Skip to content

Commit be6659c

Browse files
authored
Add OpenSpec proposals for stacking, install scope, and command surfaces (#733)
* Add OpenSpec change proposals for stacking and scope * Address review feedback across change proposals * Preserve legacy install-scope behavior with migration path * Address remaining review threads across spec proposals * Address latest review feedback on split and command-surface specs * Clarify split and composition semantics from latest review
1 parent 4ba2690 commit be6659c

File tree

23 files changed

+1165
-0
lines changed

23 files changed

+1165
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
schema: spec-driven
2+
created: 2026-02-21
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
## Why
2+
3+
Parallel changes often touch the same capabilities and `cli-init`/`cli-update` behavior, but today there is no machine-readable way to express sequencing, dependencies, or expected merge order.
4+
5+
This creates three recurring problems:
6+
7+
- teams cannot tell which change should land first
8+
- large changes are hard to split into safe mergeable slices
9+
- parallel work can accidentally reintroduce assumptions already removed by another change
10+
11+
We need lightweight planning metadata and CLI guidance so contributors can safely stack plans on top of each other.
12+
13+
## What Changes
14+
15+
### 1. Add lightweight stack metadata for changes
16+
17+
Extend change metadata to support sequencing and decomposition context, for example:
18+
19+
- `dependsOn`: changes that must land first
20+
- `provides`: capability markers exposed by this change
21+
- `requires`: capability markers needed by this change
22+
- `touches`: capability/spec areas likely affected (advisory only; warning signal, not a hard dependency)
23+
- `parent`: optional parent change for split work
24+
25+
Metadata is optional and backward compatible for existing changes.
26+
27+
Ordering semantics:
28+
29+
- `dependsOn` is the source of truth for execution/archive ordering
30+
- `provides`/`requires` are capability contracts for validation and planning visibility
31+
- `provides`/`requires` do not create implicit dependency edges; authors must still declare required ordering via `dependsOn`
32+
33+
### 2. Add stack-aware validation
34+
35+
Enhance change validation to detect planning issues early:
36+
37+
- missing dependencies
38+
- dependency cycles
39+
- archive ordering violations (for example, attempting to archive a change before all `dependsOn` predecessors are archived)
40+
- unmatched capability markers (for example, `requires` marker with no provider in active history emits non-blocking warning)
41+
- overlap warnings when active changes touch the same capability
42+
43+
Validation should fail only for deterministic blockers (for example cycles or missing required dependencies), and keep overlap checks as actionable warnings.
44+
45+
### 3. Add sequencing visibility commands
46+
47+
Add lightweight CLI support to inspect and execute plan order:
48+
49+
- `openspec change graph` to show dependency DAG/order
50+
- `openspec change graph` validates for cycles first; when cycles are present it fails with the same deterministic cycle error as stack-aware validation
51+
- `openspec change next` to suggest unblocked changes ready to implement/archive
52+
53+
### 4. Add split scaffolding for large changes
54+
55+
Add helper workflow to decompose large proposals into stackable slices:
56+
57+
- `openspec change split <change-id>` scaffolds child changes with `parent` + `dependsOn`
58+
- generates minimal proposal/tasks stubs for each child slice
59+
- converts the source change into a parent planning container (no duplicate child implementation tasks)
60+
- re-running split for an already-split source change returns a deterministic actionable error unless `--overwrite` (alias `--force`) is passed
61+
- `--overwrite` / `--force` fully regenerates managed child scaffold stubs and metadata links for the split, replacing prior scaffold content
62+
63+
### 5. Document stack-first workflow
64+
65+
Update docs to describe:
66+
67+
- how to model dependencies and parent/child slices
68+
- when to split a large change
69+
- how to use graph/next validation signals during parallel development
70+
- migration guidance for `openspec/changes/IMPLEMENTATION_ORDER.md`:
71+
- machine-readable change metadata becomes the normative dependency source
72+
- `IMPLEMENTATION_ORDER.md` remains optional narrative context during transition
73+
74+
## Capabilities
75+
76+
### New Capabilities
77+
78+
- `change-stacking-workflow`: Dependency-aware sequencing and split scaffolding for change planning
79+
80+
### Modified Capabilities
81+
82+
- `cli-change`: Adds graph/next/split planning commands and stack-aware validation messaging
83+
- `change-creation`: Supports parent/dependency metadata when creating or splitting changes
84+
- `openspec-conventions`: Defines optional stack metadata conventions for change proposals
85+
86+
## Impact
87+
88+
- `src/core/project-config.ts` and related parsing/validation utilities for change metadata loading
89+
- `src/core/config-schema.ts` (or dedicated change schema) for stack metadata validation
90+
- `src/commands/change.ts` and/or `src/core/list.ts` for graph/next/split command behavior
91+
- `src/core/validation/*` for dependency cycle and overlap checks
92+
- `docs/cli.md`, `docs/concepts.md`, and contributor guidance for stack-aware workflows
93+
- tests for metadata parsing, graph ordering, next-item suggestions, and split scaffolding
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## ADDED Requirements
2+
3+
### Requirement: Stack Metadata Scaffolding
4+
Change creation workflows SHALL support optional dependency metadata for new or split changes.
5+
6+
#### Scenario: Create change with stack metadata
7+
- **WHEN** a change is created with stack metadata inputs
8+
- **THEN** creation SHALL persist metadata fields in change configuration
9+
- **AND** persisted metadata SHALL be validated against change metadata schema rules
10+
11+
#### Scenario: Split-generated child metadata
12+
- **WHEN** child changes are generated from a split workflow
13+
- **THEN** each child SHALL include a `parent` link to the source change
14+
- **AND** SHALL include dependency metadata needed for deterministic sequencing
15+
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
## ADDED Requirements
2+
3+
### Requirement: Stack Metadata Model
4+
The system SHALL support optional metadata on active changes to express sequencing and decomposition relationships.
5+
6+
#### Scenario: Optional stack metadata is present
7+
- **WHEN** a change includes stack metadata fields
8+
- **THEN** the system SHALL parse and expose `dependsOn`, `provides`, `requires`, `touches`, and `parent`
9+
- **AND** validation SHALL enforce normalized field shapes and value types (`dependsOn`/`provides`/`requires`/`touches` as string arrays, `parent` as string when present)
10+
11+
#### Scenario: Backward compatibility without stack metadata
12+
- **WHEN** a change does not include stack metadata
13+
- **THEN** existing behavior SHALL continue without migration steps
14+
- **AND** validation SHALL not fail solely because stack metadata is absent
15+
16+
### Requirement: Change Dependency Graph
17+
The system SHALL provide dependency-aware ordering for active changes.
18+
19+
#### Scenario: Build dependency order
20+
- **WHEN** users request stack planning output
21+
- **THEN** the system SHALL compute a dependency graph across active changes
22+
- **AND** SHALL return a deterministic topological order for unblocked changes
23+
24+
#### Scenario: Tie-breaking within the same dependency depth
25+
- **WHEN** multiple unblocked changes share the same topological dependency depth
26+
- **THEN** ordering SHALL break ties lexicographically by change ID
27+
- **AND** repeated runs over the same input SHALL return the same order
28+
29+
#### Scenario: Dependency cycle detection
30+
- **WHEN** active changes contain a dependency cycle
31+
- **THEN** validation SHALL fail with cycle details before archive or sequencing actions proceed
32+
- **AND** output SHALL include actionable guidance to break the cycle
33+
34+
### Requirement: Capability marker and overlap semantics
35+
The system SHALL treat capability markers as validation contracts and `touches` as advisory overlap signals.
36+
37+
#### Scenario: Required capability provided by an active change
38+
- **WHEN** change B declares `requires` marker `X`
39+
- **AND** active change A declares `provides` marker `X`
40+
- **THEN** validation SHALL require B to declare an explicit ordering edge in `dependsOn` to at least one active provider of `X`
41+
- **AND** validation SHALL fail if no explicit dependency is declared
42+
43+
#### Scenario: Requires marker without active provider
44+
- **WHEN** a change declares a `requires` marker
45+
- **AND** no active change declares the corresponding `provides` marker
46+
- **THEN** validation SHALL NOT infer an implicit dependency edge
47+
- **AND** ordering SHALL continue to be determined solely by explicit `dependsOn` relationships
48+
49+
#### Scenario: Requires marker satisfied by archived history
50+
- **WHEN** a change declares a `requires` marker
51+
- **AND** no active change provides that marker
52+
- **AND** at least one archived change in history provides that marker
53+
- **THEN** validation SHALL NOT warn solely about missing provider
54+
- **AND** SHALL continue to use explicit `dependsOn` for active ordering
55+
56+
#### Scenario: Requires marker missing in full history
57+
- **WHEN** a change declares a `requires` marker
58+
- **AND** no active or archived change in history provides that marker
59+
- **THEN** validation SHALL emit a non-blocking warning naming the change and missing marker
60+
- **AND** SHALL NOT infer an implicit dependency edge
61+
62+
#### Scenario: Overlap warning for shared touches
63+
- **WHEN** multiple active changes declare overlapping `touches` values
64+
- **THEN** validation SHALL emit a warning listing the overlapping changes and touched areas
65+
- **AND** validation SHALL NOT fail solely on overlap
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
## ADDED Requirements
2+
3+
### Requirement: Stack Planning Commands
4+
The change CLI SHALL provide commands for dependency-aware sequencing of active changes.
5+
6+
#### Scenario: Show dependency graph
7+
- **WHEN** a user runs `openspec change graph`
8+
- **THEN** the CLI SHALL display dependency relationships for active changes
9+
- **AND** SHALL include a deterministic recommended order for execution
10+
11+
#### Scenario: Show next unblocked changes
12+
- **WHEN** a user runs `openspec change next`
13+
- **THEN** the CLI SHALL list changes that are not blocked by unresolved dependencies
14+
- **AND** SHALL use deterministic tie-breaking when multiple options are available
15+
16+
### Requirement: Split Large Change Scaffolding
17+
The change CLI SHALL support scaffolding child slices from an existing large change.
18+
19+
#### Scenario: Split command scaffolds child changes
20+
- **WHEN** a user runs `openspec change split <change-id>`
21+
- **THEN** the CLI SHALL create child change directories with proposal/tasks stubs
22+
- **AND** generated metadata SHALL include `parent` and dependency links back to the source change
23+
24+
#### Scenario: Re-running split on an already-split change
25+
- **WHEN** a user runs `openspec change split <change-id>` for a parent whose generated child directories already exist
26+
- **THEN** the CLI SHALL fail with a deterministic, actionable error
27+
- **AND** SHALL NOT mutate existing child change content unless an explicit overwrite mode is requested
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## ADDED Requirements
2+
3+
### Requirement: Stack-Aware Change Planning Conventions
4+
OpenSpec conventions SHALL define optional metadata fields for sequencing and decomposition across concurrent changes.
5+
6+
#### Scenario: Declaring change dependencies
7+
- **WHEN** authors need to sequence related changes
8+
- **THEN** conventions SHALL define how to declare dependencies and provided/required capability markers
9+
- **AND** validation guidance SHALL distinguish hard blockers from soft overlap warnings
10+
11+
#### Scenario: Dependency source of truth during migration
12+
- **WHEN** both stack metadata and `openspec/changes/IMPLEMENTATION_ORDER.md` are present
13+
- **THEN** conventions SHALL treat per-change stack metadata as the normative dependency source
14+
- **AND** `IMPLEMENTATION_ORDER.md` SHALL be treated as optional narrative guidance
15+
16+
#### Scenario: Explicit ordering remains required for capability markers
17+
- **WHEN** authors use `provides` and `requires` markers to describe capability contracts
18+
- **THEN** conventions SHALL require explicit `dependsOn` edges for ordering relationships
19+
- **AND** conventions SHALL prohibit treating `requires` as an implicit dependency edge
20+
21+
#### Scenario: Declaring advisory overlap via touches
22+
- **WHEN** a change may affect capability/spec areas shared by concurrent changes without requiring ordering
23+
- **THEN** conventions SHALL allow authors to declare `touches` with advisory area identifiers (for example capability IDs, spec area names, or paths)
24+
- **AND** tooling SHALL treat `touches` as informational only (no implicit dependency edge, non-blocking validation signal)
25+
26+
#### Scenario: Declaring parent-child split structure
27+
- **WHEN** a large change is decomposed into smaller slices
28+
- **THEN** conventions SHALL define parent-child metadata and expected ordering semantics
29+
- **AND** docs SHALL describe when to split versus keep a single change
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
## 1. Metadata Model
2+
3+
- [ ] 1.1 Add optional stack metadata fields (`dependsOn`, `provides`, `requires`, `touches`, `parent`) to change metadata schema
4+
- [ ] 1.2 Keep metadata backward compatible for existing changes without new fields
5+
- [ ] 1.3 Add tests for valid/invalid metadata and schema evolution behavior
6+
7+
## 2. Stack-Aware Validation
8+
9+
- [ ] 2.1 Detect dependency cycles and fail validation with deterministic errors
10+
- [ ] 2.2 Detect missing `dependsOn` targets (referenced change ID does not exist) and detect changes transitively blocked by unresolved/cyclic dependency paths
11+
- [ ] 2.3 Add overlap warnings for active changes that touch the same capability/spec areas
12+
- [ ] 2.4 Emit advisory warnings for unmatched `requires` markers when no provider exists in active history
13+
- [ ] 2.5 Add tests for cycle, missing dependency, overlap warning, and unmatched `requires` cases
14+
15+
## 3. Sequencing Commands
16+
17+
- [ ] 3.1 Add `openspec change graph` to display dependency order for active changes
18+
- [ ] 3.2 Add `openspec change next` to suggest unblocked changes in recommended order
19+
- [ ] 3.3 Add tests for topological ordering and deterministic tie-breaking (lexicographic by change ID at equal depth)
20+
21+
## 4. Split Scaffolding
22+
23+
- [ ] 4.1 Add `openspec change split <change-id>` to scaffold child slices
24+
- [ ] 4.2 Ensure generated children include parent/dependency metadata and stub proposal/tasks files
25+
- [ ] 4.3 Convert the source change into a parent planning container as part of split (no duplicate child implementation tasks)
26+
- [ ] 4.4 Add tests for split output structure, source-change parent conversion, and deterministic re-split error behavior when overwrite mode is not requested
27+
- [ ] 4.5 Implement and test explicit overwrite mode for `openspec change split` (`--overwrite` / `--force`) for controlled re-splitting
28+
29+
## 5. Documentation
30+
31+
- [ ] 5.1 Document stack metadata and sequencing workflow in `docs/concepts.md`
32+
- [ ] 5.2 Document new change commands and usage examples in `docs/cli.md`
33+
- [ ] 5.3 Add guidance for breaking large changes into independently mergeable slices
34+
- [ ] 5.4 Document migration guidance for `openspec/changes/IMPLEMENTATION_ORDER.md` as optional narrative, not dependency source of truth
35+
36+
## 6. Verification
37+
38+
- [ ] 6.1 Run targeted tests for change parsing, validation, and CLI commands
39+
- [ ] 6.2 Run full test suite (`pnpm test`) and resolve regressions
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
schema: spec-driven
2+
created: 2026-02-21

0 commit comments

Comments
 (0)