Skip to content

Add --type flag to add command - #2153

Closed
brunorodmoreira wants to merge 1 commit into
changesets:nextfrom
brunorodmoreira:feat/add-type-flag
Closed

Add --type flag to add command#2153
brunorodmoreira wants to merge 1 commit into
changesets:nextfrom
brunorodmoreira:feat/add-type-flag

Conversation

@brunorodmoreira

Copy link
Copy Markdown

Reworks #1890 based on the feedback there: based on next, scoped down to only the add command (no changed command), and simplified to take just a bump type and a message instead of multiple --package flags.

The add command now supports a --type flag that provides the semver bump type (patch, minor or major) from the command line instead of prompting for it. The bump type is applied to all packages that have changed since the base branch (or the ref provided with --since). Combined with --message, the changeset is created without any prompts, so scripts, CI and AI agents can add changesets non-interactively:

changeset add --type patch --message 'Fix crash on startup'

Notes:

  • --type composes with the existing flags like --message does: on its own it only replaces the package selection and bump type prompts, and the summary is still asked for. Single package repos just use their sole package.
  • In --type mode, failing to detect the changed packages (or detecting none) is a hard error instead of the interactive flow's best-effort warning, since the result now decides what gets released.
  • Detecting changed packages is now skipped in single package repos, where the result was never used. This also removes a spurious warning when running changeset in a non-git single package repo.
  • While documenting --type I noticed the CLI README never documented --since, so I added it there too.

Tested with unit tests for all the new paths and end-to-end against a real monorepo (27+ packages), including the error paths and exit codes.

Refs #979, #1604

@changeset-bot

changeset-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 54cf9a9

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

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.49%. Comparing base (909e777) to head (54cf9a9).
⚠️ Report is 7 commits behind head on next.

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #2153      +/-   ##
==========================================
+ Coverage   81.17%   81.49%   +0.32%     
==========================================
  Files          61       61              
  Lines        2321     2351      +30     
  Branches      635      648      +13     
==========================================
+ Hits         1884     1916      +32     
+ Misses        392      390       -2     
  Partials       45       45              

☔ View full report in Codecov by Harness.
📢 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 commented Jul 9, 2026

Copy link
Copy Markdown
Member

We went with this one instead #1121 - its --patch/--minor/--major approach fits the existing Changesets design better.

@Andarist Andarist closed this Jul 9, 2026
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