Skip to content
Merged
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
13 changes: 13 additions & 0 deletions bundles/bugfix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ specify workflow run bugfix \

Required inputs must be supplied with `--input`: `report` and `slug`. The slug is used as the working directory under `.specify/bugs/<slug>/` for all artifacts.

Without an interactive terminal, the run pauses at `review-assessment`. Review
the assessment, then approve it using the optional verdict input:

```bash
specify workflow resume <run_id> --input bug_review_assessment_verdict=approve
```

`bug_review_assessment_verdict` defaults to `""`. Omitting it or supplying an
empty value preserves the existing interactive prompt or non-interactive pause.
This input is available in `bugfix` workflow version 1.0.1 and requires Specify
CLI 0.15.1 or later. Update the workflow and start a new run to use the input;
existing runs retain the definition saved when they started.

## Remove

```bash
Expand Down
6 changes: 3 additions & 3 deletions bundles/bugfix/bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ schema_version: "1.0"
bundle:
id: "bugfix"
name: "Guided Bug Fix"
version: "1.0.2"
version: "1.0.3"
role: "developer"
description: "Orchestrated bug triage: assess a bug report, review the assessment behind a human gate, apply the fix, and verify it with tests."
author: "GitHub"
license: "MIT"

requires:
speckit_version: ">=0.9.0"
speckit_version: ">=0.15.1"
tools: []
mcp: []

Expand All @@ -20,6 +20,6 @@ provides:
version: "1.0.2"
workflows:
- id: "bugfix"
version: "1.0.0"
version: "1.0.1"

tags: ["bug", "triage", "workflow", "qa"]
6 changes: 3 additions & 3 deletions bundles/catalog.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"schema_version": "1.0",
"updated_at": "2026-09-10T00:00:00Z",
"updated_at": "2026-11-11T00:00:00Z",
"catalog_url": "https://raw.githubusercontent.com/github/spec-kit/main/bundles/catalog.json",
"bundles": {
"bugfix": {
"id": "bugfix",
"name": "Guided Bug Fix",
"version": "1.0.2",
"version": "1.0.3",
"role": "developer",
"description": "Orchestrated bug triage: assess a bug report, review behind a human gate, apply the fix, and verify with tests.",
"author": "GitHub",
"license": "MIT",
"download_url": "https://raw.githubusercontent.com/github/spec-kit/main/bundles/bugfix/bundle.yml",
"repository": "https://github.com/github/spec-kit",
"requires": {
"speckit_version": ">=0.9.0"
"speckit_version": ">=0.15.1"
},
"provides": {
"extensions": 1,
Expand Down
12 changes: 10 additions & 2 deletions docs/workflows/developing.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ schema_version: "1.0"
workflow:
id: "speckit"
name: "Full SDD Cycle"
version: "1.0.1"
version: "1.0.2"
author: "GitHub"
description: "Runs specify → plan → tasks → implement with review gates"

requires:
speckit_version: ">=0.8.5"
speckit_version: ">=0.15.1"
integrations:
any:
- "alquimia"
Expand All @@ -49,6 +49,12 @@ inputs:
type: string
default: "auto"
prompt: "Integration to use (e.g. claude, copilot, gemini; 'auto' uses the project's initialized integration)"
speckit_review_spec_verdict:
type: string
default: ""
speckit_review_plan_verdict:
type: string
default: ""

steps:
- id: specify
Expand All @@ -59,6 +65,7 @@ steps:

- id: review-spec
type: gate
verdict_input: speckit_review_spec_verdict
message: "Review the generated spec before planning."
options: [approve, reject]
on_reject: abort
Expand All @@ -71,6 +78,7 @@ steps:

- id: review-plan
type: gate
verdict_input: speckit_review_plan_verdict
message: "Review the plan before generating tasks."
options: [approve, reject]
on_reject: abort
Expand Down
31 changes: 29 additions & 2 deletions docs/workflows/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,32 @@ specify workflow status <run_id>
specify workflow resume <run_id>
```

To approve a paused review without an interactive terminal, supply the
corresponding verdict input after reviewing the output:

| Workflow | Review gate | Verdict input |
| --- | --- | --- |
| `speckit` | `review-spec` | `speckit_review_spec_verdict` |
| `speckit` | `review-plan` | `speckit_review_plan_verdict` |
| `bugfix` | `review-assessment` | `bug_review_assessment_verdict` |

