wingfoil 0.2.1

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 (339) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +334 -0
  3. package/dist/cli/error.d.ts +11 -0
  4. package/dist/cli/error.d.ts.map +1 -0
  5. package/dist/cli/error.js +27 -0
  6. package/dist/cli/error.js.map +1 -0
  7. package/dist/cli/exit.d.ts +19 -0
  8. package/dist/cli/exit.d.ts.map +1 -0
  9. package/dist/cli/exit.js +14 -0
  10. package/dist/cli/exit.js.map +1 -0
  11. package/dist/cli/index.d.ts +28 -0
  12. package/dist/cli/index.d.ts.map +1 -0
  13. package/dist/cli/index.js +36 -0
  14. package/dist/cli/index.js.map +1 -0
  15. package/dist/cli/init-command.d.ts +34 -0
  16. package/dist/cli/init-command.d.ts.map +1 -0
  17. package/dist/cli/init-command.js +100 -0
  18. package/dist/cli/init-command.js.map +1 -0
  19. package/dist/cli/mcp-command.d.ts +24 -0
  20. package/dist/cli/mcp-command.d.ts.map +1 -0
  21. package/dist/cli/mcp-command.js +42 -0
  22. package/dist/cli/mcp-command.js.map +1 -0
  23. package/dist/cli/output.d.ts +13 -0
  24. package/dist/cli/output.d.ts.map +1 -0
  25. package/dist/cli/output.js +28 -0
  26. package/dist/cli/output.js.map +1 -0
  27. package/dist/cli/program.d.ts +12 -0
  28. package/dist/cli/program.d.ts.map +1 -0
  29. package/dist/cli/program.js +279 -0
  30. package/dist/cli/program.js.map +1 -0
  31. package/dist/cli/registrar.d.ts +69 -0
  32. package/dist/cli/registrar.d.ts.map +1 -0
  33. package/dist/cli/registrar.js +82 -0
  34. package/dist/cli/registrar.js.map +1 -0
  35. package/dist/cli.d.ts +3 -0
  36. package/dist/cli.d.ts.map +1 -0
  37. package/dist/cli.js +45 -0
  38. package/dist/cli.js.map +1 -0
  39. package/dist/core/approval-authority.d.ts +83 -0
  40. package/dist/core/approval-authority.d.ts.map +1 -0
  41. package/dist/core/approval-authority.js +112 -0
  42. package/dist/core/approval-authority.js.map +1 -0
  43. package/dist/core/builtin-asset.d.ts +71 -0
  44. package/dist/core/builtin-asset.d.ts.map +1 -0
  45. package/dist/core/builtin-asset.js +137 -0
  46. package/dist/core/builtin-asset.js.map +1 -0
  47. package/dist/core/builtin-integrity.d.ts +32 -0
  48. package/dist/core/builtin-integrity.d.ts.map +1 -0
  49. package/dist/core/builtin-integrity.js +148 -0
  50. package/dist/core/builtin-integrity.js.map +1 -0
  51. package/dist/core/confinement.d.ts +57 -0
  52. package/dist/core/confinement.d.ts.map +1 -0
  53. package/dist/core/confinement.js +108 -0
  54. package/dist/core/confinement.js.map +1 -0
  55. package/dist/core/context.d.ts +187 -0
  56. package/dist/core/context.d.ts.map +1 -0
  57. package/dist/core/context.js +192 -0
  58. package/dist/core/context.js.map +1 -0
  59. package/dist/core/directive-assign.d.ts +131 -0
  60. package/dist/core/directive-assign.d.ts.map +1 -0
  61. package/dist/core/directive-assign.js +352 -0
  62. package/dist/core/directive-assign.js.map +1 -0
  63. package/dist/core/directives-list.d.ts +80 -0
  64. package/dist/core/directives-list.d.ts.map +1 -0
  65. package/dist/core/directives-list.js +148 -0
  66. package/dist/core/directives-list.js.map +1 -0
  67. package/dist/core/exit-code.d.ts +85 -0
  68. package/dist/core/exit-code.d.ts.map +1 -0
  69. package/dist/core/exit-code.js +163 -0
  70. package/dist/core/exit-code.js.map +1 -0
  71. package/dist/core/git-identity.d.ts +32 -0
  72. package/dist/core/git-identity.d.ts.map +1 -0
  73. package/dist/core/git-identity.js +72 -0
  74. package/dist/core/git-identity.js.map +1 -0
  75. package/dist/core/index.d.ts +388 -0
  76. package/dist/core/index.d.ts.map +1 -0
  77. package/dist/core/index.js +1331 -0
  78. package/dist/core/index.js.map +1 -0
  79. package/dist/core/init.d.ts +78 -0
  80. package/dist/core/init.d.ts.map +1 -0
  81. package/dist/core/init.js +167 -0
  82. package/dist/core/init.js.map +1 -0
  83. package/dist/core/loaders.d.ts +174 -0
  84. package/dist/core/loaders.d.ts.map +1 -0
  85. package/dist/core/loaders.js +364 -0
  86. package/dist/core/loaders.js.map +1 -0
  87. package/dist/core/memory-add-type.d.ts +43 -0
  88. package/dist/core/memory-add-type.d.ts.map +1 -0
  89. package/dist/core/memory-add-type.js +151 -0
  90. package/dist/core/memory-add-type.js.map +1 -0
  91. package/dist/core/memory-transition.d.ts +111 -0
  92. package/dist/core/memory-transition.d.ts.map +1 -0
  93. package/dist/core/memory-transition.js +269 -0
  94. package/dist/core/memory-transition.js.map +1 -0
  95. package/dist/core/registry.d.ts +189 -0
  96. package/dist/core/registry.d.ts.map +1 -0
  97. package/dist/core/registry.js +66 -0
  98. package/dist/core/registry.js.map +1 -0
  99. package/dist/core/relevance.d.ts +86 -0
  100. package/dist/core/relevance.d.ts.map +1 -0
  101. package/dist/core/relevance.js +258 -0
  102. package/dist/core/relevance.js.map +1 -0
  103. package/dist/core/require-reason.d.ts +27 -0
  104. package/dist/core/require-reason.d.ts.map +1 -0
  105. package/dist/core/require-reason.js +95 -0
  106. package/dist/core/require-reason.js.map +1 -0
  107. package/dist/core/types.d.ts +45 -0
  108. package/dist/core/types.d.ts.map +1 -0
  109. package/dist/core/types.js +22 -0
  110. package/dist/core/types.js.map +1 -0
  111. package/dist/core/usage-error.d.ts +20 -0
  112. package/dist/core/usage-error.d.ts.map +1 -0
  113. package/dist/core/usage-error.js +29 -0
  114. package/dist/core/usage-error.js.map +1 -0
  115. package/dist/core/write-guard.d.ts +99 -0
  116. package/dist/core/write-guard.d.ts.map +1 -0
  117. package/dist/core/write-guard.js +247 -0
  118. package/dist/core/write-guard.js.map +1 -0
  119. package/dist/directives/create.d.ts +47 -0
  120. package/dist/directives/create.d.ts.map +1 -0
  121. package/dist/directives/create.js +82 -0
  122. package/dist/directives/create.js.map +1 -0
  123. package/dist/directives/index.d.ts +20 -0
  124. package/dist/directives/index.d.ts.map +1 -0
  125. package/dist/directives/index.js +32 -0
  126. package/dist/directives/index.js.map +1 -0
  127. package/dist/directives/roles-edit.d.ts +53 -0
  128. package/dist/directives/roles-edit.d.ts.map +1 -0
  129. package/dist/directives/roles-edit.js +286 -0
  130. package/dist/directives/roles-edit.js.map +1 -0
  131. package/dist/directives/schema.d.ts +65 -0
  132. package/dist/directives/schema.d.ts.map +1 -0
  133. package/dist/directives/schema.js +68 -0
  134. package/dist/directives/schema.js.map +1 -0
  135. package/dist/dna/edit.d.ts +61 -0
  136. package/dist/dna/edit.d.ts.map +1 -0
  137. package/dist/dna/edit.js +429 -0
  138. package/dist/dna/edit.js.map +1 -0
  139. package/dist/dna/index.d.ts +24 -0
  140. package/dist/dna/index.d.ts.map +1 -0
  141. package/dist/dna/index.js +59 -0
  142. package/dist/dna/index.js.map +1 -0
  143. package/dist/dna/mutate.d.ts +74 -0
  144. package/dist/dna/mutate.d.ts.map +1 -0
  145. package/dist/dna/mutate.js +318 -0
  146. package/dist/dna/mutate.js.map +1 -0
  147. package/dist/dna/path.d.ts +175 -0
  148. package/dist/dna/path.d.ts.map +1 -0
  149. package/dist/dna/path.js +289 -0
  150. package/dist/dna/path.js.map +1 -0
  151. package/dist/dna/roles.d.ts +57 -0
  152. package/dist/dna/roles.d.ts.map +1 -0
  153. package/dist/dna/roles.js +50 -0
  154. package/dist/dna/roles.js.map +1 -0
  155. package/dist/dna/schema.d.ts +172 -0
  156. package/dist/dna/schema.d.ts.map +1 -0
  157. package/dist/dna/schema.js +182 -0
  158. package/dist/dna/schema.js.map +1 -0
  159. package/dist/dna/set.d.ts +145 -0
  160. package/dist/dna/set.d.ts.map +1 -0
  161. package/dist/dna/set.js +428 -0
  162. package/dist/dna/set.js.map +1 -0
  163. package/dist/mcp/dna-resource.d.ts +16 -0
  164. package/dist/mcp/dna-resource.d.ts.map +1 -0
  165. package/dist/mcp/dna-resource.js +56 -0
  166. package/dist/mcp/dna-resource.js.map +1 -0
  167. package/dist/mcp/index.d.ts +49 -0
  168. package/dist/mcp/index.d.ts.map +1 -0
  169. package/dist/mcp/index.js +60 -0
  170. package/dist/mcp/index.js.map +1 -0
  171. package/dist/mcp/memory-resource.d.ts +17 -0
  172. package/dist/mcp/memory-resource.d.ts.map +1 -0
  173. package/dist/mcp/memory-resource.js +133 -0
  174. package/dist/mcp/memory-resource.js.map +1 -0
  175. package/dist/mcp/prompt.d.ts +48 -0
  176. package/dist/mcp/prompt.d.ts.map +1 -0
  177. package/dist/mcp/prompt.js +176 -0
  178. package/dist/mcp/prompt.js.map +1 -0
  179. package/dist/mcp/read-only.d.ts +42 -0
  180. package/dist/mcp/read-only.d.ts.map +1 -0
  181. package/dist/mcp/read-only.js +93 -0
  182. package/dist/mcp/read-only.js.map +1 -0
  183. package/dist/mcp/registrar.d.ts +54 -0
  184. package/dist/mcp/registrar.d.ts.map +1 -0
  185. package/dist/mcp/registrar.js +72 -0
  186. package/dist/mcp/registrar.js.map +1 -0
  187. package/dist/mcp/server.d.ts +58 -0
  188. package/dist/mcp/server.d.ts.map +1 -0
  189. package/dist/mcp/server.js +64 -0
  190. package/dist/mcp/server.js.map +1 -0
  191. package/dist/mcp/workflow-resource.d.ts +17 -0
  192. package/dist/mcp/workflow-resource.d.ts.map +1 -0
  193. package/dist/mcp/workflow-resource.js +63 -0
  194. package/dist/mcp/workflow-resource.js.map +1 -0
  195. package/dist/memory/add.d.ts +50 -0
  196. package/dist/memory/add.d.ts.map +1 -0
  197. package/dist/memory/add.js +131 -0
  198. package/dist/memory/add.js.map +1 -0
  199. package/dist/memory/audit.d.ts +177 -0
  200. package/dist/memory/audit.d.ts.map +1 -0
  201. package/dist/memory/audit.js +287 -0
  202. package/dist/memory/audit.js.map +1 -0
  203. package/dist/memory/commit-message.d.ts +146 -0
  204. package/dist/memory/commit-message.d.ts.map +1 -0
  205. package/dist/memory/commit-message.js +203 -0
  206. package/dist/memory/commit-message.js.map +1 -0
  207. package/dist/memory/entry.d.ts +56 -0
  208. package/dist/memory/entry.d.ts.map +1 -0
  209. package/dist/memory/entry.js +28 -0
  210. package/dist/memory/entry.js.map +1 -0
  211. package/dist/memory/frontmatter-edit.d.ts +68 -0
  212. package/dist/memory/frontmatter-edit.d.ts.map +1 -0
  213. package/dist/memory/frontmatter-edit.js +333 -0
  214. package/dist/memory/frontmatter-edit.js.map +1 -0
  215. package/dist/memory/git-log.d.ts +32 -0
  216. package/dist/memory/git-log.d.ts.map +1 -0
  217. package/dist/memory/git-log.js +100 -0
  218. package/dist/memory/git-log.js.map +1 -0
  219. package/dist/memory/history.d.ts +142 -0
  220. package/dist/memory/history.d.ts.map +1 -0
  221. package/dist/memory/history.js +250 -0
  222. package/dist/memory/history.js.map +1 -0
  223. package/dist/memory/index.d.ts +58 -0
  224. package/dist/memory/index.d.ts.map +1 -0
  225. package/dist/memory/index.js +107 -0
  226. package/dist/memory/index.js.map +1 -0
  227. package/dist/memory/query.d.ts +150 -0
  228. package/dist/memory/query.d.ts.map +1 -0
  229. package/dist/memory/query.js +307 -0
  230. package/dist/memory/query.js.map +1 -0
  231. package/dist/memory/reject.d.ts +11 -0
  232. package/dist/memory/reject.d.ts.map +1 -0
  233. package/dist/memory/reject.js +32 -0
  234. package/dist/memory/reject.js.map +1 -0
  235. package/dist/memory/schema.d.ts +104 -0
  236. package/dist/memory/schema.d.ts.map +1 -0
  237. package/dist/memory/schema.js +161 -0
  238. package/dist/memory/schema.js.map +1 -0
  239. package/dist/memory/state-machine.d.ts +166 -0
  240. package/dist/memory/state-machine.d.ts.map +1 -0
  241. package/dist/memory/state-machine.js +431 -0
  242. package/dist/memory/state-machine.js.map +1 -0
  243. package/dist/memory/submit.d.ts +11 -0
  244. package/dist/memory/submit.d.ts.map +1 -0
  245. package/dist/memory/submit.js +44 -0
  246. package/dist/memory/submit.js.map +1 -0
  247. package/dist/storage/builtin-directives.d.ts +54 -0
  248. package/dist/storage/builtin-directives.d.ts.map +1 -0
  249. package/dist/storage/builtin-directives.js +152 -0
  250. package/dist/storage/builtin-directives.js.map +1 -0
  251. package/dist/storage/commit.d.ts +92 -0
  252. package/dist/storage/commit.d.ts.map +1 -0
  253. package/dist/storage/commit.js +201 -0
  254. package/dist/storage/commit.js.map +1 -0
  255. package/dist/storage/confinement.d.ts +93 -0
  256. package/dist/storage/confinement.d.ts.map +1 -0
  257. package/dist/storage/confinement.js +164 -0
  258. package/dist/storage/confinement.js.map +1 -0
  259. package/dist/storage/document.d.ts +27 -0
  260. package/dist/storage/document.d.ts.map +1 -0
  261. package/dist/storage/document.js +52 -0
  262. package/dist/storage/document.js.map +1 -0
  263. package/dist/storage/errors.d.ts +36 -0
  264. package/dist/storage/errors.d.ts.map +1 -0
  265. package/dist/storage/errors.js +46 -0
  266. package/dist/storage/errors.js.map +1 -0
  267. package/dist/storage/frontmatter.d.ts +27 -0
  268. package/dist/storage/frontmatter.d.ts.map +1 -0
  269. package/dist/storage/frontmatter.js +37 -0
  270. package/dist/storage/frontmatter.js.map +1 -0
  271. package/dist/storage/git-root.d.ts +17 -0
  272. package/dist/storage/git-root.d.ts.map +1 -0
  273. package/dist/storage/git-root.js +49 -0
  274. package/dist/storage/git-root.js.map +1 -0
  275. package/dist/storage/index.d.ts +29 -0
  276. package/dist/storage/index.d.ts.map +1 -0
  277. package/dist/storage/index.js +66 -0
  278. package/dist/storage/index.js.map +1 -0
  279. package/dist/storage/init-state.d.ts +9 -0
  280. package/dist/storage/init-state.d.ts.map +1 -0
  281. package/dist/storage/init-state.js +24 -0
  282. package/dist/storage/init-state.js.map +1 -0
  283. package/dist/storage/layout.d.ts +51 -0
  284. package/dist/storage/layout.d.ts.map +1 -0
  285. package/dist/storage/layout.js +88 -0
  286. package/dist/storage/layout.js.map +1 -0
  287. package/dist/storage/memory-path.d.ts +72 -0
  288. package/dist/storage/memory-path.d.ts.map +1 -0
  289. package/dist/storage/memory-path.js +127 -0
  290. package/dist/storage/memory-path.js.map +1 -0
  291. package/dist/storage/snapshot.d.ts +16 -0
  292. package/dist/storage/snapshot.d.ts.map +1 -0
  293. package/dist/storage/snapshot.js +72 -0
  294. package/dist/storage/snapshot.js.map +1 -0
  295. package/dist/storage/templates.d.ts +88 -0
  296. package/dist/storage/templates.d.ts.map +1 -0
  297. package/dist/storage/templates.js +422 -0
  298. package/dist/storage/templates.js.map +1 -0
  299. package/dist/validation/error-mapper.d.ts +16 -0
  300. package/dist/validation/error-mapper.d.ts.map +1 -0
  301. package/dist/validation/error-mapper.js +18 -0
  302. package/dist/validation/error-mapper.js.map +1 -0
  303. package/dist/validation/errors.d.ts +69 -0
  304. package/dist/validation/errors.d.ts.map +1 -0
  305. package/dist/validation/errors.js +69 -0
  306. package/dist/validation/errors.js.map +1 -0
  307. package/dist/validation/id.d.ts +16 -0
  308. package/dist/validation/id.d.ts.map +1 -0
  309. package/dist/validation/id.js +177 -0
  310. package/dist/validation/id.js.map +1 -0
  311. package/dist/validation/index.d.ts +18 -0
  312. package/dist/validation/index.d.ts.map +1 -0
  313. package/dist/validation/index.js +37 -0
  314. package/dist/validation/index.js.map +1 -0
  315. package/dist/validation/secret-scan.d.ts +129 -0
  316. package/dist/validation/secret-scan.d.ts.map +1 -0
  317. package/dist/validation/secret-scan.js +367 -0
  318. package/dist/validation/secret-scan.js.map +1 -0
  319. package/dist/validation/two-pass.d.ts +24 -0
  320. package/dist/validation/two-pass.d.ts.map +1 -0
  321. package/dist/validation/two-pass.js +24 -0
  322. package/dist/validation/two-pass.js.map +1 -0
  323. package/dist/validation/warning.d.ts +31 -0
  324. package/dist/validation/warning.d.ts.map +1 -0
  325. package/dist/validation/warning.js +81 -0
  326. package/dist/validation/warning.js.map +1 -0
  327. package/dist/validation/yaml.d.ts +9 -0
  328. package/dist/validation/yaml.d.ts.map +1 -0
  329. package/dist/validation/yaml.js +30 -0
  330. package/dist/validation/yaml.js.map +1 -0
  331. package/dist/workflow/index.d.ts +10 -0
  332. package/dist/workflow/index.d.ts.map +1 -0
  333. package/dist/workflow/index.js +16 -0
  334. package/dist/workflow/index.js.map +1 -0
  335. package/dist/workflow/schema.d.ts +89 -0
  336. package/dist/workflow/schema.d.ts.map +1 -0
  337. package/dist/workflow/schema.js +73 -0
  338. package/dist/workflow/schema.js.map +1 -0
  339. package/package.json +78 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/memory/schema.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;GASG;AACH,6BAAwB;AAExB,MAAM,cAAc,GAAG,YAAY,CAAC;AAEpC;;;;;;;;;;;;;;;;GAgBG;AACU,QAAA,YAAY,GAAG,OAAC;KAC1B,MAAM,CAAC;IACN,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACpC,KAAK,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,QAAQ,EAAE;IACtF,OAAO,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CACxC,CAAC;KACD,WAAW,EAAE;KACb,WAAW,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IAC1B,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAE5C,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QACtC,IAAI,KAAK,KAAK,cAAc,EAAE,CAAC;YAC7B,GAAG,CAAC,QAAQ,CAAC;gBACX,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,IAAI,cAAc,mEAAmE;gBAC9F,IAAI,EAAE,CAAC,UAAU,EAAE,KAAK,CAAC;aAC1B,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,KAAK,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,I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AC;QACtC,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,166 @@
