changeset
A tool to manage changesets in Dart and Flutter projects. It lets you record changes (major, minor, patch), group them by scope, and generate releases by updating pubspec.yaml, CHANGELOG.md, and archiving used changesets.
Works with plain Dart packages (version X.Y.Z) and Flutter projects (version X.Y.Z+build). The version format is detected from your pubspec.yaml and preserved on release.
Features
- Add changesets: Record a change with type (major, minor, patch), summary, and optionally a scope.
- Release: Reads all changesets, decides the bump from the highest type present, updates the version in
pubspec.yaml(keeps DartX.Y.Zor FlutterX.Y.Z+buildformat), writes the entry toCHANGELOG.md, and archives changesets under.changesets/archived/<version>. - Dry-run: The
release --dry-runcommand shows the release plan without modifying any files. - Config: Optional
changeset.yamlorchangeset:key in rootpubspec.yamlto set paths and workspace packages. - Monorepo / workspace: Use
-W <package>(or--workspace) onaddandreleaseto manage changesets per package: one.changesets/and oneCHANGELOG.mdat the repo root, while version bumps apply to the chosen package’spubspec.yaml. - Shell completion: Bash, zsh, and fish completion scripts (commands, options, workspace names from config).
Requirements
- Dart SDK ^3.9.2
- A project with
pubspec.yamland aversion:field:- Dart:
X.Y.Z(e.g.1.0.0) - Flutter:
X.Y.Z+<build>(e.g.1.0.0+1)
- Dart:
Installation
Add changeset as a dev dependency in your pubspec.yaml:
dev_dependencies:
changeset: ^1.0.0
Or install it globally:
dart pub global activate changeset
Shell completion
Install tab-completion for commands, options, and workspace names (from changeset.yaml / config). Run from a directory where changeset is available (e.g. after dart pub global activate changeset).
Windows (PowerShell / Starship): Use PowerShell completion so tab-completion works in Windows Terminal, Starship, etc. (requires changeset in PATH, e.g. dart pub global activate changeset). See the PowerShell option below. You can also use bash/zsh/fish in Git Bash or WSL.
Bash (add to ~/.bashrc or ~/.profile):
eval "$(changeset completion bash)"
Zsh (add to ~/.zshrc):
eval "$(changeset completion zsh)"
Fish (add to ~/.config/fish/config.fish):
changeset completion fish | source
PowerShell (Windows / Starship — add to your profile):
. (changeset completion powershell)
Or run once and add the output to your profile:
changeset completion powershell | Out-String | Invoke-Expression
You can also generate a script explicitly: changeset completion --shell bash (or zsh / fish / powershell). Completion suggests: add, release, completion; options like --type, --workspace; for -W/--workspace it lists workspace names from your config when run inside a monorepo.
Configuration
When you run changeset, it looks for config in this order:
changeset.yaml— From the current directory upward (until the repo root). If found, that directory is the root and the file content is the config.- Root
pubspec.yaml— If nochangeset.yamlexists, the first parent directory that has apubspec.yamlwith aworkspace:(Dart) ormelos:(Melos) section is treated as the root. If that pubspec has achangeset:key (map), it is used as config. - No config — Root is the current directory; behavior is the same as before (single package, no workspace).
Config schema
In changeset.yaml (or under changeset: in the root pubspec):
| Key | Default | Description |
|---|---|---|
changelogPath |
CHANGELOG.md |
Path to the changelog file (relative to root). |
changesetsPath |
.changesets |
Directory for pending changesets (relative to root). |
packages |
{} |
Map of package name → path (relative to root). Required for -W / workspace mode. |
Example changeset.yaml at monorepo root:
changelogPath: CHANGELOG.md
changesetsPath: .changesets
packages:
my_app: apps/my_app
core: packages/core
ui: packages/ui
Usage
Show help
dart run changeset --help
Add a changeset
dart run changeset add --type <major|minor|patch> [--scope <scope>] [--workspace <name>] --summary "<text>"
- --type: Semantic change type:
major,minor, orpatch. - --scope: (optional) Area or module affected; used for grouping in the changelog.
- --workspace / -W: (optional) Package name in a monorepo. Requires the package to be listed in config (
changeset.yamlorchangeset.packages). The changeset is stored at root and tagged withpackage: <name>. - --summary: Short description of the change.
Examples:
dart run changeset add --type patch --summary "Fix total calculation"
dart run changeset add --type minor --scope totem --summary "Add kitchen tickets"
dart run changeset add --type major --summary "Remove deprecated v1 API"
# Monorepo: changeset for a specific package
dart run changeset add -W core --type patch --summary "Fix validation"
Files are created under .changesets/ (or the configured changesetsPath) with the date and a slug from the summary. With --workspace, the file also includes a package: <name> line.
Run a release
dart run changeset release [--workspace <name>]
- Ensures
pubspec.yamland the.changesets/folder exist (or the configured paths when using config). - Reads all
.mdchangesets. With--workspace <name>, only changesets withpackage: <name>are used; without-W, only changesets without apackage:line are used. - Computes the bump: if any change is
major→ major; else if any isminor→ minor; else → patch. - Updates
version:in the relevantpubspec.yaml(current dir, or the package path from config when using-W). - Prepends a new section to
CHANGELOG.md(root when using config). With-W, the section header is## <package> X.Y.Z - date. - Moves used changesets to
.changesets/archived/<new-version>/or, with-W,.changesets/archived/<package>/<new-version>/.
Preview without writing files:
dart run changeset release --dry-run
dart run changeset release -W core --dry-run
Shows current version, bump, next version, and changelog preview.
Generated structure
.changesets/(orchangesetsPath) — Pending changesets (files likeYYYY-MM-DD-<slug>.md)..changesets/archived/<version>/— Changesets already included in a release (single-package mode)..changesets/archived/<package>/<version>/— Changesets already included in a release for that package (workspace mode with-W).
Each changeset file contains type:, optional scope:, optional package: (for workspace mode), and summary: lines.