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,165 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import { promises as fs } from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import os from 'os';
|
|
5
|
+
import { ListCommand } from '../../src/core/list.js';
|
|
6
|
+
|
|
7
|
+
describe('ListCommand', () => {
|
|
8
|
+
let tempDir: string;
|
|
9
|
+
let originalLog: typeof console.log;
|
|
10
|
+
let logOutput: string[] = [];
|
|
11
|
+
|
|
12
|
+
beforeEach(async () => {
|
|
13
|
+
// Create temp directory
|
|
14
|
+
tempDir = path.join(os.tmpdir(), `openspec-list-test-${Date.now()}`);
|
|
15
|
+
await fs.mkdir(tempDir, { recursive: true });
|
|
16
|
+
|
|
17
|
+
// Mock console.log to capture output
|
|
18
|
+
originalLog = console.log;
|
|
19
|
+
console.log = (...args: any[]) => {
|
|
20
|
+
logOutput.push(args.join(' '));
|
|
21
|
+
};
|
|
22
|
+
logOutput = [];
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
afterEach(async () => {
|
|
26
|
+
// Restore console.log
|
|
27
|
+
console.log = originalLog;
|
|
28
|
+
|
|
29
|
+
// Clean up temp directory
|
|
30
|
+
await fs.rm(tempDir, { recursive: true, force: true });
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe('execute', () => {
|
|
34
|
+
it('should handle missing openspec/changes directory', async () => {
|
|
35
|
+
const listCommand = new ListCommand();
|
|
36
|
+
|
|
37
|
+
await expect(listCommand.execute(tempDir, 'changes')).rejects.toThrow(
|
|
38
|
+
"No OpenSpec changes directory found. Run 'openspec init' first."
|
|
39
|
+
);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('should handle empty changes directory', async () => {
|
|
43
|
+
const changesDir = path.join(tempDir, 'openspec', 'changes');
|
|
44
|
+
await fs.mkdir(changesDir, { recursive: true });
|
|
45
|
+
|
|
46
|
+
const listCommand = new ListCommand();
|
|
47
|
+
await listCommand.execute(tempDir, 'changes');
|
|
48
|
+
|
|
49
|
+
expect(logOutput).toEqual(['No active changes found.']);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('should exclude archive directory', async () => {
|
|
53
|
+
const changesDir = path.join(tempDir, 'openspec', 'changes');
|
|
54
|
+
await fs.mkdir(path.join(changesDir, 'archive'), { recursive: true });
|
|
55
|
+
await fs.mkdir(path.join(changesDir, 'my-change'), { recursive: true });
|
|
56
|
+
|
|
57
|
+
// Create tasks.md with some tasks
|
|
58
|
+
await fs.writeFile(
|
|
59
|
+
path.join(changesDir, 'my-change', 'tasks.md'),
|
|
60
|
+
'- [x] Task 1\n- [ ] Task 2\n'
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
const listCommand = new ListCommand();
|
|
64
|
+
await listCommand.execute(tempDir, 'changes');
|
|
65
|
+
|
|
66
|
+
expect(logOutput).toContain('Changes:');
|
|
67
|
+
expect(logOutput.some(line => line.includes('my-change'))).toBe(true);
|
|
68
|
+
expect(logOutput.some(line => line.includes('archive'))).toBe(false);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('should count tasks correctly', async () => {
|
|
72
|
+
const changesDir = path.join(tempDir, 'openspec', 'changes');
|
|
73
|
+
await fs.mkdir(path.join(changesDir, 'test-change'), { recursive: true });
|
|
74
|
+
|
|
75
|
+
await fs.writeFile(
|
|
76
|
+
path.join(changesDir, 'test-change', 'tasks.md'),
|
|
77
|
+
`# Tasks
|
|
78
|
+
- [x] Completed task 1
|
|
79
|
+
- [x] Completed task 2
|
|
80
|
+
- [ ] Incomplete task 1
|
|
81
|
+
- [ ] Incomplete task 2
|
|
82
|
+
- [ ] Incomplete task 3
|
|
83
|
+
Regular text that should be ignored
|
|
84
|
+
`
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
const listCommand = new ListCommand();
|
|
88
|
+
await listCommand.execute(tempDir, 'changes');
|
|
89
|
+
|
|
90
|
+
expect(logOutput.some(line => line.includes('2/5 tasks'))).toBe(true);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('should show complete status for fully completed changes', async () => {
|
|
94
|
+
const changesDir = path.join(tempDir, 'openspec', 'changes');
|
|
95
|
+
await fs.mkdir(path.join(changesDir, 'completed-change'), { recursive: true });
|
|
96
|
+
|
|
97
|
+
await fs.writeFile(
|
|
98
|
+
path.join(changesDir, 'completed-change', 'tasks.md'),
|
|
99
|
+
'- [x] Task 1\n- [x] Task 2\n- [x] Task 3\n'
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
const listCommand = new ListCommand();
|
|
103
|
+
await listCommand.execute(tempDir, 'changes');
|
|
104
|
+
|
|
105
|
+
expect(logOutput.some(line => line.includes('✓ Complete'))).toBe(true);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it('should handle changes without tasks.md', async () => {
|
|
109
|
+
const changesDir = path.join(tempDir, 'openspec', 'changes');
|
|
110
|
+
await fs.mkdir(path.join(changesDir, 'no-tasks'), { recursive: true });
|
|
111
|
+
|
|
112
|
+
const listCommand = new ListCommand();
|
|
113
|
+
await listCommand.execute(tempDir, 'changes');
|
|
114
|
+
|
|
115
|
+
expect(logOutput.some(line => line.includes('no-tasks') && line.includes('No tasks'))).toBe(true);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it('should sort changes alphabetically', async () => {
|
|
119
|
+
const changesDir = path.join(tempDir, 'openspec', 'changes');
|
|
120
|
+
await fs.mkdir(path.join(changesDir, 'zebra'), { recursive: true });
|
|
121
|
+
await fs.mkdir(path.join(changesDir, 'alpha'), { recursive: true });
|
|
122
|
+
await fs.mkdir(path.join(changesDir, 'middle'), { recursive: true });
|
|
123
|
+
|
|
124
|
+
const listCommand = new ListCommand();
|
|
125
|
+
await listCommand.execute(tempDir);
|
|
126
|
+
|
|
127
|
+
const changeLines = logOutput.filter(line =>
|
|
128
|
+
line.includes('alpha') || line.includes('middle') || line.includes('zebra')
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
expect(changeLines[0]).toContain('alpha');
|
|
132
|
+
expect(changeLines[1]).toContain('middle');
|
|
133
|
+
expect(changeLines[2]).toContain('zebra');
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it('should handle multiple changes with various states', async () => {
|
|
137
|
+
const changesDir = path.join(tempDir, 'openspec', 'changes');
|
|
138
|
+
|
|
139
|
+
// Complete change
|
|
140
|
+
await fs.mkdir(path.join(changesDir, 'completed'), { recursive: true });
|
|
141
|
+
await fs.writeFile(
|
|
142
|
+
path.join(changesDir, 'completed', 'tasks.md'),
|
|
143
|
+
'- [x] Task 1\n- [x] Task 2\n'
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
// Partial change
|
|
147
|
+
await fs.mkdir(path.join(changesDir, 'partial'), { recursive: true });
|
|
148
|
+
await fs.writeFile(
|
|
149
|
+
path.join(changesDir, 'partial', 'tasks.md'),
|
|
150
|
+
'- [x] Done\n- [ ] Not done\n- [ ] Also not done\n'
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
// No tasks
|
|
154
|
+
await fs.mkdir(path.join(changesDir, 'no-tasks'), { recursive: true });
|
|
155
|
+
|
|
156
|
+
const listCommand = new ListCommand();
|
|
157
|
+
await listCommand.execute(tempDir);
|
|
158
|
+
|
|
159
|
+
expect(logOutput).toContain('Changes:');
|
|
160
|
+
expect(logOutput.some(line => line.includes('completed') && line.includes('✓ Complete'))).toBe(true);
|
|
161
|
+
expect(logOutput.some(line => line.includes('partial') && line.includes('1/3 tasks'))).toBe(true);
|
|
162
|
+
expect(logOutput.some(line => line.includes('no-tasks') && line.includes('No tasks'))).toBe(true);
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { promises as fs } from 'fs';
|
|
4
|
+
import os from 'os';
|
|
5
|
+
import { ChangeParser } from '../../../src/core/parsers/change-parser.js';
|
|
6
|
+
|
|
7
|
+
async function withTempDir(run: (dir: string) => Promise<void>) {
|
|
8
|
+
const dir = await fs.mkdtemp(path.join(os.tmpdir(), 'openspec-change-parser-'));
|
|
9
|
+
try {
|
|
10
|
+
await run(dir);
|
|
11
|
+
} finally {
|
|
12
|
+
// Best-effort cleanup
|
|
13
|
+
try { await fs.rm(dir, { recursive: true, force: true }); } catch {}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
describe('ChangeParser', () => {
|
|
18
|
+
it('parses simple What Changes bullet list', async () => {
|
|
19
|
+
const content = `# Test Change\n\n## Why\nWe need it because reasons that are sufficiently long.\n\n## What Changes\n- **spec-a:** Add a new requirement to A\n- **spec-b:** Rename requirement X to Y\n- **spec-c:** Remove obsolete requirement`;
|
|
20
|
+
|
|
21
|
+
const parser = new ChangeParser(content, process.cwd());
|
|
22
|
+
const change = await parser.parseChangeWithDeltas('test-change');
|
|
23
|
+
|
|
24
|
+
expect(change.name).toBe('test-change');
|
|
25
|
+
expect(change.deltas.length).toBe(3);
|
|
26
|
+
expect(change.deltas[0].spec).toBe('spec-a');
|
|
27
|
+
expect(['ADDED', 'MODIFIED', 'REMOVED', 'RENAMED']).toContain(change.deltas[1].operation);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('prefers delta-format specs over simple bullets when both exist', async () => {
|
|
31
|
+
await withTempDir(async (dir) => {
|
|
32
|
+
const changeDir = dir;
|
|
33
|
+
const specsDir = path.join(changeDir, 'specs', 'foo');
|
|
34
|
+
await fs.mkdir(specsDir, { recursive: true });
|
|
35
|
+
|
|
36
|
+
const content = `# Test Change\n\n## Why\nWe need it because reasons that are sufficiently long.\n\n## What Changes\n- **foo:** Add something via bullets (should be overridden)`;
|
|
37
|
+
const deltaSpec = `# Delta for Foo\n\n## ADDED Requirements\n\n### Requirement: New thing\n\n#### Scenario: basic\nGiven X\nWhen Y\nThen Z`;
|
|
38
|
+
|
|
39
|
+
await fs.writeFile(path.join(specsDir, 'spec.md'), deltaSpec, 'utf8');
|
|
40
|
+
|
|
41
|
+
const parser = new ChangeParser(content, changeDir);
|
|
42
|
+
const change = await parser.parseChangeWithDeltas('test-change');
|
|
43
|
+
|
|
44
|
+
expect(change.deltas.length).toBeGreaterThan(0);
|
|
45
|
+
// Since delta spec exists, the description should reflect delta-derived entries
|
|
46
|
+
expect(change.deltas[0].spec).toBe('foo');
|
|
47
|
+
expect(change.deltas[0].description).toContain('Add requirement:');
|
|
48
|
+
expect(change.deltas[0].operation).toBe('ADDED');
|
|
49
|
+
expect(change.deltas[0].requirement).toBeDefined();
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { MarkdownParser } from '../../../src/core/parsers/markdown-parser.js';
|
|
3
|
+
|
|
4
|
+
describe('MarkdownParser', () => {
|
|
5
|
+
describe('parseSpec', () => {
|
|
6
|
+
it('should parse a valid spec', () => {
|
|
7
|
+
const content = `# User Authentication Spec
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
This specification defines the requirements for user authentication.
|
|
11
|
+
|
|
12
|
+
## Requirements
|
|
13
|
+
|
|
14
|
+
### The system SHALL provide secure user authentication
|
|
15
|
+
Users need to be able to log in securely.
|
|
16
|
+
|
|
17
|
+
#### Scenario: Successful login
|
|
18
|
+
Given a user with valid credentials
|
|
19
|
+
When they submit the login form
|
|
20
|
+
Then they are authenticated
|
|
21
|
+
|
|
22
|
+
### The system SHALL handle invalid login attempts
|
|
23
|
+
The system must handle incorrect credentials.
|
|
24
|
+
|
|
25
|
+
#### Scenario: Invalid credentials
|
|
26
|
+
Given a user with invalid credentials
|
|
27
|
+
When they submit the login form
|
|
28
|
+
Then they see an error message`;
|
|
29
|
+
|
|
30
|
+
const parser = new MarkdownParser(content);
|
|
31
|
+
const spec = parser.parseSpec('user-auth');
|
|
32
|
+
|
|
33
|
+
expect(spec.name).toBe('user-auth');
|
|
34
|
+
expect(spec.overview).toContain('requirements for user authentication');
|
|
35
|
+
expect(spec.requirements).toHaveLength(2);
|
|
36
|
+
|
|
37
|
+
const firstReq = spec.requirements[0];
|
|
38
|
+
expect(firstReq.text).toBe('Users need to be able to log in securely.');
|
|
39
|
+
expect(firstReq.scenarios).toHaveLength(1);
|
|
40
|
+
|
|
41
|
+
const scenario = firstReq.scenarios[0];
|
|
42
|
+
expect(scenario.rawText).toContain('Given a user with valid credentials');
|
|
43
|
+
expect(scenario.rawText).toContain('When they submit the login form');
|
|
44
|
+
expect(scenario.rawText).toContain('Then they are authenticated');
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should handle multi-line scenarios', () => {
|
|
48
|
+
const content = `# Test Spec
|
|
49
|
+
|
|
50
|
+
## Purpose
|
|
51
|
+
Test overview
|
|
52
|
+
|
|
53
|
+
## Requirements
|
|
54
|
+
|
|
55
|
+
### The system SHALL handle complex scenarios
|
|
56
|
+
This requirement has content.
|
|
57
|
+
|
|
58
|
+
#### Scenario: Multi-line scenario
|
|
59
|
+
Given a user with valid credentials
|
|
60
|
+
and the user has admin privileges
|
|
61
|
+
and the system is in maintenance mode
|
|
62
|
+
When they attempt to login
|
|
63
|
+
and provide their MFA token
|
|
64
|
+
Then they are authenticated
|
|
65
|
+
and redirected to admin dashboard
|
|
66
|
+
and see a maintenance warning`;
|
|
67
|
+
|
|
68
|
+
const parser = new MarkdownParser(content);
|
|
69
|
+
const spec = parser.parseSpec('test');
|
|
70
|
+
|
|
71
|
+
const scenario = spec.requirements[0].scenarios[0];
|
|
72
|
+
expect(scenario.rawText).toContain('Given a user with valid credentials');
|
|
73
|
+
expect(scenario.rawText).toContain('and the user has admin privileges');
|
|
74
|
+
expect(scenario.rawText).toContain('When they attempt to login');
|
|
75
|
+
expect(scenario.rawText).toContain('and provide their MFA token');
|
|
76
|
+
expect(scenario.rawText).toContain('Then they are authenticated');
|
|
77
|
+
expect(scenario.rawText).toContain('and see a maintenance warning');
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('should throw error for missing overview', () => {
|
|
81
|
+
const content = `# Test Spec
|
|
82
|
+
|
|
83
|
+
## Requirements
|
|
84
|
+
|
|
85
|
+
### The system SHALL do something
|
|
86
|
+
|
|
87
|
+
#### Scenario: Test
|
|
88
|
+
Given test
|
|
89
|
+
When action
|
|
90
|
+
Then result`;
|
|
91
|
+
|
|
92
|
+
const parser = new MarkdownParser(content);
|
|
93
|
+
expect(() => parser.parseSpec('test')).toThrow('must have a Purpose section');
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('should throw error for missing requirements', () => {
|
|
97
|
+
const content = `# Test Spec
|
|
98
|
+
|
|
99
|
+
## Purpose
|
|
100
|
+
This is a test spec`;
|
|
101
|
+
|
|
102
|
+
const parser = new MarkdownParser(content);
|
|
103
|
+
expect(() => parser.parseSpec('test')).toThrow('must have a Requirements section');
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
describe('parseChange', () => {
|
|
108
|
+
it('should parse a valid change', () => {
|
|
109
|
+
const content = `# Add User Authentication
|
|
110
|
+
|
|
111
|
+
## Why
|
|
112
|
+
We need to implement user authentication to secure the application and protect user data from unauthorized access.
|
|
113
|
+
|
|
114
|
+
## What Changes
|
|
115
|
+
- **user-auth:** Add new user authentication specification
|
|
116
|
+
- **api-endpoints:** Modify to include authentication endpoints
|
|
117
|
+
- **database:** Remove old session management tables`;
|
|
118
|
+
|
|
119
|
+
const parser = new MarkdownParser(content);
|
|
120
|
+
const change = parser.parseChange('add-user-auth');
|
|
121
|
+
|
|
122
|
+
expect(change.name).toBe('add-user-auth');
|
|
123
|
+
expect(change.why).toContain('secure the application');
|
|
124
|
+
expect(change.whatChanges).toContain('user-auth');
|
|
125
|
+
expect(change.deltas).toHaveLength(3);
|
|
126
|
+
|
|
127
|
+
expect(change.deltas[0].spec).toBe('user-auth');
|
|
128
|
+
expect(change.deltas[0].operation).toBe('ADDED');
|
|
129
|
+
expect(change.deltas[0].description).toContain('Add new user authentication');
|
|
130
|
+
|
|
131
|
+
expect(change.deltas[1].spec).toBe('api-endpoints');
|
|
132
|
+
expect(change.deltas[1].operation).toBe('MODIFIED');
|
|
133
|
+
|
|
134
|
+
expect(change.deltas[2].spec).toBe('database');
|
|
135
|
+
expect(change.deltas[2].operation).toBe('REMOVED');
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it('should throw error for missing why section', () => {
|
|
139
|
+
const content = `# Test Change
|
|
140
|
+
|
|
141
|
+
## What Changes
|
|
142
|
+
- **test:** Add test`;
|
|
143
|
+
|
|
144
|
+
const parser = new MarkdownParser(content);
|
|
145
|
+
expect(() => parser.parseChange('test')).toThrow('must have a Why section');
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it('should throw error for missing what changes section', () => {
|
|
149
|
+
const content = `# Test Change
|
|
150
|
+
|
|
151
|
+
## Why
|
|
152
|
+
Because we need it`;
|
|
153
|
+
|
|
154
|
+
const parser = new MarkdownParser(content);
|
|
155
|
+
expect(() => parser.parseChange('test')).toThrow('must have a What Changes section');
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
it('should handle changes without deltas', () => {
|
|
159
|
+
const content = `# Test Change
|
|
160
|
+
|
|
161
|
+
## Why
|
|
162
|
+
We need to make some changes for important reasons that justify this work.
|
|
163
|
+
|
|
164
|
+
## What Changes
|
|
165
|
+
Some general description of changes without specific deltas`;
|
|
166
|
+
|
|
167
|
+
const parser = new MarkdownParser(content);
|
|
168
|
+
const change = parser.parseChange('test');
|
|
169
|
+
|
|
170
|
+
expect(change.deltas).toHaveLength(0);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it('parses change documents saved with CRLF line endings', () => {
|
|
174
|
+
const crlfContent = [
|
|
175
|
+
'# CRLF Change',
|
|
176
|
+
'',
|
|
177
|
+
'## Why',
|
|
178
|
+
'Reasons on Windows editors should parse like POSIX environments.',
|
|
179
|
+
'',
|
|
180
|
+
'## What Changes',
|
|
181
|
+
'- **alpha:** Add cross-platform parsing coverage',
|
|
182
|
+
].join('\r\n');
|
|
183
|
+
|
|
184
|
+
const parser = new MarkdownParser(crlfContent);
|
|
185
|
+
const change = parser.parseChange('crlf-change');
|
|
186
|
+
|
|
187
|
+
expect(change.why).toContain('Windows editors should parse');
|
|
188
|
+
expect(change.deltas).toHaveLength(1);
|
|
189
|
+
expect(change.deltas[0].spec).toBe('alpha');
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
describe('section parsing', () => {
|
|
194
|
+
it('should handle nested sections correctly', () => {
|
|
195
|
+
const content = `# Test Spec
|
|
196
|
+
|
|
197
|
+
## Purpose
|
|
198
|
+
This is the overview section for testing nested sections.
|
|
199
|
+
|
|
200
|
+
## Requirements
|
|
201
|
+
|
|
202
|
+
### The system SHALL handle nested sections
|
|
203
|
+
|
|
204
|
+
#### Scenario: Test nested
|
|
205
|
+
Given a nested structure
|
|
206
|
+
When parsing sections
|
|
207
|
+
Then handle correctly
|
|
208
|
+
|
|
209
|
+
### Another requirement SHALL work
|
|
210
|
+
|
|
211
|
+
#### Scenario: Another test
|
|
212
|
+
Given another test
|
|
213
|
+
When running
|
|
214
|
+
Then success`;
|
|
215
|
+
|
|
216
|
+
const parser = new MarkdownParser(content);
|
|
217
|
+
const spec = parser.parseSpec('test');
|
|
218
|
+
|
|
219
|
+
// Should find the correct sections at different levels
|
|
220
|
+
expect(spec).toBeDefined();
|
|
221
|
+
expect(spec.overview).toContain('testing nested sections');
|
|
222
|
+
expect(spec.requirements).toHaveLength(2);
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it('should preserve content between headers', () => {
|
|
226
|
+
const content = `# Test
|
|
227
|
+
|
|
228
|
+
## Purpose
|
|
229
|
+
This is the overview.
|
|
230
|
+
It has multiple lines.
|
|
231
|
+
|
|
232
|
+
Some more content here.
|
|
233
|
+
|
|
234
|
+
## Requirements
|
|
235
|
+
|
|
236
|
+
### Requirement 1
|
|
237
|
+
Content for requirement 1`;
|
|
238
|
+
|
|
239
|
+
const parser = new MarkdownParser(content);
|
|
240
|
+
const spec = parser.parseSpec('test');
|
|
241
|
+
|
|
242
|
+
expect(spec.overview).toContain('multiple lines');
|
|
243
|
+
expect(spec.overview).toContain('more content');
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
it('should use requirement heading as fallback when no content is provided', () => {
|
|
247
|
+
const content = `# Test Spec
|
|
248
|
+
|
|
249
|
+
## Purpose
|
|
250
|
+
Test overview
|
|
251
|
+
|
|
252
|
+
## Requirements
|
|
253
|
+
|
|
254
|
+
### The system SHALL use heading text when no content
|
|
255
|
+
|
|
256
|
+
#### Scenario: Test
|
|
257
|
+
Given test
|
|
258
|
+
When action
|
|
259
|
+
Then result`;
|
|
260
|
+
|
|
261
|
+
const parser = new MarkdownParser(content);
|
|
262
|
+
const spec = parser.parseSpec('test');
|
|
263
|
+
|
|
264
|
+
expect(spec.requirements[0].text).toBe('The system SHALL use heading text when no content');
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
it('should extract requirement text from first non-empty content line', () => {
|
|
268
|
+
const content = `# Test Spec
|
|
269
|
+
|
|
270
|
+
## Purpose
|
|
271
|
+
Test overview
|
|
272
|
+
|
|
273
|
+
## Requirements
|
|
274
|
+
|
|
275
|
+
### Requirement heading
|
|
276
|
+
|
|
277
|
+
This is the actual requirement text.
|
|
278
|
+
This is additional description.
|
|
279
|
+
|
|
280
|
+
#### Scenario: Test
|
|
281
|
+
Given test
|
|
282
|
+
When action
|
|
283
|
+
Then result`;
|
|
284
|
+
|
|
285
|
+
const parser = new MarkdownParser(content);
|
|
286
|
+
const spec = parser.parseSpec('test');
|
|
287
|
+
|
|
288
|
+
expect(spec.requirements[0].text).toBe('This is the actual requirement text.');
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
});
|