Skip to content

refactor(cli): cross-subcommand parity (only-filter naming, --output/--strip-prefix on diff family) #538

@dekobon

Description

@dekobon

Decided (2026-06-05): standardize on --<section>-only (rename exemptions' --only-*, hidden alias 1 cycle) — breaking, 2.0. Add --output/-o + --strip-prefix to the diff family additively, pre-2.0 (batch-fixable). See the resolved-decisions comment.

Summary

Cross-subcommand inconsistencies in the bca CLI grammar. Each is a breaking
flag change → 2.0.

Findings

  1. --*-only vs --only-* section-filter naming. The two sibling read-only
    reporters disagree on word order:

    • diff-baseline: --added-only / --removed-only / --worsened-only /
      --improved-only (big-code-analysis-cli/src/lib.rs:796)
    • exemptions: --only-markers / --only-excludes / --only-baseline
      (big-code-analysis-cli/src/lib.rs:896)
      A user who learns --added-only will guess --markers-only. Pick one
      convention for both; add the old spelling as a hidden alias for one cycle.
  2. Output destination not uniform. --output/-o exists on
    metrics/ops/report/check/preproc/exemptions but not on diff
    or diff-baseline, which unconditionally write stdout
    (commands.rs write_stdout_or_die). Adding -o is additive (could ship in
    1.x), but the contract "every emitting subcommand accepts -o, stdout if
    omitted" is worth establishing deliberately at 2.0.

  3. --strip-prefix missing from the diff family. Present on report
    (lib.rs:391) and exemptions (lib.rs:894); absent from diff /
    diff-baseline, whose markdown output is meant for PR comments where long
    paths are exactly the noise --strip-prefix removes.

Why 2.0-worthy

Item 1 is a rename (breaking). Items 2–3 are additive in isolation but should be
locked into a uniform "every reporter subcommand shares the same output/path
flags" contract at the major bump. (Distinct from #513 output-format selection
and #518 --ls/--le.)

Acceptance

  • Section-filter flags use one consistent word order across diff-baseline and
    exemptions.
  • diff / diff-baseline accept --output/-o and --strip-prefix.

Part of the pre-2.0 review (#505).

Resolution

Resolved in commit 66e52cbb on branch fix/issue-538 (integration
fix/batch-2026-06-06).

The exemptions section filters were renamed to the
--<section>-only suffix idiom (--markers-only / --excludes-only /
--baseline-only), matching the existing diff-baseline filters. The
prior --only-* spellings remain as hidden clap aliases for one
release cycle (clap alias = "...", which is excluded from --help).
The Rust fields were renamed to match (internal, non-breaking). Man
pages regenerated; book docs updated with a deprecated-alias note.

This is a breaking CLI flag rename deferred to 2.0; recorded in
CHANGELOG.md [Unreleased] marked (breaking) by the orchestrator.

The additive --output / --strip-prefix parity that was originally
bundled with this issue is split out to #544 and is not part of this
change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions