feat(doctor): Add workspace-level health checks (gt-f9x.5)

Implements 6 workspace doctor checks:
- TownConfigExists: Verify mayor/town.json exists
- TownConfigValid: Validate town.json has required fields (type, version, name)
- RigsRegistryExists: Check mayor/rigs.json exists (fixable: creates empty)
- RigsRegistryValid: Verify registered rigs exist on disk (fixable: removes missing)
- MayorExists: Check mayor/ directory structure
- MayorStateValid: Validate mayor/state.json JSON (fixable: resets to default)

Added WorkspaceChecks() helper to return all workspace checks for registration.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
cheedo
2026-01-01 19:05:28 -08:00
committed by Steve Yegge
parent 1e2a068b2a
commit 3389687dc0
2 changed files with 469 additions and 0 deletions

View File

@@ -24,6 +24,14 @@ var doctorCmd = &cobra.Command{
Doctor checks for common configuration issues, missing files,
and other problems that could affect workspace operation.
Workspace checks:
- town-config-exists Check mayor/town.json exists
- town-config-valid Check mayor/town.json is valid
- rigs-registry-exists Check mayor/rigs.json exists (fixable)
- rigs-registry-valid Check registered rigs exist (fixable)
- mayor-exists Check mayor/ directory structure
- mayor-state-valid Check mayor/state.json is valid (fixable)
Infrastructure checks:
- daemon Check if daemon is running (fixable)
- boot-health Check Boot watchdog health (vet mode)
@@ -85,6 +93,9 @@ func runDoctor(cmd *cobra.Command, args []string) error {
// Create doctor and register checks
d := doctor.NewDoctor()
// Register workspace-level checks first (fundamental)
d.RegisterAll(doctor.WorkspaceChecks()...)
// Register built-in checks
d.Register(doctor.NewTownGitCheck())
d.Register(doctor.NewDaemonCheck())