feat: add --parent flag to bd list command (bd-yqhh)

Filters issues by parent issue ID using parent-child dependencies.

Example: bd list --parent=bd-xyz --status=open

Changes:
- Add ParentID field to IssueFilter type
- Add --parent flag to list command
- Forward parent filter through RPC
- Implement filtering in SQLite and memory storage

🤖 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-23 02:10:26 -08:00
parent a3e967b956
commit 14e1f5a2e0
7 changed files with 51 additions and 0 deletions

View File

@@ -148,6 +148,9 @@ var listCmd = &cobra.Command{
// Template filtering (beads-1ra)
includeTemplates, _ := cmd.Flags().GetBool("include-templates")
// Parent filtering (bd-yqhh)
parentID, _ := cmd.Flags().GetString("parent")
// Use global jsonOutput set by PersistentPreRun
// Normalize labels: trim, dedupe, remove empty
@@ -311,6 +314,11 @@ var listCmd = &cobra.Command{
filter.IsTemplate = &isTemplate
}
// Parent filtering (bd-yqhh): filter children by parent issue
if parentID != "" {
filter.ParentID = &parentID
}
// Check database freshness before reading (bd-2q6d, bd-c4rq)
// Skip check when using daemon (daemon auto-imports on staleness)
ctx := rootCtx
@@ -392,6 +400,9 @@ var listCmd = &cobra.Command{
// Template filtering (beads-1ra)
listArgs.IncludeTemplates = includeTemplates
// Parent filtering (bd-yqhh)
listArgs.ParentID = parentID
resp, err := daemonClient.List(listArgs)
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
@@ -666,6 +677,9 @@ func init() {
// Template filtering (beads-1ra): exclude templates by default
listCmd.Flags().Bool("include-templates", false, "Include template molecules in output")
// Parent filtering (bd-yqhh): filter children by parent issue
listCmd.Flags().String("parent", "", "Filter by parent issue ID (shows children of specified issue)")
// Note: --json flag is defined as a persistent flag in main.go, not here
rootCmd.AddCommand(listCmd)
}