Skip to content

Commit 42d1db1

Browse files
authored
fix(release): decouple version bumps from release PRs (#893)
* fix(release): decouple version bumps from release PRs Release PRs previously bumped package.json, Cargo.toml, and package-lock.json, causing CI failures because the native prebuilt binary didn't exist at the new version yet. Every release PR was merged with red CI. The publish workflow already handles version bumping atomically — after building native binaries. This change: - Removes version bumping from the /release skill (docs-only PRs) - Skips npm test in publish preflight for stable releases (CI already validated the code on the merged PR) - Adds post-merge instructions to create a GitHub Release New release flow: 1. /release creates docs-only PR (CHANGELOG, ROADMAP) → CI passes 2. Merge PR, create GitHub Release with tag 3. Publish workflow bumps versions, builds, publishes, pushes version bump PR back to main * fix: revert publish.yml test skip — not needed The skill change (no version bumps in release PRs) is sufficient. With package.json staying at the old version on main, preflight tests pass naturally since both package.json and the prebuilt native binary report the same version.
1 parent 72237e6 commit 42d1db1

1 file changed

Lines changed: 33 additions & 61 deletions

File tree

.claude/skills/release/SKILL.md

Lines changed: 33 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: release
3-
description: Prepare a codegraph release — bump versions, update CHANGELOG, ROADMAP, BACKLOG, README, create PR
3+
description: Prepare a codegraph release — update CHANGELOG, ROADMAP, BACKLOG, README, create PR
44
argument-hint: "[version e.g. 3.1.1] (optional — auto-detects from commits)"
55
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, Agent
66
---
@@ -13,6 +13,8 @@ You are preparing a release for `@optave/codegraph`.
1313
- If a version was provided (e.g. `3.1.1`), use it as the target version.
1414
- If no version was provided (empty or blank `$ARGUMENTS`), you will auto-detect it in Step 1b.
1515

16+
**Important: this skill does NOT bump versions.** The publish workflow (`publish.yml`) handles version bumping in `package.json`, `Cargo.toml`, `package-lock.json`, and `optionalDependencies` atomically — after building native binaries and publishing to npm. Bumping versions in the release PR would cause CI failures because the native prebuilt binary wouldn't exist at the new version yet.
17+
1618
---
1719

1820
## Step 0: Isolate and sync
@@ -27,7 +29,7 @@ You are preparing a release for `@optave/codegraph`.
2729
```bash
2830
git checkout origin/main
2931
```
30-
Do **not** create the `release/VERSION` branch here — Step 8 creates it once VERSION is known.
32+
Do **not** create the `release/VERSION` branch here — Step 7 creates it once VERSION is known.
3133

3234
## Step 1a: Gather context
3335

@@ -69,18 +71,7 @@ Use the resolved version as `VERSION` for all subsequent steps.
6971

7072
If `$ARGUMENTS` was provided, use it directly as `VERSION`.
7173

72-
## Step 2: Bump version in package.json
73-
74-
Edit `package.json` to set `"version": "VERSION"`.
75-
76-
Also bump `crates/codegraph-core/Cargo.toml` — set the `version` field in `[package]` to match `VERSION`. This keeps the Rust crate version in sync with the npm package.
77-
78-
**Do NOT bump:**
79-
- `optionalDependencies` versions — synced automatically by `scripts/sync-native-versions.ts` during the publish workflow
80-
81-
Then run `npm install --package-lock-only` to update `package-lock.json`.
82-
83-
## Step 3: Update CHANGELOG.md
74+
## Step 2: Update CHANGELOG.md
8475

8576
The CHANGELOG doubles as **release notes** — it's what users see on the GitHub release page. Write it for humans, not machines.
8677

@@ -116,7 +107,7 @@ Rules:
116107
- Include a Performance section if there are performance improvements
117108
- Read previous CHANGELOG entries to match the tone and detail level
118109

119-
## Step 4: Update ROADMAP.md
110+
## Step 3: Update ROADMAP.md
120111

121112
Read `docs/roadmap/ROADMAP.md` and update:
122113
1. **Version header** — update `Current version: X.Y.Z`
@@ -126,7 +117,7 @@ Read `docs/roadmap/ROADMAP.md` and update:
126117
- Add checklist items: `- ✅` for done, `- 🔲` for remaining
127118
- Check actual code exists (glob/grep for new files/directories mentioned in PRs) before marking tasks complete
128119

129-
## Step 5: Update BACKLOG.md
120+
## Step 4: Update BACKLOG.md
130121

131122
Read `docs/roadmap/BACKLOG.md` and check if any backlog items were completed or partially completed by commits in this release.
132123

@@ -138,7 +129,7 @@ Read `docs/roadmap/BACKLOG.md` and check if any backlog items were completed or
138129
- Check the "Depends on" column of other items — if they depended on the newly completed item, note that they are now unblocked
139130
- Update the `Last updated` date at the top of the file
140131

141-
## Step 6: Update README.md
132+
## Step 5: Update README.md
142133

143134
Read `README.md` and check if any new user-facing features from this release need to be documented:
144135

@@ -154,79 +145,60 @@ Read `README.md` and check if any new user-facing features from this release nee
154145
6. **Version references** — only update version-specific references (e.g., install commands). Historical milestone markers like "Complete (v3.0.0)" should stay as-is
155146
7. If nothing user-facing changed (pure refactors, bug fixes, internal improvements), no README update is needed — **but still run the roadmap ordering cross-check (item 5)**
156147

157-
## Step 7: Verify package-lock.json
148+
## Step 6: Verify `libc` fields in package-lock.json
158149

159-
Run `grep` to confirm the new version appears in `package-lock.json` and that all `@optave/codegraph-*` optional dependency entries are complete (have version, resolved, integrity, cpu, os fields). Flag any incomplete entries — they indicate an unpublished platform binary.
150+
Some npm versions (notably v11+) silently strip the `libc` field from Linux entries in `package-lock.json`. Without `libc`, npm may install glibc binaries on musl systems (Alpine) and vice versa.
160151

161-
**Critical: verify `libc` fields on Linux entries.** Some npm versions (notably v11+) silently strip the `libc` field when regenerating the lock file via `npm install --package-lock-only`. Without `libc`, npm may install glibc binaries on musl systems (Alpine) and vice versa. Check:
152+
Even though this skill does not bump versions, check that `libc` fields are present — they can go missing after any `npm install` run:
162153

163154
```bash
164155
grep -A12 'codegraph-linux' package-lock.json | grep -c libc
165-
# Expected: 3 (one each for linux-arm64-gnu, linux-x64-gnu, linux-x64-musl)
156+
# Expected: 3 (one each for linux-arm64-gnu, linux-x64-gnu, linux-x64-musl)
166157
```
167158

168-
If the count is less than 3, manually restore the missing fields:
159+
If the count is less than 3, restore the missing fields in a separate commit:
169160
- `-gnu` packages: `"libc": ["glibc"]`
170161
- `-musl` packages: `"libc": ["musl"]`
171162

172163
Place the `libc` array after the `cpu` array in each entry.
173164

174-
## Step 7b: Validate release config scripts
175-
176-
Verify that all script references in release-related config files point to files that actually exist. Broken references cause silent failures during `npm run release` or the publish workflow.
177-
178-
Check these files for script paths:
179-
180-
```bash
181-
# .versionrc.json — check any "scripts" entries (runner and forwarded args)
182-
grep -oP 'node \K[^ "]+' .versionrc.json 2>/dev/null | while read script; do
183-
[ ! -f "$script" ] && echo "ERROR: .versionrc.json references '$script' but it does not exist"
184-
done
185-
grep -oP 'node [^ "]+ \K[^ "]+' .versionrc.json 2>/dev/null | while read script; do
186-
[ ! -f "$script" ] && echo "ERROR: .versionrc.json references '$script' but it does not exist"
187-
done
188-
189-
# package.json — check version/preversion/postversion lifecycle hooks
190-
grep -E '"(pre)?version"|"postversion"' package.json | grep -oP 'node \K[^ "&]+' | while read script; do
191-
[ ! -f "$script" ] && echo "ERROR: package.json lifecycle references '$script' but it does not exist"
192-
done
193-
194-
# Also check forwarded script arguments (e.g. "node scripts/node-ts.js scripts/foo.ts")
195-
grep -E '"(pre)?version"|"postversion"' package.json | grep -oP 'node [^ "&]+ \K[^ "&]+' | while read script; do
196-
[ ! -f "$script" ] && echo "ERROR: package.json lifecycle references '$script' but it does not exist"
197-
done
198-
```
199-
200-
If any script reference is broken, fix it before proceeding. Common causes:
201-
- `.js` extension referencing a `.ts`-only file (use `node scripts/node-ts.js scripts/<name>.ts` instead)
202-
- Redundant script entries that duplicate what npm lifecycle hooks already handle (remove them)
203-
204-
## Step 8: Create branch, commit, push, PR
165+
## Step 7: Create branch, commit, push, PR
205166

206167
1. Create branch: `git checkout -b release/VERSION` (if on detached HEAD from Step 0, this creates the branch at the current commit)
207-
2. Stage only the files you changed: `CHANGELOG.md`, `package.json`, `package-lock.json`, `docs/roadmap/ROADMAP.md`, `docs/roadmap/BACKLOG.md` if changed, `README.md` if changed
208-
3. Commit: `chore: release vVERSION`
168+
2. Stage only the files you changed: `CHANGELOG.md`, `docs/roadmap/ROADMAP.md`, `docs/roadmap/BACKLOG.md` if changed, `README.md` if changed, `package-lock.json` if libc fields were fixed
169+
3. Commit: `docs: prepare release notes for vVERSION`
209170
4. Push: `git push -u origin release/VERSION`
210171
5. Create PR:
211172

212173
```
213-
gh pr create --title "chore: release vVERSION" --body "$(cat <<'EOF'
174+
gh pr create --title "docs: prepare release notes for vVERSION" --body "$(cat <<'EOF'
214175
## Summary
215-
- Bump version to VERSION
216-
- Add CHANGELOG entry for all commits since previous release
176+
- Add CHANGELOG entry for vVERSION (all commits since previous release)
217177
- Update ROADMAP progress
218178
179+
**After merging:** create a GitHub Release with tag `vVERSION` to trigger the publish workflow, which handles version bumping, native binary builds, and npm publishing.
180+
219181
## Test plan
220-
- [ ] `npm install` succeeds with updated lock file
221182
- [ ] CHANGELOG renders correctly on GitHub
222183
- [ ] ROADMAP checklist items match actual codebase state
223184
EOF
224185
)"
225186
```
226187

188+
## Step 8: Post-merge instructions
189+
190+
After the PR is merged, remind the user:
191+
192+
> **Next step:** Go to GitHub → Releases → "Draft a new release" → tag `vVERSION` → target `main` → title `vVERSION` → auto-generate release notes or paste the CHANGELOG section → Publish.
193+
>
194+
> This triggers the publish workflow which will:
195+
> 1. Build native binaries for all 6 platforms with the correct version
196+
> 2. Publish platform packages and main package to npm
197+
> 3. Push a version bump PR (`package.json`, `Cargo.toml`, `package-lock.json`) back to main
198+
227199
## Important reminders
228200

201+
- **No version bumps in this PR** — the publish workflow handles `package.json`, `Cargo.toml`, `package-lock.json`, and `optionalDependencies` atomically after building native binaries
229202
- **No co-author lines** in commit messages
230203
- **No Claude Code references** in commit messages or PR descriptions
231-
- The publish workflow (`publish.yml`) handles: optionalDependencies version sync, npm publishing, git tagging, and the post-publish version bump PR
232-
- If you find issues (incomplete lock entries, phantom packages), fix them in a separate commit with a descriptive message
204+
- If you find `libc` field issues in package-lock.json, fix them in a separate commit with a descriptive message

0 commit comments

Comments
 (0)