Add the version bump script to this repo by following the spec/instructions from
https://gist.githubusercontent.com/alexey-max-fedorov/afd71efa9cd19915c3ea2c1eba883f95/raw/e518ce1560a559333e39a75e3727b7944989537f/add-bump-version.md
Last active
May 18, 2026 18:12
-
-
Save alexey-max-fedorov/afd71efa9cd19915c3ea2c1eba883f95 to your computer and use it in GitHub Desktop.
Claude prompt: add a bump-version.sh script to any project
Scan this project for every file that contains a version number, then:
- Write
bump-version.shin the project root that atomically updates all of them. chmod +x bump-version.sh- Update
CLAUDE.md— append a## Version Bumpsection (two lines: the header + a one-line quick ref). If no CLAUDE.md exists, create one with just those two lines.
Look for version numbers in:
package.json→"version"fieldmanifest.json/manifest.v3.json→"version"field- Any
*.ts/*.jsfile withexport const VERSION = "..."orexport const version = "..." Cargo.toml→version = "..."under[package]pyproject.toml→version = "..."under[tool.poetry]or[project]- Any file literally named
VERSION
Read each candidate file to confirm the version field actually exists. Skip build output directories (build/, dist/, .next/, target/).
Report what you found before writing anything.
Use this structure, adapting the body to only include the files you actually found:
#!/usr/bin/env bash
set -euo pipefail
NEW_VERSION="${1:-}"
if [ -z "$NEW_VERSION" ]; then
echo "Usage: ./bump-version.sh <new-version>"
echo "Example: ./bump-version.sh 1.2.0"
exit 1
fi
ROOT="$(cd "$(dirname "$0")" && pwd)"
# JSON files — use node so formatting stays intact
# node -e "
# const fs = require('fs');
# const p = '\$ROOT/package.json';
# const pkg = JSON.parse(fs.readFileSync(p, 'utf8'));
# pkg.version = '\$NEW_VERSION';
# fs.writeFileSync(p, JSON.stringify(pkg, null, 2) + '\n');
# "
# TypeScript/JS VERSION constants — use sed
# sed -i '' "s/^export const VERSION = \".*\";/export const VERSION = \"\$NEW_VERSION\";/" \
# "\$ROOT/path/to/version.ts"
# Cargo.toml — use sed (replace only the first occurrence under [package])
# sed -i '' "0,/^version = \".*\"/{s/^version = \".*\"/version = \"\$NEW_VERSION\"/}" \
# "\$ROOT/Cargo.toml"
echo "✓ Bumped to v\$NEW_VERSION"
# echo " → package.json"
# echo " → ..."Uncomment and fill in only the blocks that match the files you found. Do not include stubs for files that don't exist.
Append (or create) exactly:
## Version Bump
`./bump-version.sh <version>` — syncs version across <comma-separated list of files you found>
If CLAUDE.md already has a ## Version Bump section, replace it instead of duplicating.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment