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:
@@ -17,7 +17,7 @@ type State struct {
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
}
|
||||
|
||||
// Touch updates the keepalive file in the workspace's .gastown directory.
|
||||
// Touch updates the keepalive file in the workspace's .runtime directory.
|
||||
// It silently ignores errors (best-effort signaling).
|
||||
func Touch(command string) {
|
||||
TouchWithArgs(command, nil)
|
||||
@@ -43,10 +43,10 @@ func TouchWithArgs(command string, args []string) {
|
||||
// TouchInWorkspace updates the keepalive file in a specific workspace.
|
||||
// It silently ignores errors (best-effort signaling).
|
||||
func TouchInWorkspace(workspaceRoot, command string) {
|
||||
gastown := filepath.Join(workspaceRoot, ".gastown")
|
||||
runtimeDir := filepath.Join(workspaceRoot, ".runtime")
|
||||
|
||||
// Ensure .gastown directory exists
|
||||
if err := os.MkdirAll(gastown, 0755); err != nil {
|
||||
// Ensure .runtime directory exists
|
||||
if err := os.MkdirAll(runtimeDir, 0755); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -60,14 +60,14 @@ func TouchInWorkspace(workspaceRoot, command string) {
|
||||
return
|
||||
}
|
||||
|
||||
keepalivePath := filepath.Join(gastown, "keepalive.json")
|
||||
keepalivePath := filepath.Join(runtimeDir, "keepalive.json")
|
||||
_ = os.WriteFile(keepalivePath, data, 0644)
|
||||
}
|
||||
|
||||
// Read returns the current keepalive state for the workspace.
|
||||
// Returns nil if the file doesn't exist or can't be read.
|
||||
func Read(workspaceRoot string) *State {
|
||||
keepalivePath := filepath.Join(workspaceRoot, ".gastown", "keepalive.json")
|
||||
keepalivePath := filepath.Join(workspaceRoot, ".runtime", "keepalive.json")
|
||||
|
||||
data, err := os.ReadFile(keepalivePath)
|
||||
if err != nil {
|
||||
|
||||
@@ -86,12 +86,12 @@ func TestDirectoryCreation(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
workDir := filepath.Join(tmpDir, "some", "nested", "workspace")
|
||||
|
||||
// Touch should create .gastown directory
|
||||
// Touch should create .runtime directory
|
||||
TouchInWorkspace(workDir, "gt test")
|
||||
|
||||
// Verify directory was created
|
||||
gastown := filepath.Join(workDir, ".gastown")
|
||||
if _, err := os.Stat(gastown); os.IsNotExist(err) {
|
||||
t.Error("expected .gastown directory to be created")
|
||||
runtimeDir := filepath.Join(workDir, ".runtime")
|
||||
if _, err := os.Stat(runtimeDir); os.IsNotExist(err) {
|
||||
t.Error("expected .runtime directory to be created")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user