Skip to main content
ClaudeWave
Slash Command91 repo starsupdated 3mo ago

release

The release command automates the complete publication workflow for Spec-Flow by executing pre-flight checks (git remote, branch, authentication), detecting version bumps via conventional commits, validating builds, updating package.json and CHANGELOG.md, creating git commits and tags, publishing GitHub releases, and pushing to npm registry. Use this command when ready to publish a new version after merging features to the main branch.

Install in Claude Code
Copy
mkdir -p ~/.claude/commands && curl -fsSL https://raw.githubusercontent.com/marcusgoll/Spec-Flow/HEAD/.claude/commands/internal/release.md -o ~/.claude/commands/release.md
Then start a new Claude Code session; the slash command loads automatically.

release.md

<context>
Current git status: !`git status --short | head -5`

Current branch: !`git branch --show-current`

Current version: !`node -p "require('./package.json').version" 2>/dev/null || echo "unknown"`

Last git tag: !`git describe --tags --abbrev=0 2>/dev/null || echo "none"`

npm authentication: !`npm whoami 2>/dev/null && echo "✅ Authenticated" || echo "❌ Not authenticated"`

GitHub authentication: !`gh auth status >/dev/null 2>&1 && echo "✅ Authenticated" || echo "❌ Not authenticated"`

Git remote configured: !`git remote -v | grep -q origin && echo "✅ Configured" || echo "❌ Not configured"`

Recent commits (last 10): !`git log -10 --pretty=format:"%s" 2>/dev/null || echo "No commits found"`

README.md Recent Updates (first 50 lines): !`grep -A 50 "## 🆕 Recent Updates" README.md | head -50 2>/dev/null || echo "Section not found"`
</context>

<objective>
Automate the complete release workflow for the Spec-Flow package, ensuring consistency and reducing manual errors.

**What it does:**
1. Pre-flight checks (git, npm, CI status)
2. Version bump detection (conventional commits → MAJOR, MINOR, PATCH)
3. Build validation (dist/ directory with BUILD_REPORT.md)
4. File updates (package.json, CHANGELOG.md, README.md Recent Updates)
5. Git operations (commit, tag, push)
6. GitHub Release creation with CHANGELOG notes
7. npm package publishing
8. Optional X (Twitter) announcement

**README.md updates include:**
- New version section in "Recent Updates" (extracted from CHANGELOG)
- Feature highlights and breaking changes
- Version badge updates for major releases
- Chronological ordering (newest at top)

**Operating constraints:**
- **INTERNAL USE ONLY** — For Spec-Flow workflow development only
- **Pre-flight Blockers** — 5 checks must pass (git remote, main branch, clean tree, npm auth, CI status)
- **Build Validation** — dist/BUILD_REPORT.md must exist (v6.12.0+)
- **Conventional Commits** — Version bump follows semantic versioning rules
- **Git Safety** — Never force push, always verify remote before push

**Dependencies:**
- Git repository with remote configured
- On main branch with clean working tree
- npm authentication configured (npm whoami)
- GitHub CLI authenticated (gh auth status)
- CI passing on latest commit
- Build system configured (npm run build)
</objective>

<process>
1. **Execute pre-flight checks** (5 checks):
   - Git remote configured
   - On main branch
   - Working tree clean (no uncommitted changes)
   - npm authenticated (npm whoami)
   - CI passing on latest commit (gh run list)

   **If any check fails**: Display specific error and exit. User must fix issue before releasing.

2. **Detect version bump** using conventional commits:
   - Get current version from package.json
   - Get last git tag (or v0.0.0 if none)
   - Analyze commits since last tag:
     - **MAJOR**: Any commit with "BREAKING CHANGE:" or "!" after type
     - **MINOR**: Any commit with "feat:" prefix
     - **PATCH**: Any commit with "fix:", "docs:", "chore:", "refactor:", "test:"
   - Calculate new version (e.g., 6.11.0 → 6.12.0 for MINOR bump)

3. **Run build system**:
   ```bash
   npm run build
   ```
   - Validate dist/ directory created
   - Verify BUILD_REPORT.md exists in dist/
   - **If build fails**: Display error and exit

4. **Update package.json**:
   - Load current package.json
   - Update version field to new version
   - Write back with proper formatting (2-space indent + newline)

5. **Update CHANGELOG.md**:
   - Read current CHANGELOG.md
   - Extract commits since last tag grouped by type (Features, Fixes, Docs, Chores)
   - Insert new version section under ## [Unreleased]:
     ```markdown
     ## [X.Y.Z] - YYYY-MM-DD

     ### Features
     - feat: description (commit hash)

     ### Fixes
     - fix: description (commit hash)
     ```
   - Write updated CHANGELOG.md

6. **Update README.md**:
   - **Recent Updates section**: Insert new version under "🆕 Recent Updates"
     - Extract version, date, and highlights from CHANGELOG.md
     - Create formatted section with version number, date, and bullet points
     - Insert at top of Recent Updates (push older versions down)
     - Format: `### vX.Y.Z (Month YYYY)` + feature highlights
   - **Version badges**: Update npm version badge if major version change
   - **Breaking changes note**: Add breaking changes section if MAJOR bump
   - **Keep existing releases**: Preserve all existing version entries
   - Example update:
     ```markdown
     ## 🆕 Recent Updates

     ### v10.0.0 (November 2025)

     **Git Worktrees & Perpetual Learning** - Parallel development and self-improving workflows

     - **Git Worktrees**: Enable multiple Claude Code instances on different epics/features
       - Automatic worktree creation per epic/feature
       - Shared memory linking for cross-worktree observability
       - Automatic cleanup after /finalize
     - **Perpetual Learning System**: Continuously improve workflow efficiency
       - Performance pattern detection (auto-applied optimizations)
       - Anti-pattern detection (failure prevention)
       - Custom abbreviation learning (project terminology)
       - CLAUDE.md optimization (system prompt improvements with approval)
     - **NPM Update Protection**: Learnings persist across package updates via migration system

     **Breaking Changes**:
     - None (backwards compatible with v9.x.x)

     ---

     ### v9.4.0 (November 2025)
     ...
     ```

7. **Git commit and tag**:
   ```bash
   git add package.json CHANGELOG.md README.md dist/
   git commit -m "chore: release vX.Y.Z"
   git tag -a vX.Y.Z -m "Release vX.Y.Z"
   ```

8. **Push to remote**:
   ```bash
   git push origin main
   git push origin vX.Y.Z
   ```
   - Verify remote is origin before pushing
   - Use separate commands for branch and tag (safer than --tags)

9. **Create GitHub Release**:
   ```bash
   gh release create vX.Y.Z \
     --title "Release vX.Y.Z" \
     --notes "{CHANGELOG section for this version}" \