> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gatojs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Releases

> How GatoJS kit versions are released by semantic-release from Conventional Commits, and how the gato-cli and create-gato-app npm packages are published from tags with trusted publishing.

GatoJS has three independently versioned things:

| What | Version lives in | Released as | Released by |
| - | - | - | - |
| The kit | `version` in `kit/kit.json` | Git tag `v<version>` and a GitHub Release | semantic-release, on every push to `main` |
| `gato-cli` | `packages/gato-cli/package.json` | npm package `gato-cli` | A maintainer pushing a `gato-cli@<version>` tag |
| `create-gato-app` | `packages/create-gato-app/package.json` | npm package `create-gato-app` | A maintainer pushing a `create-gato-app@<version>` tag |

Each kit module also has its own `version` in its manifest, bumped by hand in the pull request that changes it.

## Kit releases

The kit version becomes `kitVersion` in every new project, and the tag `v<version>` is what `create-gato-app` downloads and what `gato add`, `list` and `update` clone. The tag and `kit/kit.json` must therefore always agree, and every version must have a tag. A release workflow guarantees both.

`.github/workflows/release.yml` runs on every push to `main` (and on demand). It runs semantic-release from the kit-only package `kit/release/`, which has its own `package.json` and lockfile so release tooling never reaches projects.

**1. Analyse commits**

The commit analyzer (`conventionalcommits` preset) reads the commits since the last tag:

| Commit | Release |
| - | - |
| `feat` | minor |
| `fix`, `perf` | patch |
| Breaking change (`feat!:` or a `BREAKING CHANGE` footer) | minor, while the kit is below 1.0 |
| `[no release]` in the subject | none |
| `docs`, `chore`, `test`, `ci`, `refactor` | none |

**2. Write the version**

`node kit/release/set-kit-version.mjs <version>` rewrites only the top-level `version` in `kit/kit.json`, then `node .wa/bin/wa.mjs kit sync` updates `kitVersion` in `.wa/kit.json`.

**3. Commit and tag**

`@semantic-release/git` commits both files as `chore(release): <version> [skip ci]` and semantic-release tags that commit `v<version>`. `[skip ci]` keeps the release commit from starting other workflows.

**4. Publish the GitHub Release**

With release notes generated from the same commits. Nothing is published to npm by this workflow.

`main` is protected; the workflow pushes the release commit and tag with a deploy key allowed to bypass the protection.

What this means for contributors:

* **Commit types decide the version.** A `feat` merged to `main` becomes a minor release with its subject in the notes. Add `[no release]` to the subject to hold a release back.
* **Never edit** `version` in `kit/kit.json` or `kitVersion` in the kit's `.wa/kit.json` by hand. Resolve conflicts on them in favour of `main`.
* **Pull after merging.** The release commit lands on `main` after your merge.
* **Bump module versions yourself.** When you change a module's files, bump its `version` in `kit/modules/<module>.json` and run `npm run wa -- kit sync` in the same pull request. Nothing checks this.
* Going to 1.0 needs a change in `kit/release/release.config.mjs`.

Preview the next version without releasing, from a checkout of `main` with GitHub access:

```bash theme={null}
npm ci --prefix kit/release
GITHUB_TOKEN=$(gh auth token) kit/release/node_modules/.bin/semantic-release \
  --dry-run --no-ci --extends ./kit/release/release.config.mjs
```

The release scripts have tests (`npm test --prefix kit/release`), run by the `release-scripts` job in `kit.yml` and before each release.

## npm packages

`gato-cli` and `create-gato-app` are published by `.github/workflows/publish-packages.yml` from a tag a maintainer pushes. There is no publishing from a laptop and no npm token: the workflow uses npm trusted publishing (OIDC) with `--provenance`.

**1. Bump the version on a branch**

```bash theme={null}
npx -y npm@11.21.1 version patch --no-git-tag-version --workspace gato-cli
npm run build --prefix packages/gato-cli
```

The build matters: the committed bundle `.wa/bin/wa.mjs` embeds the CLI version. When `gato-cli` changes, also update the exact `gato-cli` pin in `packages/create-gato-app/package.json`; a unit test and CI require them to match. Merge the pull request to `main`.

**2. Tag the merge commit**

```bash theme={null}
git tag gato-cli@<version> <merge-commit-sha>
git push origin gato-cli@<version>
```

The tag must point at a commit on `main` whose package `version` equals the tag's version. Do not tag a `chore(release): … [skip ci]` commit: GitHub does not start workflows for it.

**3. The workflow verifies and publishes**

It checks out the tag, installs the pinned npm, runs `npm run verify` for the package and publishes it as a staged version. For `create-gato-app` it first refuses to publish until the pinned `gato-cli` version is live on npm.

**4. Approve the staged version**

Staged versions wait for a maintainer's approval on npmjs.com (Staged Packages, then Approve), or `npx npm@11 stage approve <staged-id>` with the id from the job log. Until then the registry serves only a `0.0.0-stage` placeholder.

**5. Confirm**

The `confirm` job waits up to 10 minutes for `npm view <package>@<version> version` and the `latest` dist-tag to show the new version. If approval comes later, re-run the failed job, or run the workflow by hand with the tag (for example `gato-cli@0.2.2`).

**Order:** when both packages change, publish `gato-cli` first and wait until it is approved and live, then `create-gato-app`.

npm versions are immutable, and `npm unpublish` is limited to 72 hours and burns the version number. `prepack` copies `LICENSE` and `NOTICE` from the repository root and builds, so the `gato-cli` tarball holds exactly `dist/gato.mjs`, `README.md`, `LICENSE`, `NOTICE` and `package.json`; `packages.yml` checks the list. Before tagging, you can smoke-test both packed tarballs locally:

```bash theme={null}
SMOKE_INSTALL=1 bash packages/create-gato-app/scripts/smoke-pack.sh "$PWD"
```

## How versions relate

* The CLI's version is independent of the kit version ([CLI overview](https://docs.gatojs.com/cli/overview.md#versioning)). A project pins `gato-cli` with a caret range in `devDependencies`.
* `create-gato-app` pins one exact `gato-cli` version and runs its `gato create`.
* A kit release does not publish the CLI, and a CLI release does not cut a kit version. A change to `packages/gato-cli/src` usually needs both: the rebuilt bundle reaches projects through the next kit release, the npm package through a `gato-cli@<version>` tag.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.