Git Smart Commit
Use This Workflow
- Inspect change state with
git status --porcelain=v1. - Prefer staged changes for commit generation.
- If no staged changes exist, decide whether to stage all with
git add -A. - Generate a Conventional Commits header:
type(scope): subject. - Keep subject concise, imperative, and without trailing punctuation.
- Never include AI signatures or attribution text.
- Apply commit only after message looks correct.
Commit Rules
- Allowed types:
feat,fix,docs,style,refactor,perf,test,build,ci,chore,revert. - Header format:
type(scope): subjectortype: subject. - Scope is optional and should be short (module or directory name).
- Subject should be lower case when possible and stay within 72 characters.
- Do not add prefixes like
AI,Co-Authored-By, or model names unless user explicitly requests.
Script
Run the helper script in scripts/generate-commit.cjs.
node .codex/skills/git-smart-commit/scripts/generate-commit.cjs
Useful options:
--apply: rungit commitwith the generated message.--stage-all: rungit add -Aif no staged changes are found.--type <type>: force a specific commit type.--scope <scope>: force scope.--subject "<text>": force subject.--body "<text>": add commit body paragraph.--print-json: print machine-readable result.--no-icon: disable icon in console preview output.
Examples
# Preview message from current staged changes
node .codex/skills/git-smart-commit/scripts/generate-commit.cjs
# Stage all pending changes, generate, and commit
node .codex/skills/git-smart-commit/scripts/generate-commit.cjs --stage-all --apply
# Force type and scope while still auto-generating the subject
node .codex/skills/git-smart-commit/scripts/generate-commit.cjs --type docs --scope readme