Arguments: `/git-actions:commit [MODE] [CUSTOM_INSTRUCTIONS]`
Generate a Git commit message from staged changes using an AI agent. Use this when you want intelligent commit messages that analyze your changes and match repository conventions. Supports staging all files or committing only already-staged changes.
/plugin marketplace add olioapps/claude-code-plugins/plugin install git-actions@olio-pluginsArguments: /git-actions:commit [MODE] [CUSTOM_INSTRUCTIONS]
Current: !git status --short
Check repo state:
git rev-parse --git-dir 2>/dev/null || echo "NOT_A_REPO"
git status --short
git diff --cached --quiet && echo "NO_STAGED" || echo "HAS_STAGED"
git diff --quiet && echo "NO_UNSTAGED" || echo "HAS_UNSTAGED"
Abort if:
Determine mode from first argument, extract any additional context from remaining args.
Execute mode:
all mode: Use AskUserQuestion to confirm "Stage all changes with git add -A?"
git add -Astaged mode: Verify staged files exist with git diff --cached --quiet
(empty) auto-detect:
git diff --cached --name-status
git diff --cached --stat
git diff --cached --unified=3 | head -n 300 # truncate if needed
File summary:
Use commit-writer agent.
Context:
- mode: [staged/all]
- files: [summary]
- stats: [+X -Y lines]
- diff: [truncated preview]
[IF USER PROVIDED CUSTOM INSTRUCTIONS:]
USER INSTRUCTIONS (HIGHEST PRIORITY):
"""
[custom instructions verbatim]
"""
Agent returns structured output:
---SUBJECT---
[subject]
---BODY---
[body or empty]
---FOOTER---
[footer or empty]
---END---
Agent responsibilities: analyze changes, match repo style, generate message, warn if non-atomic
Parse response into SUBJECT, BODY, FOOTER. Validate:
If validation fails → Report parse error, ask agent to retry with clearer format (max 2 retries)
## Proposed Commit
**Subject:** [subject]
[**Body:** [body] if exists]
[**Footer:** [footer] if exists]
**Files:** [summary] ([stats])
[⚠️ **Non-atomic warning** if flagged by agent]
Use AskUserQuestion: "How to proceed with this commit?"
Options:
On approval:
# Construct message using HEREDOC for proper formatting
git commit -m "$(cat <<'EOF'
[SUBJECT]
[BODY if exists]
[FOOTER if exists]
EOF
)"
Check commit result and handle hooks:
If commit succeeds:
# Check if pre-commit hook modified files
git status --short
git log -1 --format="%H %s"
If pre-commit hook fails:
If commit fails (other reasons):
On cancel: ❌ "Cancelled. Files remain staged." (if mode was 'all', files are still staged)
YOU (handler): check repo, parse args, stage files (with approval), gather context, invoke agent, present message, get user approval, execute commit, handle errors
Agent: analyze changes, generate message matching repo style, return structured output
Agent does NOT orchestrate or execute. You do NOT format messages.
git add -A fails → Show git error, suggest checking .gitignore or file permissionsgit add -A/git-actions:commit all # Stage all changes, generate message, commit
/git-actions:commit staged # Commit only staged files
/git-actions:commit # Auto-detect: staged if any, else prompt for all
Custom instructions have highest priority and override all agent defaults:
/git-actions:commit all use conventional commits format
# Agent will use feat:/fix:/etc. format even if repo doesn't normally
/git-actions:commit staged keep subject under 40 chars, no body
# Forces short subject, omits body even for complex changes
/git-actions:commit all emphasize security fixes in message
# Agent will highlight security aspects in commit message
/git-actions:commit staged include performance metrics in body
# Agent will add performance details to commit body
/git-actions:commit all be concise, one-line only
# Forces single-line commit (no body/footer)
# Partial staging workflow (commit specific files only)
git add src/auth/*.ts # Stage specific files manually
/git-actions:commit staged # Commit just those files
# Result: atomic commit for auth changes only
# Quick fixes
/git-actions:commit all quick typo fix
# Custom context helps agent write appropriate message
# Working with pre-commit hooks
/git-actions:commit all # If hook fails, you'll be prompted
# Options: fix code and retry, skip hooks, or cancel
# Multiple small commits from staging
git add file1.ts
/git-actions:commit staged # First atomic commit
git add file2.ts file3.ts
/git-actions:commit staged # Second atomic commit
# Empty mode with mixed changes
/git-actions:commit # Detects: staged exist → commits staged only
/git-actions:commit # Detects: no staged → prompts "Stage all?"
# Very large changesets
/git-actions:commit all # Agent may warn: "Consider splitting commits"
# You can still proceed or split manually
# Custom formatting requirements
/git-actions:commit staged use emoji, fun tone
# Overrides professional tone, adds emoji to message