Skip to content

fix(cli): respond to --help on all subcommands#1873

Merged
Andarist merged 3 commits intochangesets:mainfrom
mixelburg:fix/help-on-all-commands
Mar 25, 2026
Merged

fix(cli): respond to --help on all subcommands#1873
Andarist merged 3 commits intochangesets:mainfrom
mixelburg:fix/help-on-all-commands

Conversation

@mixelburg
Copy link
Copy Markdown
Contributor

Problem

Running changeset <command> --help (e.g. changeset version --help) would silently execute the command instead of printing usage. The check parsed.help && args.length === 1 meant --help was only honoured when it was the sole argument.

This is especially harmful for commands that modify data (version, publish).

Fix

  • Removed the args.length === 1 guard so --help always exits early.
  • Added a COMMAND_HELP map: when a known subcommand is passed alongside --help, its specific usage line is printed; otherwise the full general help is shown.

Fixes #1823

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 4, 2026

🦋 Changeset detected

Latest commit: d6cc4c8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@changesets/cli Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.57%. Comparing base (3ab4d89) to head (d6cc4c8).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1873      +/-   ##
==========================================
+ Coverage   81.84%   84.57%   +2.73%     
==========================================
  Files          55       55              
  Lines        2396     2399       +3     
  Branches      725      721       -4     
==========================================
+ Hits         1961     2029      +68     
+ Misses        429      364      -65     
  Partials        6        6              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Andarist Andarist enabled auto-merge March 25, 2026 12:43
@Andarist Andarist added this pull request to the merge queue Mar 25, 2026
Merged via the queue into changesets:main with commit 42943b7 Mar 25, 2026
6 checks passed
@github-actions github-actions Bot mentioned this pull request Mar 25, 2026
nnecec pushed a commit to nnecec/changesets-docs that referenced this pull request Apr 16, 2026
* fix(cli): respond to --help on all subcommands

* keep both help lists in sync

* tweak changeset

---------

Co-authored-by: Maks Pikov <mixelburg@users.noreply.github.com>
Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
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.

Respond to --help on all commands

2 participants