跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
浏览器与自动化

release

Create a release branch and PR to main with auto-extracted changes from staging

rlajous · 已有静态检查记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add rlajous/claude-code-commands --skill release

技能说明


name: release description: Create a release branch and PR to main with auto-extracted changes from staging disable-model-invocation: false allowed-tools: Read, Grep, Glob, Task, Bash, AskUserQuestion, Edit user-invocable: true

Cross-runtime: follow runtime compatibility for invocation, delegation, configuration precedence, state paths, and permissions.

You are helping create a production release. Your task is to create a release branch from the development branch, bump the version, extract changes, and create a comprehensive release PR to the production branch.

Step 1: Load Configuration

Check for configuration:

if [ -f ".git-workflow/config.yaml" ]; then CONFIG_PATH=".git-workflow/config.yaml"; elif [ -f ".claude/config.yaml" ]; then CONFIG_PATH=".claude/config.yaml"; else CONFIG_PATH=""; fi

Load from the resolved CONFIG_PATH (canonical first, legacy read-only fallback):

workflow:
  type: staging # staging | tag-based | direct
  developmentBranch: staging
  productionBranch: main
branches:
  release: "release/{version}"
versioning:
  file: auto # auto | package.json | pyproject.toml | VERSION | Cargo.toml
release:
  watchFiles:
    openapi: docs/openapi.json
    migrations: prisma/migrations/**/migration.sql
    schema: prisma/schema.prisma
  generateChangelog: true

Default Values:

workflow:
  developmentBranch: staging
  productionBranch: main
branches:
  release: "release/{version}"
versioning:
  file: auto

Step 2: Verify Current State

Check that you're on the development branch and up-to-date:

# Get configured branches
DEV_BRANCH=$(config.workflow.developmentBranch || "staging")
PROD_BRANCH=$(config.workflow.productionBranch || "main")

# Check current branch
CURRENT=$(git branch --show-current)
echo "Current branch: $CURRENT"
echo "Expected: $DEV_BRANCH"

# Fetch latest
git fetch origin

# Check if up-to-date
git status

Validation:

  • If not on development branch:
    You must be on {DEV_BRANCH} branch to create a release.
    Run: git checkout {DEV_BRANCH} && git pull
    
  • If behind remote:
    Your {DEV_BRANCH} branch is behind origin.
    Run: git pull origin {DEV_BRANCH}
    
  • If there are uncommitted changes:
    You have uncommitted changes. Commit or stash them first.
    

Step 3: Detect Version File

Auto-detect or use configured version file:

# Check for version files in order of priority
if [ -f "package.json" ]; then
  VERSION_FILE="package.json"
  VERSION_TYPE="node"
elif [ -f "pyproject.toml" ]; then
  VERSION_FILE="pyproject.toml"
  VERSION_TYPE="python"
elif [ -f "Cargo.toml" ]; then
  VERSION_FILE="Cargo.toml"
  VERSION_TYPE="rust"
elif [ -f "VERSION" ]; then
  VERSION_FILE="VERSION"
  VERSION_TYPE="plain"
elif [ -f "build.gradle" ] || [ -f "build.gradle.kts" ]; then
  VERSION_FILE="build.gradle"
  VERSION_TYPE="gradle"
else
  VERSION_FILE="VERSION"
  VERSION_TYPE="plain"
fi

Read Current Version:

TypeCommand
Node.jsnode -p "require('./package.json').version"
Pythongrep -Po '(?<=version = ")[^"]*' pyproject.toml
Rustgrep -Po '(?<=^version = ")[^"]*' Cargo.toml
Plaincat VERSION
Gradlegrep -Po '(?<=version = ")[^"]*' build.gradle

Step 4: Ask for Version Type

Ask the user which version bump to perform (use the active host user-input mechanism):

Question: "What type of version bump for this release?"

Options:

  • patch: Bug fixes only (1.2.3 → 1.2.4)
  • minor: New features, backward compatible (1.2.3 → 1.3.0)
  • major: Breaking changes (1.2.3 → 2.0.0)

Display:

Current version: {CURRENT_VERSION}
Version file: {VERSION_FILE}

Select version bump:
- patch: {CURRENT} → {PATCH_VERSION}
- minor: {CURRENT} → {MINOR_VERSION}
- major: {CURRENT} → {MAJOR_VERSION}

Step 5: Calculate New Version

Based on user selection:

Current: 1.2.3
Patch:   1.2.4
Minor:   1.3.0
Major:   2.0.0

Version Calculation Logic:

// Parse version
const [major, minor, patch] = currentVersion.split('.').map(Number);

// Calculate new version based on type
switch (bumpType) {
  case 'patch':
    return `${major}.${minor}.${patch + 1}`;
  case 'minor':
    return `${major}.${minor + 1}.0`;
  case 'major':
    return `${major + 1}.0.0`;
}

Confirm with user:

Current version: 1.2.3
New version: 1.3.0

Proceed with release v1.3.0?

Step 6: Extract Changes from Development Branch

Get commits between production and development:

PROD_BRANCH=$(config.workflow.productionBranch || "main")
DEV_BRANCH=$(config.workflow.developmentBranch || "staging")

git log origin/${PROD_BRANCH}..origin/${DEV_BRANCH} --pretty=format:"%s" --no-merges

Categorize Commits:

Parse commits and group by type:

CategoryMatch Patterns
Bug Fixes[Fix], [FIX], fix:, fix(
Features[Feature], feat:, feat(
Improvements[Refactor], [Perf], improve, enhance
Documentation[Docs], docs:
OtherEverything else

Extract PR Numbers:

# Extract PR references: #123, (#456)
echo "$COMMIT_MSG" | grep -oE '#[0-9]+' | sort -u

Example Output:

### Bug Fixes

- Fix trending coins endpoint and date formatting (#662)
- Improve holder analysis accuracy (#655)

### Features

- Add cross-chain risk tag aggregation (#648)

### Improvements

- Preserve holder concentration precision (#647)

阅读完整来源 ↗