fix(list): prevent nil pointer panic in watch mode with daemon (#1324)

When running `bd list -w` with the daemon active, watchIssues() was
called with nil store, causing a panic at store.SearchIssues().

In daemon mode, storage operations are handled via RPC, so the global
`store` variable is nil. The watch mode code path didn't account for
this and used `store` directly.

Fix: Call ensureDirectMode() before watchIssues() to initialize the
store. This follows the same pattern used for other commands that
need direct store access in daemon mode (e.g., graph, ship).

Fixes #1323

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Patrick Ryan
2026-01-25 20:59:35 -05:00
committed by GitHub
parent 5ed65ed6a8
commit 119774fa7d
2 changed files with 191 additions and 0 deletions

View File

@@ -1020,7 +1020,12 @@ var listCmd = &cobra.Command{
sortIssues(issues, sortBy, reverse)
// Handle watch mode (GH#654)
// Watch mode requires direct store access for file watching
if watchMode {
if err := ensureDirectMode("watch mode requires direct database access"); err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}
watchIssues(ctx, store, filter, sortBy, reverse)
return
}