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.
Files changed (311) hide show
  1. package/.gitmodules +3 -0
  2. package/CHAT.md +3 -0
  3. package/package.json +12 -0
  4. package/references/openspec/.changeset/README.md +6 -0
  5. package/references/openspec/.changeset/config.json +12 -0
  6. package/references/openspec/.coderabbit.yaml +11 -0
  7. package/references/openspec/.devcontainer/README.md +92 -0
  8. package/references/openspec/.devcontainer/devcontainer.json +68 -0
  9. package/references/openspec/.github/CODEOWNERS +2 -0
  10. package/references/openspec/.github/workflows/ci.yml +222 -0
  11. package/references/openspec/.github/workflows/release-prepare.yml +50 -0
  12. package/references/openspec/AGENTS.md +18 -0
  13. package/references/openspec/CHANGELOG.md +205 -0
  14. package/references/openspec/LICENSE +22 -0
  15. package/references/openspec/README.md +374 -0
  16. package/references/openspec/assets/openspec_dashboard.png +0 -0
  17. package/references/openspec/assets/openspec_pixel_dark.svg +89 -0
  18. package/references/openspec/assets/openspec_pixel_light.svg +89 -0
  19. package/references/openspec/bin/openspec.js +3 -0
  20. package/references/openspec/build.js +31 -0
  21. package/references/openspec/openspec/AGENTS.md +454 -0
  22. package/references/openspec/openspec/changes/IMPLEMENTATION_ORDER.md +68 -0
  23. package/references/openspec/openspec/changes/add-antigravity-support/proposal.md +11 -0
  24. package/references/openspec/openspec/changes/add-antigravity-support/specs/cli-init/spec.md +9 -0
  25. package/references/openspec/openspec/changes/add-antigravity-support/specs/cli-update/spec.md +8 -0
  26. package/references/openspec/openspec/changes/add-antigravity-support/tasks.md +12 -0
  27. package/references/openspec/openspec/changes/add-scaffold-command/proposal.md +11 -0
  28. package/references/openspec/openspec/changes/add-scaffold-command/specs/cli-scaffold/spec.md +36 -0
  29. package/references/openspec/openspec/changes/add-scaffold-command/tasks.md +12 -0
  30. package/references/openspec/openspec/changes/archive/2025-01-11-add-update-command/design.md +86 -0
  31. package/references/openspec/openspec/changes/archive/2025-01-11-add-update-command/proposal.md +29 -0
  32. package/references/openspec/openspec/changes/archive/2025-01-11-add-update-command/specs/cli-update/spec.md +59 -0
  33. package/references/openspec/openspec/changes/archive/2025-01-11-add-update-command/tasks.md +20 -0
  34. package/references/openspec/openspec/changes/archive/2025-01-13-add-list-command/proposal.md +20 -0
  35. package/references/openspec/openspec/changes/archive/2025-01-13-add-list-command/specs/cli-list/spec.md +69 -0
  36. package/references/openspec/openspec/changes/archive/2025-01-13-add-list-command/tasks.md +26 -0
  37. package/references/openspec/openspec/changes/archive/2025-08-05-initialize-typescript-project/design.md +64 -0
  38. package/references/openspec/openspec/changes/archive/2025-08-05-initialize-typescript-project/proposal.md +18 -0
  39. package/references/openspec/openspec/changes/archive/2025-08-05-initialize-typescript-project/tasks.md +25 -0
  40. package/references/openspec/openspec/changes/archive/2025-08-06-add-init-command/design.md +104 -0
  41. package/references/openspec/openspec/changes/archive/2025-08-06-add-init-command/proposal.md +30 -0
  42. package/references/openspec/openspec/changes/archive/2025-08-06-add-init-command/specs/cli-init/spec.md +148 -0
  43. package/references/openspec/openspec/changes/archive/2025-08-06-add-init-command/tasks.md +38 -0
  44. package/references/openspec/openspec/changes/archive/2025-08-06-adopt-future-state-storage/proposal.md +24 -0
  45. package/references/openspec/openspec/changes/archive/2025-08-06-adopt-future-state-storage/specs/openspec-conventions/spec.md +120 -0
  46. package/references/openspec/openspec/changes/archive/2025-08-06-adopt-future-state-storage/tasks.md +38 -0
  47. package/references/openspec/openspec/changes/archive/2025-08-11-add-complexity-guidelines/proposal.md +13 -0
  48. package/references/openspec/openspec/changes/archive/2025-08-11-add-complexity-guidelines/specs/openspec-docs/README.md +472 -0
  49. package/references/openspec/openspec/changes/archive/2025-08-11-add-complexity-guidelines/tasks.md +9 -0
  50. package/references/openspec/openspec/changes/archive/2025-08-13-add-archive-command/proposal.md +15 -0
  51. package/references/openspec/openspec/changes/archive/2025-08-13-add-archive-command/specs/cli-archive/spec.md +111 -0
  52. package/references/openspec/openspec/changes/archive/2025-08-13-add-archive-command/tasks.md +44 -0
  53. package/references/openspec/openspec/changes/archive/2025-08-13-add-diff-command/proposal.md +19 -0
  54. package/references/openspec/openspec/changes/archive/2025-08-13-add-diff-command/specs/cli-diff/spec.md +77 -0
  55. package/references/openspec/openspec/changes/archive/2025-08-13-add-diff-command/tasks.md +23 -0
  56. package/references/openspec/openspec/changes/archive/2025-08-19-add-change-commands/design.md +56 -0
  57. package/references/openspec/openspec/changes/archive/2025-08-19-add-change-commands/proposal.md +17 -0
  58. package/references/openspec/openspec/changes/archive/2025-08-19-add-change-commands/specs/cli-change/spec.md +48 -0
  59. package/references/openspec/openspec/changes/archive/2025-08-19-add-change-commands/specs/cli-list/spec.md +12 -0
  60. package/references/openspec/openspec/changes/archive/2025-08-19-add-change-commands/tasks.md +34 -0
  61. package/references/openspec/openspec/changes/archive/2025-08-19-add-interactive-show-command/proposal.md +20 -0
  62. package/references/openspec/openspec/changes/archive/2025-08-19-add-interactive-show-command/specs/cli-change/spec.md +23 -0
  63. package/references/openspec/openspec/changes/archive/2025-08-19-add-interactive-show-command/specs/cli-show/spec.md +83 -0
  64. package/references/openspec/openspec/changes/archive/2025-08-19-add-interactive-show-command/specs/cli-spec/spec.md +23 -0
  65. package/references/openspec/openspec/changes/archive/2025-08-19-add-interactive-show-command/tasks.md +142 -0
  66. package/references/openspec/openspec/changes/archive/2025-08-19-add-skip-specs-archive-option/proposal.md +13 -0
  67. package/references/openspec/openspec/changes/archive/2025-08-19-add-skip-specs-archive-option/specs/cli-archive/spec.md +191 -0
  68. package/references/openspec/openspec/changes/archive/2025-08-19-add-skip-specs-archive-option/tasks.md +57 -0
  69. package/references/openspec/openspec/changes/archive/2025-08-19-add-spec-commands/design.md +45 -0
  70. package/references/openspec/openspec/changes/archive/2025-08-19-add-spec-commands/proposal.md +19 -0
  71. package/references/openspec/openspec/changes/archive/2025-08-19-add-spec-commands/specs/cli-spec/spec.md +43 -0
  72. package/references/openspec/openspec/changes/archive/2025-08-19-add-spec-commands/tasks.md +22 -0
  73. package/references/openspec/openspec/changes/archive/2025-08-19-add-zod-validation/design.md +104 -0
  74. package/references/openspec/openspec/changes/archive/2025-08-19-add-zod-validation/proposal.md +22 -0
  75. package/references/openspec/openspec/changes/archive/2025-08-19-add-zod-validation/specs/cli-archive/spec.md +18 -0
  76. package/references/openspec/openspec/changes/archive/2025-08-19-add-zod-validation/specs/cli-diff/spec.md +12 -0
  77. package/references/openspec/openspec/changes/archive/2025-08-19-add-zod-validation/tasks.md +59 -0
  78. package/references/openspec/openspec/changes/archive/2025-08-19-adopt-delta-based-changes/proposal.md +93 -0
  79. package/references/openspec/openspec/changes/archive/2025-08-19-adopt-delta-based-changes/specs/cli-archive/spec.md +48 -0
  80. package/references/openspec/openspec/changes/archive/2025-08-19-adopt-delta-based-changes/specs/cli-diff/spec.md +45 -0
  81. package/references/openspec/openspec/changes/archive/2025-08-19-adopt-delta-based-changes/specs/openspec-conventions/spec.md +101 -0
  82. package/references/openspec/openspec/changes/archive/2025-08-19-adopt-delta-based-changes/tasks.md +55 -0
  83. package/references/openspec/openspec/changes/archive/2025-08-19-adopt-verb-noun-cli-structure/design.md +19 -0
  84. package/references/openspec/openspec/changes/archive/2025-08-19-adopt-verb-noun-cli-structure/proposal.md +67 -0
  85. package/references/openspec/openspec/changes/archive/2025-08-19-adopt-verb-noun-cli-structure/specs/cli-list/spec.md +57 -0
  86. package/references/openspec/openspec/changes/archive/2025-08-19-adopt-verb-noun-cli-structure/specs/openspec-conventions/spec.md +23 -0
  87. package/references/openspec/openspec/changes/archive/2025-08-19-adopt-verb-noun-cli-structure/tasks.md +27 -0
  88. package/references/openspec/openspec/changes/archive/2025-08-19-bulk-validation-interactive-selection/proposal.md +20 -0
  89. package/references/openspec/openspec/changes/archive/2025-08-19-bulk-validation-interactive-selection/specs/cli-change/spec.md +22 -0
  90. package/references/openspec/openspec/changes/archive/2025-08-19-bulk-validation-interactive-selection/specs/cli-spec/spec.md +23 -0
  91. package/references/openspec/openspec/changes/archive/2025-08-19-bulk-validation-interactive-selection/specs/cli-validate/spec.md +149 -0
  92. package/references/openspec/openspec/changes/archive/2025-08-19-bulk-validation-interactive-selection/tasks.md +81 -0
  93. package/references/openspec/openspec/changes/archive/2025-08-19-fix-update-tool-selection/proposal.md +40 -0
  94. package/references/openspec/openspec/changes/archive/2025-08-19-fix-update-tool-selection/specs/cli-update/spec.md +23 -0
  95. package/references/openspec/openspec/changes/archive/2025-08-19-fix-update-tool-selection/tasks.md +21 -0
  96. package/references/openspec/openspec/changes/archive/2025-08-19-improve-validate-error-messages/proposal.md +25 -0
  97. package/references/openspec/openspec/changes/archive/2025-08-19-improve-validate-error-messages/specs/cli-validate/spec.md +55 -0
  98. package/references/openspec/openspec/changes/archive/2025-08-19-improve-validate-error-messages/tasks.md +21 -0
  99. package/references/openspec/openspec/changes/archive/2025-08-19-structured-spec-format/proposal.md +36 -0
  100. package/references/openspec/openspec/changes/archive/2025-08-19-structured-spec-format/specs/openspec-conventions/spec.md +192 -0
  101. package/references/openspec/openspec/changes/archive/2025-08-19-structured-spec-format/tasks.md +19 -0
  102. package/references/openspec/openspec/changes/archive/2025-09-12-add-view-dashboard-command/proposal.md +38 -0
  103. package/references/openspec/openspec/changes/archive/2025-09-12-add-view-dashboard-command/specs/cli-view/spec.md +109 -0
  104. package/references/openspec/openspec/changes/archive/2025-09-12-add-view-dashboard-command/tasks.md +47 -0
  105. package/references/openspec/openspec/changes/archive/2025-09-29-add-agents-md-config/proposal.md +28 -0
  106. package/references/openspec/openspec/changes/archive/2025-09-29-add-agents-md-config/specs/cli-init/spec.md +71 -0
  107. package/references/openspec/openspec/changes/archive/2025-09-29-add-agents-md-config/specs/cli-update/spec.md +41 -0
  108. package/references/openspec/openspec/changes/archive/2025-09-29-add-agents-md-config/tasks.md +17 -0
  109. package/references/openspec/openspec/changes/archive/2025-09-29-add-multi-agent-init/proposal.md +35 -0
  110. package/references/openspec/openspec/changes/archive/2025-09-29-add-multi-agent-init/specs/cli-init/spec.md +45 -0
  111. package/references/openspec/openspec/changes/archive/2025-09-29-add-multi-agent-init/tasks.md +16 -0
  112. package/references/openspec/openspec/changes/archive/2025-09-29-add-slash-command-support/proposal.md +119 -0
  113. package/references/openspec/openspec/changes/archive/2025-09-29-add-slash-command-support/specs/cli-init/spec.md +21 -0
  114. package/references/openspec/openspec/changes/archive/2025-09-29-add-slash-command-support/specs/cli-update/spec.md +22 -0
  115. package/references/openspec/openspec/changes/archive/2025-09-29-add-slash-command-support/tasks.md +20 -0
  116. package/references/openspec/openspec/changes/archive/2025-09-29-improve-cli-e2e-plan/proposal.md +19 -0
  117. package/references/openspec/openspec/changes/archive/2025-09-29-improve-cli-e2e-plan/tasks.md +9 -0
  118. package/references/openspec/openspec/changes/archive/2025-09-29-improve-deterministic-tests/proposal.md +78 -0
  119. package/references/openspec/openspec/changes/archive/2025-09-29-improve-deterministic-tests/tasks.md +25 -0
  120. package/references/openspec/openspec/changes/archive/2025-09-29-improve-init-onboarding/proposal.md +13 -0
  121. package/references/openspec/openspec/changes/archive/2025-09-29-improve-init-onboarding/specs/cli-init/spec.md +92 -0
  122. package/references/openspec/openspec/changes/archive/2025-09-29-improve-init-onboarding/tasks.md +12 -0
  123. package/references/openspec/openspec/changes/archive/2025-09-29-remove-diff-command/proposal.md +81 -0
  124. package/references/openspec/openspec/changes/archive/2025-09-29-remove-diff-command/tasks.md +37 -0
  125. package/references/openspec/openspec/changes/archive/2025-09-29-sort-active-changes-by-progress/proposal.md +25 -0
  126. package/references/openspec/openspec/changes/archive/2025-09-29-sort-active-changes-by-progress/specs/cli-view/spec.md +9 -0
  127. package/references/openspec/openspec/changes/archive/2025-09-29-sort-active-changes-by-progress/tasks.md +8 -0
  128. package/references/openspec/openspec/changes/archive/2025-09-29-update-agent-file-name/proposal.md +29 -0
  129. package/references/openspec/openspec/changes/archive/2025-09-29-update-agent-file-name/specs/cli-init/spec.md +40 -0
  130. package/references/openspec/openspec/changes/archive/2025-09-29-update-agent-file-name/specs/cli-update/spec.md +22 -0
  131. package/references/openspec/openspec/changes/archive/2025-09-29-update-agent-file-name/specs/openspec-conventions/spec.md +27 -0
  132. package/references/openspec/openspec/changes/archive/2025-09-29-update-agent-file-name/tasks.md +22 -0
  133. package/references/openspec/openspec/changes/archive/2025-09-29-update-agent-instructions/design.md +130 -0
  134. package/references/openspec/openspec/changes/archive/2025-09-29-update-agent-instructions/proposal.md +117 -0
  135. package/references/openspec/openspec/changes/archive/2025-09-29-update-agent-instructions/tasks.md +69 -0
  136. package/references/openspec/openspec/changes/archive/2025-09-29-update-markdown-parser-crlf/proposal.md +19 -0
  137. package/references/openspec/openspec/changes/archive/2025-09-29-update-markdown-parser-crlf/specs/cli-validate/spec.md +9 -0
  138. package/references/openspec/openspec/changes/archive/2025-09-29-update-markdown-parser-crlf/tasks.md +11 -0
  139. package/references/openspec/openspec/changes/archive/2025-10-14-add-codex-slash-command-support/proposal.md +25 -0
  140. package/references/openspec/openspec/changes/archive/2025-10-14-add-codex-slash-command-support/specs/cli-init/spec.md +56 -0
  141. package/references/openspec/openspec/changes/archive/2025-10-14-add-codex-slash-command-support/specs/cli-update/spec.md +41 -0
  142. package/references/openspec/openspec/changes/archive/2025-10-14-add-codex-slash-command-support/tasks.md +19 -0
  143. package/references/openspec/openspec/changes/archive/2025-10-14-add-github-copilot-prompts/proposal.md +25 -0
  144. package/references/openspec/openspec/changes/archive/2025-10-14-add-github-copilot-prompts/specs/cli-init/spec.md +48 -0
  145. package/references/openspec/openspec/changes/archive/2025-10-14-add-github-copilot-prompts/specs/cli-update/spec.md +48 -0
  146. package/references/openspec/openspec/changes/archive/2025-10-14-add-github-copilot-prompts/tasks.md +30 -0
  147. package/references/openspec/openspec/changes/archive/2025-10-14-add-kilocode-workflows/proposal.md +17 -0
  148. package/references/openspec/openspec/changes/archive/2025-10-14-add-kilocode-workflows/specs/cli-init/spec.md +43 -0
  149. package/references/openspec/openspec/changes/archive/2025-10-14-add-kilocode-workflows/specs/cli-update/spec.md +27 -0
  150. package/references/openspec/openspec/changes/archive/2025-10-14-add-kilocode-workflows/tasks.md +15 -0
  151. package/references/openspec/openspec/changes/archive/2025-10-14-add-non-interactive-init-options/proposal.md +12 -0
  152. package/references/openspec/openspec/changes/archive/2025-10-14-add-non-interactive-init-options/specs/cli-init/spec.md +39 -0
  153. package/references/openspec/openspec/changes/archive/2025-10-14-add-non-interactive-init-options/tasks.md +17 -0
  154. package/references/openspec/openspec/changes/archive/2025-10-14-add-windsurf-workflows/proposal.md +17 -0
  155. package/references/openspec/openspec/changes/archive/2025-10-14-add-windsurf-workflows/specs/cli-init/spec.md +42 -0
  156. package/references/openspec/openspec/changes/archive/2025-10-14-add-windsurf-workflows/specs/cli-update/spec.md +27 -0
  157. package/references/openspec/openspec/changes/archive/2025-10-14-add-windsurf-workflows/tasks.md +17 -0
  158. package/references/openspec/openspec/changes/archive/2025-10-14-enhance-validation-error-messages/proposal.md +12 -0
  159. package/references/openspec/openspec/changes/archive/2025-10-14-enhance-validation-error-messages/specs/cli-validate/spec.md +39 -0
  160. package/references/openspec/openspec/changes/archive/2025-10-14-enhance-validation-error-messages/tasks.md +12 -0
  161. package/references/openspec/openspec/changes/archive/2025-10-14-improve-agent-instruction-usability/proposal.md +12 -0
  162. package/references/openspec/openspec/changes/archive/2025-10-14-improve-agent-instruction-usability/specs/docs-agent-instructions/spec.md +33 -0
  163. package/references/openspec/openspec/changes/archive/2025-10-14-improve-agent-instruction-usability/tasks.md +11 -0
  164. package/references/openspec/openspec/changes/archive/2025-10-14-slim-root-agents-file/proposal.md +13 -0
  165. package/references/openspec/openspec/changes/archive/2025-10-14-slim-root-agents-file/tasks.md +15 -0
  166. package/references/openspec/openspec/changes/archive/2025-10-14-update-cli-init-enter-selection/proposal.md +14 -0
  167. package/references/openspec/openspec/changes/archive/2025-10-14-update-cli-init-enter-selection/specs/cli-init/spec.md +10 -0
  168. package/references/openspec/openspec/changes/archive/2025-10-14-update-cli-init-enter-selection/tasks.md +8 -0
  169. package/references/openspec/openspec/changes/archive/2025-10-14-update-cli-init-root-agents/proposal.md +15 -0
  170. package/references/openspec/openspec/changes/archive/2025-10-14-update-cli-init-root-agents/specs/cli-init/spec.md +32 -0
  171. package/references/openspec/openspec/changes/archive/2025-10-14-update-cli-init-root-agents/specs/cli-update/spec.md +10 -0
  172. package/references/openspec/openspec/changes/archive/2025-10-14-update-cli-init-root-agents/tasks.md +11 -0
  173. package/references/openspec/openspec/changes/archive/2025-10-14-update-release-automation/proposal.md +49 -0
  174. package/references/openspec/openspec/changes/archive/2025-10-14-update-release-automation/tasks.md +12 -0
  175. package/references/openspec/openspec/changes/archive/2025-10-22-add-archive-command-arguments/proposal.md +17 -0
  176. package/references/openspec/openspec/changes/archive/2025-10-22-add-archive-command-arguments/specs/cli-update/spec.md +32 -0
  177. package/references/openspec/openspec/changes/archive/2025-10-22-add-archive-command-arguments/tasks.md +15 -0
  178. package/references/openspec/openspec/changes/archive/2025-10-22-add-cline-support/proposal.md +15 -0
  179. package/references/openspec/openspec/changes/archive/2025-10-22-add-cline-support/specs/cli-init/spec.md +97 -0
  180. package/references/openspec/openspec/changes/archive/2025-10-22-add-cline-support/tasks.md +19 -0
  181. package/references/openspec/openspec/changes/archive/2025-10-22-add-crush-support/proposal.md +13 -0
  182. package/references/openspec/openspec/changes/archive/2025-10-22-add-crush-support/specs/cli-init/spec.md +67 -0
  183. package/references/openspec/openspec/changes/archive/2025-10-22-add-crush-support/tasks.md +7 -0
  184. package/references/openspec/openspec/changes/archive/2025-10-22-add-factory-slash-commands/proposal.md +12 -0
  185. package/references/openspec/openspec/changes/archive/2025-10-22-add-factory-slash-commands/specs/cli-init/spec.md +54 -0
  186. package/references/openspec/openspec/changes/archive/2025-10-22-add-factory-slash-commands/specs/cli-update/spec.md +54 -0
  187. package/references/openspec/openspec/changes/archive/2025-10-22-add-factory-slash-commands/tasks.md +11 -0
  188. package/references/openspec/openspec/changes/fix-cline-workflows-implementation/proposal.md +13 -0
  189. package/references/openspec/openspec/changes/fix-cline-workflows-implementation/specs/cli-init/spec.md +11 -0
  190. package/references/openspec/openspec/changes/fix-cline-workflows-implementation/tasks.md +13 -0
  191. package/references/openspec/openspec/changes/make-validation-scope-aware/proposal.md +12 -0
  192. package/references/openspec/openspec/changes/make-validation-scope-aware/specs/cli-validate/spec.md +25 -0
  193. package/references/openspec/openspec/changes/make-validation-scope-aware/tasks.md +16 -0
  194. package/references/openspec/openspec/project.md +53 -0
  195. package/references/openspec/openspec/specs/cli-archive/spec.md +210 -0
  196. package/references/openspec/openspec/specs/cli-change/spec.md +91 -0
  197. package/references/openspec/openspec/specs/cli-init/spec.md +311 -0
  198. package/references/openspec/openspec/specs/cli-list/spec.md +103 -0
  199. package/references/openspec/openspec/specs/cli-show/spec.md +85 -0
  200. package/references/openspec/openspec/specs/cli-spec/spec.md +87 -0
  201. package/references/openspec/openspec/specs/cli-update/spec.md +190 -0
  202. package/references/openspec/openspec/specs/cli-validate/spec.md +218 -0
  203. package/references/openspec/openspec/specs/cli-view/spec.md +105 -0
  204. package/references/openspec/openspec/specs/docs-agent-instructions/spec.md +38 -0
  205. package/references/openspec/openspec/specs/openspec-conventions/spec.md +474 -0
  206. package/references/openspec/openspec-parallel-merge-plan.md +98 -0
  207. package/references/openspec/package.json +73 -0
  208. package/references/openspec/pnpm-lock.yaml +2324 -0
  209. package/references/openspec/scripts/pack-version-check.mjs +111 -0
  210. package/references/openspec/src/cli/index.ts +253 -0
  211. package/references/openspec/src/commands/change.ts +291 -0
  212. package/references/openspec/src/commands/show.ts +139 -0
  213. package/references/openspec/src/commands/spec.ts +250 -0
  214. package/references/openspec/src/commands/validate.ts +305 -0
  215. package/references/openspec/src/core/archive.ts +606 -0
  216. package/references/openspec/src/core/config.ts +41 -0
  217. package/references/openspec/src/core/configurators/agents.ts +23 -0
  218. package/references/openspec/src/core/configurators/base.ts +6 -0
  219. package/references/openspec/src/core/configurators/claude.ts +23 -0
  220. package/references/openspec/src/core/configurators/cline.ts +23 -0
  221. package/references/openspec/src/core/configurators/codebuddy.ts +24 -0
  222. package/references/openspec/src/core/configurators/costrict.ts +23 -0
  223. package/references/openspec/src/core/configurators/iflow.ts +23 -0
  224. package/references/openspec/src/core/configurators/qoder.ts +53 -0
  225. package/references/openspec/src/core/configurators/qwen.ts +47 -0
  226. package/references/openspec/src/core/configurators/registry.ts +49 -0
  227. package/references/openspec/src/core/configurators/slash/amazon-q.ts +51 -0
  228. package/references/openspec/src/core/configurators/slash/antigravity.ts +28 -0
  229. package/references/openspec/src/core/configurators/slash/auggie.ts +37 -0
  230. package/references/openspec/src/core/configurators/slash/base.ts +95 -0
  231. package/references/openspec/src/core/configurators/slash/claude.ts +42 -0
  232. package/references/openspec/src/core/configurators/slash/cline.ts +27 -0
  233. package/references/openspec/src/core/configurators/slash/codebuddy.ts +43 -0
  234. package/references/openspec/src/core/configurators/slash/codex.ts +126 -0
  235. package/references/openspec/src/core/configurators/slash/costrict.ts +36 -0
  236. package/references/openspec/src/core/configurators/slash/crush.ts +42 -0
  237. package/references/openspec/src/core/configurators/slash/cursor.ts +42 -0
  238. package/references/openspec/src/core/configurators/slash/factory.ts +41 -0
  239. package/references/openspec/src/core/configurators/slash/gemini.ts +27 -0
  240. package/references/openspec/src/core/configurators/slash/github-copilot.ts +39 -0
  241. package/references/openspec/src/core/configurators/slash/iflow.ts +42 -0
  242. package/references/openspec/src/core/configurators/slash/kilocode.ts +21 -0
  243. package/references/openspec/src/core/configurators/slash/opencode.ts +83 -0
  244. package/references/openspec/src/core/configurators/slash/qoder.ts +84 -0
  245. package/references/openspec/src/core/configurators/slash/qwen.ts +55 -0
  246. package/references/openspec/src/core/configurators/slash/registry.ts +81 -0
  247. package/references/openspec/src/core/configurators/slash/roocode.ts +27 -0
  248. package/references/openspec/src/core/configurators/slash/toml-base.ts +66 -0
  249. package/references/openspec/src/core/configurators/slash/windsurf.ts +27 -0
  250. package/references/openspec/src/core/converters/json-converter.ts +61 -0
  251. package/references/openspec/src/core/index.ts +2 -0
  252. package/references/openspec/src/core/init.ts +986 -0
  253. package/references/openspec/src/core/list.ts +104 -0
  254. package/references/openspec/src/core/parsers/change-parser.ts +234 -0
  255. package/references/openspec/src/core/parsers/markdown-parser.ts +237 -0
  256. package/references/openspec/src/core/parsers/requirement-blocks.ts +234 -0
  257. package/references/openspec/src/core/schemas/base.schema.ts +20 -0
  258. package/references/openspec/src/core/schemas/change.schema.ts +42 -0
  259. package/references/openspec/src/core/schemas/index.ts +20 -0
  260. package/references/openspec/src/core/schemas/spec.schema.ts +17 -0
  261. package/references/openspec/src/core/styles/palette.ts +8 -0
  262. package/references/openspec/src/core/templates/agents-root-stub.ts +16 -0
  263. package/references/openspec/src/core/templates/agents-template.ts +457 -0
  264. package/references/openspec/src/core/templates/claude-template.ts +1 -0
  265. package/references/openspec/src/core/templates/cline-template.ts +1 -0
  266. package/references/openspec/src/core/templates/costrict-template.ts +1 -0
  267. package/references/openspec/src/core/templates/index.ts +50 -0
  268. package/references/openspec/src/core/templates/project-template.ts +38 -0
  269. package/references/openspec/src/core/templates/slash-command-templates.ts +60 -0
  270. package/references/openspec/src/core/update.ts +129 -0
  271. package/references/openspec/src/core/validation/constants.ts +48 -0
  272. package/references/openspec/src/core/validation/types.ts +19 -0
  273. package/references/openspec/src/core/validation/validator.ts +448 -0
  274. package/references/openspec/src/core/view.ts +189 -0
  275. package/references/openspec/src/index.ts +2 -0
  276. package/references/openspec/src/utils/file-system.ts +187 -0
  277. package/references/openspec/src/utils/index.ts +2 -0
  278. package/references/openspec/src/utils/interactive.ts +7 -0
  279. package/references/openspec/src/utils/item-discovery.ts +45 -0
  280. package/references/openspec/src/utils/match.ts +26 -0
  281. package/references/openspec/src/utils/task-progress.ts +43 -0
  282. package/references/openspec/test/cli-e2e/basic.test.ts +156 -0
  283. package/references/openspec/test/commands/change.interactive-show.test.ts +45 -0
  284. package/references/openspec/test/commands/change.interactive-validate.test.ts +48 -0
  285. package/references/openspec/test/commands/show.test.ts +123 -0
  286. package/references/openspec/test/commands/spec.interactive-show.test.ts +44 -0
  287. package/references/openspec/test/commands/spec.interactive-validate.test.ts +44 -0
  288. package/references/openspec/test/commands/spec.test.ts +324 -0
  289. package/references/openspec/test/commands/validate.enriched-output.test.ts +49 -0
  290. package/references/openspec/test/commands/validate.test.ts +133 -0
  291. package/references/openspec/test/core/archive.test.ts +680 -0
  292. package/references/openspec/test/core/commands/change-command.list.test.ts +76 -0
  293. package/references/openspec/test/core/commands/change-command.show-validate.test.ts +111 -0
  294. package/references/openspec/test/core/converters/json-converter.test.ts +184 -0
  295. package/references/openspec/test/core/init.test.ts +1710 -0
  296. package/references/openspec/test/core/list.test.ts +165 -0
  297. package/references/openspec/test/core/parsers/change-parser.test.ts +52 -0
  298. package/references/openspec/test/core/parsers/markdown-parser.test.ts +291 -0
  299. package/references/openspec/test/core/update.test.ts +1642 -0
  300. package/references/openspec/test/core/validation.enriched-messages.test.ts +74 -0
  301. package/references/openspec/test/core/validation.test.ts +489 -0
  302. package/references/openspec/test/core/view.test.ts +79 -0
  303. package/references/openspec/test/fixtures/tmp-init/openspec/changes/c1/proposal.md +7 -0
  304. package/references/openspec/test/fixtures/tmp-init/openspec/changes/c1/specs/alpha/spec.md +8 -0
  305. package/references/openspec/test/fixtures/tmp-init/openspec/specs/alpha/spec.md +12 -0
  306. package/references/openspec/test/helpers/run-cli.ts +139 -0
  307. package/references/openspec/test/utils/file-system.test.ts +211 -0
  308. package/references/openspec/test/utils/marker-updates.test.ts +287 -0
  309. package/references/openspec/tsconfig.json +21 -0
  310. package/references/openspec/vitest.config.ts +25 -0
  311. 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
+ });