@dedesfr/prompter 0.6.14 → 0.7.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 (379) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cli/index.js +144 -12
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/commands/archive.d.ts +11 -0
  5. package/dist/commands/archive.d.ts.map +1 -0
  6. package/dist/commands/archive.js +280 -0
  7. package/dist/commands/archive.js.map +1 -0
  8. package/dist/commands/change.d.ts +35 -0
  9. package/dist/commands/change.d.ts.map +1 -0
  10. package/dist/commands/change.js +277 -0
  11. package/dist/commands/change.js.map +1 -0
  12. package/dist/commands/config.d.ts +8 -0
  13. package/dist/commands/config.d.ts.map +1 -0
  14. package/dist/commands/config.js +198 -0
  15. package/dist/commands/config.js.map +1 -0
  16. package/dist/commands/guide.d.ts.map +1 -1
  17. package/dist/commands/guide.js +4 -0
  18. package/dist/commands/guide.js.map +1 -1
  19. package/dist/commands/list.d.ts +2 -2
  20. package/dist/commands/list.d.ts.map +1 -1
  21. package/dist/commands/list.js +153 -47
  22. package/dist/commands/list.js.map +1 -1
  23. package/dist/commands/show.d.ts +14 -0
  24. package/dist/commands/show.d.ts.map +1 -0
  25. package/dist/commands/show.js +132 -0
  26. package/dist/commands/show.js.map +1 -0
  27. package/dist/commands/spec.d.ts +15 -0
  28. package/dist/commands/spec.d.ts.map +1 -0
  29. package/dist/commands/spec.js +225 -0
  30. package/dist/commands/spec.js.map +1 -0
  31. package/dist/commands/validate.d.ts +24 -0
  32. package/dist/commands/validate.d.ts.map +1 -0
  33. package/dist/commands/validate.js +294 -0
  34. package/dist/commands/validate.js.map +1 -0
  35. package/dist/core/artifact-graph/graph.d.ts +56 -0
  36. package/dist/core/artifact-graph/graph.d.ts.map +1 -0
  37. package/dist/core/artifact-graph/graph.js +141 -0
  38. package/dist/core/artifact-graph/graph.js.map +1 -0
  39. package/dist/core/artifact-graph/index.d.ts +7 -0
  40. package/dist/core/artifact-graph/index.d.ts.map +1 -0
  41. package/dist/core/artifact-graph/index.js +13 -0
  42. package/dist/core/artifact-graph/index.js.map +1 -0
  43. package/dist/core/artifact-graph/instruction-loader.d.ts +130 -0
  44. package/dist/core/artifact-graph/instruction-loader.d.ts.map +1 -0
  45. package/dist/core/artifact-graph/instruction-loader.js +173 -0
  46. package/dist/core/artifact-graph/instruction-loader.js.map +1 -0
  47. package/dist/core/artifact-graph/resolver.d.ts +61 -0
  48. package/dist/core/artifact-graph/resolver.d.ts.map +1 -0
  49. package/dist/core/artifact-graph/resolver.js +187 -0
  50. package/dist/core/artifact-graph/resolver.js.map +1 -0
  51. package/dist/core/artifact-graph/schema.d.ts +13 -0
  52. package/dist/core/artifact-graph/schema.d.ts.map +1 -0
  53. package/dist/core/artifact-graph/schema.js +108 -0
  54. package/dist/core/artifact-graph/schema.js.map +1 -0
  55. package/dist/core/artifact-graph/state.d.ts +12 -0
  56. package/dist/core/artifact-graph/state.d.ts.map +1 -0
  57. package/dist/core/artifact-graph/state.js +54 -0
  58. package/dist/core/artifact-graph/state.js.map +1 -0
  59. package/dist/core/artifact-graph/types.d.ts +45 -0
  60. package/dist/core/artifact-graph/types.d.ts.map +1 -0
  61. package/dist/core/artifact-graph/types.js +43 -0
  62. package/dist/core/artifact-graph/types.js.map +1 -0
  63. package/dist/core/completions/command-registry.d.ts +7 -0
  64. package/dist/core/completions/command-registry.d.ts.map +1 -0
  65. package/dist/core/completions/command-registry.js +380 -0
  66. package/dist/core/completions/command-registry.js.map +1 -0
  67. package/dist/core/completions/completion-provider.d.ts +60 -0
  68. package/dist/core/completions/completion-provider.d.ts.map +1 -0
  69. package/dist/core/completions/completion-provider.js +102 -0
  70. package/dist/core/completions/completion-provider.js.map +1 -0
  71. package/dist/core/completions/generators/bash-generator.d.ts +32 -0
  72. package/dist/core/completions/generators/bash-generator.d.ts.map +1 -0
  73. package/dist/core/completions/generators/bash-generator.js +174 -0
  74. package/dist/core/completions/generators/bash-generator.js.map +1 -0
  75. package/dist/core/completions/generators/fish-generator.d.ts +32 -0
  76. package/dist/core/completions/generators/fish-generator.d.ts.map +1 -0
  77. package/dist/core/completions/generators/fish-generator.js +157 -0
  78. package/dist/core/completions/generators/fish-generator.js.map +1 -0
  79. package/dist/core/completions/generators/powershell-generator.d.ts +33 -0
  80. package/dist/core/completions/generators/powershell-generator.d.ts.map +1 -0
  81. package/dist/core/completions/generators/powershell-generator.js +207 -0
  82. package/dist/core/completions/generators/powershell-generator.js.map +1 -0
  83. package/dist/core/completions/generators/zsh-generator.d.ts +44 -0
  84. package/dist/core/completions/generators/zsh-generator.d.ts.map +1 -0
  85. package/dist/core/completions/generators/zsh-generator.js +250 -0
  86. package/dist/core/completions/generators/zsh-generator.js.map +1 -0
  87. package/dist/core/completions/templates/bash-templates.d.ts +6 -0
  88. package/dist/core/completions/templates/bash-templates.d.ts.map +1 -0
  89. package/dist/core/completions/templates/bash-templates.js +24 -0
  90. package/dist/core/completions/templates/bash-templates.js.map +1 -0
  91. package/dist/core/completions/templates/fish-templates.d.ts +7 -0
  92. package/dist/core/completions/templates/fish-templates.d.ts.map +1 -0
  93. package/dist/core/completions/templates/fish-templates.js +39 -0
  94. package/dist/core/completions/templates/fish-templates.js.map +1 -0
  95. package/dist/core/completions/templates/powershell-templates.d.ts +6 -0
  96. package/dist/core/completions/templates/powershell-templates.d.ts.map +1 -0
  97. package/dist/core/completions/templates/powershell-templates.js +25 -0
  98. package/dist/core/completions/templates/powershell-templates.js.map +1 -0
  99. package/dist/core/completions/templates/zsh-templates.d.ts +6 -0
  100. package/dist/core/completions/templates/zsh-templates.d.ts.map +1 -0
  101. package/dist/core/completions/templates/zsh-templates.js +36 -0
  102. package/dist/core/completions/templates/zsh-templates.js.map +1 -0
  103. package/dist/core/completions/types.d.ts +78 -0
  104. package/dist/core/completions/types.d.ts.map +1 -0
  105. package/dist/core/completions/types.js +2 -0
  106. package/dist/core/completions/types.js.map +1 -0
  107. package/dist/core/config-schema.d.ts +76 -0
  108. package/dist/core/config-schema.d.ts.map +1 -0
  109. package/dist/core/config-schema.js +200 -0
  110. package/dist/core/config-schema.js.map +1 -0
  111. package/dist/core/config.d.ts.map +1 -1
  112. package/dist/core/config.js +18 -0
  113. package/dist/core/config.js.map +1 -1
  114. package/dist/core/configurators/slash/antigravity.d.ts.map +1 -1
  115. package/dist/core/configurators/slash/antigravity.js +6 -0
  116. package/dist/core/configurators/slash/antigravity.js.map +1 -1
  117. package/dist/core/configurators/slash/base.js +1 -1
  118. package/dist/core/configurators/slash/base.js.map +1 -1
  119. package/dist/core/configurators/slash/claude.d.ts.map +1 -1
  120. package/dist/core/configurators/slash/claude.js +6 -0
  121. package/dist/core/configurators/slash/claude.js.map +1 -1
  122. package/dist/core/configurators/slash/codex.d.ts.map +1 -1
  123. package/dist/core/configurators/slash/codex.js +6 -0
  124. package/dist/core/configurators/slash/codex.js.map +1 -1
  125. package/dist/core/configurators/slash/github-copilot.d.ts.map +1 -1
  126. package/dist/core/configurators/slash/github-copilot.js +6 -0
  127. package/dist/core/configurators/slash/github-copilot.js.map +1 -1
  128. package/dist/core/configurators/slash/kilocode.d.ts.map +1 -1
  129. package/dist/core/configurators/slash/kilocode.js +6 -0
  130. package/dist/core/configurators/slash/kilocode.js.map +1 -1
  131. package/dist/core/configurators/slash/opencode.d.ts.map +1 -1
  132. package/dist/core/configurators/slash/opencode.js +6 -0
  133. package/dist/core/configurators/slash/opencode.js.map +1 -1
  134. package/dist/core/converters/json-converter.d.ts +6 -0
  135. package/dist/core/converters/json-converter.d.ts.map +1 -0
  136. package/dist/core/converters/json-converter.js +51 -0
  137. package/dist/core/converters/json-converter.js.map +1 -0
  138. package/dist/core/global-config.d.ts +39 -0
  139. package/dist/core/global-config.d.ts.map +1 -0
  140. package/dist/core/global-config.js +115 -0
  141. package/dist/core/global-config.js.map +1 -0
  142. package/dist/core/parsers/change-parser.d.ts +13 -0
  143. package/dist/core/parsers/change-parser.d.ts.map +1 -0
  144. package/dist/core/parsers/change-parser.js +193 -0
  145. package/dist/core/parsers/change-parser.js.map +1 -0
  146. package/dist/core/parsers/markdown-parser.d.ts +22 -0
  147. package/dist/core/parsers/markdown-parser.d.ts.map +1 -0
  148. package/dist/core/parsers/markdown-parser.js +187 -0
  149. package/dist/core/parsers/markdown-parser.js.map +1 -0
  150. package/dist/core/parsers/requirement-blocks.d.ts +37 -0
  151. package/dist/core/parsers/requirement-blocks.d.ts.map +1 -0
  152. package/dist/core/parsers/requirement-blocks.js +201 -0
  153. package/dist/core/parsers/requirement-blocks.js.map +1 -0
  154. package/dist/core/prompt-templates.d.ts +3 -0
  155. package/dist/core/prompt-templates.d.ts.map +1 -1
  156. package/dist/core/prompt-templates.js +66 -0
  157. package/dist/core/prompt-templates.js.map +1 -1
  158. package/dist/core/schemas/base.schema.d.ts +13 -0
  159. package/dist/core/schemas/base.schema.d.ts.map +1 -0
  160. package/dist/core/schemas/base.schema.js +13 -0
  161. package/dist/core/schemas/base.schema.js.map +1 -0
  162. package/dist/core/schemas/change.schema.d.ts +73 -0
  163. package/dist/core/schemas/change.schema.d.ts.map +1 -0
  164. package/dist/core/schemas/change.schema.js +31 -0
  165. package/dist/core/schemas/change.schema.js.map +1 -0
  166. package/dist/core/schemas/index.d.ts +4 -0
  167. package/dist/core/schemas/index.d.ts.map +1 -0
  168. package/dist/core/schemas/index.js +4 -0
  169. package/dist/core/schemas/index.js.map +1 -0
  170. package/dist/core/schemas/spec.schema.d.ts +18 -0
  171. package/dist/core/schemas/spec.schema.d.ts.map +1 -0
  172. package/dist/core/schemas/spec.schema.js +15 -0
  173. package/dist/core/schemas/spec.schema.js.map +1 -0
  174. package/dist/core/specs-apply.d.ts +73 -0
  175. package/dist/core/specs-apply.d.ts.map +1 -0
  176. package/dist/core/specs-apply.js +384 -0
  177. package/dist/core/specs-apply.js.map +1 -0
  178. package/dist/core/styles/palette.d.ts +7 -0
  179. package/dist/core/styles/palette.d.ts.map +1 -0
  180. package/dist/core/styles/palette.js +8 -0
  181. package/dist/core/styles/palette.js.map +1 -0
  182. package/dist/core/templates/slash-command-templates.d.ts +1 -1
  183. package/dist/core/templates/slash-command-templates.d.ts.map +1 -1
  184. package/dist/core/templates/slash-command-templates.js +4 -1
  185. package/dist/core/templates/slash-command-templates.js.map +1 -1
  186. package/dist/core/validation/constants.d.ts +34 -0
  187. package/dist/core/validation/constants.d.ts.map +1 -0
  188. package/dist/core/validation/constants.js +40 -0
  189. package/dist/core/validation/constants.js.map +1 -0
  190. package/dist/core/validation/types.d.ts +18 -0
  191. package/dist/core/validation/types.d.ts.map +1 -0
  192. package/dist/core/validation/types.js +2 -0
  193. package/dist/core/validation/types.js.map +1 -0
  194. package/dist/core/validation/validator.d.ts +33 -0
  195. package/dist/core/validation/validator.d.ts.map +1 -0
  196. package/dist/core/validation/validator.js +409 -0
  197. package/dist/core/validation/validator.js.map +1 -0
  198. package/dist/core/view.d.ts +8 -0
  199. package/dist/core/view.d.ts.map +1 -0
  200. package/dist/core/view.js +168 -0
  201. package/dist/core/view.js.map +1 -0
  202. package/dist/utils/change-metadata.d.ts +47 -0
  203. package/dist/utils/change-metadata.d.ts.map +1 -0
  204. package/dist/utils/change-metadata.js +130 -0
  205. package/dist/utils/change-metadata.js.map +1 -0
  206. package/dist/utils/change-utils.d.ts +51 -0
  207. package/dist/utils/change-utils.d.ts.map +1 -0
  208. package/dist/utils/change-utils.js +100 -0
  209. package/dist/utils/change-utils.js.map +1 -0
  210. package/dist/utils/file-system.d.ts +25 -0
  211. package/dist/utils/file-system.d.ts.map +1 -0
  212. package/dist/utils/file-system.js +218 -0
  213. package/dist/utils/file-system.js.map +1 -0
  214. package/dist/utils/index.d.ts +4 -0
  215. package/dist/utils/index.d.ts.map +1 -0
  216. package/dist/utils/index.js +5 -0
  217. package/dist/utils/index.js.map +1 -0
  218. package/dist/utils/interactive.d.ts +18 -0
  219. package/dist/utils/interactive.d.ts.map +1 -0
  220. package/dist/utils/interactive.js +21 -0
  221. package/dist/utils/interactive.js.map +1 -0
  222. package/dist/utils/item-discovery.d.ts +4 -0
  223. package/dist/utils/item-discovery.d.ts.map +1 -0
  224. package/dist/utils/item-discovery.js +72 -0
  225. package/dist/utils/item-discovery.js.map +1 -0
  226. package/dist/utils/match.d.ts +3 -0
  227. package/dist/utils/match.d.ts.map +1 -0
  228. package/dist/utils/match.js +22 -0
  229. package/dist/utils/match.js.map +1 -0
  230. package/dist/utils/shell-detection.d.ts +20 -0
  231. package/dist/utils/shell-detection.d.ts.map +1 -0
  232. package/dist/utils/shell-detection.js +41 -0
  233. package/dist/utils/shell-detection.js.map +1 -0
  234. package/dist/utils/task-progress.d.ts +8 -0
  235. package/dist/utils/task-progress.d.ts.map +1 -0
  236. package/dist/utils/task-progress.js +36 -0
  237. package/dist/utils/task-progress.js.map +1 -0
  238. package/docs/tasks.md +1 -1
  239. package/package.json +6 -2
  240. package/prompt/apply.md +17 -0
  241. package/prompt/archive.md +21 -0
  242. package/prompt/proposal.md +22 -0
  243. package/src/cli/index.ts +151 -16
  244. package/src/commands/archive.ts +302 -0
  245. package/src/commands/change.ts +292 -0
  246. package/src/commands/config.ts +233 -0
  247. package/src/commands/guide.ts +5 -0
  248. package/src/commands/list.ts +176 -66
  249. package/src/commands/show.ts +138 -0
  250. package/src/commands/spec.ts +251 -0
  251. package/src/commands/validate.ts +326 -0
  252. package/src/core/artifact-graph/graph.ts +167 -0
  253. package/src/core/artifact-graph/index.ts +44 -0
  254. package/src/core/artifact-graph/instruction-loader.ts +302 -0
  255. package/src/core/artifact-graph/resolver.ts +226 -0
  256. package/src/core/artifact-graph/schema.ts +124 -0
  257. package/src/core/artifact-graph/state.ts +64 -0
  258. package/src/core/artifact-graph/types.ts +65 -0
  259. package/src/core/completions/command-registry.ts +382 -0
  260. package/src/core/completions/completion-provider.ts +128 -0
  261. package/src/core/completions/generators/bash-generator.ts +191 -0
  262. package/src/core/completions/generators/fish-generator.ts +188 -0
  263. package/src/core/completions/generators/powershell-generator.ts +223 -0
  264. package/src/core/completions/generators/zsh-generator.ts +281 -0
  265. package/src/core/completions/templates/bash-templates.ts +24 -0
  266. package/src/core/completions/templates/fish-templates.ts +40 -0
  267. package/src/core/completions/templates/powershell-templates.ts +25 -0
  268. package/src/core/completions/templates/zsh-templates.ts +36 -0
  269. package/src/core/completions/types.ts +90 -0
  270. package/src/core/config-schema.ts +230 -0
  271. package/src/core/config.ts +18 -0
  272. package/src/core/configurators/slash/antigravity.ts +6 -0
  273. package/src/core/configurators/slash/base.ts +1 -1
  274. package/src/core/configurators/slash/claude.ts +6 -0
  275. package/src/core/configurators/slash/codex.ts +6 -0
  276. package/src/core/configurators/slash/github-copilot.ts +6 -0
  277. package/src/core/configurators/slash/kilocode.ts +6 -0
  278. package/src/core/configurators/slash/opencode.ts +6 -0
  279. package/src/core/converters/json-converter.ts +62 -0
  280. package/src/core/global-config.ts +136 -0
  281. package/src/core/parsers/change-parser.ts +234 -0
  282. package/src/core/parsers/markdown-parser.ts +237 -0
  283. package/src/core/parsers/requirement-blocks.ts +234 -0
  284. package/src/core/prompt-templates.ts +69 -0
  285. package/src/core/schemas/base.schema.ts +20 -0
  286. package/src/core/schemas/change.schema.ts +42 -0
  287. package/src/core/schemas/index.ts +20 -0
  288. package/src/core/schemas/spec.schema.ts +17 -0
  289. package/src/core/specs-apply.ts +483 -0
  290. package/src/core/styles/palette.ts +8 -0
  291. package/src/core/templates/slash-command-templates.ts +7 -1
  292. package/src/core/validation/constants.ts +48 -0
  293. package/src/core/validation/types.ts +19 -0
  294. package/src/core/validation/validator.ts +449 -0
  295. package/src/core/view.ts +219 -0
  296. package/src/utils/change-metadata.ts +171 -0
  297. package/src/utils/change-utils.ts +131 -0
  298. package/src/utils/file-system.ts +252 -0
  299. package/src/utils/index.ts +12 -0
  300. package/src/utils/interactive.ts +29 -0
  301. package/src/utils/item-discovery.ts +66 -0
  302. package/src/utils/match.ts +26 -0
  303. package/src/utils/shell-detection.ts +62 -0
  304. package/src/utils/task-progress.ts +43 -0
  305. package/dist/commands/ai-humanizer.d.ts +0 -11
  306. package/dist/commands/ai-humanizer.d.ts.map +0 -1
  307. package/dist/commands/ai-humanizer.js +0 -97
  308. package/dist/commands/ai-humanizer.js.map +0 -1
  309. package/dist/commands/api-contract-generator.d.ts +0 -11
  310. package/dist/commands/api-contract-generator.d.ts.map +0 -1
  311. package/dist/commands/api-contract-generator.js +0 -97
  312. package/dist/commands/api-contract-generator.js.map +0 -1
  313. package/dist/commands/design-system.d.ts +0 -11
  314. package/dist/commands/design-system.d.ts.map +0 -1
  315. package/dist/commands/design-system.js +0 -97
  316. package/dist/commands/design-system.js.map +0 -1
  317. package/dist/commands/document-explainer.d.ts +0 -11
  318. package/dist/commands/document-explainer.d.ts.map +0 -1
  319. package/dist/commands/document-explainer.js +0 -97
  320. package/dist/commands/document-explainer.js.map +0 -1
  321. package/dist/commands/epic-generator.d.ts +0 -11
  322. package/dist/commands/epic-generator.d.ts.map +0 -1
  323. package/dist/commands/epic-generator.js +0 -97
  324. package/dist/commands/epic-generator.js.map +0 -1
  325. package/dist/commands/erd-generator.d.ts +0 -11
  326. package/dist/commands/erd-generator.d.ts.map +0 -1
  327. package/dist/commands/erd-generator.js +0 -97
  328. package/dist/commands/erd-generator.js.map +0 -1
  329. package/dist/commands/fsd-generator.d.ts +0 -11
  330. package/dist/commands/fsd-generator.d.ts.map +0 -1
  331. package/dist/commands/fsd-generator.js +0 -97
  332. package/dist/commands/fsd-generator.js.map +0 -1
  333. package/dist/commands/prd-agent-generator.d.ts +0 -11
  334. package/dist/commands/prd-agent-generator.d.ts.map +0 -1
  335. package/dist/commands/prd-agent-generator.js +0 -95
  336. package/dist/commands/prd-agent-generator.js.map +0 -1
  337. package/dist/commands/prd-generator.d.ts +0 -11
  338. package/dist/commands/prd-generator.d.ts.map +0 -1
  339. package/dist/commands/prd-generator.js +0 -97
  340. package/dist/commands/prd-generator.js.map +0 -1
  341. package/dist/commands/product-brief.d.ts +0 -11
  342. package/dist/commands/product-brief.d.ts.map +0 -1
  343. package/dist/commands/product-brief.js +0 -97
  344. package/dist/commands/product-brief.js.map +0 -1
  345. package/dist/commands/skill-creator.d.ts +0 -11
  346. package/dist/commands/skill-creator.d.ts.map +0 -1
  347. package/dist/commands/skill-creator.js +0 -101
  348. package/dist/commands/skill-creator.js.map +0 -1
  349. package/dist/commands/story-generator.d.ts +0 -11
  350. package/dist/commands/story-generator.d.ts.map +0 -1
  351. package/dist/commands/story-generator.js +0 -97
  352. package/dist/commands/story-generator.js.map +0 -1
  353. package/dist/commands/tdd-generator.d.ts +0 -11
  354. package/dist/commands/tdd-generator.d.ts.map +0 -1
  355. package/dist/commands/tdd-generator.js +0 -97
  356. package/dist/commands/tdd-generator.js.map +0 -1
  357. package/dist/commands/tdd-lite-generator.d.ts +0 -11
  358. package/dist/commands/tdd-lite-generator.d.ts.map +0 -1
  359. package/dist/commands/tdd-lite-generator.js +0 -97
  360. package/dist/commands/tdd-lite-generator.js.map +0 -1
  361. package/dist/commands/wireframe-generator.d.ts +0 -11
  362. package/dist/commands/wireframe-generator.d.ts.map +0 -1
  363. package/dist/commands/wireframe-generator.js +0 -97
  364. package/dist/commands/wireframe-generator.js.map +0 -1
  365. package/src/commands/ai-humanizer.ts +0 -118
  366. package/src/commands/api-contract-generator.ts +0 -118
  367. package/src/commands/design-system.ts +0 -118
  368. package/src/commands/document-explainer.ts +0 -118
  369. package/src/commands/epic-generator.ts +0 -118
  370. package/src/commands/erd-generator.ts +0 -118
  371. package/src/commands/fsd-generator.ts +0 -118
  372. package/src/commands/prd-agent-generator.ts +0 -115
  373. package/src/commands/prd-generator.ts +0 -118
  374. package/src/commands/product-brief.ts +0 -118
  375. package/src/commands/skill-creator.ts +0 -123
  376. package/src/commands/story-generator.ts +0 -118
  377. package/src/commands/tdd-generator.ts +0 -118
  378. package/src/commands/tdd-lite-generator.ts +0 -118
  379. package/src/commands/wireframe-generator.ts +0 -118
@@ -0,0 +1,234 @@
1
+ export interface RequirementBlock {
2
+ headerLine: string; // e.g., '### Requirement: Something'
3
+ name: string; // e.g., 'Something'
4
+ raw: string; // full block including headerLine and following content
5
+ }
6
+
7
+ export interface RequirementsSectionParts {
8
+ before: string;
9
+ headerLine: string; // the '## Requirements' line
10
+ preamble: string; // content between headerLine and first requirement block
11
+ bodyBlocks: RequirementBlock[]; // parsed requirement blocks in order
12
+ after: string;
13
+ }
14
+
15
+ export function normalizeRequirementName(name: string): string {
16
+ return name.trim();
17
+ }
18
+
19
+ const REQUIREMENT_HEADER_REGEX = /^###\s*Requirement:\s*(.+)\s*$/;
20
+
21
+ /**
22
+ * Extracts the Requirements section from a spec file and parses requirement blocks.
23
+ */
24
+ export function extractRequirementsSection(content: string): RequirementsSectionParts {
25
+ const normalized = normalizeLineEndings(content);
26
+ const lines = normalized.split('\n');
27
+ const reqHeaderIndex = lines.findIndex(l => /^##\s+Requirements\s*$/i.test(l));
28
+
29
+ if (reqHeaderIndex === -1) {
30
+ // No requirements section; create an empty one at the end
31
+ const before = content.trimEnd();
32
+ const headerLine = '## Requirements';
33
+ return {
34
+ before: before ? before + '\n\n' : '',
35
+ headerLine,
36
+ preamble: '',
37
+ bodyBlocks: [],
38
+ after: '\n',
39
+ };
40
+ }
41
+
42
+ // Find end of this section: next line that starts with '## ' at same or higher level
43
+ let endIndex = lines.length;
44
+ for (let i = reqHeaderIndex + 1; i < lines.length; i++) {
45
+ if (/^##\s+/.test(lines[i])) {
46
+ endIndex = i;
47
+ break;
48
+ }
49
+ }
50
+
51
+ const before = lines.slice(0, reqHeaderIndex).join('\n');
52
+ const headerLine = lines[reqHeaderIndex];
53
+ const sectionBodyLines = lines.slice(reqHeaderIndex + 1, endIndex);
54
+
55
+ // Parse requirement blocks within section body
56
+ const blocks: RequirementBlock[] = [];
57
+ let cursor = 0;
58
+ let preambleLines: string[] = [];
59
+
60
+ // Collect preamble lines until first requirement header
61
+ while (cursor < sectionBodyLines.length && !/^###\s+Requirement:/.test(sectionBodyLines[cursor])) {
62
+ preambleLines.push(sectionBodyLines[cursor]);
63
+ cursor++;
64
+ }
65
+
66
+ while (cursor < sectionBodyLines.length) {
67
+ const headerStart = cursor;
68
+ const headerLineCandidate = sectionBodyLines[cursor];
69
+ const headerMatch = headerLineCandidate.match(REQUIREMENT_HEADER_REGEX);
70
+ if (!headerMatch) {
71
+ // Not a requirement header; skip line defensively
72
+ cursor++;
73
+ continue;
74
+ }
75
+ const name = normalizeRequirementName(headerMatch[1]);
76
+ cursor++;
77
+ // Gather lines until next requirement header or end of section
78
+ const bodyLines: string[] = [headerLineCandidate];
79
+ while (cursor < sectionBodyLines.length && !/^###\s+Requirement:/.test(sectionBodyLines[cursor]) && !/^##\s+/.test(sectionBodyLines[cursor])) {
80
+ bodyLines.push(sectionBodyLines[cursor]);
81
+ cursor++;
82
+ }
83
+ const raw = bodyLines.join('\n').trimEnd();
84
+ blocks.push({ headerLine: headerLineCandidate, name, raw });
85
+ }
86
+
87
+ const after = lines.slice(endIndex).join('\n');
88
+ const preamble = preambleLines.join('\n').trimEnd();
89
+
90
+ return {
91
+ before: before.trimEnd() ? before + '\n' : before,
92
+ headerLine,
93
+ preamble,
94
+ bodyBlocks: blocks,
95
+ after: after.startsWith('\n') ? after : '\n' + after,
96
+ };
97
+ }
98
+
99
+ export interface DeltaPlan {
100
+ added: RequirementBlock[];
101
+ modified: RequirementBlock[];
102
+ removed: string[]; // requirement names
103
+ renamed: Array<{ from: string; to: string }>;
104
+ sectionPresence: {
105
+ added: boolean;
106
+ modified: boolean;
107
+ removed: boolean;
108
+ renamed: boolean;
109
+ };
110
+ }
111
+
112
+ function normalizeLineEndings(content: string): string {
113
+ return content.replace(/\r\n?/g, '\n');
114
+ }
115
+
116
+ /**
117
+ * Parse a delta-formatted spec change file content into a DeltaPlan with raw blocks.
118
+ */
119
+ export function parseDeltaSpec(content: string): DeltaPlan {
120
+ const normalized = normalizeLineEndings(content);
121
+ const sections = splitTopLevelSections(normalized);
122
+ const addedLookup = getSectionCaseInsensitive(sections, 'ADDED Requirements');
123
+ const modifiedLookup = getSectionCaseInsensitive(sections, 'MODIFIED Requirements');
124
+ const removedLookup = getSectionCaseInsensitive(sections, 'REMOVED Requirements');
125
+ const renamedLookup = getSectionCaseInsensitive(sections, 'RENAMED Requirements');
126
+ const added = parseRequirementBlocksFromSection(addedLookup.body);
127
+ const modified = parseRequirementBlocksFromSection(modifiedLookup.body);
128
+ const removedNames = parseRemovedNames(removedLookup.body);
129
+ const renamedPairs = parseRenamedPairs(renamedLookup.body);
130
+ return {
131
+ added,
132
+ modified,
133
+ removed: removedNames,
134
+ renamed: renamedPairs,
135
+ sectionPresence: {
136
+ added: addedLookup.found,
137
+ modified: modifiedLookup.found,
138
+ removed: removedLookup.found,
139
+ renamed: renamedLookup.found,
140
+ },
141
+ };
142
+ }
143
+
144
+ function splitTopLevelSections(content: string): Record<string, string> {
145
+ const lines = content.split('\n');
146
+ const result: Record<string, string> = {};
147
+ const indices: Array<{ title: string; index: number; level: number }> = [];
148
+ for (let i = 0; i < lines.length; i++) {
149
+ const m = lines[i].match(/^(##)\s+(.+)$/);
150
+ if (m) {
151
+ const level = m[1].length; // only care for '##'
152
+ indices.push({ title: m[2].trim(), index: i, level });
153
+ }
154
+ }
155
+ for (let i = 0; i < indices.length; i++) {
156
+ const current = indices[i];
157
+ const next = indices[i + 1];
158
+ const body = lines.slice(current.index + 1, next ? next.index : lines.length).join('\n');
159
+ result[current.title] = body;
160
+ }
161
+ return result;
162
+ }
163
+
164
+ function getSectionCaseInsensitive(sections: Record<string, string>, desired: string): { body: string; found: boolean } {
165
+ const target = desired.toLowerCase();
166
+ for (const [title, body] of Object.entries(sections)) {
167
+ if (title.toLowerCase() === target) return { body, found: true };
168
+ }
169
+ return { body: '', found: false };
170
+ }
171
+
172
+ function parseRequirementBlocksFromSection(sectionBody: string): RequirementBlock[] {
173
+ if (!sectionBody) return [];
174
+ const lines = normalizeLineEndings(sectionBody).split('\n');
175
+ const blocks: RequirementBlock[] = [];
176
+ let i = 0;
177
+ while (i < lines.length) {
178
+ // Seek next requirement header
179
+ while (i < lines.length && !/^###\s+Requirement:/.test(lines[i])) i++;
180
+ if (i >= lines.length) break;
181
+ const headerLine = lines[i];
182
+ const m = headerLine.match(REQUIREMENT_HEADER_REGEX);
183
+ if (!m) { i++; continue; }
184
+ const name = normalizeRequirementName(m[1]);
185
+ const buf: string[] = [headerLine];
186
+ i++;
187
+ while (i < lines.length && !/^###\s+Requirement:/.test(lines[i]) && !/^##\s+/.test(lines[i])) {
188
+ buf.push(lines[i]);
189
+ i++;
190
+ }
191
+ blocks.push({ headerLine, name, raw: buf.join('\n').trimEnd() });
192
+ }
193
+ return blocks;
194
+ }
195
+
196
+ function parseRemovedNames(sectionBody: string): string[] {
197
+ if (!sectionBody) return [];
198
+ const names: string[] = [];
199
+ const lines = normalizeLineEndings(sectionBody).split('\n');
200
+ for (const line of lines) {
201
+ const m = line.match(REQUIREMENT_HEADER_REGEX);
202
+ if (m) {
203
+ names.push(normalizeRequirementName(m[1]));
204
+ continue;
205
+ }
206
+ // Also support bullet list of headers
207
+ const bullet = line.match(/^\s*-\s*`?###\s*Requirement:\s*(.+?)`?\s*$/);
208
+ if (bullet) {
209
+ names.push(normalizeRequirementName(bullet[1]));
210
+ }
211
+ }
212
+ return names;
213
+ }
214
+
215
+ function parseRenamedPairs(sectionBody: string): Array<{ from: string; to: string }> {
216
+ if (!sectionBody) return [];
217
+ const pairs: Array<{ from: string; to: string }> = [];
218
+ const lines = normalizeLineEndings(sectionBody).split('\n');
219
+ let current: { from?: string; to?: string } = {};
220
+ for (const line of lines) {
221
+ const fromMatch = line.match(/^\s*-?\s*FROM:\s*`?###\s*Requirement:\s*(.+?)`?\s*$/);
222
+ const toMatch = line.match(/^\s*-?\s*TO:\s*`?###\s*Requirement:\s*(.+?)`?\s*$/);
223
+ if (fromMatch) {
224
+ current.from = normalizeRequirementName(fromMatch[1]);
225
+ } else if (toMatch) {
226
+ current.to = normalizeRequirementName(toMatch[1]);
227
+ if (current.from && current.to) {
228
+ pairs.push({ from: current.from, to: current.to });
229
+ current = {};
230
+ }
231
+ }
232
+ }
233
+ return pairs;
234
+ }
@@ -3412,10 +3412,78 @@ First, I will analyze each provided document systematically, then generate the c
3412
3412
  4. API Contract/Specification
3413
3413
  `;
3414
3414
 
3415
+ export const APPLY_TEMPLATE = `<!-- PROMPTER:START -->
3416
+ **Guardrails**
3417
+ - Favor straightforward, minimal implementations first and add complexity only when it is requested or clearly required.
3418
+ - Keep changes tightly scoped to the requested outcome.
3419
+ - Refer to \`prompter/AGENTS.md\` (located inside the \`prompter/\` directory—run \`ls prompter\` if you don't see it) if you need additional Prompter conventions or clarifications.
3420
+
3421
+ **Steps**
3422
+ Track these steps as TODOs and complete them one by one.
3423
+ 1. Read \`changes/<id>/proposal.md\`, \`design.md\` (if present), and \`tasks.md\` to confirm scope and acceptance criteria.
3424
+ 2. Work through tasks sequentially, keeping edits minimal and focused on the requested change.
3425
+ 3. Confirm completion before updating statuses—make sure every item in \`tasks.md\` is finished.
3426
+ 4. Update the checklist after all work is done so each task is marked \`- [x]\` and reflects reality.
3427
+ 5. Reference \`prompter list\` or \`prompter show <item>\` when additional context is required.
3428
+
3429
+ **Reference**
3430
+ - Use \`prompter show <id> --json --deltas-only\` if you need additional context from the proposal while implementing.
3431
+ <!-- PROMPTER:END -->
3432
+ `;
3433
+
3434
+ export const PROPOSAL_TEMPLATE = `<!-- PROMPTER:START -->
3435
+ **Guardrails**
3436
+ - Favor straightforward, minimal implementations first and add complexity only when it is requested or clearly required.
3437
+ - Keep changes tightly scoped to the requested outcome.
3438
+ - Refer to \`prompter/AGENTS.md\` (located inside the \`prompter/\` directory—run \`ls prompter\` if you don't see it) if you need additional Prompter conventions or clarifications.
3439
+ - Identify any vague or ambiguous details and ask the necessary follow-up questions before editing files.
3440
+ - Do not write any code during the proposal stage. Only create design documents (proposal.md, tasks.md, design.md, and spec deltas). Implementation happens in the apply stage after approval.
3441
+
3442
+ **Steps**
3443
+ 1. Review \`prompter/project.md\`, run \`prompter list\` and \`prompter list --specs\`, and inspect related code or docs (e.g., via \`rg\`/\`ls\`) to ground the proposal in current behaviour; note any gaps that require clarification.
3444
+ 2. Choose a unique verb-led \`change-id\` and scaffold \`proposal.md\`, \`tasks.md\`, and \`design.md\` (when needed) under \`prompter/changes/<id>/\`.
3445
+ 3. Map the change into concrete capabilities or requirements, breaking multi-scope efforts into distinct spec deltas with clear relationships and sequencing.
3446
+ 4. Capture architectural reasoning in \`design.md\` when the solution spans multiple systems, introduces new patterns, or demands trade-off discussion before committing to specs.
3447
+ 5. Draft spec deltas in \`changes/<id>/specs/<capability>/spec.md\` (one folder per capability) using \`## ADDED|MODIFIED|REMOVED Requirements\` with at least one \`#### Scenario:\` per requirement and cross-reference related capabilities when relevant.
3448
+ 6. Draft \`tasks.md\` as an ordered list of small, verifiable work items that deliver user-visible progress, include validation (tests, tooling), and highlight dependencies or parallelizable work.
3449
+ 7. Validate with \`prompter validate <id> --strict\` and resolve every issue before sharing the proposal.
3450
+
3451
+ **Reference**
3452
+ - Use \`prompter show <id> --json --deltas-only\` or \`prompter show <spec> --type spec\` to inspect details when validation fails.
3453
+ - Search existing requirements with \`rg -n "Requirement:|Scenario:" prompter/specs\` before writing new ones.
3454
+ - Explore the codebase with \`rg <keyword>\`, \`ls\`, or direct file reads so proposals align with current implementation realities.
3455
+ <!-- PROMPTER:END -->
3456
+ `;
3457
+
3458
+ export const ARCHIVE_TEMPLATE = `<!-- PROMPTER:START -->
3459
+ **Guardrails**
3460
+ - Favor straightforward, minimal implementations first and add complexity only when it is requested or clearly required.
3461
+ - Keep changes tightly scoped to the requested outcome.
3462
+ - Refer to \`prompter/AGENTS.md\` (located inside the \`prompter/\` directory—run \`ls prompter\` if you don't see it) if you need additional Prompter conventions or clarifications.
3463
+
3464
+ **Steps**
3465
+ 1. Determine the change ID to archive:
3466
+ - If this prompt already includes a specific change ID (for example inside a \`<ChangeId>\` block populated by slash-command arguments), use that value after trimming whitespace.
3467
+ - If the conversation references a change loosely (for example by title or summary), run \`prompter list\` to surface likely IDs, share the relevant candidates, and confirm which one the user intends.
3468
+ - Otherwise, review the conversation, run \`prompter list\`, and ask the user which change to archive; wait for a confirmed change ID before proceeding.
3469
+ - If you still cannot identify a single change ID, stop and tell the user you cannot archive anything yet.
3470
+ 2. Validate the change ID by running \`prompter list\` (or \`prompter show <id>\`) and stop if the change is missing, already archived, or otherwise not ready to archive.
3471
+ 3. Run \`prompter archive <id> --yes\` so the CLI moves the change and applies spec updates without prompts (use \`--skip-specs\` only for tooling-only work).
3472
+ 4. Review the command output to confirm the target specs were updated and the change landed in \`changes/archive/\`.
3473
+ 5. Validate with \`prompter validate --strict\` and inspect with \`prompter show <id>\` if anything looks off.
3474
+
3475
+ **Reference**
3476
+ - Use \`prompter list\` to confirm change IDs before archiving.
3477
+ - Inspect refreshed specs with \`prompter list --specs\` and address any validation issues before handing off.
3478
+ <!-- PROMPTER:END -->
3479
+ `;
3480
+
3415
3481
  // Map prompt IDs to their template contents
3416
3482
  export const PROMPT_TEMPLATES: Record<string, string> = {
3417
3483
  'ai-humanizer': AI_HUMANIZER_TEMPLATE,
3418
3484
  'api-contract-generator': API_CONTRACT_GENERATOR_TEMPLATE,
3485
+ 'apply': APPLY_TEMPLATE,
3486
+ 'archive': ARCHIVE_TEMPLATE,
3419
3487
  'design-system': DESIGN_SYSTEM_TEMPLATE,
3420
3488
  'document-explainer': DOCUMENT_EXPLAINER_TEMPLATE,
3421
3489
  'epic-generator': EPIC_GENERATOR_TEMPLATE,
@@ -3425,6 +3493,7 @@ export const PROMPT_TEMPLATES: Record<string, string> = {
3425
3493
  'prd-agent-generator': PRD_AGENT_GENERATOR_TEMPLATE,
3426
3494
  'prd-generator': PRD_GENERATOR_TEMPLATE,
3427
3495
  'product-brief': PRODUCT_BRIEF_TEMPLATE,
3496
+ 'proposal': PROPOSAL_TEMPLATE,
3428
3497
  'qa-test-scenario': QA_TEST_SCENARIO_TEMPLATE,
3429
3498
  'skill-creator': SKILL_CREATOR_TEMPLATE,
3430
3499
  'story-generator': STORY_GENERATOR_TEMPLATE,
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ import { VALIDATION_MESSAGES } from '../validation/constants.js';
3
+
4
+ export const ScenarioSchema = z.object({
5
+ rawText: z.string().min(1, VALIDATION_MESSAGES.SCENARIO_EMPTY),
6
+ });
7
+
8
+ export const RequirementSchema = z.object({
9
+ text: z.string()
10
+ .min(1, VALIDATION_MESSAGES.REQUIREMENT_EMPTY)
11
+ .refine(
12
+ (text) => text.includes('SHALL') || text.includes('MUST'),
13
+ VALIDATION_MESSAGES.REQUIREMENT_NO_SHALL
14
+ ),
15
+ scenarios: z.array(ScenarioSchema)
16
+ .min(1, VALIDATION_MESSAGES.REQUIREMENT_NO_SCENARIOS),
17
+ });
18
+
19
+ export type Scenario = z.infer<typeof ScenarioSchema>;
20
+ export type Requirement = z.infer<typeof RequirementSchema>;
@@ -0,0 +1,42 @@
1
+ import { z } from 'zod';
2
+ import { RequirementSchema } from './base.schema.js';
3
+ import {
4
+ MIN_WHY_SECTION_LENGTH,
5
+ MAX_WHY_SECTION_LENGTH,
6
+ MAX_DELTAS_PER_CHANGE,
7
+ VALIDATION_MESSAGES
8
+ } from '../validation/constants.js';
9
+
10
+ export const DeltaOperationType = z.enum(['ADDED', 'MODIFIED', 'REMOVED', 'RENAMED']);
11
+
12
+ export const DeltaSchema = z.object({
13
+ spec: z.string().min(1, VALIDATION_MESSAGES.DELTA_SPEC_EMPTY),
14
+ operation: DeltaOperationType,
15
+ description: z.string().min(1, VALIDATION_MESSAGES.DELTA_DESCRIPTION_EMPTY),
16
+ requirement: RequirementSchema.optional(),
17
+ requirements: z.array(RequirementSchema).optional(),
18
+ rename: z.object({
19
+ from: z.string(),
20
+ to: z.string(),
21
+ }).optional(),
22
+ });
23
+
24
+ export const ChangeSchema = z.object({
25
+ name: z.string().min(1, VALIDATION_MESSAGES.CHANGE_NAME_EMPTY),
26
+ why: z.string()
27
+ .min(MIN_WHY_SECTION_LENGTH, VALIDATION_MESSAGES.CHANGE_WHY_TOO_SHORT)
28
+ .max(MAX_WHY_SECTION_LENGTH, VALIDATION_MESSAGES.CHANGE_WHY_TOO_LONG),
29
+ whatChanges: z.string().min(1, VALIDATION_MESSAGES.CHANGE_WHAT_EMPTY),
30
+ deltas: z.array(DeltaSchema)
31
+ .min(1, VALIDATION_MESSAGES.CHANGE_NO_DELTAS)
32
+ .max(MAX_DELTAS_PER_CHANGE, VALIDATION_MESSAGES.CHANGE_TOO_MANY_DELTAS),
33
+ metadata: z.object({
34
+ version: z.string().default('1.0.0'),
35
+ format: z.literal('prompter-change'),
36
+ sourcePath: z.string().optional(),
37
+ }).optional(),
38
+ });
39
+
40
+ export type DeltaOperation = z.infer<typeof DeltaOperationType>;
41
+ export type Delta = z.infer<typeof DeltaSchema>;
42
+ export type Change = z.infer<typeof ChangeSchema>;
@@ -0,0 +1,20 @@
1
+ export {
2
+ ScenarioSchema,
3
+ RequirementSchema,
4
+ type Scenario,
5
+ type Requirement,
6
+ } from './base.schema.js';
7
+
8
+ export {
9
+ SpecSchema,
10
+ type Spec,
11
+ } from './spec.schema.js';
12
+
13
+ export {
14
+ DeltaOperationType,
15
+ DeltaSchema,
16
+ ChangeSchema,
17
+ type DeltaOperation,
18
+ type Delta,
19
+ type Change,
20
+ } from './change.schema.js';
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ import { RequirementSchema } from './base.schema.js';
3
+ import { VALIDATION_MESSAGES } from '../validation/constants.js';
4
+
5
+ export const SpecSchema = z.object({
6
+ name: z.string().min(1, VALIDATION_MESSAGES.SPEC_NAME_EMPTY),
7
+ overview: z.string().min(1, VALIDATION_MESSAGES.SPEC_PURPOSE_EMPTY),
8
+ requirements: z.array(RequirementSchema)
9
+ .min(1, VALIDATION_MESSAGES.SPEC_NO_REQUIREMENTS),
10
+ metadata: z.object({
11
+ version: z.string().default('1.0.0'),
12
+ format: z.literal('prompter'),
13
+ sourcePath: z.string().optional(),
14
+ }).optional(),
15
+ });
16
+
17
+ export type Spec = z.infer<typeof SpecSchema>;