@seanmars/tospec 0.4.2

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 (402) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +114 -0
  3. package/assets/dashboard/app.js +1032 -0
  4. package/assets/dashboard/chart.umd.js +14 -0
  5. package/assets/dashboard/index.html +30 -0
  6. package/assets/dashboard/style.css +675 -0
  7. package/bin/tospec.js +5 -0
  8. package/dist/cli/index.d.ts +5 -0
  9. package/dist/cli/index.d.ts.map +1 -0
  10. package/dist/cli/index.js +330 -0
  11. package/dist/cli/index.js.map +1 -0
  12. package/dist/commands/config.d.ts +36 -0
  13. package/dist/commands/config.d.ts.map +1 -0
  14. package/dist/commands/config.js +486 -0
  15. package/dist/commands/config.js.map +1 -0
  16. package/dist/commands/dashboard.d.ts +40 -0
  17. package/dist/commands/dashboard.d.ts.map +1 -0
  18. package/dist/commands/dashboard.js +385 -0
  19. package/dist/commands/dashboard.js.map +1 -0
  20. package/dist/commands/shared-output.d.ts +24 -0
  21. package/dist/commands/shared-output.d.ts.map +1 -0
  22. package/dist/commands/shared-output.js +51 -0
  23. package/dist/commands/shared-output.js.map +1 -0
  24. package/dist/commands/show.d.ts +17 -0
  25. package/dist/commands/show.d.ts.map +1 -0
  26. package/dist/commands/show.js +164 -0
  27. package/dist/commands/show.js.map +1 -0
  28. package/dist/commands/validate.d.ts +51 -0
  29. package/dist/commands/validate.d.ts.map +1 -0
  30. package/dist/commands/validate.js +416 -0
  31. package/dist/commands/validate.js.map +1 -0
  32. package/dist/commands/workflow/index.d.ts +17 -0
  33. package/dist/commands/workflow/index.d.ts.map +1 -0
  34. package/dist/commands/workflow/index.js +12 -0
  35. package/dist/commands/workflow/index.js.map +1 -0
  36. package/dist/commands/workflow/instructions.d.ts +35 -0
  37. package/dist/commands/workflow/instructions.d.ts.map +1 -0
  38. package/dist/commands/workflow/instructions.js +359 -0
  39. package/dist/commands/workflow/instructions.js.map +1 -0
  40. package/dist/commands/workflow/new-change.d.ts +17 -0
  41. package/dist/commands/workflow/new-change.d.ts.map +1 -0
  42. package/dist/commands/workflow/new-change.js +97 -0
  43. package/dist/commands/workflow/new-change.js.map +1 -0
  44. package/dist/commands/workflow/schemas.d.ts +10 -0
  45. package/dist/commands/workflow/schemas.d.ts.map +1 -0
  46. package/dist/commands/workflow/schemas.js +33 -0
  47. package/dist/commands/workflow/schemas.js.map +1 -0
  48. package/dist/commands/workflow/shared.d.ts +63 -0
  49. package/dist/commands/workflow/shared.d.ts.map +1 -0
  50. package/dist/commands/workflow/shared.js +111 -0
  51. package/dist/commands/workflow/shared.js.map +1 -0
  52. package/dist/commands/workflow/status.d.ts +14 -0
  53. package/dist/commands/workflow/status.d.ts.map +1 -0
  54. package/dist/commands/workflow/status.js +77 -0
  55. package/dist/commands/workflow/status.js.map +1 -0
  56. package/dist/commands/workflow/templates.d.ts +16 -0
  57. package/dist/commands/workflow/templates.d.ts.map +1 -0
  58. package/dist/commands/workflow/templates.js +60 -0
  59. package/dist/commands/workflow/templates.js.map +1 -0
  60. package/dist/core/archive.d.ts +33 -0
  61. package/dist/core/archive.d.ts.map +1 -0
  62. package/dist/core/archive.js +585 -0
  63. package/dist/core/archive.js.map +1 -0
  64. package/dist/core/artifact-graph/graph.d.ts +56 -0
  65. package/dist/core/artifact-graph/graph.d.ts.map +1 -0
  66. package/dist/core/artifact-graph/graph.js +141 -0
  67. package/dist/core/artifact-graph/graph.js.map +1 -0
  68. package/dist/core/artifact-graph/index.d.ts +9 -0
  69. package/dist/core/artifact-graph/index.d.ts.map +1 -0
  70. package/dist/core/artifact-graph/index.js +14 -0
  71. package/dist/core/artifact-graph/index.js.map +1 -0
  72. package/dist/core/artifact-graph/instruction-loader.d.ts +188 -0
  73. package/dist/core/artifact-graph/instruction-loader.d.ts.map +1 -0
  74. package/dist/core/artifact-graph/instruction-loader.js +243 -0
  75. package/dist/core/artifact-graph/instruction-loader.js.map +1 -0
  76. package/dist/core/artifact-graph/outputs.d.ts +14 -0
  77. package/dist/core/artifact-graph/outputs.d.ts.map +1 -0
  78. package/dist/core/artifact-graph/outputs.js +39 -0
  79. package/dist/core/artifact-graph/outputs.js.map +1 -0
  80. package/dist/core/artifact-graph/resolver.d.ts +81 -0
  81. package/dist/core/artifact-graph/resolver.d.ts.map +1 -0
  82. package/dist/core/artifact-graph/resolver.js +257 -0
  83. package/dist/core/artifact-graph/resolver.js.map +1 -0
  84. package/dist/core/artifact-graph/schema.d.ts +13 -0
  85. package/dist/core/artifact-graph/schema.d.ts.map +1 -0
  86. package/dist/core/artifact-graph/schema.js +108 -0
  87. package/dist/core/artifact-graph/schema.js.map +1 -0
  88. package/dist/core/artifact-graph/state.d.ts +12 -0
  89. package/dist/core/artifact-graph/state.d.ts.map +1 -0
  90. package/dist/core/artifact-graph/state.js +31 -0
  91. package/dist/core/artifact-graph/state.js.map +1 -0
  92. package/dist/core/artifact-graph/types.d.ts +55 -0
  93. package/dist/core/artifact-graph/types.d.ts.map +1 -0
  94. package/dist/core/artifact-graph/types.js +38 -0
  95. package/dist/core/artifact-graph/types.js.map +1 -0
  96. package/dist/core/available-tools.d.ts +17 -0
  97. package/dist/core/available-tools.d.ts.map +1 -0
  98. package/dist/core/available-tools.js +43 -0
  99. package/dist/core/available-tools.js.map +1 -0
  100. package/dist/core/change-metadata/index.d.ts +2 -0
  101. package/dist/core/change-metadata/index.d.ts.map +1 -0
  102. package/dist/core/change-metadata/index.js +2 -0
  103. package/dist/core/change-metadata/index.js.map +1 -0
  104. package/dist/core/change-metadata/schema.d.ts +12 -0
  105. package/dist/core/change-metadata/schema.d.ts.map +1 -0
  106. package/dist/core/change-metadata/schema.js +15 -0
  107. package/dist/core/change-metadata/schema.js.map +1 -0
  108. package/dist/core/change-presenter.d.ts +24 -0
  109. package/dist/core/change-presenter.d.ts.map +1 -0
  110. package/dist/core/change-presenter.js +135 -0
  111. package/dist/core/change-presenter.js.map +1 -0
  112. package/dist/core/change-status-policy.d.ts +35 -0
  113. package/dist/core/change-status-policy.d.ts.map +1 -0
  114. package/dist/core/change-status-policy.js +34 -0
  115. package/dist/core/change-status-policy.js.map +1 -0
  116. package/dist/core/command-generation/adapters/claude.d.ts +14 -0
  117. package/dist/core/command-generation/adapters/claude.d.ts.map +1 -0
  118. package/dist/core/command-generation/adapters/claude.js +38 -0
  119. package/dist/core/command-generation/adapters/claude.js.map +1 -0
  120. package/dist/core/command-generation/adapters/cursor.d.ts +14 -0
  121. package/dist/core/command-generation/adapters/cursor.d.ts.map +1 -0
  122. package/dist/core/command-generation/adapters/cursor.js +31 -0
  123. package/dist/core/command-generation/adapters/cursor.js.map +1 -0
  124. package/dist/core/command-generation/adapters/index.d.ts +8 -0
  125. package/dist/core/command-generation/adapters/index.d.ts.map +1 -0
  126. package/dist/core/command-generation/adapters/index.js +8 -0
  127. package/dist/core/command-generation/adapters/index.js.map +1 -0
  128. package/dist/core/command-generation/generator.d.ts +21 -0
  129. package/dist/core/command-generation/generator.d.ts.map +1 -0
  130. package/dist/core/command-generation/generator.js +27 -0
  131. package/dist/core/command-generation/generator.js.map +1 -0
  132. package/dist/core/command-generation/index.d.ts +22 -0
  133. package/dist/core/command-generation/index.d.ts.map +1 -0
  134. package/dist/core/command-generation/index.js +24 -0
  135. package/dist/core/command-generation/index.js.map +1 -0
  136. package/dist/core/command-generation/registry.d.ts +24 -0
  137. package/dist/core/command-generation/registry.d.ts.map +1 -0
  138. package/dist/core/command-generation/registry.js +38 -0
  139. package/dist/core/command-generation/registry.js.map +1 -0
  140. package/dist/core/command-generation/types.d.ts +56 -0
  141. package/dist/core/command-generation/types.d.ts.map +1 -0
  142. package/dist/core/command-generation/types.js +8 -0
  143. package/dist/core/command-generation/types.js.map +1 -0
  144. package/dist/core/command-generation/yaml.d.ts +22 -0
  145. package/dist/core/command-generation/yaml.d.ts.map +1 -0
  146. package/dist/core/command-generation/yaml.js +38 -0
  147. package/dist/core/command-generation/yaml.js.map +1 -0
  148. package/dist/core/config-prompts.d.ts +9 -0
  149. package/dist/core/config-prompts.d.ts.map +1 -0
  150. package/dist/core/config-prompts.js +34 -0
  151. package/dist/core/config-prompts.js.map +1 -0
  152. package/dist/core/config-schema.d.ts +87 -0
  153. package/dist/core/config-schema.d.ts.map +1 -0
  154. package/dist/core/config-schema.js +239 -0
  155. package/dist/core/config-schema.js.map +1 -0
  156. package/dist/core/config.d.ts +19 -0
  157. package/dist/core/config.d.ts.map +1 -0
  158. package/dist/core/config.js +14 -0
  159. package/dist/core/config.js.map +1 -0
  160. package/dist/core/converters/json-converter.d.ts +6 -0
  161. package/dist/core/converters/json-converter.d.ts.map +1 -0
  162. package/dist/core/converters/json-converter.js +51 -0
  163. package/dist/core/converters/json-converter.js.map +1 -0
  164. package/dist/core/dashboard-activity.d.ts +50 -0
  165. package/dist/core/dashboard-activity.d.ts.map +1 -0
  166. package/dist/core/dashboard-activity.js +147 -0
  167. package/dist/core/dashboard-activity.js.map +1 -0
  168. package/dist/core/dashboard-data.d.ts +100 -0
  169. package/dist/core/dashboard-data.d.ts.map +1 -0
  170. package/dist/core/dashboard-data.js +368 -0
  171. package/dist/core/dashboard-data.js.map +1 -0
  172. package/dist/core/global-config.d.ts +51 -0
  173. package/dist/core/global-config.d.ts.map +1 -0
  174. package/dist/core/global-config.js +124 -0
  175. package/dist/core/global-config.js.map +1 -0
  176. package/dist/core/id.d.ts +17 -0
  177. package/dist/core/id.d.ts.map +1 -0
  178. package/dist/core/id.js +30 -0
  179. package/dist/core/id.js.map +1 -0
  180. package/dist/core/init.d.ts +34 -0
  181. package/dist/core/init.d.ts.map +1 -0
  182. package/dist/core/init.js +495 -0
  183. package/dist/core/init.js.map +1 -0
  184. package/dist/core/list.d.ts +12 -0
  185. package/dist/core/list.d.ts.map +1 -0
  186. package/dist/core/list.js +192 -0
  187. package/dist/core/list.js.map +1 -0
  188. package/dist/core/migrate.d.ts +52 -0
  189. package/dist/core/migrate.d.ts.map +1 -0
  190. package/dist/core/migrate.js +300 -0
  191. package/dist/core/migrate.js.map +1 -0
  192. package/dist/core/parsers/change-parser.d.ts +19 -0
  193. package/dist/core/parsers/change-parser.d.ts.map +1 -0
  194. package/dist/core/parsers/change-parser.js +204 -0
  195. package/dist/core/parsers/change-parser.js.map +1 -0
  196. package/dist/core/parsers/markdown-parser.d.ts +29 -0
  197. package/dist/core/parsers/markdown-parser.d.ts.map +1 -0
  198. package/dist/core/parsers/markdown-parser.js +181 -0
  199. package/dist/core/parsers/markdown-parser.js.map +1 -0
  200. package/dist/core/parsers/requirement-blocks.d.ts +37 -0
  201. package/dist/core/parsers/requirement-blocks.d.ts.map +1 -0
  202. package/dist/core/parsers/requirement-blocks.js +201 -0
  203. package/dist/core/parsers/requirement-blocks.js.map +1 -0
  204. package/dist/core/parsers/requirement-text.d.ts +55 -0
  205. package/dist/core/parsers/requirement-text.d.ts.map +1 -0
  206. package/dist/core/parsers/requirement-text.js +136 -0
  207. package/dist/core/parsers/requirement-text.js.map +1 -0
  208. package/dist/core/parsers/spec-structure.d.ts +9 -0
  209. package/dist/core/parsers/spec-structure.d.ts.map +1 -0
  210. package/dist/core/parsers/spec-structure.js +88 -0
  211. package/dist/core/parsers/spec-structure.js.map +1 -0
  212. package/dist/core/planning-home.d.ts +16 -0
  213. package/dist/core/planning-home.d.ts.map +1 -0
  214. package/dist/core/planning-home.js +67 -0
  215. package/dist/core/planning-home.js.map +1 -0
  216. package/dist/core/profiles.d.ts +24 -0
  217. package/dist/core/profiles.d.ts.map +1 -0
  218. package/dist/core/profiles.js +27 -0
  219. package/dist/core/profiles.js.map +1 -0
  220. package/dist/core/project-config.d.ts +100 -0
  221. package/dist/core/project-config.d.ts.map +1 -0
  222. package/dist/core/project-config.js +389 -0
  223. package/dist/core/project-config.js.map +1 -0
  224. package/dist/core/references.d.ts +40 -0
  225. package/dist/core/references.d.ts.map +1 -0
  226. package/dist/core/references.js +11 -0
  227. package/dist/core/references.js.map +1 -0
  228. package/dist/core/root-selection.d.ts +57 -0
  229. package/dist/core/root-selection.d.ts.map +1 -0
  230. package/dist/core/root-selection.js +98 -0
  231. package/dist/core/root-selection.js.map +1 -0
  232. package/dist/core/schemas/base.schema.d.ts +13 -0
  233. package/dist/core/schemas/base.schema.d.ts.map +1 -0
  234. package/dist/core/schemas/base.schema.js +18 -0
  235. package/dist/core/schemas/base.schema.js.map +1 -0
  236. package/dist/core/schemas/change.schema.d.ts +73 -0
  237. package/dist/core/schemas/change.schema.d.ts.map +1 -0
  238. package/dist/core/schemas/change.schema.js +31 -0
  239. package/dist/core/schemas/change.schema.js.map +1 -0
  240. package/dist/core/schemas/index.d.ts +4 -0
  241. package/dist/core/schemas/index.d.ts.map +1 -0
  242. package/dist/core/schemas/index.js +4 -0
  243. package/dist/core/schemas/index.js.map +1 -0
  244. package/dist/core/schemas/spec.schema.d.ts +18 -0
  245. package/dist/core/schemas/spec.schema.d.ts.map +1 -0
  246. package/dist/core/schemas/spec.schema.js +15 -0
  247. package/dist/core/schemas/spec.schema.js.map +1 -0
  248. package/dist/core/shared/index.d.ts +8 -0
  249. package/dist/core/shared/index.d.ts.map +1 -0
  250. package/dist/core/shared/index.js +8 -0
  251. package/dist/core/shared/index.js.map +1 -0
  252. package/dist/core/shared/skill-generation.d.ts +63 -0
  253. package/dist/core/shared/skill-generation.d.ts.map +1 -0
  254. package/dist/core/shared/skill-generation.js +125 -0
  255. package/dist/core/shared/skill-generation.js.map +1 -0
  256. package/dist/core/shared/tool-detection.d.ts +96 -0
  257. package/dist/core/shared/tool-detection.d.ts.map +1 -0
  258. package/dist/core/shared/tool-detection.js +207 -0
  259. package/dist/core/shared/tool-detection.js.map +1 -0
  260. package/dist/core/spec-presenter.d.ts +17 -0
  261. package/dist/core/spec-presenter.d.ts.map +1 -0
  262. package/dist/core/spec-presenter.js +98 -0
  263. package/dist/core/spec-presenter.js.map +1 -0
  264. package/dist/core/specs-apply.d.ts +78 -0
  265. package/dist/core/specs-apply.d.ts.map +1 -0
  266. package/dist/core/specs-apply.js +429 -0
  267. package/dist/core/specs-apply.js.map +1 -0
  268. package/dist/core/templates/index.d.ts +8 -0
  269. package/dist/core/templates/index.d.ts.map +1 -0
  270. package/dist/core/templates/index.js +9 -0
  271. package/dist/core/templates/index.js.map +1 -0
  272. package/dist/core/templates/skill-templates.d.ts +14 -0
  273. package/dist/core/templates/skill-templates.d.ts.map +1 -0
  274. package/dist/core/templates/skill-templates.js +13 -0
  275. package/dist/core/templates/skill-templates.js.map +1 -0
  276. package/dist/core/templates/types.d.ts +20 -0
  277. package/dist/core/templates/types.d.ts.map +1 -0
  278. package/dist/core/templates/types.js +5 -0
  279. package/dist/core/templates/types.js.map +1 -0
  280. package/dist/core/templates/workflows/apply.d.ts +10 -0
  281. package/dist/core/templates/workflows/apply.d.ts.map +1 -0
  282. package/dist/core/templates/workflows/apply.js +81 -0
  283. package/dist/core/templates/workflows/apply.js.map +1 -0
  284. package/dist/core/templates/workflows/archive.d.ts +10 -0
  285. package/dist/core/templates/workflows/archive.d.ts.map +1 -0
  286. package/dist/core/templates/workflows/archive.js +75 -0
  287. package/dist/core/templates/workflows/archive.js.map +1 -0
  288. package/dist/core/templates/workflows/explore.d.ts +10 -0
  289. package/dist/core/templates/workflows/explore.d.ts.map +1 -0
  290. package/dist/core/templates/workflows/explore.js +75 -0
  291. package/dist/core/templates/workflows/explore.js.map +1 -0
  292. package/dist/core/templates/workflows/issue.d.ts +10 -0
  293. package/dist/core/templates/workflows/issue.d.ts.map +1 -0
  294. package/dist/core/templates/workflows/issue.js +89 -0
  295. package/dist/core/templates/workflows/issue.js.map +1 -0
  296. package/dist/core/templates/workflows/propose.d.ts +10 -0
  297. package/dist/core/templates/workflows/propose.d.ts.map +1 -0
  298. package/dist/core/templates/workflows/propose.js +77 -0
  299. package/dist/core/templates/workflows/propose.js.map +1 -0
  300. package/dist/core/templates/workflows/sync.d.ts +14 -0
  301. package/dist/core/templates/workflows/sync.d.ts.map +1 -0
  302. package/dist/core/templates/workflows/sync.js +86 -0
  303. package/dist/core/templates/workflows/sync.js.map +1 -0
  304. package/dist/core/templates/workflows/update.d.ts +10 -0
  305. package/dist/core/templates/workflows/update.d.ts.map +1 -0
  306. package/dist/core/templates/workflows/update.js +99 -0
  307. package/dist/core/templates/workflows/update.js.map +1 -0
  308. package/dist/core/templates/workflows/verify.d.ts +9 -0
  309. package/dist/core/templates/workflows/verify.d.ts.map +1 -0
  310. package/dist/core/templates/workflows/verify.js +44 -0
  311. package/dist/core/templates/workflows/verify.js.map +1 -0
  312. package/dist/core/update.d.ts +46 -0
  313. package/dist/core/update.d.ts.map +1 -0
  314. package/dist/core/update.js +296 -0
  315. package/dist/core/update.js.map +1 -0
  316. package/dist/core/validation/constants.d.ts +34 -0
  317. package/dist/core/validation/constants.d.ts.map +1 -0
  318. package/dist/core/validation/constants.js +40 -0
  319. package/dist/core/validation/constants.js.map +1 -0
  320. package/dist/core/validation/section-validator.d.ts +19 -0
  321. package/dist/core/validation/section-validator.d.ts.map +1 -0
  322. package/dist/core/validation/section-validator.js +59 -0
  323. package/dist/core/validation/section-validator.js.map +1 -0
  324. package/dist/core/validation/types.d.ts +18 -0
  325. package/dist/core/validation/types.d.ts.map +1 -0
  326. package/dist/core/validation/types.js +2 -0
  327. package/dist/core/validation/types.js.map +1 -0
  328. package/dist/core/validation/validator.d.ts +51 -0
  329. package/dist/core/validation/validator.d.ts.map +1 -0
  330. package/dist/core/validation/validator.js +469 -0
  331. package/dist/core/validation/validator.js.map +1 -0
  332. package/dist/index.d.ts +2 -0
  333. package/dist/index.d.ts.map +1 -0
  334. package/dist/index.js +2 -0
  335. package/dist/index.js.map +1 -0
  336. package/dist/prompts/searchable-multi-select.d.ts +28 -0
  337. package/dist/prompts/searchable-multi-select.d.ts.map +1 -0
  338. package/dist/prompts/searchable-multi-select.js +158 -0
  339. package/dist/prompts/searchable-multi-select.js.map +1 -0
  340. package/dist/ui/welcome-screen.d.ts +5 -0
  341. package/dist/ui/welcome-screen.d.ts.map +1 -0
  342. package/dist/ui/welcome-screen.js +22 -0
  343. package/dist/ui/welcome-screen.js.map +1 -0
  344. package/dist/utils/change-metadata.d.ts +55 -0
  345. package/dist/utils/change-metadata.d.ts.map +1 -0
  346. package/dist/utils/change-metadata.js +141 -0
  347. package/dist/utils/change-metadata.js.map +1 -0
  348. package/dist/utils/change-utils.d.ts +73 -0
  349. package/dist/utils/change-utils.d.ts.map +1 -0
  350. package/dist/utils/change-utils.js +194 -0
  351. package/dist/utils/change-utils.js.map +1 -0
  352. package/dist/utils/command-references.d.ts +18 -0
  353. package/dist/utils/command-references.d.ts.map +1 -0
  354. package/dist/utils/command-references.js +20 -0
  355. package/dist/utils/command-references.js.map +1 -0
  356. package/dist/utils/file-system.d.ts +41 -0
  357. package/dist/utils/file-system.d.ts.map +1 -0
  358. package/dist/utils/file-system.js +320 -0
  359. package/dist/utils/file-system.js.map +1 -0
  360. package/dist/utils/index.d.ts +6 -0
  361. package/dist/utils/index.d.ts.map +1 -0
  362. package/dist/utils/index.js +9 -0
  363. package/dist/utils/index.js.map +1 -0
  364. package/dist/utils/interactive.d.ts +18 -0
  365. package/dist/utils/interactive.d.ts.map +1 -0
  366. package/dist/utils/interactive.js +21 -0
  367. package/dist/utils/interactive.js.map +1 -0
  368. package/dist/utils/item-discovery.d.ts +14 -0
  369. package/dist/utils/item-discovery.d.ts.map +1 -0
  370. package/dist/utils/item-discovery.js +104 -0
  371. package/dist/utils/item-discovery.js.map +1 -0
  372. package/dist/utils/link.d.ts +22 -0
  373. package/dist/utils/link.d.ts.map +1 -0
  374. package/dist/utils/link.js +85 -0
  375. package/dist/utils/link.js.map +1 -0
  376. package/dist/utils/match.d.ts +3 -0
  377. package/dist/utils/match.d.ts.map +1 -0
  378. package/dist/utils/match.js +22 -0
  379. package/dist/utils/match.js.map +1 -0
  380. package/dist/utils/shell-detection.d.ts +20 -0
  381. package/dist/utils/shell-detection.d.ts.map +1 -0
  382. package/dist/utils/shell-detection.js +41 -0
  383. package/dist/utils/shell-detection.js.map +1 -0
  384. package/dist/utils/task-progress.d.ts +32 -0
  385. package/dist/utils/task-progress.d.ts.map +1 -0
  386. package/dist/utils/task-progress.js +129 -0
  387. package/dist/utils/task-progress.js.map +1 -0
  388. package/dist/utils/timestamp.d.ts +9 -0
  389. package/dist/utils/timestamp.d.ts.map +1 -0
  390. package/dist/utils/timestamp.js +18 -0
  391. package/dist/utils/timestamp.js.map +1 -0
  392. package/package.json +55 -0
  393. package/schemas/issue/schema.yaml +34 -0
  394. package/schemas/issue/templates/spec.md +13 -0
  395. package/schemas/issue/templates/task.md +21 -0
  396. package/schemas/issue/templates/ticket.md +2 -0
  397. package/schemas/sdd/schema.yaml +55 -0
  398. package/schemas/sdd/templates/design.md +15 -0
  399. package/schemas/sdd/templates/proposal.md +15 -0
  400. package/schemas/sdd/templates/spec.md +13 -0
  401. package/schemas/sdd/templates/tasks.md +11 -0
  402. package/schemas/sdd/templates/ticket.md +2 -0