```bash
specify workflow resume <sdd_run_id> --input speckit_review_spec_verdict=approve
specify workflow resume <sdd_run_id> --input speckit_review_plan_verdict=approve
specify workflow resume <bugfix_run_id> --input bug_review_assessment_verdict=approve
```

Use the command matching the active review. These string inputs are optional
and default to `""`: omitting an input or supplying an empty value keeps the
existing prompt on an interactive terminal or pause otherwise. Approving the
specification does not approve the plan review.

The inputs are available in `speckit` workflow version 1.0.2 and `bugfix` version
1.0.1, with Specify CLI 0.15.1 or later. Update the installed workflow and start
a new run to use its new input declarations. Existing runs keep the workflow
definition saved when they started; updating the installed workflow does not
add inputs to those runs.

Each run gets its own ID and state directory. Completed occurrences are replayed
into the expression context without re-executing their implementations.
Unfinished work continues from its persisted state; a side effect interrupted
Expand All @@ -53,8 +79,9 @@ specify workflow run ./workflow.yml --input spec="Build a kanban board"
| `assess` | Idea intake, research, definition, shaping, and decision | `idea` |

Use `specify workflow info <id>` for metadata, inputs, and the step graph.
The `speckit` workflow declares `spec` and optional `integration`, not a `scope`
input. Workflows using extension commands also need those commands installed;
The `speckit` workflow declares `spec`, optional `integration`, and the two
optional verdict inputs above, not a `scope` input. Workflows using extension
commands also need those commands installed;
consult each bundled definition's requirements.

## Customize a workflow
Expand Down
8 changes: 7 additions & 1 deletion tests/specify_cli/bundles/test_command_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from unittest.mock import patch

import pytest
import yaml
from typer.testing import CliRunner

from specify_cli import app
Expand Down Expand Up @@ -101,6 +102,11 @@ def fake_open_url(
encoding="utf-8"
)
)
assert registry["workflows"][bundle_id]["version"] == "1.0.0"
workflow = yaml.safe_load(
(REPO_ROOT / "workflows" / bundle_id / "workflow.yml").read_text(
encoding="utf-8"
)
)
assert registry["workflows"][bundle_id]["version"] == workflow["workflow"]["version"]
assert FIRSTPARTY_CATALOG_URL in captured_urls
assert expected_manifest_url in captured_urls
7 changes: 6 additions & 1 deletion tests/specify_cli/bundles/test_command_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,12 @@ def test_local_firstparty_bundle_installs_bundled_components_offline(
encoding="utf-8"
)
)
assert registry["workflows"][bundle_id]["version"] == "1.0.0"
workflow = yaml.safe_load(
(REPO_ROOT / "workflows" / bundle_id / "workflow.yml").read_text(
encoding="utf-8"
)
)
assert registry["workflows"][bundle_id]["version"] == workflow["workflow"]["version"]


