@seanmars/tospec 0.19.0-beta.8 → 0.20.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 (421) hide show
  1. package/CHANGELOG.md +60 -310
  2. package/README.md +69 -82
  3. package/assets/dashboard/app.js +11 -0
  4. package/assets/dashboard/style.css +7 -0
  5. package/dist/cli/index.d.ts.map +1 -1
  6. package/dist/cli/index.js +89 -106
  7. package/dist/cli/index.js.map +1 -1
  8. package/dist/commands/config.d.ts +9 -17
  9. package/dist/commands/config.d.ts.map +1 -1
  10. package/dist/commands/config.js +293 -145
  11. package/dist/commands/config.js.map +1 -1
  12. package/dist/commands/dashboard.d.ts +57 -99
  13. package/dist/commands/dashboard.d.ts.map +1 -1
  14. package/dist/commands/dashboard.js +190 -313
  15. package/dist/commands/dashboard.js.map +1 -1
  16. package/dist/commands/decision.d.ts +38 -27
  17. package/dist/commands/decision.d.ts.map +1 -1
  18. package/dist/commands/decision.js +296 -128
  19. package/dist/commands/decision.js.map +1 -1
  20. package/dist/commands/metrics.d.ts +28 -51
  21. package/dist/commands/metrics.d.ts.map +1 -1
  22. package/dist/commands/metrics.js +62 -93
  23. package/dist/commands/metrics.js.map +1 -1
  24. package/dist/commands/shared-output.d.ts +12 -27
  25. package/dist/commands/shared-output.d.ts.map +1 -1
  26. package/dist/commands/shared-output.js +22 -45
  27. package/dist/commands/shared-output.js.map +1 -1
  28. package/dist/commands/show.d.ts +4 -7
  29. package/dist/commands/show.d.ts.map +1 -1
  30. package/dist/commands/show.js +23 -11
  31. package/dist/commands/show.js.map +1 -1
  32. package/dist/commands/validate.d.ts +34 -58
  33. package/dist/commands/validate.d.ts.map +1 -1
  34. package/dist/commands/validate.js +225 -141
  35. package/dist/commands/validate.js.map +1 -1
  36. package/dist/commands/workflow/index.d.ts +1 -5
  37. package/dist/commands/workflow/index.d.ts.map +1 -1
  38. package/dist/commands/workflow/index.js +1 -5
  39. package/dist/commands/workflow/index.js.map +1 -1
  40. package/dist/commands/workflow/instructions.d.ts +14 -24
  41. package/dist/commands/workflow/instructions.d.ts.map +1 -1
  42. package/dist/commands/workflow/instructions.js +219 -128
  43. package/dist/commands/workflow/instructions.js.map +1 -1
  44. package/dist/commands/workflow/new-change.d.ts +2 -5
  45. package/dist/commands/workflow/new-change.d.ts.map +1 -1
  46. package/dist/commands/workflow/new-change.js +69 -32
  47. package/dist/commands/workflow/new-change.js.map +1 -1
  48. package/dist/commands/workflow/schemas.d.ts +1 -5
  49. package/dist/commands/workflow/schemas.d.ts.map +1 -1
  50. package/dist/commands/workflow/schemas.js +6 -17
  51. package/dist/commands/workflow/schemas.js.map +1 -1
  52. package/dist/commands/workflow/shared.d.ts +37 -42
  53. package/dist/commands/workflow/shared.d.ts.map +1 -1
  54. package/dist/commands/workflow/shared.js +23 -54
  55. package/dist/commands/workflow/shared.js.map +1 -1
  56. package/dist/commands/workflow/status.d.ts +7 -17
  57. package/dist/commands/workflow/status.d.ts.map +1 -1
  58. package/dist/commands/workflow/status.js +57 -72
  59. package/dist/commands/workflow/status.js.map +1 -1
  60. package/dist/commands/workflow/templates.d.ts +8 -8
  61. package/dist/commands/workflow/templates.d.ts.map +1 -1
  62. package/dist/commands/workflow/templates.js +32 -46
  63. package/dist/commands/workflow/templates.js.map +1 -1
  64. package/dist/core/archive.d.ts +22 -31
  65. package/dist/core/archive.d.ts.map +1 -1
  66. package/dist/core/archive.js +296 -283
  67. package/dist/core/archive.js.map +1 -1
  68. package/dist/core/artifact-graph/graph.d.ts +25 -42
  69. package/dist/core/artifact-graph/graph.d.ts.map +1 -1
  70. package/dist/core/artifact-graph/graph.js +45 -63
  71. package/dist/core/artifact-graph/graph.js.map +1 -1
  72. package/dist/core/artifact-graph/index.d.ts +1 -1
  73. package/dist/core/artifact-graph/index.d.ts.map +1 -1
  74. package/dist/core/artifact-graph/index.js +1 -1
  75. package/dist/core/artifact-graph/index.js.map +1 -1
  76. package/dist/core/artifact-graph/instruction-loader.d.ts +54 -120
  77. package/dist/core/artifact-graph/instruction-loader.d.ts.map +1 -1
  78. package/dist/core/artifact-graph/instruction-loader.js +129 -111
  79. package/dist/core/artifact-graph/instruction-loader.js.map +1 -1
  80. package/dist/core/artifact-graph/outputs.d.ts +9 -23
  81. package/dist/core/artifact-graph/outputs.d.ts.map +1 -1
  82. package/dist/core/artifact-graph/outputs.js +45 -38
  83. package/dist/core/artifact-graph/outputs.js.map +1 -1
  84. package/dist/core/artifact-graph/resolver.d.ts +36 -81
  85. package/dist/core/artifact-graph/resolver.d.ts.map +1 -1
  86. package/dist/core/artifact-graph/resolver.js +60 -101
  87. package/dist/core/artifact-graph/resolver.js.map +1 -1
  88. package/dist/core/artifact-graph/schema.d.ts +0 -6
  89. package/dist/core/artifact-graph/schema.d.ts.map +1 -1
  90. package/dist/core/artifact-graph/schema.js +7 -32
  91. package/dist/core/artifact-graph/schema.js.map +1 -1
  92. package/dist/core/artifact-graph/state.d.ts +1 -8
  93. package/dist/core/artifact-graph/state.d.ts.map +1 -1
  94. package/dist/core/artifact-graph/state.js +2 -17
  95. package/dist/core/artifact-graph/state.js.map +1 -1
  96. package/dist/core/artifact-graph/stub-detection.d.ts +6 -14
  97. package/dist/core/artifact-graph/stub-detection.d.ts.map +1 -1
  98. package/dist/core/artifact-graph/stub-detection.js +13 -16
  99. package/dist/core/artifact-graph/stub-detection.js.map +1 -1
  100. package/dist/core/artifact-graph/types.d.ts +4 -0
  101. package/dist/core/artifact-graph/types.d.ts.map +1 -1
  102. package/dist/core/artifact-graph/types.js +30 -10
  103. package/dist/core/artifact-graph/types.js.map +1 -1
  104. package/dist/core/available-tools.d.ts +3 -12
  105. package/dist/core/available-tools.d.ts.map +1 -1
  106. package/dist/core/available-tools.js +4 -13
  107. package/dist/core/available-tools.js.map +1 -1
  108. package/dist/core/change-metadata/schema.d.ts +1 -1
  109. package/dist/core/change-metadata/schema.d.ts.map +1 -1
  110. package/dist/core/change-metadata/schema.js +10 -7
  111. package/dist/core/change-metadata/schema.js.map +1 -1
  112. package/dist/core/change-presenter.d.ts +16 -27
  113. package/dist/core/change-presenter.d.ts.map +1 -1
  114. package/dist/core/change-presenter.js +53 -53
  115. package/dist/core/change-presenter.js.map +1 -1
  116. package/dist/core/change-status-policy.d.ts +4 -8
  117. package/dist/core/change-status-policy.d.ts.map +1 -1
  118. package/dist/core/change-status-policy.js +9 -17
  119. package/dist/core/change-status-policy.js.map +1 -1
  120. package/dist/core/codex-metrics.d.ts +25 -45
  121. package/dist/core/codex-metrics.d.ts.map +1 -1
  122. package/dist/core/codex-metrics.js +44 -88
  123. package/dist/core/codex-metrics.js.map +1 -1
  124. package/dist/core/codex-residue.d.ts +14 -15
  125. package/dist/core/codex-residue.d.ts.map +1 -1
  126. package/dist/core/codex-residue.js +18 -22
  127. package/dist/core/codex-residue.js.map +1 -1
  128. package/dist/core/command-generation/adapters/claude.d.ts +2 -9
  129. package/dist/core/command-generation/adapters/claude.d.ts.map +1 -1
  130. package/dist/core/command-generation/adapters/claude.js +2 -12
  131. package/dist/core/command-generation/adapters/claude.js.map +1 -1
  132. package/dist/core/command-generation/adapters/index.d.ts +1 -9
  133. package/dist/core/command-generation/adapters/index.d.ts.map +1 -1
  134. package/dist/core/command-generation/adapters/index.js +1 -9
  135. package/dist/core/command-generation/adapters/index.js.map +1 -1
  136. package/dist/core/command-generation/generator.d.ts +0 -17
  137. package/dist/core/command-generation/generator.d.ts.map +1 -1
  138. package/dist/core/command-generation/generator.js +0 -17
  139. package/dist/core/command-generation/generator.js.map +1 -1
  140. package/dist/core/command-generation/index.d.ts +2 -5
  141. package/dist/core/command-generation/index.d.ts.map +1 -1
  142. package/dist/core/command-generation/index.js +0 -9
  143. package/dist/core/command-generation/index.js.map +1 -1
  144. package/dist/core/command-generation/types.d.ts +10 -36
  145. package/dist/core/command-generation/types.d.ts.map +1 -1
  146. package/dist/core/command-generation/types.js +0 -6
  147. package/dist/core/command-generation/types.js.map +1 -1
  148. package/dist/core/command-generation/yaml.d.ts +3 -18
  149. package/dist/core/command-generation/yaml.d.ts.map +1 -1
  150. package/dist/core/command-generation/yaml.js +5 -23
  151. package/dist/core/command-generation/yaml.js.map +1 -1
  152. package/dist/core/config-prompts.d.ts +2 -4
  153. package/dist/core/config-prompts.d.ts.map +1 -1
  154. package/dist/core/config-prompts.js +2 -7
  155. package/dist/core/config-prompts.js.map +1 -1
  156. package/dist/core/config-schema.d.ts +7 -41
  157. package/dist/core/config-schema.d.ts.map +1 -1
  158. package/dist/core/config-schema.js +35 -74
  159. package/dist/core/config-schema.js.map +1 -1
  160. package/dist/core/config.d.ts +25 -49
  161. package/dist/core/config.d.ts.map +1 -1
  162. package/dist/core/config.js +22 -45
  163. package/dist/core/config.js.map +1 -1
  164. package/dist/core/dashboard-activity.d.ts +7 -9
  165. package/dist/core/dashboard-activity.d.ts.map +1 -1
  166. package/dist/core/dashboard-activity.js +26 -24
  167. package/dist/core/dashboard-activity.js.map +1 -1
  168. package/dist/core/dashboard-data.d.ts +35 -22
  169. package/dist/core/dashboard-data.d.ts.map +1 -1
  170. package/dist/core/dashboard-data.js +57 -72
  171. package/dist/core/dashboard-data.js.map +1 -1
  172. package/dist/core/global-config.d.ts +24 -53
  173. package/dist/core/global-config.d.ts.map +1 -1
  174. package/dist/core/global-config.js +38 -67
  175. package/dist/core/global-config.js.map +1 -1
  176. package/dist/core/init.d.ts +12 -28
  177. package/dist/core/init.d.ts.map +1 -1
  178. package/dist/core/init.js +90 -168
  179. package/dist/core/init.js.map +1 -1
  180. package/dist/core/list.d.ts.map +1 -1
  181. package/dist/core/list.js +80 -38
  182. package/dist/core/list.js.map +1 -1
  183. package/dist/core/local-server.d.ts +41 -83
  184. package/dist/core/local-server.d.ts.map +1 -1
  185. package/dist/core/local-server.js +53 -98
  186. package/dist/core/local-server.js.map +1 -1
  187. package/dist/core/markdown-render.d.ts +15 -23
  188. package/dist/core/markdown-render.d.ts.map +1 -1
  189. package/dist/core/markdown-render.js +25 -34
  190. package/dist/core/markdown-render.js.map +1 -1
  191. package/dist/core/migrate.d.ts +19 -16
  192. package/dist/core/migrate.d.ts.map +1 -1
  193. package/dist/core/migrate.js +151 -135
  194. package/dist/core/migrate.js.map +1 -1
  195. package/dist/core/parsers/change-parser.d.ts +7 -10
  196. package/dist/core/parsers/change-parser.d.ts.map +1 -1
  197. package/dist/core/parsers/change-parser.js +48 -56
  198. package/dist/core/parsers/change-parser.js.map +1 -1
  199. package/dist/core/parsers/markdown-parser.d.ts +8 -9
  200. package/dist/core/parsers/markdown-parser.d.ts.map +1 -1
  201. package/dist/core/parsers/markdown-parser.js +23 -30
  202. package/dist/core/parsers/markdown-parser.js.map +1 -1
  203. package/dist/core/parsers/requirement-blocks.d.ts +43 -15
  204. package/dist/core/parsers/requirement-blocks.d.ts.map +1 -1
  205. package/dist/core/parsers/requirement-blocks.js +142 -70
  206. package/dist/core/parsers/requirement-blocks.js.map +1 -1
  207. package/dist/core/parsers/requirement-text.d.ts +73 -79
  208. package/dist/core/parsers/requirement-text.d.ts.map +1 -1
  209. package/dist/core/parsers/requirement-text.js +137 -79
  210. package/dist/core/parsers/requirement-text.js.map +1 -1
  211. package/dist/core/parsers/spec-structure.d.ts.map +1 -1
  212. package/dist/core/parsers/spec-structure.js +10 -6
  213. package/dist/core/parsers/spec-structure.js.map +1 -1
  214. package/dist/core/profiles.d.ts +3 -10
  215. package/dist/core/profiles.d.ts.map +1 -1
  216. package/dist/core/profiles.js +5 -12
  217. package/dist/core/profiles.js.map +1 -1
  218. package/dist/core/project-config.d.ts +43 -44
  219. package/dist/core/project-config.d.ts.map +1 -1
  220. package/dist/core/project-config.js +107 -82
  221. package/dist/core/project-config.js.map +1 -1
  222. package/dist/core/project-layout.d.ts +9 -17
  223. package/dist/core/project-layout.d.ts.map +1 -1
  224. package/dist/core/project-layout.js +16 -26
  225. package/dist/core/project-layout.js.map +1 -1
  226. package/dist/core/root-selection.d.ts +8 -14
  227. package/dist/core/root-selection.d.ts.map +1 -1
  228. package/dist/core/root-selection.js +3 -6
  229. package/dist/core/root-selection.js.map +1 -1
  230. package/dist/core/rules.d.ts.map +1 -1
  231. package/dist/core/rules.js +2 -3
  232. package/dist/core/rules.js.map +1 -1
  233. package/dist/core/schema-names.d.ts +16 -0
  234. package/dist/core/schema-names.d.ts.map +1 -0
  235. package/dist/core/schema-names.js +16 -0
  236. package/dist/core/schema-names.js.map +1 -0
  237. package/dist/core/schemas/base.schema.d.ts.map +1 -1
  238. package/dist/core/schemas/base.schema.js +6 -12
  239. package/dist/core/schemas/base.schema.js.map +1 -1
  240. package/dist/core/schemas/change.schema.d.ts +8 -0
  241. package/dist/core/schemas/change.schema.d.ts.map +1 -1
  242. package/dist/core/schemas/change.schema.js +41 -10
  243. package/dist/core/schemas/change.schema.js.map +1 -1
  244. package/dist/core/shared/index.d.ts +2 -7
  245. package/dist/core/shared/index.d.ts.map +1 -1
  246. package/dist/core/shared/index.js +2 -7
  247. package/dist/core/shared/index.js.map +1 -1
  248. package/dist/core/shared/rules-generation.d.ts +5 -15
  249. package/dist/core/shared/rules-generation.d.ts.map +1 -1
  250. package/dist/core/shared/rules-generation.js +33 -37
  251. package/dist/core/shared/rules-generation.js.map +1 -1
  252. package/dist/core/shared/skill-generation.d.ts +28 -43
  253. package/dist/core/shared/skill-generation.d.ts.map +1 -1
  254. package/dist/core/shared/skill-generation.js +82 -51
  255. package/dist/core/shared/skill-generation.js.map +1 -1
  256. package/dist/core/shared/tool-detection.d.ts +35 -76
  257. package/dist/core/shared/tool-detection.d.ts.map +1 -1
  258. package/dist/core/shared/tool-detection.js +73 -93
  259. package/dist/core/shared/tool-detection.js.map +1 -1
  260. package/dist/core/skill-metrics.d.ts +36 -63
  261. package/dist/core/skill-metrics.d.ts.map +1 -1
  262. package/dist/core/skill-metrics.js +34 -73
  263. package/dist/core/skill-metrics.js.map +1 -1
  264. package/dist/core/spec-presenter.d.ts.map +1 -1
  265. package/dist/core/spec-presenter.js +5 -10
  266. package/dist/core/spec-presenter.js.map +1 -1
  267. package/dist/core/specs-apply.d.ts +16 -31
  268. package/dist/core/specs-apply.d.ts.map +1 -1
  269. package/dist/core/specs-apply.js +146 -195
  270. package/dist/core/specs-apply.js.map +1 -1
  271. package/dist/core/templates/fragments/interview.d.ts +2 -6
  272. package/dist/core/templates/fragments/interview.d.ts.map +1 -1
  273. package/dist/core/templates/fragments/interview.js +2 -6
  274. package/dist/core/templates/fragments/interview.js.map +1 -1
  275. package/dist/core/templates/fragments/next-step.d.ts +4 -8
  276. package/dist/core/templates/fragments/next-step.d.ts.map +1 -1
  277. package/dist/core/templates/fragments/next-step.js +4 -8
  278. package/dist/core/templates/fragments/next-step.js.map +1 -1
  279. package/dist/core/templates/fragments/validate.d.ts +13 -0
  280. package/dist/core/templates/fragments/validate.d.ts.map +1 -0
  281. package/dist/core/templates/fragments/validate.js +13 -0
  282. package/dist/core/templates/fragments/validate.js.map +1 -0
  283. package/dist/core/templates/fragments/verify.d.ts +9 -12
  284. package/dist/core/templates/fragments/verify.d.ts.map +1 -1
  285. package/dist/core/templates/fragments/verify.js +9 -12
  286. package/dist/core/templates/fragments/verify.js.map +1 -1
  287. package/dist/core/templates/index.d.ts +0 -6
  288. package/dist/core/templates/index.d.ts.map +1 -1
  289. package/dist/core/templates/index.js +0 -7
  290. package/dist/core/templates/index.js.map +1 -1
  291. package/dist/core/templates/skill-templates.d.ts +1 -5
  292. package/dist/core/templates/skill-templates.d.ts.map +1 -1
  293. package/dist/core/templates/skill-templates.js +0 -5
  294. package/dist/core/templates/skill-templates.js.map +1 -1
  295. package/dist/core/templates/types.d.ts +3 -7
  296. package/dist/core/templates/types.d.ts.map +1 -1
  297. package/dist/core/templates/types.js +0 -3
  298. package/dist/core/templates/types.js.map +1 -1
  299. package/dist/core/templates/workflows/apply.d.ts +3 -9
  300. package/dist/core/templates/workflows/apply.d.ts.map +1 -1
  301. package/dist/core/templates/workflows/apply.js +11 -13
  302. package/dist/core/templates/workflows/apply.js.map +1 -1
  303. package/dist/core/templates/workflows/archive.d.ts +0 -6
  304. package/dist/core/templates/workflows/archive.d.ts.map +1 -1
  305. package/dist/core/templates/workflows/archive.js +16 -5
  306. package/dist/core/templates/workflows/archive.js.map +1 -1
  307. package/dist/core/templates/workflows/decision.js +3 -3
  308. package/dist/core/templates/workflows/decision.js.map +1 -1
  309. package/dist/core/templates/workflows/explore.js +1 -1
  310. package/dist/core/templates/workflows/grill.d.ts.map +1 -1
  311. package/dist/core/templates/workflows/grill.js +0 -2
  312. package/dist/core/templates/workflows/grill.js.map +1 -1
  313. package/dist/core/templates/workflows/issue.d.ts +0 -6
  314. package/dist/core/templates/workflows/issue.d.ts.map +1 -1
  315. package/dist/core/templates/workflows/issue.js +3 -2
  316. package/dist/core/templates/workflows/issue.js.map +1 -1
  317. package/dist/core/templates/workflows/propose.d.ts +0 -6
  318. package/dist/core/templates/workflows/propose.d.ts.map +1 -1
  319. package/dist/core/templates/workflows/propose.js +2 -2
  320. package/dist/core/templates/workflows/propose.js.map +1 -1
  321. package/dist/core/templates/workflows/sync.d.ts +2 -8
  322. package/dist/core/templates/workflows/sync.d.ts.map +1 -1
  323. package/dist/core/templates/workflows/sync.js +4 -3
  324. package/dist/core/templates/workflows/sync.js.map +1 -1
  325. package/dist/core/templates/workflows/update.d.ts +0 -6
  326. package/dist/core/templates/workflows/update.d.ts.map +1 -1
  327. package/dist/core/templates/workflows/update.js +9 -2
  328. package/dist/core/templates/workflows/update.js.map +1 -1
  329. package/dist/core/update.d.ts +10 -36
  330. package/dist/core/update.d.ts.map +1 -1
  331. package/dist/core/update.js +59 -126
  332. package/dist/core/update.js.map +1 -1
  333. package/dist/core/user-state-migration.d.ts +13 -15
  334. package/dist/core/user-state-migration.d.ts.map +1 -1
  335. package/dist/core/user-state-migration.js +16 -20
  336. package/dist/core/user-state-migration.js.map +1 -1
  337. package/dist/core/validation/constants.d.ts +4 -10
  338. package/dist/core/validation/constants.d.ts.map +1 -1
  339. package/dist/core/validation/constants.js +25 -25
  340. package/dist/core/validation/constants.js.map +1 -1
  341. package/dist/core/validation/prose-length.d.ts +15 -0
  342. package/dist/core/validation/prose-length.d.ts.map +1 -0
  343. package/dist/core/validation/prose-length.js +29 -0
  344. package/dist/core/validation/prose-length.js.map +1 -0
  345. package/dist/core/validation/purpose-placeholder.d.ts +9 -16
  346. package/dist/core/validation/purpose-placeholder.d.ts.map +1 -1
  347. package/dist/core/validation/purpose-placeholder.js +30 -44
  348. package/dist/core/validation/purpose-placeholder.js.map +1 -1
  349. package/dist/core/validation/section-validator.d.ts +4 -4
  350. package/dist/core/validation/section-validator.d.ts.map +1 -1
  351. package/dist/core/validation/section-validator.js +30 -12
  352. package/dist/core/validation/section-validator.js.map +1 -1
  353. package/dist/core/validation/task-numbering.d.ts +6 -3
  354. package/dist/core/validation/task-numbering.d.ts.map +1 -1
  355. package/dist/core/validation/task-numbering.js +23 -11
  356. package/dist/core/validation/task-numbering.js.map +1 -1
  357. package/dist/core/validation/types.d.ts +18 -0
  358. package/dist/core/validation/types.d.ts.map +1 -1
  359. package/dist/core/validation/types.js +12 -1
  360. package/dist/core/validation/types.js.map +1 -1
  361. package/dist/core/validation/validator.d.ts +42 -68
  362. package/dist/core/validation/validator.d.ts.map +1 -1
  363. package/dist/core/validation/validator.js +468 -285
  364. package/dist/core/validation/validator.js.map +1 -1
  365. package/dist/prompts/searchable-multi-select.d.ts +3 -8
  366. package/dist/prompts/searchable-multi-select.d.ts.map +1 -1
  367. package/dist/prompts/searchable-multi-select.js +16 -39
  368. package/dist/prompts/searchable-multi-select.js.map +1 -1
  369. package/dist/utils/change-metadata.d.ts +11 -50
  370. package/dist/utils/change-metadata.d.ts.map +1 -1
  371. package/dist/utils/change-metadata.js +48 -67
  372. package/dist/utils/change-metadata.js.map +1 -1
  373. package/dist/utils/change-utils.d.ts +24 -76
  374. package/dist/utils/change-utils.d.ts.map +1 -1
  375. package/dist/utils/change-utils.js +95 -142
  376. package/dist/utils/change-utils.js.map +1 -1
  377. package/dist/utils/file-lock.d.ts +39 -0
  378. package/dist/utils/file-lock.d.ts.map +1 -0
  379. package/dist/utils/file-lock.js +149 -0
  380. package/dist/utils/file-lock.js.map +1 -0
  381. package/dist/utils/file-system.d.ts +12 -32
  382. package/dist/utils/file-system.d.ts.map +1 -1
  383. package/dist/utils/file-system.js +16 -40
  384. package/dist/utils/file-system.js.map +1 -1
  385. package/dist/utils/frontmatter.d.ts +7 -11
  386. package/dist/utils/frontmatter.d.ts.map +1 -1
  387. package/dist/utils/frontmatter.js +11 -11
  388. package/dist/utils/frontmatter.js.map +1 -1
  389. package/dist/utils/interactive.d.ts +4 -9
  390. package/dist/utils/interactive.d.ts.map +1 -1
  391. package/dist/utils/interactive.js +2 -4
  392. package/dist/utils/interactive.js.map +1 -1
  393. package/dist/utils/item-discovery.d.ts +10 -20
  394. package/dist/utils/item-discovery.d.ts.map +1 -1
  395. package/dist/utils/item-discovery.js +31 -55
  396. package/dist/utils/item-discovery.js.map +1 -1
  397. package/dist/utils/link.d.ts +9 -18
  398. package/dist/utils/link.d.ts.map +1 -1
  399. package/dist/utils/link.js +9 -18
  400. package/dist/utils/link.js.map +1 -1
  401. package/dist/utils/requirement-diff.d.ts +13 -23
  402. package/dist/utils/requirement-diff.d.ts.map +1 -1
  403. package/dist/utils/requirement-diff.js +13 -23
  404. package/dist/utils/requirement-diff.js.map +1 -1
  405. package/dist/utils/spec-files.d.ts +7 -20
  406. package/dist/utils/spec-files.d.ts.map +1 -1
  407. package/dist/utils/spec-files.js +26 -51
  408. package/dist/utils/spec-files.js.map +1 -1
  409. package/dist/utils/task-progress.d.ts +11 -9
  410. package/dist/utils/task-progress.d.ts.map +1 -1
  411. package/dist/utils/task-progress.js +53 -32
  412. package/dist/utils/task-progress.js.map +1 -1
  413. package/dist/utils/timestamp.d.ts +5 -8
  414. package/dist/utils/timestamp.d.ts.map +1 -1
  415. package/dist/utils/timestamp.js +5 -8
  416. package/dist/utils/timestamp.js.map +1 -1
  417. package/package.json +2 -3
  418. package/schemas/issue/schema.yaml +8 -1
  419. package/schemas/issue/templates/spec.md +20 -3
  420. package/schemas/sdd/schema.yaml +20 -1
  421. package/schemas/sdd/templates/spec.md +20 -3
