feat(doctor): add prefix mismatch detection check (gt-17wdl)

Add a new 'prefix-mismatch' check to gt doctor that detects when the
prefix configured in rigs.json differs from what routes.jsonl actually
uses for a rig's beads.

This can happen when:
- deriveBeadsPrefix() generates a different prefix than what's in the DB
- Someone manually edited rigs.json with the wrong prefix
- Beads were initialized before auto-derive existed with a different prefix

The check is fixable: running 'gt doctor --fix' will update rigs.json
to match the actual prefixes from routes.jsonl.

Includes comprehensive tests for:
- No routes (nothing to check)
- No rigs.json (nothing to check)
- Matching prefixes (OK)
- Mismatched prefixes (Warning)
- Fix functionality

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gastown/crew/jack
2026-01-05 21:30:11 -08:00
committed by Steve Yegge
parent cf1eac8521
commit 637df1d289
3 changed files with 426 additions and 0 deletions

View File

@@ -60,6 +60,7 @@ Rig checks (with --rig flag):
Routing checks (fixable):
- routes-config Check beads routing configuration
- prefix-mismatch Detect rigs.json vs routes.jsonl prefix mismatches (fixable)
Session hook checks:
- session-hooks Check settings.json use session-start.sh
@@ -111,6 +112,7 @@ func runDoctor(cmd *cobra.Command, args []string) error {
d.Register(doctor.NewBeadsDatabaseCheck())
d.Register(doctor.NewBdDaemonCheck())
d.Register(doctor.NewPrefixConflictCheck())
d.Register(doctor.NewPrefixMismatchCheck())
d.Register(doctor.NewRoutesCheck())
d.Register(doctor.NewOrphanSessionCheck())
d.Register(doctor.NewOrphanProcessCheck())