fix(memory): implement GetReadyWork/GetBlockedIssues + child counters
Fixes #543, #544, #545, #546 (no-db mode regressions) Memory backend fixes: - GetReadyWork now properly excludes issues with open blocks dependencies - GetBlockedIssues now includes issues with status=blocked (even with 0 blockers) - LoadFromIssues initializes hierarchical child counters from existing IDs so repeated --parent creates bd-xxx.1, bd-xxx.2, etc. JSONL path discovery: - findJSONLPath works in no-db mode when dbPath is empty - Honors BEADS_JSONL environment variable override - Falls back to locating .beads directory Based on PR #547 by @joelklabo - cherry-picked core fixes. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -19,6 +19,7 @@ import (
|
||||
"github.com/steveyegge/beads/internal/config"
|
||||
"github.com/steveyegge/beads/internal/debug"
|
||||
"github.com/steveyegge/beads/internal/types"
|
||||
"github.com/steveyegge/beads/internal/utils"
|
||||
)
|
||||
|
||||
// outputJSON outputs data as pretty-printed JSON
|
||||
@@ -42,12 +43,26 @@ func outputJSON(v interface{}) {
|
||||
//
|
||||
// Thread-safe: No shared state access.
|
||||
func findJSONLPath() string {
|
||||
// Allow explicit override (useful in no-db mode or non-standard layouts)
|
||||
if jsonlEnv := os.Getenv("BEADS_JSONL"); jsonlEnv != "" {
|
||||
return utils.CanonicalizePath(jsonlEnv)
|
||||
}
|
||||
|
||||
// Use public API for path discovery
|
||||
jsonlPath := beads.FindJSONLPath(dbPath)
|
||||
|
||||
// In --no-db mode, dbPath may be empty. Fall back to locating the .beads directory.
|
||||
if jsonlPath == "" {
|
||||
beadsDir := beads.FindBeadsDir()
|
||||
if beadsDir == "" {
|
||||
return ""
|
||||
}
|
||||
jsonlPath = utils.FindJSONLInDir(beadsDir)
|
||||
}
|
||||
|
||||
// Ensure the directory exists (important for new databases)
|
||||
// This is the only difference from the public API - we create the directory
|
||||
dbDir := filepath.Dir(dbPath)
|
||||
dbDir := filepath.Dir(jsonlPath)
|
||||
if err := os.MkdirAll(dbDir, 0750); err != nil {
|
||||
// If we can't create the directory, return discovered path anyway
|
||||
// (the subsequent write will fail with a clearer error)
|
||||
|
||||
Reference in New Issue
Block a user