speckit-git-commit
Auto-commit changes after a Spec Kit command completes
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- speckit-git-commit
- metadata
- { "author": "github-spec-kit", "source": "git:commands/speckit.git.commit.md" }
- description
- Auto-commit changes after a Spec Kit command completes
- compatibility
- Requires spec-kit project structure with .specify/ directory
03 SKILL.md 正文
Auto-Commit Changes
Automatically stage and commit all changes after a Spec Kit command completes.
Behavior
This command is invoked as a hook after (or before) core commands. It:
- Determines the event name from the hook context (e.g., if invoked as an
after_specifyhook, the event isafter_specify; ifbefore_plan, the event isbefore_plan) - Checks
.specify/extensions/git/git-config.ymlfor theauto_commitsection - Looks up the specific event key to see if auto-commit is enabled
- Falls back to
auto_commit.defaultif no event-specific key exists - Determines the commit message based on
commit_style(see below) - If enabled and there are uncommitted changes, runs
git add .+git commit
Commit Message Styles
Controlled by the commit_style key in .specify/extensions/git/git-config.yml:
fixed(default): use the per-commandmessageif 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 specificationordocs: 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 configuredmessagevalues are ignored in this mode.
Execution
Determine the event name from the hook that triggered this command, then run the script:
- Bash:
.specify/extensions/git/scripts/bash/auto-commit.sh <event_name> [--message-file <path>] - PowerShell:
.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:
- If
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 shellecho/printf), then pass that file's path via--message-file <path>(Bash) or-MessageFile <path>(PowerShell). - If
fixedor absent: run the script with just<event_name>; it uses the configured/static message.
Configuration
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"
Graceful Degradation
- If Git is not available or the current directory is not a repository: skips with a warning
- If no config file exists: skips (disabled by default)
- If no changes to commit: skips with a message
- If
commit_style: conventionalis set and no generated message was supplied: fails with a clear error instead of silently falling back to the fixed message format
04 同仓库更多 Skills
speckit-tdd-verify
Audit TDD discipline by delegating to zfa tdd verify (mutation testing, evidence integrity); the LLM interprets the verdict and drives remediation
speckit-tdd-setup
Detect the test stack and write .specify/memory/tdd-profile.md; zuraffa-wired projects record zfa commands as the engine
speckit-tdd-run
Drive the red-green-refactor loop by delegating to zfa tdd run (deterministic engine); the LLM handles only honest stops — fixing genuine reds and remediation — never re-driving what zfa drives
speckit-tdd-plan
Derive the feature's test list by delegating to zfa tdd plan (deterministic engine); falls back to LLM-guided derivation only when zfa is unavailable
speckit-spec-stats-runs
On-demand execution — reads verified suite command from .specify/memory/tdd-profile.md, runs it for selected specs (--all, spec id/slug, or default active feature), captures pass/fail + duration + tail, appends run record to .specify/stats/runs.json, refreshes dashboard health column
speckit-spec-stats-report
Main generator — scans all specs/*/, derives per-feature stage, task progress, health, last updated; when the TDD extension is installed, adds a deep TDD table (acceptance/unit/characterization counts, DONE, loop mode, tasks.md state); renders dashboard to configurable output path and writes .specify/stats/stats.json snapshot