fix: Bypass daemon for routed IDs in show command (bd-uu8p)

When an ID needs routing to a different beads directory, the daemon
cannot resolve it. Now we check needsRouting() before daemon resolution
and handle routed IDs via direct mode with routing.

🤖 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 14:54:29 -08:00
parent f11ad08ad9
commit a9237741d2
2 changed files with 78 additions and 4 deletions

View File

@@ -164,3 +164,20 @@ func getRoutedStoreForID(ctx context.Context, id string) (*routing.RoutedStorage
beadsDir := filepath.Dir(dbPath)
return routing.GetRoutedStorageForID(ctx, id, beadsDir)
}
// needsRouting checks if an ID would be routed to a different beads directory.
// This is used to decide whether to bypass the daemon for cross-repo lookups.
func needsRouting(id string) bool {
if dbPath == "" {
return false
}
beadsDir := filepath.Dir(dbPath)
targetDir, routed, err := routing.ResolveBeadsDirForID(context.Background(), id, beadsDir)
if err != nil || !routed {
return false
}
// Check if the routed directory is different from the current one
return targetDir != beadsDir
}