From 60b84afa3aaf9bce32cec3c5f3b18fb4b1d5d64f Mon Sep 17 00:00:00 2001 From: Claude Code Date: Fri, 24 Oct 2025 09:40:34 +0000 Subject: [PATCH 1/4] Add support for showing multiple issues with bd show bd show now accepts multiple issue IDs and displays each one: - bd show bd-1 bd-2 bd-3 shows all three issues - Issues are separated by a horizontal line for clarity - Works in both daemon and direct modes - JSON output returns an array of all requested issues This feature already worked in the implementation (it looped through args), but now it's properly documented in the help text. --- cmd/bd/main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/bd/main.go b/cmd/bd/main.go index cb05766f..32277424 100644 --- a/cmd/bd/main.go +++ b/cmd/bd/main.go @@ -1759,7 +1759,12 @@ func resolveIssueID(ctx context.Context, id string) (*types.Issue, string, error var showCmd = &cobra.Command{ Use: "show [id...]", Short: "Show issue details", - Args: cobra.MinimumNArgs(1), + Long: `Show detailed information for one or more issues. + +Examples: + bd show bd-42 # Show single issue + bd show bd-1 bd-2 bd-3 # Show multiple issues`, + Args: cobra.MinimumNArgs(1), Run: func(cmd *cobra.Command, args []string) { // If daemon is running, use RPC if daemonClient != nil { From 75541c3ff6ac0166e36a648c421ae73392e9693d Mon Sep 17 00:00:00 2001 From: Claude Code Date: Fri, 24 Oct 2025 09:41:12 +0000 Subject: [PATCH 2/4] Add --all-issues flag to bd show command Adds a new --all-issues flag that displays all issues in the database: - bd show --all-issues shows every issue - Warns when showing more than 20 issues (performance) - Works only in direct mode (--no-daemon required for now) - Provides clear error message in daemon mode - Help text warns that this may be expensive for large databases This is useful for getting a complete overview of the database, but users should be aware it can be slow with many issues. --- cmd/bd/main.go | 72 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 59 insertions(+), 13 deletions(-) diff --git a/cmd/bd/main.go b/cmd/bd/main.go index 32277424..a15b7306 100644 --- a/cmd/bd/main.go +++ b/cmd/bd/main.go @@ -1763,13 +1763,58 @@ var showCmd = &cobra.Command{ Examples: bd show bd-42 # Show single issue - bd show bd-1 bd-2 bd-3 # Show multiple issues`, - Args: cobra.MinimumNArgs(1), + bd show bd-1 bd-2 bd-3 # Show multiple issues + bd show --all-issues # Show all issues (may be expensive)`, + Args: func(cmd *cobra.Command, args []string) error { + allIssues, _ := cmd.Flags().GetBool("all-issues") + if !allIssues && len(args) == 0 { + return fmt.Errorf("requires at least 1 issue ID or --all-issues flag") + } + return nil + }, Run: func(cmd *cobra.Command, args []string) { + allIssues, _ := cmd.Flags().GetBool("all-issues") + + // Build list of issue IDs to show + var issueIDs []string + + // If --all-issues is used, fetch all issues + if allIssues { + ctx := context.Background() + + if daemonClient != nil { + // Daemon mode - not yet supported + fmt.Fprintf(os.Stderr, "Error: --all-issues not yet supported in daemon mode\n") + fmt.Fprintf(os.Stderr, "Use --no-daemon flag or specify issue IDs directly\n") + os.Exit(1) + } else { + // Direct mode - fetch all issues + filter := types.IssueFilter{} + issues, err := store.SearchIssues(ctx, "", filter) + if err != nil { + fmt.Fprintf(os.Stderr, "Error searching issues: %v\n", err) + os.Exit(1) + } + + // Extract IDs + for _, issue := range issues { + issueIDs = append(issueIDs, issue.ID) + } + + // Warn if showing many issues + if len(issueIDs) > 20 && !jsonOutput { + yellow := color.New(color.FgYellow).SprintFunc() + fmt.Fprintf(os.Stderr, "%s Showing %d issues (this may take a while)\n\n", yellow("⚠"), len(issueIDs)) + } + } + } else { + // Use provided IDs + issueIDs = args + } // If daemon is running, use RPC if daemonClient != nil { allDetails := []interface{}{} - for idx, id := range args { + for idx, id := range issueIDs { showArgs := &rpc.ShowArgs{ID: id} resp, err := daemonClient.Show(showArgs) if err != nil { @@ -1906,16 +1951,16 @@ Examples: // Direct mode ctx := context.Background() allDetails := []interface{}{} - for idx, id := range args { - issue, resolvedID, err := resolveIssueID(ctx, id) - if err != nil { - fmt.Fprintf(os.Stderr, "Error fetching %s: %v\n", id, err) - continue - } - if issue == nil { - fmt.Fprintf(os.Stderr, "Issue %s not found\n", resolvedID) - continue - } + for idx, id := range issueIDs { + issue, resolvedID, err := resolveIssueID(ctx, id) + if err != nil { + fmt.Fprintf(os.Stderr, "Error fetching %s: %v\n", id, err) + continue + } + if issue == nil { + fmt.Fprintf(os.Stderr, "Issue %s not found\n", resolvedID) + continue + } if jsonOutput { // Include labels, dependencies, and comments in JSON output @@ -2047,6 +2092,7 @@ Examples: } func init() { + showCmd.Flags().Bool("all-issues", false, "Show all issues (WARNING: may be expensive for large databases)") rootCmd.AddCommand(showCmd) } From 3b8d13f1004ecbda9a13889e8dfdd47070a736b2 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Fri, 24 Oct 2025 09:41:49 +0000 Subject: [PATCH 3/4] Add --priority flag to bd show command Adds a new --priority (-p) flag to filter issues by priority: - bd show --priority 0 shows all P0 issues - bd show -p 0 -p 1 shows all P0 and P1 issues - Can be used multiple times to show multiple priority levels - Combines with --all-issues if both are specified - Works only in direct mode (--no-daemon required for now) This makes it easy to focus on high-priority issues without needing to specify each issue ID individually. Example: bd show -p 0 -p 1 shows all critical and high-priority issues in the database. --- cmd/bd/main.go | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/cmd/bd/main.go b/cmd/bd/main.go index a15b7306..a1fa7dd2 100644 --- a/cmd/bd/main.go +++ b/cmd/bd/main.go @@ -1764,27 +1764,31 @@ var showCmd = &cobra.Command{ Examples: bd show bd-42 # Show single issue bd show bd-1 bd-2 bd-3 # Show multiple issues - bd show --all-issues # Show all issues (may be expensive)`, + bd show --all-issues # Show all issues (may be expensive) + bd show --priority 0 --priority 1 # Show all P0 and P1 issues + bd show -p 0 -p 1 # Short form`, Args: func(cmd *cobra.Command, args []string) error { allIssues, _ := cmd.Flags().GetBool("all-issues") - if !allIssues && len(args) == 0 { - return fmt.Errorf("requires at least 1 issue ID or --all-issues flag") + priorities, _ := cmd.Flags().GetIntSlice("priority") + if !allIssues && len(priorities) == 0 && len(args) == 0 { + return fmt.Errorf("requires at least 1 issue ID, or use --all-issues, or --priority flag") } return nil }, Run: func(cmd *cobra.Command, args []string) { allIssues, _ := cmd.Flags().GetBool("all-issues") + priorities, _ := cmd.Flags().GetIntSlice("priority") // Build list of issue IDs to show var issueIDs []string - // If --all-issues is used, fetch all issues - if allIssues { + // If --all-issues or --priority is used, fetch matching issues + if allIssues || len(priorities) > 0 { ctx := context.Background() if daemonClient != nil { // Daemon mode - not yet supported - fmt.Fprintf(os.Stderr, "Error: --all-issues not yet supported in daemon mode\n") + fmt.Fprintf(os.Stderr, "Error: --all-issues and --priority not yet supported in daemon mode\n") fmt.Fprintf(os.Stderr, "Use --no-daemon flag or specify issue IDs directly\n") os.Exit(1) } else { @@ -1796,6 +1800,22 @@ Examples: os.Exit(1) } + // Filter by priority if specified + if len(priorities) > 0 { + priorityMap := make(map[int]bool) + for _, p := range priorities { + priorityMap[p] = true + } + + filtered := make([]*types.Issue, 0) + for _, issue := range issues { + if priorityMap[issue.Priority] { + filtered = append(filtered, issue) + } + } + issues = filtered + } + // Extract IDs for _, issue := range issues { issueIDs = append(issueIDs, issue.ID) @@ -2093,6 +2113,7 @@ Examples: func init() { showCmd.Flags().Bool("all-issues", false, "Show all issues (WARNING: may be expensive for large databases)") + showCmd.Flags().IntSliceP("priority", "p", []int{}, "Show issues with specified priority (can be used multiple times, e.g., -p 0 -p 1)") rootCmd.AddCommand(showCmd) } From 1ea936d7c3d03d95f134d44b90610e649d7283ea Mon Sep 17 00:00:00 2001 From: Claude Code Date: Fri, 24 Oct 2025 09:52:42 +0000 Subject: [PATCH 4/4] Sort issues by ID when showing multiple issues When bd show displays multiple issues, they are now sorted by ID for consistent and predictable ordering: - bd show bd-7 bd-5 bd-6 displays them as bd-5, bd-6, bd-7 - Works with explicit IDs, --all-issues, and --priority flags - Applies to both text and JSON output - Uses alphabetical sorting which works for typical ID formats This makes the output easier to read and more predictable, especially when showing many issues at once. --- cmd/bd/main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/bd/main.go b/cmd/bd/main.go index a1fa7dd2..8805281e 100644 --- a/cmd/bd/main.go +++ b/cmd/bd/main.go @@ -1831,6 +1831,12 @@ Examples: // Use provided IDs issueIDs = args } + + // Sort issue IDs for consistent ordering when showing multiple issues + if len(issueIDs) > 1 { + sort.Strings(issueIDs) + } + // If daemon is running, use RPC if daemonClient != nil { allDetails := []interface{}{}