8.9 KiB
Executable File
model, allowed-tools, argument-hint, description
| model | allowed-tools | argument-hint | description |
|---|---|---|---|
| claude-haiku-4-5-20251001 | Bash(git add:*), Bash(git status:*), Bash(git commit:*), Bash(git diff:*), Bash(git log:*), Bash(git push:*), Bash(git pull:*), Bash(git branch:*), mcp__*, mcp__ado__repo_list_branches_by_repo, mcp__ado__repo_search_commits, mcp__ado__repo_create_pull_request, mcp__ado__repo_get_pull_request_by_id, mcp__ado__repo_get_repo_by_name_or_id, mcp__ado__wit_add_work_item_comment, mcp__ado__wit_get_work_item, Read, Glob | Automatically analyze changes and create PR from current feature branch to staging |
Create Feature PR to Staging
Automatically analyzes repository changes, generates appropriate commit message, and creates pull request to staging.
Repository Configuration
- Project: Program Unify
- Repository ID: e030ea00-2f85-4b19-88c3-05a864d7298d
- Repository Name: unify_2_1_dm_synapse_env_d10
- Target Branch:
staging(fixed) - Source Branch: Current feature branch
Current Repository State
- Git status: !
git status --short - Current branch: !
git branch --show-current - Staged changes: !
git diff --cached --stat - Unstaged changes: !
git diff --stat - Recent commits: !
git log --oneline -5
Implementation Logic
1. Validate Current Branch
- Get current branch:
git branch --show-current - REQUIRE: Branch must start with
feature/ - BLOCK:
staging,develop,mainbranches - If validation fails: Show clear error and exit
2. Analyze Changes and Generate Commit Message
- Run
git status --shortto see modified files - Run
git diff --statto see change statistics - Run
git diffto analyze actual code changes - Automatically determine:
- Type: Based on file changes (feat, fix, refactor, docs, test, chore, etc.)
- Scope: From file paths (bronze, silver, gold, utilities, pipeline, etc.)
- Description: Concise summary of what changed (e.g., "add person address table", "fix deduplication logic")
- Work Items: Extract from branch name pattern (e.g., feature/46225-description → #46225)
- Analysis Rules:
- New files in gold/silver/bronze →
feat - Modified transformation logic →
refactororfix - Test files →
test - Documentation →
docs - Utilities/session_optimiser →
refactororfeat - Multiple file types → prioritize feat > fix > refactor
- Gold layer → scope:
(gold) - Silver layer → scope:
(silver)or(silver_<database>) - Bronze layer → scope:
(bronze)
- New files in gold/silver/bronze →
- Generate commit message in format:
emoji type(scope): description #workitem
3. Execute Commit Workflow
- Stage all changes:
git add . - Create commit with auto-generated emoji conventional format
- Run pre-commit hooks (ruff lint/format, YAML validation, etc.)
- Push to current feature branch
4. Create Pull Request
- Use
mcp__ado__repo_create_pull_requestwith:repositoryId: e030ea00-2f85-4b19-88c3-05a864d7298dsourceRefName: Current feature branch (refs/heads/feature/*)targetRefName: refs/heads/stagingtitle: Extract from auto-generated commit messagedescription: Brief summary with bullet points based on analyzed changes
- Return PR URL to user
5. Add Work Item Comments (Automatic)
If PR creation was successful:
- Get work items linked to PR using
mcp__ado__repo_get_pull_request_by_id - For each linked work item:
- Verify work item exists with
mcp__ado__wit_get_work_item - Generate comment with:
- PR title and number
- Commit message and SHA
- File changes summary from
git diff --stat - Link to PR in Azure DevOps
- Link to commit in Azure DevOps
- Add comment using
mcp__ado__wit_add_work_item_comment - Use HTML format for rich formatting
- Verify work item exists with
- IMPORTANT: Do NOT include footer attribution text
- IMPORTANT: always use australian english in all messages and descriptions
- IMPORTANT: do not mention that you are using australian english in all messages and descriptions
Commit Message Format
Type + Emoji Mapping
- ✨
feat: New feature - 🐛
fix: Bug fix - 📝
docs: Documentation - 💄
style: Formatting/style - ♻️
refactor: Code refactoring - ⚡️
perf: Performance improvements - ✅
test: Tests - 🔧
chore: Tooling, configuration - 🚀
ci: CI/CD improvements - 🗃️
db: Database changes - 🔥
fix: Remove code/files - 📦️
chore: Dependencies - 🚸
feat: UX improvements - 🦺
feat: Validation
Example Format
✨ feat(gold): add X_MG_Offender linkage table #45497
Auto-Generation Logic
File Path Analysis:
python_files/gold/*.py→ scope:(gold)python_files/silver/s_fvms_*.py→ scope:(silver_fvms)or(silver)python_files/silver/s_cms_*.py→ scope:(silver_cms)or(silver)python_files/bronze/*.py→ scope:(bronze)python_files/utilities/*.py→ scope:(utilities)python_files/pipeline_operations/*.py→ scope:(pipeline)python_files/testing/*.py→ scope:(test).claude/**,*.md→ scope:(docs)
Change Type Detection:
- New files (
Ain git status) →feat✨ - Modified transformation/ETL files →
refactor♻️ - Bug fixes (keywords: fix, bug, error, issue) →
fix🐛 - Test files →
test✅ - Documentation files →
docs📝 - Configuration files →
chore🔧
Description Generation:
- Extract meaningful operation from file names and diffs
- New table: "add <table_name> table"
- Modified logic: "improve/update "
- Bug fix: "fix <issue_description>"
- Refactor: "refactor for "
Work Item Extraction:
- Branch name pattern:
feature/<number>-description→#<number> - Multiple numbers: Extract first occurrence
- No number in branch: No work item reference added
What This Command Does
- Validates you're on a feature branch (feature/*)
- Analyzes git changes to determine type, scope, and description
- Extracts work item numbers from branch name
- Auto-generates commit message with conventional emoji format
- Stages all modified files
- Creates commit with auto-generated message
- Runs pre-commit hooks (auto-fixes code quality issues)
- Pushes to current feature branch
- Creates PR from feature branch → staging
- Automatically adds comments to linked work items with PR details
Pre-Commit Hooks
Your project uses pre-commit with:
- Ruff: Linting with auto-fix + formatting
- Standard hooks: Trailing whitespace, YAML/JSON validation
- Security: Private key detection
Pre-commit hooks will auto-fix issues and may modify files. The commit process will:
- Run hooks
- Auto-stage modified files
- Complete commit with fixes applied
Example Usage
Automatic Feature PR
/pr-feature-to-staging
On branch: feature/46225-add-person-address-table
Changed files: python_files/gold/g_occ_person_address.py (new file)
Auto-generated commit: ✨ feat(gold): add person address table #46225
This will:
- Analyze changes (new gold layer file)
- Extract work item #46225 from branch name
- Auto-generate commit message
- Commit and push to feature branch
- Create PR:
feature/46225-add-person-address-table → staging - Link work item #46225
- Add automatic comment to work item #46225 with PR details
Multiple File Changes
On branch: feature/46789-refactor-deduplication
Changed files:
python_files/silver/s_fvms_incident.py(modified)python_files/silver/s_cms_offence_report.py(modified)python_files/utilities/session_optimiser.py(modified)
Auto-generated commit: ♻️ refactor(silver): improve deduplication logic #46789
Fix Bug
On branch: feature/47123-fix-timestamp-parsing
Changed files: python_files/utilities/session_optimiser.py (modified, TableUtilities.clean_date_time_columns)
Auto-generated commit: 🐛 fix(utilities): correct timestamp parsing for null values #47123
Error Handling
Not on Feature Branch
# Error: On staging branch
/pr-feature-to-staging
Result: ERROR - Must be on feature/* branch. Current: staging
Invalid Branch
# Error: On develop or main branch
/pr-feature-to-staging
Result: ERROR - Cannot create feature PR from develop/main branch
No Changes to Commit
# Error: Working directory clean
/pr-feature-to-staging
Result: ERROR - No changes to commit. Working directory is clean.
Best Practices
- Work on feature branches - Always create PRs from
feature/*branches - Include work item in branch name - Use pattern
feature/<work-item>-description(e.g.,feature/46225-add-person-address) - Make focused changes - Keep changes related to a single feature/fix for accurate commit message generation
- Let pre-commit work - Hooks maintain code quality automatically
- Review changes - Check
git statusbefore running command to ensure only intended files are modified - Trust the automation - The command analyzes your changes and generates appropriate conventional commit messages