Implement three-tier config architecture (gt-k1lr tasks 1-5)

**Architecture changes:**
- Renamed `.gastown/` → `.runtime/` for runtime state (gitignored)
- Added `settings/` directory for rig behavioral config (git-tracked)
- Added `mayor/config.json` for town-level config (MayorConfig type)
- Separated RigConfig (identity) from RigSettings (behavioral)

**File location changes:**
- Town runtime: `~/.gastown/*` → `~/.runtime/*`
- Rig runtime: `<rig>/.gastown/*` → `<rig>/.runtime/*`
- Rig config: `<rig>/.gastown/config.json` → `<rig>/settings/config.json`
- Namepool state: `namepool.json` → `namepool-state.json`

**New types:**
- MayorConfig: town-level behavioral config
- RigSettings: rig behavioral config (merge_queue, theme, namepool)
- RigConfig now identity-only (name, git_url, beads, created_at)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-22 01:22:27 -08:00
parent f16ce2d634
commit 97e0535bfe
20 changed files with 449 additions and 201 deletions

View File

@@ -10,6 +10,7 @@ import (
"github.com/spf13/cobra"
"github.com/steveyegge/gastown/internal/beads"
"github.com/steveyegge/gastown/internal/config"
"github.com/steveyegge/gastown/internal/git"
"github.com/steveyegge/gastown/internal/style"
"github.com/steveyegge/gastown/internal/workspace"
@@ -397,33 +398,17 @@ func filterMRsByTarget(mrs []*beads.Issue, targetBranch string) []*beads.Issue {
return result
}
// getTestCommand returns the test command from rig config.
// getTestCommand returns the test command from rig settings.
func getTestCommand(rigPath string) string {
configPath := filepath.Join(rigPath, "config.json")
data, err := os.ReadFile(configPath)
settingsPath := filepath.Join(rigPath, "settings", "config.json")
settings, err := config.LoadRigSettings(settingsPath)
if err != nil {
// Try .gastown/config.json as fallback
configPath = filepath.Join(rigPath, ".gastown", "config.json")
data, err = os.ReadFile(configPath)
if err != nil {
return ""
}
}
var rawConfig struct {
MergeQueue struct {
TestCommand string `json:"test_command"`
} `json:"merge_queue"`
TestCommand string `json:"test_command"` // Legacy fallback
}
if err := json.Unmarshal(data, &rawConfig); err != nil {
return ""
}
if rawConfig.MergeQueue.TestCommand != "" {
return rawConfig.MergeQueue.TestCommand
if settings.MergeQueue != nil && settings.MergeQueue.TestCommand != "" {
return settings.MergeQueue.TestCommand
}
return rawConfig.TestCommand
return ""
}
// runTestCommand executes a test command in the given directory.