Skip to content

Commit d32d49f

Browse files
chore(openspec): archive schema init force validation change (#1467)
1 parent 9a61f3f commit d32d49f

6 files changed

Lines changed: 20 additions & 1 deletion

File tree

openspec/changes/fix-schema-init-force-validation-order/.openspec.yaml renamed to openspec/changes/archive/2026-07-28-fix-schema-init-force-validation-order/.openspec.yaml

File renamed without changes.

openspec/changes/fix-schema-init-force-validation-order/design.md renamed to openspec/changes/archive/2026-07-28-fix-schema-init-force-validation-order/design.md

File renamed without changes.

openspec/changes/fix-schema-init-force-validation-order/proposal.md renamed to openspec/changes/archive/2026-07-28-fix-schema-init-force-validation-order/proposal.md

File renamed without changes.

openspec/changes/fix-schema-init-force-validation-order/specs/schema-init-command/spec.md renamed to openspec/changes/archive/2026-07-28-fix-schema-init-force-validation-order/specs/schema-init-command/spec.md

File renamed without changes.

openspec/changes/fix-schema-init-force-validation-order/tasks.md renamed to openspec/changes/archive/2026-07-28-fix-schema-init-force-validation-order/tasks.md

File renamed without changes.

openspec/specs/schema-init-command/spec.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
## Purpose
44
Define `openspec schema init` behavior for creating project-local schema skeletons in interactive and non-interactive modes.
5-
65
## Requirements
76
### Requirement: Schema init command creates project-local schema
87
The CLI SHALL provide an `openspec schema init <name>` command that creates a new schema directory under `openspec/schemas/<name>/` with a valid `schema.yaml` file and default template files.
@@ -74,3 +73,23 @@ The CLI SHALL support `--json` flag for machine-readable output.
7473
- **THEN** system outputs JSON with `error` field describing the issue
7574
- **AND** exits with non-zero code
7675

76+
### Requirement: Schema init validates artifacts before forced replacement
77+
The CLI SHALL validate all requested artifact IDs before replacing an existing project-local schema. If artifact validation fails, the CLI SHALL leave the existing schema directory and all of its contents unchanged on every supported platform.
78+
79+
#### Scenario: Unknown artifact preserves existing schema
80+
- **GIVEN** `openspec/schemas/tdd-driven/` already exists with user-authored files
81+
- **WHEN** the user runs `schema init tdd-driven` with `--force` and an artifact list containing the unknown ID `task`
82+
- **THEN** the command exits with a non-zero status and reports the unknown artifact
83+
- **AND** the existing `tdd-driven` schema directory and its contents remain unchanged
84+
85+
#### Scenario: Unknown artifact preserves a schema at a Windows project path
86+
- **GIVEN** an existing project-local schema is resolved from a Windows filesystem path
87+
- **WHEN** forced schema initialization fails artifact validation
88+
- **THEN** the resolved schema directory and its contents remain unchanged
89+
90+
#### Scenario: Valid artifacts allow forced replacement
91+
- **GIVEN** a project-local schema already exists
92+
- **WHEN** the user runs `schema init` with `--force` and only valid artifact IDs
93+
- **THEN** the command replaces the existing schema with the newly generated schema
94+
- **AND** reports successful creation
95+

0 commit comments

Comments
 (0)