1
+ import type { MemoryYaml, StateMachine } from './schema';
2
+ /** The reserved implicit-wildcard target state (spec-001) — never declared explicitly anywhere. */
3
+ export declare const DEPRECATED_STATE = "deprecated";
4
+ /**
5
+ * The terminal state of the `adr` and `tech-spec` machines (`memory.yaml`): reached along the forward
6
+ * `sequence` by `approve`, never by `memory deprecate`. A superseded decision is archived content — a
7
+ * later element explicitly replaced it — which is why `dl-028-archived-states-excluded-from-context`
8
+ * puts it in {@link ARCHIVED_STATUSES} alongside {@link DEPRECATED_STATE}.
9
+ */
10
+ export declare const SUPERSEDED_STATE = "superseded";
11
+ /**
12
+ * The canonical **archived** status set, ratified by `dl-028-archived-states-excluded-from-context`:
13
+ * exactly `{deprecated, superseded}`, in this fixed order (REQ-SYS-07 — no unordered iteration in any
14
+ * output-affecting path).
15
+ *
16
+ * REQ-STATE-06's Rationale ("distinguish active from archived decisions") always named the archived
17
+ * set, but its Description and Fit Criterion named only `deprecated`; dl-028 closes that gap and the
18
+ * SARD entry now names both. The previously-specified `rejected` is **not** here: `spec-001-memory-yaml-schema`
19
+ * removed that status from every type's machine (a `reject` transition lands back on `draft`), so it
20
+ * can never appear in a document's frontmatter.
21
+ */
22
+ export declare const ARCHIVED_STATUSES: readonly string[];
23
+ /**
24
+ * True when a document's frontmatter `status` is an archived state ({@link ARCHIVED_STATUSES}).
25
+ *
26
+ * This is the **single shared predicate** dl-028 mandates: both the default-search path
27
+ * (`searchMemoryDocuments`, REQ-STATE-06) and the agent-context path (`src/core/relevance.ts`'s
28
+ * relevance filter, spec-012 §6) consume it, so "archived" has exactly one definition. It supersedes
29
+ * `task-038`'s `isDeprecatedStatus`.
30
+ *
31
+ * It takes the **already-parsed status string**, not the raw frontmatter record: every call site
32
+ * projects `status` out of frontmatter anyway (for its own result shape), and a frontmatter-shaped
33
+ * predicate forced those callers either to re-parse or to hand back a record they had already
34
+ * destructured — the composition problem `task-038`'s reviewer flagged. Non-string / absent `status`
35
+ * values are normalised to `undefined` by the caller's own frontmatter projection and are never
36
+ * archived.
37
+ *
38
+ * Note the deliberate asymmetry with the *context* filter: `src/core/relevance.ts` excludes
39
+ * `draft` **in addition to** this archived set (spec-012 §6 — only "stable, decided and still-current"
40
+ * content enters an execution context), while default `memory search` keeps drafts visible.
41
+ * `draft` is therefore NOT part of the archived set.
42
+ */
43
+ export declare function isArchivedStatus(status: string | undefined): boolean;
44
+ /** `E_INVALID_<X>` field-level code (spec-009 §3) for an illegal state transition. */
45
+ export declare const E_INVALID_TRANSITION = "E_INVALID_TRANSITION";
46
+ /**
47
+ * `E_INVALID_<X>` field-level code (spec-009 §3, spec-010-memory-frontmatter-schema "Validation
48
+ * rules") for a document frontmatter `status` value that is not a legal state for its declared type
49
+ * at all — as opposed to {@link E_INVALID_TRANSITION}, which flags an illegal *transition attempt*
50
+ * (verb + current state), not the current state's bare legality. See {@link validateFrontmatterState}.
51
+ */
52
+ export declare const E_INVALID_STATE = "E_INVALID_STATE";
53
+ /** The four CLI verbs a transition can be requested for (`memory.add` assigns `sequence[0]` directly, no verb). */
54
+ export type TransitionOp = 'submit' | 'approve' | 'reject' | 'deprecate';
55
+ /**
56
+ * REQ-STATE-08's default machine, owned by the **engine** rather than by any config file
57
+ * (`bug-030-init-memory-yaml-has-no-state-machine`, task-071). It is the last arm of
58
+ * {@link resolveStateMachine}'s resolution: it governs every registered type that declares no `states`
59
+ * block in a `memory.yaml` that declares no `defaults.states` either.
60
+ *
61
+ * **Why the engine owns it.** REQ-STATE-08 states the rule over the *type* — "A Memory type that does
62
+ * not declare its own `states` uses the default machine" — with no mention of a `defaults` block, and
63
+ * its Rationale is "reduce config friction for simple types". `spec-001-memory-yaml-schema` makes
64
+ * `defaults` optional (`defaults: z.object({ states: StateMachine }).optional()`). A `memory.yaml`
65
+ * that omits `defaults` and registers a type without `states` is therefore a legal file whose types
66
+ * REQ-STATE-08 still gives a machine — which can only hold if the default exists without being
67
+ * declared. Before task-071 that combination threw instead, so every project `wingfoil init` created
68
+ * refused every transition verb (bug-030). BDD `p1-memory/P1.13-memory-element-schema.feature`
69
+ * scenario 2 is read the same way: its `Given` only puts a type in the file "without a `states`
70
+ * block", and its `Then` names the machine by value — so its title ("uses the defaults block")
71
+ * describes the common case rather than a precondition.
72
+ *
73
+ * **Why this value.** It is `spec-001`'s own worked `defaults` example, verbatim — not REQ-STATE-08's
74
+ * literal `draft → pending → approved/rejected → deprecated` wording, which `spec-001` §Consequences
75
+ * deliberately superseded: the default machine "loses its `rejected` state" ("no document ever records
76
+ * `status: rejected` again" — a `reject` from the `pending` gate lands straight back on `draft`), and
77
+ * `deprecated` is the reserved implicit wildcard reachable from any state, never declared in a
78
+ * `sequence` (the `StateMachine` schema's own `.superRefine()` forbids declaring it). The resulting
79
+ * legal set is exactly REQ-STATE-08's fit criterion under that encoding: `submit` draft→pending,
80
+ * `approve` pending→approved, `reject` pending→draft, `deprecate` →`deprecated` from anywhere, and
81
+ * nothing else.
82
+ *
83
+ * Frozen: it is shared by every type that falls back to it, so no consumer may mutate the machine
84
+ * other types are resolving (a shared constant, built once, with no per-call construction and no
85
+ * ordering dependence — REQ-SYS-07).
86
+ */
87
+ export declare const DEFAULT_STATE_MACHINE: StateMachine;
88
+ /**
89
+ * Resolve the state machine that governs `typeName`, per REQ-STATE-08. Three arms, in precedence
90
+ * order — the first that exists wins:
91
+ *
92
+ * 1. the type's own `states` block (`types.<name>.states`);
93
+ * 2. the file's `defaults.states`, when it declares one — a per-project override of the built-in;
94
+ * 3. {@link DEFAULT_STATE_MACHINE}, the engine's built-in default (task-071 / bug-030).
95
+ *
96
+ * Because arm 3 always applies, **no registered type can fail to resolve a machine**: the previous
97
+ * "neither the type nor `defaults` declares a machine" throw is gone, and with it the failure that
98
+ * made every transition verb refuse in a freshly-`wingfoil init`-ed project.
99
+ *
100
+ * The one remaining throw is for a type that is **not registered at all**. It is a plain `Error`, not
101
+ * a `ValidationError`, because it is a caller-programming-error condition rather than a
102
+ * document-transition failure — and it is not reachable from any CLI or MCP call: every transition
103
+ * verb goes through `prepareMemoryTransition` (`src/core/memory-transition.ts`), which returns the
104
+ * `NOT_FOUND` result `unknown memory type '<t>' (not defined in memory.yaml)` (exit `1`) for an
105
+ * unregistered type *before* calling this function. Only a direct library call naming a type the file
106
+ * does not register can reach it.
107
+ */
108
+ export declare function resolveStateMachine(memoryYaml: MemoryYaml, typeName: string): StateMachine;
109
+ /**
110
+ * Compute the legal target state for `op` applied to `currentState` under `machine`. Returns the
111
+ * target state on success; throws `ValidationError` (never returns a target) when the transition is
112
+ * illegal, per REQ-STATE-01 — a caller must never write a document's `status` unless this function
113
+ * returns normally. `filePath` is only used to enrich the thrown error's `file` field (optional —
114
+ * defaults to `''` when no document is on hand, e.g. in pure unit tests).
115
+ */
116
+ export declare function resolveTransitionTarget(machine: StateMachine, currentState: string, op: TransitionOp, filePath?: string): string;
117
+ /**
118
+ * Resolve the legal target of verb `op` for a document of type `typeName` currently in `currentState`
119
+ * — the entry point every Memory transition verb (`submit`, and `approve`/`reject`/`deprecate` after
120
+ * it) uses. It resolves the type's machine ({@link resolveStateMachine}, REQ-STATE-08) and delegates
121
+ * legality to {@link resolveTransitionTarget}, adding only the user-facing contract:
122
+ *
123
+ * An illegal transition is rethrown as the `E_INVALID_TRANSITION` issue ratified by
124
+ * `dl-032-illegal-transition-message-contract` (option (c)) — `message` is the pinned
125
+ * `` illegal transition <from> -> <to> for type '<type>' `` (REQ-STATE-01 Fit Criterion; BDD `P1.6`
126
+ * sc.2, `P5.2.3` sc.2), `detail` carries the engine's explanation of *why* the edge is illegal, and the
127
+ * exit code is `1`. `<to>` is computed by {@link contractTarget}.
128
+ *
129
+ * @throws {@link ../validation.ValidationError} `E_INVALID_TRANSITION` (exit `1`) as above.
130
+ * @throws `Error` when `typeName` is not registered (see {@link resolveStateMachine}). A registered type
131
+ * can no longer fail to resolve a machine: REQ-STATE-08's built-in default is the last fallback.
132
+ */
133
+ export declare function resolveTypeTransition(memoryYaml: MemoryYaml, typeName: string, currentState: string, op: TransitionOp, filePath?: string): string;
134
+ /**
135
+ * Assert that `status` — a value read straight off a document's frontmatter — is a legal state for
136
+ * `typeName` under `machine` (REQ-STATE-01: state is derived from frontmatter; spec-010's "Validation
137
+ * rules": *"`status` must be a value in the type's `states.values`"*). The legal set is exactly
138
+ * {@link isDeclaredState}'s: `sequence` ∪ every `gates.<state>.reject` target ∪ `deprecated`.
139
+ *
140
+ * This is a distinct check from {@link resolveTransitionTarget}: that function asks "is verb `op`
141
+ * legal FROM `currentState`", assuming `currentState` is already known-legal; this function asks
142
+ * whether an arbitrary `status` string is itself a legal state for the type at all — independent of
143
+ * any transition attempt, e.g. when validating a document's frontmatter as read (BDD
144
+ * `P4.11-deliverables.feature` scenario 3, `P4.13-state-deduction.feature` scenario 3). The two must
145
+ * agree: any state `resolveTransitionTarget` can return must validate here, or the tool would refuse
146
+ * a document it wrote itself.
147
+ *
148
+ * @throws {@link ../validation.ValidationError} `E_INVALID_STATE` with the message
149
+ * `` invalid state '<status>' for type '<typeName>' `` when `status` is not a legal state for
150
+ * `typeName`. **Exit code `1`**, per spec-009-validation-strategy §3 as rewritten under
151
+ * `dl-032-illegal-transition-message-contract`: the code keys on the *nature* of the failure, not
152
+ * the pass that detected it — `2` is reserved for parse and system-integrity failures, while "every
153
+ * other validation failure ... including business-rule failures detected in Pass 2" exits `1`. An
154
+ * unrecognised `status` is understood input that a rule refused, so it is a `1`; that is why this
155
+ * throws the `ValidationError` constructor directly rather than `ValidationError.semantic(...)`,
156
+ * which hard-codes `2` for the genuine integrity checks (`loaders`, `id`, `query`). No BDD scenario
157
+ * pins an exit code for this message — `P4.11` sc.3 and `P4.13` sc.3 pin the text only — so the spec
158
+ * rule governs unopposed. (The separate `E_INVALID_TRANSITION` message/exit-code realignment that
159
+ * `dl-032` ratified lives in {@link resolveTypeTransition}, added by `task-045-memory-submit`.)
160
+ *
161
+ * `filePath` is only used to enrich the thrown error's `file` field (optional — defaults to `''`
162
+ * when no document is on hand, e.g. in pure unit tests), mirroring {@link resolveTransitionTarget}'s
163
+ * own `filePath` parameter.
164
+ */
165
+ export declare function validateFrontmatterState(machine: StateMachine, typeName: string, status: string, filePath?: string): void;
166
+ //# sourceMappingURL=state-machine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-machine.d.ts","sourceRoot":"","sources":["../../src/memory/state-machine.ts"],"names":[],"mappings":"AAuEA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAEzD,mGAAmG;AACnG,eAAO,MAAM,gBAAgB,eAAe,CAAC;AAE7C;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,eAAe,CAAC;AAE7C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EAAwD,CAAC;AAExG;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAEpE;AAED,sFAAsF;AACtF,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAE3D;;;;;GAKG;AACH,eAAO,MAAM,eAAe,oBAAoB,CAAC;AAEjD,mHAAmH;AACnH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,qBAAqB,EAAE,YAahC,CAAC;AAEL;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,YAAY,CAM1F;AAmBD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,YAAY,EACrB,YAAY,EAAE,MAAM,EACpB,EAAE,EAAE,YAAY,EAChB,QAAQ,SAAK,GACZ,MAAM,CA8DR;AAsCD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,EAAE,EAAE,YAAY,EAChB,QAAQ,SAAK,GACZ,MAAM,CAiBR;AAuCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,QAAQ,SAAK,GACZ,IAAI,CAYN"}
@@ -0,0 +1,431 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_STATE_MACHINE = exports.E_INVALID_STATE = exports.E_INVALID_TRANSITION = exports.ARCHIVED_STATUSES = exports.SUPERSEDED_STATE = exports.DEPRECATED_STATE = void 0;
4
+ exports.isArchivedStatus = isArchivedStatus;
5
+ exports.resolveStateMachine = resolveStateMachine;
6
+ exports.resolveTransitionTarget = resolveTransitionTarget;
7
+ exports.resolveTypeTransition = resolveTypeTransition;
8
+ exports.validateFrontmatterState = validateFrontmatterState;
9
+ /**
10
+ * State-machine transition-legality engine (REQ-SYS-04, task-005-per-type-state-machines).
11
+ *
12
+ * task-004-decoupled-pillars already shipped the *structural* `StateMachine` Zod schema in
13
+ * `./schema.ts` — the `sequence`/`gates`/`waiting` shape plus a `.superRefine()` enforcing
14
+ * spec-001-memory-yaml-schema's "Semantic validation (post-parse)" rules (gates/waiting keys must be
15
+ * members of `sequence`, `"deprecated"` is reserved, etc.). This module does NOT re-validate any of
16
+ * that — it takes an already-parsed, already-structurally-valid `StateMachine` and answers a
17
+ * different question: **given a document's current `status` and a requested CLI verb
18
+ * (`submit`/`approve`/`reject`/`deprecate`), what is the legal target state, if any?**
19
+ *
20
+ * This is spec-009-validation-strategy §1's Pass 2 (semantic / cross-file): the transition rule
21
+ * needs the type's registered machine (loaded from `memory.yaml`) plus the document's own `status`
22
+ * field — neither is decidable from the document's frontmatter schema alone, matching spec-009's own
23
+ * worked example ("`wingfoil.status` must be a member of that type's `states.values`"). An illegal
24
+ * transition throws the shared `ValidationError` (exit code `1` — a business-rule failure, not an
25
+ * integrity one, per spec-009 §3 as rewritten under `dl-032-illegal-transition-message-contract`)
26
+ * and — critically — throws *before* returning any target, so a caller can never reach
27
+ * the frontmatter-write step on an illegal transition (REQ-STATE-01: rejected before any file write).
28
+ * This module never touches a document or the filesystem itself; it is a pure function of
29
+ * (`machine`, `currentState`, `op`) → target-or-throw, and it is the caller's job to gate any actual
30
+ * write on this function returning normally.
31
+ *
32
+ * Rules implemented below (spec-001-memory-yaml-schema, "Sub-schema: StateMachine" +
33
+ * "Which verb drives each forward edge — fully determined by the schema" + "`deprecated` is
34
+ * implicit"):
35
+ *
36
+ * - `submit`: legal only from a state that is in `sequence`, is NOT a `gates` key, and is NOT in
37
+ * `waiting`, and that has a next state in `sequence`. Target: the next state in `sequence`.
38
+ * - `approve`: legal only from a state that IS a `gates` key and is NOT also in `waiting` (a state
39
+ * that is both is spec-001's explicit "verb-less" case: "its forward edge is verb-less (picked up
40
+ * automatically)" — the manual `approve` verb does not apply, only the manual `reject` does).
41
+ * Target: the next state in `sequence`.
42
+ * - `reject`: legal only from a state that IS a `gates` key (regardless of `waiting` membership —
43
+ * spec-001: a gate+waiting state "still exposes a manual `reject`/decline path"). Target:
44
+ * `gates[<state>].reject`, always taken verbatim (it need not be a `sequence` member).
45
+ * - `deprecate`: the implicit wildcard edge — always legal from any current state, target is the
46
+ * reserved `"deprecated"` state. Never declared in `sequence`/`gates`/`waiting` (enforced
47
+ * structurally by task-004's `.superRefine()`; this engine does not need to re-check it).
48
+ * - Anything else (state not a member of `sequence` at all, wrong verb for the state's category, or
49
+ * a `sequence`-terminal state with no next entry) is illegal.
50
+ *
51
+ * task-036-frontmatter-lifecycle-validation adds {@link validateFrontmatterState} — a distinct check
52
+ * from the transition engine above: REQ-STATE-01's "document state derived from frontmatter" half,
53
+ * independent of any transition attempt. `resolveTransitionTarget` only answers "is verb `op` legal
54
+ * FROM `currentState`"; it never asserts that an arbitrary `status` string read off a document's
55
+ * frontmatter is itself a member of the type's declared state set at all — the check
56
+ * spec-010-memory-frontmatter-schema's "Validation rules" table names ("`status` must be a value in
57
+ * the type's `states.values`" → failure "invalid state for type") and BDD
58
+ * `P4.11-deliverables.feature`/`P4.13-state-deduction.feature` both exercise (`"invalid state
59
+ * 'shipped' for type 'task'"`). A state is legal for a type iff it belongs to that machine's full
60
+ * reachable set — `sequence` ∪ every `gates.<state>.reject` target (spec-001 permits those to be
61
+ * off-chain, and `resolveTransitionTarget` returns them verbatim) ∪ the reserved implicit
62
+ * `"deprecated"` state (never declared in `sequence` itself, per the `StateMachine` schema's own
63
+ * `.superRefine()`, but always a legal transition target via `memory.deprecate` — see
64
+ * `resolveTransitionTarget`'s `deprecate` case above).
65
+ *
66
+ * **Type resolution (REQ-STATE-08):** `resolveStateMachine` resolves a type's machine as
67
+ * `types.<name>.states ?? defaults.states ?? `{@link DEFAULT_STATE_MACHINE}. task-005's own tests
68
+ * exercise only the real types registered in `docs/self/.wingfoil/memory.yaml`, every one of which
69
+ * declares its own `states` block — so the `?? defaults.states` arm was left uncovered by that task,
70
+ * and `task-010-default-state-machine-fallback` closed that gap with a throwaway fixture type
71
+ * (declared with no `states:` key) in `test/memory/state-machine.test.ts`. The **third** arm is
72
+ * task-071's (`bug-030-init-memory-yaml-has-no-state-machine`): task-010's fixture still *declared* a
73
+ * `defaults` block, so a file with no machine anywhere — the shape `wingfoil init` scaffolded — was
74
+ * never resolved by anything, and it threw. See {@link DEFAULT_STATE_MACHINE} for why the engine, not
75
+ * the config file, owns that default.
76
+ */
77
+ const validation_1 = require("../validation");
78
+ const schema_1 = require("./schema");
79
+ /** The reserved implicit-wildcard target state (spec-001) — never declared explicitly anywhere. */
80
+ exports.DEPRECATED_STATE = 'deprecated';
81
+ /**
82
+ * The terminal state of the `adr` and `tech-spec` machines (`memory.yaml`): reached along the forward
83
+ * `sequence` by `approve`, never by `memory deprecate`. A superseded decision is archived content — a
84
+ * later element explicitly replaced it — which is why `dl-028-archived-states-excluded-from-context`
85
+ * puts it in {@link ARCHIVED_STATUSES} alongside {@link DEPRECATED_STATE}.
86
+ */
87
+ exports.SUPERSEDED_STATE = 'superseded';
88
+ /**
89
+ * The canonical **archived** status set, ratified by `dl-028-archived-states-excluded-from-context`:
90
+ * exactly `{deprecated, superseded}`, in this fixed order (REQ-SYS-07 — no unordered iteration in any
91
+ * output-affecting path).
92
+ *
93
+ * REQ-STATE-06's Rationale ("distinguish active from archived decisions") always named the archived
94
+ * set, but its Description and Fit Criterion named only `deprecated`; dl-028 closes that gap and the
95
+ * SARD entry now names both. The previously-specified `rejected` is **not** here: `spec-001-memory-yaml-schema`
96
+ * removed that status from every type's machine (a `reject` transition lands back on `draft`), so it
97
+ * can never appear in a document's frontmatter.
98
+ */
99
+ exports.ARCHIVED_STATUSES = Object.freeze([exports.DEPRECATED_STATE, exports.SUPERSEDED_STATE]);
100
+ /**
101
+ * True when a document's frontmatter `status` is an archived state ({@link ARCHIVED_STATUSES}).
102
+ *
103
+ * This is the **single shared predicate** dl-028 mandates: both the default-search path
104
+ * (`searchMemoryDocuments`, REQ-STATE-06) and the agent-context path (`src/core/relevance.ts`'s
105
+ * relevance filter, spec-012 §6) consume it, so "archived" has exactly one definition. It supersedes
106
+ * `task-038`'s `isDeprecatedStatus`.
107
+ *
108
+ * It takes the **already-parsed status string**, not the raw frontmatter record: every call site
109
+ * projects `status` out of frontmatter anyway (for its own result shape), and a frontmatter-shaped
110
+ * predicate forced those callers either to re-parse or to hand back a record they had already
111
+ * destructured — the composition problem `task-038`'s reviewer flagged. Non-string / absent `status`
112
+ * values are normalised to `undefined` by the caller's own frontmatter projection and are never
113
+ * archived.
114
+ *
115
+ * Note the deliberate asymmetry with the *context* filter: `src/core/relevance.ts` excludes
116
+ * `draft` **in addition to** this archived set (spec-012 §6 — only "stable, decided and still-current"
117
+ * content enters an execution context), while default `memory search` keeps drafts visible.
118
+ * `draft` is therefore NOT part of the archived set.
119
+ */
120
+ function isArchivedStatus(status) {
121
+ return status !== undefined && exports.ARCHIVED_STATUSES.includes(status);
122
+ }
123
+ /** `E_INVALID_<X>` field-level code (spec-009 §3) for an illegal state transition. */
124
+ exports.E_INVALID_TRANSITION = 'E_INVALID_TRANSITION';
125
+ /**
126
+ * `E_INVALID_<X>` field-level code (spec-009 §3, spec-010-memory-frontmatter-schema "Validation
127
+ * rules") for a document frontmatter `status` value that is not a legal state for its declared type
128
+ * at all — as opposed to {@link E_INVALID_TRANSITION}, which flags an illegal *transition attempt*
129
+ * (verb + current state), not the current state's bare legality. See {@link validateFrontmatterState}.
130
+ */
131
+ exports.E_INVALID_STATE = 'E_INVALID_STATE';
132
+ /**
133
+ * REQ-STATE-08's default machine, owned by the **engine** rather than by any config file
134
+ * (`bug-030-init-memory-yaml-has-no-state-machine`, task-071). It is the last arm of
135
+ * {@link resolveStateMachine}'s resolution: it governs every registered type that declares no `states`
136
+ * block in a `memory.yaml` that declares no `defaults.states` either.
137
+ *
138
+ * **Why the engine owns it.** REQ-STATE-08 states the rule over the *type* — "A Memory type that does
139
+ * not declare its own `states` uses the default machine" — with no mention of a `defaults` block, and
140
+ * its Rationale is "reduce config friction for simple types". `spec-001-memory-yaml-schema` makes
141
+ * `defaults` optional (`defaults: z.object({ states: StateMachine }).optional()`). A `memory.yaml`
142
+ * that omits `defaults` and registers a type without `states` is therefore a legal file whose types
143
+ * REQ-STATE-08 still gives a machine — which can only hold if the default exists without being
144
+ * declared. Before task-071 that combination threw instead, so every project `wingfoil init` created
145
+ * refused every transition verb (bug-030). BDD `p1-memory/P1.13-memory-element-schema.feature`
146
+ * scenario 2 is read the same way: its `Given` only puts a type in the file "without a `states`
147
+ * block", and its `Then` names the machine by value — so its title ("uses the defaults block")
148
+ * describes the common case rather than a precondition.
149
+ *
150
+ * **Why this value.** It is `spec-001`'s own worked `defaults` example, verbatim — not REQ-STATE-08's
151
+ * literal `draft → pending → approved/rejected → deprecated` wording, which `spec-001` §Consequences
152
+ * deliberately superseded: the default machine "loses its `rejected` state" ("no document ever records
153
+ * `status: rejected` again" — a `reject` from the `pending` gate lands straight back on `draft`), and
154
+ * `deprecated` is the reserved implicit wildcard reachable from any state, never declared in a
155
+ * `sequence` (the `StateMachine` schema's own `.superRefine()` forbids declaring it). The resulting
156
+ * legal set is exactly REQ-STATE-08's fit criterion under that encoding: `submit` draft→pending,
157
+ * `approve` pending→approved, `reject` pending→draft, `deprecate` →`deprecated` from anywhere, and
158
+ * nothing else.
159
+ *
160
+ * Frozen: it is shared by every type that falls back to it, so no consumer may mutate the machine
161
+ * other types are resolving (a shared constant, built once, with no per-call construction and no
162
+ * ordering dependence — REQ-SYS-07).
163
+ */
164
+ exports.DEFAULT_STATE_MACHINE = (() => {
165
+ // Built through the real `StateMachine` schema, so the built-in is held to exactly the structural
166
+ // rules (`gates` keys ⊆ `sequence`, `"deprecated"` never declared) every hand-written machine is —
167
+ // a malformed default would otherwise be the one machine nothing validates. Frozen through, so a
168
+ // consumer cannot mutate what every falling-back type resolves.
169
+ const machine = schema_1.StateMachine.parse({
170
+ sequence: ['draft', 'pending', 'approved'],
171
+ gates: { pending: { reject: 'draft' } },
172
+ });
173
+ Object.freeze(machine.sequence);
174
+ Object.freeze(machine.gates['pending']);
175
+ Object.freeze(machine.gates);
176
+ return Object.freeze(machine);
177
+ })();
178
+ /**
179
+ * Resolve the state machine that governs `typeName`, per REQ-STATE-08. Three arms, in precedence
180
+ * order — the first that exists wins:
181
+ *
182
+ * 1. the type's own `states` block (`types.<name>.states`);
183
+ * 2. the file's `defaults.states`, when it declares one — a per-project override of the built-in;
184
+ * 3. {@link DEFAULT_STATE_MACHINE}, the engine's built-in default (task-071 / bug-030).
185
+ *
186
+ * Because arm 3 always applies, **no registered type can fail to resolve a machine**: the previous
187
+ * "neither the type nor `defaults` declares a machine" throw is gone, and with it the failure that
188
+ * made every transition verb refuse in a freshly-`wingfoil init`-ed project.
189
+ *
190
+ * The one remaining throw is for a type that is **not registered at all**. It is a plain `Error`, not
191
+ * a `ValidationError`, because it is a caller-programming-error condition rather than a
192
+ * document-transition failure — and it is not reachable from any CLI or MCP call: every transition
193
+ * verb goes through `prepareMemoryTransition` (`src/core/memory-transition.ts`), which returns the
194
+ * `NOT_FOUND` result `unknown memory type '<t>' (not defined in memory.yaml)` (exit `1`) for an
195
+ * unregistered type *before* calling this function. Only a direct library call naming a type the file
196
+ * does not register can reach it.
197
+ */
198
+ function resolveStateMachine(memoryYaml, typeName) {
199
+ const typeEntry = memoryYaml.types[typeName];
200
+ if (!typeEntry) {
201
+ throw new Error(`memory.yaml has no type "${typeName}" registered`);
202
+ }
203
+ return typeEntry.states ?? memoryYaml.defaults?.states ?? exports.DEFAULT_STATE_MACHINE;
204
+ }
205
+ /**
206
+ * Build one `E_INVALID_TRANSITION` `ValidationError` and throw it. Exits `1`: an illegal transition is
207
+ * understood input that a rule refused, not a parse/integrity failure (spec-009 §3, `dl-032`) — so the
208
+ * plain constructor, not `ValidationError.semantic(...)`. The message here is the type-agnostic
209
+ * diagnostic; {@link resolveTypeTransition} turns it into the pinned contract message.
210
+ */
211
+ function illegal(currentState, op, message, filePath) {
212
+ throw new validation_1.ValidationError([
213
+ {
214
+ code: exports.E_INVALID_TRANSITION,
215
+ path: 'status',
216
+ file: filePath,
217
+ message: `illegal \`${op}\` from "${currentState}": ${message}`,
218
+ },
219
+ ]);
220
+ }
221
+ /**
222
+ * Compute the legal target state for `op` applied to `currentState` under `machine`. Returns the
223
+ * target state on success; throws `ValidationError` (never returns a target) when the transition is
224
+ * illegal, per REQ-STATE-01 — a caller must never write a document's `status` unless this function
225
+ * returns normally. `filePath` is only used to enrich the thrown error's `file` field (optional —
226
+ * defaults to `''` when no document is on hand, e.g. in pure unit tests).
227
+ */
228
+ function resolveTransitionTarget(machine, currentState, op, filePath = '') {
229
+ if (op === 'deprecate') {
230
+ // Implicit wildcard edge from any state (spec-001) — always legal, never declared explicitly.
231
+ return exports.DEPRECATED_STATE;
232
+ }
233
+ const index = machine.sequence.indexOf(currentState);
234
+ const gate = (machine.gates ?? {})[currentState];
235
+ const isWaiting = (machine.waiting ?? []).includes(currentState);
236
+ switch (op) {
237
+ case 'submit': {
238
+ if (index === -1) {
239
+ return illegal(currentState, op, "not a member of this type's `sequence`", filePath);
240
+ }
241
+ if (gate) {
242
+ return illegal(currentState, op, 'a `gates` state — its forward edge requires `approve`, not `submit`', filePath);
243
+ }
244
+ if (isWaiting) {
245
+ return illegal(currentState, op, 'a `waiting` state — its forward edge fires only via a Workflow action, not `submit`', filePath);
246
+ }
247
+ const next = machine.sequence[index + 1];
248
+ if (next === undefined) {
249
+ return illegal(currentState, op, 'the last state in `sequence` — there is no forward edge', filePath);
250
+ }
251
+ return next;
252
+ }
253
+ case 'approve': {
254
+ if (!gate) {
255
+ return illegal(currentState, op, 'not a `gates` state — `approve` is only legal from a gate', filePath);
256
+ }
257
+ if (isWaiting) {
258
+ return illegal(currentState, op, 'both a `gates` and `waiting` state — its forward edge is verb-less (fires only via a Workflow action), not `approve`', filePath);
259
+ }
260
+ const next = machine.sequence[index + 1];
261
+ if (next === undefined) {
262
+ return illegal(currentState, op, 'a `gates` state with no next `sequence` entry to approve into', filePath);
263
+ }
264
+ return next;
265
+ }
266
+ case 'reject': {
267
+ if (!gate) {
268
+ return illegal(currentState, op, 'not a `gates` state — `reject` is only legal from a gate', filePath);
269
+ }
270
+ // `reject` target is taken verbatim — need not be a `sequence` member (spec-001).
271
+ return gate.reject;
272
+ }
273
+ default: {
274
+ const exhaustive = op;
275
+ return illegal(currentState, exhaustive, 'unknown operation', filePath);
276
+ }
277
+ }
278
+ }
279
+ /** What the contract message prints for `<to>` when a verb has no legal edge anywhere in the machine. */
280
+ const NO_TARGET = '(none)';
281
+ /**
282
+ * The `<to>` of the illegal-transition contract message: the verb's **canonical edge** for this type —
283
+ * the target `op` reaches from the first state, in `sequence` order, from which `op` is legal (for
284
+ * `submit` on `task` or on the default machine: `pending`; on `release`: `planning`). A verb names no
285
+ * target of its own, so the message needs a rule; this one reproduces the string BDD `P1.6` sc.2 and
286
+ * `P5.2.3` sc.2 pin (`approved -> pending` for `task`) on both the default machine and the real `task`
287
+ * machine, where the literal forward edge out of `approved` is `done`.
288
+ *
289
+ * What happens when that canonical target IS `currentState` — printing it would be a self-loop — is
290
+ * ratified by `dl-053-illegal-transition-target-for-verbless-edges` (option 1): **keep walking
291
+ * `sequence` for the next legal edge of the SAME verb**, and render {@link NO_TARGET} when the verb
292
+ * has no other target. It must never name the next state in `sequence` regardless of verb — the
293
+ * earlier fallback did, printing `draft -> pending` for a `reject` (a rejection shown as a forward
294
+ * move) and `backlog -> in-progress` for an `approve` (a `waiting` edge no verb drives), misinforming
295
+ * exactly the user who has just made an illegal call. Every `<to>` printed here is therefore a real
296
+ * target of the verb the user typed, on this type's own machine.
297
+ *
298
+ * A pure function of `(machine, currentState, op)` walked in `sequence` order (REQ-SYS-07).
299
+ */
300
+ function contractTarget(machine, currentState, op) {
301
+ for (const state of machine.sequence) {
302
+ let target;
303
+ try {
304
+ target = resolveTransitionTarget(machine, state, op);
305
+ }
306
+ catch {
307
+ continue; // `op` is not legal from this state — keep walking the chain
308
+ }
309
+ // dl-053: a self-loop is not a transition; keep looking for a different target of this same verb.
310
+ if (target !== currentState)
311
+ return target;
312
+ }
313
+ return NO_TARGET;
314
+ }
315
+ /**
316
+ * Resolve the legal target of verb `op` for a document of type `typeName` currently in `currentState`
317
+ * — the entry point every Memory transition verb (`submit`, and `approve`/`reject`/`deprecate` after
318
+ * it) uses. It resolves the type's machine ({@link resolveStateMachine}, REQ-STATE-08) and delegates
319
+ * legality to {@link resolveTransitionTarget}, adding only the user-facing contract:
320
+ *
321
+ * An illegal transition is rethrown as the `E_INVALID_TRANSITION` issue ratified by
322
+ * `dl-032-illegal-transition-message-contract` (option (c)) — `message` is the pinned
323
+ * `` illegal transition <from> -> <to> for type '<type>' `` (REQ-STATE-01 Fit Criterion; BDD `P1.6`
324
+ * sc.2, `P5.2.3` sc.2), `detail` carries the engine's explanation of *why* the edge is illegal, and the
325
+ * exit code is `1`. `<to>` is computed by {@link contractTarget}.
326
+ *
327
+ * @throws {@link ../validation.ValidationError} `E_INVALID_TRANSITION` (exit `1`) as above.
328
+ * @throws `Error` when `typeName` is not registered (see {@link resolveStateMachine}). A registered type
329
+ * can no longer fail to resolve a machine: REQ-STATE-08's built-in default is the last fallback.
330
+ */
331
+ function resolveTypeTransition(memoryYaml, typeName, currentState, op, filePath = '') {
332
+ const machine = resolveStateMachine(memoryYaml, typeName);
333
+ try {
334
+ return resolveTransitionTarget(machine, currentState, op, filePath);
335
+ }
336
+ catch (error) {
337
+ if (!(error instanceof validation_1.ValidationError))
338
+ throw error;
339
+ const detail = error.issues.map((issue) => issue.message).join('; ');
340
+ throw new validation_1.ValidationError([
341
+ {
342
+ code: exports.E_INVALID_TRANSITION,
343
+ path: 'status',
344
+ file: filePath,
345
+ message: `illegal transition ${currentState} -> ${contractTarget(machine, currentState, op)} for type '${typeName}'`,
346
+ detail,
347
+ },
348
+ ]);
349
+ }
350
+ }
351
+ /**
352
+ * True when `status` is a state a document of this type may legitimately carry — the **full**
353
+ * reachable state set of `machine`, which is the union of three sources:
354
+ *
355
+ * 1. **`machine.sequence`** — every state on the forward chain.
356
+ * 2. **Every `machine.gates.<state>.reject` target** — `resolveTransitionTarget` returns these
357
+ * *verbatim* and spec-001-memory-yaml-schema's "Semantic validation (post-parse)" is explicit that
358
+ * such a target "need **not** be a member of `sequence`: it may revert into the chain (e.g.
359
+ * `pending: { reject: draft }`) or name an **off-chain decline state reached by no forward edge**".
360
+ * Only the gate *keys* (and `waiting` entries) are constrained to `sequence`; the reject targets
361
+ * are not. Omitting this arm is what task-036's first pass got wrong: the `reject` verb would write
362
+ * a status that this very function then declared invalid, leaving the document unmovable —
363
+ * a REQ-SYS-04 violation for a config shape spec-001 names by example. No type registered in
364
+ * `docs/self/.wingfoil/memory.yaml` currently exercises it (all three of its reject targets —
365
+ * `draft`, `closed`, `in-progress` — happen to be `sequence` members), so it is covered by a
366
+ * synthetic fixture machine in `test/memory/state-machine.test.ts`.
367
+ * 3. **{@link DEPRECATED_STATE}** — the reserved implicit wildcard target every type reaches via
368
+ * `memory.deprecate` (see {@link resolveTransitionTarget}'s `deprecate` case), never declared in
369
+ * any `sequence` (the `StateMachine` schema's own `.superRefine()` forbids declaring it).
370
+ *
371
+ * `machine.waiting` contributes nothing: every `waiting` entry is required to be a `sequence` member
372
+ * already, so it is covered by (1).
373
+ *
374
+ * Iteration over `gates` is sorted (REQ-SYS-07 — no unordered iteration in any output-affecting path);
375
+ * the predicate's boolean result is order-independent, but keeping the traversal deterministic keeps
376
+ * it so under any future change that reports *which* source matched.
377
+ */
378
+ function isDeclaredState(machine, status) {
379
+ if (status === exports.DEPRECATED_STATE || machine.sequence.includes(status)) {
380
+ return true;
381
+ }
382
+ const gates = machine.gates ?? {};
383
+ return Object.keys(gates)
384
+ .sort()
385
+ .some((gateState) => gates[gateState]?.reject === status);
386
+ }
387
+ /**
388
+ * Assert that `status` — a value read straight off a document's frontmatter — is a legal state for
389
+ * `typeName` under `machine` (REQ-STATE-01: state is derived from frontmatter; spec-010's "Validation
390
+ * rules": *"`status` must be a value in the type's `states.values`"*). The legal set is exactly
391
+ * {@link isDeclaredState}'s: `sequence` ∪ every `gates.<state>.reject` target ∪ `deprecated`.
392
+ *
393
+ * This is a distinct check from {@link resolveTransitionTarget}: that function asks "is verb `op`
394
+ * legal FROM `currentState`", assuming `currentState` is already known-legal; this function asks
395
+ * whether an arbitrary `status` string is itself a legal state for the type at all — independent of
396
+ * any transition attempt, e.g. when validating a document's frontmatter as read (BDD
397
+ * `P4.11-deliverables.feature` scenario 3, `P4.13-state-deduction.feature` scenario 3). The two must
398
+ * agree: any state `resolveTransitionTarget` can return must validate here, or the tool would refuse
399
+ * a document it wrote itself.
400
+ *
401
+ * @throws {@link ../validation.ValidationError} `E_INVALID_STATE` with the message
402
+ * `` invalid state '<status>' for type '<typeName>' `` when `status` is not a legal state for
403
+ * `typeName`. **Exit code `1`**, per spec-009-validation-strategy §3 as rewritten under
404
+ * `dl-032-illegal-transition-message-contract`: the code keys on the *nature* of the failure, not
405
+ * the pass that detected it — `2` is reserved for parse and system-integrity failures, while "every
406
+ * other validation failure ... including business-rule failures detected in Pass 2" exits `1`. An
407
+ * unrecognised `status` is understood input that a rule refused, so it is a `1`; that is why this
408
+ * throws the `ValidationError` constructor directly rather than `ValidationError.semantic(...)`,
409
+ * which hard-codes `2` for the genuine integrity checks (`loaders`, `id`, `query`). No BDD scenario
410
+ * pins an exit code for this message — `P4.11` sc.3 and `P4.13` sc.3 pin the text only — so the spec
411
+ * rule governs unopposed. (The separate `E_INVALID_TRANSITION` message/exit-code realignment that
412
+ * `dl-032` ratified lives in {@link resolveTypeTransition}, added by `task-045-memory-submit`.)
413
+ *
414
+ * `filePath` is only used to enrich the thrown error's `file` field (optional — defaults to `''`
415
+ * when no document is on hand, e.g. in pure unit tests), mirroring {@link resolveTransitionTarget}'s
416
+ * own `filePath` parameter.
417
+ */
418
+ function validateFrontmatterState(machine, typeName, status, filePath = '') {
419
+ if (isDeclaredState(machine, status)) {
420
+ return;
421
+ }
422
+ throw new validation_1.ValidationError([
423
+ {
424
+ code: exports.E_INVALID_STATE,
425
+ path: 'status',
426
+ file: filePath,
427
+ message: `invalid state '${status}' for type '${typeName}'`,
428
+ },
429
+ ]);
430
+ }
431
+ //# sourceMappingURL=state-machine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-machine.js","sourceRoot":"","sources":["../../src/memory/state-machine.ts"],"names":[],"mappings":";;;AAqHA,4CAEC;AAmFD,kDAMC;AA0BD,0DAmEC;AAsDD,sDAuBC;AAsED,4DAiBC;AAjdD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;AACL,CAAC"}
@@ -0,0 +1,11 @@
1
+ /** The frontmatter key `memory.reject` sets and `memory.submit` removes (spec-010). */
2
+ export declare const REJECTION_REASON_FIELD = "rejection_reason";
3
+ /**
4
+ * The fields that must be filled before a submit but are not: `title` first (spec-010 requires it of
5
+ * every type), then each of `required` in its declared order, without duplicates. `[]` means the
6
+ * document may be submitted.
7
+ */
8
+ export declare function missingRequiredFields(frontmatter: Readonly<Record<string, unknown>>, required: readonly string[]): string[];
9
+ /** The submitted document: `status` set to `target` and `rejection_reason` removed; nothing else changes. */
10
+ export declare function renderSubmitDocument(content: string, target: string): string;
11
+ //# sourceMappingURL=submit.d.ts.map