Snoozer10/synthesize-skills / .agents/skills/release-sync
release-sync
VerifiedUse when detecting release semver version drift across VERSION, GEMINI.md, and package.json, maintaining CHANGELOG and README release hygiene, or atomically bumping release versions
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 2.1 KB |
| references/api.md | markdown | 1.2 KB |
| references/examples.md | markdown | 1.1 KB |
| scripts/bump.py | script | 6.8 KB |
| scripts/check.py | script | 4.5 KB |
scripts/bump.py
View on GitHub"""release-sync atomic version bump. Stdlib only.
Writes VERSION, GEMINI.md, package.json atomically with rollback on failure.
Exit codes: 0=success/dry-run, 1=failure, 2=usage error
Usage: bump.py major|minor|patch [--apply] [--json]
"""
import json
import os
import re
import subprocess
import sys
import tempfile
from datetime import date
from pathlib import Path
SEMVER_RE = re.compile(r"^(\d+)\.(\d+)\.(\d+)$")
if hasattr(sys.stdout, "reconfigure"):
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
if hasattr(sys.stderr, "reconfigure"):
sys.stderr.reconfigure(encoding="utf-8", errors="replace")
def _find_root():
cur = Path.cwd()
for _ in range(6):
if (cur / "VERSION").exists():
return cur
if cur.parent == cur:
break
cur = cur.parent
return Path.cwd()
def _read_version(root):
p = root / "VERSION"
return p.read_text(encoding="utf-8").strip() if p.exists() else ""
def _semver_parse(v):
m = SEMVER_RE.match(v.strip())
if not m:
raise ValueError(f"bad semver: {v!r}")
return tuple(int(x) for x in m.groups())
def _semver_bump(v, kind):
maj, mi, pa = _semver_parse(v)
if kind == "major":
return f"{maj + 1}.0.0"
if kind == "minor":
return f"{maj}.{mi + 1}.0"
if kind == "patch":
return f"{maj}.{mi}.{pa + 1}"
raise ValueError(f"unknown kind: {kind!r}")
def _atomic_write(target, content):
target.parent.mkdir(parents=True, exist_ok=True)
fd, tmp = tempfile.mkstemp(dir=str(target.parent), prefix="tmp.")
try:
with os.fdopen(fd, "w", encoding="utf-8", newline="\n") as f:
f.write(content)
f.flush()
os.fsync(f.fileno())
os.replace(tmp, str(target))
except Exception:
try:
os.unlink(tmp)
except Exception:
pass
raise
def _atomic_write_bytes(target, data: bytes):
target.parent.mkdir(parents=True, exist_ok=True)
fd, tmp = tempfile.mkstemp(dir=str(target.parent), prefix="tmp.")
try:
with os.fdopen(fd, "wb") as f:
f.write(data)
f.flush()
os.fsync(f.fileno())
os.replace(tmp, str(target))
except Exception:
try:
os.unlink(tmp)
except Exception:
pass
raise
def _run_check(root):
check_py = Path(__file__).parent / "check.py"
r = subprocess.run(
[sys.executable, str(check_py)],
cwd=str(root), capture_output=True, text=True,
encoding="utf-8", errors="replace", shell=False,
)
return r.returncode == 0
def _git_clean(root):
r = subprocess.run(
["git", "diff", "--quiet"], cwd=str(root),
capture_output=True, text=True, shell=False,
)
r2 = subprocess.run(
["git", "diff", "--cached", "--quiet"], cwd=str(root),
capture_output=True, text=True, shell=False,
)
return r.returncode == 0 and r2.returncode == 0
def _git_ignored(root, path):
r = subprocess.run(
["git", "check-ignore", "-q", path], cwd=str(root),
capture_output=True, text=True, shell=False,
)
return r.returncode == 0
def bump(kind, apply=False, as_json=False, root=None):
root = root or _find_root()
if kind not in ("major", "minor", "patch"):
print(f"usage: kind must be major|minor|patch, got {kind!r}", file=sys.stderr)
return 2
v = _read_version(root)
try:
_semver_parse(v)
except ValueError as e:
print(f"usage: {e}", file=sys.stderr)
return 2
new = _semver_bump(v, kind)
if not apply:
msg = f"would bump {v} -> {new}"
if as_json:
print(json.dumps({"action": "dry-run", "from": v, "to": new}))
else:
print(msg)
return 0
# pre-checks
if not _run_check(root):
print("error: pre-check drift detected, abort bump", file=sys.stderr)
return 1
if not _git_clean(root):
print("error: working tree not clean, abort bump", file=sys.stderr)
return 1
if _git_ignored(root, "VERSION"):
print("error: VERSION is gitignored, abort bump", file=sys.stderr)
return 1
# read originals for rollback
originals = {}
existed = {}
targets = [root / "VERSION", root / "GEMINI.md", root / "package.json"]
readme_p = root / "README.md"
if readme_p.exists():
targets.append(readme_p)
for p in targets:
existed[p] = p.exists()
if p.exists():
originals[p] = p.read_bytes()
today = date.today().isoformat()
try:
# VERSION
_atomic_write(root / "VERSION", new + "\n")
# GEMINI.md
gemini = root / "GEMINI.md"
if gemini.exists():
t = gemini.read_text(encoding="utf-8")
t = re.sub(r'^(version:\s*)["\']?[^"\'\r\n]+["\']?', rf'\1"{new}"', t, flags=re.MULTILINE)
t = re.sub(r'^(last_indexed:\s*)["\']?[^"\'\r\n]+["\']?', rf'\1"{today}"', t, flags=re.MULTILINE)
_atomic_write(gemini, t)
# package.json
pkg = root / "package.json"
if pkg.exists():
pj = json.loads(pkg.read_text(encoding="utf-8"))
pj["version"] = new
_atomic_write(pkg, json.dumps(pj, indent=2) + "\n")
# README.md
if readme_p.exists():
rt = readme_p.read_text(encoding="utf-8")
if "<!-- release-sync:start -->" in rt:
rt = re.sub(
r"(<!-- release-sync:start -->).*?(<!-- release-sync:end -->)",
rf"\g<1>Version: {new}\g<2>",
rt,
flags=re.DOTALL,
)
_atomic_write(readme_p, rt)
# post-check
if not _run_check(root):
raise RuntimeError("post-check failed")
except Exception as e:
print(f"error: bump failed, rolling back: {e}", file=sys.stderr)
for p, data in originals.items():
try:
_atomic_write_bytes(p, data)
except Exception:
pass
version_p = root / "VERSION"
if not existed.get(version_p, False) and version_p.exists():
try:
version_p.unlink()
except Exception:
pass
return 1
if as_json:
print(json.dumps({"action": "bumped", "from": v, "to": new}))
else:
print(f"bumped {v} -> {new}")
return 0
def main(argv=None):
args = list(argv or sys.argv[1:])
as_json = "--json" in args
apply = "--apply" in args
args = [a for a in args if a not in ("--json", "--apply")]
if not args:
print("usage: bump.py major|minor|patch [--apply] [--json]", file=sys.stderr)
return 2
return bump(args[0], apply=apply, as_json=as_json)
if __name__ == "__main__":
sys.exit(main())
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-changelog-updatemorluto/reaPrepare or rewrite REA release changelogs and GitHub release notes from pinned Git history, with verified contributor thanks and Release Please synchronization. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| academy-guideanthropics/skillsStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials, and use cases from Claude Academy (academy.claude.com), Anthropic's learning hub. Trigger on: "how do I", "how can I", "getting started with", "what can Claude do", "teach me", "learn to use"; questions about artifacts, projects, skills, plugins, connectors, MCP; requests about rolling Claude out to a team, class, or organization; and any ask for training materials, onboarding content, or learning resources. Use it when the user is learning how to use a feature or product — not when they are mid-task and just want the task done. This skill composes with other skills: after consulting product documentation to answer how a Claude feature works, also check here for a matching course or tutorial — a docs-grounded answer and an Academy recommendation belong together. Only recommend on a strong match; never invent Academy content. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| claude-apianthropics/skillsReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any form (Claude, Anthropic, Fable, Opus, Sonnet, Haiku, `anthropic`, `@anthropic-ai`, `claude-*`, `us.anthropic.*`, `[1m]`); the user asks about an LLM (pricing/model choice/limits/caching) — never answer from memory; OR the task is LLM-shaped with provider unstated (agent/MCP/tool-definition/multi-agent/RAG/LLM-judge/computer-use; generate/summarize/extract/classify/rewrite/converse over NL; debugging refusals/cutoffs/streaming/tool-calls/tokens). SKIP only when another provider is being worked on (overrides all triggers): OpenAI/GPT/Gemini/Llama/Mistral/Cohere/Ollama named in the query; OR `grep -rE 'openai|langchain_openai|google.generativeai|genai|mistralai|cohere|ollama'` over the project hits (run this grep FIRST if no provider named — don't Read the file). | Stars: 198k | Updated | Claude CodeCodex | Unverified | Install |
| doc-coauthoringanthropics/skillsGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |