name: commit description: Generate a commit message and commit staged changes using git commit -s -S. allowed-tools: Bash, AskUserQuestion
Commit the current staged changes.
- Run
git diff --staged. If empty, tell the user there is nothing staged and stop. - Run
git log --oneline -5to understand this repo's commit message style. - Run
git branch --show-currentto get the branch name. If it contains aCM-XXXticket number, include it at the end of the subject in parentheses (e.g.feat: add token refresh (CM-1234)). - Generate a single commit message following Conventional Commits format:
type: description. Subject max 72 characters. No scope required unless meaningful. No body, no extra trailers, no Co-Authored-By. (TheSigned-off-bytrailer is added automatically by-s.)- Valid types:
feat,fix,docs,style,refactor,perf,test,build,ci,chore,revert
- Valid types:
- Run
git commit -s -S -m "<message>"using exactly the generated message. - Output only the commit hash and subject line from the result.