Error in user YAML: (<unknown>): did not find expected key while parsing a block mapping at line 1 column 1
---
description: Git commit helper (no-args = commit ALL changes automatically)
argument-hint: [MSG="<message>"] [FILES="<paths>"] [TYPE=<feat|fix|docs|refactor|test|chore>] [SCOPE="<scope>"] [RUN="<cmd>"] [NO_VERIFY=true]
---
You are running in a local repo. Create exactly ONE high-quality Git commit.
CRITICAL BEHAVIOR CHANGE (commit-all mode):
- If the user invokes this command with NO arguments (i.e., $ARGUMENTS is empty AND all named inputs below are empty),
then you MUST automatically stage and commit ALL current changes (including new/untracked files) without asking.
Concretely: run
git add -A, generate an appropriate commit message, then commit.
Safety rules (always):
- Do NOT discard, reset, clean, stash, rebase, amend, or rewrite history.
- Do NOT push. Only create a local commit.
- If checks fail (whitespace check or $RUN), STOP and report; do not commit.
Inputs (may be empty):
- $ARGUMENTS: all space-separated arguments after the command.
- $FILES: space-separated paths to stage (quoted by the user when needed).
- $MSG: commit message to use (may be empty).
- $TYPE and $SCOPE: used to build a Conventional Commit subject if $MSG is empty.
- $RUN: optional command to run before committing (tests/lint), e.g. RUN="npm test" or RUN="pnpm lint".
- $NO_VERIFY: if "true", pass --no-verify to git commit.
Procedure:
-
Confirm this is a Git repo and capture status.
- Run: git rev-parse --show-toplevel
- Run: git status -sb
- Run: git status --porcelain=v1 If there are no changes (clean tree), stop and say: "Nothing to commit."
-
Decide staging mode.
2.1) Commit-all mode (NO ARGS):
- Condition: $ARGUMENTS is empty AND $FILES/$MSG/$TYPE/$SCOPE/$RUN/$NO_VERIFY are all empty.
- Action:
- Stage everything:
- Run: git add -A
- Stage everything:
2.2) Selective mode (ARGS PRESENT):
- Check currently staged changes:
- Run: git diff --cached --name-status
- If $FILES is provided (non-empty):
- Stage ONLY those files:
- Run: git add -- $FILES
- Stage ONLY those files:
- Else if there are already staged changes:
- Do NOT stage anything else. Proceed with the staged set.
- Else (no staged changes and no $FILES):
- Ask ONE short question before proceeding: "No files specified and nothing is staged. Stage all changes with 'git add -A' and commit?"
- If user says yes:
- Run: git add -A
- If user says no:
- Tell them to re-run with FILES="..." or stage changes manually, then stop.
-
Show what is staged and ensure it is non-empty.
- Run: git diff --cached --stat
- Run: git diff --cached If staged diff is empty, stop and explain why.
-
Run checks.
- Always run whitespace check on staged diff:
- Run: git diff --cached --check
- If it reports problems, stop and paste the output; do not commit.
- If $RUN is provided and non-empty:
- Run exactly: $RUN
- If it fails, stop and report the failure; do not commit.
- Always run whitespace check on staged diff:
-
Prepare commit message.
- If $MSG is provided and non-empty: use it exactly.
- Else:
- Build a Conventional Commit style subject:
- If $TYPE is empty:
- Infer best type from diff: feat/fix/docs/refactor/test/chore.
- If changes are broad/mixed or look like a snapshot, default to: chore
- If $SCOPE provided: SUBJECT = "$TYPE($SCOPE): " else SUBJECT = "$TYPE: "
- If $TYPE is empty:
- Create a short body (2-6 bullets) summarizing the key changes (what/why).
- Keep SUBJECT <= 72 chars when possible.
- If there are breaking changes, include a "BREAKING CHANGE:" footer.
- Build a Conventional Commit style subject:
- Ensure the message is accurate and grounded in the staged diff.
-
Commit.
- If $NO_VERIFY == "true", include --no-verify.
- If you have a body, use: git commit -m "" -m "" else: git commit -m ""
-
Show final result.
- Run: git show --stat --oneline -1
- Run: git status -sb
Output requirements:
- Print the final commit subject line.
- Print a short summary of which files were included (from git show --stat / staged names).