Skip to content

add: let a valueless --major/--minor/--patch use the detected packages - #2308

Open
seanogdev wants to merge 5 commits into
changesets:mainfrom
seanogdev:bare-bump-flags-use-detected-packages
Open

seanogdev wants to merge 5 commits into
changesets:mainfrom
seanogdev:bare-bump-flags-use-detected-packages

Conversation

@seanogdev

Copy link
Copy Markdown

Closes #2307.

changeset add --patch -m 'Fix the export types' failed at parse time, because --patch <pkg> made the value mandatory. add already computes the changed packages on every run and passes them into createChangeset, where the CLI branch ignored them. This uses them.

changeset add --patch -m 'Fix the export types'   # patch everything detected
changeset add --patch pkg-a,pkg-b -m '...'        # unchanged

The options are now [pkg], and normalizeOptions keeps the true that cac produces for a valueless option rather than stringifying it to "true", the same shape --snapshot [name] already carries into version. resolveBumpFlags swaps that marker for the detected list before the existing validators run, so they and the release loop are unchanged.

Decisions

  • All three options, not just --patch. The repo treats them as a triple everywhere, and making one of them optional-valued would be the special case. The CLI path never reaches confirmMajorRelease, so a valueless --major is not a new hazard.
  • A named package is excluded from the detected set. --major pkg-a --patch majors pkg-a and patches the rest. Substituting the detected list raw would instead make that command fail its own duplicate check, which is a worse answer than the obvious one. Two valueless options still collide, and the existing duplicate error names them.
  • Detection failure is fatal when an option carries no value. The catch warns and continues today because the detection only orders a prompt. With no value there is nothing to fall back to.
  • Zero resolved releases is an error, not a silently empty changeset. --empty is how you ask for that.

Note on detection

getChangedFilesSince diffs the working tree against the base, so an uncommitted edit to a tracked file counts, but a new file only counts once it is git added. That is pre-existing and matches what the prompt shows; I have documented it rather than changed it.

Tests

Parse cases in cli.test.ts, and add.test.ts covers the valueless option, combining it with a named list, the cross-option exclusion, single-package repos, two valueless options, nothing detected, and detection failing.

For context, #2152 asked for a non-interactive bump type and the options landed with the list mandatory, which is what this finishes.

@netlify

netlify Bot commented Sep 17, 2026

Copy link
Copy Markdown

Deploy Preview for changesets ready!

Name Link
🔨 Latest commit cd2f845
🔍 Latest deploy log https://app.netlify.com/projects/changesets/deploys/6aac3b7c83321a0007fe8cae
😎 Deploy Preview https://deploy-preview-2308--changesets.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@changeset-bot

changeset-bot Bot commented Sep 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cd2f845

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 Sep 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.60%. Comparing base (c9269c0) to head (cd2f845).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2308      +/-   ##
==========================================
+ Coverage   87.48%   87.60%   +0.12%     
==========================================
  Files          78       78              
  Lines        2973     3002      +29     
  Branches      853      859       +6     
==========================================
+ Hits         2601     2630      +29     
  Misses        337      337              
  Partials       35       35              

☔ 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.

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.

add: let a bare --patch use the packages it already detected

1 participant