[IMP] conf: simplify Claude commit template
The previous template used a piped shell command to detect the active model, which caused permission errors in sandboxed environments. Replace with a simple Python script approach and add disable-model-invocation for reliability. Generated by Claude Code 2.1.72 model claude-opus-4-6 Co-Authored-By: Mathieu Benoit <mathben@technolibre.ca>
This commit is contained in:
parent
98d2ea890c
commit
c3684ee320
1 changed files with 50 additions and 58 deletions
|
|
@ -1,58 +1,60 @@
|
||||||
---
|
---
|
||||||
description: "OCA/Odoo conventional commit in English with dynamic Claude Code attribution"
|
name: commit
|
||||||
|
description: "OCA/Odoo conventional commit in English with dynamic Claude Code attribution."
|
||||||
|
disable-model-invocation: true
|
||||||
allowed-tools:
|
allowed-tools:
|
||||||
- "Bash(git add:*)"
|
- Bash(git add:*)
|
||||||
- "Bash(git status:*)"
|
- Bash(git status:*)
|
||||||
- "Bash(git commit:*)"
|
- Bash(git commit:*)
|
||||||
- "Bash(git diff:*)"
|
- Bash(git diff:*)
|
||||||
- "Bash(git log:*)"
|
- Bash(git log:*)
|
||||||
- "Bash(claude --version)"
|
- Bash(claude --version)
|
||||||
- "Bash(cat ~/.claude/settings.json)"
|
- Bash(cat:*)
|
||||||
|
- Bash(python3:*)
|
||||||
---
|
---
|
||||||
|
|
||||||
## Context
|
## Context
|
||||||
|
|
||||||
- Current git status: !`git status`
|
- Git status: !`git status`
|
||||||
- Staged & unstaged diff: !`git diff HEAD`
|
- Full diff: !`git diff HEAD`
|
||||||
- Current branch: !`git branch --show-current`
|
- Current branch: !`git branch --show-current`
|
||||||
- Recent commits (for style reference): !`git log --oneline -5`
|
- Last 5 commits (for style reference): !`git log --oneline -5`
|
||||||
- Claude Code version: !`claude --version 2>/dev/null | head -1`
|
- 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
|
## Task
|
||||||
|
|
||||||
Analyze the changes and create an OCA/Odoo-compliant git commit.
|
Before committing, retrieve the active model with:
|
||||||
|
```bash
|
||||||
|
python3 -c "
|
||||||
|
import json, os
|
||||||
|
path = os.path.expanduser('~/.claude/settings.json')
|
||||||
|
try:
|
||||||
|
d = json.load(open(path))
|
||||||
|
print(d.get('model', 'claude-sonnet-4-6'))
|
||||||
|
except:
|
||||||
|
print('claude-sonnet-4-6')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
### Step 1 – Determine the TAG
|
Then create an OCA/Odoo-compliant commit.
|
||||||
|
|
||||||
Choose ONE tag based on the nature of the change:
|
### OCA Tags
|
||||||
|
|
||||||
| Tag | Use when |
|
| Tag | Usage |
|
||||||
|-----|----------|
|
|-----|-------|
|
||||||
| `[IMP]` | Improvement, new feature, enhancement |
|
| `[IMP]` | Improvement / new feature |
|
||||||
| `[FIX]` | Bug fix |
|
| `[FIX]` | Bug fix |
|
||||||
| `[REF]` | Refactoring (no behavior change) |
|
| `[REF]` | Refactoring |
|
||||||
| `[ADD]` | Adding a new module or major component |
|
| `[ADD]` | New module |
|
||||||
| `[REM]` | Removing code or a module |
|
| `[REM]` | Remove code/module |
|
||||||
| `[MOV]` | Moving/renaming files or modules |
|
| `[MOV]` | Move/rename |
|
||||||
| `[I18N]` | Translation updates |
|
| `[I18N]` | Translations |
|
||||||
| `[MRG]` | Merge commit |
|
|
||||||
|
|
||||||
### Step 2 – Identify the module name
|
### Format
|
||||||
|
|
||||||
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
|
[TAG] module_name: short description in imperative mood
|
||||||
|
|
||||||
WHY this change was made (focus on the reason, not what was done).
|
Explain WHY the change was made (not what — the diff already shows that).
|
||||||
The diff already shows what changed.
|
|
||||||
|
|
||||||
If there were technical choices involved, explain them here.
|
|
||||||
Keep lines under 80 characters.
|
Keep lines under 80 characters.
|
||||||
|
|
||||||
Generated by Claude Code {VERSION} model {MODEL}
|
Generated by Claude Code {VERSION} model {MODEL}
|
||||||
|
|
@ -60,29 +62,19 @@ Generated by Claude Code {VERSION} model {MODEL}
|
||||||
Co-Authored-By: Your Name <your@email.com>
|
Co-Authored-By: Your Name <your@email.com>
|
||||||
```
|
```
|
||||||
|
|
||||||
Rules:
|
### 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
|
- **English only**, imperative mood, subject line under 50 chars
|
||||||
|
- Use the Odoo technical module name (e.g. `sale_order`, `account`, `stock`)
|
||||||
|
- If multiple modules are impacted, suggest splitting into separate commits
|
||||||
|
|
||||||
Stage all relevant changes, then run:
|
### Execute
|
||||||
```bash
|
```bash
|
||||||
git commit \
|
git add -A && git commit --author="Your Name <your@email.com>" -m "[TAG] module: description
|
||||||
--author="Your Name " \
|
|
||||||
-m "$(cat <
|
Explain WHY here.
|
||||||
COMMITMSG
|
|
||||||
)"
|
Generated by Claude Code {VERSION} model {MODEL}
|
||||||
|
|
||||||
|
Co-Authored-By: Your Name <your@email.com>"
|
||||||
```
|
```
|
||||||
|
|
||||||
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
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue