Skip to content

feat(validator): deprecate --all in favor of --unmodified in bit validate - #10560

Merged
davidfirst merged 5 commits into
masterfrom
validate-unmodified-flag
Aug 4, 2026
Merged

feat(validator): deprecate --all in favor of --unmodified in bit validate#10560
davidfirst merged 5 commits into
masterfrom
validate-unmodified-flag

Conversation

@davidfirst

Copy link
Copy Markdown
Member

bit validate used --all to validate all components. The related commands bit test and bit check-types use --unmodified for the same function. They show --all as deprecated.

This change makes bit validate consistent with them:

  • Add the --unmodified (-u) flag. Use it to validate all components, not only new and modified ones.
  • Keep --all (-a) as a deprecated alias. It shows a deprecation warning and behaves as --unmodified.
  • Update the e2e tests to cover both flags.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Deprecate bit validate --all in favor of --unmodified (with e2e coverage)

✨ Enhancement 🧪 Tests 🕐 10-20 Minutes

Grey Divider

AI Description

• Add --unmodified/-u to validate all components, matching other CLI commands.
• Keep --all/-a as a deprecated alias that warns and maps to --unmodified.
• Extend e2e coverage to assert behavior and deprecation messaging for both flags.
Diagram

graph TD
  U(["User"]) --> VC["ValidateCmd"] --> WS["Workspace.getComponentsByUserInput"] --> CL[("Components list")]
  VC --> LG["Logger"] --> DM["Deprecation warning"]
  CL --> VM["ValidatorMain.validate"] --> OUT["Validation output"]

  subgraph Legend
    direction LR
    _user(["User"]) ~~~ _cmd["Command"] ~~~ _data[("Data")]
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Hard switch: remove `--all` immediately
  • ➕ Simplifies CLI surface area and reduces long-term maintenance
  • ➖ Breaking change for existing scripts/users
  • ➖ No migration runway or explicit guidance in output
2. Silent alias: keep `--all` without warning
  • ➕ Zero noise for existing users and CI logs
  • ➖ Does not guide users toward the standardized flag
  • ➖ Inconsistent UX compared to bit test/bit check-types deprecation behavior

Recommendation: The chosen approach (introduce --unmodified, keep --all as a deprecated alias with a warning) is the best tradeoff: it aligns bit validate with related commands, preserves backward compatibility, and provides an explicit migration path via deprecation messaging and test coverage.

Files changed (2) +18 / -5

Enhancement (1) +11 / -4
validate.cmd.tsIntroduce '--unmodified' flag and deprecate '--all' for 'bit validate' +11/-4

Introduce '--unmodified' flag and deprecate '--all' for 'bit validate'

• Updates CLI help/extended description to prefer '--unmodified' for validating all components. Adds a new '--unmodified' ('-u') option and maps '--all' ('-a') to it while emitting a deprecation warning. Uses 'unmodified' when calling 'workspace.getComponentsByUserInput()' so selection matches other commands.

scopes/defender/validator/validate.cmd.ts

Tests (1) +7 / -1
validate.e2e.tsAdd e2e coverage for '--unmodified' and deprecated '--all' +7/-1

Add e2e coverage for '--unmodified' and deprecated '--all'

• Renames the existing '--all' validation scenario to '--unmodified' and adds a new assertion that '--all' still works. Verifies the deprecation warning string is printed when '--all' is used.

e2e/harmony/validate.e2e.ts

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Aug 4, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (1) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. E2E doesn’t prove unmodified ✓ Resolved 🐞 Bug ☼ Reliability
Description
The new bit validate --unmodified e2e test populates fresh components, which are already treated
as “new/modified”, so the same validation count would occur even without --unmodified. This
weakens regression coverage for the new flag and could allow a broken --unmodified implementation
to pass CI.
Code

e2e/harmony/validate.e2e.ts[R120-123]

+      const output = helper.command.runCmd('bit validate --unmodified');
+      expect(output).to.include('Validating 2 component(s)');
+      expect(output).to.include('All validation checks passed');
+    });
Evidence
The test setup creates components that are “new/modified”, so default bit validate would select
them even without --unmodified, making the test assertion non-discriminating. The workspace
selector confirms that when all/unmodified is false and no pattern is provided, the selection is
newAndModified().

