Skip to content

docs(cli): unify/clarify list-merge semantics (--paths-from union vs manifest replace) #539

@dekobon

Description

@dekobon

Decided (2026-06-05): semantic split — targets (paths/include) replace the manifest, excludes (exclude/check_exclude) accumulate; --x/--x-from union; --no-config escape hatch. Add --output/-o to strip-comments. Now a behavior change (2.0), not docs-only. See the resolved-decisions comment.

Summary

Two different list-merge mental models coexist in the CLI/manifest surface, and
they are not documented in one place. This is a behavior-contract clarification;
any change to the merge rule itself is breaking → 2.0.

Evidence

  • --paths-from doc: "Combined as a union with any --paths values"
    (big-code-analysis-cli/src/lib.rs:243); --exclude-from likewise "unioned"
    (lib.rs:253).
  • Manifest list keys are CLI-replaces-manifest: paths / include /
    exclude / check_exclude (manifest.rs:239, manifest.rs:313; "an explicit
    --check-exclude replaces the bca.toml list", lib.rs:706).

So -from files union with their sibling flag, but a manifest list is replaced
by any CLI value. A user reasonably expects --paths + bca.toml paths to also
union. (See memory: "Manifest keys are CLI-replaces-manifest, not union".)

Secondary

strip-comments has no --output/-o; its only sink toggle is --in-place
(lib.rs:447), a bespoke idiom vs the "--output, stdout if omitted" pattern
used everywhere else. Likely keep --in-place (correct verb for multi-file
rewrite) but document the routing exception.

Proposed change

  1. Document the merge rule explicitly in one place: "-from flags union with
    their sibling flag; manifest list keys are replaced by any CLI value."
  2. Decide at 2.0 whether to keep the split or make manifest list-keys union too
    (the behavior change is breaking).
  3. Document strip-comments's --in-place-only routing as a deliberate
    exception.

Acceptance

  • One authoritative description of list-merge semantics in the CLI docs /
    STABILITY.md.

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

Resolution

Implemented on fix/issue-539 (commit 7592467), 2.0 line.

Semantic split by list meaning (#539):

  • Positive scope keys (paths, include): explicit CLI value
    REPLACES the manifest (unchanged — if x.is_empty() fallback kept).
  • Negative filter keys (exclude, [check] exclude): CLI values now
    UNION with the manifest list (changed; previously CLI replaced).
    Dedup preserves order, CLI patterns first.
  • --x / --x-from continue to union with each other.
  • --no-config still bypasses the manifest entirely.

strip-comments --output/-o added for single-file output
routing (stdout when omitted); --in-place still drives multi-file
rewrites; the two are mutually exclusive (clap conflicts_with).

Docs updated in one authoritative place: STABILITY.md (new
"CLI / manifest list-merge semantics" section), the book
(local-gates.md, check.md, exporting-data.md), and the
--exclude / --check-exclude / strip-comments flag help. Man
pages regenerated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions