mirror of
https://github.com/davila7/claude-code-templates.git
synced 2026-09-19 01:30:23 +08:00
41cbbea00c
- Split components.json: índice sin content (1.9 MB / 249 KB br vs 15.6 MB / 4.15 MB br).
Generador produce component-content/{type}/{slug}.json por componente y auto-copia
a dashboard/public/. Página de detalle carga contenido on-demand via fetchComponentContent().
- Restaurar cabeceras de caché y seguridad perdidas en la migración Vercel→Cloudflare:
_headers con Cache-Control max-age=86400 para JSONs, immutable para _astro/*,
y HSTS, X-Frame-Options, Referrer-Policy, Permissions-Policy en todas las rutas.
- Eliminar dashboard/vercel.json (config muerta desde migración a Cloudflare Pages).
- Diferir hidratación: ClerkIsland y AuthButton client:load → client:idle;
SaveToCollectionButton → client:visible.
- Eliminar gpt-tokenizer del bundle del navegador: reemplazado por estimación chars/4.
- Actualizar .claude/rules/dashboard.md para reflejar hosting en Cloudflare Pages.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 line
12 KiB
JSON
1 line
12 KiB
JSON
{"content": "---\nallowed-tools: Bash(git:*), Read, Edit\nargument-hint: [--no-delete] [--no-tag]\ndescription: Complete and merge current Git Flow branch (feature/release/hotfix) with proper cleanup and tagging\n---\n\n# Git Flow Finish Branch\n\nComplete current Git Flow branch: **$ARGUMENTS**\n\n## Current Repository State\n\n- Current branch: !`git branch --show-current`\n- Branch type: !`git branch --show-current | grep -oE '^(feature|release|hotfix)' || echo \"Not a Git Flow branch\"`\n- Git status: !`git status --porcelain`\n- Unpushed commits: !`git log @{u}.. --oneline 2>/dev/null | wc -l | tr -d ' '`\n- Latest tag: !`git describe --tags --abbrev=0 2>/dev/null || echo \"No tags\"`\n- Test status: !`npm test 2>/dev/null | tail -20 || echo \"No test command available\"`\n\n## Task\n\nComplete the current Git Flow branch by merging it to appropriate target branch(es):\n\n### 1. Branch Type Detection\n\nDetect the current branch type and determine merge strategy:\n\n```bash\nCURRENT_BRANCH=$(git branch --show-current)\n\nif [[ $CURRENT_BRANCH == feature/* ]]; then\n BRANCH_TYPE=\"feature\"\n MERGE_TO=\"develop\"\n CREATE_TAG=\"no\"\nelif [[ $CURRENT_BRANCH == release/* ]]; then\n BRANCH_TYPE=\"release\"\n MERGE_TO=\"main develop\"\n CREATE_TAG=\"yes\"\n TAG_NAME=\"${CURRENT_BRANCH#release/}\"\nelif [[ $CURRENT_BRANCH == hotfix/* ]]; then\n BRANCH_TYPE=\"hotfix\"\n MERGE_TO=\"main develop\"\n CREATE_TAG=\"yes\"\n # Increment patch version from current tag\n CURRENT_TAG=$(git describe --tags --abbrev=0 origin/main 2>/dev/null)\n TAG_NAME=\"${CURRENT_TAG%.*}.$((${CURRENT_TAG##*.} + 1))\"\nelse\n echo \"❌ Not on a Git Flow branch (feature/release/hotfix)\"\n exit 1\nfi\n```\n\n### 2. Pre-Merge Validation\n\nBefore merging, validate these conditions:\n\n**Critical Checks:**\n- ✅ All changes are committed (no uncommitted files)\n- ✅ All commits are pushed to remote\n- ✅ Tests are passing (run test suite)\n- ✅ No merge conflicts with target branch\n- ✅ Branch is up to date with remote\n\n```\n🔍 Pre-Merge Validation\n\n✓ Working directory clean\n✓ All commits pushed to remote\n✓ Running tests...\n ├─ Unit tests: 45/45 passed\n ├─ Integration tests: 12/12 passed\n └─ All tests passed ✓\n\n✓ Checking for merge conflicts with develop...\n └─ No conflicts detected ✓\n\n✓ Branch is up to date with remote ✓\n\nReady to merge!\n```\n\n### 3. Feature Branch Finish\n\nFor **feature/** branches:\n\n```bash\n# Ensure all commits are pushed\ngit push\n\n# Switch to develop\ngit checkout develop\n\n# Pull latest changes\ngit pull origin develop\n\n# Merge feature branch (no fast-forward)\ngit merge --no-ff feature/$NAME -m \"Merge feature/$NAME into develop\n\n$(git log develop..feature/$NAME --oneline)\n\n🤖 Generated with Claude Code\nCo-Authored-By: Claude <noreply@anthropic.com>\"\n\n# Push to remote\ngit push origin develop\n\n# Delete local branch (unless --no-delete)\ngit branch -d feature/$NAME\n\n# Delete remote branch (unless --no-delete)\ngit push origin --delete feature/$NAME\n```\n\n**Success Response:**\n```\n✓ Pushed all commits to remote\n✓ Switched to develop\n✓ Pulled latest changes\n✓ Merged feature/$NAME into develop\n✓ Pushed to origin/develop\n✓ Deleted local branch: feature/$NAME\n✓ Deleted remote branch: origin/feature/$NAME\n\n🌿 Feature Complete!\n\nMerged: feature/$NAME\nTarget: develop\nCommits included: 5\nFiles changed: 12\n\n🎉 Your feature is now in the develop branch!\n\nNext steps:\n- Feature will be included in next release\n- Other team members can pull from develop\n- You can start a new feature branch\n```\n\n### 4. Release Branch Finish\n\nFor **release/** branches:\n\n```bash\n# Extract version from branch name\nVERSION=\"${CURRENT_BRANCH#release/}\"\n\n# Ensure all commits are pushed\ngit push\n\n# Merge to main first\ngit checkout main\ngit pull origin main\ngit merge --no-ff release/$VERSION -m \"Merge release/$VERSION into main\n\nRelease notes:\n$(cat CHANGELOG.md | sed -n \"/## \\[$VERSION\\]/,/## \\[/p\" | head -n -1)\n\n🤖 Generated with Claude Code\nCo-Authored-By: Claude <noreply@anthropic.com>\"\n\n# Create tag on main (unless --no-tag)\ngit tag -a $VERSION -m \"Release $VERSION\n\n$(cat CHANGELOG.md | sed -n \"/## \\[$VERSION\\]/,/## \\[/p\" | head -n -1)\"\n\n# Push main with tags\ngit push origin main --tags\n\n# Merge back to develop\ngit checkout develop\ngit pull origin develop\ngit merge --no-ff release/$VERSION -m \"Merge release/$VERSION back into develop\n\n🤖 Generated with Claude Code\nCo-Authored-By: Claude <noreply@anthropic.com>\"\n\n# Push develop\ngit push origin develop\n\n# Delete branches (unless --no-delete)\ngit branch -d release/$VERSION\ngit push origin --delete release/$VERSION\n```\n\n**Success Response:**\n```\n✓ Pushed all commits to remote\n✓ Merged release/$VERSION into main\n✓ Created tag: $VERSION\n✓ Pushed main with tags\n✓ Merged release/$VERSION into develop\n✓ Pushed to origin/develop\n✓ Deleted local branch: release/$VERSION\n✓ Deleted remote branch: origin/release/$VERSION\n\n🚀 Release Complete: $VERSION\n\nMerged to: main, develop\nTag created: $VERSION\nCommits included: 15\nChanges:\n - 5 features\n - 3 bug fixes\n - 2 performance improvements\n\n🎉 Release $VERSION is now in production!\n\nNext steps:\n- Deploy to production: [deployment command]\n- Monitor production for issues\n- Announce release to team\n- Update documentation if needed\n\nTag details:\n git show $VERSION\n```\n\n### 5. Hotfix Branch Finish\n\nFor **hotfix/** branches:\n\n```bash\n# Determine new version (patch bump)\nCURRENT_VERSION=$(git describe --tags --abbrev=0 origin/main)\nNEW_VERSION=\"${CURRENT_VERSION%.*}.$((${CURRENT_VERSION##*.} + 1))\"\n\n# Ensure all commits are pushed\ngit push\n\n# Merge to main first\ngit checkout main\ngit pull origin main\ngit merge --no-ff hotfix/$NAME -m \"Merge hotfix/$NAME into main\n\nCritical fix for: $NAME\n\n🤖 Generated with Claude Code\nCo-Authored-By: Claude <noreply@anthropic.com>\"\n\n# Create tag on main (unless --no-tag)\ngit tag -a $NEW_VERSION -m \"Hotfix $NEW_VERSION: $NAME\n\nCritical production fix\"\n\n# Push main with tags\ngit push origin main --tags\n\n# Merge back to develop\ngit checkout develop\ngit pull origin develop\ngit merge --no-ff hotfix/$NAME -m \"Merge hotfix/$NAME back into develop\n\n🤖 Generated with Claude Code\nCo-Authored-By: Claude <noreply@anthropic.com>\"\n\n# Push develop\ngit push origin develop\n\n# Delete branches (unless --no-delete)\ngit branch -d hotfix/$NAME\ngit push origin --delete hotfix/$NAME\n```\n\n**Success Response:**\n```\n✓ Pushed all commits to remote\n✓ Merged hotfix/$NAME into main\n✓ Created tag: $NEW_VERSION (patch bump)\n✓ Pushed main with tags\n✓ Merged hotfix/$NAME into develop\n✓ Pushed to origin/develop\n✓ Deleted local branch: hotfix/$NAME\n✓ Deleted remote branch: origin/hotfix/$NAME\n\n🔥 Hotfix Complete: $NEW_VERSION\n\nMerged to: main, develop\nTag created: $NEW_VERSION\nIssue fixed: $NAME\nPrevious version: $CURRENT_VERSION\n\n⚠️ CRITICAL: Deploy to production immediately!\n\nNext steps:\n1. Deploy $NEW_VERSION to production NOW\n2. Monitor production systems closely\n3. Verify fix is working\n4. Notify team of hotfix deployment\n5. Update incident documentation\n\nDeployment command:\n [your deployment command here]\n\nMonitor:\n - Error rates\n - System metrics\n - User reports\n```\n\n### 6. Error Handling\n\n**Not on Git Flow Branch:**\n```\n❌ Not on a Git Flow branch\n\nCurrent branch: $CURRENT_BRANCH\n\n/finish only works on:\n- feature/* branches\n- release/* branches\n- hotfix/* branches\n\nTo finish this branch manually:\n1. Switch to target branch\n2. Merge manually: git merge $CURRENT_BRANCH\n3. Push: git push\n```\n\n**Uncommitted Changes:**\n```\n❌ Cannot finish: Uncommitted changes detected\n\nModified files:\nM src/file1.js\nM src/file2.js\n\nPlease commit or stash your changes first:\n1. Commit: git add . && git commit\n2. Stash: git stash\n3. Discard: git checkout .\n```\n\n**Unpushed Commits:**\n```\n⚠️ Warning: 3 unpushed commits detected\n\nCommits not on remote:\n abc1234 feat: add new feature\n def5678 fix: resolve bug\n ghi9012 docs: update README\n\nWould you like to push now? [Y/n]\n✓ Pushing commits...\n✓ All commits pushed to remote\n```\n\n**Test Failures:**\n```\n❌ Cannot finish: Tests are failing\n\nFailed tests:\n ✗ UserService.test.js\n - should authenticate user (expected 200, got 401)\n ✗ PaymentController.test.js\n - should process payment (timeout)\n\nFix the failing tests before finishing:\n1. Run tests: npm test\n2. Fix failures\n3. Commit fixes\n4. Try /finish again\n\nSkip tests? (NOT RECOMMENDED) [y/N]\n```\n\n**Merge Conflicts:**\n```\n❌ Merge conflict detected with develop\n\nConflicting files:\n src/config.js\n package.json\n\nResolution steps:\n1. Fetch latest develop: git fetch origin develop\n2. Try merge locally: git merge origin/develop\n3. Resolve conflicts manually\n4. Commit resolution\n5. Try /finish again\n\nWould you like to see conflict details? [Y/n]\n```\n\n**Missing Tag for Release:**\n```\n⚠️ Release branch missing version in CHANGELOG\n\nExpected format in CHANGELOG.md:\n## [v1.2.0] - 2025-10-01\n\nCurrent CHANGELOG:\n[show relevant section]\n\nPlease update CHANGELOG.md with release version.\nContinue anyway? [y/N]\n```\n\n### 7. Arguments\n\n**--no-delete**: Keep branch after merging\n```bash\n/finish --no-delete\n\n# Merges but keeps local and remote branches\n```\n\n**--no-tag**: Skip tag creation (release/hotfix only)\n```bash\n/finish --no-tag\n\n# Merges but doesn't create version tag\n```\n\n### 8. Interactive Confirmation\n\nFor destructive operations, ask for confirmation:\n\n```\n🔍 Finish Summary\n\nBranch: release/v1.2.0\nType: Release\nWill merge to: main, develop\nWill create tag: v1.2.0\nWill delete: Local and remote branches\n\nActions to perform:\n 1. Merge to main\n 2. Create tag v1.2.0 on main\n 3. Push main with tags\n 4. Merge to develop\n 5. Push develop\n 6. Delete release/v1.2.0 (local)\n 7. Delete origin/release/v1.2.0 (remote)\n\nProceed with finish? [Y/n]\n```\n\n### 9. Post-Finish Checklist\n\n**For Features:**\n```\n✅ Feature Finished Checklist\n\n- [x] Merged to develop\n- [x] Remote branch deleted\n- [x] Local branch deleted\n\nWhat's next:\n- Feature is now in develop\n- Will be included in next release\n- Team can pull from develop\n- You can start new feature\n\nStart new feature:\n /feature <name>\n```\n\n**For Releases:**\n```\n✅ Release Finished Checklist\n\n- [x] Merged to main\n- [x] Merged to develop\n- [x] Tag created: v1.2.0\n- [x] Branches deleted\n\nDeployment checklist:\n- [ ] Deploy to production\n- [ ] Verify deployment\n- [ ] Monitor for issues\n- [ ] Announce release\n- [ ] Update documentation\n\nDeploy command:\n [your deployment command]\n```\n\n**For Hotfixes:**\n```\n✅ Hotfix Finished Checklist\n\n- [x] Merged to main\n- [x] Merged to develop\n- [x] Tag created: v1.2.1\n- [x] Branches deleted\n\n🚨 IMMEDIATE ACTIONS REQUIRED:\n- [ ] Deploy to production NOW\n- [ ] Monitor production systems\n- [ ] Verify fix is working\n- [ ] Notify team\n- [ ] Update incident documentation\n\nThis was an emergency hotfix - production deployment is CRITICAL!\n```\n\n## Environment Variables\n\n- `GIT_FLOW_MAIN_BRANCH`: Main branch (default: \"main\")\n- `GIT_FLOW_DEVELOP_BRANCH`: Develop branch (default: \"develop\")\n\n## Related Commands\n\n- `/feature <name>` - Start new feature branch\n- `/release <version>` - Start new release branch\n- `/hotfix <name>` - Start new hotfix branch\n- `/flow-status` - Check Git Flow status\n\n## Best Practices\n\n**DO:**\n- ✅ Run tests before finishing\n- ✅ Ensure all commits are pushed\n- ✅ Review changes one last time\n- ✅ Update CHANGELOG for releases\n- ✅ Create tags for releases/hotfixes\n- ✅ Merge to all required branches\n- ✅ Clean up branches after merge\n\n**DON'T:**\n- ❌ Finish with failing tests\n- ❌ Skip pushing commits\n- ❌ Forget to merge to develop\n- ❌ Leave branches undeleted\n- ❌ Skip tags for releases\n- ❌ Force push after merge\n"} |