Skip to content

Commit 81cdc22

Browse files
bloveclaude
andauthored
docs(release): correct the runbook's two broken commands (#811)
Both documented commands fail as written: - `nx release patch` is rejected outright — nx.json configures git options under release.changelog.git, and Nx refuses the top-level command when granular git config is present. Replaced with the version/changelog subcommands. - `nx release changelog v0.0.2` double-prefixes the tag. releaseTagPattern is `v{version}`, so passing `vX.Y.Z` yields a malformed `vvX.Y.Z` tag and GitHub Release. Pass the bare version. Also adds a lockfile check before pushing (the version step regenerates package-lock.json, which on macOS can drop Linux swc bindings) and a drift check, since version bumps on main don't publish and the version on disk can match npm while the code differs. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
1 parent a63348b commit 81cdc22

1 file changed

Lines changed: 58 additions & 27 deletions

File tree

docs/RELEASE.md

Lines changed: 58 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,66 @@
22

33
The seven publishable libraries (`@threadplane/chat`, `@threadplane/langgraph`, `@threadplane/ag-ui`, `@threadplane/render`, `@threadplane/a2ui`, `@threadplane/licensing`, `@threadplane/telemetry`) ship together at a synchronized version via Nx Release. During the `0.0.x` exploratory phase, only patch bumps are used.
44

5-
## One-shot release (recommended; second release onward)
5+
## Standard release (second release onward)
66

77
> First release? See **[First `@threadplane` release](#first-threadplane-release)** below — the flow is different because there's no prior package under the new npm org yet.
88
9+
> [!WARNING]
10+
> **Do not use `nx release patch`.** The one-shot `nx release` command does not
11+
> work in this repo. `nx.json` configures git options under
12+
> `release.changelog.git`, and Nx rejects the top-level command whenever
13+
> granular git config is present:
14+
>
15+
> `NX The "release" top level command cannot be used with granular git configuration.`
16+
>
17+
> Use the subcommands below instead.
18+
919
From a clean main branch:
1020

1121
```bash
1222
git checkout main && git pull
13-
npx nx release patch
14-
```
1523

16-
This runs Nx Release in interactive mode, which:
17-
18-
1. Builds all seven publishable projects and patches install telemetry into the publishable package manifests (preVersionCommand).
19-
2. Bumps every package.json version (e.g., `0.0.1``0.0.2`).
20-
3. Generates `CHANGELOG.md` from commits since the last tag.
21-
4. Creates a git commit `chore(release): publish v0.0.2`.
22-
5. Tags the commit `v0.0.2`.
23-
6. **Prompts for confirmation, then publishes to npm with provenance.**
24+
# 1. Version bump. Runs preVersionCommand (builds all seven projects and
25+
# patches install telemetry into the dist manifests), rewrites every
26+
# package.json, updates package-lock.json, and stages the result.
27+
npx nx release version --specifier=patch
2428

25-
After the prompt, push the commit and tag:
29+
# 2. Changelog + commit + tag + GitHub Release.
30+
# Pass the BARE version — see the warning below.
31+
npx nx release changelog 0.0.57
2632

27-
```bash
33+
# 3. Push. The Publish workflow fires on the tag and publishes to npm
34+
# with provenance via OIDC trusted publishing.
2835
git push origin main --tags
2936
```
3037

31-
The `Publish` GitHub Actions workflow fires on tag push and re-publishes (idempotent — npm rejects duplicate versions).
32-
33-
## Step-by-step (for debugging)
38+
> [!WARNING]
39+
> **Pass the bare version to `changelog`, not `vX.Y.Z`.** `releaseTagPattern` is
40+
> `v{version}`, so Nx prepends the `v` itself. Passing `v0.0.57` produces a
41+
> malformed **`vv0.0.57`** tag and a GitHub Release at
42+
> `/releases/tag/vv0.0.57`. Pass `0.0.57`.
43+
>
44+
> Always `--dry-run` step 2 first and check the printed tag URL before
45+
> committing to it.
3446
35-
If something goes wrong, run the steps individually:
47+
Step 3 is what actually ships. You can also publish from your machine with
48+
`npx nx release publish --groups=publishable`, but preferring the tag-driven
49+
workflow means no local npm credentials are needed and provenance is attested
50+
by CI.
3651

37-
```bash
38-
# 1. Version bump (writes new versions to package.json files)
39-
npx nx release version --specifier=patch
52+
### Check the lockfile before pushing
4053

41-
# 2. Generate changelog (creates CHANGELOG.md, commits, tags)
42-
npx nx release changelog v0.0.2 # use the version produced by step 1
54+
Step 1 regenerates `package-lock.json`. On macOS that can drop the Linux
55+
`@next/swc-*` bindings and break CI. The diff should be **only** the version
56+
lines for the seven libs:
4357

44-
# 3. Publish to npm
45-
npx nx release publish --groups=publishable
58+
```bash
59+
git diff --cached package-lock.json | grep -E '^-' | grep -icE 'linux|darwin|musl|gnu'
60+
# must print 0
4661
```
4762

63+
If it prints anything else, revert the lockfile and re-apply the version lines by hand.
64+
4865
## First `@threadplane` release
4966

5067
The first publish under the `@threadplane` npm org is manual. The packages must exist on npm before trusted publishing can be configured package-by-package. Run this from a clean, merged `main` branch.
@@ -87,13 +104,27 @@ After the first `@threadplane` release, configure npm trusted publishing for all
87104

88105
## Dry run
89106

90-
Always sanity-check before a real release:
107+
Always sanity-check before a real release. Dry-run each subcommand — the
108+
one-shot `nx release patch --dry-run` fails the same way the real command does:
109+
110+
```bash
111+
npx nx release version --specifier=patch --dry-run
112+
npx nx release changelog 0.0.57 --dry-run # bare version; check the printed tag URL
113+
```
114+
115+
These print what would happen without modifying anything.
116+
117+
## Is a release actually needed?
118+
119+
Version bumps on `main` do **not** publish — only a pushed `vX.Y.Z` tag does. Main
120+
routinely drifts ahead of npm, and the version on disk can match the version on
121+
npm while the code differs. Check before assuming:
91122

92123
```bash
93-
npx nx release patch --dry-run
124+
git rev-list --count "v$(npm view @threadplane/chat version)"..origin/main
94125
```
95126

96-
This prints what would happen without modifying anything.
127+
Anything above `0` means main has unpublished commits.
97128

98129
## Manual workflow trigger
99130

0 commit comments

Comments
 (0)