-
Notifications
You must be signed in to change notification settings - Fork 0
chore(changesets): enforce changesets, open Version Packages PR, document conventions #403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
14d7305
chore(changesets): enforce changesets, open Version Packages PR, docu…
ScriptedAlchemy 3973608
test: temporary probe — publishable change without a changeset (to be…
ScriptedAlchemy 66f7f3c
Revert "test: temporary probe — publishable change without a changese…
ScriptedAlchemy 9fdaceb
fix(release): let a CHANGESETS_GITHUB_TOKEN drive the Version Package…
ScriptedAlchemy 82cec69
docs(agents): require an explicit @codex review after each push and a…
ScriptedAlchemy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,129 @@ | ||
| # Changesets | ||
|
|
||
| Add one Markdown changeset for every user-visible package change. Version PRs | ||
| and npm publication are handled by the standard Changesets workflow. Pull | ||
| request canaries use `pnpm preview:publish` and pkg.pr.new. | ||
| This repository versions its published packages with | ||
| [Changesets](https://github.com/changesets/changesets). A changeset is a small | ||
| Markdown file in this directory that names the packages a pull request | ||
| changes, the bump each one needs, and a user-facing summary. `changeset | ||
| version` folds pending changesets into `CHANGELOG.md` and `package.json` | ||
| versions; `changeset publish` (when enabled) publishes the result. | ||
|
|
||
| ## Which packages get changesets | ||
|
|
||
| | Package | Path | Status | | ||
| | ----------------------- | ------------------------------ | ---------------------------------------- | | ||
| | `agent-bundle` | `packages/agent-bundle` | publishable | | ||
| | `@agent-bundle/runtime` | `packages/rsc-runtime` | publishable | | ||
| | `create-agent-bundle` | `packages/create-agent-bundle` | publishable | | ||
| | `agent-bundle-workbench`| `packages/workbench` | private, ignored | | ||
| | `@agent-bundle-example/*`, `@agent-bundle/rsc-agent-runtime-demo` | `examples/*` | private, ignored | | ||
| | `@agent-bundle/docs` | `website` | private, ignored | | ||
|
|
||
| Private packages are listed under `ignore` in `config.json` and are also | ||
| excluded by `privatePackages.version: false`, so `pnpm changeset` never | ||
| prompts for them and a changeset must never name them. The workspace root | ||
| (`agent-bundle-workspace`) is not a workspace package and needs no entry. A | ||
| change that only touches private packages, `docs/**`, `agent-patterns/**`, | ||
| CI, or a publishable package's `tests/**` directory needs no changeset | ||
| (`changedFilePatterns` in `config.json` exempts `tests/**`). | ||
|
|
||
| ## Rules | ||
|
|
||
| - **One changeset per pull request** that changes a publishable package's | ||
| shipped surface (`src/**`, `bin/**`, `templates/**`, `package.json`, | ||
| `README.md`, build config). Name every affected package in that one file. | ||
| Split a PR instead of writing several changesets for it; the rare exception | ||
| is a PR that intentionally ships two independent user-facing changes. | ||
| - **Semver before 1.0**: `minor` = breaking change (removed or renamed | ||
| exports, CLI flags, config keys, diagnostic codes, on-disk formats, or | ||
| changed defaults that require consumer action); `patch` = everything else, | ||
| including new features. Do not use `major` until the first `1.0.0`; after | ||
| 1.0 the usual semver meanings apply. | ||
| - **Summary style**: user-facing, imperative, one paragraph. Lead with what | ||
| changes for the consumer, name the affected command, export, or config key, | ||
| and mention diagnostic codes (`AB` + four digits, see `docs/diagnostics.md`) | ||
| when a diagnostic is added, removed, or reworded. Do not describe the implementation, the | ||
| review thread, or internal refactors that leave behavior unchanged. End | ||
| with the pull request reference in parentheses, `(#123)`, when the PR | ||
| number is known. | ||
| - **Never edit `CHANGELOG.md` or a publishable `package.json` `version` by | ||
| hand.** The "Version Packages" pull request is machine-owned; it is | ||
| regenerated on every push to `main` and any manual edit is overwritten. | ||
| - **`skip-changeset` label**: a PR that changes publishable files but ships | ||
| no observable change (comments, formatting, type-only refactors) may carry | ||
| the `skip-changeset` label instead of a changeset. The `Changeset present` | ||
| check honours the label; reviewers should challenge its use. | ||
|
|
||
| ## Writing a changeset | ||
|
|
||
| Run `pnpm changeset` and follow the prompts, or create | ||
| `.changeset/<slug>.md` by hand: | ||
|
|
||
| ```md | ||
| --- | ||
| "agent-bundle": patch | ||
| "create-agent-bundle": patch | ||
| --- | ||
|
|
||
| `agent-bundle doctor` now reports `AB6026` when a Cursor hook manifest points | ||
| at a missing built script instead of failing silently; scaffolded projects | ||
| pick up the same check. (#123) | ||
| ``` | ||
|
|
||
| Use a descriptive kebab-case slug (the generated random names are fine | ||
| too). Commit the file with the change it describes. | ||
|
|
||
| ## Enforcement | ||
|
|
||
| `.github/workflows/changeset.yml` runs `pnpm changeset status | ||
| --since=origin/main` on every pull request. It fails when a publishable | ||
| package changed (per `changedFilePatterns`) and the PR adds no | ||
| `.changeset/*.md`. It is skipped for the `skip-changeset` label and for the | ||
| machine-owned `changeset-release/main` branch of this repository (not for a | ||
| fork or contributor branch of the same name). Docs-only PRs pass automatically | ||
| because they change no publishable package. | ||
|
|
||
| ## Versioning decisions | ||
|
|
||
| - `agent-bundle` and `@agent-bundle/runtime` version **independently** | ||
| (`fixed` and `linked` are empty). `agent-bundle` declares | ||
| `@agent-bundle/runtime` as an *optional* peer with range `*`, and | ||
| `@agent-bundle/runtime` does not depend on `agent-bundle`, so neither | ||
| package needs to move when the other does. Preview tarballs pin the peer to | ||
| the same commit (`docs/preview-packages.md`), which is a preview concern, | ||
| not a version-coupling one. Revisit if the peer range ever becomes exact. | ||
| - `create-agent-bundle` versions independently; its templates pin | ||
| `agent-bundle` explicitly rather than through a workspace range. | ||
| - `updateInternalDependencies: "patch"` with | ||
| `bumpVersionsWithWorkspaceProtocolOnly: true`: only `workspace:` ranges | ||
| between publishable packages would trigger dependent patch bumps, and | ||
| there are none today. | ||
| - `access` stays `"restricted"` at the repository level until the release | ||
| owner decides the npm package names and access policy | ||
| (`docs/preview-packages.md`). `@agent-bundle/runtime` and | ||
| `create-agent-bundle` already override it with `publishConfig.access`. | ||
|
|
||
| ## Release flow | ||
|
|
||
| 1. PRs merge to `main` with their changesets. | ||
| 2. `.github/workflows/release.yml` runs `changesets/action` on every push to | ||
| `main`. While changesets are pending it pushes `changeset-release/main` | ||
| and opens or refreshes the **Version Packages** pull request, which | ||
| deletes the consumed changesets, bumps versions, and writes `CHANGELOG.md` | ||
| entries. Review it, never edit it. GitHub does not start workflows for | ||
| events created with the built-in `GITHUB_TOKEN`, so for that PR to get | ||
| PR CI the repository needs a `CHANGESETS_GITHUB_TOKEN` secret (fine-grained | ||
| PAT or GitHub App installation token with `contents: write` and | ||
| `pull-requests: write` on this repository); the workflow falls back to | ||
| `GITHUB_TOKEN`, in which case close and reopen the PR to trigger CI. | ||
| 3. Merging Version Packages pushes a `Version Packages` commit to `main` | ||
| with no pending changesets. With publishing disabled (the default) the | ||
| workflow then runs the release gates (`pnpm check:release`) and stops; | ||
| nothing reaches npm. | ||
| 4. Publishing is opt-in: set the repository variable | ||
| `AGENT_BUNDLE_NPM_PUBLISH=true` and the `NPM_TOKEN` secret. The action | ||
| then runs `pnpm release` (`pnpm check:release && changeset publish`) with | ||
| npm provenance (`NPM_CONFIG_PROVENANCE=true`, `id-token: write`) and | ||
| creates GitHub releases and tags. | ||
|
|
||
| Until publishing is enabled, installable previews come from pkg.pr.new | ||
| (`pnpm preview:publish`, `docs/preview-packages.md`). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| name: Changeset | ||
|
|
||
| # Every pull request that changes a publishable package must ship a | ||
| # `.changeset/*.md` entry (see .changeset/README.md and AGENTS.md). This | ||
| # lives outside ci.yml on purpose: toggling the `skip-changeset` label must | ||
| # re-evaluate only this check, not re-run the heavy CI matrix. | ||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened, labeled, unlabeled] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: changeset-${{ github.event.pull_request.number }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| changeset: | ||
| name: Changeset present | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| steps: | ||
| # `changeset status --since=origin/main` diffs against the merge-base | ||
| # with main, so the PR merge commit needs enough history to reach it. | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
| - uses: pnpm/setup@v2 | ||
| with: | ||
| cache: true | ||
| install: false | ||
| runtime: node@22.19.0 | ||
| - run: pnpm install --frozen-lockfile | ||
| - name: Require a changeset for publishable package changes | ||
| env: | ||
| SKIP_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'skip-changeset') }} | ||
| # Only the machine-owned release branch of this repository is exempt; | ||
| # a fork or contributor branch that happens to share the name is not. | ||
| IS_RELEASE_BRANCH: >- | ||
| ${{ github.event.pull_request.head.ref == 'changeset-release/main' && | ||
| github.event.pull_request.head.repo.full_name == github.repository }} | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| if [ "$SKIP_LABEL" = "true" ]; then | ||
| echo "::notice::skip-changeset label present; not requiring a changeset." | ||
| exit 0 | ||
| fi | ||
| if [ "$IS_RELEASE_BRANCH" = "true" ]; then | ||
| echo "::notice::Version Packages branch; changesets are consumed here, not added." | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Exit 1 when a publishable package changed (per changedFilePatterns | ||
| # in .changeset/config.json; tests/** is exempt) and this PR adds no | ||
| # .changeset/*.md. Docs-only and private-package changes need none. | ||
| if ! pnpm changeset status --since=origin/main --verbose; then | ||
| echo "::error::This PR changes a publishable package (agent-bundle, @agent-bundle/runtime, create-agent-bundle) without a changeset. Run 'pnpm changeset' (or add .changeset/<slug>.md) — see .changeset/README.md. For a genuinely no-op change, apply the 'skip-changeset' label." | ||
| exit 1 | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.