Skip to content

Commit 02a1d61

Browse files
authored
docs: add workflows reference, reorganize into docs/reference/, and add --version flag (#2244)
* docs: add workflows reference, reorganize into docs/reference/, and add --version flag - Move integrations.md, extensions.md, presets.md into docs/reference/ - New docs/reference/workflows.md: command reference for all workflow commands, built-in SDD Cycle workflow with Mermaid diagram, step types, expressions, input types, state/resume, and FAQ - Rename workflow input feature_name to spec with prompt 'Describe what you want to build' to match speckit.specify command terminology - Add --version / -V flag to root specify command with tests - Update docs/toc.yml, README.md links, and docs/upgrade.md cross-reference to use reference/ paths - Add workflow command to README CLI reference table * docs: update speckit_version requirement to >=0.7.2 in workflow example
1 parent 8d2797d commit 02a1d61

File tree

14 files changed

+369
-34
lines changed

14 files changed

+369
-34
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ Community projects that extend, visualize, or build on Spec Kit:
316316

317317
## 🤖 Supported AI Coding Agent Integrations
318318

319-
Spec Kit works with 30+ AI coding agents — both CLI tools and IDE-based assistants. See the full list with notes and usage details in the [Supported AI Coding Agent Integrations](https://github.github.io/spec-kit/integrations.html) guide.
319+
Spec Kit works with 30+ AI coding agents — both CLI tools and IDE-based assistants. See the full list with notes and usage details in the [Supported AI Coding Agent Integrations](https://github.github.io/spec-kit/reference/integrations.html) guide.
320320

321321
Run `specify integration list` to see all available integrations in your installed version.
322322

@@ -367,6 +367,7 @@ and supports the following commands:
367367
| `extension` | Manage extensions |
368368
| `preset` | Manage presets |
369369
| `integration` | Manage integrations |
370+
| `workflow` | Run, manage, and search workflows. See the [Workflows reference](https://github.github.io/spec-kit/reference/workflows.html) |
370371

371372
### `specify init` Arguments & Options
372373

@@ -510,7 +511,7 @@ specify extension add <extension-name>
510511

511512
For example, extensions could add Jira integration, post-implementation code review, V-Model test traceability, or project health diagnostics.
512513

513-
See the [Extensions reference](https://github.github.io/spec-kit/extensions.html) for the full command guide. Browse the [community extensions](#-community-extensions) above for what's available.
514+
See the [Extensions reference](https://github.github.io/spec-kit/reference/extensions.html) for the full command guide. Browse the [community extensions](#-community-extensions) above for what's available.
514515

515516
### Presets — Customize Existing Workflows
516517

@@ -526,7 +527,7 @@ specify preset add <preset-name>
526527

527528
For example, presets could restructure spec templates to require regulatory traceability, adapt the workflow to fit the methodology you use (e.g., Agile, Kanban, Waterfall, jobs-to-be-done, or domain-driven design), add mandatory security review gates to plans, enforce test-first task ordering, or localize the entire workflow to a different language. The [pirate-speak demo](https://github.com/mnriem/spec-kit-pirate-speak-preset-demo) shows just how deep the customization can go. Multiple presets can be stacked with priority ordering.
528529

529-
See the [Presets reference](https://github.github.io/spec-kit/presets.html) for the full command guide, including resolution order and priority stacking.
530+
See the [Presets reference](https://github.github.io/spec-kit/reference/presets.html) for the full command guide, including resolution order and priority stacking.
530531

531532
### When to Use Which
532533

File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/reference/workflows.md

Lines changed: 289 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,289 @@
1+
# Workflows
2+
3+
Workflows automate multi-step Spec-Driven Development processes — chaining commands, prompts, shell steps, and human checkpoints into repeatable sequences. They support conditional logic, loops, fan-out/fan-in, and can be paused and resumed from the exact point of interruption.
4+
5+
## Run a Workflow
6+
7+
```bash
8+
specify workflow run <source>
9+
```
10+
11+
| Option | Description |
12+
| ------------------- | -------------------------------------------------------- |
13+
| `-i` / `--input` | Pass input values as `key=value` (repeatable) |
14+
15+
Runs a workflow from a catalog ID, URL, or local file path. Inputs declared by the workflow can be provided via `--input` or will be prompted interactively.
16+
17+
Example:
18+
19+
```bash
20+
specify workflow run speckit -i spec="Build a kanban board with drag-and-drop task management" -i scope=full
21+
```
22+
23+
> **Note:** All workflow commands require a project already initialized with `specify init`.
24+
25+
## Resume a Workflow
26+
27+
```bash
28+
specify workflow resume <run_id>
29+
```
30+
31+
Resumes a paused or failed workflow run from the exact step where it stopped. Useful after responding to a gate step or fixing an issue that caused a failure.
32+
33+
## Workflow Status
34+
35+
```bash
36+
specify workflow status [<run_id>]
37+
```
38+
39+
Shows the status of a specific run, or lists all runs if no ID is given. Run states: `created`, `running`, `completed`, `paused`, `failed`, `aborted`.
40+
41+
## List Installed Workflows
42+
43+
```bash
44+
specify workflow list
45+
```
46+
47+
Lists workflows installed in the current project.
48+
49+
## Install a Workflow
50+
51+
```bash
52+
specify workflow add <source>
53+
```
54+
55+
Installs a workflow from the catalog, a URL (HTTPS required), or a local file path.
56+
57+
## Remove a Workflow
58+
59+
```bash
60+
specify workflow remove <workflow_id>
61+
```
62+
63+
Removes an installed workflow from the project.
64+
65+
## Search Available Workflows
66+
67+
```bash
68+
specify workflow search [query]
69+
```
70+
71+
| Option | Description |
72+
| ------- | --------------- |
73+
| `--tag` | Filter by tag |
74+
75+
Searches all active catalogs for workflows matching the query.
76+
77+
## Workflow Info
78+
79+
```bash
80+
specify workflow info <workflow_id>
81+
```
82+
83+
Shows detailed information about a workflow, including its steps, inputs, and requirements.
84+
85+
## Catalog Management
86+
87+
Workflow catalogs control where `search` and `add` look for workflows. Catalogs are checked in priority order.
88+
89+
### List Catalogs
90+
91+
```bash
92+
specify workflow catalog list
93+
```
94+
95+
Shows all active catalog sources.
96+
97+
### Add a Catalog
98+
99+
```bash
100+
specify workflow catalog add <url>
101+
```
102+
103+
| Option | Description |
104+
| --------------- | -------------------------------- |
105+
| `--name <name>` | Optional name for the catalog |
106+
107+
Adds a custom catalog URL to the project's `.specify/workflow-catalogs.yml`.
108+
109+
### Remove a Catalog
110+
111+
```bash
112+
specify workflow catalog remove <index>
113+
```
114+
115+
Removes a catalog by its index in the catalog list.
116+
117+
### Catalog Resolution Order
118+
119+
Catalogs are resolved in this order (first match wins):
120+
121+
1. **Environment variable**`SPECKIT_WORKFLOW_CATALOG_URL` overrides all catalogs
122+
2. **Project config**`.specify/workflow-catalogs.yml`
123+
3. **User config**`~/.specify/workflow-catalogs.yml`
124+
4. **Built-in defaults** — official catalog + community catalog
125+
126+
## Workflow Definition
127+
128+
Workflows are defined in YAML files. Here is the built-in **Full SDD Cycle** workflow that ships with Spec Kit:
129+
130+
```yaml
131+
schema_version: "1.0"
132+
workflow:
133+
id: "speckit"
134+
name: "Full SDD Cycle"
135+
version: "1.0.0"
136+
author: "GitHub"
137+
description: "Runs specify → plan → tasks → implement with review gates"
138+
139+
requires:
140+
speckit_version: ">=0.7.2"
141+
integrations:
142+
any: ["copilot", "claude", "gemini"]
143+
144+
inputs:
145+
spec:
146+
type: string
147+
required: true
148+
prompt: "Describe what you want to build"
149+
integration:
150+
type: string
151+
default: "copilot"
152+
prompt: "Integration to use (e.g. claude, copilot, gemini)"
153+
scope:
154+
type: string
155+
default: "full"
156+
enum: ["full", "backend-only", "frontend-only"]
157+
158+
steps:
159+
- id: specify
160+
command: speckit.specify
161+
integration: "{{ inputs.integration }}"
162+
input:
163+
args: "{{ inputs.spec }}"
164+
165+
- id: review-spec
166+
type: gate
167+
message: "Review the generated spec before planning."
168+
options: [approve, reject]
169+
on_reject: abort
170+
171+
- id: plan
172+
command: speckit.plan
173+
integration: "{{ inputs.integration }}"
174+
input:
175+
args: "{{ inputs.spec }}"
176+
177+
- id: review-plan
178+
type: gate
179+
message: "Review the plan before generating tasks."
180+
options: [approve, reject]
181+
on_reject: abort
182+
183+
- id: tasks
184+
command: speckit.tasks
185+
integration: "{{ inputs.integration }}"
186+
input:
187+
args: "{{ inputs.spec }}"
188+
189+
- id: implement
190+
command: speckit.implement
191+
integration: "{{ inputs.integration }}"
192+
input:
193+
args: "{{ inputs.spec }}"
194+
```
195+
196+
This produces the following execution flow:
197+
198+
```mermaid
199+
flowchart TB
200+
A["specify<br/>(command)"] --> B{"review-spec<br/>(gate)"}
201+
B -- approve --> C["plan<br/>(command)"]
202+
B -- reject --> X1["⏹ Abort"]
203+
C --> D{"review-plan<br/>(gate)"}
204+
D -- approve --> E["tasks<br/>(command)"]
205+
D -- reject --> X2["⏹ Abort"]
206+
E --> F["implement<br/>(command)"]
207+
208+
style A fill:#49a,color:#fff
209+
style B fill:#a94,color:#fff
210+
style C fill:#49a,color:#fff
211+
style D fill:#a94,color:#fff
212+
style E fill:#49a,color:#fff
213+
style F fill:#49a,color:#fff
214+
style X1 fill:#999,color:#fff
215+
style X2 fill:#999,color:#fff
216+
```
217+
218+
Run it with:
219+
220+
```bash
221+
specify workflow run speckit -i spec="Build a kanban board with drag-and-drop task management"
222+
```
223+
224+
## Step Types
225+
226+
| Type | Purpose |
227+
| ------------ | ------------------------------------------------ |
228+
| `command` | Invoke a Spec Kit command (e.g., `speckit.plan`) |
229+
| `prompt` | Send an arbitrary prompt to the AI coding agent |
230+
| `shell` | Execute a shell command and capture output |
231+
| `gate` | Pause for human approval before continuing |
232+
| `if` | Conditional branching (then/else) |
233+
| `switch` | Multi-branch dispatch on an expression |
234+
| `while` | Loop while a condition is true |
235+
| `do-while` | Execute at least once, then loop on condition |
236+
| `fan-out` | Dispatch a step for each item in a list |
237+
| `fan-in` | Aggregate results from a fan-out step |
238+
239+
## Expressions
240+
241+
Steps can reference inputs and previous step outputs using `{{ expression }}` syntax:
242+
243+
| Namespace | Description |
244+
| ------------------------------ | ------------------------------------ |
245+
| `inputs.spec` | Workflow input values |
246+
| `steps.specify.output.file` | Output from a previous step |
247+
| `item` | Current item in a fan-out iteration |
248+
249+
Available filters: `default`, `join`, `contains`, `map`.
250+
251+
Example:
252+
253+
```yaml
254+
condition: "{{ steps.test.output.exit_code == 0 }}"
255+
args: "{{ inputs.spec }}"
256+
message: "{{ status | default('pending') }}"
257+
```
258+
259+
## Input Types
260+
261+
| Type | Coercion |
262+
| --------- | ------------------------------------------------- |
263+
| `string` | Pass-through |
264+
| `number` | `"42"` → `42`, `"3.14"` → `3.14` |
265+
| `boolean` | `"true"` / `"1"` / `"yes"` → `True` |
266+
267+
## State and Resume
268+
269+
Each workflow run persists its state at `.specify/workflows/runs/<run_id>/`:
270+
271+
- `state.json` — current run state and step progress
272+
- `inputs.json` — resolved input values
273+
- `log.jsonl` — step-by-step execution log
274+
275+
This enables `specify workflow resume` to continue from the exact step where a run was paused (e.g., at a gate) or failed.
276+
277+
## FAQ
278+
279+
### What happens when a workflow hits a gate step?
280+
281+
The workflow pauses and waits for human input. Run `specify workflow resume <run_id>` after reviewing to continue.
282+
283+
### Can I run the same workflow multiple times?
284+
285+
Yes. Each run gets a unique ID and its own state directory. Use `specify workflow status` to see all runs.
286+
287+
### Who maintains workflows?
288+
289+
Most workflows are independently created and maintained by their respective authors. The Spec Kit maintainers do not review, audit, endorse, or support workflow code. Review a workflow's source before installing and use at your own discretion.

docs/toc.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616
- name: Reference
1717
items:
1818
- name: Integrations
19-
href: integrations.md
19+
href: reference/integrations.md
2020
- name: Extensions
21-
href: extensions.md
21+
href: reference/extensions.md
2222
- name: Presets
23-
href: presets.md
23+
href: reference/presets.md
24+
- name: Workflows
25+
href: reference/workflows.md
2426

2527
# Development workflows
2628
- name: Development

docs/upgrade.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Run this inside your project directory:
7676
specify init --here --force --ai <your-agent>
7777
```
7878

79-
Replace `<your-agent>` with your AI coding agent. Refer to this list of [Supported AI Coding Agent Integrations](integrations.md)
79+
Replace `<your-agent>` with your AI coding agent. Refer to this list of [Supported AI Coding Agent Integrations](reference/integrations.md)
8080

8181
**Example:**
8282

src/specify_cli/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,16 @@ def show_banner():
351351
console.print(Align.center(Text(TAGLINE, style="italic bright_yellow")))
352352
console.print()
353353

354+
def _version_callback(value: bool):
355+
if value:
356+
console.print(f"specify {get_speckit_version()}")
357+
raise typer.Exit()
358+
354359
@app.callback()
355-
def callback(ctx: typer.Context):
360+
def callback(
361+
ctx: typer.Context,
362+
version: bool = typer.Option(False, "--version", "-V", callback=_version_callback, is_eager=True, help="Show version and exit."),
363+
):
356364
"""Show banner when no subcommand is provided."""
357365
if ctx.invoked_subcommand is None and "--help" not in sys.argv and "-h" not in sys.argv:
358366
show_banner()

src/specify_cli/workflows/expressions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ def evaluate_expression(template: str, context: Any) -> Any:
255255
----------
256256
template:
257257
The template string (e.g., ``"{{ steps.plan.output.task_count }}"``
258-
or ``"Processed {{ inputs.feature_name }}"``.
258+
or ``"Processed {{ inputs.spec }}"``.
259259
context:
260260
A ``StepContext`` or compatible object.
261261

0 commit comments

Comments
 (0)