openspecui 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitmodules +3 -0
- package/CHAT.md +3 -0
- package/package.json +12 -0
- package/references/openspec/.changeset/README.md +6 -0
- package/references/openspec/.changeset/config.json +12 -0
- package/references/openspec/.coderabbit.yaml +11 -0
- package/references/openspec/.devcontainer/README.md +92 -0
- package/references/openspec/.devcontainer/devcontainer.json +68 -0
- package/references/openspec/.github/CODEOWNERS +2 -0
- package/references/openspec/.github/workflows/ci.yml +222 -0
- package/references/openspec/.github/workflows/release-prepare.yml +50 -0
- package/references/openspec/AGENTS.md +18 -0
- package/references/openspec/CHANGELOG.md +205 -0
- package/references/openspec/LICENSE +22 -0
- package/references/openspec/README.md +374 -0
- package/references/openspec/assets/openspec_dashboard.png +0 -0
- package/references/openspec/assets/openspec_pixel_dark.svg +89 -0
- package/references/openspec/assets/openspec_pixel_light.svg +89 -0
- package/references/openspec/bin/openspec.js +3 -0
- package/references/openspec/build.js +31 -0
- package/references/openspec/openspec/AGENTS.md +454 -0
- package/references/openspec/openspec/changes/IMPLEMENTATION_ORDER.md +68 -0
- package/references/openspec/openspec/changes/add-antigravity-support/proposal.md +11 -0
- package/references/openspec/openspec/changes/add-antigravity-support/specs/cli-init/spec.md +9 -0
- package/references/openspec/openspec/changes/add-antigravity-support/specs/cli-update/spec.md +8 -0
- package/references/openspec/openspec/changes/add-antigravity-support/tasks.md +12 -0
- package/references/openspec/openspec/changes/add-scaffold-command/proposal.md +11 -0
- package/references/openspec/openspec/changes/add-scaffold-command/specs/cli-scaffold/spec.md +36 -0
- package/references/openspec/openspec/changes/add-scaffold-command/tasks.md +12 -0
- package/references/openspec/openspec/changes/archive/2025-01-11-add-update-command/design.md +86 -0
- package/references/openspec/openspec/changes/archive/2025-01-11-add-update-command/proposal.md +29 -0
- package/references/openspec/openspec/changes/archive/2025-01-11-add-update-command/specs/cli-update/spec.md +59 -0
- package/references/openspec/openspec/changes/archive/2025-01-11-add-update-command/tasks.md +20 -0
- package/references/openspec/openspec/changes/archive/2025-01-13-add-list-command/proposal.md +20 -0
- package/references/openspec/openspec/changes/archive/2025-01-13-add-list-command/specs/cli-list/spec.md +69 -0
- package/references/openspec/openspec/changes/archive/2025-01-13-add-list-command/tasks.md +26 -0
- package/references/openspec/openspec/changes/archive/2025-08-05-initialize-typescript-project/design.md +64 -0
- package/references/openspec/openspec/changes/archive/2025-08-05-initialize-typescript-project/proposal.md +18 -0
- package/references/openspec/openspec/changes/archive/2025-08-05-initialize-typescript-project/tasks.md +25 -0
- package/references/openspec/openspec/changes/archive/2025-08-06-add-init-command/design.md +104 -0
- package/references/openspec/openspec/changes/archive/2025-08-06-add-init-command/proposal.md +30 -0
- package/references/openspec/openspec/changes/archive/2025-08-06-add-init-command/specs/cli-init/spec.md +148 -0
- package/references/openspec/openspec/changes/archive/2025-08-06-add-init-command/tasks.md +38 -0
- package/references/openspec/openspec/changes/archive/2025-08-06-adopt-future-state-storage/proposal.md +24 -0
- package/references/openspec/openspec/changes/archive/2025-08-06-adopt-future-state-storage/specs/openspec-conventions/spec.md +120 -0
- package/references/openspec/openspec/changes/archive/2025-08-06-adopt-future-state-storage/tasks.md +38 -0
- package/references/openspec/openspec/changes/archive/2025-08-11-add-complexity-guidelines/proposal.md +13 -0
- package/references/openspec/openspec/changes/archive/2025-08-11-add-complexity-guidelines/specs/openspec-docs/README.md +472 -0
- package/references/openspec/openspec/changes/archive/2025-08-11-add-complexity-guidelines/tasks.md +9 -0
- package/references/openspec/openspec/changes/archive/2025-08-13-add-archive-command/proposal.md +15 -0
- package/references/openspec/openspec/changes/archive/2025-08-13-add-archive-command/specs/cli-archive/spec.md +111 -0
- package/references/openspec/openspec/changes/archive/2025-08-13-add-archive-command/tasks.md +44 -0
- package/references/openspec/openspec/changes/archive/2025-08-13-add-diff-command/proposal.md +19 -0
- package/references/openspec/openspec/changes/archive/2025-08-13-add-diff-command/specs/cli-diff/spec.md +77 -0
- package/references/openspec/openspec/changes/archive/2025-08-13-add-diff-command/tasks.md +23 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-add-change-commands/design.md +56 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-add-change-commands/proposal.md +17 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-add-change-commands/specs/cli-change/spec.md +48 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-add-change-commands/specs/cli-list/spec.md +12 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-add-change-commands/tasks.md +34 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-add-interactive-show-command/proposal.md +20 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-add-interactive-show-command/specs/cli-change/spec.md +23 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-add-interactive-show-command/specs/cli-show/spec.md +83 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-add-interactive-show-command/specs/cli-spec/spec.md +23 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-add-interactive-show-command/tasks.md +142 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-add-skip-specs-archive-option/proposal.md +13 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-add-skip-specs-archive-option/specs/cli-archive/spec.md +191 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-add-skip-specs-archive-option/tasks.md +57 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-add-spec-commands/design.md +45 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-add-spec-commands/proposal.md +19 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-add-spec-commands/specs/cli-spec/spec.md +43 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-add-spec-commands/tasks.md +22 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-add-zod-validation/design.md +104 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-add-zod-validation/proposal.md +22 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-add-zod-validation/specs/cli-archive/spec.md +18 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-add-zod-validation/specs/cli-diff/spec.md +12 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-add-zod-validation/tasks.md +59 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-adopt-delta-based-changes/proposal.md +93 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-adopt-delta-based-changes/specs/cli-archive/spec.md +48 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-adopt-delta-based-changes/specs/cli-diff/spec.md +45 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-adopt-delta-based-changes/specs/openspec-conventions/spec.md +101 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-adopt-delta-based-changes/tasks.md +55 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-adopt-verb-noun-cli-structure/design.md +19 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-adopt-verb-noun-cli-structure/proposal.md +67 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-adopt-verb-noun-cli-structure/specs/cli-list/spec.md +57 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-adopt-verb-noun-cli-structure/specs/openspec-conventions/spec.md +23 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-adopt-verb-noun-cli-structure/tasks.md +27 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-bulk-validation-interactive-selection/proposal.md +20 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-bulk-validation-interactive-selection/specs/cli-change/spec.md +22 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-bulk-validation-interactive-selection/specs/cli-spec/spec.md +23 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-bulk-validation-interactive-selection/specs/cli-validate/spec.md +149 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-bulk-validation-interactive-selection/tasks.md +81 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-fix-update-tool-selection/proposal.md +40 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-fix-update-tool-selection/specs/cli-update/spec.md +23 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-fix-update-tool-selection/tasks.md +21 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-improve-validate-error-messages/proposal.md +25 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-improve-validate-error-messages/specs/cli-validate/spec.md +55 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-improve-validate-error-messages/tasks.md +21 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-structured-spec-format/proposal.md +36 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-structured-spec-format/specs/openspec-conventions/spec.md +192 -0
- package/references/openspec/openspec/changes/archive/2025-08-19-structured-spec-format/tasks.md +19 -0
- package/references/openspec/openspec/changes/archive/2025-09-12-add-view-dashboard-command/proposal.md +38 -0
- package/references/openspec/openspec/changes/archive/2025-09-12-add-view-dashboard-command/specs/cli-view/spec.md +109 -0
- package/references/openspec/openspec/changes/archive/2025-09-12-add-view-dashboard-command/tasks.md +47 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-add-agents-md-config/proposal.md +28 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-add-agents-md-config/specs/cli-init/spec.md +71 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-add-agents-md-config/specs/cli-update/spec.md +41 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-add-agents-md-config/tasks.md +17 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-add-multi-agent-init/proposal.md +35 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-add-multi-agent-init/specs/cli-init/spec.md +45 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-add-multi-agent-init/tasks.md +16 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-add-slash-command-support/proposal.md +119 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-add-slash-command-support/specs/cli-init/spec.md +21 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-add-slash-command-support/specs/cli-update/spec.md +22 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-add-slash-command-support/tasks.md +20 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-improve-cli-e2e-plan/proposal.md +19 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-improve-cli-e2e-plan/tasks.md +9 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-improve-deterministic-tests/proposal.md +78 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-improve-deterministic-tests/tasks.md +25 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-improve-init-onboarding/proposal.md +13 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-improve-init-onboarding/specs/cli-init/spec.md +92 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-improve-init-onboarding/tasks.md +12 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-remove-diff-command/proposal.md +81 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-remove-diff-command/tasks.md +37 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-sort-active-changes-by-progress/proposal.md +25 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-sort-active-changes-by-progress/specs/cli-view/spec.md +9 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-sort-active-changes-by-progress/tasks.md +8 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-update-agent-file-name/proposal.md +29 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-update-agent-file-name/specs/cli-init/spec.md +40 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-update-agent-file-name/specs/cli-update/spec.md +22 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-update-agent-file-name/specs/openspec-conventions/spec.md +27 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-update-agent-file-name/tasks.md +22 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-update-agent-instructions/design.md +130 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-update-agent-instructions/proposal.md +117 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-update-agent-instructions/tasks.md +69 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-update-markdown-parser-crlf/proposal.md +19 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-update-markdown-parser-crlf/specs/cli-validate/spec.md +9 -0
- package/references/openspec/openspec/changes/archive/2025-09-29-update-markdown-parser-crlf/tasks.md +11 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-add-codex-slash-command-support/proposal.md +25 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-add-codex-slash-command-support/specs/cli-init/spec.md +56 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-add-codex-slash-command-support/specs/cli-update/spec.md +41 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-add-codex-slash-command-support/tasks.md +19 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-add-github-copilot-prompts/proposal.md +25 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-add-github-copilot-prompts/specs/cli-init/spec.md +48 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-add-github-copilot-prompts/specs/cli-update/spec.md +48 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-add-github-copilot-prompts/tasks.md +30 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-add-kilocode-workflows/proposal.md +17 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-add-kilocode-workflows/specs/cli-init/spec.md +43 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-add-kilocode-workflows/specs/cli-update/spec.md +27 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-add-kilocode-workflows/tasks.md +15 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-add-non-interactive-init-options/proposal.md +12 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-add-non-interactive-init-options/specs/cli-init/spec.md +39 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-add-non-interactive-init-options/tasks.md +17 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-add-windsurf-workflows/proposal.md +17 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-add-windsurf-workflows/specs/cli-init/spec.md +42 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-add-windsurf-workflows/specs/cli-update/spec.md +27 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-add-windsurf-workflows/tasks.md +17 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-enhance-validation-error-messages/proposal.md +12 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-enhance-validation-error-messages/specs/cli-validate/spec.md +39 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-enhance-validation-error-messages/tasks.md +12 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-improve-agent-instruction-usability/proposal.md +12 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-improve-agent-instruction-usability/specs/docs-agent-instructions/spec.md +33 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-improve-agent-instruction-usability/tasks.md +11 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-slim-root-agents-file/proposal.md +13 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-slim-root-agents-file/tasks.md +15 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-update-cli-init-enter-selection/proposal.md +14 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-update-cli-init-enter-selection/specs/cli-init/spec.md +10 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-update-cli-init-enter-selection/tasks.md +8 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-update-cli-init-root-agents/proposal.md +15 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-update-cli-init-root-agents/specs/cli-init/spec.md +32 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-update-cli-init-root-agents/specs/cli-update/spec.md +10 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-update-cli-init-root-agents/tasks.md +11 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-update-release-automation/proposal.md +49 -0
- package/references/openspec/openspec/changes/archive/2025-10-14-update-release-automation/tasks.md +12 -0
- package/references/openspec/openspec/changes/archive/2025-10-22-add-archive-command-arguments/proposal.md +17 -0
- package/references/openspec/openspec/changes/archive/2025-10-22-add-archive-command-arguments/specs/cli-update/spec.md +32 -0
- package/references/openspec/openspec/changes/archive/2025-10-22-add-archive-command-arguments/tasks.md +15 -0
- package/references/openspec/openspec/changes/archive/2025-10-22-add-cline-support/proposal.md +15 -0
- package/references/openspec/openspec/changes/archive/2025-10-22-add-cline-support/specs/cli-init/spec.md +97 -0
- package/references/openspec/openspec/changes/archive/2025-10-22-add-cline-support/tasks.md +19 -0
- package/references/openspec/openspec/changes/archive/2025-10-22-add-crush-support/proposal.md +13 -0
- package/references/openspec/openspec/changes/archive/2025-10-22-add-crush-support/specs/cli-init/spec.md +67 -0
- package/references/openspec/openspec/changes/archive/2025-10-22-add-crush-support/tasks.md +7 -0
- package/references/openspec/openspec/changes/archive/2025-10-22-add-factory-slash-commands/proposal.md +12 -0
- package/references/openspec/openspec/changes/archive/2025-10-22-add-factory-slash-commands/specs/cli-init/spec.md +54 -0
- package/references/openspec/openspec/changes/archive/2025-10-22-add-factory-slash-commands/specs/cli-update/spec.md +54 -0
- package/references/openspec/openspec/changes/archive/2025-10-22-add-factory-slash-commands/tasks.md +11 -0
- package/references/openspec/openspec/changes/fix-cline-workflows-implementation/proposal.md +13 -0
- package/references/openspec/openspec/changes/fix-cline-workflows-implementation/specs/cli-init/spec.md +11 -0
- package/references/openspec/openspec/changes/fix-cline-workflows-implementation/tasks.md +13 -0
- package/references/openspec/openspec/changes/make-validation-scope-aware/proposal.md +12 -0
- package/references/openspec/openspec/changes/make-validation-scope-aware/specs/cli-validate/spec.md +25 -0
- package/references/openspec/openspec/changes/make-validation-scope-aware/tasks.md +16 -0
- package/references/openspec/openspec/project.md +53 -0
- package/references/openspec/openspec/specs/cli-archive/spec.md +210 -0
- package/references/openspec/openspec/specs/cli-change/spec.md +91 -0
- package/references/openspec/openspec/specs/cli-init/spec.md +311 -0
- package/references/openspec/openspec/specs/cli-list/spec.md +103 -0
- package/references/openspec/openspec/specs/cli-show/spec.md +85 -0
- package/references/openspec/openspec/specs/cli-spec/spec.md +87 -0
- package/references/openspec/openspec/specs/cli-update/spec.md +190 -0
- package/references/openspec/openspec/specs/cli-validate/spec.md +218 -0
- package/references/openspec/openspec/specs/cli-view/spec.md +105 -0
- package/references/openspec/openspec/specs/docs-agent-instructions/spec.md +38 -0
- package/references/openspec/openspec/specs/openspec-conventions/spec.md +474 -0
- package/references/openspec/openspec-parallel-merge-plan.md +98 -0
- package/references/openspec/package.json +73 -0
- package/references/openspec/pnpm-lock.yaml +2324 -0
- package/references/openspec/scripts/pack-version-check.mjs +111 -0
- package/references/openspec/src/cli/index.ts +253 -0
- package/references/openspec/src/commands/change.ts +291 -0
- package/references/openspec/src/commands/show.ts +139 -0
- package/references/openspec/src/commands/spec.ts +250 -0
- package/references/openspec/src/commands/validate.ts +305 -0
- package/references/openspec/src/core/archive.ts +606 -0
- package/references/openspec/src/core/config.ts +41 -0
- package/references/openspec/src/core/configurators/agents.ts +23 -0
- package/references/openspec/src/core/configurators/base.ts +6 -0
- package/references/openspec/src/core/configurators/claude.ts +23 -0
- package/references/openspec/src/core/configurators/cline.ts +23 -0
- package/references/openspec/src/core/configurators/codebuddy.ts +24 -0
- package/references/openspec/src/core/configurators/costrict.ts +23 -0
- package/references/openspec/src/core/configurators/iflow.ts +23 -0
- package/references/openspec/src/core/configurators/qoder.ts +53 -0
- package/references/openspec/src/core/configurators/qwen.ts +47 -0
- package/references/openspec/src/core/configurators/registry.ts +49 -0
- package/references/openspec/src/core/configurators/slash/amazon-q.ts +51 -0
- package/references/openspec/src/core/configurators/slash/antigravity.ts +28 -0
- package/references/openspec/src/core/configurators/slash/auggie.ts +37 -0
- package/references/openspec/src/core/configurators/slash/base.ts +95 -0
- package/references/openspec/src/core/configurators/slash/claude.ts +42 -0
- package/references/openspec/src/core/configurators/slash/cline.ts +27 -0
- package/references/openspec/src/core/configurators/slash/codebuddy.ts +43 -0
- package/references/openspec/src/core/configurators/slash/codex.ts +126 -0
- package/references/openspec/src/core/configurators/slash/costrict.ts +36 -0
- package/references/openspec/src/core/configurators/slash/crush.ts +42 -0
- package/references/openspec/src/core/configurators/slash/cursor.ts +42 -0
- package/references/openspec/src/core/configurators/slash/factory.ts +41 -0
- package/references/openspec/src/core/configurators/slash/gemini.ts +27 -0
- package/references/openspec/src/core/configurators/slash/github-copilot.ts +39 -0
- package/references/openspec/src/core/configurators/slash/iflow.ts +42 -0
- package/references/openspec/src/core/configurators/slash/kilocode.ts +21 -0
- package/references/openspec/src/core/configurators/slash/opencode.ts +83 -0
- package/references/openspec/src/core/configurators/slash/qoder.ts +84 -0
- package/references/openspec/src/core/configurators/slash/qwen.ts +55 -0
- package/references/openspec/src/core/configurators/slash/registry.ts +81 -0
- package/references/openspec/src/core/configurators/slash/roocode.ts +27 -0
- package/references/openspec/src/core/configurators/slash/toml-base.ts +66 -0
- package/references/openspec/src/core/configurators/slash/windsurf.ts +27 -0
- package/references/openspec/src/core/converters/json-converter.ts +61 -0
- package/references/openspec/src/core/index.ts +2 -0
- package/references/openspec/src/core/init.ts +986 -0
- package/references/openspec/src/core/list.ts +104 -0
- package/references/openspec/src/core/parsers/change-parser.ts +234 -0
- package/references/openspec/src/core/parsers/markdown-parser.ts +237 -0
- package/references/openspec/src/core/parsers/requirement-blocks.ts +234 -0
- package/references/openspec/src/core/schemas/base.schema.ts +20 -0
- package/references/openspec/src/core/schemas/change.schema.ts +42 -0
- package/references/openspec/src/core/schemas/index.ts +20 -0
- package/references/openspec/src/core/schemas/spec.schema.ts +17 -0
- package/references/openspec/src/core/styles/palette.ts +8 -0
- package/references/openspec/src/core/templates/agents-root-stub.ts +16 -0
- package/references/openspec/src/core/templates/agents-template.ts +457 -0
- package/references/openspec/src/core/templates/claude-template.ts +1 -0
- package/references/openspec/src/core/templates/cline-template.ts +1 -0
- package/references/openspec/src/core/templates/costrict-template.ts +1 -0
- package/references/openspec/src/core/templates/index.ts +50 -0
- package/references/openspec/src/core/templates/project-template.ts +38 -0
- package/references/openspec/src/core/templates/slash-command-templates.ts +60 -0
- package/references/openspec/src/core/update.ts +129 -0
- package/references/openspec/src/core/validation/constants.ts +48 -0
- package/references/openspec/src/core/validation/types.ts +19 -0
- package/references/openspec/src/core/validation/validator.ts +448 -0
- package/references/openspec/src/core/view.ts +189 -0
- package/references/openspec/src/index.ts +2 -0
- package/references/openspec/src/utils/file-system.ts +187 -0
- package/references/openspec/src/utils/index.ts +2 -0
- package/references/openspec/src/utils/interactive.ts +7 -0
- package/references/openspec/src/utils/item-discovery.ts +45 -0
- package/references/openspec/src/utils/match.ts +26 -0
- package/references/openspec/src/utils/task-progress.ts +43 -0
- package/references/openspec/test/cli-e2e/basic.test.ts +156 -0
- package/references/openspec/test/commands/change.interactive-show.test.ts +45 -0
- package/references/openspec/test/commands/change.interactive-validate.test.ts +48 -0
- package/references/openspec/test/commands/show.test.ts +123 -0
- package/references/openspec/test/commands/spec.interactive-show.test.ts +44 -0
- package/references/openspec/test/commands/spec.interactive-validate.test.ts +44 -0
- package/references/openspec/test/commands/spec.test.ts +324 -0
- package/references/openspec/test/commands/validate.enriched-output.test.ts +49 -0
- package/references/openspec/test/commands/validate.test.ts +133 -0
- package/references/openspec/test/core/archive.test.ts +680 -0
- package/references/openspec/test/core/commands/change-command.list.test.ts +76 -0
- package/references/openspec/test/core/commands/change-command.show-validate.test.ts +111 -0
- package/references/openspec/test/core/converters/json-converter.test.ts +184 -0
- package/references/openspec/test/core/init.test.ts +1710 -0
- package/references/openspec/test/core/list.test.ts +165 -0
- package/references/openspec/test/core/parsers/change-parser.test.ts +52 -0
- package/references/openspec/test/core/parsers/markdown-parser.test.ts +291 -0
- package/references/openspec/test/core/update.test.ts +1642 -0
- package/references/openspec/test/core/validation.enriched-messages.test.ts +74 -0
- package/references/openspec/test/core/validation.test.ts +489 -0
- package/references/openspec/test/core/view.test.ts +79 -0
- package/references/openspec/test/fixtures/tmp-init/openspec/changes/c1/proposal.md +7 -0
- package/references/openspec/test/fixtures/tmp-init/openspec/changes/c1/specs/alpha/spec.md +8 -0
- package/references/openspec/test/fixtures/tmp-init/openspec/specs/alpha/spec.md +12 -0
- package/references/openspec/test/helpers/run-cli.ts +139 -0
- package/references/openspec/test/utils/file-system.test.ts +211 -0
- package/references/openspec/test/utils/marker-updates.test.ts +287 -0
- package/references/openspec/tsconfig.json +21 -0
- package/references/openspec/vitest.config.ts +25 -0
- package/references/openspec/vitest.setup.ts +6 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# CLI Archive Command Specification
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
The archive command moves completed changes from the active changes directory to the archive folder with date-based naming, following OpenSpec conventions.
|
|
5
|
+
|
|
6
|
+
## Command Syntax
|
|
7
|
+
```bash
|
|
8
|
+
openspec archive [change-name] [--yes|-y] [--skip-specs]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Options:
|
|
12
|
+
- `--yes`, `-y`: Skip confirmation prompts (for automation)
|
|
13
|
+
- `--skip-specs`: Skip spec update operations entirely (for changes without spec modifications)
|
|
14
|
+
|
|
15
|
+
## Behavior
|
|
16
|
+
|
|
17
|
+
### Requirement: Change Selection
|
|
18
|
+
|
|
19
|
+
The command SHALL support both interactive and direct change selection methods.
|
|
20
|
+
|
|
21
|
+
#### Scenario: Interactive selection
|
|
22
|
+
|
|
23
|
+
- **WHEN** no change-name is provided
|
|
24
|
+
- **THEN** display interactive list of available changes (excluding archive/)
|
|
25
|
+
- **AND** allow user to select one
|
|
26
|
+
|
|
27
|
+
#### Scenario: Direct selection
|
|
28
|
+
|
|
29
|
+
- **WHEN** change-name is provided
|
|
30
|
+
- **THEN** use that change directly
|
|
31
|
+
- **AND** validate it exists
|
|
32
|
+
|
|
33
|
+
### Requirement: Task Completion Check
|
|
34
|
+
|
|
35
|
+
The command SHALL verify task completion status before archiving to prevent premature archival.
|
|
36
|
+
|
|
37
|
+
#### Scenario: Incomplete tasks found
|
|
38
|
+
|
|
39
|
+
- **WHEN** incomplete tasks are found (marked with `- [ ]`)
|
|
40
|
+
- **THEN** display all incomplete tasks to the user
|
|
41
|
+
- **AND** prompt for confirmation to continue
|
|
42
|
+
- **AND** default to "No" for safety
|
|
43
|
+
|
|
44
|
+
#### Scenario: All tasks complete
|
|
45
|
+
|
|
46
|
+
- **WHEN** all tasks are complete OR no tasks.md exists
|
|
47
|
+
- **THEN** proceed with archiving without prompting
|
|
48
|
+
|
|
49
|
+
### Requirement: Archive Process
|
|
50
|
+
|
|
51
|
+
The archive operation SHALL follow a structured process to safely move changes to the archive.
|
|
52
|
+
|
|
53
|
+
#### Scenario: Performing archive
|
|
54
|
+
|
|
55
|
+
- **WHEN** archiving a change
|
|
56
|
+
- **THEN** execute these steps:
|
|
57
|
+
1. Create archive/ directory if it doesn't exist
|
|
58
|
+
2. Generate target name as `YYYY-MM-DD-[change-name]` using current date
|
|
59
|
+
3. Check if target directory already exists
|
|
60
|
+
4. Update main specs from the change's future state specs unless `--skip-specs` is provided (see Spec Update Process below)
|
|
61
|
+
5. Move the entire change directory to the archive location
|
|
62
|
+
|
|
63
|
+
#### Scenario: Archive already exists
|
|
64
|
+
|
|
65
|
+
- **WHEN** target archive already exists
|
|
66
|
+
- **THEN** fail with error message
|
|
67
|
+
- **AND** do not overwrite existing archive
|
|
68
|
+
|
|
69
|
+
#### Scenario: Successful archive
|
|
70
|
+
|
|
71
|
+
- **WHEN** move succeeds
|
|
72
|
+
- **THEN** display success message with archived name and list of updated specs (if any)
|
|
73
|
+
|
|
74
|
+
### Requirement: Spec Update Process
|
|
75
|
+
|
|
76
|
+
Before moving the change to archive, the command SHALL update main specs to reflect the deployed reality unless the `--skip-specs` flag is provided.
|
|
77
|
+
|
|
78
|
+
#### Scenario: Skipping spec updates
|
|
79
|
+
|
|
80
|
+
- **WHEN** the `--skip-specs` flag is provided
|
|
81
|
+
- **THEN** skip all spec discovery and update operations
|
|
82
|
+
- **AND** proceed directly to moving the change to archive
|
|
83
|
+
- **AND** display message indicating specs were skipped
|
|
84
|
+
|
|
85
|
+
#### Scenario: Updating specs from change
|
|
86
|
+
|
|
87
|
+
- **WHEN** the change contains specs in `changes/[name]/specs/` AND `--skip-specs` is NOT provided
|
|
88
|
+
- **THEN** execute these steps:
|
|
89
|
+
1. Analyze which specs will be affected by comparing with existing specs
|
|
90
|
+
2. Display a summary of spec updates to the user (see Confirmation Behavior below)
|
|
91
|
+
3. Prompt for confirmation unless `--yes` flag is provided
|
|
92
|
+
4. If confirmed, for each capability spec in the change directory:
|
|
93
|
+
- Copy the spec from `changes/[name]/specs/[capability]/spec.md` to `openspec/specs/[capability]/spec.md`
|
|
94
|
+
- Create the target directory structure if it doesn't exist
|
|
95
|
+
- Overwrite existing spec files (specs represent current reality, change specs are the new reality)
|
|
96
|
+
- Track which specs were updated for the success message
|
|
97
|
+
|
|
98
|
+
#### Scenario: No specs in change
|
|
99
|
+
|
|
100
|
+
- **WHEN** no specs exist in the change AND `--skip-specs` is NOT provided
|
|
101
|
+
- **THEN** skip the spec update step
|
|
102
|
+
- **AND** proceed with archiving
|
|
103
|
+
|
|
104
|
+
### Requirement: Confirmation Behavior
|
|
105
|
+
|
|
106
|
+
The spec update confirmation SHALL provide clear visibility into changes before they are applied.
|
|
107
|
+
|
|
108
|
+
#### Scenario: Displaying confirmation
|
|
109
|
+
|
|
110
|
+
- **WHEN** prompting for confirmation AND `--skip-specs` is NOT provided
|
|
111
|
+
- **THEN** display a clear summary showing:
|
|
112
|
+
- Which specs will be created (new capabilities)
|
|
113
|
+
- Which specs will be updated (existing capabilities)
|
|
114
|
+
- The source path for each spec
|
|
115
|
+
- **AND** format the confirmation prompt as:
|
|
116
|
+
```
|
|
117
|
+
The following specs will be updated:
|
|
118
|
+
|
|
119
|
+
NEW specs to be created:
|
|
120
|
+
- cli-archive (from changes/add-archive-command/specs/cli-archive/spec.md)
|
|
121
|
+
|
|
122
|
+
EXISTING specs to be updated:
|
|
123
|
+
- cli-init (from changes/update-init-command/specs/cli-init/spec.md)
|
|
124
|
+
|
|
125
|
+
Update 2 specs and archive 'add-archive-command'? [y/N]:
|
|
126
|
+
```
|
|
127
|
+
#### Scenario: Handling confirmation response
|
|
128
|
+
|
|
129
|
+
- **WHEN** waiting for user confirmation
|
|
130
|
+
- **THEN** default to "No" for safety (require explicit "y" or "yes")
|
|
131
|
+
- **AND** skip confirmation when `--yes` or `-y` flag is provided
|
|
132
|
+
- **AND** skip entire spec confirmation when `--skip-specs` flag is provided
|
|
133
|
+
|
|
134
|
+
#### Scenario: User declines spec update confirmation
|
|
135
|
+
|
|
136
|
+
- **WHEN** user declines the spec update confirmation
|
|
137
|
+
- **THEN** skip the spec update operations
|
|
138
|
+
- **AND** display message: "Skipping spec updates. Proceeding with archive."
|
|
139
|
+
- **AND** continue with the archive operation
|
|
140
|
+
- **AND** display success message indicating specs were not updated
|
|
141
|
+
|
|
142
|
+
## Error Handling
|
|
143
|
+
|
|
144
|
+
### Requirement: Error Conditions
|
|
145
|
+
|
|
146
|
+
The command SHALL handle various error conditions gracefully.
|
|
147
|
+
|
|
148
|
+
#### Scenario: Handling errors
|
|
149
|
+
|
|
150
|
+
- **WHEN** errors occur
|
|
151
|
+
- **THEN** handle the following conditions:
|
|
152
|
+
- Missing openspec/changes/ directory
|
|
153
|
+
- Change not found
|
|
154
|
+
- Archive target already exists
|
|
155
|
+
- File system permissions issues
|
|
156
|
+
|
|
157
|
+
## Why These Decisions
|
|
158
|
+
|
|
159
|
+
**Interactive selection**: Reduces typing and helps users see available changes
|
|
160
|
+
**Task checking**: Prevents accidental archiving of incomplete work
|
|
161
|
+
**Date prefixing**: Maintains chronological order and prevents naming conflicts
|
|
162
|
+
**No overwrite**: Preserves historical archives and prevents data loss
|
|
163
|
+
**Spec updates before archiving**: Specs in the main directory represent current reality; when a change is deployed and archived, its future state specs become the new reality and must replace the main specs
|
|
164
|
+
**Confirmation for spec updates**: Provides visibility into what will change, prevents accidental overwrites, and ensures users understand the impact before specs are modified
|
|
165
|
+
**Non-blocking confirmation**: Declining spec updates doesn't cancel archiving - users can review specs and choose to update them separately if needed
|
|
166
|
+
**--yes flag for automation**: Allows CI/CD pipelines to archive without interactive prompts while maintaining safety by default for manual use
|
|
167
|
+
**--skip-specs flag**: Enables archiving of changes that don't modify specs (like infrastructure, tooling, or documentation changes) without unnecessary spec update prompts or operations
|
|
168
|
+
|
|
169
|
+
## ADDED Requirements
|
|
170
|
+
|
|
171
|
+
### Requirement: Skip Specs Option
|
|
172
|
+
|
|
173
|
+
The archive command SHALL support a `--skip-specs` flag that skips all spec update operations and proceeds directly to archiving.
|
|
174
|
+
|
|
175
|
+
#### Scenario: Skipping spec updates with flag
|
|
176
|
+
|
|
177
|
+
- **WHEN** executing `openspec archive <change> --skip-specs`
|
|
178
|
+
- **THEN** skip spec discovery and update confirmation
|
|
179
|
+
- **AND** proceed directly to moving the change to archive
|
|
180
|
+
- **AND** display a message indicating specs were skipped
|
|
181
|
+
|
|
182
|
+
### Requirement: Non-blocking confirmation
|
|
183
|
+
|
|
184
|
+
The archive operation SHALL proceed when the user declines spec updates instead of cancelling the entire operation.
|
|
185
|
+
|
|
186
|
+
#### Scenario: User declines spec update confirmation
|
|
187
|
+
|
|
188
|
+
- **WHEN** the user declines spec update confirmation
|
|
189
|
+
- **THEN** skip spec updates
|
|
190
|
+
- **AND** continue with the archive operation
|
|
191
|
+
- **AND** display a success message indicating specs were not updated
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
## 1. Update Archive Command Implementation
|
|
2
|
+
- [x] 1.1 Add `skipSpecs` option to the archive command options interface
|
|
3
|
+
- [x] 1.2 Modify the execute method to skip spec operations when flag is set
|
|
4
|
+
- [x] 1.3 Fix confirmation behavior: when user declines spec updates, proceed with archiving instead of cancelling
|
|
5
|
+
- [x] 1.4 Update console output to indicate when specs are being skipped (via flag or user choice)
|
|
6
|
+
- [x] 1.5 Ensure archive continues after declining spec updates
|
|
7
|
+
|
|
8
|
+
## 2. Update CLI Interface
|
|
9
|
+
- [x] 2.1 Add `--skip-specs` flag to the archive command definition
|
|
10
|
+
- [x] 2.2 Pass the flag value to the archive command execute method
|
|
11
|
+
|
|
12
|
+
## 3. Update Tests
|
|
13
|
+
- [x] 3.1 Add test case for archiving with --skip-specs flag
|
|
14
|
+
- [x] 3.2 Add test case for declining spec updates but continuing with archive
|
|
15
|
+
- [x] 3.3 Verify that spec updates are skipped when flag is used
|
|
16
|
+
- [x] 3.4 Verify that archive proceeds when user declines spec updates
|
|
17
|
+
- [x] 3.5 Ensure existing behavior remains unchanged when flag is not used
|
|
18
|
+
|
|
19
|
+
## 4. Update Documentation
|
|
20
|
+
- [x] 4.1 Update the cli-archive spec to document the new --skip-specs flag
|
|
21
|
+
- [x] 4.2 Document the new behavior when declining spec updates interactively
|
|
22
|
+
|
|
23
|
+
## Implementation Notes
|
|
24
|
+
|
|
25
|
+
### Key Design Decisions
|
|
26
|
+
|
|
27
|
+
1. **Non-blocking Confirmation Behavior**: When users decline spec updates interactively, the archive operation continues rather than cancelling entirely. This was a critical UX improvement because:
|
|
28
|
+
- Users may want to review specs separately before updating them
|
|
29
|
+
- Archiving work shouldn't be blocked by spec review decisions
|
|
30
|
+
- Maintains flexibility in the deployment workflow
|
|
31
|
+
|
|
32
|
+
2. **Flag Naming Convention**: Chose `--skip-specs` for clarity and consistency:
|
|
33
|
+
- Clearly indicates the action (skipping) and target (specs)
|
|
34
|
+
- Follows kebab-case convention for CLI flags
|
|
35
|
+
- Converts naturally to `skipSpecs` camelCase in code
|
|
36
|
+
|
|
37
|
+
3. **Console Messaging Strategy**: Added explicit messages for all spec-skipping scenarios:
|
|
38
|
+
- When flag is used: "Skipping spec updates (--skip-specs flag provided)."
|
|
39
|
+
- When user declines: "Skipping spec updates. Proceeding with archive."
|
|
40
|
+
- Ensures users always understand what's happening with their specs
|
|
41
|
+
|
|
42
|
+
4. **Test Coverage Approach**: Created separate test cases for:
|
|
43
|
+
- Flag-based skipping (explicit user choice via CLI)
|
|
44
|
+
- Interactive declining (runtime user decision)
|
|
45
|
+
- Both verify the same outcome but test different code paths
|
|
46
|
+
|
|
47
|
+
### Use Cases Addressed
|
|
48
|
+
|
|
49
|
+
- **Infrastructure Changes**: Changes to build tools, CI/CD, dependencies
|
|
50
|
+
- **Documentation Updates**: README updates, comment improvements
|
|
51
|
+
- **Tooling Modifications**: Developer tools, scripts, configuration files
|
|
52
|
+
- **Refactoring**: Code improvements that don't change functionality/specs
|
|
53
|
+
|
|
54
|
+
### Future Considerations
|
|
55
|
+
|
|
56
|
+
- Could potentially auto-detect when changes don't include specs and suggest using the flag
|
|
57
|
+
- May want to track which archives skipped spec updates for audit purposes
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Design: Spec Commands
|
|
2
|
+
|
|
3
|
+
## Architecture Decisions
|
|
4
|
+
|
|
5
|
+
### Command Hierarchy
|
|
6
|
+
We chose a subcommand pattern (`spec show`, `spec list`, `spec validate`) to:
|
|
7
|
+
- Group related functionality under a common namespace
|
|
8
|
+
- Enable future extensibility without polluting the top-level CLI
|
|
9
|
+
- Maintain consistency with the planned `change` command structure
|
|
10
|
+
|
|
11
|
+
### JSON Schema Structure
|
|
12
|
+
The spec JSON schema follows this structure:
|
|
13
|
+
```typescript
|
|
14
|
+
{
|
|
15
|
+
version: string, // Schema version for compatibility
|
|
16
|
+
format: "spec", // Identifies this as a spec document
|
|
17
|
+
sourcePath: string, // Original markdown file path
|
|
18
|
+
id: string, // Spec identifier from filename
|
|
19
|
+
title: string, // Human-readable title
|
|
20
|
+
overview?: string, // Optional overview section
|
|
21
|
+
requirements: Array<{
|
|
22
|
+
id: string,
|
|
23
|
+
text: string,
|
|
24
|
+
scenarios: Array<{
|
|
25
|
+
id: string,
|
|
26
|
+
text: string
|
|
27
|
+
}>
|
|
28
|
+
}>
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Rationale:**
|
|
33
|
+
- Flat structure for requirements array (vs nested objects) for easier iteration
|
|
34
|
+
- Scenarios nested within requirements to maintain relationship
|
|
35
|
+
- Metadata fields (version, format, sourcePath) for tooling integration
|
|
36
|
+
|
|
37
|
+
### Parser Architecture
|
|
38
|
+
- **Markdown-first approach**: Parse markdown headings rather than custom syntax
|
|
39
|
+
- **Streaming parser**: Process line-by-line to handle large files efficiently
|
|
40
|
+
- **Strict heading hierarchy**: Enforce ##/###/#### structure for consistency
|
|
41
|
+
|
|
42
|
+
### Validation Strategy
|
|
43
|
+
- **Parse-time validation**: Catch structural issues during parsing
|
|
44
|
+
- **Schema validation**: Use Zod for runtime type checking of parsed data
|
|
45
|
+
- **Separate validation command**: Allow validation without full parsing/conversion
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Change: Add Spec Commands with JSON Output
|
|
2
|
+
|
|
3
|
+
## Why
|
|
4
|
+
|
|
5
|
+
Currently, OpenSpec specs can only be viewed as markdown files. This makes programmatic access difficult and prevents integration with CI/CD pipelines, external tools, and automated processing.
|
|
6
|
+
|
|
7
|
+
## What Changes
|
|
8
|
+
|
|
9
|
+
- Add new `openspec spec` command with three subcommands: `show`, `list`, and `validate`
|
|
10
|
+
- Implement JSON output capability for specs using heading-based parsing
|
|
11
|
+
- Add Zod schemas for spec structure validation
|
|
12
|
+
- Enable content filtering options (requirements only, no scenarios, specific requirement)
|
|
13
|
+
|
|
14
|
+
## Impact
|
|
15
|
+
|
|
16
|
+
- **Affected specs**: None (new capability)
|
|
17
|
+
- **Affected code**:
|
|
18
|
+
- src/cli/index.ts (register new command)
|
|
19
|
+
- package.json (add zod dependency)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
## ADDED Requirements
|
|
2
|
+
|
|
3
|
+
### Requirement: Spec Command
|
|
4
|
+
|
|
5
|
+
The system SHALL provide a `spec` command with subcommands for displaying, listing, and validating specifications.
|
|
6
|
+
|
|
7
|
+
#### Scenario: Show spec as JSON
|
|
8
|
+
|
|
9
|
+
- **WHEN** executing `openspec spec show init --json`
|
|
10
|
+
- **THEN** parse the markdown spec file
|
|
11
|
+
- **AND** extract headings and content hierarchically
|
|
12
|
+
- **AND** output valid JSON to stdout
|
|
13
|
+
|
|
14
|
+
#### Scenario: List all specs
|
|
15
|
+
|
|
16
|
+
- **WHEN** executing `openspec spec list`
|
|
17
|
+
- **THEN** scan the openspec/specs directory
|
|
18
|
+
- **AND** return list of all available capabilities
|
|
19
|
+
- **AND** support JSON output with `--json` flag
|
|
20
|
+
|
|
21
|
+
#### Scenario: Filter spec content
|
|
22
|
+
|
|
23
|
+
- **WHEN** executing `openspec spec show init --requirements`
|
|
24
|
+
- **THEN** display only requirement names and SHALL statements
|
|
25
|
+
- **AND** exclude scenario content
|
|
26
|
+
|
|
27
|
+
#### Scenario: Validate spec structure
|
|
28
|
+
|
|
29
|
+
- **WHEN** executing `openspec spec validate init`
|
|
30
|
+
- **THEN** parse the spec file
|
|
31
|
+
- **AND** validate against Zod schema
|
|
32
|
+
- **AND** report any structural issues
|
|
33
|
+
|
|
34
|
+
### Requirement: JSON Schema Definition
|
|
35
|
+
|
|
36
|
+
The system SHALL define Zod schemas that accurately represent the spec structure for runtime validation.
|
|
37
|
+
|
|
38
|
+
#### Scenario: Schema validation
|
|
39
|
+
|
|
40
|
+
- **WHEN** parsing a spec into JSON
|
|
41
|
+
- **THEN** validate the structure using Zod schemas
|
|
42
|
+
- **AND** ensure all required fields are present
|
|
43
|
+
- **AND** provide clear error messages for validation failures
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Implementation Tasks (Phase 3: Builds on add-zod-validation and add-change-commands)
|
|
2
|
+
|
|
3
|
+
## 1. Command Implementation
|
|
4
|
+
- [x] 1.1 Create src/commands/spec.ts
|
|
5
|
+
- [x] 1.2 Import RequirementSchema, ScenarioSchema, SpecSchema from src/core/schemas/
|
|
6
|
+
- [x] 1.3 Import markdown parser from src/core/parsers/markdown-parser.ts
|
|
7
|
+
- [x] 1.4 Import SpecValidator from src/core/validation/validator.ts
|
|
8
|
+
- [x] 1.5 Import JSON converter from src/core/converters/json-converter.ts
|
|
9
|
+
- [x] 1.6 Implement show subcommand with JSON output using existing converter
|
|
10
|
+
- [x] 1.7 Implement list subcommand
|
|
11
|
+
- [x] 1.8 Implement validate subcommand using existing SpecValidator
|
|
12
|
+
- [x] 1.9 Add filtering options (--requirements, --no-scenarios, -r)
|
|
13
|
+
- [x] 1.10 Add --strict mode support (leveraging existing validation infrastructure)
|
|
14
|
+
- [x] 1.11 Add --json flag for validation reports
|
|
15
|
+
|
|
16
|
+
## 2. Integration
|
|
17
|
+
- [x] 2.1 Register spec command in src/cli/index.ts
|
|
18
|
+
- [x] 2.2 Add integration tests for all subcommands
|
|
19
|
+
- [x] 2.3 Test JSON output validation
|
|
20
|
+
- [x] 2.4 Test filtering options
|
|
21
|
+
- [x] 2.5 Test validation with strict mode
|
|
22
|
+
- [x] 2.6 Update CLI help documentation (add 'spec' command to main help, document subcommands: show, list, validate)
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Design: Zod Validation Framework
|
|
2
|
+
|
|
3
|
+
## Architecture Decisions
|
|
4
|
+
|
|
5
|
+
### Validation Levels
|
|
6
|
+
Three-tier validation system:
|
|
7
|
+
1. **ERROR**: Structural issues that prevent parsing (must fix)
|
|
8
|
+
2. **WARNING**: Quality issues that should be addressed (recommended fix)
|
|
9
|
+
3. **INFO**: Suggestions for improvement (optional)
|
|
10
|
+
|
|
11
|
+
**Rationale:**
|
|
12
|
+
- Gradual enforcement allows teams to adopt validation incrementally
|
|
13
|
+
- CI/CD can fail on errors but allow warnings initially
|
|
14
|
+
- Info level provides guidance without blocking
|
|
15
|
+
|
|
16
|
+
### Validation Rules Hierarchy
|
|
17
|
+
|
|
18
|
+
#### Spec Validation Rules
|
|
19
|
+
```
|
|
20
|
+
ERROR level:
|
|
21
|
+
- Missing ## Overview or ## Requirements sections
|
|
22
|
+
- Invalid heading hierarchy
|
|
23
|
+
- Malformed requirement/scenario structure
|
|
24
|
+
|
|
25
|
+
WARNING level:
|
|
26
|
+
- Requirements without scenarios
|
|
27
|
+
- Requirements missing SHALL keyword
|
|
28
|
+
- Empty overview section
|
|
29
|
+
|
|
30
|
+
INFO level:
|
|
31
|
+
- Very long requirement text (>500 chars)
|
|
32
|
+
- Scenarios without Given/When/Then structure
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
#### Change Validation Rules
|
|
36
|
+
```
|
|
37
|
+
ERROR level:
|
|
38
|
+
- Missing ## Why or ## What Changes sections
|
|
39
|
+
- Invalid delta operation types
|
|
40
|
+
- Malformed delta structure
|
|
41
|
+
|
|
42
|
+
WARNING level:
|
|
43
|
+
- Why section too brief (<50 chars)
|
|
44
|
+
- Deltas without clear descriptions
|
|
45
|
+
- Missing requirements in ADDED/MODIFIED
|
|
46
|
+
|
|
47
|
+
INFO level:
|
|
48
|
+
- Very long why section (>1000 chars)
|
|
49
|
+
- Too many deltas in single change (>10)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Strict Mode
|
|
53
|
+
- **Default**: Show all levels, fail on ERROR only
|
|
54
|
+
- **--strict flag**: Fail on both ERROR and WARNING
|
|
55
|
+
- **Use case**: Gradual quality improvement in CI/CD pipelines
|
|
56
|
+
|
|
57
|
+
### Archive Command Safety
|
|
58
|
+
**Problem:** Invalid specs could be archived, polluting the archive.
|
|
59
|
+
|
|
60
|
+
**Solution:**
|
|
61
|
+
1. Pre-archive validation (default behavior)
|
|
62
|
+
2. --no-validate flag with safeguards:
|
|
63
|
+
- Interactive confirmation prompt
|
|
64
|
+
- Prominent warning message
|
|
65
|
+
- Console logging with timestamp
|
|
66
|
+
- Not recommended for CI/CD usage
|
|
67
|
+
|
|
68
|
+
**Rationale:**
|
|
69
|
+
- Protect archive integrity by default
|
|
70
|
+
- Allow emergency overrides with accountability
|
|
71
|
+
- Clear audit trail for validation bypasses
|
|
72
|
+
|
|
73
|
+
### Validation Report Format
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"valid": boolean,
|
|
77
|
+
"issues": [
|
|
78
|
+
{
|
|
79
|
+
"level": "ERROR" | "WARNING" | "INFO",
|
|
80
|
+
"path": "requirements[0].scenarios",
|
|
81
|
+
"message": "Requirement must have at least one scenario",
|
|
82
|
+
"line": 15,
|
|
83
|
+
"column": 0
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
"summary": {
|
|
87
|
+
"errors": 2,
|
|
88
|
+
"warnings": 5,
|
|
89
|
+
"info": 3
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Benefits:**
|
|
95
|
+
- Machine-readable for tooling integration
|
|
96
|
+
- Human-friendly messages
|
|
97
|
+
- Line/column info for IDE integration
|
|
98
|
+
- Summary for quick assessment
|
|
99
|
+
|
|
100
|
+
### Implementation Strategy
|
|
101
|
+
1. **Zod schemas with refinements**: Built-in validation in type definitions
|
|
102
|
+
2. **Custom validators**: Additional business logic validation
|
|
103
|
+
3. **Composable rules**: Mix and match for different contexts
|
|
104
|
+
4. **Extensible framework**: Easy to add new rules without refactoring
|
package/references/openspec/openspec/changes/archive/2025-08-19-add-zod-validation/proposal.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Change: Add Zod Runtime Validation
|
|
2
|
+
|
|
3
|
+
## Why
|
|
4
|
+
|
|
5
|
+
While the spec and change commands can output JSON, they currently don't perform strict runtime validation beyond basic structure checking. This can lead to invalid specs or changes being processed, silent failures when required fields are missing, and poor error messages.
|
|
6
|
+
|
|
7
|
+
## What Changes
|
|
8
|
+
|
|
9
|
+
- Enhance existing `spec validate` and `change validate` commands with strict Zod validation
|
|
10
|
+
- Add validation to the archive command to ensure changes are valid before applying
|
|
11
|
+
- Add validation to the diff command to ensure changes are well-formed
|
|
12
|
+
- Provide detailed validation reports in JSON format
|
|
13
|
+
- Add `--strict` mode that fails on warnings
|
|
14
|
+
|
|
15
|
+
## Impact
|
|
16
|
+
|
|
17
|
+
- **Affected specs**: cli-spec, cli-change, cli-archive, cli-diff
|
|
18
|
+
- **Affected code**:
|
|
19
|
+
- src/commands/spec.ts (enhance validate subcommand)
|
|
20
|
+
- src/commands/change.ts (enhance validate subcommand)
|
|
21
|
+
- src/core/archive.ts (add pre-archive validation)
|
|
22
|
+
- src/core/diff.ts (add validation check)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
## ADDED Requirements
|
|
2
|
+
|
|
3
|
+
### Requirement: Archive Validation
|
|
4
|
+
|
|
5
|
+
The archive command SHALL validate changes before applying them to ensure data integrity.
|
|
6
|
+
|
|
7
|
+
#### Scenario: Pre-archive validation
|
|
8
|
+
|
|
9
|
+
- **WHEN** executing `openspec archive change-name`
|
|
10
|
+
- **THEN** validate the change structure first
|
|
11
|
+
- **AND** only proceed if validation passes
|
|
12
|
+
- **AND** show validation errors if it fails
|
|
13
|
+
|
|
14
|
+
#### Scenario: Force archive without validation
|
|
15
|
+
|
|
16
|
+
- **WHEN** executing `openspec archive change-name --no-validate`
|
|
17
|
+
- **THEN** skip validation (unsafe mode)
|
|
18
|
+
- **AND** show warning about skipping validation
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
## ADDED Requirements
|
|
2
|
+
|
|
3
|
+
### Requirement: Diff Command Enhancement
|
|
4
|
+
|
|
5
|
+
The diff command SHALL validate change structure before displaying differences.
|
|
6
|
+
|
|
7
|
+
#### Scenario: Validate before diff
|
|
8
|
+
|
|
9
|
+
- **WHEN** executing `openspec diff change-name`
|
|
10
|
+
- **THEN** validate change structure
|
|
11
|
+
- **AND** show validation warnings if present
|
|
12
|
+
- **AND** continue with diff display
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Implementation Tasks (Foundation Phase)
|
|
2
|
+
|
|
3
|
+
## 1. Core Schemas
|
|
4
|
+
- [x] 1.1 Add zod dependency to package.json
|
|
5
|
+
- [x] 1.2 Create src/core/schemas/base.schema.ts with ScenarioSchema and RequirementSchema
|
|
6
|
+
- [x] 1.3 Create src/core/schemas/spec.schema.ts with SpecSchema
|
|
7
|
+
- [x] 1.4 Create src/core/schemas/change.schema.ts with DeltaSchema and ChangeSchema
|
|
8
|
+
- [x] 1.5 Create src/core/schemas/index.ts to export all schemas
|
|
9
|
+
|
|
10
|
+
## 2. Parser Implementation
|
|
11
|
+
- [x] 2.1 Create src/core/parsers/markdown-parser.ts
|
|
12
|
+
- [x] 2.2 Implement heading extraction (##, ###, ####)
|
|
13
|
+
- [x] 2.3 Implement content capture between headings
|
|
14
|
+
- [x] 2.4 Add tests for parser edge cases
|
|
15
|
+
|
|
16
|
+
## 3. Validation Infrastructure
|
|
17
|
+
- [x] 3.1 Create src/core/validation/types.ts with ValidationLevel, ValidationIssue, ValidationReport types
|
|
18
|
+
- [x] 3.2 Create src/core/validation/constants.ts with validation rules and thresholds
|
|
19
|
+
- [x] 3.3 Create src/core/validation/validator.ts with SpecValidator and ChangeValidator classes
|
|
20
|
+
|
|
21
|
+
## 4. Enhanced Validation Rules
|
|
22
|
+
- [x] 4.1 Add RequirementValidation refinements (must have scenarios, must contain SHALL)
|
|
23
|
+
- [x] 4.2 Add SpecValidation refinements (must have requirements)
|
|
24
|
+
- [x] 4.3 Add ChangeValidation refinements (must have deltas, why section length)
|
|
25
|
+
- [x] 4.4 Implement custom error messages for each rule
|
|
26
|
+
|
|
27
|
+
## 5. JSON Converter
|
|
28
|
+
- [x] 5.1 Create src/core/converters/json-converter.ts
|
|
29
|
+
- [x] 5.2 Implement spec-to-JSON conversion
|
|
30
|
+
- [x] 5.3 Implement change-to-JSON conversion
|
|
31
|
+
- [x] 5.4 Add metadata fields (version, format, sourcePath)
|
|
32
|
+
|
|
33
|
+
## 6. Archive Command Enhancement
|
|
34
|
+
- [x] 6.1 Add pre-archive validation check using new validators
|
|
35
|
+
- [x] 6.2 Add --no-validate flag with required confirmation prompt and warning message: "⚠️ WARNING: Skipping validation may archive invalid specs. Continue? (y/N)"
|
|
36
|
+
- [x] 6.3 Display validation errors before aborting
|
|
37
|
+
- [x] 6.4 Log all --no-validate usages to console with timestamp and affected files
|
|
38
|
+
- [x] 6.5 Add tests for validation scenarios including --no-validate confirmation flow
|
|
39
|
+
|
|
40
|
+
## 7. Diff Command Enhancement
|
|
41
|
+
- [x] 7.1 Add validation check before diff using new validators
|
|
42
|
+
- [x] 7.2 Show validation warnings (non-blocking)
|
|
43
|
+
- [x] 7.3 Continue with diff even if warnings present
|
|
44
|
+
|
|
45
|
+
## 8. Testing
|
|
46
|
+
- [x] 8.1 Unit tests for all schemas
|
|
47
|
+
- [x] 8.2 Unit tests for parser
|
|
48
|
+
- [x] 8.3 Unit tests for validation rules
|
|
49
|
+
- [x] 8.4 Integration tests for validation reports
|
|
50
|
+
- [x] 8.5 Test various invalid spec/change formats
|
|
51
|
+
- [x] 8.6 Test strict mode behavior
|
|
52
|
+
- [x] 8.7 Test pre-archive validation
|
|
53
|
+
- [x] 8.8 Test validation report JSON output
|
|
54
|
+
|
|
55
|
+
## 9. Documentation
|
|
56
|
+
- [x] 9.1 Document schema structure and validation rules (openspec/VALIDATION.md)
|
|
57
|
+
- [x] 9.2 Update CLI help for archive (document --no-validate flag and its warnings)
|
|
58
|
+
- [x] 9.3 Update CLI help for diff (document validation warnings behavior)
|
|
59
|
+
- [x] 9.4 Create migration guide for future command integration (openspec/MIGRATION.md)
|