| name | commit-message |
| description | Generate Git commit messages in Semantic Commit format. Use when asked to write commit messages, format Semantic Commits, or summarize changes/diffs into a commit. |
Commit Message
Setup
- Load commands with
source $CLI_TOOLS/tools.sh
Use staged context only
Rules:
- Prefer staged changes as input via
git-commit-context --stdout - Never run
git addon your own; do not stage files the user has not explicitly staged - If
git-commit-contextis not available, collect fallback inputs:git diff --staged --no-colorfor the diffgit-scope staged --no-colorfor the scope tree (fallback:git diff --staged --name-only)- For each staged file, include its staged version via
git show :<path> - If a file is deleted and has no index version, note it as deleted
- Do not infer from unstaged changes or untracked files
- If staged diff is empty, ask for staged changes or a change summary
Follow Semantic Commit format
Use the exact header format:
type(scope): subject
Rules:
- Use a valid type (feat, fix, refactor, chore, etc.)
- Use a concise scope that matches the changed area
- Keep the subject lowercase and concise
- Keep the full header under 100 characters
Write the body correctly
Rules:
- Insert one blank line between header and body
- Start every body line with "- " and a capitalized word
- Keep each line under 100 characters
- Keep bullets concise and group related changes
- Do not insert blank lines between body items
- For small or trivial changes, the body is optional; if included, use a single bullet and avoid restating the subject
Commit execution
- Generate the full commit message from staged context
- Write the message to a temporary file to preserve formatting
- Run
git commit -F <temp-file>and remove the temp file afterward - Capture the exit status in
rcorexit_code(do not usestatus) - If the commit fails, report the error and do not claim success
Input completeness
- Full-file reads are not required for commit message generation
- Base the message on staged diff, scope tree, and staged (index) version content
- Only read full files if the diff/context is insufficient to describe the change accurately
Example
refactor(members): simplify otp purpose validation logic in requestOtp
- Merged duplicated member existence checks into a single query
- Reordered conditional logic for better readability
Output and clarification rules
- If type, scope, or change summary is missing, ask a concise clarifying question and do not commit
- After a successful commit, run
git-scope commit HEAD --no-color - The response must include the
git-scopeoutput in a code block