|
| 1 | +# cli-artifact-workflow Specification |
| 2 | + |
| 3 | +## Purpose |
| 4 | +TBD - created by archiving change add-artifact-workflow-cli. Update Purpose after archive. |
| 5 | +## Requirements |
| 6 | +### Requirement: Status Command |
| 7 | +The system SHALL display artifact completion status for a change. |
| 8 | + |
| 9 | +#### Scenario: Show status with all states |
| 10 | +- **WHEN** user runs `openspec status --change <id>` |
| 11 | +- **THEN** the system displays each artifact with status indicator: |
| 12 | + - `[x]` for completed artifacts |
| 13 | + - `[ ]` for ready artifacts |
| 14 | + - `[-]` for blocked artifacts (with missing dependencies listed) |
| 15 | + |
| 16 | +#### Scenario: Status shows completion summary |
| 17 | +- **WHEN** user runs `openspec status --change <id>` |
| 18 | +- **THEN** output includes completion percentage and count (e.g., "2/4 artifacts complete") |
| 19 | + |
| 20 | +#### Scenario: Status JSON output |
| 21 | +- **WHEN** user runs `openspec status --change <id> --json` |
| 22 | +- **THEN** the system outputs JSON with changeName, schemaName, isComplete, and artifacts array |
| 23 | + |
| 24 | +#### Scenario: Missing change parameter |
| 25 | +- **WHEN** user runs `openspec status` without `--change` |
| 26 | +- **THEN** the system displays an error with list of available changes |
| 27 | + |
| 28 | +#### Scenario: Unknown change |
| 29 | +- **WHEN** user runs `openspec status --change unknown-id` |
| 30 | +- **THEN** the system displays an error indicating the change does not exist |
| 31 | + |
| 32 | +### Requirement: Next Command |
| 33 | +The system SHALL show which artifacts are ready to be created. |
| 34 | + |
| 35 | +#### Scenario: Show ready artifacts |
| 36 | +- **WHEN** user runs `openspec next --change <id>` |
| 37 | +- **THEN** the system lists artifacts whose dependencies are all satisfied |
| 38 | + |
| 39 | +#### Scenario: No artifacts ready |
| 40 | +- **WHEN** all artifacts are either completed or blocked |
| 41 | +- **THEN** the system indicates no artifacts are ready (with explanation) |
| 42 | + |
| 43 | +#### Scenario: All artifacts complete |
| 44 | +- **WHEN** all artifacts in the change are completed |
| 45 | +- **THEN** the system indicates the change is complete |
| 46 | + |
| 47 | +#### Scenario: Next JSON output |
| 48 | +- **WHEN** user runs `openspec next --change <id> --json` |
| 49 | +- **THEN** the system outputs JSON array of ready artifact IDs |
| 50 | + |
| 51 | +### Requirement: Instructions Command |
| 52 | +The system SHALL output enriched instructions for creating an artifact. |
| 53 | + |
| 54 | +#### Scenario: Show enriched instructions |
| 55 | +- **WHEN** user runs `openspec instructions <artifact> --change <id>` |
| 56 | +- **THEN** the system outputs: |
| 57 | + - Artifact metadata (ID, output path, description) |
| 58 | + - Template content |
| 59 | + - Dependency status (done/missing) |
| 60 | + - Unlocked artifacts (what becomes available after completion) |
| 61 | + |
| 62 | +#### Scenario: Instructions JSON output |
| 63 | +- **WHEN** user runs `openspec instructions <artifact> --change <id> --json` |
| 64 | +- **THEN** the system outputs JSON matching ArtifactInstructions interface |
| 65 | + |
| 66 | +#### Scenario: Unknown artifact |
| 67 | +- **WHEN** user runs `openspec instructions unknown-artifact --change <id>` |
| 68 | +- **THEN** the system displays an error listing valid artifact IDs for the schema |
| 69 | + |
| 70 | +#### Scenario: Artifact with unmet dependencies |
| 71 | +- **WHEN** user requests instructions for a blocked artifact |
| 72 | +- **THEN** the system displays instructions with a warning about missing dependencies |
| 73 | + |
| 74 | +### Requirement: Templates Command |
| 75 | +The system SHALL show resolved template paths for all artifacts in a schema. |
| 76 | + |
| 77 | +#### Scenario: List template paths with default schema |
| 78 | +- **WHEN** user runs `openspec templates` |
| 79 | +- **THEN** the system displays each artifact with its resolved template path using the default schema |
| 80 | + |
| 81 | +#### Scenario: List template paths with custom schema |
| 82 | +- **WHEN** user runs `openspec templates --schema tdd` |
| 83 | +- **THEN** the system displays template paths for the specified schema |
| 84 | + |
| 85 | +#### Scenario: Templates JSON output |
| 86 | +- **WHEN** user runs `openspec templates --json` |
| 87 | +- **THEN** the system outputs JSON mapping artifact IDs to template paths |
| 88 | + |
| 89 | +#### Scenario: Template resolution source |
| 90 | +- **WHEN** displaying template paths |
| 91 | +- **THEN** the system indicates whether each template is from user override or package built-in |
| 92 | + |
| 93 | +### Requirement: New Change Command |
| 94 | +The system SHALL create new change directories with validation. |
| 95 | + |
| 96 | +#### Scenario: Create valid change |
| 97 | +- **WHEN** user runs `openspec new change add-feature` |
| 98 | +- **THEN** the system creates `openspec/changes/add-feature/` directory |
| 99 | + |
| 100 | +#### Scenario: Invalid change name |
| 101 | +- **WHEN** user runs `openspec new change "Add Feature"` with invalid name |
| 102 | +- **THEN** the system displays validation error with guidance |
| 103 | + |
| 104 | +#### Scenario: Duplicate change name |
| 105 | +- **WHEN** user runs `openspec new change existing-change` for an existing change |
| 106 | +- **THEN** the system displays an error indicating the change already exists |
| 107 | + |
| 108 | +#### Scenario: Create with description |
| 109 | +- **WHEN** user runs `openspec new change add-feature --description "Add new feature"` |
| 110 | +- **THEN** the system creates the change directory with description in README.md |
| 111 | + |
| 112 | +### Requirement: Schema Selection |
| 113 | +The system SHALL support custom schema selection for workflow commands. |
| 114 | + |
| 115 | +#### Scenario: Default schema |
| 116 | +- **WHEN** user runs workflow commands without `--schema` |
| 117 | +- **THEN** the system uses the "spec-driven" schema |
| 118 | + |
| 119 | +#### Scenario: Custom schema |
| 120 | +- **WHEN** user runs `openspec status --change <id> --schema tdd` |
| 121 | +- **THEN** the system uses the specified schema for artifact graph |
| 122 | + |
| 123 | +#### Scenario: Unknown schema |
| 124 | +- **WHEN** user specifies an unknown schema |
| 125 | +- **THEN** the system displays an error listing available schemas |
| 126 | + |
| 127 | +### Requirement: Output Formatting |
| 128 | +The system SHALL provide consistent output formatting. |
| 129 | + |
| 130 | +#### Scenario: Color output |
| 131 | +- **WHEN** terminal supports colors |
| 132 | +- **THEN** status indicators use colors: green (done), yellow (ready), red (blocked) |
| 133 | + |
| 134 | +#### Scenario: No color output |
| 135 | +- **WHEN** `--no-color` flag is used or NO_COLOR environment variable is set |
| 136 | +- **THEN** output uses text-only indicators without ANSI colors |
| 137 | + |
| 138 | +#### Scenario: Progress indication |
| 139 | +- **WHEN** loading change state takes time |
| 140 | +- **THEN** the system displays a spinner during loading |
| 141 | + |
| 142 | +### Requirement: Experimental Isolation |
| 143 | +The system SHALL implement artifact workflow commands in isolation for easy removal. |
| 144 | + |
| 145 | +#### Scenario: Single file implementation |
| 146 | +- **WHEN** artifact workflow feature is implemented |
| 147 | +- **THEN** all commands are in `src/commands/artifact-workflow.ts` |
| 148 | + |
| 149 | +#### Scenario: Help text marking |
| 150 | +- **WHEN** user runs `--help` on any artifact workflow command |
| 151 | +- **THEN** help text indicates the command is experimental |
| 152 | + |
0 commit comments