mirror of
https://github.com/github/spec-kit.git
synced 2026-07-08 07:04:44 +08:00
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
This commit is contained in:
35
tests/test_cli_version.py
Normal file
35
tests/test_cli_version.py
Normal file
@@ -0,0 +1,35 @@
|
||||
"""Tests for the --version CLI flag."""
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from typer.testing import CliRunner
|
||||
|
||||
from specify_cli import app
|
||||
|
||||
|
||||
runner = CliRunner()
|
||||
|
||||
|
||||
class TestVersionFlag:
|
||||
"""Test --version / -V flag on the root command."""
|
||||
|
||||
def test_version_long_flag(self):
|
||||
"""specify --version prints version and exits 0."""
|
||||
with patch("specify_cli.get_speckit_version", return_value="1.2.3"):
|
||||
result = runner.invoke(app, ["--version"])
|
||||
assert result.exit_code == 0
|
||||
assert "specify 1.2.3" in result.output
|
||||
|
||||
def test_version_short_flag(self):
|
||||
"""specify -V prints version and exits 0."""
|
||||
with patch("specify_cli.get_speckit_version", return_value="1.2.3"):
|
||||
result = runner.invoke(app, ["-V"])
|
||||
assert result.exit_code == 0
|
||||
assert "specify 1.2.3" in result.output
|
||||
|
||||
def test_version_flag_takes_precedence_over_subcommand(self):
|
||||
"""--version should work even when a subcommand follows."""
|
||||
with patch("specify_cli.get_speckit_version", return_value="0.7.2"):
|
||||
result = runner.invoke(app, ["--version", "init"])
|
||||
assert result.exit_code == 0
|
||||
assert "specify 0.7.2" in result.output
|
||||
@@ -54,7 +54,7 @@ workflow:
|
||||
description: "A test workflow"
|
||||
|
||||
inputs:
|
||||
feature_name:
|
||||
spec:
|
||||
type: string
|
||||
required: true
|
||||
scope:
|
||||
@@ -65,7 +65,7 @@ steps:
|
||||
- id: step-one
|
||||
command: speckit.specify
|
||||
input:
|
||||
args: "{{ inputs.feature_name }}"
|
||||
args: "{{ inputs.spec }}"
|
||||
|
||||
- id: step-two
|
||||
command: speckit.plan
|
||||
@@ -1152,8 +1152,8 @@ class TestWorkflowDefinition:
|
||||
from specify_cli.workflows.engine import WorkflowDefinition
|
||||
|
||||
definition = WorkflowDefinition.from_string(sample_workflow_yaml)
|
||||
assert "feature_name" in definition.inputs
|
||||
assert definition.inputs["feature_name"]["required"] is True
|
||||
assert "spec" in definition.inputs
|
||||
assert definition.inputs["spec"]["required"] is True
|
||||
assert definition.inputs["scope"]["default"] == "full"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user