@@ -0,0 +1,57 @@
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).
8
+ */
9
+ import { type PlanningHome } from './planning-home.js';
10
+ export type TospecRootSource = 'nearest' | 'implicit';
11
+ export interface ResolveTospecRootOptions {
12
+ startPath?: string;
13
+ allowImplicitRoot?: boolean;
14
+ globalDataDir?: string;
15
+ }
16
+ export interface ResolvedTospecRoot {
17
+ path: string;
18
+ changesDir: string;
19
+ specsDir: string;
20
+ archiveDir: string;
21
+ defaultSchema: 'sdd';
22
+ source: TospecRootSource;
23
+ }
24
+ export interface RootSelectionDiagnostic {
25
+ severity: 'error';
26
+ code: string;
27
+ message: string;
28
+ target?: string;
29
+ fix?: string;
30
+ }
31
+ export declare class RootSelectionError extends Error {
32
+ readonly diagnostic: RootSelectionDiagnostic;
33
+ constructor(message: string, code: string, options?: {
34
+ target?: string;
35
+ fix?: string;
36
+ });
37
+ }
38
+ export declare function isRootSelectionError(error: unknown): error is RootSelectionError;
39
+ export declare function resolveTospecRoot(options?: ResolveTospecRootOptions): Promise<ResolvedTospecRoot>;
40
+ export interface RootOutput {
41
+ path: string;
42
+ source: TospecRootSource;
43
+ }
44
+ export declare function toRootOutput(root: ResolvedTospecRoot): RootOutput;
45
+ /** Compatibility bridge for workflow code that expects a PlanningHome. */
46
+ export declare function toPlanningHome(root: ResolvedTospecRoot): PlanningHome;
47
+ /**
48
+ * CLI adapter shared by the supported commands. In JSON mode a resolution
49
+ * failure is reported as a machine-readable payload on stdout with a non-zero
50
+ * exit code; the caller must return when this resolves to null.
51
+ */
52
+ export declare function resolveRootForCommand(_selector: unknown, output?: {
53
+ json?: boolean;
54
+ failurePayload?: Record<string, unknown>;
55
+ allowImplicitRoot?: boolean;
56
+ }): Promise<ResolvedTospecRoot | null>;
57
+ //# sourceMappingURL=root-selection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root-selection.d.ts","sourceRoot":"","sources":["../../src/core/root-selection.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,EAA4B,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGjF,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,UAAU,CAAC;AAEtD,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;gBAG3C,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAO;CAWlD;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,kBAAkB,CAEhF;AAwBD,wBAAsB,iBAAiB,CACrC,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,kBAAkB,CAAC,CAgB7B;AAMD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,gBAAgB,CAAC;CAC1B;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,kBAAkB,GAAG,UAAU,CAKjE;AAED,0EAA0E;AAC1E,wBAAgB,cAAc,CAAC,IAAI,EAAE,kBAAkB,GAAG,YAAY,CAOrE;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CACzC,SAAS,EAAE,OAAO,EAClB,MAAM,GAAE;IACN,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CACxB,GACL,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAqBpC"}
@@ -0,0 +1,98 @@
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).
8
+ */
9
+ import * as fs from 'node:fs';
10
+ import * as path from 'node:path';
11
+ import { findRepoPlanningRootSync } from './planning-home.js';
12
+ import { FileSystemUtils } from '../utils/file-system.js';
13
+ export class RootSelectionError extends Error {
14
+ diagnostic;
15
+ constructor(message, code, options = {}) {
16
+ super(message);
17
+ this.name = 'RootSelectionError';
18
+ this.diagnostic = {
19
+ severity: 'error',
20
+ code,
21
+ message,
22
+ ...options,
23
+ };
24
+ }
25
+ }
26
+ export function isRootSelectionError(error) {
27
+ return error instanceof RootSelectionError;
28
+ }
29
+ function makeRoot(rootPath, source) {
30
+ return {
31
+ path: rootPath,
32
+ changesDir: path.join(rootPath, 'tospec', 'changes'),
33
+ specsDir: path.join(rootPath, 'tospec', 'specs'),
34
+ archiveDir: path.join(rootPath, 'tospec', 'changes', 'archive'),
35
+ defaultSchema: 'sdd',
36
+ source,
37
+ };
38
+ }
39
+ function canonicalDirectory(startPath) {
40
+ const resolved = path.resolve(startPath);
41
+ try {
42
+ const stats = fs.statSync(resolved);
43
+ const dir = stats.isDirectory() ? resolved : path.dirname(resolved);
44
+ return FileSystemUtils.canonicalizeExistingPath(dir);
45
+ }
46
+ catch {
47
+ return resolved;
48
+ }
49
+ }
50
+ export async function resolveTospecRoot(options = {}) {
51
+ const startPath = options.startPath ?? process.cwd();
52
+ const nearestRoot = findRepoPlanningRootSync(startPath);
53
+ if (nearestRoot) {
54
+ return makeRoot(nearestRoot, 'nearest');
55
+ }
56
+ if (options.allowImplicitRoot === false) {
57
+ throw new RootSelectionError('No tospec root found from the current directory.', 'no_tospec_root', { target: 'tospec.root', fix: 'Run tospec init to create a root here.' });
58
+ }
59
+ return makeRoot(canonicalDirectory(startPath), 'implicit');
60
+ }
61
+ export function toRootOutput(root) {
62
+ return {
63
+ path: root.path,
64
+ source: root.source,
65
+ };
66
+ }
67
+ /** Compatibility bridge for workflow code that expects a PlanningHome. */
68
+ export function toPlanningHome(root) {
69
+ return {
70
+ kind: 'repo',
71
+ root: root.path,
72
+ changesDir: root.changesDir,
73
+ defaultSchema: root.defaultSchema,
74
+ };
75
+ }
76
+ /**
77
+ * CLI adapter shared by the supported commands. In JSON mode a resolution
78
+ * failure is reported as a machine-readable payload on stdout with a non-zero
79
+ * exit code; the caller must return when this resolves to null.
80
+ */
81
+ export async function resolveRootForCommand(_selector, output = {}) {
82
+ try {
83
+ return await resolveTospecRoot({
84
+ ...(output.allowImplicitRoot !== undefined
85
+ ? { allowImplicitRoot: output.allowImplicitRoot }
86
+ : {}),
87
+ });
88
+ }
89
+ catch (error) {
90
+ if (output.json && isRootSelectionError(error)) {
91
+ console.log(JSON.stringify({ ...(output.failurePayload ?? {}), status: [error.diagnostic] }, null, 2));
92
+ process.exitCode = 1;
93
+ return null;
94
+ }
95
+ throw error;
96
+ }
97
+ }
98
+ //# sourceMappingURL=root-selection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root-selection.js","sourceRoot":"","sources":["../../src/core/root-selection.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,wBAAwB,EAAqB,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AA2B1D,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAClC,UAAU,CAA0B;IAE7C,YACE,OAAe,EACf,IAAY,EACZ,UAA6C,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,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IAAI,CAAC;QACd,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ export declare const ScenarioSchema: z.ZodObject<{
3
+ rawText: z.ZodString;
4
+ }, z.core.$strip>;
5
+ export declare const RequirementSchema: z.ZodObject<{
6
+ text: z.ZodString;
7
+ scenarios: z.ZodArray<z.ZodObject<{
8
+ rawText: z.ZodString;
9
+ }, z.core.$strip>>;
10
+ }, z.core.$strip>;
11
+ export type Scenario = z.infer<typeof ScenarioSchema>;
12
+ export type Requirement = z.infer<typeof RequirementSchema>;
13
+ //# sourceMappingURL=base.schema.d.ts.map
@@ -0,0 +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;;iBAEzB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;iBAW5B,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"}
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import { VALIDATION_MESSAGES } from '../validation/constants.js';
3
+ export const ScenarioSchema = z.object({
4
+ rawText: z.string().min(1, VALIDATION_MESSAGES.SCENARIO_EMPTY),
5
+ });
6
+ export const RequirementSchema = z.object({
7
+ // SHALL/MUST body-keyword enforcement lives in the imperative validator
8
+ // (Validator.applySpecRules), not here: the parser collapses the requirement
9
+ // header into `text`, so a Zod refine on `text` cannot tell "keyword in header
10
+ // only" from "keyword in body" and emits a misleading generic error. The
11
+ // validator recovers the header and emits the targeted hint for both the
12
+ // main-spec and change-delta paths (#1156).
13
+ text: z.string()
14
+ .min(1, VALIDATION_MESSAGES.REQUIREMENT_EMPTY),
15
+ scenarios: z.array(ScenarioSchema)
16
+ .min(1, VALIDATION_MESSAGES.REQUIREMENT_NO_SCENARIOS),
17
+ });
18
+ //# sourceMappingURL=base.schema.js.map
@@ -0,0 +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,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,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"}
@@ -0,0 +1,73 @@
1
+ import { z } from 'zod';
2
+ export declare const DeltaOperationType: z.ZodEnum<{
3
+ ADDED: "ADDED";
4
+ MODIFIED: "MODIFIED";
5
+ REMOVED: "REMOVED";
6
+ RENAMED: "RENAMED";
7
+ }>;
8
+ export declare const DeltaSchema: z.ZodObject<{
9
+ spec: z.ZodString;
10
+ operation: z.ZodEnum<{
11
+ ADDED: "ADDED";
12
+ MODIFIED: "MODIFIED";
13
+ REMOVED: "REMOVED";
14
+ RENAMED: "RENAMED";
15
+ }>;
16
+ description: z.ZodString;
17
+ requirement: z.ZodOptional<z.ZodObject<{
18
+ text: z.ZodString;
19
+ scenarios: z.ZodArray<z.ZodObject<{
20
+ rawText: z.ZodString;
21
+ }, z.core.$strip>>;
22
+ }, z.core.$strip>>;
23
+ requirements: z.ZodOptional<z.ZodArray<z.ZodObject<{
24
+ text: z.ZodString;
25
+ scenarios: z.ZodArray<z.ZodObject<{
26
+ rawText: z.ZodString;
27
+ }, z.core.$strip>>;
28
+ }, z.core.$strip>>>;
29
+ rename: z.ZodOptional<z.ZodObject<{
30
+ from: z.ZodString;
31
+ to: z.ZodString;
32
+ }, z.core.$strip>>;
33
+ }, z.core.$strip>;
34
+ export declare const ChangeSchema: z.ZodObject<{
35
+ name: z.ZodString;
36
+ why: z.ZodString;
37
+ whatChanges: z.ZodString;
38
+ deltas: z.ZodArray<z.ZodObject<{
39
+ spec: z.ZodString;
40
+ operation: z.ZodEnum<{
41
+ ADDED: "ADDED";
42
+ MODIFIED: "MODIFIED";
43
+ REMOVED: "REMOVED";
44
+ RENAMED: "RENAMED";
45
+ }>;
46
+ description: z.ZodString;
47
+ requirement: z.ZodOptional<z.ZodObject<{
48
+ text: z.ZodString;
49
+ scenarios: z.ZodArray<z.ZodObject<{
50
+ rawText: z.ZodString;
51
+ }, z.core.$strip>>;
52
+ }, z.core.$strip>>;
53
+ requirements: z.ZodOptional<z.ZodArray<z.ZodObject<{
54
+ text: z.ZodString;
55
+ scenarios: z.ZodArray<z.ZodObject<{
56
+ rawText: z.ZodString;
57
+ }, z.core.$strip>>;
58
+ }, z.core.$strip>>>;
59
+ rename: z.ZodOptional<z.ZodObject<{
60
+ from: z.ZodString;
61
+ to: z.ZodString;
62
+ }, z.core.$strip>>;
63
+ }, z.core.$strip>>;
64
+ metadata: z.ZodOptional<z.ZodObject<{
65
+ version: z.ZodDefault<z.ZodString>;
66
+ format: z.ZodLiteral<"tospec-change">;
67
+ sourcePath: z.ZodOptional<z.ZodString>;
68
+ }, z.core.$strip>>;
69
+ }, z.core.$strip>;
70
+ export type DeltaOperation = z.infer<typeof DeltaOperationType>;
71
+ export type Delta = z.infer<typeof DeltaSchema>;
72
+ export type Change = z.infer<typeof ChangeSchema>;
73
+ //# sourceMappingURL=change.schema.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,31 @@
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';
4
+ export const DeltaOperationType = z.enum(['ADDED', 'MODIFIED', 'REMOVED', 'RENAMED']);
5
+ export const DeltaSchema = z.object({
6
+ spec: z.string().min(1, VALIDATION_MESSAGES.DELTA_SPEC_EMPTY),
7
+ operation: DeltaOperationType,
8
+ description: z.string().min(1, VALIDATION_MESSAGES.DELTA_DESCRIPTION_EMPTY),
9
+ requirement: RequirementSchema.optional(),
10
+ requirements: z.array(RequirementSchema).optional(),
11
+ rename: z.object({
12
+ from: z.string(),
13
+ to: z.string(),
14
+ }).optional(),
15
+ });
16
+ export const ChangeSchema = z.object({
17
+ 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),
21
+ 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),
25
+ metadata: z.object({
26
+ version: z.string().default('1.0.0'),
27
+ format: z.literal('tospec-change'),
28
+ sourcePath: z.string().optional(),
29
+ }).optional(),
30
+ });
31
+ //# sourceMappingURL=change.schema.js.map
@@ -0,0 +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,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,mBAAmB,CAAC,gBAAgB,CAAC;IAC7D,SAAS,EAAE,kBAAkB;IAC7B,WAA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,CAAC,QAAQ,EAAE;CACd,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { ScenarioSchema, RequirementSchema, type Scenario, type Requirement, } from './base.schema.js';
2
+ export { SpecSchema, type Spec, } from './spec.schema.js';
3
+ export { DeltaOperationType, DeltaSchema, ChangeSchema, type DeltaOperation, type Delta, type Change, } from './change.schema.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,KAAK,QAAQ,EACb,KAAK,WAAW,GACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,UAAU,EACV,KAAK,IAAI,GACV,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,KAAK,cAAc,EACnB,KAAK,KAAK,EACV,KAAK,MAAM,GACZ,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { ScenarioSchema, RequirementSchema, } from './base.schema.js';
2
+ export { SpecSchema, } from './spec.schema.js';
3
+ export { DeltaOperationType, DeltaSchema, ChangeSchema, } from './change.schema.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,iBAAiB,GAGlB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,UAAU,GAEX,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,YAAY,GAIb,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ export declare const SpecSchema: z.ZodObject<{
3
+ name: z.ZodString;
4
+ overview: z.ZodString;
5
+ requirements: z.ZodArray<z.ZodObject<{
6
+ text: z.ZodString;
7
+ scenarios: z.ZodArray<z.ZodObject<{
8
+ rawText: z.ZodString;
9
+ }, z.core.$strip>>;
10
+ }, z.core.$strip>>;
11
+ metadata: z.ZodOptional<z.ZodObject<{
12
+ version: z.ZodDefault<z.ZodString>;
13
+ format: z.ZodLiteral<"tospec">;
14
+ sourcePath: z.ZodOptional<z.ZodString>;
15
+ }, z.core.$strip>>;
16
+ }, z.core.$strip>;
17
+ export type Spec = z.infer<typeof SpecSchema>;
18
+ //# sourceMappingURL=spec.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spec.schema.d.ts","sourceRoot":"","sources":["../../../src/core/schemas/spec.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;iBAUrB,CAAC;AAEH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ import { RequirementSchema } from './base.schema.js';
3
+ import { VALIDATION_MESSAGES } from '../validation/constants.js';
4
+ export const SpecSchema = z.object({
5
+ name: z.string().min(1, VALIDATION_MESSAGES.SPEC_NAME_EMPTY),
6
+ overview: z.string().min(1, VALIDATION_MESSAGES.SPEC_PURPOSE_EMPTY),
7
+ requirements: z.array(RequirementSchema)
8
+ .min(1, VALIDATION_MESSAGES.SPEC_NO_REQUIREMENTS),
9
+ metadata: z.object({
10
+ version: z.string().default('1.0.0'),
11
+ format: z.literal('tospec'),
12
+ sourcePath: z.string().optional(),
13
+ }).optional(),
14
+ });
15
+ //# sourceMappingURL=spec.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spec.schema.js","sourceRoot":"","sources":["../../../src/core/schemas/spec.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,mBAAmB,CAAC,eAAe,CAAC;IAC5D,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,mBAAmB,CAAC,kBAAkB,CAAC;IACnE,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC;SACrC,GAAG,CAAC,CAAC,EAAE,mBAAmB,CAAC,oBAAoB,CAAC;IACnD,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC;QACjB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;QACpC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;QAC3B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAClC,CAAC,CAAC,QAAQ,EAAE;CACd,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Shared Utilities
3
+ *
4
+ * Common code shared between init and update commands.
5
+ */
6
+ export { SKILL_NAMES, type SkillName, LEGACY_SKILL_DIRS, COMMAND_IDS, type CommandId, type ToolSkillStatus, type ToolVersionStatus, removeLegacySkillDirs, removeLegacyToolSkillLayout, getToolsWithSkillsDir, getToolSkillStatus, getToolStates, extractGeneratedByVersion, getToolVersionStatus, getConfiguredTools, getAllToolVersionStatus, } from './tool-detection.js';
7
+ export { type SkillTemplateEntry, type CommandTemplateEntry, getSkillTemplates, getCommandTemplates, getCommandContents, generateSkillContent, writeToolCommands, } from './skill-generation.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/shared/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,WAAW,EACX,KAAK,SAAS,EACd,iBAAiB,EACjB,WAAW,EACX,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,qBAAqB,EACrB,2BAA2B,EAC3B,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Shared Utilities
3
+ *
4
+ * Common code shared between init and update commands.
5
+ */
6
+ export { SKILL_NAMES, LEGACY_SKILL_DIRS, COMMAND_IDS, removeLegacySkillDirs, removeLegacyToolSkillLayout, getToolsWithSkillsDir, getToolSkillStatus, getToolStates, extractGeneratedByVersion, getToolVersionStatus, getConfiguredTools, getAllToolVersionStatus, } from './tool-detection.js';
7
+ export { getSkillTemplates, getCommandTemplates, getCommandContents, generateSkillContent, writeToolCommands, } from './skill-generation.js';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/shared/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,WAAW,EAEX,iBAAiB,EACjB,WAAW,EAIX,qBAAqB,EACrB,2BAA2B,EAC3B,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAGL,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Skill Generation Utilities
3
+ *
4
+ * Shared utilities for generating skill and command files.
5
+ */
6
+ import { getTospecExploreCommandTemplate, type SkillTemplate } from '../templates/skill-templates.js';
7
+ import { type CommandContent } from '../command-generation/index.js';
8
+ /**
9
+ * Skill template with directory name and workflow ID mapping.
10
+ */
11
+ export interface SkillTemplateEntry {
12
+ template: SkillTemplate;
13
+ dirName: string;
14
+ workflowId: string;
15
+ }
16
+ /**
17
+ * Command template with ID mapping.
18
+ */
19
+ export interface CommandTemplateEntry {
20
+ template: ReturnType<typeof getTospecExploreCommandTemplate>;
21
+ id: string;
22
+ }
23
+ /**
24
+ * Gets skill templates with their directory names, optionally filtered by workflow IDs.
25
+ *
26
+ * @param workflowFilter - If provided, only return templates whose workflowId is in this array
27
+ */
28
+ export declare function getSkillTemplates(workflowFilter?: readonly string[]): SkillTemplateEntry[];
29
+ /**
30
+ * Gets command templates with their IDs, optionally filtered by workflow IDs.
31
+ *
32
+ * @param workflowFilter - If provided, only return templates whose id is in this array
33
+ */
34
+ export declare function getCommandTemplates(workflowFilter?: readonly string[]): CommandTemplateEntry[];
35
+ /**
36
+ * Converts command templates to CommandContent array, optionally filtered by workflow IDs.
37
+ *
38
+ * @param workflowFilter - If provided, only return contents whose id is in this array
39
+ */
40
+ export declare function getCommandContents(workflowFilter?: readonly string[]): CommandContent[];
41
+ /**
42
+ * Generates skill file content with YAML frontmatter.
43
+ *
44
+ * @param template - The skill template
45
+ * @param generatedByVersion - The Tospec version to embed in the file
46
+ * @param transformInstructions - Optional callback to transform the instructions content
47
+ */
48
+ export declare function generateSkillContent(template: SkillTemplate, generatedByVersion: string, transformInstructions?: (instructions: string) => string): string;
49
+ /**
50
+ * Writes slash-command files for a tool that has a registered command adapter
51
+ * (Claude Code writes `.claude/commands/tosx/<id>.md`, invocable as
52
+ * `/tosx:<id>`). No-op for tools without an adapter (e.g. codex).
53
+ *
54
+ * Refreshes the tospec command directory first so deselected or renamed
55
+ * commands don't linger. Only removes a tospec-specific command dir, never a
56
+ * shared `commands/` directory.
57
+ *
58
+ * @param projectPath - Project root
59
+ * @param toolValue - Tool id (e.g. 'claude')
60
+ * @param workflowFilter - If provided, only these workflow ids get commands
61
+ */
62
+ export declare function writeToolCommands(projectPath: string, toolValue: string, workflowFilter?: readonly string[]): Promise<void>;
63
+ //# sourceMappingURL=skill-generation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-generation.d.ts","sourceRoot":"","sources":["../../../src/core/shared/skill-generation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAQL,+BAA+B,EAO/B,KAAK,aAAa,EACnB,MAAM,iCAAiC,CAAC;AAIzC,OAAO,EACL,KAAK,cAAc,EAGpB,MAAM,gCAAgC,CAAC;AAGxC;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,aAAa,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,UAAU,CAAC,OAAO,+BAA+B,CAAC,CAAC;IAC7D,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,kBAAkB,EAAE,CAe1F;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,oBAAoB,EAAE,CAe9F;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,cAAc,EAAE,CAUvF;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,aAAa,EACvB,kBAAkB,EAAE,MAAM,EAC1B,qBAAqB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM,GACvD,MAAM,CAsBR;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,iBAAiB,CACrC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,GACjC,OAAO,CAAC,IAAI,CAAC,CAgBf"}
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Skill Generation Utilities
3
+ *
4
+ * Shared utilities for generating skill and command files.
5
+ */
6
+ import { getExploreSkillTemplate, getTospecProposeSkillTemplate, getTospecIssueSkillTemplate, getTospecUpdateSkillTemplate, getTospecApplySkillTemplate, getTospecSyncSkillTemplate, getTospecArchiveSkillTemplate, getTospecExploreCommandTemplate, getTospecProposeCommandTemplate, getTospecIssueCommandTemplate, getTospecUpdateCommandTemplate, getTospecApplyCommandTemplate, getTospecSyncCommandTemplate, getTospecArchiveCommandTemplate, } from '../templates/skill-templates.js';
7
+ import path from 'path';
8
+ import { promises as fs } from 'fs';
9
+ import { FileSystemUtils } from '../../utils/file-system.js';
10
+ import { CommandAdapterRegistry, generateCommands, } from '../command-generation/index.js';
11
+ import { escapeYamlValue } from '../command-generation/yaml.js';
12
+ /**
13
+ * Gets skill templates with their directory names, optionally filtered by workflow IDs.
14
+ *
15
+ * @param workflowFilter - If provided, only return templates whose workflowId is in this array
16
+ */
17
+ export function getSkillTemplates(workflowFilter) {
18
+ const all = [
19
+ { template: getExploreSkillTemplate(), dirName: 'tospec-explore', workflowId: 'explore' },
20
+ { template: getTospecProposeSkillTemplate(), dirName: 'tospec-propose', workflowId: 'propose' },
21
+ { template: getTospecIssueSkillTemplate(), dirName: 'tospec-issue', workflowId: 'issue' },
22
+ { template: getTospecUpdateSkillTemplate(), dirName: 'tospec-update', workflowId: 'update' },
23
+ { template: getTospecApplySkillTemplate(), dirName: 'tospec-apply', workflowId: 'apply' },
24
+ { template: getTospecSyncSkillTemplate(), dirName: 'tospec-sync', workflowId: 'sync' },
25
+ { template: getTospecArchiveSkillTemplate(), dirName: 'tospec-archive', workflowId: 'archive' },
26
+ ];
27
+ if (!workflowFilter)
28
+ return all;
29
+ const filterSet = new Set(workflowFilter);
30
+ return all.filter(entry => filterSet.has(entry.workflowId));
31
+ }
32
+ /**
33
+ * Gets command templates with their IDs, optionally filtered by workflow IDs.
34
+ *
35
+ * @param workflowFilter - If provided, only return templates whose id is in this array
36
+ */
37
+ export function getCommandTemplates(workflowFilter) {
38
+ const all = [
39
+ { template: getTospecExploreCommandTemplate(), id: 'explore' },
40
+ { template: getTospecProposeCommandTemplate(), id: 'propose' },
41
+ { template: getTospecIssueCommandTemplate(), id: 'issue' },
42
+ { template: getTospecUpdateCommandTemplate(), id: 'update' },
43
+ { template: getTospecApplyCommandTemplate(), id: 'apply' },
44
+ { template: getTospecSyncCommandTemplate(), id: 'sync' },
45
+ { template: getTospecArchiveCommandTemplate(), id: 'archive' },
46
+ ];
47
+ if (!workflowFilter)
48
+ return all;
49
+ const filterSet = new Set(workflowFilter);
50
+ return all.filter(entry => filterSet.has(entry.id));
51
+ }
52
+ /**
53
+ * Converts command templates to CommandContent array, optionally filtered by workflow IDs.
54
+ *
55
+ * @param workflowFilter - If provided, only return contents whose id is in this array
56
+ */
57
+ export function getCommandContents(workflowFilter) {
58
+ const commandTemplates = getCommandTemplates(workflowFilter);
59
+ return commandTemplates.map(({ template, id }) => ({
60
+ id,
61
+ name: template.name,
62
+ description: template.description,
63
+ category: template.category,
64
+ tags: template.tags,
65
+ body: template.content,
66
+ }));
67
+ }
68
+ /**
69
+ * Generates skill file content with YAML frontmatter.
70
+ *
71
+ * @param template - The skill template
72
+ * @param generatedByVersion - The Tospec version to embed in the file
73
+ * @param transformInstructions - Optional callback to transform the instructions content
74
+ */
75
+ export function generateSkillContent(template, generatedByVersion, transformInstructions) {
76
+ const instructions = transformInstructions
77
+ ? transformInstructions(template.instructions)
78
+ : template.instructions;
79
+ const allowedToolsLine = template.allowedTools?.length
80
+ ? `allowed-tools: ${escapeYamlValue(template.allowedTools.join(', '))}\n`
81
+ : '';
82
+ return `---
83
+ name: ${escapeYamlValue(template.name)}
84
+ description: ${escapeYamlValue(template.description)}
85
+ license: ${escapeYamlValue(template.license || 'MIT')}
86
+ compatibility: ${escapeYamlValue(template.compatibility || 'Requires tospec CLI.')}
87
+ ${allowedToolsLine}metadata:
88
+ author: ${escapeYamlValue(template.metadata?.author || 'tospec')}
89
+ version: "${template.metadata?.version || '1.0'}"
90
+ generatedBy: "${generatedByVersion}"
91
+ ---
92
+
93
+ ${instructions}
94
+ `;
95
+ }
96
+ /**
97
+ * Writes slash-command files for a tool that has a registered command adapter
98
+ * (Claude Code writes `.claude/commands/tosx/<id>.md`, invocable as
99
+ * `/tosx:<id>`). No-op for tools without an adapter (e.g. codex).
100
+ *
101
+ * Refreshes the tospec command directory first so deselected or renamed
102
+ * commands don't linger. Only removes a tospec-specific command dir, never a
103
+ * shared `commands/` directory.
104
+ *
105
+ * @param projectPath - Project root
106
+ * @param toolValue - Tool id (e.g. 'claude')
107
+ * @param workflowFilter - If provided, only these workflow ids get commands
108
+ */
109
+ export async function writeToolCommands(projectPath, toolValue, workflowFilter) {
110
+ const adapter = CommandAdapterRegistry.get(toolValue);
111
+ if (!adapter)
112
+ return;
113
+ // Refresh a tospec-owned namespace sub-dir (e.g. .claude/commands/tosx), but
114
+ // never a shared `commands/` dir (a flat adapter would put files directly
115
+ // there alongside unrelated commands).
116
+ const commandBaseDir = path.dirname(adapter.getFilePath('_probe'));
117
+ if (path.basename(commandBaseDir) !== 'commands') {
118
+ await fs.rm(path.join(projectPath, commandBaseDir), { recursive: true, force: true });
119
+ }
120
+ const commands = generateCommands(getCommandContents(workflowFilter), adapter);
121
+ for (const command of commands) {
122
+ await FileSystemUtils.writeFile(path.join(projectPath, command.path), command.fileContent);
123
+ }
124
+ }
125
+ //# sourceMappingURL=skill-generation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-generation.js","sourceRoot":"","sources":["../../../src/core/sh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