@@ -1,30 +1,23 @@
1
1
  /**
2
2
  * The directory layout `tospec init` creates, and the anchors that make it
3
- * survive version control.
4
- *
5
- * Git does not track an empty directory, so a layout committed straight after
6
- * init is not the layout a collaborator clones: the directories are gone, and
7
- * the first command that looks for one reports the project as uninitialized.
8
- * Nothing is lost — every writer creates the directory it needs on demand — but
9
- * a diagnostic that sends the reader to re-run a command that will change
10
- * nothing is worse than a crash.
3
+ * survive version control. Git does not track an empty directory, so without
4
+ * them a collaborator clones a layout whose directories are gone and the first
5
+ * command reports the project as uninitialized — nothing is lost, but the
6
+ * diagnostic sends the reader to re-run a command that changes nothing.
11
7
  */
12
8
  import path from 'path';
13
9
  import { promises as fs } from 'fs';
14
10
  /**
15
- * Relative to `tospec/`, in creation order.
16
- *
17
- * Not named for anchoring: whether a directory gets an anchor is computed from
18
- * whether it ends up empty, and `changes/` never does because it holds
19
- * `archive/`. A name asserting the property would be wrong for the next
20
- * directory that ships with content.
11
+ * Relative to `tospec/`, in creation order. Not named for anchoring: whether a
12
+ * directory gets an anchor is computed from whether it ends up empty, and
13
+ * `changes/` never does because it holds `archive/`.
21
14
  */
