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:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user