From 92f929329760ffaa49d49503d3ff1a27425d2d3f Mon Sep 17 00:00:00 2001 From: postoso Date: Wed, 2 Sep 2026 21:12:46 -0400 Subject: [PATCH] fix(cli): accept --flat on bd ready as an alias for --plain (#5724) `bd list --flat` disables the tree view; `bd ready --plain` does the same thing under a different name. A user who learns the flag from bd list and tries `bd ready --flat` gets "unknown flag: --flat" and exit 1, with nothing in the error pointing at --plain. Register --flat on ready and fold it into the existing plainFormat choice in gatherReadyInput, which is the one place both routes parse the command's flags, so the direct and proxied listings pick it up together. --plain stays the canonical spelling and its behavior is unchanged. Generated CLI docs are not regenerated: docs/cli-docs.pin builds them from tag v1.1.0, not HEAD. ./scripts/check-cli-docs-drift.sh --base main and ./scripts/check-doc-flags.sh both pass. Co-authored-by: postoso --- cmd/bd/ready.go | 1 + cmd/bd/ready_input.go | 3 +++ cmd/bd/ready_input_test.go | 27 +++++++++++++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/cmd/bd/ready.go b/cmd/bd/ready.go index b529d3f20..8cf480a82 100644 --- a/cmd/bd/ready.go +++ b/cmd/bd/ready.go @@ -732,6 +732,7 @@ func init() { readyCmd.Flags().String("mol-type", "", "Filter by molecule type: swarm, patrol, or work") readyCmd.Flags().Bool("pretty", true, "Display issues in a tree format with status/priority symbols") readyCmd.Flags().Bool("plain", false, "Display issues as a plain numbered list") + readyCmd.Flags().Bool("flat", false, "Alias for --plain, spelled the way bd list spells it") readyCmd.Flags().Bool("include-deferred", false, "Include issues with future defer_until timestamps") readyCmd.Flags().Bool("include-ephemeral", false, "Include ephemeral issues (wisps) in results") readyCmd.Flags().Bool("gated", false, "Find molecules ready for gate-resume dispatch") diff --git a/cmd/bd/ready_input.go b/cmd/bd/ready_input.go index 04baf9fe1..0643ae3bd 100644 --- a/cmd/bd/ready_input.go +++ b/cmd/bd/ready_input.go @@ -63,6 +63,9 @@ func gatherReadyInput(cmd *cobra.Command, resolveCap func(*cobra.Command) (int, in.Brief, _ = cmd.Flags().GetBool("brief") in.prettyFormat, _ = cmd.Flags().GetBool("pretty") in.plainFormat, _ = cmd.Flags().GetBool("plain") + if flat, _ := cmd.Flags().GetBool("flat"); flat { + in.plainFormat = true + } in.jsonOut = jsonOutput limit, _ := cmd.Flags().GetInt("limit") diff --git a/cmd/bd/ready_input_test.go b/cmd/bd/ready_input_test.go index d189b53e8..1345161ae 100644 --- a/cmd/bd/ready_input_test.go +++ b/cmd/bd/ready_input_test.go @@ -469,6 +469,33 @@ func TestGatherReadyInputIgnoresNegativeOffset(t *testing.T) { } } +// TestGatherReadyInputFlatAliasesPlain pins the flag-name parity with +// `bd list --flat`. Both spellings have to land on plainFormat, because that +// one field is where the direct route and the proxied route each build their +// usePlain choice. +func TestGatherReadyInputFlatAliasesPlain(t *testing.T) { + for _, tc := range []struct { + name string + args []string + want bool + }{ + {name: "neither", args: nil, want: false}, + {name: "plain", args: []string{"--plain"}, want: true}, + {name: "flat", args: []string{"--flat"}, want: true}, + {name: "both", args: []string{"--plain", "--flat"}, want: true}, + } { + t.Run(tc.name, func(t *testing.T) { + got := runGatherReadyInput(t, newReadyFlagsCommand(t, tc.args...), nil) + if got.err != nil { + t.Fatalf("gatherReadyInput(%v) = %v, want no error", tc.args, got.err) + } + if got.in.plainFormat != tc.want { + t.Errorf("plainFormat = %v, want %v", got.in.plainFormat, tc.want) + } + }) + } +} + // TestGatherReadyInputKeepsDirectoryLabelVerbatim pins GH#541's label against // the collapse into workapi. The configured label is not user input: `bd ready` // has always put it on the filter exactly as configured, so it must not be