erplibre/conf/template_claude_commands_commit.md

89 lines
2.7 KiB
Markdown
Raw Normal View History

---
description: "OCA/Odoo conventional commit in English with dynamic Claude Code attribution"
allowed-tools:
- "Bash(git add:*)"
- "Bash(git status:*)"
- "Bash(git commit:*)"
- "Bash(git diff:*)"
- "Bash(git log:*)"
- "Bash(claude --version)"
- "Bash(cat ~/.claude/settings.json)"
---
## Context
- Current git status: !`git status`
- Staged & unstaged diff: !`git diff HEAD`
- Current branch: !`git branch --show-current`
- Recent commits (for style reference): !`git log --oneline -5`
- Claude Code version: !`claude --version 2>/dev/null | head -1`
- Active model: !`cat ~/.claude/settings.json 2>/dev/null | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('model', d.get('env', {}).get('ANTHROPIC_MODEL', 'claude-sonnet-4-6')))" 2>/dev/null || echo "claude-sonnet-4-6"`
## Task
Analyze the changes and create an OCA/Odoo-compliant git commit.
### Step 1 Determine the TAG
Choose ONE tag based on the nature of the change:
| Tag | Use when |
|-----|----------|
| `[IMP]` | Improvement, new feature, enhancement |
| `[FIX]` | Bug fix |
| `[REF]` | Refactoring (no behavior change) |
| `[ADD]` | Adding a new module or major component |
| `[REM]` | Removing code or a module |
| `[MOV]` | Moving/renaming files or modules |
| `[I18N]` | Translation updates |
| `[MRG]` | Merge commit |
### Step 2 Identify the module name
Use the Odoo technical module name (e.g., `sale_order`, `account`, `stock_picking`).
If the change spans multiple modules, pick the primary one or use the repo name.
### Step 3 Build the commit message
Format:
```
[TAG] module_name: short description in imperative mood
WHY this change was made (focus on the reason, not what was done).
The diff already shows what changed.
If there were technical choices involved, explain them here.
Keep lines under 80 characters.
Generated by Claude Code {VERSION} model {MODEL}
Co-Authored-By: Your Name <your@email.com>
```
Rules:
- **English only** — no French, no other language
- Subject line (first line): under 50 characters, imperative mood
- Body: explain the *WHY*, not the *what*
- One module per commit when possible
### Step 4 Execute
Stage all relevant changes, then run:
```bash
git commit \
--author="Your Name " \
-m "$(cat <
COMMITMSG
)"
```
Replace `{VERSION}` and `{MODEL}` with the actual values retrieved in the Context section above.
## Constraints
- NEVER write the commit message in French
- ALWAYS use the `[TAG]` prefix — never use `feat:`, `fix:` or other conventional commit formats
- ALWAYS include the `Generated by Claude Code ...` line with real version and model values
- ALWAYS use `--author` with the specified identity
- If changes span multiple modules, suggest splitting into separate commits