feat(rig): add route from rig beads to town beads
Add AppendRouteToDir helper and use it to add hq-* route during rig initialization. This allows rig beads to resolve role beads and other hq-* prefixed beads stored in town beads. Uses safe append pattern (load, merge, write) instead of overwriting to avoid clobbering future rig routes. Supersedes PR #184 with proper implementation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
Steve Yegge
parent
e8d27e7212
commit
03fef16748
@@ -57,7 +57,12 @@ func LoadRoutes(beadsDir string) ([]Route, error) {
|
|||||||
// If the prefix already exists, it updates the path.
|
// If the prefix already exists, it updates the path.
|
||||||
func AppendRoute(townRoot string, route Route) error {
|
func AppendRoute(townRoot string, route Route) error {
|
||||||
beadsDir := filepath.Join(townRoot, ".beads")
|
beadsDir := filepath.Join(townRoot, ".beads")
|
||||||
|
return AppendRouteToDir(beadsDir, route)
|
||||||
|
}
|
||||||
|
|
||||||
|
// AppendRouteToDir appends a route to routes.jsonl in the given beads directory.
|
||||||
|
// If the prefix already exists, it updates the path.
|
||||||
|
func AppendRouteToDir(beadsDir string, route Route) error {
|
||||||
// Load existing routes
|
// Load existing routes
|
||||||
routes, err := LoadRoutes(beadsDir)
|
routes, err := LoadRoutes(beadsDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -547,6 +547,15 @@ func (m *Manager) initBeads(rigPath, prefix string) error {
|
|||||||
// Ignore errors - fingerprint is optional for functionality
|
// Ignore errors - fingerprint is optional for functionality
|
||||||
_, _ = migrateCmd.CombinedOutput()
|
_, _ = migrateCmd.CombinedOutput()
|
||||||
|
|
||||||
|
// Add route from rig beads to town beads for cross-database resolution.
|
||||||
|
// This allows rig beads to resolve hq-* prefixed beads (role beads, etc.)
|
||||||
|
// that are stored in town beads.
|
||||||
|
townRoute := beads.Route{Prefix: "hq-", Path: ".."}
|
||||||
|
if err := beads.AppendRouteToDir(beadsDir, townRoute); err != nil {
|
||||||
|
// Non-fatal: role slot set will fail but agent beads still work
|
||||||
|
fmt.Printf(" ⚠ Could not add route to town beads: %v\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user