extensions/git/commands/speckit.git.commit.md
Automatically stage and commit all changes after a Spec Kit command completes.
This command is invoked as a hook after (or before) core commands. It:
after_specify hook, the event is after_specify; if before_plan, the event is before_plan).specify/extensions/git/git-config.yml for the auto_commit sectionauto_commit.default if no event-specific key existscommit_style (see below)git add . + git commitControlled by the commit_style key in .specify/extensions/git/git-config.yml:
fixed (default): use the per-command message if configured, otherwise a generic [Spec Kit] Auto-commit <phase> <command> message.conventional: inspect the actual changes (git diff / git status) since the last commit and generate a single-line Conventional Commit message (type(scope): subject, e.g. feat: add OAuth specification or docs: update implementation plan) that accurately summarizes the change. Write this message to a temporary file and pass the file's path to the script (see Execution below). The configured message values are ignored in this mode.Determine the event name from the hook that triggered this command, then run the script:
.specify/extensions/git/scripts/bash/auto-commit.sh <event_name> [--message-file <path>].specify/extensions/git/scripts/powershell/auto-commit.ps1 <event_name> [-MessageFile <path>]Replace <event_name> with the actual hook event (e.g., after_specify, before_plan, after_implement). Only pass a generated message when commit_style: conventional is configured — first check .specify/extensions/git/git-config.yml for the value of commit_style:
conventional: inspect the diff and generate a Conventional Commit message. Do not interpolate the generated message directly into a shell command string — its content is derived from repository changes and may contain characters (quotes, $(...), backticks) that a shell would execute or that would break command quoting. Instead, write the message to a temporary file using your file-editing tool (not a shell echo/printf), then pass that file's path via --message-file <path> (Bash) or -MessageFile <path> (PowerShell).fixed or absent: run the script with just <event_name>; it uses the configured/static message.In .specify/extensions/git/git-config.yml:
# "fixed" (default) uses the messages below; "conventional" asks the agent
# to generate a Conventional Commit message from the diff instead.
commit_style: fixed
auto_commit:
default: false # Global toggle — set true to enable for all commands
after_specify:
enabled: true # Override per-command
message: "[Spec Kit] Add specification"
after_plan:
enabled: false
message: "[Spec Kit] Add implementation plan"
commit_style: conventional is set and no generated message was supplied: fails with a clear error instead of silently falling back to the fixed message format