From 5c1cd2b9fa1c16a3ec1e63444de7d72d5ae68375 Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Mon, 29 Dec 2025 17:51:55 -0800 Subject: [PATCH] feat: add default limit of 50 to bd list (bd-v5fn, GH#788) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes: - Default --limit changed from 0 (unlimited) to 50 - --limit 0 explicitly means unlimited (override default) - Show truncation hint when results are limited: "Showing N issues (use --limit 0 for all)" This protects agents and humans from overwhelming output. Follows precedent from gh cli (30) and jira-cli (50). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- cmd/bd/list.go | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/cmd/bd/list.go b/cmd/bd/list.go index fb97af92..9adc4c04 100644 --- a/cmd/bd/list.go +++ b/cmd/bd/list.go @@ -390,8 +390,15 @@ var listCmd = &cobra.Command{ } } + // Handle limit: --limit 0 means unlimited (explicit override) + // Otherwise use the value (default 50 or user-specified) + effectiveLimit := limit + if cmd.Flags().Changed("limit") && limit == 0 { + effectiveLimit = 0 // Explicit unlimited + } + filter := types.IssueFilter{ - Limit: limit, + Limit: effectiveLimit, } if status != "" && status != "all" { s := types.Status(status) @@ -720,6 +727,10 @@ var listCmd = &cobra.Command{ } } } + // Show truncation hint if we hit the limit (GH#788) + if effectiveLimit > 0 && len(issues) == effectiveLimit { + fmt.Fprintf(os.Stderr, "\nShowing %d issues (use --limit 0 for all)\n", effectiveLimit) + } return } @@ -755,6 +766,10 @@ var listCmd = &cobra.Command{ // Handle pretty format (GH#654) if prettyFormat { displayPrettyList(issues, false) + // Show truncation hint if we hit the limit (GH#788) + if effectiveLimit > 0 && len(issues) == effectiveLimit { + fmt.Fprintf(os.Stderr, "\nShowing %d issues (use --limit 0 for all)\n", effectiveLimit) + } return } @@ -870,6 +885,11 @@ var listCmd = &cobra.Command{ } } + // Show truncation hint if we hit the limit (GH#788) + if effectiveLimit > 0 && len(issues) == effectiveLimit { + fmt.Fprintf(os.Stderr, "\nShowing %d issues (use --limit 0 for all)\n", effectiveLimit) + } + // Show tip after successful list (direct mode only) maybeShowTip(store) }, @@ -884,7 +904,7 @@ func init() { listCmd.Flags().StringSlice("label-any", []string{}, "Filter by labels (OR: must have AT LEAST ONE). Can combine with --label") listCmd.Flags().String("title", "", "Filter by title text (case-insensitive substring match)") listCmd.Flags().String("id", "", "Filter by specific issue IDs (comma-separated, e.g., bd-1,bd-5,bd-10)") - listCmd.Flags().IntP("limit", "n", 0, "Limit results") + listCmd.Flags().IntP("limit", "n", 50, "Limit results (default 50, use 0 for unlimited)") listCmd.Flags().String("format", "", "Output format: 'digraph' (for golang.org/x/tools/cmd/digraph), 'dot' (Graphviz), or Go template") listCmd.Flags().Bool("all", false, "Show all issues (default behavior; flag provided for CLI familiarity)") listCmd.Flags().Bool("long", false, "Show detailed multi-line output for each issue")