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
+7 -7
View File
@@ -48,19 +48,19 @@ func NewManager(r *rig.Rig, g *git.Git) *Manager {
// Use the rig root for beads operations (rig-level beads at .beads/)
rigPath := r.Path
// Try to load rig config for namepool settings
rigConfigPath := filepath.Join(r.Path, ".gastown", "config.json")
// Try to load rig settings for namepool config
settingsPath := filepath.Join(r.Path, "settings", "config.json")
var pool *NamePool
rigConfig, err := config.LoadRigConfig(rigConfigPath)
if err == nil && rigConfig.Namepool != nil {
settings, err := config.LoadRigSettings(settingsPath)
if err == nil && settings.Namepool != nil {
// Use configured namepool settings
pool = NewNamePoolWithConfig(
r.Path,
r.Name,
rigConfig.Namepool.Style,
rigConfig.Namepool.Names,
rigConfig.Namepool.MaxBeforeNumbering,
settings.Namepool.Style,
settings.Namepool.Names,
settings.Namepool.MaxBeforeNumbering,
)
} else {
// Use defaults
+2 -2
View File
@@ -95,7 +95,7 @@ func NewNamePool(rigPath, rigName string) *NamePool {
InUse: make(map[string]bool),
OverflowNext: DefaultPoolSize + 1,
MaxSize: DefaultPoolSize,
stateFile: filepath.Join(rigPath, ".gastown", "namepool.json"),
stateFile: filepath.Join(rigPath, ".runtime", "namepool-state.json"),
}
}
@@ -115,7 +115,7 @@ func NewNamePoolWithConfig(rigPath, rigName, theme string, customNames []string,
InUse: make(map[string]bool),
OverflowNext: maxSize + 1,
MaxSize: maxSize,
stateFile: filepath.Join(rigPath, ".gastown", "namepool.json"),
stateFile: filepath.Join(rigPath, ".runtime", "namepool-state.json"),
}
}
+1 -1
View File
@@ -308,7 +308,7 @@ func TestNamePool_StateFilePath(t *testing.T) {
}
// Verify file was created in expected location
expectedPath := filepath.Join(tmpDir, ".gastown", "namepool.json")
expectedPath := filepath.Join(tmpDir, ".runtime", "namepool-state.json")
if _, err := os.Stat(expectedPath); err != nil {
t.Errorf("state file not found at expected path: %v", err)
}