@@ -23,8 +23,10 @@ git status --porcelain
2323# Check current branch
2424git branch --show-current
2525
26- # Check for plugin.json
27- test -f .claude-plugin/plugin.json && echo " EXISTS" || echo " MISSING"
26+ # Detect version file (check in priority order)
27+ for f in .claude-plugin/plugin.json package.json pyproject.toml Cargo.toml; do
28+ test -f " $f " && echo " VERSION_FILE=$f " && break
29+ done
2830
2931# Check for gh CLI
3032command -v gh > /dev/null 2>&1 && echo " INSTALLED" || echo " NOT_FOUND"
@@ -36,11 +38,18 @@ command -v gh >/dev/null 2>&1 && echo "INSTALLED" || echo "NOT_FOUND"
3638 - If dirty: Error with message: "Working directory has uncommitted changes. Please commit or stash changes before creating a release."
3739- Current branch SHOULD be main/master
3840 - If not: Ask user to confirm creating release from current branch
39- - plugin.json MUST exist
40- - If missing: Error with message: "File .claude-plugin/plugin.json not found. Are you in a plugin directory?"
41+ - A supported version file MUST exist (one of the following, checked in order):
42+ - ` .claude-plugin/plugin.json ` — Claude Code plugin
43+ - ` package.json ` — Node.js project
44+ - ` pyproject.toml ` — Python project (version in ` [project] ` or ` [tool.poetry] ` )
45+ - ` Cargo.toml ` — Rust project (version in ` [package] ` )
46+ - If none found: Error with message: "No supported version file found. Releaserator supports: plugin.json, package.json, pyproject.toml, Cargo.toml"
4147- gh CLI MUST be installed
4248 - If missing: Error with message: "GitHub CLI (gh) not found. Install with: brew install gh"
4349
50+ ** Store** :
51+ - ` VERSION_FILE ` = path to the detected version file
52+
4453** Optional check** : Verify docs/CONTEXT.md is recent (< 24 hours old)
4554- If stale: Warn user and suggest running ` /session-wrapup ` first
4655
@@ -49,8 +58,8 @@ command -v gh >/dev/null 2>&1 && echo "INSTALLED" || echo "NOT_FOUND"
4958** Task** : Read current version and find last release tag
5059
5160``` bash
52- # Read current version from plugin.json (use Read tool)
53- # Parse the " version" field
61+ # Read current version from VERSION_FILE (use Read tool)
62+ # Parse the version field based on file type (see below)
5463
5564# Find last tag (if any)
5665git describe --tags --abbrev=0 2> /dev/null || echo " NO_TAGS"
@@ -59,14 +68,23 @@ git describe --tags --abbrev=0 2>/dev/null || echo "NO_TAGS"
5968git tag --list --sort=-version:refname
6069```
6170
71+ ** Version parsing by file type** :
72+
73+ | Version File | How to read version |
74+ | ---| ---|
75+ | ` .claude-plugin/plugin.json ` | JSON field ` "version" ` |
76+ | ` package.json ` | JSON field ` "version" ` |
77+ | ` pyproject.toml ` | ` [project] version = "X.Y.Z" ` or ` [tool.poetry] version = "X.Y.Z" ` |
78+ | ` Cargo.toml ` | ` [package] version = "X.Y.Z" ` |
79+
6280** Logic** :
6381
64- - Parse version from plugin.json (e.g., "1.0.0")
82+ - Read and parse version from VERSION_FILE
6583- If no tags exist, this is first release (baseline: use all commits)
6684- If tags exist, use latest tag as baseline for commit collection
6785
6886** Store** :
69- - ` CURRENT_VERSION ` = version from plugin.json
87+ - ` CURRENT_VERSION ` = version from VERSION_FILE
7088- ` LAST_TAG ` = latest git tag (or "NO_TAGS")
7189- ` IS_FIRST_RELEASE ` = true if no tags exist
7290
@@ -257,24 +275,28 @@ test -f CHANGELOG.md && echo "EXISTS" || echo "MISSING"
257275
258276** Use Write tool** to create/update CHANGELOG.md
259277
260- ### Step 7: Update plugin.json Version
278+ ### Step 7: Update Version File
279+
280+ ** Task** : Write new version to VERSION_FILE
261281
262- ** Task ** : Write new version to .claude-plugin/plugin.json
282+ ** By file type ** :
263283
264- 1 . Read .claude-plugin/plugin.json
265- 2 . Parse JSON
266- 3 . Update ` "version" ` field to NEW_VERSION
267- 4 . Write back with proper formatting (2-space indentation, trailing newline)
284+ | Version File | How to update |
285+ | ---| ---|
286+ | ` .claude-plugin/plugin.json ` | Update JSON ` "version" ` field. Use 2-space indentation, trailing newline. |
287+ | ` package.json ` | Update JSON ` "version" ` field. Preserve existing indentation and trailing newline. |
288+ | ` pyproject.toml ` | Replace ` version = "OLD" ` with ` version = "NEW" ` in the correct section. |
289+ | ` Cargo.toml ` | Replace ` version = "OLD" ` with ` version = "NEW" ` in the ` [package] ` section. |
268290
269- ** Use Read and Write tools** (or Edit tool for simple replacement)
291+ ** Use Read and Edit tools** for precise replacement.
270292
271293### Step 8: Commit Version Bump
272294
273295** Task** : Create commit for version and changelog changes
274296
275297``` bash
276- # Stage files
277- git add .claude-plugin/plugin.json CHANGELOG.md
298+ # Stage files (VERSION_FILE is the detected version file from Step 1)
299+ git add VERSION_FILE CHANGELOG.md
278300
279301# Create commit
280302git commit -m " chore: bump version to NEW_VERSION"
@@ -379,7 +401,7 @@ Output a summary:
379401✅ Release vNEW_VERSION created successfully!
380402
381403** Changes** :
382- - Updated plugin.json (OLD_VERSION → NEW_VERSION)
404+ - Updated VERSION_FILE (OLD_VERSION → NEW_VERSION)
383405- Created/updated CHANGELOG.md with entry for vNEW_VERSION
384406- Committed changes (abc1234: "chore: bump version to NEW_VERSION")
385407- Created git tag vNEW_VERSION
@@ -463,10 +485,10 @@ After installing, run: gh auth login
463485** Message** :
464486```
465487❌ Version X.Y.Z already exists as git tag.
466- Current version in plugin.json : X.Y.Z
488+ Current version in VERSION_FILE : X.Y.Z
467489Existing tag: vX.Y.Z
468490
469- Please update plugin.json manually to a higher version ,
491+ Please update the version manually in VERSION_FILE ,
470492or delete the tag if it was created in error:
471493 git tag -d vX.Y.Z
472494 git push origin :refs/tags/vX.Y.Z
@@ -632,7 +654,7 @@ After running releaserator, verify:
632654
633655- ✅ CHANGELOG.md created or updated with new entry
634656- ✅ CHANGELOG.md follows Keep A Changelog format
635- - ✅ plugin.json version field updated correctly
657+ - ✅ Version file updated correctly ( plugin.json, package.json, pyproject.toml, or Cargo.toml)
636658- ✅ Git commit created with conventional commit message
637659- ✅ Annotated git tag created (not lightweight)
638660- ✅ Tag pushed to remote
0 commit comments