Skip to content

Commit 2c667fb

Browse files
committed
clarify scaffold proposal
1 parent 17d7e59 commit 2c667fb

File tree

3 files changed

+19
-26
lines changed

3 files changed

+19
-26
lines changed

openspec/changes/add-scaffold-command/proposal.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
Manual setup for new changes leads to formatting mistakes in spec deltas and slows agents who must recreate the same file skeletons for every proposal. A built-in scaffold command will generate compliant templates so assistants can focus on the change content instead of structure.
33

44
## What Changes
5-
- Add an `openspec scaffold <change-id>` CLI command that creates a change directory with validated `proposal.md`, `tasks.md`, and spec delta templates.
6-
- Update CLI documentation and quick-reference guidance so agents discover the scaffold workflow before drafting files manually.
7-
- Add automated coverage (unit/integ tests) to ensure the command respects existing naming rules and generated Markdown passes validation.
5+
- Add an `openspec scaffold <change-id>` CLI command that validates IDs, copies the default proposal/tasks/design template bundle into a new change directory, and errors out if the target already exists (authors add spec deltas later).
6+
- Update CLI documentation and quick-reference guidance so agents discover the scaffold workflow before drafting files manually, including reminders on when to create spec deltas.
7+
- Add automated coverage (unit/integ tests) to ensure the command respects naming rules, copies templates correctly, fails for existing directories, and produces output that passes `openspec validate --strict` untouched.
88

99
## Impact
1010
- Affected specs: `specs/cli-scaffold`

openspec/changes/add-scaffold-command/specs/cli-scaffold/spec.md

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ The CLI SHALL expose an `openspec scaffold <change-id>` command that validates t
99
- **AND** exit with code 0 after successful scaffolding
1010

1111
### Requirement: Change Directory Structure
12-
The scaffold command SHALL create the standard change workspace with proposal, tasks, optional design, and delta directories laid out according to OpenSpec conventions.
12+
The scaffold command SHALL create the standard change workspace with proposal, tasks, optional design, and `specs/` directories laid out according to OpenSpec conventions.
1313

1414
#### Scenario: Generating change workspace
1515
- **WHEN** scaffolding a new change with id `add-user-notifications`
1616
- **THEN** create `openspec/changes/add-user-notifications/`
17-
- **AND** generate `proposal.md`, `tasks.md`, and `design.md` (commented placeholder content) in that directory when missing
18-
- **AND** create `openspec/changes/add-user-notifications/specs/` ready for capability-specific deltas
17+
- **AND** copy the default template bundle (proposal, tasks, design placeholders) into that directory in a single operation
18+
- **AND** create an empty `openspec/changes/add-user-notifications/specs/` directory ready for capability-specific deltas that will be authored later
1919

2020
### Requirement: Template Content Guidance
2121
The scaffold command SHALL populate generated Markdown files with OpenSpec-compliant templates so authors can copy, edit, and pass validation without reformatting.
@@ -25,20 +25,12 @@ The scaffold command SHALL populate generated Markdown files with OpenSpec-compl
2525
- **THEN** include the `## Why`, `## What Changes`, and `## Impact` headings with placeholder guidance text
2626
- **AND** ensure `tasks.md` starts with `## 1. Implementation` and numbered checklist items using `- [ ]` syntax
2727
- **AND** annotate optional sections (like `design.md`) with inline TODO comments so users understand when to keep or delete them
28+
- **AND** include a short reminder inside `specs/README.md` (or similar) instructing authors to add deltas once they know the affected capability
2829

29-
### Requirement: Delta Spec Creation
30-
The scaffold command SHALL create at least one capability delta file with correctly formatted requirement and scenario placeholders that guide authors to enter the actual behavior.
30+
### Requirement: Directory Collision Handling
31+
The scaffold command SHALL prevent accidental overwrites by refusing to run when a change directory already exists.
3132

32-
#### Scenario: Creating spec delta skeleton
33-
- **WHEN** scaffolding a change and the capability `cli-scaffold` is provided interactively or via flags
34-
- **THEN** generate `openspec/changes/add-user-notifications/specs/cli-scaffold/spec.md`
35-
- **AND** include `## ADDED Requirements` with at least one `### Requirement:` block and matching `#### Scenario:` entries that remind the author to replace placeholder text
36-
- **AND** ensure the generated delta passes `openspec validate add-user-notifications --strict` until the author edits it
37-
38-
### Requirement: Idempotent Execution
39-
The scaffold command SHALL be safe to rerun, preserving user edits while filling in any missing managed sections.
40-
41-
#### Scenario: Rerunning scaffold on existing change
42-
- **WHEN** the command is executed again for an existing change directory containing user-edited files
43-
- **THEN** leave existing content untouched except for managed placeholder regions or missing files that need creation
44-
- **AND** update the filesystem summary to highlight which files were skipped, created, or refreshed
33+
#### Scenario: Existing change-id
34+
- **WHEN** the command is executed for a `change-id` whose directory already exists
35+
- **THEN** emit an error stating the change has already been scaffolded
36+
- **AND** exit without modifying any files
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
## 1. CLI scaffolding command
22
- [ ] 1.1 Register an `openspec scaffold` command in the CLI entrypoint with `change-id` argument validation.
3-
- [ ] 1.2 Implement generator logic that creates the change directory structure plus default `proposal.md`, `tasks.md`, and delta spec skeletons without overwriting existing populated files.
3+
- [ ] 1.2 Implement generator logic that copies the default change template bundle (`proposal.md`, `tasks.md`, optional `design.md`, `specs/README.md`) into `openspec/changes/<id>/`, creating the directory tree in a single pass.
4+
- [ ] 1.3 Detect when `openspec/changes/<id>/` already exists and exit with a clear error instead of overwriting user files.
45

56
## 2. Templates and documentation
6-
- [ ] 2.1 Surface copy/paste templates and scaffold usage in the top-level quick reference for `openspec/AGENTS.md`.
7-
- [ ] 2.2 Refresh other CLI docs (`docs/`, README) to mention the scaffold workflow and link to instructions.
7+
- [ ] 2.1 Update `openspec/AGENTS.md` quick reference so agents see `openspec scaffold` before drafting files manually.
8+
- [ ] 2.2 Refresh CLI docs/README/help text to mention the scaffold workflow, template bundle contents, and when to add spec deltas manually.
89

910
## 3. Test coverage
10-
- [ ] 3.1 Add unit tests covering name validation, file generation, and idempotent reruns.
11-
- [ ] 3.2 Add integration coverage ensuring generated files pass `openspec validate --strict` without manual edits.
11+
- [ ] 3.1 Add unit tests covering name validation, template copying, and existing-directory failures.
12+
- [ ] 3.2 Add integration coverage ensuring a freshly scaffolded change (without deltas) passes `openspec validate --strict` until the author customizes it.

0 commit comments

Comments
 (0)