3.6 KiB
3.6 KiB
tags, description, argument-hint, allowed-tools, model, references_guidelines
| tags | description | argument-hint | allowed-tools | model | references_guidelines | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Unified branch operations with git-workflow enforcement | create ISSUE-ID | merge [target] | delete branch-name | switch branch-name | status | "natural language" |
|
claude-sonnet-4-5 |
|
/branch Command
WHAT: Unified branch operations (create, merge, delete, switch, status) with git-workflow enforcement.
WHY: Ensure consistent branch naming, enforce quality gates on merge, prevent workflow violations.
HOW: See git-workflow.md for branching rules, merge validation requirements, and naming patterns.
CRITICAL: Always read docs/development/workflows/git-workflow.md FIRST for project-specific rules.
Usage
/branch create TASK-001 # Create work branch
/branch merge [develop|main] # Merge with validation
/branch delete feature/TASK-001 # Delete merged branch
/branch switch develop # Switch branches
/branch status # Show workflow state
# Natural language
/branch "merge to develop"
/branch "create for TASK-001"
Operations
Create
- Read git-workflow.md for branching pattern and base branch
- Parse issue ID → determine type (TASK → feature, BUG → bugfix)
- Create branch following pattern (e.g.,
feature/TASK-001fromdevelop) - Switch to new branch
Merge
- Read git-workflow.md for merge rules
- Apply validation based on target:
- To develop: Run tests (BLOCK if fail)
- To main:
- Verify source is
develop(BLOCK if feature/bugfix) - Run staging health checks (BLOCK if fail)
- Hotfixes require explicit justification
- Verify source is
- If pass: merge and push
- If fail: block with clear error
Delete
- Check if fully merged
- Confirm with user
- Delete local and remote
Switch
- Check uncommitted changes (offer stash)
- Switch to target
- Pull latest
Status
- Show current branch and issue context
- Check test/validation status
- Show merge requirements
Configuration
Reads docs/development/workflows/git-workflow.md YAML frontmatter:
---
branching_strategy: "three-branch"
main_branch: "main"
develop_branch: "develop"
work_branch_pattern: "type/ISSUE-ID"
merge_rules:
to_develop: "tests_pass"
to_main: "staging_validated"
---
If missing: Use defaults (three-branch: main ← develop ← work branches)
Agent Coordination
- devops-engineer - Health checks, deployment validation
- test-engineer - Test execution, result parsing
Command Instructions
Task: "Execute Git branch operation following project workflow rules.
CRITICAL:
1. FIRST: Read docs/development/workflows/git-workflow.md
- Extract YAML frontmatter
- Understand strategy, patterns, merge rules
- Use as source of truth
2. Execute operation:
- create: Follow pattern, create from base
- merge: Apply validation, block if fail
- delete: Check merge status, confirm, delete
- switch: Handle uncommitted, switch, pull
- status: Show state and readiness
3. Validation enforcement:
- Merge to develop: Run tests (auto-detect)
- Merge to main: Verify source=develop, check staging
- Block if fail, show clear errors
4. Git commands:
- git checkout, branch, merge, push
- Parse output, handle conflicts
5. Natural language:
- Parse intent from quoted string
- Map to structured operation
- Execute with same validation
All rules defined in git-workflow.md - this command enforces them."