feat: Add prefix-based routing support for beads (gt-hrgpg)

- Add internal/beads/routes.go with helpers to manage routes.jsonl
- Update gt rig add to auto-append routes for new rigs
- Add prefix-conflict check to gt doctor

bd already has prefix routing via routes.jsonl - this wires up
Gas Town to maintain routes when rigs are added and detect conflicts.

🤖 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-26 19:54:26 -08:00
parent 43a848b719
commit 4405475c9b
4 changed files with 236 additions and 0 deletions

View File

@@ -211,6 +211,18 @@ func runRigAdd(cmd *cobra.Command, args []string) error {
return fmt.Errorf("saving rigs config: %w", err)
}
// Add route to town-level routes.jsonl for prefix-based routing
if newRig.Config.Prefix != "" {
route := beads.Route{
Prefix: newRig.Config.Prefix + "-",
Path: name + "/mayor/rig",
}
if err := beads.AppendRoute(townRoot, route); err != nil {
// Non-fatal: routing will still work, just not from town root
fmt.Printf(" %s Could not update routes.jsonl: %v\n", style.Warning.Render("!"), err)
}
}
elapsed := time.Since(startTime)
fmt.Printf("\n%s Rig created in %.1fs\n", style.Success.Render("✓"), elapsed.Seconds())