22
15
  export const TOSPEC_LAYOUT_DIRS = [
23
16
  'specs',
24
17
  'changes',
25
18
  'changes/archive',
26
- // Permanent decision records (`tospec decision new`); scaffolded here so the
27
- // layout is visible from the start instead of appearing on first use.
19
+ // Permanent decision records (`tospec decision new`), scaffolded here so the
20
+ // layout is visible from the start rather than appearing on first use.
28
21
  'decisions',
29
22
  ];
30
23
  const DIRECTORY_ANCHOR_FILE_NAME = '.gitkeep';
@@ -33,27 +26,24 @@ export function tospecLayoutDirs(tospecPath) {
33
26
  return TOSPEC_LAYOUT_DIRS.map((relative) => path.join(tospecPath, relative));
34
27
  }
35
28
  /**
36
- * Anchor `directory` if it is empty. A directory that already holds content
37
- * needs no anchor — the anchor exists to make an empty directory representable,
38
- * and adding one beside real content leaves a file nobody asked for.
29
+ * Anchor `directory` if it is empty. An anchor exists to make an empty directory
30
+ * representable, so adding one beside real content leaves a file nobody wanted.
39
31
  */
40
32
  export async function ensureDirectoryAnchor(directory) {
41
33
  if ((await fs.readdir(directory)).length > 0)
42
34
  return;
43
35
  try {
44
- // Exclusive create. The emptiness check above already covers every entry
45
- // visible when it ran; this closes the window after it, where a file or a
46
- // link can appear at the anchor's path. An ordinary write would overwrite
47
- // content the anchor never owned, or write *through* a link into a path
48
- // outside the project entirely.
36
+ // Exclusive create, closing the window after the emptiness check where a
37
+ // file or link can appear at the anchor's path: an ordinary write would
38
+ // overwrite content the anchor never owned, or write *through* a link.
49
39
  await fs.writeFile(path.join(directory, DIRECTORY_ANCHOR_FILE_NAME), '', {
50
40
  encoding: 'utf-8',
51
41
  flag: 'wx',
52
42
  });
53
43
  }
54
44
  catch (error) {
55
- // Something is already there, so the directory is not empty and needs no
56
- // anchor. That is the anchor's job being done, not a failure.
45
+ // Something is already there, so the directory needs no anchor: done, not
46
+ // a failure.
57
47
  if (error?.code === 'EEXIST')
58
48
  return;
59
49
  throw error;
@@ -1 +1 @@
1
- {"version":3,"file":"project-layout.js","sourceRoot":"","sources":["../../src/core/project-layout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AAEpC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,OAAO;IACP,SAAS;IACT,iBAAiB;IACjB,6EAA6E;IAC7E,sEAAsE;IACtE,WAAW;CACH,CAAC;AAEX,MAAM,0BAA0B,GAAG,UAAU,CAAC;AAE9C,yEAAyE;AACzE,MAAM,UAAU,gBAAgB,CAAC,UAAkB;IACjD,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAA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CAAC;AAC/E,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,SAAiB;IAC3D,IAAI,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO;IAErD,IAAI,CAAC;QACH,yEAAyE;QACzE,wEAAwE;QACxE,uEAAuE;QACvE,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,0BAA0B,CAAC,EAAE,EAAE,EAAE;YACvE,QAAQ,EAAE,OAAO;YACjB,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,0EAA0E;QAC1E,aAAa;QACb,IAAK,KAA+B,EAAE,IAAI,KAAK,QAAQ;YAAE,OAAO;QAChE,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -1,21 +1,15 @@
1
1
  /**
2
- * tospec root resolution — minimal single-team version.
3
- *
4
- * tospec drops the store subsystem, so resolution collapses to the plan's
5
- * rule: walk up from the start path to the nearest ancestor that contains a
6
- * `tospec/` directory; if none is found, treat the current directory as an
7
- * implicit root (unless the caller forbids it).
2
+ * Root resolution: walk up from the start path to the nearest ancestor holding
3
+ * a `tospec/` directory, else treat the current directory as an implicit root
4
+ * unless the caller forbids it.
8
5
  */
9
6
  import { type PlanningHome } from './planning-home.js';
10
7
  /**
11
- * How a command arrived at the root it reports.
12
- *
13
- * `nearest` and `implicit` are the two outcomes of *searching* for a root.
14
- * `explicit` is the install layer (`init`, `update`, `rules`, `migrate`), which
15
- * never searches — it operates on the path it was handed. Those commands used
16
- * to omit `source` entirely, and `JSON.stringify` drops an absent key, so a
17
- * caller reading `root.source` could not tell "this command does not resolve a
18
- * root" from "the field was renamed". Naming the case keeps the key present.
8
+ * How a command arrived at the root it reports. `nearest` and `implicit` are the
9
+ * two outcomes of *searching*; `explicit` is the install layer (`init`,
10
+ * `update`, `rules`, `migrate`), which operates on the path it was handed.
11
+ * Naming that case keeps the key present: `JSON.stringify` drops an omitted
12
+ * one, leaving a caller unable to tell it from a renamed field.
19
13
  */
20
14
  export type TospecRootSource = 'nearest' | 'implicit' | 'explicit';
21
15
  export interface ResolveTospecRootOptions {
@@ -1 +1 @@
1
- {"version":3,"file":"root-selection.d.ts","sourceRoot":"","sources":["../../src/core/root-selection.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAG5B;;;;;;;;;GASG;AACH,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAEnE,MAAM,WAAW,wBAAwB;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,KAAK,CAAC;IACrB,MAAM,EAAE,gBAAgB,CAAC;CAC1B;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,UAAU,EAAE,uBAAuB,CAAC;IAE7C,YACE,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAO,EA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- *
4
- * tospec drops the store subsystem, so resolution collapses to the plan's
5
- * rule: walk up from the start path to the nearest ancestor that contains a
6
- * `tospec/` directory; if none is found, treat the current directory as an
7
- * implicit root (unless the caller forbids it).
2
+ * Root resolution: walk up from the start path to the nearest ancestor holding
3
+ * a `tospec/` directory, else treat the current directory as an implicit root
4
+ * unless the caller forbids it.
8
5
  */
9
6
  import * as path from 'node:path';
10
7
  import { findRepoPlanningRootSync, getSearchStartDirectory, } from './planning-home.js';
@@ -1 +1 @@
1
- {"version":3,"file":"root-selection.js","sourceRoot":"","sources":["../../src/core/root-selection.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EACL,wBAAwB,EACxB,uBAAuB,GAExB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAqCrF,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAClC,UAAU,CAA0B;IAE7C,YACE,OAAe,EACf,IAAY,EACZ,OAAO,GAAsC,EAAE;QAE/C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG;YAChB,QAAQ,EAAE,OAAO;YACjB,IAAI;YACJ,OAAO;YACP,GAAG,OAAO;SACX,CAAC;IACJ,CAAC;CACF;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAc;IACjD,OAAO,KAAK,YAAY,kBAAkB,CAAC;AAC7C,CAAC;AAED,SAAS,QAAQ,CAAC,QAAgB,EAAE,MAAwB;IAC1D,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC;QACpD,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC;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f,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,aAAa,EAAE,IAAI,CAAC,aAAa;KAClC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,SAAkB,EAClB,MAAM,GAIF,EAAE;IAEN,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,iBAAiB,CAAC;YACnC,GAAG,CAAC,MAAM,CAAC,iBAAiB,KAAK,SAAS;gBACxC,CAAC,CAAC,EAAE,iBAAiB,EAAE,MAAM,CAAC,iBAAiB,EAAE;gBACjD,CAAC,CAAC,EAAE,CAAC;SACR,CAAC,CAAC;QACH,kBAAkB,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;QACvC,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,MAAM,CAAC,IAAI,IAAI,oBAAoB,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/C,iBAAiB,CAAC,MAAM,CAAC,cAAc,IAAI,EAAE,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;YACjE,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/core/rules.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,gFAAgF;AAChF,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAA+B,CAAC;AAE1F,oFAAoF;AACpF,qBAAa,YAAY;IACjB,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAmClF;CACF"}
1
+ {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/core/rules.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,gFAAgF;AAChF,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAA+B,CAAC;AAE1F,oFAAoF;AACpF,qBAAa,YAAY;IACjB,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkClF;CACF"}
@@ -16,9 +16,8 @@ export class RulesCommand {
16
16
  const tools = getConfiguredTools(projectPath);
17
17
  if (tools.length === 0) {
18
18
  // Not an error: a project can legitimately have no agent configured. The
19
- // JSON form says so with an empty list rather than prose, so a caller does
20
- // not have to tell "nothing to do" from "something went wrong" by reading
21
- // English.
19
+ // JSON form says so with an empty list, so a caller need not read English
20
+ // to tell "nothing to do" from "something went wrong".
22
21
  if (options.json) {
23
22
  emitSuccess({ rules: [], message: 'No configured tools found.' }, { path: projectPath, source: 'explicit' });
24
23
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"rules.js","sourceRoot":"","sources":["../../src/core/rules.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAM3D,gFAAgF;AAChF,MAAM,CAAC,MAAM,qBAAqB,GAA4B,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAE1F,oFAAoF;AACpF,MAAM,OAAO,YAAY;IACvB,KAAK,CAAC,OAAO,CAAC,UAAkB,EAAE,OAAO,GAAwB,EA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AAC,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,4BAA4B,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;gBAC7G,OAAO;YACT,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,+DAA+D,CAAC,CAAC;YAC7E,OAAO;QACT,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,iBAAiB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QACzD,MAAM,kBAAkB,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAEzD,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACjB,WAAW,CACT;gBACE,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;oBAC1B,IAAI,EAAE,KAAK,CAAC,MAAM;oBAClB,IAAI,EAAE,KAAK,CAAC,IAAI;oBAChB,IAAI,EAAE,KAAK,CAAC,WAAW;oBACvB,MAAM,EAAE,KAAK,CAAC,MAAM;oBACpB,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBACvD,CAAC,CAAC;aACJ,EACD,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,CAC1C,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Schema names the command layer keys behaviour on. Kept out of any command
3
+ * module: `workflow/shared.ts` needs the decision name to refuse it for `new
4
+ * change`, and `decision.ts` needs the default schema to complete a root — with
5
+ * the constants living in those two files, each imported the other and the
6
+ * ESM cycle left one of them reading `undefined` depending on entry order.
7
+ */
8
+ /** The schema `new change` and `templates` fall back to. */
9
+ export declare const DEFAULT_SCHEMA = "sdd";
10
+ /**
11
+ * Backs the ADR writer, not the change graph: a change created against it
12
+ * lands under `tospec/changes/` where `decision list` never sees it, so `new
13
+ * change` refuses it by name.
14
+ */
15
+ export declare const DECISION_SCHEMA_NAME = "decision";
16
+ //# sourceMappingURL=schema-names.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-names.d.ts","sourceRoot":"","sources":["../../src/core/schema-names.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,4DAA4D;AAC5D,eAAO,MAAM,cAAc,QAAQ,CAAC;AAEpC;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,aAAa,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Schema names the command layer keys behaviour on. Kept out of any command
3
+ * module: `workflow/shared.ts` needs the decision name to refuse it for `new
4
+ * change`, and `decision.ts` needs the default schema to complete a root — with
5
+ * the constants living in those two files, each imported the other and the
6
+ * ESM cycle left one of them reading `undefined` depending on entry order.
7
+ */
8
+ /** The schema `new change` and `templates` fall back to. */
9
+ export const DEFAULT_SCHEMA = 'sdd';
10
+ /**
11
+ * Backs the ADR writer, not the change graph: a change created against it
12
+ * lands under `tospec/changes/` where `decision list` never sees it, so `new
13
+ * change` refuses it by name.
14
+ */
15
+ export const DECISION_SCHEMA_NAME = 'decision';
16
+ //# sourceMappingURL=schema-names.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-names.js","sourceRoot":"","sources":["../../src/core/schema-names.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC;AAEpC;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"base.schema.d.ts","sourceRoot":"","sources":["../../../src/core/schemas/base.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,cAAc;;;iBASzB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;iBA0B5B,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
1
+ {"version":3,"file":"base.schema.d.ts","sourceRoot":"","sources":["../../../src/core/schemas/base.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,cAAc;;;iBASzB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;iBAoB5B,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -15,23 +15,17 @@ export const RequirementSchema = z.object({
15
15
  * The `### Requirement: <name>` heading text, without the `Requirement:`
16
16
  * prefix.
17
17
  *
18
- * Carried rather than discarded because this string is load-bearing: a
19
- * MODIFIED, REMOVED or RENAMED delta must reproduce the header exactly, and
20
- * archive hard-fails on a mismatch. While `show --json` reported only `text`,
21
- * the one command an agent would use to read the current spec withheld the
22
- * single field needed to write a delta against it, forcing a fall back to
23
- * parsing raw Markdown.
18
+ * Carried rather than discarded: a MODIFIED, REMOVED or RENAMED delta must
19
+ * reproduce the header exactly and archive hard-fails on a mismatch, so
20
+ * `show --json` has to report it.
24
21
  *
25
22
  * Optional in the schema so a hand-built Requirement need not supply one;
26
23
  * every parsed requirement carries it.
27
24
  */
28
25
  name: z.string().optional(),
29
- // SHALL/MUST body-keyword enforcement lives in the imperative validator
30
- // (Validator.applySpecRules), not here: the parser collapses the requirement
31
- // header into `text`, so a Zod refine on `text` cannot tell "keyword in header
32
- // only" from "keyword in body" and emits a misleading generic error. The
33
- // validator recovers the header and emits the targeted hint for both the
34
- // main-spec and change-delta paths (#1156).
26
+ // SHALL/MUST body-keyword enforcement lives in Validator.applySpecRules: the
27
+ // parser collapses the requirement header into `text`, so a Zod refine here
28
+ // cannot tell "keyword in header only" from "keyword in body".
35
29
  text: z.string()
36
30
  .min(1, VALIDATION_MESSAGES.REQUIREMENT_EMPTY),
37
31
  scenarios: z.array(ScenarioSchema)
@@ -1 +1 @@
1
- {"version":3,"file":"base.schema.js","sourceRoot":"","sources":["../../../src/core/schemas/base.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC;;;;;OAKG;IACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,mBAAmB,CAAC,cAAc,CAAC;CAC/D,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC;;;;;;;;;;;;;OAaG;IACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,wEAAwE;IACxE,6EAA6E;IAC7E,+EAA+E;IAC/E,yEAAyE;IACzE,yEAAyE;IACzE,4CAA4C;IAC5C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;SACb,GAAG,CAAC,CAAC,EAAE,mBAAmB,CAAC,iBAAiB,CAAC;IAChD,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC;SAC/B,GAAG,CAAC,CAAC,EAAE,mBAAmB,CAAC,wBAAwB,CAAC;CACxD,CAAC,CAAC"}
1
+ {"version":3,"file":"base.schema.js","sourceRoot":"","sources":["../../../src/core/schemas/base.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC;;;;;OAKG;IACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,mBAAmB,CAAC,cAAc,CAAC;CAC/D,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC;;;;;;;;;;OAUG;IACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,6EAA6E;IAC7E,4EAA4E;IAC5E,+DAA+D;IAC/D,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;SACb,GAAG,CAAC,CAAC,EAAE,mBAAmB,CAAC,iBAAiB,CAAC;IAChD,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC;SAC/B,GAAG,CAAC,CAAC,EAAE,mBAAmB,CAAC,wBAAwB,CAAC;CACxD,CAAC,CAAC"}
@@ -35,6 +35,14 @@ export declare const DeltaSchema: z.ZodObject<{
35
35
  to: z.ZodString;
36
36
  }, z.core.$strip>>;
37
37
  }, z.core.$strip>;
38
+ /**
39
+ * The *shape* of a parsed change — what `ChangeParser` returns and what `Change`
40
+ * is inferred from — not where a change's rules live. Those are in
41
+ * `schemas/<name>/schema.yaml` (read by `validateSections`) and
42
+ * `validateChangeDeltaSpecs`.
43
+ *
44
+ * Keep it that way: nothing in `src/` runs a rule added here.
45
+ */
38
46
  export declare const ChangeSchema: z.ZodObject<{
39
47
  name: z.ZodString;
40
48
  why: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"change.schema.d.ts","sourceRoot":"","sources":["../../../src/core/schemas/change.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,kBAAkB;;;;;EAAsD,CAAC;AAEtF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAUtB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAcvB,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAChE,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAChD,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC"}
1
+ {"version":3,"file":"change.schema.d.ts","sourceRoot":"","sources":["../../../src/core/schemas/change.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,kBAAkB;;;;;EAAsD,CAAC;AAatF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0BtB,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAUvB,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAChE,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAChD,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC"}
@@ -1,27 +1,58 @@
1
1
  import { z } from 'zod';
2
- import { RequirementSchema } from './base.schema.js';
3
- import { MIN_WHY_SECTION_LENGTH, MAX_WHY_SECTION_LENGTH, MAX_DELTAS_PER_CHANGE, VALIDATION_MESSAGES } from '../validation/constants.js';
2
+ import { RequirementSchema, ScenarioSchema } from './base.schema.js';
3
+ import { VALIDATION_MESSAGES } from '../validation/constants.js';
4
4
  export const DeltaOperationType = z.enum(['ADDED', 'MODIFIED', 'REMOVED', 'RENAMED']);
5
+ /**
6
+ * A requirement as a delta carries it. Identical to RequirementSchema except
7
+ * that the scenario list may be empty, because a REMOVED entry names a
8
+ * requirement that is going away: the canonical form for it is a bullet with
9
+ * Reason/Migration fields, which has no scenarios to restate. The min-1 rule
10
+ * still applies to every other operation — see the refinement below.
11
+ */
12
+ const DeltaRequirementSchema = RequirementSchema.extend({
13
+ scenarios: z.array(ScenarioSchema),
14
+ });
5
15
  export const DeltaSchema = z.object({
6
16
  spec: z.string().min(1, VALIDATION_MESSAGES.DELTA_SPEC_EMPTY),
7
17
  operation: DeltaOperationType,
8
18
  description: z.string().min(1, VALIDATION_MESSAGES.DELTA_DESCRIPTION_EMPTY),
9
- requirement: RequirementSchema.optional(),
10
- requirements: z.array(RequirementSchema).optional(),
19
+ requirement: DeltaRequirementSchema.optional(),
20
+ requirements: z.array(DeltaRequirementSchema).optional(),
11
21
  rename: z.object({
12
22
  from: z.string(),
13
23
  to: z.string(),
14
24
  }).optional(),
25
+ }).superRefine((delta, ctx) => {
26
+ // Scenario-less requirements are only legal on a REMOVED delta. Enforced here
27
+ // rather than on the field so every operation keeps one shape.
28
+ if (delta.operation === 'REMOVED')
29
+ return;
30
+ const reject = (path) => ctx.addIssue({
31
+ code: z.ZodIssueCode.custom,
32
+ message: VALIDATION_MESSAGES.REQUIREMENT_NO_SCENARIOS,
33
+ path,
34
+ });
35
+ if (delta.requirement && delta.requirement.scenarios.length === 0) {
36
+ reject(['requirement', 'scenarios']);
37
+ }
38
+ delta.requirements?.forEach((requirement, index) => {
39
+ if (requirement.scenarios.length === 0)
40
+ reject(['requirements', index, 'scenarios']);
41
+ });
15
42
  });
43
+ /**
44
+ * The *shape* of a parsed change — what `ChangeParser` returns and what `Change`
45
+ * is inferred from — not where a change's rules live. Those are in
46
+ * `schemas/<name>/schema.yaml` (read by `validateSections`) and
47
+ * `validateChangeDeltaSpecs`.
48
+ *
49
+ * Keep it that way: nothing in `src/` runs a rule added here.
50
+ */
16
51
  export const ChangeSchema = z.object({
17
52
  name: z.string().min(1, VALIDATION_MESSAGES.CHANGE_NAME_EMPTY),
18
- why: z.string()
19
- .min(MIN_WHY_SECTION_LENGTH, VALIDATION_MESSAGES.CHANGE_WHY_TOO_SHORT)
20
- .max(MAX_WHY_SECTION_LENGTH, VALIDATION_MESSAGES.CHANGE_WHY_TOO_LONG),
53
+ why: z.string(),
21
54
  whatChanges: z.string().min(1, VALIDATION_MESSAGES.CHANGE_WHAT_EMPTY),
22
- deltas: z.array(DeltaSchema)
23
- .min(1, VALIDATION_MESSAGES.CHANGE_NO_DELTAS)
24
- .max(MAX_DELTAS_PER_CHANGE, VALIDATION_MESSAGES.CHANGE_TOO_MANY_DELTAS),
55
+ deltas: z.array(DeltaSchema),
25
56
  metadata: z.object({
26
57
  version: z.string().default('1.0.0'),
27
58
  format: z.literal('tospec-change'),
@@ -1 +1 @@
1
- {"version":3,"file":"change.schema.js","sourceRoot":"","sources":["../../../src/core/schemas/change.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;AAEtF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,IAAI,EAAE,CAAC,CAAC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,MAAM,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;QACpC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC;QAClC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAClC,CAAC,CAAC,QAAQ,EAAE;CACd,CAAC,CAAC"}
@@ -1,9 +1,4 @@
1
- /**
2
- * Shared Utilities
3
- *
4
- * Common code shared between init and update commands.
5
- */
6
- export { SKILL_NAMES, LEGACY_SKILL_DIRS, type ToolSkillStatus, type ToolVersionStatus, removeLegacySkillDirs, removeLegacyToolSkillLayout, getToolsWithSkillsDir, getToolSkillStatus, getToolStates, extractGeneratedByVersion, getToolVersionStatus, getConfiguredTools, } from './tool-detection.js';
7
- export { type SkillTemplateEntry, type CommandTemplateEntry, getSkillTemplates, getCommandTemplates, getCommandContents, generateSkillContent, writeSkillDir, writeToolCommands, } from './skill-generation.js';
1
+ export { SKILL_NAMES, LEGACY_SKILL_DIRS, type ToolSkillStatus, type ToolVersionStatus, removeLegacySkillDirs, removeUnselectedSkillDirs, removeLegacyToolSkillLayout, getToolsWithSkillsDir, getToolSkillStatus, getToolStates, extractGeneratedByVersion, getToolVersionStatus, getConfiguredTools, } from './tool-detection.js';
2
+ export { type SkillTemplateEntry, type CommandTemplateEntry, type WorkflowReferenceGap, getSkillTemplates, getCommandTemplates, getCommandContents, generateSkillContent, writeSkillDir, writeToolCommands, findWorkflowReferenceGaps, describeWorkflowReferenceGaps, } from './skill-generation.js';
8
3
  export { planWorkflowRules, writeWorkflowRules } from './rules-generation.js';
9
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/shared/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,qBAAqB,EACrB,2BAA2B,EAC3B,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/shared/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,qBAAqB,EACrB,yBAAyB,EACzB,2BAA2B,EAC3B,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -1,9 +1,4 @@
1
- /**
2
- * Shared Utilities
3
- *
4
- * Common code shared between init and update commands.
5
- */
6
- export { SKILL_NAMES, LEGACY_SKILL_DIRS, removeLegacySkillDirs, removeLegacyToolSkillLayout, getToolsWithSkillsDir, getToolSkillStatus, getToolStates, extractGeneratedByVersion, getToolVersionStatus, getConfiguredTools, } from './tool-detection.js';
7
- export { getSkillTemplates, getCommandTemplates, getCommandContents, generateSkillContent, writeSkillDir, writeToolCommands, } from './skill-generation.js';
1
+ export { SKILL_NAMES, LEGACY_SKILL_DIRS, removeLegacySkillDirs, removeUnselectedSkillDirs, removeLegacyToolSkillLayout, getToolsWithSkillsDir, getToolSkillStatus, getToolStates, extractGeneratedByVersion, getToolVersionStatus, getConfiguredTools, } from './tool-detection.js';
2
+ export { getSkillTemplates, getCommandTemplates, getCommandContents, generateSkillContent, writeSkillDir, writeToolCommands, findWorkflowReferenceGaps, describeWorkflowReferenceGaps, } from './skill-generation.js';
8
3
  export { planWorkflowRules, writeWorkflowRules } from './rules-generation.js';
9
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/shared/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,WAAW,EACX,iBAAiB,EAGjB,qBAAqB,EACrB,2BAA2B,EAC3B,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAGL,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/shared/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,iBAAiB,EAGjB,qBAAqB,EACrB,yBAAyB,EACzB,2BAA2B,EAC3B,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAIL,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -1,16 +1,9 @@
1
1
  /**
2
- * Rules Generation
3
- *
4
2
  * Every rule document tospec writes is managed the same way: a shipped Markdown
5
3
  * template, wrapped in a hash-stamped marker, planned read-only before any
6
- * project write, and refused rather than overwritten once somebody has edited it.
7
- *
8
- * `decision.md` used to be the exception — an init-only writer that overwrote it
9
- * unconditionally, with no marker to tell a generated file from an edited one and
10
- * no entry in what `rules`/`update` reported. Editing it therefore lost the edit
11
- * on the next `tospec init`, silently, in the default path, while its sibling in
12
- * the same directory refused even `--force`. Two standards in one directory teach
13
- * the safer one and then break it, so there is now only one.
4
+ * project write, and refused rather than overwritten once somebody has edited
5
+ * it. Without the marker there is no way to tell a generated file from an
6
+ * edited one, and `tospec init` silently loses the edit.
14
7
  */
15
8
  export interface WorkflowRulePlan {
16
9
  toolId: string;
@@ -28,11 +21,8 @@ export interface WorkflowRulePlan {
28
21
  /** Read every target before allowing any project mutation. */
29
22
  export declare function planWorkflowRules(projectPath: string, toolIds: string[]): Promise<WorkflowRulePlan[]>;
30
23
  /**
31
- * Call only after the complete plan passed preflight.
32
- *
33
- * `silent` suppresses the progress prose for a `--json` caller, which reports
34
- * the same facts from the plan itself — prose on stdout would break the
35
- * one-document envelope.
24
+ * Call only after the complete plan passed preflight. `silent` suppresses the
25
+ * progress prose for a `--json` caller, whose stdout must stay one document.
36
26
  */
37
27
  export declare function writeWorkflowRules(plan: WorkflowRulePlan[], options?: {
38
28
  silent?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"rules-generation.d.ts","sourceRoot":"","sources":["../../../src/core/shared/rules-generation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAoEH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,CAAC;IAC5C;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAkCD,8DAA8D;AAC9D,wBAAsB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CA8D3G;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,gBAAgB,EAAE,EACxB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GACjC,OAAO,CAAC,IAAI,CAAC,CAuBf"}
1
+ {"version":3,"file":"rules-generation.d.ts","sourceRoot":"","sources":["../../../src/core/shared/rules-generation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAoEH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,CAAC;IAC5C;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAuCD,8DAA8D;AAC9D,wBAAsB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAkE3G;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,gBAAgB,EAAE,EACxB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GACjC,OAAO,CAAC,IAAI,CAAC,CAsBf"}
@@ -1,16 +1,9 @@
1
1
  /**
2
- * Rules Generation
3
- *
4
2
  * Every rule document tospec writes is managed the same way: a shipped Markdown
5
3
  * template, wrapped in a hash-stamped marker, planned read-only before any
6
- * project write, and refused rather than overwritten once somebody has edited it.
7
- *
8
- * `decision.md` used to be the exception — an init-only writer that overwrote it
9
- * unconditionally, with no marker to tell a generated file from an edited one and
10
- * no entry in what `rules`/`update` reported. Editing it therefore lost the edit
11
- * on the next `tospec init`, silently, in the default path, while its sibling in
12
- * the same directory refused even `--force`. Two standards in one directory teach
13
- * the safer one and then break it, so there is now only one.
4
+ * project write, and refused rather than overwritten once somebody has edited
5
+ * it. Without the marker there is no way to tell a generated file from an
6
+ * edited one, and `tospec init` silently loses the edit.
14
7
  */
15
8
  import path from 'node:path';
16
9
  import { promises as fs } from 'node:fs';
@@ -18,9 +11,9 @@ import { createHash } from 'node:crypto';
18
11
  import { AI_TOOLS, CODEX_TARGET_ID, DECISION_RULE_FILENAME, LEGACY_WORKFLOW_RULE_FILENAME, TOOL_RULES_SUBDIR, WORKFLOW_RULE_FILENAME, } from '../config.js';
19
12
  import { FileSystemUtils } from '../../utils/file-system.js';
20
13
  /**
21
- * The exact text the init-only writer produced. Kept verbatim — not regenerated
22
- * from the template — because its only job is to recognise files already on disk.
23
- * If the shipped body ever changes, this string must not follow it.
14
+ * The exact text the init-only writer produced. Kept verbatim rather than
15
+ * regenerated from the template: its only job is to recognise files already on
16
+ * disk, so it must not follow a change to the shipped body.
24
17
  */
25
18
  const UNMARKED_DECISION_RULE = `# Decision
26
19
 
@@ -50,24 +43,30 @@ function bodyHash(body) {
50
43
  }
51
44
  const managedDocumentPattern = (slug) => new RegExp(`^<!-- tospec:${slug}:v1 sha256=([a-f0-9]{64}) -->\\n([\\s\\S]*\\n)<!-- \\/tospec:${slug} -->\\n$`);
52
45
  /**
53
- * Whether the file is an untouched tospec-generated rule document.
54
- *
55
- * Every slug this rule has ever used is accepted, and so is any unmarked body a
56
- * previous tospec wrote: refusing either would turn a routine `tospec update`
57
- * into a rule conflict for every project that predates the change.
46
+ * Whether the file is an untouched tospec-generated rule document. Every slug
47
+ * this rule has ever used is accepted, as is any unmarked body a previous tospec
48
+ * wrote: refusing either turns a routine `tospec update` into a rule conflict
49
+ * for every project predating the change.
58
50
  */
59
51
  function isIntactDocument(rule, content) {
60
52
  if (rule.unmarkedLegacyBodies?.some((body) => content === body))
61
53
  return true;
62
54
  return [rule.slug, ...(rule.legacySlugs ?? [])].some((slug) => {
63
55
  const match = managedDocumentPattern(slug).exec(content);
64
- // A dedicated file has exactly one frame; never silently drop text outside it.
56
+ // A dedicated file has exactly one frame; text outside it is somebody's.
65
57
  return match !== null && match[0] === content
66
58
  && !match[2].includes(`<!-- tospec:${slug}:`)
67
59
  && !match[2].includes(`<!-- /tospec:${slug} -->`)
68
60
  && bodyHash(match[2]) === match[1];
69
61
  });
70
62
  }
63
+ function planAction(previous, content) {
64
+ if (previous === undefined)
65
+ return 'created';
66
+ if (previous === content)
67
+ return 'unchanged';
68
+ return 'updated';
69
+ }
71
70
  /** Read every target before allowing any project mutation. */
72
71
  export async function planWorkflowRules(projectPath, toolIds) {
73
72
  if (toolIds.length === 0)
@@ -106,14 +105,15 @@ export async function planWorkflowRules(projectPath, toolIds) {
106
105
  const legacy = path.join(rulesDir, rule.legacyFilename);
107
106
  const legacyPrevious = await readIfPresent(legacy);
108
107
  if (legacyPrevious !== undefined) {
109
- // An edited copy under the old name is left exactly where it is and
110
- // reported, not deleted: the rename is tospec's housekeeping, and it
111
- // must not be the reason somebody's notes disappear. Removing it by
112
- // hand is the same one-step fix the conflict message already asks for.
108
+ // An edited copy under the old name is reported, not deleted: the
109
+ // rename is tospec's housekeeping, not a reason to drop notes. Named
110
+ // as the old spelling, because a user who never typed that filename
111
+ // cannot otherwise tell why an "old" file blocks the run.
113
112
  if (isIntactDocument(rule, legacyPrevious))
114
113
  retire = legacy;
115
- else
116
- conflicts.push(legacy);
114
+ else {
115
+ conflicts.push(`${legacy} (previous filename of ${rule.filename}; tospec would have renamed it had it not been edited)`);
116
+ }
117
117
  }
118
118
  }
119
119
  plan.push({
@@ -121,7 +121,7 @@ export async function planWorkflowRules(projectPath, toolIds) {
121
121
  rule: rule.filename,
122
122
  destination,
123
123
  content,
124
- action: previous === undefined ? 'created' : previous === content ? 'unchanged' : 'updated',
124
+ action: planAction(previous, content),
125
125
  ...(retire ? { retire } : {}),
126
126
  });
127
127
  }
@@ -132,11 +132,8 @@ export async function planWorkflowRules(projectPath, toolIds) {
132
132
  return plan;
133
133
  }
134
134
  /**
135
- * Call only after the complete plan passed preflight.
136
- *
137
- * `silent` suppresses the progress prose for a `--json` caller, which reports
138
- * the same facts from the plan itself — prose on stdout would break the
139
- * one-document envelope.
135
+ * Call only after the complete plan passed preflight. `silent` suppresses the
136
+ * progress prose for a `--json` caller, whose stdout must stay one document.
140
137
  */
141
138
  export async function writeWorkflowRules(plan, options = {}) {
142
139
  const say = (line) => {
@@ -148,17 +145,16 @@ export async function writeWorkflowRules(plan, options = {}) {
148
145
  await FileSystemUtils.writeFile(entry.destination, entry.content);
149
146
  }
150
147
  say(`Rules ${entry.action}: ${entry.destination}`);
151
- // After the write, never before: a failure between the two would otherwise
152
- // leave the project with no rule document at all.
148
+ // After the write, never before: a failure between the two would leave the
149
+ // project with no rule document at all.
153
150
  if (entry.retire) {
154
151
  await fs.rm(entry.retire, { force: true });
155
152
  say(`Rules removed (renamed): ${entry.retire}`);
156
153
  }
157
154
  }
158
- // Kept, not dropped, when the rules moved to `.agents`: Codex reads command
159
- // approval rules, AGENTS.md and skill files, never project Markdown under
160
- // rules/. Relocating the file did not give it a loading path, so removing the
161
- // notice would turn a known limitation into a silent failure.
155
+ // Codex reads AGENTS.md and skill files, never project Markdown under rules/,
156
+ // so the relocated file has no loading path there. Said out loud, or the
157
+ // limitation is silent.
162
158
  if (plan.some((entry) => entry.toolId === CODEX_TARGET_ID)) {
163
159
  say('Codex: rule documents are reference material; configure loading yourself. Markdown files in .agents/rules/ are not automatically loaded as instructions — Codex takes its text guidance from AGENTS.md and skill files.');
164
160
  }