Files
wehub-resource-sync bb5c75ce05
Component Security Validation / Security Audit (push) Has been cancelled
Deploy to Cloudflare Pages / deploy (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:38:58 +08:00

1 line
9.3 KiB
JSON

{"content": "---\nallowed-tools: Bash(git:*), Read, Edit, Write\nargument-hint: <version>\ndescription: Create a new Git Flow release branch from develop with version bumping and changelog generation\n---\n\n# Git Flow Release Branch\n\nCreate new release branch: **$ARGUMENTS**\n\n## Current Repository State\n\n- Current branch: !`git branch --show-current`\n- Git status: !`git status --porcelain`\n- Latest tag: !`git describe --tags --abbrev=0 2>/dev/null || echo \"No tags found\"`\n- Commits since last tag: !`git log $(git describe --tags --abbrev=0 2>/dev/null)..HEAD --oneline 2>/dev/null | wc -l | tr -d ' '`\n- Package.json version: !`cat package.json 2>/dev/null | grep '\"version\"' | head -1 || echo \"No package.json found\"`\n- Recent commits: !`git log --oneline -10`\n\n## Task\n\nCreate a Git Flow release branch following these steps:\n\n### 1. Version Validation\n\nValidate the version format and ensure it's newer than current:\n\n**Version Format Requirements:**\n- Must follow semantic versioning: `vMAJOR.MINOR.PATCH`\n- Examples: `v1.0.0`, `v2.1.3`, `v0.5.0-beta.1`\n- Pattern: `v` + `NUMBER.NUMBER.NUMBER` + optional `-prerelease.NUMBER`\n\n**Version Increment Logic:**\n\nAnalyze commits since last tag to suggest version:\n- **MAJOR** (v2.0.0): Breaking changes (contains \"BREAKING CHANGE:\" in commits)\n- **MINOR** (v1.3.0): New features (contains \"feat:\" commits)\n- **PATCH** (v1.2.1): Bug fixes only (only \"fix:\" and \"chore:\" commits)\n\n**Current Version Analysis:**\n```\nLatest tag: [from git describe]\nSuggested version: [based on commit analysis]\nProvided version: $ARGUMENTS\n```\n\nIf version is invalid or not newer, show:\n```\n❌ Invalid version format: \"$ARGUMENTS\"\n\n✅ Use semantic versioning: vMAJOR.MINOR.PATCH\n\nExamples:\n - v1.0.0 (initial release)\n - v1.2.0 (new features)\n - v1.2.1 (bug fixes)\n - v2.0.0 (breaking changes)\n - v1.0.0-beta.1 (pre-release)\n\n💡 Suggested version based on commits: v1.3.0\n```\n\n### 2. Create Release Branch Workflow\n\n```bash\n# Switch to develop and update\ngit checkout develop\ngit pull origin develop\n\n# Create release branch\ngit checkout -b release/$ARGUMENTS\n\n# Update package.json version (if Node.js project)\nnpm version ${ARGUMENTS#v} --no-git-tag-version\n\n# Generate CHANGELOG.md from commits\n# (analyze git log since last tag)\n\n# Commit version bump\ngit add package.json CHANGELOG.md\ngit commit -m \"chore(release): bump version to ${ARGUMENTS#v}\n\n- Updated package.json version\n- Generated CHANGELOG.md from commits\n\n🤖 Generated with Claude Code\nCo-Authored-By: Claude <noreply@anthropic.com>\"\n\n# Push to remote with tracking\ngit push -u origin release/$ARGUMENTS\n```\n\n### 3. CHANGELOG Generation\n\nGenerate changelog from commits since last tag, grouped by type:\n\n```markdown\n# Changelog\n\n## [$ARGUMENTS] - [Current Date]\n\n### ✨ Features\n- [List all feat: commits with PR links]\n\n### 🐛 Bug Fixes\n- [List all fix: commits with PR links]\n\n### 📝 Documentation\n- [List all docs: commits]\n\n### ♻️ Refactoring\n- [List all refactor: commits]\n\n### ⚡️ Performance\n- [List all perf: commits]\n\n### 🔒️ Security\n- [List all security-related commits]\n\n### 💥 Breaking Changes\n- [List all commits with BREAKING CHANGE]\n\n### 🧪 Tests\n- [List all test: commits]\n\n### 🔧 Chore\n- [List all chore: commits]\n```\n\n### 4. Release Checklist\n\nDisplay this checklist after creation:\n\n```\n🚀 Release Checklist for $ARGUMENTS\n\nPre-Release Tasks:\n- [ ] All tests passing (run: npm test)\n- [ ] Documentation updated\n- [ ] CHANGELOG.md reviewed and accurate\n- [ ] Version numbers consistent across files\n- [ ] No breaking changes (or properly documented)\n- [ ] Dependencies updated (run: npm audit)\n\nTesting Tasks:\n- [ ] Manual testing completed\n- [ ] Regression tests passed\n- [ ] Performance benchmarks acceptable\n- [ ] Security scan clean (run: npm audit)\n- [ ] Cross-browser testing (if applicable)\n\nDeployment Preparation:\n- [ ] Staging deployment successful\n- [ ] Production deployment plan reviewed\n- [ ] Rollback plan documented\n- [ ] Monitoring and alerts configured\n\nFinal Steps:\n- [ ] Create PR to main (run: gh pr create)\n- [ ] Get required approvals (minimum 2 reviewers)\n- [ ] Run /finish to merge and tag release\n- [ ] Announce release to team\n\n🎯 Next Commands:\n- Review CHANGELOG: cat CHANGELOG.md\n- Run tests: npm test\n- Create PR: gh pr create --base main --head release/$ARGUMENTS\n- When ready: /finish\n```\n\n### 5. Success Response\n\n```\n✓ Switched to develop branch\n✓ Pulled latest changes from origin/develop\n✓ Created branch: release/$ARGUMENTS\n✓ Updated package.json version to ${ARGUMENTS#v}\n✓ Generated CHANGELOG.md (15 commits analyzed)\n✓ Committed version bump changes\n✓ Set up remote tracking: origin/release/$ARGUMENTS\n✓ Pushed branch to remote\n\n🚀 Release Branch Ready: $ARGUMENTS\n\nBranch: release/$ARGUMENTS\nBase: develop\nTarget: main (after review)\n\n📊 Release Statistics:\n - 5 new features\n - 3 bug fixes\n - 1 performance improvement\n - 0 breaking changes\n - 2 documentation updates\n\n📝 CHANGELOG Summary:\n - Created with 15 commits\n - Grouped by commit type\n - Includes PR references\n - Ready for review\n\n🎯 Next Steps:\n1. Review CHANGELOG.md for accuracy\n2. Run final tests: npm test\n3. Test on staging environment\n4. Create PR to main: gh pr create\n5. Get team approvals\n6. Run /finish to complete release\n\n💡 Release Tips:\n- No new features should be added to release branch\n- Only bug fixes and documentation updates allowed\n- Keep release branch short-lived (hours, not days)\n- Tag will be created automatically when merged to main\n```\n\n### 6. Error Handling\n\n**No Version Provided:**\n```\n❌ Version is required\n\nUsage: /release <version>\n\nExamples:\n /release v1.2.0\n /release v2.0.0-beta.1\n\nCurrent version: v1.1.0\nSuggested version: v1.2.0 (based on commits)\n```\n\n**Invalid Version Format:**\n```\n❌ Invalid version format: \"1.0\"\n\n✅ Correct format: v1.0.0 (must start with 'v')\n\nExamples:\n ✅ v1.0.0\n ✅ v2.1.3\n ✅ v1.0.0-beta.1\n ❌ 1.0.0 (missing 'v')\n ❌ v1.0 (incomplete)\n ❌ version-1.0.0 (wrong format)\n```\n\n**Version Not Incremented:**\n```\n❌ Version $ARGUMENTS is not newer than current v1.2.0\n\n💡 Valid version bumps from v1.2.0:\n - v1.2.1 (patch - bug fixes only)\n - v1.3.0 (minor - new features)\n - v2.0.0 (major - breaking changes)\n\n📊 Commit Analysis:\n - 3 feat: commits → suggests MINOR bump (v1.3.0)\n - 0 BREAKING CHANGE → no MAJOR bump needed\n - 2 fix: commits → could use PATCH (v1.2.1)\n\nRecommended: v1.3.0\n```\n\n**Uncommitted Changes:**\n```\n⚠️ Uncommitted changes detected:\nM src/feature.js\nM README.md\n\nBefore creating release:\n1. Commit your changes\n2. Stash them: git stash\n3. Or discard them: git checkout .\n\nPlease clean your working directory first.\n```\n\n**Develop Behind Remote:**\n```\n⚠️ Local develop is behind origin/develop by 3 commits\n\n✓ Pulling latest changes...\n✓ Fetched 3 commits\n✓ Develop is now up to date with remote\n✓ Ready to create release branch\n```\n\n## Creating Pull Request\n\nIf `gh` CLI is available, offer to create PR:\n\n```bash\ngh pr create \\\n --title \"Release $ARGUMENTS\" \\\n --body \"$(cat <<'EOF'\n## Release Summary\n\nVersion: $ARGUMENTS\nBase: develop\nTarget: main\n\n## Changes Included\n\n[Auto-generated from CHANGELOG.md]\n\n## Release Checklist\n\n- [ ] All tests passing\n- [ ] Documentation updated\n- [ ] CHANGELOG reviewed\n- [ ] No breaking changes (or documented)\n- [ ] Security audit clean\n- [ ] Staging deployment successful\n\n## Deployment Plan\n\n1. Merge to main\n2. Tag release: $ARGUMENTS\n3. Deploy to production\n4. Merge back to develop\n5. Monitor for issues\n\n---\n🤖 Generated with Claude Code\nEOF\n)\" \\\n --base main \\\n --head release/$ARGUMENTS \\\n --label \"release\" \\\n --assignee @me\n```\n\n## Semantic Versioning Guide\n\n**MAJOR version (X.0.0)**: Breaking changes\n- API changes that break backward compatibility\n- Removal of deprecated features\n- Major architectural changes\n\n**MINOR version (1.X.0)**: New features\n- New functionality added\n- Backward compatible changes\n- New APIs or methods\n\n**PATCH version (1.0.X)**: Bug fixes\n- Bug fixes only\n- No new features\n- No breaking changes\n\n## Environment Variables\n\n- `GIT_FLOW_DEVELOP_BRANCH`: Develop branch name (default: \"develop\")\n- `GIT_FLOW_MAIN_BRANCH`: Main branch name (default: \"main\")\n- `GIT_FLOW_PREFIX_RELEASE`: Release prefix (default: \"release/\")\n\n## Related Commands\n\n- `/finish` - Complete release (merge to main and develop, create tag)\n- `/flow-status` - Check current Git Flow status\n- `/feature <name>` - Create feature branch\n- `/hotfix <name>` - Create hotfix branch\n\n## Best Practices\n\n**DO:**\n- ✅ Analyze commits to determine correct version bump\n- ✅ Generate comprehensive CHANGELOG\n- ✅ Test thoroughly on release branch\n- ✅ Keep release branch short-lived\n- ✅ Only allow bug fixes on release branch\n- ✅ Create PR for team review\n\n**DON'T:**\n- ❌ Add new features to release branch\n- ❌ Skip testing phase\n- ❌ Let release branch live for days\n- ❌ Skip CHANGELOG generation\n- ❌ Forget to merge back to develop\n- ❌ Create releases without team approval\n"}