Skip to content

feat: add msg flag to add command - #1839

Merged
Andarist merged 8 commits into
changesets:mainfrom
leochiu-a:feat/add-msg-flag-to-add-command
Feb 23, 2026
Merged

Andarist merged 8 commits into
changesets:mainfrom
leochiu-a:feat/add-msg-flag-to-add-command

Conversation

@leochiu-a

@leochiu-a leochiu-a commented Feb 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR adds a new --msg <text> flag to changeset add (and the default changeset command path) so users can provide the changeset summary directly from the CLI.

The goal is to support non-interactive and script-friendly usage while preserving the existing confirmation workflow before writing the changeset.

resolve: #1833

Key Changes

  • Added CLI support for --msg in argument parsing and option typing, then passed it through the run pipeline into the add command.
  • Updated add/createChangeset flow to use the CLI-provided summary and skip only the summary prompt when --msg is present.
  • Kept the final confirmation step unchanged, so users still confirm the generated changeset before it is written.
  • Added behavior coverage for --msg in tests, including default-command forwarding, explicit add forwarding, empty-string summaries, and --empty with a provided summary.
  • Updated CLI docs (docs/command-line-options.md, packages/cli/README.md) and added a release note changeset for @changesets/cli.

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • ♻️ Refactoring (no functional changes)
  • 🎨 Style/formatting changes
  • 🧪 Test improvements
  • 🔧 Configuration changes

Test Plan

Manual Testing

  • Run changeset add --msg "Fix auth token refresh handling", complete package/version selections, and confirm the changeset.
  • Verify the summary prompt is skipped, the final confirmation prompt still appears, and the generated .changeset/*.md contains the provided summary.
  • Run changeset --msg "Default command summary" and changeset add --empty --msg "" to verify both command paths forward --msg, including empty summaries.

Automated Testing

  • yarn test packages/cli/src/run.test.ts -t "should pass --msg"
  • yarn test packages/cli/src/commands/add/__tests__/add.ts -t "summary passed via msg|empty summary when msg is an empty string|using msg with empty changesets"

Breaking Changes

None

Checklist

  • 📝 Code follows the style guidelines
  • 👀 Self-review has been performed
  • 🧪 Tests have been added/updated
  • 📖 Documentation has been updated

- Introduced a new `--msg` option for the `add` command to allow users to provide a custom summary for changesets.
- Updated the `CliOptions` type to include the `msg` property.
- Modified the `add` function and `createChangeset` to handle the new message parameter, enhancing user experience by allowing direct input of change summaries.
- Added tests to verify that the `--msg` option correctly passes a custom summary to the `add` command.
- Included scenarios for handling empty summaries and using messages with empty changesets.
- Ensured that the confirmation flow remains intact when a summary is provided.
@changeset-bot

changeset-bot Bot commented Feb 6, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 20b9441

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 Feb 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.46%. Comparing base (e07fd62) to head (20b9441).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1839      +/-   ##
==========================================
+ Coverage   81.33%   81.46%   +0.12%     
==========================================
  Files          54       55       +1     
  Lines        2277     2336      +59     
  Branches      679      692      +13     
==========================================
+ Hits         1852     1903      +51     
- Misses        420      428       +8     
  Partials        5        5              

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

@leochiu-a
leochiu-a marked this pull request as draft February 6, 2026 03:26
@leochiu-a
leochiu-a marked this pull request as ready for review February 6, 2026 05:12
@Andarist
Andarist force-pushed the feat/add-msg-flag-to-add-command branch from 2de1b51 to 20b9441 Compare February 23, 2026 13:08
@Andarist
Andarist merged commit 73b1809 into changesets:main Feb 23, 2026
3 checks passed
@github-actions github-actions Bot mentioned this pull request Feb 23, 2026
nnecec pushed a commit to nnecec/changesets-docs that referenced this pull request Apr 16, 2026
* feat(cli): add support for custom message in `add` command

- Introduced a new `--msg` option for the `add` command to allow users to provide a custom summary for changesets.
- Updated the `CliOptions` type to include the `msg` property.
- Modified the `add` function and `createChangeset` to handle the new message parameter, enhancing user experience by allowing direct input of change summaries.

* test(cli): enhance tests for `add` command with custom message support

- Added tests to verify that the `--msg` option correctly passes a custom summary to the `add` command.
- Included scenarios for handling empty summaries and using messages with empty changesets.
- Ensured that the confirmation flow remains intact when a summary is provided.

* docs(cli): update command line options to include `--msg` for custom summary

* chore: update changelog

* rename to message

* add test

* tweak

---------

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.

Support changeset add by adding the --msg option to receive external changelog messages

2 participants