def test_local_parent_installs_referenced_catalog_components(
Expand Down
72 changes: 72 additions & 0 deletions tests/workflows/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import sys
import tempfile
from pathlib import Path
from types import SimpleNamespace

import pytest

Expand All @@ -24,3 +25,74 @@ def project_dir(temp_dir):
workflows_dir = temp_dir / ".specify" / "workflows"
workflows_dir.mkdir(parents=True, exist_ok=True)
return temp_dir


@pytest.fixture
def bundled_review(monkeypatch, project_dir):
"""Run a canonical workflow up to a review, without invoking an agent."""
from specify_cli.workflows.base import RunStatus, StepResult, StepStatus
from specify_cli.workflows.engine import WorkflowDefinition, WorkflowEngine
from specify_cli.workflows.step import gate as gate_module
from specify_cli.workflows.step.command import CommandStep

def start(workflow_id: str, gate_id: str):
commands: list[str] = []
tty = gate_id == "review-plan"

def execute_command(self, config, context):
commands.append(config["command"])
return StepResult(status=StepStatus.COMPLETED)

def approve_previous_review(message, options):
nonlocal tty
assert tty
tty = False
return "approve"

monkeypatch.setattr(CommandStep, "execute", execute_command)
monkeypatch.setattr(
gate_module, "sys",
SimpleNamespace(stdin=SimpleNamespace(isatty=lambda: tty)),
)
monkeypatch.setattr(
gate_module.GateStep, "_prompt", staticmethod(approve_previous_review)
)
definition = WorkflowDefinition.from_yaml(
Path(__file__).resolve().parents[2]
/ "workflows" / workflow_id / "workflow.yml"
)
engine = WorkflowEngine(project_dir)
assert engine.validate(definition) == []
inputs = (
{"spec": "Test feature"}
if workflow_id == "speckit"
else {"report": "Test bug report", "slug": "test-bug"}
)
state = engine.execute(definition, inputs={**inputs, "integration": "copilot"})
assert state.status is RunStatus.PAUSED
assert state.current_step_id == gate_id
monkeypatch.setattr(
gate_module.GateStep, "_prompt",
staticmethod(lambda *_: pytest.fail("Unexpected review prompt")),
)
return engine, state, commands

return start


@pytest.fixture
def resume_bundled_review(monkeypatch, project_dir):
from typer.testing import CliRunner

from specify_cli import app
from specify_cli.workflows.engine import RunState

monkeypatch.setenv("SPECIFY_INIT_DIR", str(project_dir))

def resume(state, input_name: str, value: str):
result = CliRunner().invoke(
app, ["workflow", "resume", state.run_id, "--input", f"{input_name}={value}"]
)
return result, RunState.load(state.run_id, project_dir)

return resume
73 changes: 73 additions & 0 deletions tests/workflows/test_bundled_bugfix_assess_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

from __future__ import annotations

from types import SimpleNamespace

import pytest

from specify_cli._assets import _locate_bundled_workflow
from specify_cli.workflows.base import RunStatus
from specify_cli.workflows.engine import WorkflowDefinition, validate_workflow
from specify_cli.workflows.step import gate as gate_module


def _load_workflow(workflow_id: str) -> WorkflowDefinition:
Expand Down Expand Up @@ -91,3 +95,72 @@ def test_bundled_workflow_has_required_inputs(
for input_id in required_inputs:
assert definition.inputs[input_id].get("required") is True
assert definition.inputs.get("integration", {}).get("default") == "auto"


def test_verdict_resume(bundled_review, resume_bundled_review) -> None:
_, state, commands = bundled_review("bugfix", "review-assessment")

result, resumed = resume_bundled_review(
state, "bug_review_assessment_verdict", "approve"
)

assert result.exit_code == 0, result.output
assert resumed.status is RunStatus.COMPLETED
assert resumed.step_results["review-assessment"]["output"]["choice"] == "approve"
assert resumed.step_results["review-assessment"]["status"] == "completed"
assert commands == ["speckit.bug.assess", "speckit.bug.fix", "speckit.bug.test"]


@pytest.mark.parametrize("explicit_empty", [False, True], ids=["omitted", "empty"])
@pytest.mark.parametrize("tty", [False, True], ids=["non-tty", "tty"])
def test_empty_verdict_preserves_review(
bundled_review, monkeypatch, explicit_empty, tty
) -> None:
engine, state, commands = bundled_review("bugfix", "review-assessment")
assert state.inputs["bug_review_assessment_verdict"] == ""
prompts = []

def prompt(message, options):
prompts.append((message, options))
return "reject"

monkeypatch.setattr(
gate_module, "sys",
SimpleNamespace(stdin=SimpleNamespace(isatty=lambda: tty)),
)
monkeypatch.setattr(gate_module.GateStep, "_prompt", staticmethod(prompt))

resumed = engine.resume(
state.run_id,
{"bug_review_assessment_verdict": ""} if explicit_empty else None,
)

assert resumed.status is (RunStatus.ABORTED if tty else RunStatus.PAUSED)
assert len(prompts) == int(tty)
assert resumed.inputs["bug_review_assessment_verdict"] == ""
assert resumed.step_results["review-assessment"]["output"]["choice"] == (
"reject" if tty else None
)
assert commands == ["speckit.bug.assess"]


@pytest.mark.parametrize("value", ["reject", "maybe", " ", "aPpRoVe"])
def test_bound_verdict_preserves_decisions(bundled_review, value) -> None:
engine, state, commands = bundled_review("bugfix", "review-assessment")

resumed = engine.resume(
state.run_id, {"bug_review_assessment_verdict": value}
)

if value == "aPpRoVe":
assert resumed.status is RunStatus.COMPLETED
assert resumed.step_results["review-assessment"]["output"]["choice"] == "approve"
assert commands == ["speckit.bug.assess", "speckit.bug.fix", "speckit.bug.test"]
else:
expected = RunStatus.ABORTED if value == "reject" else RunStatus.FAILED
assert resumed.status is expected
assert commands == ["speckit.bug.assess"]
if value == "reject":
assert resumed.step_results["review-assessment"]["output"]["aborted"] is True
else:
assert "does not match any configured option" in resumed.error
Loading
Loading