name: commit
about: AI-generated commit message
args:
- name: path
short: 'p'
input: string
default: .
help: 'Path to git repository (default: current directory)'
- name: dry_run
short: 'd'
input: bool
default: 'false'
help: 'Print commit message without committing'
actions:
- tag: tag_changed_files
run: cmd
expect: list
check: .+
action: cd {path|resolve} && git diff HEAD -U0 --name-only --relative
- tag: tag_file_diff
run: cmd
expect: list
action: |
cd {path}
if [ -f "{tag_changed_files}" ]; then
git diff HEAD -- "{tag_changed_files}"
fi
- tag: tag_file_summary
run: small
expect: list
action: |
[Task]
1. Read the git diff below.
2. Find the file path in the header (lines starting with --- and +++).
3. Count the number of changed blocks (@@ sections).
4. Write a single phrase describing the most important changes.
5. Reply in format: <path> (<N> changes): <phrase>
6. Ignore trivial changes like imports or formatting.
[Example]
src/main.rs (3 changes): fix CLI argument parsing
[Diff]
{tag_file_diff}
- tag: tag_commit_message
run: medium
expect: string
action: |
[Task]
Summarize all summaries below into ONE short conventional commit message (max 10 words).
Allowed types: feat, fix, docs, refactor, test, chore.
Format strictly: <type>: <commit> (NO parentheses or scopes).
[Summaries]
{tag_file_summary|uniq|join}
- tag: tag_commit_exec
run: cmd
expect: string
confirm: true
when: '{dry_run|contains:false}'
action: cd {path} && git add . && git commit -m '{tag_commit_message|lower}'
- tag: tag_commit
run: value
expect: string
action:
- when: '{dry_run|contains:true}'
then: '{tag_commit_message|lower|clipboard}'
- when: '{dry_run|contains:false}'
then: '{tag_commit_exec}'