e2e/harmony/validate.e2e.ts[114-129]
scopes/workspace/workspace/workspace.ts[1172-1193]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The `--unmodified` e2e test currently validates freshly populated components, which are included in the default (new+modified) set, so it doesn’t verify that `--unmodified` changes component selection.
### Issue Context
`Workspace.getComponentsByUserInput(all, pattern, ...)` returns `newAndModified()` when `all/unmodified` is false and no pattern is given.
### Fix Focus Areas
- e2e/harmony/validate.e2e.ts[114-129]
### Suggested fix
Update the scenario to include at least one *unmodified* component:
1. Populate 2 components.
2. Tag/snap them so the workspace has **no** new/modified components.
3. Assert `bit validate` (no flags) prints `No components found to validate`.
4. Assert `bit validate --unmodified` validates 2 components.
5. Keep the deprecated `--all` assertion, but run it against the same “clean workspace” setup so it proves `--all` maps to `--unmodified`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. consoleWarning for deprecation output 📘 Rule violation ⚙ Maintainability
Description
The new --all deprecation message is emitted via logger.consoleWarning, which formats output
using logger-internal chalk/symbol behavior instead of the shared @teambit/cli output formatting
toolkit. This risks inconsistent CLI styling and violates the CLI output style guide requirement.
Code

scopes/defender/validator/validate.cmd.ts[R51-54]

+    if (all) {
+      unmodified = all;
+      this.logger.consoleWarning(`--all is deprecated, use --unmodified instead`);
+    }
Evidence
The style guide states CLI output should use the shared formatting toolkit from @teambit/cli. The
PR adds a new deprecation warning using this.logger.consoleWarning(...), and consoleWarning()
itself applies chalk coloring and routes through loader warning output rather than the
@teambit/cli formatter utilities.

CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols): CLAUDE.md: CLI Output Must Follow Style Guide and Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles or Unicode Symbols)
scopes/defender/validator/validate.cmd.ts[51-54]
scopes/harmony/cli/cli-output-style-guide.md[1-4]
scopes/harmony/logger/logger.ts[153-169]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`bit validate` now prints a deprecation warning for `--all` using `this.logger.consoleWarning(...)`, which bypasses the shared CLI output formatting toolkit and may produce inconsistent styling.
## Issue Context
The repository CLI output style guide requires CLI output to use the shared formatting toolkit from `@teambit/cli` (e.g., `formatWarningSummary`, `warnSymbol`) rather than ad-hoc or logger-internal styling.
## Fix Focus Areas
- scopes/defender/validator/validate.cmd.ts[51-54]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Docs omit deprecated --all 🐞 Bug ⚙ Maintainability
Description
contrib/claude-skill-bit-cli/CLI_REFERENCE.md now documents only --unmodified for `bit
validate, but the command still supports --all` as a deprecated alias (with a warning). This makes
the reference inaccurate and can mislead users/tools that rely on this file for supported flags.
Code

contrib/claude-skill-bit-cli/CLI_REFERENCE.md[R987-988]

+validates components by running check-types, lint, and test commands in sequence. by default runs all checks even when errors are found. use --fail-fast to stop at the first failure. by default validates only new and modified components. use --unmodified to validate all components.
+Flags: --unmodified, --fail-fast, --skip-tasks <string>
Evidence
The Claude-skill CLI reference was updated to only mention --unmodified, while the validate
command implementation still declares --all and explicitly handles it by mapping it to
unmodified and emitting a warning.

contrib/claude-skill-bit-cli/CLI_REFERENCE.md[983-989]
scopes/defender/validator/validate.cmd.ts[21-24]
scopes/defender/validator/validate.cmd.ts[51-55]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`contrib/claude-skill-bit-cli/CLI_REFERENCE.md` lists `bit validate` flags as `--unmodified, --fail-fast, --skip-tasks`, but the implementation still supports `--all` as a deprecated alias. This doc should reflect that `--all` is still accepted (deprecated) to avoid misleading users/tools.
### Issue Context
The command implementation keeps `--all` and maps it to `--unmodified` while emitting a deprecation warning.
### Fix Focus Areas
- contrib/claude-skill-bit-cli/CLI_REFERENCE.md[983-989]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo

Comment thread scopes/defender/validator/validate.cmd.ts
Comment thread contrib/claude-skill-bit-cli/CLI_REFERENCE.md
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 43368eb

Comment thread e2e/harmony/validate.e2e.ts
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 0f2bf6a

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 85f358a

@davidfirst
davidfirst enabled auto-merge (squash) August 4, 2026 15:32
@davidfirst
davidfirst merged commit eb3255f into master Aug 4, 2026
14 checks passed
@davidfirst
davidfirst deleted the validate-unmodified-flag branch August 4, 2026 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants