feat(doctor): add --server flag for Dolt server mode health checks (bd-dolt.2.3)

Adds bd doctor --server to diagnose Dolt server mode connections:
- Server reachability (TCP connect to host:port)
- Dolt version check (verifies it is Dolt, not vanilla MySQL)
- Database exists and is accessible
- Schema compatible (can query beads tables)
- Connection pool health metrics

Supports --json for machine-readable output.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
beads/crew/emma
2026-01-23 20:29:12 -08:00
committed by Steve Yegge
parent 433115725b
commit 66d994264b
3 changed files with 467 additions and 1 deletions

View File

@@ -58,6 +58,7 @@ var (
doctorDeep bool // full graph integrity validation
doctorGastown bool // running in gastown multi-workspace mode
gastownDuplicatesThreshold int // duplicate tolerance threshold for gastown mode
doctorServer bool // run server mode health checks
)
// ConfigKeyHintsDoctor is the config key for suppressing doctor hints
@@ -114,6 +115,14 @@ Deep Validation Mode (--deep):
- Mail thread integrity: Thread IDs reference existing issues
- Molecule integrity: Molecules have valid parent-child structures
Server Mode (--server):
Run health checks for Dolt server mode connections (bd-dolt.2.3):
- Server reachable: Can connect to configured host:port?
- Dolt version: Is it a Dolt server (not vanilla MySQL)?
- Database exists: Does the 'beads' database exist?
- Schema compatible: Can query beads tables?
- Connection pool: Pool health metrics
Examples:
bd doctor # Check current directory
bd doctor /path/to/repo # Check specific repository
@@ -129,7 +138,8 @@ Examples:
bd doctor --output diagnostics.json # Export diagnostics to file
bd doctor --check=pollution # Show potential test issues
bd doctor --check=pollution --clean # Delete test issues (with confirmation)
bd doctor --deep # Full graph integrity validation`,
bd doctor --deep # Full graph integrity validation
bd doctor --server # Dolt server mode health checks`,
Run: func(cmd *cobra.Command, args []string) {
// Use global jsonOutput set by PersistentPreRun
@@ -177,6 +187,12 @@ Examples:
return
}
// Run server mode health checks if --server flag is set
if doctorServer {
runServerHealth(absPath)
return
}
// Run diagnostics
result := runDiagnostics(absPath)
@@ -230,6 +246,7 @@ func init() {
doctorCmd.Flags().StringVar(&doctorSource, "source", "auto", "Choose source of truth for recovery: auto (detect), jsonl (prefer JSONL), db (prefer database)")
doctorCmd.Flags().BoolVar(&doctorGastown, "gastown", false, "Running in gastown multi-workspace mode (routes.jsonl is expected, higher duplicate tolerance)")
doctorCmd.Flags().IntVar(&gastownDuplicatesThreshold, "gastown-duplicates-threshold", 1000, "Duplicate tolerance threshold for gastown mode (wisps are ephemeral)")
doctorCmd.Flags().BoolVar(&doctorServer, "server", false, "Run Dolt server mode health checks (connectivity, version, schema)")
}
func runDiagnostics(path string) doctorResult {