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,103 @@
1
+ # List Command Specification
2
+
3
+ ## Purpose
4
+
5
+ The `openspec list` command SHALL provide developers with a quick overview of all active changes in the project, showing their names and task completion status.
6
+ ## Requirements
7
+ ### Requirement: Command Execution
8
+ The command SHALL scan and analyze either active changes or specs based on the selected mode.
9
+
10
+ #### Scenario: Scanning for changes (default)
11
+ - **WHEN** `openspec list` is executed without flags
12
+ - **THEN** scan the `openspec/changes/` directory for change directories
13
+ - **AND** exclude the `archive/` subdirectory from results
14
+ - **AND** parse each change's `tasks.md` file to count task completion
15
+
16
+ #### Scenario: Scanning for specs
17
+ - **WHEN** `openspec list --specs` is executed
18
+ - **THEN** scan the `openspec/specs/` directory for capabilities
19
+ - **AND** read each capability's `spec.md`
20
+ - **AND** parse requirements to compute requirement counts
21
+
22
+ ### Requirement: Task Counting
23
+
24
+ The command SHALL accurately count task completion status using standard markdown checkbox patterns.
25
+
26
+ #### Scenario: Counting tasks in tasks.md
27
+
28
+ - **WHEN** parsing a `tasks.md` file
29
+ - **THEN** count tasks matching these patterns:
30
+ - Completed: Lines containing `- [x]`
31
+ - Incomplete: Lines containing `- [ ]`
32
+ - **AND** calculate total tasks as the sum of completed and incomplete
33
+
34
+ ### Requirement: Output Format
35
+ The command SHALL display items in a clear, readable table format with mode-appropriate progress or counts.
36
+
37
+ #### Scenario: Displaying change list (default)
38
+ - **WHEN** displaying the list of changes
39
+ - **THEN** show a table with columns:
40
+ - Change name (directory name)
41
+ - Task progress (e.g., "3/5 tasks" or "✓ Complete")
42
+
43
+ #### Scenario: Displaying spec list
44
+ - **WHEN** displaying the list of specs
45
+ - **THEN** show a table with columns:
46
+ - Spec id (directory name)
47
+ - Requirement count (e.g., "requirements 12")
48
+
49
+ ### Requirement: Flags
50
+ The command SHALL accept flags to select the noun being listed.
51
+
52
+ #### Scenario: Selecting specs
53
+ - **WHEN** `--specs` is provided
54
+ - **THEN** list specs instead of changes
55
+
56
+ #### Scenario: Selecting changes
57
+ - **WHEN** `--changes` is provided
58
+ - **THEN** list changes explicitly (same as default behavior)
59
+
60
+ ### Requirement: Empty State
61
+ The command SHALL provide clear feedback when no items are present for the selected mode.
62
+
63
+ #### Scenario: Handling empty state (changes)
64
+ - **WHEN** no active changes exist (only archive/ or empty changes/)
65
+ - **THEN** display: "No active changes found."
66
+
67
+ #### Scenario: Handling empty state (specs)
68
+ - **WHEN** no specs directory exists or contains no capabilities
69
+ - **THEN** display: "No specs found."
70
+
71
+ ### Requirement: Error Handling
72
+
73
+ The command SHALL gracefully handle missing files and directories with appropriate messages.
74
+
75
+ #### Scenario: Missing tasks.md file
76
+
77
+ - **WHEN** a change directory has no `tasks.md` file
78
+ - **THEN** display the change with "No tasks" status
79
+
80
+ #### Scenario: Missing changes directory
81
+
82
+ - **WHEN** `openspec/changes/` directory doesn't exist
83
+ - **THEN** display error: "No OpenSpec changes directory found. Run 'openspec init' first."
84
+ - **AND** exit with code 1
85
+
86
+ ### Requirement: Sorting
87
+
88
+ The command SHALL maintain consistent ordering of changes for predictable output.
89
+
90
+ #### Scenario: Ordering changes
91
+
92
+ - **WHEN** displaying multiple changes
93
+ - **THEN** sort them in alphabetical order by change name
94
+
95
+ ## Why
96
+
97
+ Developers need a quick way to:
98
+ - See what changes are in progress
99
+ - Identify which changes are ready to archive
100
+ - Understand the overall project evolution status
101
+ - Get a bird's-eye view without opening multiple files
102
+
103
+ This command provides that visibility with minimal effort, following OpenSpec's philosophy of simplicity and clarity.
@@ -0,0 +1,85 @@
1
+ # cli-show Specification
2
+
3
+ ## Purpose
4
+ TBD - created by archiving change add-interactive-show-command. Update Purpose after archive.
5
+ ## Requirements
6
+ ### Requirement: Top-level show command
7
+
8
+ The CLI SHALL provide a top-level `show` command for displaying changes and specs with intelligent selection.
9
+
10
+ #### Scenario: Interactive show selection
11
+
12
+ - **WHEN** executing `openspec show` without arguments
13
+ - **THEN** prompt user to select type (change or spec)
14
+ - **AND** display list of available items for selected type
15
+ - **AND** show the selected item's content
16
+
17
+ #### Scenario: Non-interactive environments do not prompt
18
+
19
+ - **GIVEN** stdin is not a TTY or `--no-interactive` is provided or environment variable `OPEN_SPEC_INTERACTIVE=0`
20
+ - **WHEN** executing `openspec show` without arguments
21
+ - **THEN** do not prompt
22
+ - **AND** print a helpful hint with examples for `openspec show <item>` or `openspec change/spec show`
23
+ - **AND** exit with code 1
24
+
25
+ #### Scenario: Direct item display
26
+
27
+ - **WHEN** executing `openspec show <item-name>`
28
+ - **THEN** automatically detect if item is a change or spec
29
+ - **AND** display the item's content
30
+ - **AND** use appropriate formatting based on item type
31
+
32
+ #### Scenario: Type detection and ambiguity handling
33
+
34
+ - **WHEN** executing `openspec show <item-name>`
35
+ - **THEN** if `<item-name>` uniquely matches a change or a spec, show that item
36
+ - **AND** if it matches both, print an ambiguity error and suggest `--type change|spec` or using `openspec change show`/`openspec spec show`
37
+ - **AND** if it matches neither, print not-found with nearest-match suggestions
38
+
39
+ #### Scenario: Explicit type override
40
+
41
+ - **WHEN** executing `openspec show --type change <item>`
42
+ - **THEN** treat `<item>` as a change ID and show it (skipping auto-detection)
43
+
44
+ - **WHEN** executing `openspec show --type spec <item>`
45
+ - **THEN** treat `<item>` as a spec ID and show it (skipping auto-detection)
46
+
47
+ ### Requirement: Output format options
48
+
49
+ The show command SHALL support various output formats consistent with existing commands.
50
+
51
+ #### Scenario: JSON output
52
+
53
+ - **WHEN** executing `openspec show <item> --json`
54
+ - **THEN** output the item in JSON format
55
+ - **AND** include parsed metadata and structure
56
+ - **AND** maintain format consistency with existing change/spec show commands
57
+
58
+ #### Scenario: Flag scoping and delegation
59
+
60
+ - **WHEN** showing a change or a spec via the top-level command
61
+ - **THEN** accept common flags such as `--json`
62
+ - **AND** pass through type-specific flags to the corresponding implementation
63
+ - Change-only flags: `--deltas-only` (alias `--requirements-only` deprecated)
64
+ - Spec-only flags: `--requirements`, `--no-scenarios`, `-r/--requirement`
65
+ - **AND** ignore irrelevant flags for the detected type with a warning
66
+
67
+ ### Requirement: Interactivity controls
68
+
69
+ - The CLI SHALL respect `--no-interactive` to disable prompts.
70
+ - The CLI SHALL respect `OPEN_SPEC_INTERACTIVE=0` to disable prompts globally.
71
+ - Interactive prompts SHALL only be shown when stdin is a TTY and interactivity is not disabled.
72
+
73
+ #### Scenario: Change-specific options
74
+
75
+ - **WHEN** showing a change with `openspec show <change-name> --deltas-only`
76
+ - **THEN** display only the deltas in JSON format
77
+ - **AND** maintain compatibility with existing change show options
78
+
79
+ #### Scenario: Spec-specific options
80
+
81
+ - **WHEN** showing a spec with `openspec show <spec-id> --requirements`
82
+ - **THEN** display only requirements in JSON format
83
+ - **AND** support other spec options (--no-scenarios, -r)
84
+ - **AND** maintain compatibility with existing spec show options
85
+
@@ -0,0 +1,87 @@
1
+ # cli-spec Specification
2
+
3
+ ## Purpose
4
+ TBD - created by archiving change add-interactive-show-command. Update Purpose after archive.
5
+ ## Requirements
6
+ ### Requirement: Interactive spec show
7
+
8
+ The spec show command SHALL support interactive selection when no spec-id is provided.
9
+
10
+ #### Scenario: Interactive spec selection for show
11
+
12
+ - **WHEN** executing `openspec spec show` without arguments
13
+ - **THEN** display an interactive list of available specs
14
+ - **AND** allow the user to select a spec to show
15
+ - **AND** display the selected spec content
16
+ - **AND** maintain all existing show options (--json, --requirements, --no-scenarios, -r)
17
+
18
+ #### Scenario: Non-interactive fallback keeps current behavior
19
+
20
+ - **GIVEN** stdin is not a TTY or `--no-interactive` is provided or environment variable `OPEN_SPEC_INTERACTIVE=0`
21
+ - **WHEN** executing `openspec spec show` without a spec-id
22
+ - **THEN** do not prompt interactively
23
+ - **AND** print the existing error message for missing spec-id
24
+ - **AND** set non-zero exit code
25
+
26
+ ### Requirement: Spec Command
27
+
28
+ The system SHALL provide a `spec` command with subcommands for displaying, listing, and validating specifications.
29
+
30
+ #### Scenario: Show spec as JSON
31
+
32
+ - **WHEN** executing `openspec spec show init --json`
33
+ - **THEN** parse the markdown spec file
34
+ - **AND** extract headings and content hierarchically
35
+ - **AND** output valid JSON to stdout
36
+
37
+ #### Scenario: List all specs
38
+
39
+ - **WHEN** executing `openspec spec list`
40
+ - **THEN** scan the openspec/specs directory
41
+ - **AND** return list of all available capabilities
42
+ - **AND** support JSON output with `--json` flag
43
+
44
+ #### Scenario: Filter spec content
45
+
46
+ - **WHEN** executing `openspec spec show init --requirements`
47
+ - **THEN** display only requirement names and SHALL statements
48
+ - **AND** exclude scenario content
49
+
50
+ #### Scenario: Validate spec structure
51
+
52
+ - **WHEN** executing `openspec spec validate init`
53
+ - **THEN** parse the spec file
54
+ - **AND** validate against Zod schema
55
+ - **AND** report any structural issues
56
+
57
+ ### Requirement: JSON Schema Definition
58
+
59
+ The system SHALL define Zod schemas that accurately represent the spec structure for runtime validation.
60
+
61
+ #### Scenario: Schema validation
62
+
63
+ - **WHEN** parsing a spec into JSON
64
+ - **THEN** validate the structure using Zod schemas
65
+ - **AND** ensure all required fields are present
66
+ - **AND** provide clear error messages for validation failures
67
+
68
+ ### Requirement: Interactive spec validation
69
+
70
+ The spec validate command SHALL support interactive selection when no spec-id is provided.
71
+
72
+ #### Scenario: Interactive spec selection for validation
73
+
74
+ - **WHEN** executing `openspec spec validate` without arguments
75
+ - **THEN** display an interactive list of available specs
76
+ - **AND** allow the user to select a spec to validate
77
+ - **AND** validate the selected spec
78
+ - **AND** maintain all existing validation options (--strict, --json)
79
+
80
+ #### Scenario: Non-interactive fallback keeps current behavior
81
+
82
+ - **GIVEN** stdin is not a TTY or `--no-interactive` is provided or environment variable `OPEN_SPEC_INTERACTIVE=0`
83
+ - **WHEN** executing `openspec spec validate` without a spec-id
84
+ - **THEN** do not prompt interactively
85
+ - **AND** print the existing error message for missing spec-id
86
+ - **AND** set non-zero exit code
87
+
@@ -0,0 +1,190 @@
1
+ # Update Command Specification
2
+
3
+ ## Purpose
4
+
5
+ As a developer using OpenSpec, I want to update the OpenSpec instructions in my project when new versions are released, so that I can benefit from improvements to AI agent instructions.
6
+ ## Requirements
7
+ ### Requirement: Update Behavior
8
+ The update command SHALL update OpenSpec instruction files to the latest templates in a team-friendly manner.
9
+
10
+ #### Scenario: Running update command
11
+ - **WHEN** a user runs `openspec update`
12
+ - **THEN** replace `openspec/AGENTS.md` with the latest template
13
+ - **AND** if a root-level stub (`AGENTS.md`/`CLAUDE.md`) exists, refresh it so it points to `@/openspec/AGENTS.md`
14
+
15
+ ### Requirement: Prerequisites
16
+
17
+ The command SHALL require an existing OpenSpec structure before allowing updates.
18
+
19
+ #### Scenario: Checking prerequisites
20
+
21
+ - **GIVEN** the command requires an existing `openspec` directory (created by `openspec init`)
22
+ - **WHEN** the `openspec` directory does not exist
23
+ - **THEN** display error: "No OpenSpec directory found. Run 'openspec init' first."
24
+ - **AND** exit with code 1
25
+
26
+ ### Requirement: File Handling
27
+ The update command SHALL handle file updates in a predictable and safe manner.
28
+
29
+ #### Scenario: Updating files
30
+ - **WHEN** updating files
31
+ - **THEN** completely replace `openspec/AGENTS.md` with the latest template
32
+ - **AND** if a root-level stub exists, update the managed block content so it keeps directing teammates to `@/openspec/AGENTS.md`
33
+
34
+ ### Requirement: Tool-Agnostic Updates
35
+ The update command SHALL refresh OpenSpec-managed files in a predictable manner while respecting each team's chosen tooling.
36
+
37
+ #### Scenario: Updating files
38
+ - **WHEN** updating files
39
+ - **THEN** completely replace `openspec/AGENTS.md` with the latest template
40
+ - **AND** create or refresh the root-level `AGENTS.md` stub using the managed marker block, even if the file was previously absent
41
+ - **AND** update only the OpenSpec-managed sections inside existing AI tool files, leaving user-authored content untouched
42
+ - **AND** avoid creating new native-tool configuration files (slash commands, CLAUDE.md, etc.) unless they already exist
43
+
44
+ ### Requirement: Core Files Always Updated
45
+ The update command SHALL always update the core OpenSpec files and display an ASCII-safe success message.
46
+
47
+ #### Scenario: Successful update
48
+ - **WHEN** the update completes successfully
49
+ - **THEN** replace `openspec/AGENTS.md` with the latest template
50
+ - **AND** if a root-level stub exists, refresh it so it still directs contributors to `@/openspec/AGENTS.md`
51
+
52
+ ### Requirement: Slash Command Updates
53
+ The update command SHALL refresh existing slash command files for configured tools without creating new ones, and ensure the OpenCode archive command accepts change ID arguments.
54
+
55
+ #### Scenario: Updating slash commands for Claude Code
56
+ - **WHEN** `.claude/commands/openspec/` contains `proposal.md`, `apply.md`, and `archive.md`
57
+ - **THEN** refresh each file using shared templates
58
+ - **AND** ensure templates include instructions for the relevant workflow stage
59
+
60
+ #### Scenario: Updating slash commands for CodeBuddy Code
61
+ - **WHEN** `.codebuddy/commands/openspec/` contains `proposal.md`, `apply.md`, and `archive.md`
62
+ - **THEN** refresh each file using shared templates
63
+ - **AND** ensure templates include instructions for the relevant workflow stage
64
+
65
+ #### Scenario: Updating slash commands for Cline
66
+ - **WHEN** `.clinerules/` contains `openspec-proposal.md`, `openspec-apply.md`, and `openspec-archive.md`
67
+ - **THEN** refresh each file using shared templates
68
+ - **AND** include Cline-specific Markdown heading frontmatter
69
+ - **AND** ensure templates include instructions for the relevant workflow stage
70
+
71
+ #### Scenario: Updating slash commands for Crush
72
+ - **WHEN** `.crush/commands/` contains `openspec/proposal.md`, `openspec/apply.md`, and `openspec/archive.md`
73
+ - **THEN** refresh each file using shared templates
74
+ - **AND** include Crush-specific frontmatter with OpenSpec category and tags
75
+ - **AND** ensure templates include instructions for the relevant workflow stage
76
+
77
+ #### Scenario: Updating slash commands for Cursor
78
+ - **WHEN** `.cursor/commands/` contains `openspec-proposal.md`, `openspec-apply.md`, and `openspec-archive.md`
79
+ - **THEN** refresh each file using shared templates
80
+ - **AND** ensure templates include instructions for the relevant workflow stage
81
+
82
+ #### Scenario: Updating slash commands for Factory Droid
83
+ - **WHEN** `.factory/commands/` contains `openspec-proposal.md`, `openspec-apply.md`, and `openspec-archive.md`
84
+ - **THEN** refresh each file using the shared Factory templates that include YAML frontmatter for the `description` and `argument-hint` fields
85
+ - **AND** ensure the template body retains the `$ARGUMENTS` placeholder so user input keeps flowing into droid
86
+ - **AND** update only the content inside the OpenSpec managed markers, leaving any unmanaged notes untouched
87
+ - **AND** skip creating missing files during update
88
+
89
+ #### Scenario: Updating slash commands for OpenCode
90
+ - **WHEN** `.opencode/command/` contains `openspec-proposal.md`, `openspec-apply.md`, and `openspec-archive.md`
91
+ - **THEN** refresh each file using shared templates
92
+ - **AND** ensure templates include instructions for the relevant workflow stage
93
+ - **AND** ensure the archive command includes `$ARGUMENTS` placeholder in frontmatter for accepting change ID arguments
94
+
95
+ #### Scenario: Updating slash commands for Windsurf
96
+ - **WHEN** `.windsurf/workflows/` contains `openspec-proposal.md`, `openspec-apply.md`, and `openspec-archive.md`
97
+ - **THEN** refresh each file using shared templates wrapped in OpenSpec markers
98
+ - **AND** ensure templates include instructions for the relevant workflow stage
99
+ - **AND** skip creating missing files (the update command only refreshes what already exists)
100
+
101
+ #### Scenario: Updating slash commands for Kilo Code
102
+ - **WHEN** `.kilocode/workflows/` contains `openspec-proposal.md`, `openspec-apply.md`, and `openspec-archive.md`
103
+ - **THEN** refresh each file using shared templates wrapped in OpenSpec markers
104
+ - **AND** ensure templates include instructions for the relevant workflow stage
105
+ - **AND** skip creating missing files (the update command only refreshes what already exists)
106
+
107
+ #### Scenario: Updating slash commands for Codex
108
+ - **GIVEN** the global Codex prompt directory contains `openspec-proposal.md`, `openspec-apply.md`, and `openspec-archive.md`
109
+ - **WHEN** a user runs `openspec update`
110
+ - **THEN** refresh each file using the shared slash-command templates (including placeholder guidance)
111
+ - **AND** preserve any unmanaged content outside the OpenSpec marker block
112
+ - **AND** skip creation when a Codex prompt file is missing
113
+
114
+ #### Scenario: Updating slash commands for GitHub Copilot
115
+ - **WHEN** `.github/prompts/` contains `openspec-proposal.prompt.md`, `openspec-apply.prompt.md`, and `openspec-archive.prompt.md`
116
+ - **THEN** refresh each file using shared templates while preserving the YAML frontmatter
117
+ - **AND** update only the OpenSpec-managed block between markers
118
+ - **AND** ensure templates include instructions for the relevant workflow stage
119
+
120
+ #### Scenario: Updating slash commands for Gemini CLI
121
+ - **WHEN** `.gemini/commands/openspec/` contains `proposal.toml`, `apply.toml`, and `archive.toml`
122
+ - **THEN** refresh the body of each file using the shared proposal/apply/archive templates
123
+ - **AND** replace only the content between `<!-- OPENSPEC:START -->` and `<!-- OPENSPEC:END -->` markers inside the `prompt = """` block so the TOML framing (`description`, `prompt`) stays intact
124
+ - **AND** skip creating any missing `.toml` files during update; only pre-existing Gemini commands are refreshed
125
+
126
+ #### Scenario: Updating slash commands for iFlow CLI
127
+ - **WHEN** `.iflow/commands/` contains `openspec-proposal.md`, `openspec-apply.md`, and `openspec-archive.md`
128
+ - **THEN** refresh each file using shared templates
129
+ - **AND** preserve the YAML frontmatter with `name`, `id`, `category`, and `description` fields
130
+ - **AND** update only the OpenSpec-managed block between markers
131
+ - **AND** ensure templates include instructions for the relevant workflow stage
132
+
133
+ #### Scenario: Missing slash command file
134
+ - **WHEN** a tool lacks a slash command file
135
+ - **THEN** do not create a new file during update
136
+
137
+ ### Requirement: Archive Command Argument Support
138
+ The archive slash command template SHALL support optional change ID arguments for tools that support `$ARGUMENTS` placeholder.
139
+
140
+ #### Scenario: Archive command with change ID argument
141
+ - **WHEN** a user invokes `/openspec:archive <change-id>` with a change ID
142
+ - **THEN** the template SHALL instruct the AI to validate the provided change ID against `openspec list`
143
+ - **AND** use the provided change ID for archiving if valid
144
+ - **AND** fail fast if the provided change ID doesn't match an archivable change
145
+
146
+ #### Scenario: Archive command without argument (backward compatibility)
147
+ - **WHEN** a user invokes `/openspec:archive` without providing a change ID
148
+ - **THEN** the template SHALL instruct the AI to identify the change ID from context or by running `openspec list`
149
+ - **AND** proceed with the existing behavior (maintaining backward compatibility)
150
+
151
+ #### Scenario: OpenCode archive template generation
152
+ - **WHEN** generating the OpenCode archive slash command file
153
+ - **THEN** include the `$ARGUMENTS` placeholder in the frontmatter
154
+ - **AND** wrap it in a clear structure like `<ChangeId>\n $ARGUMENTS\n</ChangeId>` to indicate the expected argument
155
+ - **AND** include validation steps in the template body to check if the change ID is valid
156
+
157
+ ## Edge Cases
158
+
159
+ ### Requirement: Error Handling
160
+
161
+ The command SHALL handle edge cases gracefully.
162
+
163
+ #### Scenario: File permission errors
164
+
165
+ - **WHEN** file write fails
166
+ - **THEN** let the error bubble up naturally with file path
167
+
168
+ #### Scenario: Missing AI tool files
169
+
170
+ - **WHEN** an AI tool configuration file doesn't exist
171
+ - **THEN** skip updating that file
172
+ - **AND** do not create it
173
+
174
+ #### Scenario: Custom directory names
175
+
176
+ - **WHEN** considering custom directory names
177
+ - **THEN** not supported in this change
178
+ - **AND** the default directory name `openspec` SHALL be used
179
+
180
+ ## Success Criteria
181
+
182
+ Users SHALL be able to:
183
+ - Update OpenSpec instructions with a single command
184
+ - Get the latest AI agent instructions
185
+ - See clear confirmation of the update
186
+
187
+ The update process SHALL be:
188
+ - Simple and fast (no version checking)
189
+ - Predictable (same result every time)
190
+ - Self-contained (no network required)
@@ -0,0 +1,218 @@
1
+ # cli-validate Specification
2
+
3
+ ## Purpose
4
+ TBD - created by archiving change improve-validate-error-messages. Update Purpose after archive.
5
+ ## Requirements
6
+ ### Requirement: Validation SHALL provide actionable remediation steps
7
+ Validation output SHALL include specific guidance to fix each error, including expected structure, example headers, and suggested commands to verify fixes.
8
+
9
+ #### Scenario: No deltas found in change
10
+ - **WHEN** validating a change with zero parsed deltas
11
+ - **THEN** show error "No deltas found" with guidance:
12
+ - Explain that change specs must include `## ADDED Requirements`, `## MODIFIED Requirements`, `## REMOVED Requirements`, or `## RENAMED Requirements`
13
+ - Remind authors that files must live under `openspec/changes/{id}/specs/<capability>/spec.md`
14
+ - Include an explicit note: "Spec delta files cannot start with titles before the operation headers"
15
+ - Suggest running `openspec change show {id} --json --deltas-only` for debugging
16
+
17
+ #### Scenario: Missing required sections
18
+ - **WHEN** a required section is missing
19
+ - **THEN** include expected header names and a minimal skeleton:
20
+ - For Spec: `## Purpose`, `## Requirements`
21
+ - For Change: `## Why`, `## What Changes`
22
+ - Provide an example snippet of the missing section with placeholder prose ready to copy
23
+ - Mention the quick-reference section in `openspec/AGENTS.md` as the authoritative template
24
+
25
+ #### Scenario: Missing requirement descriptive text
26
+ - **WHEN** a requirement header lacks descriptive text before scenarios
27
+ - **THEN** emit an error explaining that `### Requirement:` lines must be followed by narrative text before any `#### Scenario:` headers
28
+ - Show compliant example: "### Requirement: Foo" followed by "The system SHALL ..."
29
+ - Suggest adding 1-2 sentences describing the normative behavior prior to listing scenarios
30
+ - Reference the pre-validation checklist in `openspec/AGENTS.md`
31
+
32
+ ### Requirement: Validator SHALL detect likely misformatted scenarios and warn with a fix
33
+ The validator SHALL recognize bulleted lines that look like scenarios (e.g., lines beginning with WHEN/THEN/AND) and emit a targeted warning with a conversion example to `#### Scenario:`.
34
+
35
+ #### Scenario: Bulleted WHEN/THEN under a Requirement
36
+ - **WHEN** bullets that start with WHEN/THEN/AND are found under a requirement without any `#### Scenario:` headers
37
+ - **THEN** emit warning: "Scenarios must use '#### Scenario:' headers", and show a conversion template:
38
+ ```
39
+ #### Scenario: Short name
40
+ - **WHEN** ...
41
+ - **THEN** ...
42
+ - **AND** ...
43
+ ```
44
+
45
+ ### Requirement: All issues SHALL include file paths and structured locations
46
+ Error, warning, and info messages SHALL include:
47
+ - Source file path (`openspec/changes/{id}/proposal.md`, `.../specs/{cap}/spec.md`)
48
+ - Structured path (e.g., `deltas[0].requirements[0].scenarios`)
49
+
50
+ #### Scenario: Zod validation error
51
+ - **WHEN** a schema validation fails
52
+ - **THEN** the message SHALL include `file`, `path`, and a remediation hint if applicable
53
+
54
+ ### Requirement: Invalid results SHALL include a Next steps footer in human-readable output
55
+ The CLI SHALL append a Next steps footer when the item is invalid and not using `--json`, including:
56
+ - Summary line with counts
57
+ - Top-3 guidance bullets (contextual to the most frequent or blocking errors)
58
+ - A suggestion to re-run with `--json` and/or the debug command
59
+
60
+ #### Scenario: Change invalid summary
61
+ - **WHEN** a change validation fails
62
+ - **THEN** print "Next steps" with 2-3 targeted bullets and suggest `openspec change show <id> --json --deltas-only`
63
+
64
+ ### Requirement: Top-level validate command
65
+
66
+ The CLI SHALL provide a top-level `validate` command for validating changes and specs with flexible selection options.
67
+
68
+ #### Scenario: Interactive validation selection
69
+
70
+ - **WHEN** executing `openspec validate` without arguments
71
+ - **THEN** prompt user to select what to validate (all, changes, specs, or specific item)
72
+ - **AND** perform validation based on selection
73
+ - **AND** display results with appropriate formatting
74
+
75
+ #### Scenario: Non-interactive environments do not prompt
76
+
77
+ - **GIVEN** stdin is not a TTY or `--no-interactive` is provided or environment variable `OPEN_SPEC_INTERACTIVE=0`
78
+ - **WHEN** executing `openspec validate` without arguments
79
+ - **THEN** do not prompt interactively
80
+ - **AND** print a helpful hint listing available commands/flags and exit with code 1
81
+
82
+ #### Scenario: Direct item validation
83
+
84
+ - **WHEN** executing `openspec validate <item-name>`
85
+ - **THEN** automatically detect if item is a change or spec
86
+ - **AND** validate the specified item
87
+ - **AND** display validation results
88
+
89
+ ### Requirement: Bulk and filtered validation
90
+
91
+ The validate command SHALL support flags for bulk validation (--all) and filtered validation by type (--changes, --specs).
92
+
93
+ #### Scenario: Validate everything
94
+
95
+ - **WHEN** executing `openspec validate --all`
96
+ - **THEN** validate all changes in openspec/changes/ (excluding archive)
97
+ - **AND** validate all specs in openspec/specs/
98
+ - **AND** display a summary showing passed/failed items
99
+ - **AND** exit with code 1 if any validation fails
100
+
101
+ #### Scenario: Scope of bulk validation
102
+
103
+ - **WHEN** validating with `--all` or `--changes`
104
+ - **THEN** include all change proposals under `openspec/changes/`
105
+ - **AND** exclude the `openspec/changes/archive/` directory
106
+
107
+ - **WHEN** validating with `--specs`
108
+ - **THEN** include all specs that have a `spec.md` under `openspec/specs/<id>/spec.md`
109
+
110
+ #### Scenario: Validate all changes
111
+
112
+ - **WHEN** executing `openspec validate --changes`
113
+ - **THEN** validate all changes in openspec/changes/ (excluding archive)
114
+ - **AND** display results for each change
115
+ - **AND** show summary statistics
116
+
117
+ #### Scenario: Validate all specs
118
+
119
+ - **WHEN** executing `openspec validate --specs`
120
+ - **THEN** validate all specs in openspec/specs/
121
+ - **AND** display results for each spec
122
+ - **AND** show summary statistics
123
+
124
+ ### Requirement: Validation options and progress indication
125
+
126
+ The validate command SHALL support standard validation options (--strict, --json) and display progress during bulk operations.
127
+
128
+ #### Scenario: Strict validation
129
+
130
+ - **WHEN** executing `openspec validate --all --strict`
131
+ - **THEN** apply strict validation to all items
132
+ - **AND** treat warnings as errors
133
+ - **AND** fail if any item has warnings or errors
134
+
135
+ #### Scenario: JSON output
136
+
137
+ - **WHEN** executing `openspec validate --all --json`
138
+ - **THEN** output validation results as JSON
139
+ - **AND** include detailed issues for each item
140
+ - **AND** include summary statistics
141
+
142
+ #### Scenario: JSON output schema for bulk validation
143
+
144
+ - **WHEN** executing `openspec validate --all --json` (or `--changes` / `--specs`)
145
+ - **THEN** output a JSON object with the following shape:
146
+ - `items`: Array of objects with fields `{ id: string, type: "change"|"spec", valid: boolean, issues: Issue[], durationMs: number }`
147
+ - `summary`: Object `{ totals: { items: number, passed: number, failed: number }, byType: { change?: { items: number, passed: number, failed: number }, spec?: { items: number, passed: number, failed: number } } }`
148
+ - `version`: String identifier for the schema (e.g., `"1.0"`)
149
+ - **AND** exit with code 1 if any `items[].valid === false`
150
+
151
+ Where `Issue` follows the existing per-item validation report shape `{ level: "ERROR"|"WARNING"|"INFO", path: string, message: string }`.
152
+
153
+ #### Scenario: Show validation progress
154
+
155
+ - **WHEN** validating multiple items (--all, --changes, or --specs)
156
+ - **THEN** show progress indicator or status updates
157
+ - **AND** indicate which item is currently being validated
158
+ - **AND** display running count of passed/failed items
159
+
160
+ #### Scenario: Concurrency limits for performance
161
+
162
+ - **WHEN** validating multiple items
163
+ - **THEN** run validations with a bounded concurrency (e.g., 4–8 in parallel)
164
+ - **AND** ensure progress indicators remain responsive
165
+
166
+ ### Requirement: Item type detection and ambiguity handling
167
+
168
+ The validate command SHALL handle ambiguous names and explicit type overrides to ensure clear, deterministic behavior.
169
+
170
+ #### Scenario: Direct item validation with automatic type detection
171
+
172
+ - **WHEN** executing `openspec validate <item-name>`
173
+ - **THEN** if `<item-name>` uniquely matches a change or a spec, validate that item
174
+
175
+ #### Scenario: Ambiguity between change and spec names
176
+
177
+ - **GIVEN** `<item-name>` exists both as a change and as a spec
178
+ - **WHEN** executing `openspec validate <item-name>`
179
+ - **THEN** print an ambiguity error explaining both matches
180
+ - **AND** suggest passing `--type change` or `--type spec`, or using `openspec change validate` / `openspec spec validate`
181
+ - **AND** exit with code 1 without performing validation
182
+
183
+ #### Scenario: Unknown item name
184
+
185
+ - **WHEN** the `<item-name>` matches neither a change nor a spec
186
+ - **THEN** print a not-found error
187
+ - **AND** show nearest-match suggestions when available
188
+ - **AND** exit with code 1
189
+
190
+ #### Scenario: Explicit type override
191
+
192
+ - **WHEN** executing `openspec validate --type change <item>`
193
+ - **THEN** treat `<item>` as a change ID and validate it (skipping auto-detection)
194
+
195
+ - **WHEN** executing `openspec validate --type spec <item>`
196
+ - **THEN** treat `<item>` as a spec ID and validate it (skipping auto-detection)
197
+
198
+ ### Requirement: Interactivity controls
199
+
200
+ - The CLI SHALL respect `--no-interactive` to disable prompts.
201
+ - The CLI SHALL respect `OPEN_SPEC_INTERACTIVE=0` to disable prompts globally.
202
+ - Interactive prompts SHALL only be shown when stdin is a TTY and interactivity is not disabled.
203
+
204
+ #### Scenario: Disabling prompts via flags or environment
205
+
206
+ - **WHEN** `openspec validate` is executed with `--no-interactive` or with environment `OPEN_SPEC_INTERACTIVE=0`
207
+ - **THEN** the CLI SHALL not display interactive prompts
208
+ - **AND** SHALL print non-interactive hints or chosen outputs as appropriate
209
+
210
+ ### Requirement: Parser SHALL handle cross-platform line endings
211
+ The markdown parser SHALL correctly identify sections regardless of line ending format (LF, CRLF, CR).
212
+
213
+ #### Scenario: Required sections parsed with CRLF line endings
214
+ - **GIVEN** a change proposal markdown saved with CRLF line endings
215
+ - **AND** the document contains `## Why` and `## What Changes`
216
+ - **WHEN** running `openspec validate <change-id>`
217
+ - **THEN** validation SHALL recognize the sections and NOT raise parsing errors
218
+