Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion extensions/catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"git": {
"name": "Git Branching Workflow",
"id": "git",
"version": "1.0.1",
"version": "1.0.2",
"description": "Feature branch creation, numbering (sequential/timestamp), validation, and Git remote detection",
"author": "spec-kit-core",
"repository": "https://github.com/github/spec-kit",
Expand Down
12 changes: 12 additions & 0 deletions extensions/git/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,18 @@ auto_commit:
message: "[Spec Kit] Add specification"
```

`auto_commit.default` applies only to events without an event section. The
installed config template lists each event with `enabled: false`, so changing
only `default` to `true` does not enable those events. Set `enabled: true` for
each listed event you want to enable, as shown for `after_specify` above. To use
the default for an event, remove its entire section; removing only `enabled`
while leaving `message` does not enable the fallback.

With `commit_style: fixed`, removing the section also removes its custom
message. A fallback commit uses `[Spec Kit] Auto-commit after specify` for
`after_specify` (and the corresponding phase and command for other events).
Keep the section and set `enabled: true` to retain its custom message.

`{author}` is derived from Git config and sanitized for branch names. `{app}` is derived from the Spec Kit init directory name. Custom templates must not put `{slug}` before `{number}`, and must put `{number}-` at the start of the final path segment so generated names remain valid feature branches. For a monorepo project at `apps/web/.specify/`, a template such as `{author}/{app}/{number}-{slug}` produces branches like `jdoe/web/008-guided-tour`.

For simple namespace-only customization, `branch_prefix` is also accepted as a shorthand and expands to `<branch_prefix>/{number}-{slug}`.
Expand Down
15 changes: 12 additions & 3 deletions extensions/git/commands/speckit.git.commit.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This command is invoked as a hook after (or before) core commands. It:
1. Determines the event name from the hook context (e.g., if invoked as an `after_specify` hook, the event is `after_specify`; if `before_plan`, the event is `before_plan`)
2. Checks `.specify/extensions/git/git-config.yml` for the `auto_commit` section
3. Looks up the specific event key to see if auto-commit is enabled
4. Falls back to `auto_commit.default` if no event-specific key exists
4. Falls back to `auto_commit.default` if no section exists for the event
5. Determines the commit message based on `commit_style` (see below)
6. If enabled and there are uncommitted changes, runs `git add .` + `git commit`

Expand Down Expand Up @@ -46,15 +46,24 @@ In `.specify/extensions/git/git-config.yml`:
commit_style: fixed

auto_commit:
default: false # Global toggle — set true to enable for all commands
# Fallback for events without a section
default: false
after_specify:
enabled: true # Override per-command
# Override per-command
enabled: true
message: "[Spec Kit] Add specification"
after_plan:
enabled: false
message: "[Spec Kit] Add implementation plan"
```

Listed events need `enabled: true` to opt in, even when `default` is `true`.
Remove an event's entire section to use the default; leaving its `message`
entry still prevents fallback.
With `commit_style: fixed`, removing the section also drops its custom message:
`after_specify` then uses `[Spec Kit] Auto-commit after specify`. Keep the
section with `enabled: true` to retain its configured message.

## Graceful Degradation

- If Git is not available or the current directory is not a repository: skips with a warning
Expand Down
7 changes: 5 additions & 2 deletions extensions/git/config-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ init_commit_message: "[Spec Kit] Initial commit"
commit_style: fixed

# Auto-commit before/after core commands.
# Set "default" to enable for all commands, then override per-command.
# Each key can be true/false. Message is customizable per-command.
# "default" applies only to events that have no section below.
# Listed events must use "enabled: true" to opt in, even if default is true.
Comment on lines +28 to +29
# Messages are customizable per event.
# In fixed mode, removing an event section also removes its custom message;
# keep the section with "enabled: true" to retain that message.
auto_commit:
default: false
before_clarify:
Expand Down
2 changes: 1 addition & 1 deletion extensions/git/extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ schema_version: "1.0"
extension:
id: git
name: "Git Branching Workflow"
version: "1.0.1"
version: "1.0.2"
description: "Feature branch creation, numbering (sequential/timestamp), templating, validation, and Git remote detection"
author: spec-kit-core
repository: https://github.com/github/spec-kit
Expand Down
7 changes: 5 additions & 2 deletions extensions/git/git-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ init_commit_message: "[Spec Kit] Initial commit"
commit_style: fixed

# Auto-commit before/after core commands.
# Set "default" to enable for all commands, then override per-command.
# Each key can be true/false. Message is customizable per-command.
# "default" applies only to events that have no section below.
# Listed events must use "enabled: true" to opt in, even if default is true.
# Messages are customizable per event.
# In fixed mode, removing an event section also removes its custom message;
# keep the section with "enabled: true" to retain that message.
auto_commit:
default: false
before_clarify:
Expand Down
2 changes: 1 addition & 1 deletion tests/extensions/git/test_git_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def test_manifest_validates(self):

m = ExtensionManifest(EXT_DIR / "extension.yml")
assert m.id == "git"
assert m.version == "1.0.1"
assert m.version == "1.0.2"

def test_manifest_commands(self):
"""Manifest declares expected commands."""
Expand Down
Loading