refactor: extract skills from commands across 8 plugins
Refactored commands to extract reusable skills following the Commands → Skills separation pattern. Each command is now <50 lines and references skill files for detailed knowledge. Plugins refactored: - claude-config-maintainer: 5 commands → 7 skills - code-sentinel: 3 commands → 2 skills - contract-validator: 5 commands → 6 skills - data-platform: 10 commands → 6 skills - doc-guardian: 5 commands → 6 skills (replaced nested dir) - git-flow: 8 commands → 7 skills Skills contain: workflows, validation rules, conventions, reference data, tool documentation Commands now contain: YAML frontmatter, agent assignment, skills list, brief workflow steps, parameters Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,124 +1,44 @@
|
||||
---
|
||||
name: branch-cleanup
|
||||
description: Remove merged and stale branches locally and optionally on remote
|
||||
agent: git-assistant
|
||||
---
|
||||
|
||||
# /branch-cleanup - Clean Merged and Stale Branches
|
||||
|
||||
## Visual Output
|
||||
## Skills
|
||||
|
||||
When executing this command, display the plugin header:
|
||||
|
||||
```
|
||||
┌──────────────────────────────────────────────────────────────────┐
|
||||
│ 🔀 GIT-FLOW · Branch Cleanup │
|
||||
└──────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
Then proceed with the workflow.
|
||||
- skills/visual-header.md
|
||||
- skills/git-safety.md
|
||||
- skills/sync-workflow.md
|
||||
- skills/environment-variables.md
|
||||
|
||||
## Purpose
|
||||
|
||||
Remove branches that have been merged OR whose remote tracking branch no longer exists, both locally and optionally on remote.
|
||||
Remove branches that have been merged OR whose remote tracking branch no longer exists.
|
||||
|
||||
## Behavior
|
||||
## Parameters
|
||||
|
||||
### Step 1: Prune Remote Refs
|
||||
| Parameter | Description |
|
||||
|-----------|-------------|
|
||||
| `--dry-run` | Preview without deleting |
|
||||
| `--remote` | Also delete remote branches |
|
||||
| `--stale-only` | Only delete stale branches (upstream gone) |
|
||||
|
||||
```bash
|
||||
# Remove stale remote-tracking references
|
||||
git fetch --prune
|
||||
```
|
||||
## Workflow
|
||||
|
||||
### Step 2: Identify Branches for Cleanup
|
||||
|
||||
```bash
|
||||
# Find merged local branches
|
||||
git branch --merged <base-branch>
|
||||
|
||||
# Find merged remote branches
|
||||
git branch -r --merged <base-branch>
|
||||
|
||||
# Find local branches with deleted upstreams (stale)
|
||||
git branch -vv | grep ': gone]'
|
||||
```
|
||||
|
||||
### Step 3: Present Findings
|
||||
|
||||
```
|
||||
Found branches for cleanup:
|
||||
|
||||
Merged (safe to delete):
|
||||
- feat/login-page (merged 3 days ago)
|
||||
- fix/typo-header (merged 1 week ago)
|
||||
- chore/deps-update (merged 2 weeks ago)
|
||||
|
||||
Stale (remote deleted):
|
||||
- feat/old-feature (upstream gone)
|
||||
- fix/already-merged (upstream gone)
|
||||
|
||||
Remote (merged into base):
|
||||
- origin/feat/login-page
|
||||
- origin/fix/typo-header
|
||||
|
||||
Protected (won't delete):
|
||||
- main
|
||||
- development
|
||||
- staging
|
||||
|
||||
Delete these branches?
|
||||
1. Delete all (local merged + stale + remote)
|
||||
2. Delete merged only (skip stale)
|
||||
3. Delete stale only (upstream gone)
|
||||
4. Let me pick which ones
|
||||
5. Cancel
|
||||
```
|
||||
|
||||
### Step 4: Execute Cleanup
|
||||
|
||||
```bash
|
||||
# Delete merged local branches
|
||||
git branch -d <branch-name>
|
||||
|
||||
# Delete stale local branches (force needed since no upstream)
|
||||
git branch -D <stale-branch-name>
|
||||
|
||||
# Delete remote branches
|
||||
git push origin --delete <branch-name>
|
||||
```
|
||||
|
||||
### Step 5: Report
|
||||
|
||||
```
|
||||
Cleanup complete:
|
||||
|
||||
Deleted local (merged): 3 branches
|
||||
Deleted local (stale): 2 branches
|
||||
Deleted remote: 2 branches
|
||||
Skipped: 0 branches
|
||||
|
||||
Remaining local branches:
|
||||
- main
|
||||
- development
|
||||
- feat/current-work (not merged, has upstream)
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| `GIT_DEFAULT_BASE` | `development` | Base branch for merge detection |
|
||||
| `GIT_PROTECTED_BRANCHES` | `main,master,development,staging,production` | Never delete these |
|
||||
| `GIT_AUTO_DELETE_REMOTE` | `false` | Auto-delete remote branches |
|
||||
| `GIT_CLEANUP_STALE` | `true` | Include stale branches (upstream gone) in cleanup |
|
||||
|
||||
## Safety
|
||||
|
||||
- Never deletes protected branches
|
||||
- Warns about unmerged branches that still have upstreams
|
||||
- Confirms before deleting remote branches
|
||||
- Uses `-d` (safe delete) for merged branches
|
||||
- Uses `-D` (force delete) only for stale branches with confirmation
|
||||
- Stale branches are highlighted separately for review
|
||||
1. **Display header** - Show GIT-FLOW Branch Cleanup header
|
||||
2. **Prune remote refs** - `git fetch --prune`
|
||||
3. **Find merged branches** - `git branch --merged <base-branch>`
|
||||
4. **Find stale branches** - `git branch -vv | grep ': gone]'`
|
||||
5. **Exclude protected** - Never delete protected branches (per git-safety.md)
|
||||
6. **Present findings** - Show merged, stale, and protected lists
|
||||
7. **Confirm deletion** - Options: all, merged only, stale only, pick, cancel
|
||||
8. **Execute cleanup** - Delete selected branches
|
||||
9. **Report** - Show deletion summary
|
||||
|
||||
## Output
|
||||
|
||||
On success:
|
||||
```
|
||||
Cleaned up:
|
||||
Local (merged): 3 branches deleted
|
||||
|
||||
@@ -1,106 +1,43 @@
|
||||
---
|
||||
name: branch-start
|
||||
description: Create a new feature/fix/chore branch with consistent naming
|
||||
agent: git-assistant
|
||||
---
|
||||
|
||||
# /branch-start - Start New Branch
|
||||
|
||||
## Visual Output
|
||||
## Skills
|
||||
|
||||
When executing this command, display the plugin header:
|
||||
|
||||
```
|
||||
┌──────────────────────────────────────────────────────────────────┐
|
||||
│ 🔀 GIT-FLOW · Branch Start │
|
||||
└──────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
Then proceed with the workflow.
|
||||
- skills/visual-header.md
|
||||
- skills/branch-naming.md
|
||||
- skills/git-safety.md
|
||||
- skills/environment-variables.md
|
||||
|
||||
## Purpose
|
||||
|
||||
Create a new feature/fix/chore branch with consistent naming conventions.
|
||||
Create a new branch with consistent naming conventions, based on the configured base branch.
|
||||
|
||||
## Usage
|
||||
## Parameters
|
||||
|
||||
```
|
||||
/branch-start [description]
|
||||
```
|
||||
| Parameter | Description |
|
||||
|-----------|-------------|
|
||||
| `<description>` | Brief description for branch name |
|
||||
| `--type` | Branch type: feat, fix, chore, docs, refactor |
|
||||
| `--issue` | Issue number to include in branch name |
|
||||
|
||||
## Behavior
|
||||
## Workflow
|
||||
|
||||
### Step 1: Determine Branch Type
|
||||
|
||||
```
|
||||
What type of change is this?
|
||||
1. feat - New feature
|
||||
2. fix - Bug fix
|
||||
3. chore - Maintenance task
|
||||
4. docs - Documentation
|
||||
5. refactor - Code refactoring
|
||||
```
|
||||
|
||||
### Step 2: Get Description
|
||||
|
||||
If not provided, ask:
|
||||
|
||||
```
|
||||
Brief description (2-4 words):
|
||||
> add user authentication
|
||||
```
|
||||
|
||||
### Step 3: Generate Branch Name
|
||||
|
||||
Convert to kebab-case:
|
||||
- `feat/add-user-authentication`
|
||||
- `fix/login-timeout-error`
|
||||
- `chore/update-dependencies`
|
||||
|
||||
### Step 4: Create Branch
|
||||
|
||||
```bash
|
||||
# Ensure base branch is up-to-date
|
||||
git checkout <base-branch>
|
||||
git pull origin <base-branch>
|
||||
|
||||
# Create and switch to new branch
|
||||
git checkout -b <new-branch>
|
||||
```
|
||||
|
||||
### Step 5: Confirm
|
||||
|
||||
```
|
||||
Created branch: feat/add-user-authentication
|
||||
Based on: development (abc1234)
|
||||
|
||||
Ready to start coding!
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| `GIT_DEFAULT_BASE` | `development` | Branch to create from |
|
||||
| `GIT_BRANCH_PREFIX` | `true` | Use type/ prefix |
|
||||
|
||||
## Naming Rules
|
||||
|
||||
- Lowercase only
|
||||
- Hyphens for spaces
|
||||
- No special characters
|
||||
- Max 50 characters
|
||||
|
||||
## Validation
|
||||
|
||||
```
|
||||
Branch name validation:
|
||||
✓ Lowercase
|
||||
✓ Valid prefix (feat/)
|
||||
✓ Descriptive (3+ words recommended)
|
||||
✗ Too long (52 chars, max 50)
|
||||
|
||||
Suggested: feat/add-user-auth
|
||||
Use this instead? (y/n)
|
||||
```
|
||||
1. **Display header** - Show GIT-FLOW Branch Start header
|
||||
2. **Determine type** - Prompt for branch type if not provided
|
||||
3. **Get description** - Prompt for description if not provided
|
||||
4. **Generate name** - Convert to kebab-case (per branch-naming.md)
|
||||
5. **Validate** - Check naming rules, truncate if needed
|
||||
6. **Update base** - Checkout and pull base branch
|
||||
7. **Create branch** - `git checkout -b <new-branch>`
|
||||
8. **Confirm** - Display created branch info
|
||||
|
||||
## Output
|
||||
|
||||
On success:
|
||||
```
|
||||
Branch: feat/add-user-authentication
|
||||
Base: development @ abc1234
|
||||
|
||||
@@ -1,94 +1,49 @@
|
||||
---
|
||||
name: commit-merge
|
||||
description: Commit current changes and merge branch into target
|
||||
agent: git-assistant
|
||||
---
|
||||
|
||||
# /commit-merge - Commit and Merge
|
||||
|
||||
## Visual Output
|
||||
## Skills
|
||||
|
||||
When executing this command, display the plugin header:
|
||||
|
||||
```
|
||||
┌──────────────────────────────────────────────────────────────────┐
|
||||
│ 🔀 GIT-FLOW · Commit & Merge │
|
||||
└──────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
Then proceed with the workflow.
|
||||
- skills/visual-header.md
|
||||
- skills/commit-conventions.md
|
||||
- skills/merge-workflow.md
|
||||
- skills/git-safety.md
|
||||
- skills/environment-variables.md
|
||||
|
||||
## Purpose
|
||||
|
||||
Commit current changes, then merge the current branch into a target branch.
|
||||
|
||||
## Behavior
|
||||
## Parameters
|
||||
|
||||
### Step 1: Run /commit
|
||||
| Parameter | Description |
|
||||
|-----------|-------------|
|
||||
| `--target` | Target branch (default: GIT_DEFAULT_BASE) |
|
||||
| `--squash` | Squash commits on merge |
|
||||
| `--no-delete` | Keep branch after merge |
|
||||
|
||||
Execute the standard commit workflow.
|
||||
## Workflow
|
||||
|
||||
### Step 2: Identify Target Branch
|
||||
|
||||
Check environment or ask:
|
||||
|
||||
```
|
||||
Merge into which branch?
|
||||
1. development (Recommended - GIT_DEFAULT_BASE)
|
||||
2. main
|
||||
3. Other: ____
|
||||
```
|
||||
|
||||
### Step 3: Merge Strategy
|
||||
|
||||
```
|
||||
How should I merge?
|
||||
1. Merge commit (preserves history)
|
||||
2. Squash and merge (single commit)
|
||||
3. Rebase (linear history)
|
||||
```
|
||||
|
||||
### Step 4: Execute Merge
|
||||
|
||||
```bash
|
||||
# Switch to target
|
||||
git checkout <target>
|
||||
|
||||
# Pull latest
|
||||
git pull origin <target>
|
||||
|
||||
# Merge feature branch
|
||||
git merge <feature-branch> [--squash] [--no-ff]
|
||||
|
||||
# Push
|
||||
git push origin <target>
|
||||
```
|
||||
|
||||
### Step 5: Cleanup (Optional)
|
||||
|
||||
```
|
||||
Merge complete. Delete the feature branch?
|
||||
1. Yes, delete local and remote (Recommended)
|
||||
2. Delete local only
|
||||
3. Keep the branch
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| `GIT_DEFAULT_BASE` | `development` | Default branch to merge into |
|
||||
| `GIT_MERGE_STRATEGY` | `merge` | Default merge strategy |
|
||||
| `GIT_AUTO_DELETE_MERGED` | `true` | Auto-delete merged branches |
|
||||
|
||||
## Safety Checks
|
||||
|
||||
- Verify target branch exists
|
||||
- Check for uncommitted changes before switching
|
||||
- Ensure merge doesn't conflict (preview first)
|
||||
1. **Display header** - Show GIT-FLOW Commit & Merge header
|
||||
2. **Run /commit** - Execute standard commit workflow
|
||||
3. **Identify target** - Prompt for target branch if not specified
|
||||
4. **Select strategy** - Merge commit, squash, or rebase (per merge-workflow.md)
|
||||
5. **Execute merge** - Switch to target, pull, merge, push
|
||||
6. **Handle conflicts** - Guide resolution if needed
|
||||
7. **Cleanup** - Offer to delete merged branch (per git-safety.md)
|
||||
8. **Report** - Show merge summary
|
||||
|
||||
## Output
|
||||
|
||||
On success:
|
||||
```
|
||||
Committed: abc1234
|
||||
feat(auth): add password reset functionality
|
||||
|
||||
Merged feat/password-reset → development
|
||||
Merged feat/password-reset -> development
|
||||
Deleted branch: feat/password-reset
|
||||
|
||||
development is now at: def5678
|
||||
|
||||
@@ -1,65 +1,42 @@
|
||||
---
|
||||
name: commit-push
|
||||
description: Create a commit and push to remote in one operation
|
||||
agent: git-assistant
|
||||
---
|
||||
|
||||
# /commit-push - Commit and Push
|
||||
|
||||
## Visual Output
|
||||
## Skills
|
||||
|
||||
When executing this command, display the plugin header:
|
||||
|
||||
```
|
||||
┌──────────────────────────────────────────────────────────────────┐
|
||||
│ 🔀 GIT-FLOW · Commit & Push │
|
||||
└──────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
Then proceed with the workflow.
|
||||
- skills/visual-header.md
|
||||
- skills/commit-conventions.md
|
||||
- skills/sync-workflow.md
|
||||
- skills/git-safety.md
|
||||
- skills/environment-variables.md
|
||||
|
||||
## Purpose
|
||||
|
||||
Create a commit and push to the remote repository in one operation.
|
||||
|
||||
## Behavior
|
||||
## Parameters
|
||||
|
||||
### Step 1: Run /commit
|
||||
| Parameter | Description |
|
||||
|-----------|-------------|
|
||||
| `--message`, `-m` | Override auto-generated message |
|
||||
| `--force` | Force push (requires confirmation) |
|
||||
|
||||
Execute the standard commit workflow (see commit.md).
|
||||
## Workflow
|
||||
|
||||
### Step 2: Push to Remote
|
||||
|
||||
After successful commit:
|
||||
|
||||
1. Check if branch has upstream tracking
|
||||
2. If no upstream, set it: `git push -u origin <branch>`
|
||||
3. If upstream exists: `git push`
|
||||
|
||||
### Step 3: Handle Conflicts
|
||||
|
||||
If push fails due to diverged history:
|
||||
|
||||
```
|
||||
Remote has changes not in your local branch.
|
||||
|
||||
Options:
|
||||
1. Pull and rebase, then push (Recommended)
|
||||
2. Pull and merge, then push
|
||||
3. Force push (⚠️ destructive)
|
||||
4. Cancel and review manually
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| `GIT_AUTO_PUSH` | `true` | Auto-push after commit |
|
||||
| `GIT_PUSH_STRATEGY` | `rebase` | How to handle diverged branches |
|
||||
|
||||
## Safety Checks
|
||||
|
||||
- **Protected branches**: Warn before pushing to main/master/production
|
||||
- **Force push**: Require explicit confirmation
|
||||
- **No tracking**: Ask before creating new remote branch
|
||||
1. **Display header** - Show GIT-FLOW Commit & Push header
|
||||
2. **Run /commit** - Execute standard commit workflow
|
||||
3. **Check upstream** - Set up tracking if needed (`git push -u`)
|
||||
4. **Push** - Push to remote
|
||||
5. **Handle conflicts** - Offer rebase/merge/force if push fails (per sync-workflow.md)
|
||||
6. **Verify safety** - Warn before push to protected branches (per git-safety.md)
|
||||
7. **Report** - Show push result
|
||||
|
||||
## Output
|
||||
|
||||
On success:
|
||||
```
|
||||
Committed: abc1234
|
||||
feat(auth): add password reset functionality
|
||||
|
||||
@@ -1,116 +1,49 @@
|
||||
---
|
||||
name: commit-sync
|
||||
description: Commit, push, and sync with base branch
|
||||
agent: git-assistant
|
||||
---
|
||||
|
||||
# /commit-sync - Commit, Push, and Sync
|
||||
|
||||
## Visual Output
|
||||
## Skills
|
||||
|
||||
When executing this command, display the plugin header:
|
||||
|
||||
```
|
||||
┌──────────────────────────────────────────────────────────────────┐
|
||||
│ 🔀 GIT-FLOW · Commit Sync │
|
||||
└──────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
Then proceed with the workflow.
|
||||
- skills/visual-header.md
|
||||
- skills/commit-conventions.md
|
||||
- skills/sync-workflow.md
|
||||
- skills/merge-workflow.md
|
||||
- skills/environment-variables.md
|
||||
|
||||
## Purpose
|
||||
|
||||
Full sync operation: commit local changes, push to remote, sync with upstream/base branch, and clean up stale remote-tracking branches.
|
||||
Full sync operation: commit local changes, push to remote, sync with upstream/base branch, and detect stale branches.
|
||||
|
||||
## Behavior
|
||||
## Parameters
|
||||
|
||||
### Step 1: Run /commit
|
||||
| Parameter | Description |
|
||||
|-----------|-------------|
|
||||
| `--base` | Override default base branch |
|
||||
| `--no-rebase` | Use merge instead of rebase |
|
||||
|
||||
Execute the standard commit workflow.
|
||||
## Workflow
|
||||
|
||||
### Step 2: Push to Remote
|
||||
|
||||
Push committed changes to remote branch.
|
||||
|
||||
### Step 3: Sync with Base
|
||||
|
||||
Pull latest from base branch and rebase/merge:
|
||||
|
||||
```bash
|
||||
# Fetch all with prune (removes stale remote-tracking refs)
|
||||
git fetch --all --prune
|
||||
|
||||
# Rebase on base branch
|
||||
git rebase origin/<base-branch>
|
||||
|
||||
# Push again (if rebased)
|
||||
git push --force-with-lease
|
||||
```
|
||||
|
||||
### Step 4: Detect Stale Local Branches
|
||||
|
||||
Check for local branches tracking deleted remotes:
|
||||
|
||||
```bash
|
||||
# Find local branches with gone upstreams
|
||||
git branch -vv | grep ': gone]'
|
||||
```
|
||||
|
||||
If stale branches found, report them:
|
||||
|
||||
```
|
||||
Stale local branches (remote deleted):
|
||||
- feat/old-feature (was tracking origin/feat/old-feature)
|
||||
- fix/merged-bugfix (was tracking origin/fix/merged-bugfix)
|
||||
|
||||
Run /branch-cleanup to remove these branches.
|
||||
```
|
||||
|
||||
### Step 5: Report Status
|
||||
|
||||
```
|
||||
Sync complete:
|
||||
|
||||
Local: feat/password-reset @ abc1234
|
||||
Remote: origin/feat/password-reset @ abc1234
|
||||
Base: development @ xyz7890 (synced)
|
||||
|
||||
Your branch is up-to-date with development.
|
||||
No conflicts detected.
|
||||
|
||||
Cleanup:
|
||||
Remote refs pruned: 2
|
||||
Stale local branches: 2 (run /branch-cleanup to remove)
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| `GIT_DEFAULT_BASE` | `development` | Branch to sync with |
|
||||
| `GIT_SYNC_STRATEGY` | `rebase` | How to incorporate upstream changes |
|
||||
| `GIT_AUTO_PRUNE` | `true` | Auto-prune stale remote refs on sync |
|
||||
|
||||
## Conflict Handling
|
||||
|
||||
If conflicts occur during rebase:
|
||||
|
||||
```
|
||||
Conflicts detected while syncing with development.
|
||||
|
||||
Conflicting files:
|
||||
- src/auth/login.ts
|
||||
- src/auth/types.ts
|
||||
|
||||
Options:
|
||||
1. Open conflict resolution (I'll guide you)
|
||||
2. Abort sync (keep local state)
|
||||
3. Accept all theirs (⚠️ loses your changes in conflicts)
|
||||
4. Accept all ours (⚠️ ignores upstream in conflicts)
|
||||
```
|
||||
1. **Display header** - Show GIT-FLOW Commit Sync header
|
||||
2. **Run /commit** - Execute standard commit workflow
|
||||
3. **Push to remote** - Push committed changes
|
||||
4. **Fetch with prune** - `git fetch --all --prune`
|
||||
5. **Sync with base** - Rebase on base branch (per sync-workflow.md)
|
||||
6. **Handle conflicts** - Guide resolution if conflicts occur (per merge-workflow.md)
|
||||
7. **Push again** - `git push --force-with-lease` if rebased
|
||||
8. **Detect stale** - Report stale local branches
|
||||
9. **Report status** - Show sync summary
|
||||
|
||||
## Output
|
||||
|
||||
On success:
|
||||
```
|
||||
Committed: abc1234
|
||||
Pushed to: origin/feat/password-reset
|
||||
Synced with: development (xyz7890)
|
||||
|
||||
Status: Clean, up-to-date
|
||||
Stale branches: None (or N found - run /branch-cleanup)
|
||||
Stale branches: 2 found - run /branch-cleanup
|
||||
```
|
||||
|
||||
@@ -1,158 +1,41 @@
|
||||
---
|
||||
name: commit
|
||||
description: Create a git commit with auto-generated conventional commit message
|
||||
agent: git-assistant
|
||||
---
|
||||
|
||||
# /commit - Smart Commit
|
||||
|
||||
## Visual Output
|
||||
## Skills
|
||||
|
||||
When executing this command, display the plugin header:
|
||||
|
||||
```
|
||||
┌──────────────────────────────────────────────────────────────────┐
|
||||
│ 🔀 GIT-FLOW · Smart Commit │
|
||||
└──────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
Then proceed with the commit workflow.
|
||||
- skills/visual-header.md
|
||||
- skills/git-safety.md
|
||||
- skills/commit-conventions.md
|
||||
- skills/environment-variables.md
|
||||
|
||||
## Purpose
|
||||
|
||||
Create a git commit with an auto-generated conventional commit message based on staged changes.
|
||||
|
||||
## Behavior
|
||||
## Parameters
|
||||
|
||||
### Step 1: Check for Protected Branch
|
||||
| Parameter | Description |
|
||||
|-----------|-------------|
|
||||
| `--message`, `-m` | Override auto-generated message |
|
||||
| `--all`, `-a` | Stage all changes before commit |
|
||||
|
||||
Before any commit operation, check if the current branch is protected:
|
||||
## Workflow
|
||||
|
||||
1. Get current branch: `git branch --show-current`
|
||||
2. Check against `GIT_PROTECTED_BRANCHES` (default: `main,master,development,staging,production`)
|
||||
|
||||
If on a protected branch, warn the user:
|
||||
|
||||
```
|
||||
⚠️ You are on a protected branch: development
|
||||
|
||||
Protected branches typically have push restrictions that will prevent
|
||||
direct commits from being pushed to the remote.
|
||||
|
||||
Options:
|
||||
1. Create a feature branch and continue (Recommended)
|
||||
2. Continue on this branch anyway (may fail on push)
|
||||
3. Cancel
|
||||
```
|
||||
|
||||
**If option 1 (create feature branch):**
|
||||
- Prompt for branch type (feat/fix/chore/docs/refactor)
|
||||
- Prompt for brief description
|
||||
- Create branch using `/branch-start` naming conventions
|
||||
- Continue with commit on the new branch
|
||||
|
||||
**If option 2 (continue anyway):**
|
||||
- Proceed with commit (user accepts risk of push rejection)
|
||||
- Display reminder: "Remember: push may be rejected by remote protection rules"
|
||||
|
||||
### Step 2: Analyze Changes
|
||||
|
||||
1. Run `git status` to see staged and unstaged changes
|
||||
2. Run `git diff --staged` to examine staged changes
|
||||
3. If nothing staged, prompt user to stage changes
|
||||
|
||||
### Step 3: Generate Commit Message
|
||||
|
||||
Analyze the changes and generate a conventional commit message:
|
||||
|
||||
```
|
||||
<type>(<scope>): <description>
|
||||
|
||||
[optional body]
|
||||
|
||||
[optional footer]
|
||||
```
|
||||
|
||||
**Types:**
|
||||
- `feat`: New feature
|
||||
- `fix`: Bug fix
|
||||
- `docs`: Documentation only
|
||||
- `style`: Formatting, missing semicolons, etc.
|
||||
- `refactor`: Code change that neither fixes a bug nor adds a feature
|
||||
- `perf`: Performance improvement
|
||||
- `test`: Adding/updating tests
|
||||
- `chore`: Maintenance tasks
|
||||
- `build`: Build system or external dependencies
|
||||
- `ci`: CI configuration
|
||||
|
||||
**Scope:** Determined from changed files (e.g., `auth`, `api`, `ui`)
|
||||
|
||||
### Step 4: Confirm or Edit
|
||||
|
||||
Present the generated message:
|
||||
|
||||
```
|
||||
Proposed commit message:
|
||||
───────────────────────
|
||||
feat(auth): add password reset functionality
|
||||
|
||||
Implement forgot password flow with email verification.
|
||||
Includes rate limiting and token expiration.
|
||||
───────────────────────
|
||||
|
||||
Options:
|
||||
1. Use this message (Recommended)
|
||||
2. Edit the message
|
||||
3. Regenerate with different focus
|
||||
4. Cancel
|
||||
```
|
||||
|
||||
### Step 5: Execute Commit
|
||||
|
||||
If confirmed, run:
|
||||
|
||||
```bash
|
||||
git commit -m "$(cat <<'EOF'
|
||||
<message>
|
||||
|
||||
Co-Authored-By: Claude <noreply@anthropic.com>
|
||||
EOF
|
||||
)"
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| `GIT_PROTECTED_BRANCHES` | `main,master,development,staging,production` | Branches that trigger protection warning |
|
||||
| `GIT_COMMIT_STYLE` | `conventional` | Message style (conventional, simple, detailed) |
|
||||
| `GIT_SIGN_COMMITS` | `false` | Use GPG signing |
|
||||
| `GIT_CO_AUTHOR` | `true` | Include Claude co-author footer |
|
||||
|
||||
## Edge Cases
|
||||
|
||||
### No Changes Staged
|
||||
|
||||
```
|
||||
No changes staged for commit.
|
||||
|
||||
Would you like to:
|
||||
1. Stage all changes (`git add -A`)
|
||||
2. Stage specific files (I'll help you choose)
|
||||
3. Cancel
|
||||
```
|
||||
|
||||
### Untracked Files
|
||||
|
||||
```
|
||||
Found 3 untracked files:
|
||||
- src/new-feature.ts
|
||||
- tests/new-feature.test.ts
|
||||
- docs/new-feature.md
|
||||
|
||||
Include these in the commit?
|
||||
1. Yes, stage all (Recommended)
|
||||
2. Let me pick which ones
|
||||
3. No, commit only tracked files
|
||||
```
|
||||
1. **Display header** - Show GIT-FLOW Smart Commit header
|
||||
2. **Check protected branch** - Warn if on protected branch (per git-safety.md)
|
||||
3. **Analyze changes** - Run `git status` and `git diff --staged`
|
||||
4. **Handle unstaged** - Prompt to stage if nothing staged
|
||||
5. **Generate message** - Create conventional commit message (per commit-conventions.md)
|
||||
6. **Confirm or edit** - Present message with options to use, edit, regenerate, or cancel
|
||||
7. **Execute commit** - Run `git commit` with message and co-author footer
|
||||
|
||||
## Output
|
||||
|
||||
On success:
|
||||
```
|
||||
Committed: abc1234
|
||||
feat(auth): add password reset functionality
|
||||
|
||||
@@ -1,106 +1,50 @@
|
||||
---
|
||||
name: git-config
|
||||
description: Configure git-flow settings for the current project
|
||||
agent: git-assistant
|
||||
---
|
||||
|
||||
# /git-config - Configure git-flow
|
||||
|
||||
## Visual Output
|
||||
## Skills
|
||||
|
||||
When executing this command, display the plugin header:
|
||||
|
||||
```
|
||||
┌──────────────────────────────────────────────────────────────────┐
|
||||
│ 🔀 GIT-FLOW · Configuration │
|
||||
└──────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
Then proceed with the configuration.
|
||||
- skills/visual-header.md
|
||||
- skills/environment-variables.md
|
||||
- skills/workflow-patterns/branching-strategies.md
|
||||
|
||||
## Purpose
|
||||
|
||||
Configure git-flow settings for the current project.
|
||||
Configure git-flow settings interactively or display current configuration.
|
||||
|
||||
## Behavior
|
||||
## Parameters
|
||||
|
||||
### Interactive Configuration
|
||||
| Parameter | Description |
|
||||
|-----------|-------------|
|
||||
| `--show` | Display current settings without prompting |
|
||||
| `--reset` | Reset all settings to defaults |
|
||||
| `<key>=<value>` | Set specific variable directly |
|
||||
|
||||
```
|
||||
git-flow Configuration
|
||||
═══════════════════════════════════════════
|
||||
## Workflow
|
||||
|
||||
Current settings:
|
||||
GIT_WORKFLOW_STYLE: feature-branch
|
||||
GIT_DEFAULT_BASE: development
|
||||
GIT_AUTO_DELETE_MERGED: true
|
||||
GIT_AUTO_PUSH: false
|
||||
1. **Display header** - Show GIT-FLOW Configuration header
|
||||
2. **Load current settings** - Read from project and user config
|
||||
3. **Present menu** - Show configuration options
|
||||
4. **Handle selection** - Configure workflow style, base branch, protected branches, etc.
|
||||
5. **Save settings** - Write to `.env` or `.claude/settings.json`
|
||||
6. **Confirm** - Display saved configuration
|
||||
|
||||
What would you like to configure?
|
||||
1. Workflow style
|
||||
## Configuration Menu
|
||||
|
||||
1. Workflow style (simple, feature-branch, pr-required, trunk-based)
|
||||
2. Default base branch
|
||||
3. Auto-delete merged branches
|
||||
4. Auto-push after commit
|
||||
5. Protected branches
|
||||
6. View all settings
|
||||
7. Reset to defaults
|
||||
```
|
||||
|
||||
### Setting: Workflow Style
|
||||
|
||||
```
|
||||
Choose your workflow style:
|
||||
|
||||
1. simple
|
||||
- Direct commits to development
|
||||
- No feature branches required
|
||||
- Good for solo projects
|
||||
|
||||
2. feature-branch (Recommended)
|
||||
- Feature branches from development
|
||||
- Merge when complete
|
||||
- Good for small teams
|
||||
|
||||
3. pr-required
|
||||
- Feature branches from development
|
||||
- Requires PR for merge
|
||||
- Good for code review workflows
|
||||
|
||||
4. trunk-based
|
||||
- Short-lived branches
|
||||
- Frequent integration
|
||||
- Good for CI/CD heavy workflows
|
||||
```
|
||||
|
||||
### Setting: Protected Branches
|
||||
|
||||
```
|
||||
Protected branches (comma-separated):
|
||||
Current: main, master, development, staging, production
|
||||
|
||||
These branches will:
|
||||
- Never be auto-deleted
|
||||
- Require confirmation before direct commits
|
||||
- Warn before force push
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Variable | Default | Options |
|
||||
|----------|---------|---------|
|
||||
| `GIT_WORKFLOW_STYLE` | `feature-branch` | simple, feature-branch, pr-required, trunk-based |
|
||||
| `GIT_DEFAULT_BASE` | `development` | Any branch name |
|
||||
| `GIT_AUTO_DELETE_MERGED` | `true` | true, false |
|
||||
| `GIT_AUTO_PUSH` | `false` | true, false |
|
||||
| `GIT_PROTECTED_BRANCHES` | `main,master,development,staging,production` | Comma-separated |
|
||||
| `GIT_COMMIT_STYLE` | `conventional` | conventional, simple, detailed |
|
||||
| `GIT_CO_AUTHOR` | `true` | true, false |
|
||||
|
||||
## Storage
|
||||
|
||||
Settings are stored in:
|
||||
- Project: `.env` or `.claude/settings.json`
|
||||
- User: `~/.config/claude/git-flow.env`
|
||||
|
||||
Project settings override user settings.
|
||||
|
||||
## Output
|
||||
|
||||
After configuration:
|
||||
```
|
||||
Configuration saved!
|
||||
|
||||
|
||||
@@ -1,84 +1,56 @@
|
||||
---
|
||||
name: git-status
|
||||
description: Show comprehensive git status with recommendations
|
||||
agent: git-assistant
|
||||
---
|
||||
|
||||
# /git-status - Enhanced Status
|
||||
|
||||
## Visual Output
|
||||
## Skills
|
||||
|
||||
When executing this command, display the plugin header:
|
||||
|
||||
```
|
||||
┌──────────────────────────────────────────────────────────────────┐
|
||||
│ 🔀 GIT-FLOW · Status │
|
||||
└──────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
Then proceed with the status display.
|
||||
- skills/visual-header.md
|
||||
- skills/commit-conventions.md
|
||||
- skills/environment-variables.md
|
||||
|
||||
## Purpose
|
||||
|
||||
Show comprehensive git status with recommendations and insights.
|
||||
Show comprehensive git status with recommendations and insights beyond standard `git status`.
|
||||
|
||||
## Behavior
|
||||
## Parameters
|
||||
|
||||
### Output Format
|
||||
| Parameter | Description |
|
||||
|-----------|-------------|
|
||||
| `--short` | Compact output format |
|
||||
|
||||
## Workflow
|
||||
|
||||
1. **Display header** - Show GIT-FLOW Status header
|
||||
2. **Gather info** - Branch, base comparison, remote status
|
||||
3. **Categorize changes** - Staged, unstaged, untracked, deleted, renamed
|
||||
4. **Generate recommendations** - What to stage, commit, sync
|
||||
5. **Show quick actions** - Relevant /commands for current state
|
||||
|
||||
## Output Format
|
||||
|
||||
```
|
||||
═══════════════════════════════════════════
|
||||
Git Status: <repo-name>
|
||||
═══════════════════════════════════════════
|
||||
|
||||
Branch: feat/password-reset
|
||||
Base: development (3 commits ahead, 0 behind)
|
||||
Remote: origin/feat/password-reset (synced)
|
||||
|
||||
─── Changes ───────────────────────────────
|
||||
|
||||
--- Changes ---
|
||||
Staged (ready to commit):
|
||||
✓ src/auth/reset.ts (modified)
|
||||
✓ src/auth/types.ts (modified)
|
||||
[x] src/auth/reset.ts (modified)
|
||||
|
||||
Unstaged:
|
||||
• tests/auth.test.ts (modified)
|
||||
• src/utils/email.ts (new file, untracked)
|
||||
|
||||
─── Recommendations ───────────────────────
|
||||
[ ] tests/auth.test.ts (modified)
|
||||
|
||||
--- Recommendations ---
|
||||
1. Stage test file: git add tests/auth.test.ts
|
||||
2. Consider adding new file: git add src/utils/email.ts
|
||||
3. Ready to commit with 2 staged files
|
||||
2. Ready to commit with 1 staged file
|
||||
|
||||
─── Quick Actions ─────────────────────────
|
||||
|
||||
• /commit - Commit staged changes
|
||||
• /commit-push - Commit and push
|
||||
• /commit-sync - Full sync with development
|
||||
|
||||
═══════════════════════════════════════════
|
||||
--- Quick Actions ---
|
||||
/commit - Commit staged changes
|
||||
/commit-push - Commit and push
|
||||
```
|
||||
|
||||
## Analysis Provided
|
||||
|
||||
### Branch Health
|
||||
- Commits ahead/behind base branch
|
||||
- Sync status with remote
|
||||
- Age of branch
|
||||
|
||||
### Change Categories
|
||||
- Staged (ready to commit)
|
||||
- Modified (not staged)
|
||||
- Untracked (new files)
|
||||
- Deleted
|
||||
- Renamed
|
||||
|
||||
### Recommendations
|
||||
- What to stage
|
||||
- What to ignore
|
||||
- When to commit
|
||||
- When to sync
|
||||
|
||||
### Warnings
|
||||
- Large number of changes (consider splitting)
|
||||
- Old branch (consider rebasing)
|
||||
- Conflicts with upstream
|
||||
|
||||
## Output
|
||||
|
||||
Always produces the formatted status report with context-aware recommendations.
|
||||
|
||||
97
plugins/git-flow/skills/branch-naming.md
Normal file
97
plugins/git-flow/skills/branch-naming.md
Normal file
@@ -0,0 +1,97 @@
|
||||
# Branch Naming
|
||||
|
||||
## Purpose
|
||||
|
||||
Defines branch naming conventions and validation rules for consistent repository organization.
|
||||
|
||||
## When to Use
|
||||
|
||||
- Creating new branches with `/branch-start`
|
||||
- Validating branch names
|
||||
- Converting descriptions to branch names
|
||||
|
||||
## Branch Name Format
|
||||
|
||||
```
|
||||
<type>/<description>
|
||||
```
|
||||
|
||||
## Branch Types
|
||||
|
||||
| Type | Purpose | Example |
|
||||
|------|---------|---------|
|
||||
| `feat` | New feature | `feat/user-authentication` |
|
||||
| `fix` | Bug fix | `fix/login-timeout` |
|
||||
| `chore` | Maintenance | `chore/update-deps` |
|
||||
| `docs` | Documentation | `docs/api-reference` |
|
||||
| `refactor` | Code restructure | `refactor/auth-module` |
|
||||
| `test` | Test additions | `test/auth-coverage` |
|
||||
| `perf` | Performance | `perf/query-optimization` |
|
||||
| `debug` | Debugging work | `debug/memory-leak` |
|
||||
|
||||
## Naming Rules
|
||||
|
||||
1. **Lowercase only** - Never use uppercase
|
||||
2. **Hyphens for spaces** - Use `-` not `_` or ` `
|
||||
3. **No special characters** - Alphanumeric and hyphens only
|
||||
4. **Descriptive** - 2-4 words recommended
|
||||
5. **Max 50 characters** - Keep concise
|
||||
|
||||
## Conversion Algorithm
|
||||
|
||||
```
|
||||
Input: "Add User Authentication"
|
||||
Output: "feat/add-user-authentication"
|
||||
|
||||
Steps:
|
||||
1. Lowercase: "add user authentication"
|
||||
2. Replace spaces: "add-user-authentication"
|
||||
3. Remove special chars: (none to remove)
|
||||
4. Add prefix: "feat/add-user-authentication"
|
||||
5. Truncate if > 50: (not needed)
|
||||
```
|
||||
|
||||
## Validation Checks
|
||||
|
||||
```
|
||||
Branch name validation:
|
||||
[x] Lowercase
|
||||
[x] Valid prefix (feat/)
|
||||
[x] Descriptive (3+ words recommended)
|
||||
[ ] Too long (52 chars, max 50)
|
||||
|
||||
Suggested: feat/add-user-auth
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
**Valid:**
|
||||
```
|
||||
feat/add-password-reset
|
||||
fix/null-pointer-login
|
||||
chore/upgrade-typescript-5
|
||||
docs/update-readme
|
||||
refactor/simplify-auth
|
||||
```
|
||||
|
||||
**Invalid:**
|
||||
```
|
||||
Feature/Add_Password_Reset (wrong case, underscores)
|
||||
fix-bug (too vague, no prefix)
|
||||
my-branch (no type prefix)
|
||||
feat/add-new-super-amazing-feature-for-users (too long)
|
||||
```
|
||||
|
||||
## Issue-Linked Branches
|
||||
|
||||
When working on issues, include issue number:
|
||||
```
|
||||
feat/123-add-password-reset
|
||||
fix/456-login-timeout
|
||||
```
|
||||
|
||||
## Related Skills
|
||||
|
||||
- skills/commit-conventions.md
|
||||
- skills/git-safety.md
|
||||
- skills/workflow-patterns/branching-strategies.md
|
||||
95
plugins/git-flow/skills/commit-conventions.md
Normal file
95
plugins/git-flow/skills/commit-conventions.md
Normal file
@@ -0,0 +1,95 @@
|
||||
# Commit Conventions
|
||||
|
||||
## Purpose
|
||||
|
||||
Defines conventional commit message format for consistent, parseable commit history.
|
||||
|
||||
## When to Use
|
||||
|
||||
- Generating commit messages in `/commit`
|
||||
- Validating user-provided commit messages
|
||||
- Explaining commit format to users
|
||||
|
||||
## Message Format
|
||||
|
||||
```
|
||||
<type>(<scope>): <description>
|
||||
|
||||
[optional body]
|
||||
|
||||
[optional footer]
|
||||
```
|
||||
|
||||
## Commit Types
|
||||
|
||||
| Type | Purpose | Example Scope |
|
||||
|------|---------|---------------|
|
||||
| `feat` | New feature | `auth`, `api`, `ui` |
|
||||
| `fix` | Bug fix | `login`, `validation` |
|
||||
| `docs` | Documentation only | `readme`, `api-docs` |
|
||||
| `style` | Formatting, whitespace | `lint`, `format` |
|
||||
| `refactor` | Code change (no bug fix, no feature) | `auth-module` |
|
||||
| `perf` | Performance improvement | `query`, `cache` |
|
||||
| `test` | Adding/updating tests | `unit`, `e2e` |
|
||||
| `chore` | Maintenance tasks | `deps`, `build` |
|
||||
| `build` | Build system or dependencies | `webpack`, `npm` |
|
||||
| `ci` | CI configuration | `github-actions` |
|
||||
|
||||
## Scope Detection
|
||||
|
||||
Derive scope from changed files:
|
||||
- `src/auth/*` -> `auth`
|
||||
- `src/api/*` -> `api`
|
||||
- `tests/*` -> `test`
|
||||
- `docs/*` -> `docs`
|
||||
- Multiple directories -> most significant or omit
|
||||
|
||||
## Examples
|
||||
|
||||
**Feature commit:**
|
||||
```
|
||||
feat(auth): add password reset flow
|
||||
|
||||
Implement forgot password with email verification.
|
||||
Includes rate limiting (5 attempts/hour) and 24h token expiration.
|
||||
|
||||
Closes #123
|
||||
```
|
||||
|
||||
**Bug fix:**
|
||||
```
|
||||
fix(ui): resolve button alignment on mobile
|
||||
|
||||
The submit button was misaligned on screens < 768px.
|
||||
Added responsive flex rules.
|
||||
```
|
||||
|
||||
**Maintenance:**
|
||||
```
|
||||
chore(deps): update dependencies
|
||||
|
||||
- typescript 5.3 -> 5.4
|
||||
- react 18.2 -> 18.3
|
||||
- node 18 -> 20 (LTS)
|
||||
```
|
||||
|
||||
## Footer Conventions
|
||||
|
||||
| Footer | Purpose |
|
||||
|--------|---------|
|
||||
| `Closes #123` | Auto-close issue |
|
||||
| `Refs #123` | Reference without closing |
|
||||
| `BREAKING CHANGE:` | Breaking change description |
|
||||
| `Co-Authored-By:` | Credit co-author |
|
||||
|
||||
## Co-Author Footer
|
||||
|
||||
When Claude assists with commits:
|
||||
```
|
||||
Co-Authored-By: Claude <noreply@anthropic.com>
|
||||
```
|
||||
|
||||
## Related Skills
|
||||
|
||||
- skills/branch-naming.md
|
||||
- skills/git-safety.md
|
||||
92
plugins/git-flow/skills/environment-variables.md
Normal file
92
plugins/git-flow/skills/environment-variables.md
Normal file
@@ -0,0 +1,92 @@
|
||||
# Environment Variables
|
||||
|
||||
## Purpose
|
||||
|
||||
Centralized reference for all git-flow environment variables and their defaults.
|
||||
|
||||
## When to Use
|
||||
|
||||
- Configuring git-flow behavior in `/git-config`
|
||||
- Documenting available options to users
|
||||
- Setting up project-specific overrides
|
||||
|
||||
## Core Variables
|
||||
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| `GIT_DEFAULT_BASE` | `development` | Base branch for new branches and merges |
|
||||
| `GIT_PROTECTED_BRANCHES` | `main,master,development,staging,production` | Comma-separated list of protected branches |
|
||||
| `GIT_WORKFLOW_STYLE` | `feature-branch` | Workflow: simple, feature-branch, pr-required, trunk-based |
|
||||
|
||||
## Commit Variables
|
||||
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| `GIT_COMMIT_STYLE` | `conventional` | Message style: conventional, simple, detailed |
|
||||
| `GIT_SIGN_COMMITS` | `false` | Use GPG signing |
|
||||
| `GIT_CO_AUTHOR` | `true` | Include Claude co-author footer |
|
||||
|
||||
## Push/Sync Variables
|
||||
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| `GIT_AUTO_PUSH` | `false` | Auto-push after commit |
|
||||
| `GIT_PUSH_STRATEGY` | `rebase` | Handle diverged branches: rebase, merge |
|
||||
| `GIT_SYNC_STRATEGY` | `rebase` | Incorporate upstream changes: rebase, merge |
|
||||
| `GIT_AUTO_PRUNE` | `true` | Auto-prune stale remote refs on sync |
|
||||
|
||||
## Branch Variables
|
||||
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| `GIT_BRANCH_PREFIX` | `true` | Use type/ prefix for branches |
|
||||
| `GIT_AUTO_DELETE_MERGED` | `true` | Auto-delete merged branches |
|
||||
| `GIT_AUTO_DELETE_REMOTE` | `false` | Auto-delete remote branches |
|
||||
| `GIT_CLEANUP_STALE` | `true` | Include stale branches in cleanup |
|
||||
|
||||
## Workflow Styles
|
||||
|
||||
### simple
|
||||
- Direct commits to main/development
|
||||
- No feature branches required
|
||||
- Best for: Solo projects, small scripts
|
||||
|
||||
### feature-branch (Default)
|
||||
- Feature branches from development
|
||||
- Merge when complete
|
||||
- Best for: Small teams
|
||||
|
||||
### pr-required
|
||||
- Feature branches from development
|
||||
- Requires PR for merge
|
||||
- Best for: Code review workflows
|
||||
|
||||
### trunk-based
|
||||
- Short-lived branches (< 1 day)
|
||||
- Frequent integration
|
||||
- Best for: CI/CD heavy workflows
|
||||
|
||||
## Storage Locations
|
||||
|
||||
| Scope | Location | Priority |
|
||||
|-------|----------|----------|
|
||||
| Project | `.env` or `.claude/settings.json` | Highest |
|
||||
| User | `~/.config/claude/git-flow.env` | Lower |
|
||||
|
||||
Project settings override user settings.
|
||||
|
||||
## Example Configuration
|
||||
|
||||
**.env file:**
|
||||
```bash
|
||||
GIT_DEFAULT_BASE=main
|
||||
GIT_WORKFLOW_STYLE=pr-required
|
||||
GIT_AUTO_DELETE_MERGED=true
|
||||
GIT_COMMIT_STYLE=conventional
|
||||
GIT_PROTECTED_BRANCHES=main,staging,production
|
||||
```
|
||||
|
||||
## Related Skills
|
||||
|
||||
- skills/git-safety.md
|
||||
- skills/commit-conventions.md
|
||||
105
plugins/git-flow/skills/git-safety.md
Normal file
105
plugins/git-flow/skills/git-safety.md
Normal file
@@ -0,0 +1,105 @@
|
||||
# Git Safety
|
||||
|
||||
## Purpose
|
||||
|
||||
Defines protected branches, destructive command warnings, and safety checks to prevent accidental data loss.
|
||||
|
||||
## When to Use
|
||||
|
||||
- Before any commit, push, or merge operation
|
||||
- When user attempts to work on protected branches
|
||||
- Before executing destructive commands
|
||||
|
||||
## Protected Branches
|
||||
|
||||
Default protected branches (configurable via `GIT_PROTECTED_BRANCHES`):
|
||||
- `main`
|
||||
- `master`
|
||||
- `development`
|
||||
- `staging`
|
||||
- `production`
|
||||
|
||||
## Protection Rules
|
||||
|
||||
| Action | Behavior |
|
||||
|--------|----------|
|
||||
| Direct commit | Warn and offer to create feature branch |
|
||||
| Force push | Require explicit confirmation |
|
||||
| Deletion | Block completely |
|
||||
| Merge into | Allow with standard workflow |
|
||||
|
||||
## Protected Branch Warning
|
||||
|
||||
When committing on protected branch:
|
||||
|
||||
```
|
||||
You are on a protected branch: development
|
||||
|
||||
Protected branches typically have push restrictions that will prevent
|
||||
direct commits from being pushed to the remote.
|
||||
|
||||
Options:
|
||||
1. Create a feature branch and continue (Recommended)
|
||||
2. Continue on this branch anyway (may fail on push)
|
||||
3. Cancel
|
||||
```
|
||||
|
||||
## Destructive Commands
|
||||
|
||||
Commands requiring extra confirmation:
|
||||
|
||||
| Command | Risk | Mitigation |
|
||||
|---------|------|------------|
|
||||
| `git push --force` | Overwrites remote history | Use `--force-with-lease` |
|
||||
| `git reset --hard` | Loses uncommitted changes | Warn about unsaved work |
|
||||
| `git branch -D` | Deletes unmerged branch | Confirm branch name |
|
||||
| `git clean -fd` | Deletes untracked files | List files first |
|
||||
|
||||
## Safe Alternatives
|
||||
|
||||
| Risky | Safe Alternative |
|
||||
|-------|------------------|
|
||||
| `git push --force` | `git push --force-with-lease` |
|
||||
| `git branch -D` | `git branch -d` (merged only) |
|
||||
| `git reset --hard` | `git stash` first |
|
||||
| `git checkout .` | Review changes first |
|
||||
|
||||
## Branch Deletion Safety
|
||||
|
||||
**Merged branches (`-d`):**
|
||||
```bash
|
||||
git branch -d feat/old-feature # Safe: only deletes if merged
|
||||
```
|
||||
|
||||
**Unmerged branches (`-D`):**
|
||||
```bash
|
||||
# Requires confirmation
|
||||
git branch -D feat/abandoned # Force: deletes regardless
|
||||
```
|
||||
|
||||
## Push Rejection Handling
|
||||
|
||||
When push fails on protected branch:
|
||||
|
||||
```
|
||||
Push rejected: Remote protection rules prevent direct push to development.
|
||||
|
||||
Options:
|
||||
1. Create a pull request instead (Recommended)
|
||||
2. Review branch protection settings
|
||||
3. Cancel
|
||||
```
|
||||
|
||||
## Stale Branch Detection
|
||||
|
||||
Branches with deleted remotes:
|
||||
```bash
|
||||
git branch -vv | grep ': gone]'
|
||||
```
|
||||
|
||||
These are safe to delete locally with `-D` after confirmation.
|
||||
|
||||
## Related Skills
|
||||
|
||||
- skills/branch-naming.md
|
||||
- skills/merge-workflow.md
|
||||
124
plugins/git-flow/skills/merge-workflow.md
Normal file
124
plugins/git-flow/skills/merge-workflow.md
Normal file
@@ -0,0 +1,124 @@
|
||||
# Merge Workflow
|
||||
|
||||
## Purpose
|
||||
|
||||
Defines merge strategies, conflict resolution approaches, and post-merge cleanup procedures.
|
||||
|
||||
## When to Use
|
||||
|
||||
- Merging feature branches in `/commit-merge`
|
||||
- Resolving conflicts during sync operations
|
||||
- Cleaning up after successful merges
|
||||
|
||||
## Merge Strategies
|
||||
|
||||
### 1. Merge Commit (Default)
|
||||
|
||||
```bash
|
||||
git merge <branch> --no-ff
|
||||
```
|
||||
|
||||
- **Preserves history** - All commits visible
|
||||
- **Creates merge commit** - Clear merge point
|
||||
- **Best for:** Feature branches, team workflows
|
||||
|
||||
### 2. Squash and Merge
|
||||
|
||||
```bash
|
||||
git merge <branch> --squash
|
||||
git commit -m "feat: complete feature"
|
||||
```
|
||||
|
||||
- **Single commit** - Clean main branch history
|
||||
- **Loses individual commits** - Combined into one
|
||||
- **Best for:** PR workflows, many small commits
|
||||
|
||||
### 3. Rebase
|
||||
|
||||
```bash
|
||||
git checkout <branch>
|
||||
git rebase <target>
|
||||
git checkout <target>
|
||||
git merge <branch> --ff-only
|
||||
```
|
||||
|
||||
- **Linear history** - No merge commits
|
||||
- **Rewrites history** - Changes commit hashes
|
||||
- **Best for:** Personal branches, clean history
|
||||
|
||||
## Standard Merge Procedure
|
||||
|
||||
```bash
|
||||
# 1. Switch to target branch
|
||||
git checkout <target>
|
||||
|
||||
# 2. Pull latest changes
|
||||
git pull origin <target>
|
||||
|
||||
# 3. Merge feature branch
|
||||
git merge <feature-branch> [--squash] [--no-ff]
|
||||
|
||||
# 4. Push merged result
|
||||
git push origin <target>
|
||||
```
|
||||
|
||||
## Conflict Resolution
|
||||
|
||||
When conflicts occur:
|
||||
|
||||
```
|
||||
Conflicts detected while merging.
|
||||
|
||||
Conflicting files:
|
||||
- src/auth/login.ts
|
||||
- src/auth/types.ts
|
||||
|
||||
Options:
|
||||
1. Open conflict resolution (guided)
|
||||
2. Abort merge (keep local state)
|
||||
3. Accept all theirs (loses your changes in conflicts)
|
||||
4. Accept all ours (ignores upstream in conflicts)
|
||||
```
|
||||
|
||||
### Manual Resolution Steps
|
||||
|
||||
1. Open conflicting file
|
||||
2. Find conflict markers: `<<<<<<<`, `=======`, `>>>>>>>`
|
||||
3. Edit to desired state
|
||||
4. Remove markers
|
||||
5. Stage resolved file: `git add <file>`
|
||||
6. Continue: `git merge --continue` or `git rebase --continue`
|
||||
|
||||
## Post-Merge Cleanup
|
||||
|
||||
After successful merge:
|
||||
|
||||
```
|
||||
Merge complete. Delete the feature branch?
|
||||
1. Yes, delete local and remote (Recommended)
|
||||
2. Delete local only
|
||||
3. Keep the branch
|
||||
```
|
||||
|
||||
### Cleanup Commands
|
||||
|
||||
```bash
|
||||
# Delete local branch
|
||||
git branch -d <branch>
|
||||
|
||||
# Delete remote branch
|
||||
git push origin --delete <branch>
|
||||
```
|
||||
|
||||
## Pre-Merge Checks
|
||||
|
||||
Before merging:
|
||||
1. **Verify target exists** - `git branch -a | grep <target>`
|
||||
2. **Check for uncommitted changes** - `git status`
|
||||
3. **Preview conflicts** - `git merge --no-commit --no-ff <branch>`
|
||||
4. **Abort preview** - `git merge --abort`
|
||||
|
||||
## Related Skills
|
||||
|
||||
- skills/git-safety.md
|
||||
- skills/sync-workflow.md
|
||||
146
plugins/git-flow/skills/sync-workflow.md
Normal file
146
plugins/git-flow/skills/sync-workflow.md
Normal file
@@ -0,0 +1,146 @@
|
||||
# Sync Workflow
|
||||
|
||||
## Purpose
|
||||
|
||||
Defines push/pull patterns, rebase strategies, upstream tracking, and stale branch detection.
|
||||
|
||||
## When to Use
|
||||
|
||||
- Pushing commits in `/commit-push`
|
||||
- Full sync operations in `/commit-sync`
|
||||
- Detecting and reporting stale branches
|
||||
|
||||
## Push Workflow
|
||||
|
||||
### First Push (No Upstream)
|
||||
|
||||
```bash
|
||||
git push -u origin <branch>
|
||||
```
|
||||
|
||||
Sets upstream tracking for future pushes.
|
||||
|
||||
### Subsequent Pushes
|
||||
|
||||
```bash
|
||||
git push
|
||||
```
|
||||
|
||||
Pushes to tracked upstream.
|
||||
|
||||
### Push After Rebase
|
||||
|
||||
```bash
|
||||
git push --force-with-lease
|
||||
```
|
||||
|
||||
Safe force push - fails if remote has new commits.
|
||||
|
||||
## Sync with Base Branch
|
||||
|
||||
```bash
|
||||
# 1. Fetch all with prune
|
||||
git fetch --all --prune
|
||||
|
||||
# 2. Rebase on base branch
|
||||
git rebase origin/<base-branch>
|
||||
|
||||
# 3. Push (force if rebased)
|
||||
git push --force-with-lease
|
||||
```
|
||||
|
||||
## Push Conflict Handling
|
||||
|
||||
When push fails due to diverged history:
|
||||
|
||||
```
|
||||
Remote has changes not in your local branch.
|
||||
|
||||
Options:
|
||||
1. Pull and rebase, then push (Recommended)
|
||||
2. Pull and merge, then push
|
||||
3. Force push (destructive - requires confirmation)
|
||||
4. Cancel and review manually
|
||||
```
|
||||
|
||||
### Rebase Resolution
|
||||
|
||||
```bash
|
||||
git pull --rebase origin <branch>
|
||||
git push
|
||||
```
|
||||
|
||||
### Merge Resolution
|
||||
|
||||
```bash
|
||||
git pull origin <branch>
|
||||
git push
|
||||
```
|
||||
|
||||
## Stale Branch Detection
|
||||
|
||||
Find local branches tracking deleted remotes:
|
||||
|
||||
```bash
|
||||
git branch -vv | grep ': gone]'
|
||||
```
|
||||
|
||||
### Report Format
|
||||
|
||||
```
|
||||
Stale local branches (remote deleted):
|
||||
- feat/old-feature (was tracking origin/feat/old-feature)
|
||||
- fix/merged-bugfix (was tracking origin/fix/merged-bugfix)
|
||||
|
||||
Run /branch-cleanup to remove these branches.
|
||||
```
|
||||
|
||||
## Remote Pruning
|
||||
|
||||
Remove stale remote-tracking references:
|
||||
|
||||
```bash
|
||||
git fetch --prune
|
||||
```
|
||||
|
||||
Or fetch all remotes:
|
||||
|
||||
```bash
|
||||
git fetch --all --prune
|
||||
```
|
||||
|
||||
## Sync Status Report
|
||||
|
||||
```
|
||||
Sync complete:
|
||||
|
||||
Local: feat/password-reset @ abc1234
|
||||
Remote: origin/feat/password-reset @ abc1234
|
||||
Base: development @ xyz7890 (synced)
|
||||
|
||||
Your branch is up-to-date with development.
|
||||
No conflicts detected.
|
||||
|
||||
Cleanup:
|
||||
Remote refs pruned: 2
|
||||
Stale local branches: 2 (run /branch-cleanup to remove)
|
||||
```
|
||||
|
||||
## Tracking Setup
|
||||
|
||||
Check tracking status:
|
||||
|
||||
```bash
|
||||
git branch -vv
|
||||
```
|
||||
|
||||
Set upstream:
|
||||
|
||||
```bash
|
||||
git branch --set-upstream-to=origin/<branch> <branch>
|
||||
```
|
||||
|
||||
## Related Skills
|
||||
|
||||
- skills/git-safety.md
|
||||
- skills/merge-workflow.md
|
||||
84
plugins/git-flow/skills/visual-header.md
Normal file
84
plugins/git-flow/skills/visual-header.md
Normal file
@@ -0,0 +1,84 @@
|
||||
# Visual Header
|
||||
|
||||
## Purpose
|
||||
|
||||
Standard header format for consistent visual output across all git-flow commands.
|
||||
|
||||
## When to Use
|
||||
|
||||
- At the start of every git-flow command execution
|
||||
- Displaying command identity to user
|
||||
|
||||
## Header Format
|
||||
|
||||
```
|
||||
+----------------------------------------------------------------------+
|
||||
| GIT-FLOW [Command Name] |
|
||||
+----------------------------------------------------------------------+
|
||||
```
|
||||
|
||||
## Command Headers
|
||||
|
||||
### /commit
|
||||
```
|
||||
+----------------------------------------------------------------------+
|
||||
| GIT-FLOW Smart Commit |
|
||||
+----------------------------------------------------------------------+
|
||||
```
|
||||
|
||||
### /commit-push
|
||||
```
|
||||
+----------------------------------------------------------------------+
|
||||
| GIT-FLOW Commit & Push |
|
||||
+----------------------------------------------------------------------+
|
||||
```
|
||||
|
||||
### /commit-sync
|
||||
```
|
||||
+----------------------------------------------------------------------+
|
||||
| GIT-FLOW Commit Sync |
|
||||
+----------------------------------------------------------------------+
|
||||
```
|
||||
|
||||
### /commit-merge
|
||||
```
|
||||
+----------------------------------------------------------------------+
|
||||
| GIT-FLOW Commit & Merge |
|
||||
+----------------------------------------------------------------------+
|
||||
```
|
||||
|
||||
### /branch-start
|
||||
```
|
||||
+----------------------------------------------------------------------+
|
||||
| GIT-FLOW Branch Start |
|
||||
+----------------------------------------------------------------------+
|
||||
```
|
||||
|
||||
### /branch-cleanup
|
||||
```
|
||||
+----------------------------------------------------------------------+
|
||||
| GIT-FLOW Branch Cleanup |
|
||||
+----------------------------------------------------------------------+
|
||||
```
|
||||
|
||||
### /git-status
|
||||
```
|
||||
+----------------------------------------------------------------------+
|
||||
| GIT-FLOW Status |
|
||||
+----------------------------------------------------------------------+
|
||||
```
|
||||
|
||||
### /git-config
|
||||
```
|
||||
+----------------------------------------------------------------------+
|
||||
| GIT-FLOW Configuration |
|
||||
+----------------------------------------------------------------------+
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Display header immediately after command invocation, before any workflow steps.
|
||||
|
||||
## Related Skills
|
||||
|
||||
- None (standalone utility)
|
||||
Reference in New Issue
Block a user