wingfoil 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (452) hide show
  1. package/README.md +88 -42
  2. package/dist/agent/discovery.d.ts +72 -0
  3. package/dist/agent/discovery.d.ts.map +1 -0
  4. package/dist/agent/discovery.js +210 -0
  5. package/dist/agent/discovery.js.map +1 -0
  6. package/dist/agent/execute.d.ts +206 -0
  7. package/dist/agent/execute.d.ts.map +1 -0
  8. package/dist/agent/execute.js +581 -0
  9. package/dist/agent/execute.js.map +1 -0
  10. package/dist/agent/index.d.ts +23 -0
  11. package/dist/agent/index.d.ts.map +1 -0
  12. package/dist/agent/index.js +85 -0
  13. package/dist/agent/index.js.map +1 -0
  14. package/dist/agent/launch.d.ts +133 -0
  15. package/dist/agent/launch.d.ts.map +1 -0
  16. package/dist/agent/launch.js +380 -0
  17. package/dist/agent/launch.js.map +1 -0
  18. package/dist/agent/manifest.d.ts +30 -0
  19. package/dist/agent/manifest.d.ts.map +1 -0
  20. package/dist/agent/manifest.js +93 -0
  21. package/dist/agent/manifest.js.map +1 -0
  22. package/dist/agent/placeholders.d.ts +49 -0
  23. package/dist/agent/placeholders.d.ts.map +1 -0
  24. package/dist/agent/placeholders.js +177 -0
  25. package/dist/agent/placeholders.js.map +1 -0
  26. package/dist/agent/run-log.d.ts +254 -0
  27. package/dist/agent/run-log.d.ts.map +1 -0
  28. package/dist/agent/run-log.js +612 -0
  29. package/dist/agent/run-log.js.map +1 -0
  30. package/dist/agent/schema.d.ts +100 -0
  31. package/dist/agent/schema.d.ts.map +1 -0
  32. package/dist/agent/schema.js +89 -0
  33. package/dist/agent/schema.js.map +1 -0
  34. package/dist/agent/step.d.ts +41 -0
  35. package/dist/agent/step.d.ts.map +1 -0
  36. package/dist/agent/step.js +95 -0
  37. package/dist/agent/step.js.map +1 -0
  38. package/dist/build-info.json +4 -0
  39. package/dist/cli/error.d.ts +11 -2
  40. package/dist/cli/error.d.ts.map +1 -1
  41. package/dist/cli/error.js +27 -6
  42. package/dist/cli/error.js.map +1 -1
  43. package/dist/cli/exit.d.ts +33 -3
  44. package/dist/cli/exit.d.ts.map +1 -1
  45. package/dist/cli/exit.js +54 -3
  46. package/dist/cli/exit.js.map +1 -1
  47. package/dist/cli/index.d.ts +2 -2
  48. package/dist/cli/index.d.ts.map +1 -1
  49. package/dist/cli/index.js +3 -2
  50. package/dist/cli/index.js.map +1 -1
  51. package/dist/cli/init-command.d.ts.map +1 -1
  52. package/dist/cli/init-command.js +6 -3
  53. package/dist/cli/init-command.js.map +1 -1
  54. package/dist/cli/mcp-command.d.ts +13 -4
  55. package/dist/cli/mcp-command.d.ts.map +1 -1
  56. package/dist/cli/mcp-command.js +25 -8
  57. package/dist/cli/mcp-command.js.map +1 -1
  58. package/dist/cli/output.d.ts +12 -4
  59. package/dist/cli/output.d.ts.map +1 -1
  60. package/dist/cli/output.js +15 -4
  61. package/dist/cli/output.js.map +1 -1
  62. package/dist/cli/program.d.ts +1 -1
  63. package/dist/cli/program.d.ts.map +1 -1
  64. package/dist/cli/program.js +270 -60
  65. package/dist/cli/program.js.map +1 -1
  66. package/dist/cli/registrar.d.ts +16 -7
  67. package/dist/cli/registrar.d.ts.map +1 -1
  68. package/dist/cli/registrar.js +71 -6
  69. package/dist/cli/registrar.js.map +1 -1
  70. package/dist/cli/suggest.d.ts +20 -0
  71. package/dist/cli/suggest.d.ts.map +1 -0
  72. package/dist/cli/suggest.js +49 -0
  73. package/dist/cli/suggest.js.map +1 -0
  74. package/dist/cli/warning.d.ts +26 -0
  75. package/dist/cli/warning.d.ts.map +1 -0
  76. package/dist/cli/warning.js +66 -0
  77. package/dist/cli/warning.js.map +1 -0
  78. package/dist/cli.js +11 -2
  79. package/dist/cli.js.map +1 -1
  80. package/dist/core/agent-execute.d.ts +44 -0
  81. package/dist/core/agent-execute.d.ts.map +1 -0
  82. package/dist/core/agent-execute.js +71 -0
  83. package/dist/core/agent-execute.js.map +1 -0
  84. package/dist/core/agent-list.d.ts +95 -0
  85. package/dist/core/agent-list.d.ts.map +1 -0
  86. package/dist/core/agent-list.js +207 -0
  87. package/dist/core/agent-list.js.map +1 -0
  88. package/dist/core/agent-show.d.ts +44 -0
  89. package/dist/core/agent-show.d.ts.map +1 -0
  90. package/dist/core/agent-show.js +188 -0
  91. package/dist/core/agent-show.js.map +1 -0
  92. package/dist/core/approval-authority.d.ts +17 -14
  93. package/dist/core/approval-authority.d.ts.map +1 -1
  94. package/dist/core/approval-authority.js +9 -9
  95. package/dist/core/approval-authority.js.map +1 -1
  96. package/dist/core/builtin-asset.d.ts +18 -15
  97. package/dist/core/builtin-asset.d.ts.map +1 -1
  98. package/dist/core/builtin-asset.js +17 -14
  99. package/dist/core/builtin-asset.js.map +1 -1
  100. package/dist/core/builtin-integrity.d.ts +12 -2
  101. package/dist/core/builtin-integrity.d.ts.map +1 -1
  102. package/dist/core/builtin-integrity.js +85 -9
  103. package/dist/core/builtin-integrity.js.map +1 -1
  104. package/dist/core/confinement.d.ts +3 -1
  105. package/dist/core/confinement.d.ts.map +1 -1
  106. package/dist/core/confinement.js +7 -4
  107. package/dist/core/confinement.js.map +1 -1
  108. package/dist/core/context.d.ts +150 -98
  109. package/dist/core/context.d.ts.map +1 -1
  110. package/dist/core/context.js +602 -66
  111. package/dist/core/context.js.map +1 -1
  112. package/dist/core/directive-assign.d.ts +33 -7
  113. package/dist/core/directive-assign.d.ts.map +1 -1
  114. package/dist/core/directive-assign.js +67 -27
  115. package/dist/core/directive-assign.js.map +1 -1
  116. package/dist/core/directive-scope.d.ts +36 -0
  117. package/dist/core/directive-scope.d.ts.map +1 -0
  118. package/dist/core/directive-scope.js +34 -0
  119. package/dist/core/directive-scope.js.map +1 -0
  120. package/dist/core/directives-list.d.ts +13 -3
  121. package/dist/core/directives-list.d.ts.map +1 -1
  122. package/dist/core/directives-list.js +18 -6
  123. package/dist/core/directives-list.js.map +1 -1
  124. package/dist/core/dry-run.d.ts +33 -0
  125. package/dist/core/dry-run.d.ts.map +1 -0
  126. package/dist/core/dry-run.js +45 -0
  127. package/dist/core/dry-run.js.map +1 -0
  128. package/dist/core/element-ref.d.ts +23 -0
  129. package/dist/core/element-ref.d.ts.map +1 -0
  130. package/dist/core/element-ref.js +24 -0
  131. package/dist/core/element-ref.js.map +1 -0
  132. package/dist/core/error-details.d.ts +20 -0
  133. package/dist/core/error-details.d.ts.map +1 -0
  134. package/dist/core/error-details.js +65 -0
  135. package/dist/core/error-details.js.map +1 -0
  136. package/dist/core/exit-code.js +6 -6
  137. package/dist/core/git-identity.d.ts +46 -11
  138. package/dist/core/git-identity.d.ts.map +1 -1
  139. package/dist/core/git-identity.js +140 -27
  140. package/dist/core/git-identity.js.map +1 -1
  141. package/dist/core/index.d.ts +189 -14
  142. package/dist/core/index.d.ts.map +1 -1
  143. package/dist/core/index.js +1241 -238
  144. package/dist/core/index.js.map +1 -1
  145. package/dist/core/init.d.ts +50 -8
  146. package/dist/core/init.d.ts.map +1 -1
  147. package/dist/core/init.js +139 -27
  148. package/dist/core/init.js.map +1 -1
  149. package/dist/core/loaders.d.ts +170 -14
  150. package/dist/core/loaders.d.ts.map +1 -1
  151. package/dist/core/loaders.js +570 -89
  152. package/dist/core/loaders.js.map +1 -1
  153. package/dist/core/memory-add-link.d.ts +28 -0
  154. package/dist/core/memory-add-link.d.ts.map +1 -0
  155. package/dist/core/memory-add-link.js +67 -0
  156. package/dist/core/memory-add-link.js.map +1 -0
  157. package/dist/core/memory-add-type.d.ts +25 -1
  158. package/dist/core/memory-add-type.d.ts.map +1 -1
  159. package/dist/core/memory-add-type.js +59 -1
  160. package/dist/core/memory-add-type.js.map +1 -1
  161. package/dist/core/memory-amend.d.ts +80 -0
  162. package/dist/core/memory-amend.d.ts.map +1 -0
  163. package/dist/core/memory-amend.js +160 -0
  164. package/dist/core/memory-amend.js.map +1 -0
  165. package/dist/core/memory-supersede.d.ts +28 -0
  166. package/dist/core/memory-supersede.d.ts.map +1 -0
  167. package/dist/core/memory-supersede.js +79 -0
  168. package/dist/core/memory-supersede.js.map +1 -0
  169. package/dist/core/memory-transition.d.ts +190 -30
  170. package/dist/core/memory-transition.d.ts.map +1 -1
  171. package/dist/core/memory-transition.js +480 -59
  172. package/dist/core/memory-transition.js.map +1 -1
  173. package/dist/core/registry.d.ts +147 -23
  174. package/dist/core/registry.d.ts.map +1 -1
  175. package/dist/core/registry.js +50 -0
  176. package/dist/core/registry.js.map +1 -1
  177. package/dist/core/relevance.d.ts +74 -12
  178. package/dist/core/relevance.d.ts.map +1 -1
  179. package/dist/core/relevance.js +45 -27
  180. package/dist/core/relevance.js.map +1 -1
  181. package/dist/core/require-reason.d.ts.map +1 -1
  182. package/dist/core/require-reason.js +6 -5
  183. package/dist/core/require-reason.js.map +1 -1
  184. package/dist/core/required-fields.d.ts +28 -0
  185. package/dist/core/required-fields.d.ts.map +1 -0
  186. package/dist/core/required-fields.js +60 -0
  187. package/dist/core/required-fields.js.map +1 -0
  188. package/dist/core/revision.d.ts +82 -0
  189. package/dist/core/revision.d.ts.map +1 -0
  190. package/dist/core/revision.js +144 -0
  191. package/dist/core/revision.js.map +1 -0
  192. package/dist/core/types.d.ts +28 -2
  193. package/dist/core/types.d.ts.map +1 -1
  194. package/dist/core/types.js +12 -3
  195. package/dist/core/types.js.map +1 -1
  196. package/dist/core/workflow-core-checks.d.ts +34 -0
  197. package/dist/core/workflow-core-checks.d.ts.map +1 -0
  198. package/dist/core/workflow-core-checks.js +403 -0
  199. package/dist/core/workflow-core-checks.js.map +1 -0
  200. package/dist/core/workflow-create-remove.d.ts +65 -0
  201. package/dist/core/workflow-create-remove.d.ts.map +1 -0
  202. package/dist/core/workflow-create-remove.js +277 -0
  203. package/dist/core/workflow-create-remove.js.map +1 -0
  204. package/dist/core/workflow-deduction.d.ts +48 -0
  205. package/dist/core/workflow-deduction.d.ts.map +1 -0
  206. package/dist/core/workflow-deduction.js +523 -0
  207. package/dist/core/workflow-deduction.js.map +1 -0
  208. package/dist/core/workflow-diagnostics.d.ts +83 -0
  209. package/dist/core/workflow-diagnostics.d.ts.map +1 -0
  210. package/dist/core/workflow-diagnostics.js +375 -0
  211. package/dist/core/workflow-diagnostics.js.map +1 -0
  212. package/dist/core/workflow-exit-state.d.ts +125 -0
  213. package/dist/core/workflow-exit-state.d.ts.map +1 -0
  214. package/dist/core/workflow-exit-state.js +243 -0
  215. package/dist/core/workflow-exit-state.js.map +1 -0
  216. package/dist/core/workflow-finalize.d.ts +37 -0
  217. package/dist/core/workflow-finalize.d.ts.map +1 -0
  218. package/dist/core/workflow-finalize.js +153 -0
  219. package/dist/core/workflow-finalize.js.map +1 -0
  220. package/dist/core/workflow-list-show.d.ts +176 -0
  221. package/dist/core/workflow-list-show.d.ts.map +1 -0
  222. package/dist/core/workflow-list-show.js +268 -0
  223. package/dist/core/workflow-list-show.js.map +1 -0
  224. package/dist/core/workflow-next.d.ts +268 -0
  225. package/dist/core/workflow-next.d.ts.map +1 -0
  226. package/dist/core/workflow-next.js +503 -0
  227. package/dist/core/workflow-next.js.map +1 -0
  228. package/dist/core/workflow-registry.d.ts +52 -0
  229. package/dist/core/workflow-registry.d.ts.map +1 -0
  230. package/dist/core/workflow-registry.js +158 -0
  231. package/dist/core/workflow-registry.js.map +1 -0
  232. package/dist/core/workflow-start-end.d.ts +71 -0
  233. package/dist/core/workflow-start-end.d.ts.map +1 -0
  234. package/dist/core/workflow-start-end.js +298 -0
  235. package/dist/core/workflow-start-end.js.map +1 -0
  236. package/dist/core/workflow-status.d.ts +83 -0
  237. package/dist/core/workflow-status.d.ts.map +1 -0
  238. package/dist/core/workflow-status.js +125 -0
  239. package/dist/core/workflow-status.js.map +1 -0
  240. package/dist/core/write-guard.d.ts +51 -8
  241. package/dist/core/write-guard.d.ts.map +1 -1
  242. package/dist/core/write-guard.js +139 -9
  243. package/dist/core/write-guard.js.map +1 -1
  244. package/dist/directives/index.d.ts +3 -2
  245. package/dist/directives/index.d.ts.map +1 -1
  246. package/dist/directives/index.js +5 -3
  247. package/dist/directives/index.js.map +1 -1
  248. package/dist/directives/schema.d.ts +35 -30
  249. package/dist/directives/schema.d.ts.map +1 -1
  250. package/dist/directives/schema.js +36 -30
  251. package/dist/directives/schema.js.map +1 -1
  252. package/dist/directives/version.d.ts +28 -0
  253. package/dist/directives/version.d.ts.map +1 -0
  254. package/dist/directives/version.js +51 -0
  255. package/dist/directives/version.js.map +1 -0
  256. package/dist/dna/edit.d.ts +7 -6
  257. package/dist/dna/edit.d.ts.map +1 -1
  258. package/dist/dna/edit.js +96 -41
  259. package/dist/dna/edit.js.map +1 -1
  260. package/dist/dna/mutate.js +18 -3
  261. package/dist/dna/mutate.js.map +1 -1
  262. package/dist/dna/path.d.ts +2 -2
  263. package/dist/dna/roles.d.ts +1 -1
  264. package/dist/dna/schema.d.ts +61 -3
  265. package/dist/dna/schema.d.ts.map +1 -1
  266. package/dist/dna/schema.js +121 -6
  267. package/dist/dna/schema.js.map +1 -1
  268. package/dist/mcp/dna-resource.d.ts.map +1 -1
  269. package/dist/mcp/dna-resource.js +4 -4
  270. package/dist/mcp/dna-resource.js.map +1 -1
  271. package/dist/mcp/index.d.ts +9 -5
  272. package/dist/mcp/index.d.ts.map +1 -1
  273. package/dist/mcp/index.js +13 -2
  274. package/dist/mcp/index.js.map +1 -1
  275. package/dist/mcp/memory-resource.d.ts.map +1 -1
  276. package/dist/mcp/memory-resource.js +30 -19
  277. package/dist/mcp/memory-resource.js.map +1 -1
  278. package/dist/mcp/prompt.d.ts +61 -24
  279. package/dist/mcp/prompt.d.ts.map +1 -1
  280. package/dist/mcp/prompt.js +176 -47
  281. package/dist/mcp/prompt.js.map +1 -1
  282. package/dist/mcp/read-only.d.ts +39 -0
  283. package/dist/mcp/read-only.d.ts.map +1 -1
  284. package/dist/mcp/read-only.js +61 -0
  285. package/dist/mcp/read-only.js.map +1 -1
  286. package/dist/mcp/registrar.d.ts +10 -0
  287. package/dist/mcp/registrar.d.ts.map +1 -1
  288. package/dist/mcp/registrar.js +48 -12
  289. package/dist/mcp/registrar.js.map +1 -1
  290. package/dist/mcp/server.d.ts +21 -14
  291. package/dist/mcp/server.d.ts.map +1 -1
  292. package/dist/mcp/server.js +41 -15
  293. package/dist/mcp/server.js.map +1 -1
  294. package/dist/mcp/session-resource.d.ts +13 -0
  295. package/dist/mcp/session-resource.d.ts.map +1 -0
  296. package/dist/mcp/session-resource.js +65 -0
  297. package/dist/mcp/session-resource.js.map +1 -0
  298. package/dist/mcp/workflow-resource.d.ts +18 -0
  299. package/dist/mcp/workflow-resource.d.ts.map +1 -1
  300. package/dist/mcp/workflow-resource.js +37 -8
  301. package/dist/mcp/workflow-resource.js.map +1 -1
  302. package/dist/memory/add.d.ts +160 -17
  303. package/dist/memory/add.d.ts.map +1 -1
  304. package/dist/memory/add.js +361 -51
  305. package/dist/memory/add.js.map +1 -1
  306. package/dist/memory/audit.d.ts +165 -32
  307. package/dist/memory/audit.d.ts.map +1 -1
  308. package/dist/memory/audit.js +267 -97
  309. package/dist/memory/audit.js.map +1 -1
  310. package/dist/memory/commit-message.d.ts +60 -38
  311. package/dist/memory/commit-message.d.ts.map +1 -1
  312. package/dist/memory/commit-message.js +167 -21
  313. package/dist/memory/commit-message.js.map +1 -1
  314. package/dist/memory/entry.d.ts.map +1 -1
  315. package/dist/memory/entry.js +1 -2
  316. package/dist/memory/entry.js.map +1 -1
  317. package/dist/memory/frontmatter-edit.d.ts +16 -4
  318. package/dist/memory/frontmatter-edit.d.ts.map +1 -1
  319. package/dist/memory/frontmatter-edit.js +13 -1
  320. package/dist/memory/frontmatter-edit.js.map +1 -1
  321. package/dist/memory/git-log.d.ts +18 -6
  322. package/dist/memory/git-log.d.ts.map +1 -1
  323. package/dist/memory/git-log.js +40 -13
  324. package/dist/memory/git-log.js.map +1 -1
  325. package/dist/memory/history.d.ts +74 -13
  326. package/dist/memory/history.d.ts.map +1 -1
  327. package/dist/memory/history.js +129 -45
  328. package/dist/memory/history.js.map +1 -1
  329. package/dist/memory/index.d.ts +13 -11
  330. package/dist/memory/index.d.ts.map +1 -1
  331. package/dist/memory/index.js +38 -3
  332. package/dist/memory/index.js.map +1 -1
  333. package/dist/memory/query.d.ts +161 -19
  334. package/dist/memory/query.d.ts.map +1 -1
  335. package/dist/memory/query.js +435 -55
  336. package/dist/memory/query.js.map +1 -1
  337. package/dist/memory/schema.d.ts +52 -3
  338. package/dist/memory/schema.d.ts.map +1 -1
  339. package/dist/memory/schema.js +132 -8
  340. package/dist/memory/schema.js.map +1 -1
  341. package/dist/memory/state-machine.d.ts +65 -10
  342. package/dist/memory/state-machine.d.ts.map +1 -1
  343. package/dist/memory/state-machine.js +136 -48
  344. package/dist/memory/state-machine.js.map +1 -1
  345. package/dist/memory/submit.d.ts +52 -3
  346. package/dist/memory/submit.d.ts.map +1 -1
  347. package/dist/memory/submit.js +118 -11
  348. package/dist/memory/submit.js.map +1 -1
  349. package/dist/storage/build-stamp.d.ts +18 -0
  350. package/dist/storage/build-stamp.d.ts.map +1 -0
  351. package/dist/storage/build-stamp.js +68 -0
  352. package/dist/storage/build-stamp.js.map +1 -0
  353. package/dist/storage/builtin-adapters.d.ts +32 -0
  354. package/dist/storage/builtin-adapters.d.ts.map +1 -0
  355. package/dist/storage/builtin-adapters.js +100 -0
  356. package/dist/storage/builtin-adapters.js.map +1 -0
  357. package/dist/storage/builtin-directives.d.ts +0 -29
  358. package/dist/storage/builtin-directives.d.ts.map +1 -1
  359. package/dist/storage/builtin-directives.js +9 -4
  360. package/dist/storage/builtin-directives.js.map +1 -1
  361. package/dist/storage/commit.d.ts +310 -3
  362. package/dist/storage/commit.d.ts.map +1 -1
  363. package/dist/storage/commit.js +807 -33
  364. package/dist/storage/commit.js.map +1 -1
  365. package/dist/storage/document.d.ts +6 -0
  366. package/dist/storage/document.d.ts.map +1 -1
  367. package/dist/storage/document.js +10 -1
  368. package/dist/storage/document.js.map +1 -1
  369. package/dist/storage/dry-run.d.ts +65 -0
  370. package/dist/storage/dry-run.d.ts.map +1 -0
  371. package/dist/storage/dry-run.js +150 -0
  372. package/dist/storage/dry-run.js.map +1 -0
  373. package/dist/storage/errors.d.ts +26 -0
  374. package/dist/storage/errors.d.ts.map +1 -1
  375. package/dist/storage/errors.js +27 -1
  376. package/dist/storage/errors.js.map +1 -1
  377. package/dist/storage/frontmatter.d.ts +1 -1
  378. package/dist/storage/frontmatter.js +1 -1
  379. package/dist/storage/git-read.d.ts +64 -0
  380. package/dist/storage/git-read.d.ts.map +1 -0
  381. package/dist/storage/git-read.js +107 -0
  382. package/dist/storage/git-read.js.map +1 -0
  383. package/dist/storage/index.d.ts +13 -5
  384. package/dist/storage/index.d.ts.map +1 -1
  385. package/dist/storage/index.js +39 -2
  386. package/dist/storage/index.js.map +1 -1
  387. package/dist/storage/layout.d.ts +2 -2
  388. package/dist/storage/layout.d.ts.map +1 -1
  389. package/dist/storage/layout.js +2 -7
  390. package/dist/storage/layout.js.map +1 -1
  391. package/dist/storage/memory-path.d.ts +18 -5
  392. package/dist/storage/memory-path.d.ts.map +1 -1
  393. package/dist/storage/memory-path.js +41 -5
  394. package/dist/storage/memory-path.js.map +1 -1
  395. package/dist/storage/snapshot.js +1 -1
  396. package/dist/storage/templates.d.ts +33 -6
  397. package/dist/storage/templates.d.ts.map +1 -1
  398. package/dist/storage/templates.js +182 -17
  399. package/dist/storage/templates.js.map +1 -1
  400. package/dist/validation/config-version.d.ts +19 -0
  401. package/dist/validation/config-version.d.ts.map +1 -0
  402. package/dist/validation/config-version.js +53 -0
  403. package/dist/validation/config-version.js.map +1 -0
  404. package/dist/validation/diagnostic.d.ts +40 -0
  405. package/dist/validation/diagnostic.d.ts.map +1 -0
  406. package/dist/validation/diagnostic.js +41 -0
  407. package/dist/validation/diagnostic.js.map +1 -0
  408. package/dist/validation/format.d.ts +74 -0
  409. package/dist/validation/format.d.ts.map +1 -0
  410. package/dist/validation/format.js +104 -0
  411. package/dist/validation/format.js.map +1 -0
  412. package/dist/validation/id.d.ts +40 -0
  413. package/dist/validation/id.d.ts.map +1 -1
  414. package/dist/validation/id.js +99 -12
  415. package/dist/validation/id.js.map +1 -1
  416. package/dist/validation/identity.d.ts +40 -0
  417. package/dist/validation/identity.d.ts.map +1 -0
  418. package/dist/validation/identity.js +78 -0
  419. package/dist/validation/identity.js.map +1 -0
  420. package/dist/validation/index.d.ts +9 -3
  421. package/dist/validation/index.d.ts.map +1 -1
  422. package/dist/validation/index.js +33 -1
  423. package/dist/validation/index.js.map +1 -1
  424. package/dist/validation/secret-scan.d.ts +10 -7
  425. package/dist/validation/secret-scan.d.ts.map +1 -1
  426. package/dist/validation/secret-scan.js +39 -16
  427. package/dist/validation/secret-scan.js.map +1 -1
  428. package/dist/validation/warning.d.ts +30 -16
  429. package/dist/validation/warning.d.ts.map +1 -1
  430. package/dist/validation/warning.js +74 -7
  431. package/dist/validation/warning.js.map +1 -1
  432. package/dist/workflow/bindings.d.ts +152 -0
  433. package/dist/workflow/bindings.d.ts.map +1 -0
  434. package/dist/workflow/bindings.js +249 -0
  435. package/dist/workflow/bindings.js.map +1 -0
  436. package/dist/workflow/create.d.ts +13 -0
  437. package/dist/workflow/create.d.ts.map +1 -0
  438. package/dist/workflow/create.js +41 -0
  439. package/dist/workflow/create.js.map +1 -0
  440. package/dist/workflow/deduce.d.ts +400 -0
  441. package/dist/workflow/deduce.d.ts.map +1 -0
  442. package/dist/workflow/deduce.js +1109 -0
  443. package/dist/workflow/deduce.js.map +1 -0
  444. package/dist/workflow/manifest-edit.d.ts +19 -0
  445. package/dist/workflow/manifest-edit.d.ts.map +1 -0
  446. package/dist/workflow/manifest-edit.js +124 -0
  447. package/dist/workflow/manifest-edit.js.map +1 -0
  448. package/dist/workflow/schema.d.ts +158 -19
  449. package/dist/workflow/schema.d.ts.map +1 -1
  450. package/dist/workflow/schema.js +190 -16
  451. package/dist/workflow/schema.js.map +1 -1
  452. package/package.json +37 -13
@@ -1,10 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CONFIGURATION_SCOPES = exports.MEMORY_OPERATIONS = void 0;
3
4
  exports.isValidAttribution = isValidAttribution;
4
5
  exports.auditAttribution = auditAttribution;
5
6
  exports.parseCommitReason = parseCommitReason;
6
7
  exports.parseApprovalMetadata = parseApprovalMetadata;
8
+ exports.parseMemoryOperation = parseMemoryOperation;
7
9
  exports.reconstructMemoryTransitions = reconstructMemoryTransitions;
10
+ exports.parseBracketHops = parseBracketHops;
8
11
  exports.verifyTransitionConsistency = verifyTransitionConsistency;
9
12
  /**
10
13
  * Audit-trail verification & reconstruction (task-015-complete-audit-trail, REQ-SEC-02) — the
@@ -37,36 +40,43 @@ exports.verifyTransitionConsistency = verifyTransitionConsistency;
37
40
  * - "Recomputing an element's state at any historical commit ... agrees with the transition history
38
41
  * derived from git log ... no drift" -> {@link verifyTransitionConsistency}.
39
42
  */
40
- const child_process_1 = require("child_process");
41
43
  const core_1 = require("../core");
42
44
  const validation_1 = require("../validation");
43
45
  const commit_message_1 = require("./commit-message");
44
46
  const history_1 = require("./history");
47
+ const schema_1 = require("./schema");
48
+ const state_machine_1 = require("./state-machine");
45
49
  const git_log_1 = require("./git-log");
46
50
  const storage_1 = require("../storage");
47
- const EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@()]+$/;
48
- // The literal marker git itself appends to an author email when it falls back to a guessed identity
49
- // (user@hostname) and cannot determine a real domain — e.g. "root@buildhost.(none)". A commit
50
- // carrying this is not a deliberately-configured identity, so it counts as "unknown author".
51
- const GIT_GUESSED_DOMAIN_MARKER = '.(none)';
52
51
  /**
53
52
  * Whether `name`/`email` look like a real, deliberately-configured git identity rather than an
54
53
  * empty or git-guessed placeholder, as recorded on a *historical* commit. The base check — non-empty
55
54
  * `name` AND non-empty `email` — is NOT re-derived here: it delegates to
56
55
  * {@link isConfiguredIdentity} from `src/core/git-identity.ts`, the single source of truth also used
57
56
  * by `requireGitIdentity`'s write-time precondition (REQ-SEC-01). On top of that shared base, this
58
- * audit (REQ-SEC-02) layers two read-only augmentations that only make sense when inspecting
57
+ * audit (REQ-SEC-02) layers three read-only augmentations that only make sense when inspecting
59
58
  * *historical* commits rather than live config — `requireGitIdentity` has no need for either, because
60
59
  * it only ever looks at the identity a caller is about to write with:
61
60
  *
62
- * - Rejects the `GIT_GUESSED_DOMAIN_MARKER` (`.(none)`): git appends this to an author email when it
61
+ * - Rejects git's guessed-domain marker (`.(none)`): git appends this to an author email when it
63
62
  * fell back to a guessed identity at commit time. `requireGitIdentity` now PREVENTS this going
64
63
  * forward (task-014), but older history predating that guard can still carry it, so the read audit
65
64
  * must flag it — it is a legacy-history concern, not part of the live write-time rule.
66
- * - Rejects a non-empty-but-malformed email (`EMAIL_RE`): `requireGitIdentity` never needs this check
65
+ * - Rejects a non-empty-but-malformed email (one `@`, a dotted domain, no whitespace, no parenthesis in
66
+ * the top-level label): `requireGitIdentity` never needs this check
67
67
  * because it only reads a git config value (itself always syntactically well-formed or absent);
68
68
  * historical commit authors, however, can carry hand-edited or otherwise malformed values, so the
69
69
  * audit validates the shape too.
70
+ * - Rejects an email on an RFC 2606 reserved top-level domain (`.invalid`, `.example`, `.test`,
71
+ * `.localhost`; task-132, `bug-153`): such an address names no mailbox, so a commit carrying it is
72
+ * as unattributed as one carrying `.(none)`. Only the top-level label counts — `test.example.com`
73
+ * is an ordinary domain. The write-time check does not apply this rule: test fixtures and scratch
74
+ * repositories commit under these domains on purpose, and the audit is where they must show up.
75
+ *
76
+ * The three augmentations, with a blank-name check the base already covers, are
77
+ * {@link isAttributableIdentity} (`src/validation/identity.ts`, task-260, `bug-261`), the rule the
78
+ * `team.agents` schema applies too: after the base check this function adds nothing else, so an agent
79
+ * identity `dna.yaml` accepts is one this audit accepts.
70
80
  *
71
81
  * Pure predicate — no filesystem/git access.
72
82
  */
@@ -75,9 +85,7 @@ function isValidAttribution(name, email) {
75
85
  const trimmedEmail = email.trim();
76
86
  if (!(0, core_1.isConfiguredIdentity)(trimmedName, trimmedEmail))
77
87
  return false;
78
- if (trimmedEmail.includes(GIT_GUESSED_DOMAIN_MARKER))
79
- return false;
80
- return EMAIL_RE.test(trimmedEmail);
88
+ return (0, validation_1.isAttributableIdentity)(trimmedName, trimmedEmail);
81
89
  }
82
90
  const AUDIT_LOG_FIELDS = ['%H', '%an', '%ae', '%aI', '%s'];
83
91
  /**
@@ -86,20 +94,26 @@ const AUDIT_LOG_FIELDS = ['%H', '%an', '%ae', '%aI', '%s'];
86
94
  * REQ-SEC-02's "0 'unknown author'" fit criterion. `pathspecs` is sorted before being passed to git
87
95
  * so the invocation itself is deterministic regardless of caller-supplied order (REQ-SYS-07); a
88
96
  * commit touching more than one of the given pathspecs still appears exactly once (git's own log
89
- * de-duplicates by commit, not by path). Returns `[]` (never throws) when none of `pathspecs` has
90
- * any history, mirroring {@link getMemoryHistory}.
97
+ * de-duplicates by commit, not by path). Returns `[]` when none of `pathspecs` has any history,
98
+ * mirroring {@link getMemoryHistory}; a git read that fails throws `StorageError`
99
+ * `E_GIT_READ_FAILED` rather than passing for a clean, empty audit (task-142, `bug-072`).
91
100
  */
92
101
  function auditAttribution(root, pathspecs) {
93
102
  const sortedPathspecs = [...pathspecs].sort();
94
103
  const records = (0, git_log_1.walkGitLogFields)(root, AUDIT_LOG_FIELDS, sortedPathspecs);
95
- return records.map(([sha = '', authorName = '', authorEmail = '', date = '', subject = '']) => ({
96
- sha,
97
- authorName,
98
- authorEmail,
99
- date,
100
- subject,
101
- valid: isValidAttribution(authorName, authorEmail),
102
- }));
104
+ // `walkGitLogFields` returns records of exactly `AUDIT_LOG_FIELDS.length` entries, never fewer.
105
+ return records.map((record) => {
106
+ const authorName = record[1];
107
+ const authorEmail = record[2];
108
+ return {
109
+ sha: record[0],
110
+ authorName,
111
+ authorEmail,
112
+ date: record[3],
113
+ subject: record[4],
114
+ valid: isValidAttribution(authorName, authorEmail),
115
+ };
116
+ });
103
117
  }
104
118
  /**
105
119
  * The identity on an `Approver:` trailer line. Applied to that ONE line — located by
@@ -113,7 +127,7 @@ const APPROVER_LINE_RE = /^Approver:\s*(.+?)\s*<([^>]+)>\s*\(([^)]+)\)\s*$/;
113
127
  * `add`/`submit` body, which carries no trailer by convention), or carries a bare `Reason:` with no
114
128
  * value. Split out of {@link parseApprovalMetadata} by `task-049-memory-history` (P1.10) because the
115
129
  * two trailers do not always travel together: an APPROVAL-gate commit (`approve`/`reject`) must carry
116
- * both `Approver:` and `Reason:` (CLAUDE.md §5.1, P1.7), but a `deprecate` commit records a `Reason:`
130
+ * both `Approver:` and `Reason:` (AGENTS.md §5.1, P1.7), but a `deprecate` commit records a `Reason:`
117
131
  * with **no** `Approver:` line at all — deprecate is explicitly not an approval gate. Reading the
118
132
  * reason through `parseApprovalMetadata` would therefore drop every deprecate reason from the audit
119
133
  * trail it exists to surface.
@@ -134,7 +148,7 @@ function parseCommitReason(body) {
134
148
  }
135
149
  /**
136
150
  * Parse a commit body for the `Approver: Name <email> (role)` and `Reason: ...` trailers
137
- * (CLAUDE.md §5.1; REQ-SEC-02/REQ-SEC-04). Returns `null` when there is no `Approver:` trailer line —
151
+ * (AGENTS.md §5.1; REQ-SEC-02/REQ-SEC-04). Returns `null` when there is no `Approver:` trailer line —
138
152
  * e.g. for a plain `add`/`submit` body, or a `deprecate` one (not an approval gate), neither of which
139
153
  * records an approval at all. A caller that wants such a commit's reason wants
140
154
  * {@link parseCommitReason} instead.
@@ -153,72 +167,155 @@ function parseApprovalMetadata(body) {
153
167
  const approverMatch = approverLine === null ? null : APPROVER_LINE_RE.exec(approverLine);
154
168
  if (!approverMatch)
155
169
  return null;
156
- const [, approverName = '', approverEmail = '', approverRole = ''] = approverMatch;
157
- return { approverName, approverEmail, approverRole, reason: parseCommitReason(body) };
170
+ // The three groups of APPROVER_LINE_RE are not optional: a match always defines all of them.
171
+ return {
172
+ approverName: approverMatch[1],
173
+ approverEmail: approverMatch[2],
174
+ approverRole: approverMatch[3],
175
+ reason: parseCommitReason(body),
176
+ };
158
177
  }
159
- const OPERATION_RE = /^wf\([^)]+\):\s*(add|submit|approve|reject|deprecate)\b/;
178
+ // --- Full transition reconstruction (`memory history`, P1.10) --------------------------------
179
+ /**
180
+ * The closed, declared list of Memory operation verbs a `wf({type}): {verb} …` subject may carry
181
+ * (`dl-079` (A), `spec-008-cli-grammar` §2, `spec-003` verb table): the five CLI verbs, the three
182
+ * workflow verbs of practice (`start`, `finalize`, `sync`), `amend` (`dl-108`), `park` (`dl-110`),
183
+ * and `assign` (`element.set_release`, approver ruling 2026-10-01). No other verb is a Memory
184
+ * operation. Ordered as `spec-008` §2 lists them (REQ-SYS-07).
185
+ */
186
+ exports.MEMORY_OPERATIONS = [
187
+ 'add',
188
+ 'submit',
189
+ 'approve',
190
+ 'reject',
191
+ 'deprecate',
192
+ 'start',
193
+ 'finalize',
194
+ 'sync',
195
+ 'amend',
196
+ 'park',
197
+ 'assign',
198
+ ];
199
+ /**
200
+ * The `wf({scope})` scopes that record a change to **configuration**, not to a Memory element
201
+ * (`spec-008` §2): `wf(dna): set|add|update|remove …` (`dna` mutations), `wf(directive):
202
+ * create|assign|remove …` and `wf(workflow): create|remove …` (`spec-017` §7.7–7.8). Their verbs are
203
+ * not Memory operations even where the token coincides with one (`wf(dna): add <field>`), and their
204
+ * subjects carry no transition. No `memory.yaml` type may take one of these names: this list is the
205
+ * schema's {@link RESERVED_TYPE_NAMES} (`spec-001`, `bug-177`), which `MemoryYaml` refuses at load time,
206
+ * because a type that took one would have every commit of its own read as configuration.
207
+ */
208
+ exports.CONFIGURATION_SCOPES = schema_1.RESERVED_TYPE_NAMES;
209
+ /**
210
+ * A `wf({scope}): {token}` subject: the scope, and the verb token — everything after `: ` up to the
211
+ * first whitespace. Taking the whole token, rather than a declared verb followed by a word boundary,
212
+ * is what keeps a practised compound verb such as `start-fix` from reading as `start`.
213
+ */
214
+ const WF_SUBJECT_RE = /^wf\(([^)]*)\):\s*(\S+)/;
215
+ /**
216
+ * `assign`'s one canonical subject (`spec-008` §2): `wf({type}): assign release {version} to {id1},
217
+ * {id2}…`, with no bracket — the form the four practised `assign` commits already have. `assign` writes
218
+ * only the `release` field, so a subject that names anything else, or carries a bracket, is not one.
219
+ */
220
+ const ASSIGN_SUBJECT_RE = /^wf\([^)]*\):\s*assign release \S+ to [^[\]\s][^[\]]*$/;
160
221
  /**
161
- * Read `historicalPath`'s frontmatter `status:` field as it existed at `sha` (`git show sha:path`),
162
- * without validating it against any type's Zod schema — this is a historical-snapshot read, not a
163
- * live document validation. Returns `null` if the path didn't exist at `sha`, has no frontmatter
164
- * block, or the frontmatter has no string `status` field.
222
+ * The Memory operation a commit subject declares, or `null` — for a subject outside the `wf()`
223
+ * grammar (`workflow: finalize …`, `agent: record …`, `docs(…): …`), a configuration scope
224
+ * ({@link CONFIGURATION_SCOPES}), or a verb outside {@link MEMORY_OPERATIONS}. The practised verbs the
225
+ * declared list leaves out (`start-fix`, `schedule`, `plan`, `enter-releasing`, `mark-released`,
226
+ * `deferred`, and the early verbless `wf(task): {id} [a → b]`), and an `assign` subject outside its
227
+ * canonical form, keep reading as `null`: the
228
+ * history is not rewritten, and the reader does not guess (`dl-035`, `dl-079`).
229
+ */
230
+ function parseMemoryOperation(subject) {
231
+ const match = WF_SUBJECT_RE.exec(subject);
232
+ if (!match)
233
+ return null;
234
+ // Both groups always participate in a match of WF_SUBJECT_RE.
235
+ const scope = match[1];
236
+ const verb = match[2];
237
+ if (exports.CONFIGURATION_SCOPES.includes(scope))
238
+ return null;
239
+ if (verb === 'assign' && !ASSIGN_SUBJECT_RE.test(subject))
240
+ return null;
241
+ return exports.MEMORY_OPERATIONS.includes(verb) ? verb : null;
242
+ }
243
+ /**
244
+ * Parse a document's frontmatter `status:` field out of `raw` — its bytes at one revision, from
245
+ * {@link reconstructMemoryTransitions}' batched read — without validating it against any type's Zod
246
+ * schema: this is a historical-snapshot read, not a live document validation. Its `status` is `null`
247
+ * if the revision does not hold the path (`raw` is `null`), has no frontmatter block, or the
248
+ * frontmatter has no string `status` field. A frontmatter that does not parse is returned as
249
+ * `unreadable`, never thrown here (task-171, `bug-188`): one bad revision used to make the whole
250
+ * history unreadable.
165
251
  *
166
- * `historicalPath` is the path the element occupied **at that commit** — `MemoryHistoryEntry.path`,
167
- * produced by the same `--follow` walk that selected the commit — never the caller's current path.
168
- * Passing the current one was `bug-080-read-status-at-reads-the-current-path-at-pre-rename-commits`:
169
- * every commit older than a rename asked git for a path that tree does not contain, the read failed,
170
- * and the transition reported `null` states. `dl-080` — a read that gates an operation resolves at
171
- * `HEAD` — does not reach here: this read gates nothing, and its subject is by construction *other*
172
- * commits.
252
+ * The path read is the one the element occupied **at that revision** — `MemoryHistoryEntry.path` for
253
+ * the commit, `MemoryHistoryEntry.parentPath` for its first parent, both produced by the same
254
+ * `--follow` walk that selected the commit — never the caller's current path. Passing the current one
255
+ * was `bug-080-read-status-at-reads-the-current-path-at-pre-rename-commits`: every commit older than a
256
+ * rename asked git for a path that tree does not contain, the read failed, and the transition reported
257
+ * `null` states. `dl-080` — a read that gates an operation resolves at `HEAD` — does not reach here:
258
+ * this read gates nothing, and its subject is by construction *other* commits.
173
259
  *
174
- * The explicit `stdio` is `bug-071-read-status-at-leaks-git-stderr`, and it is not made redundant by
175
- * the paragraph above. `execFileSync` hands the child this process's own stderr by default, so on
176
- * the failure that remains legitimate — a commit where the document genuinely does not exist, before
177
- * its creation or after a deletion — git's `fatal: path ... does not exist in '<sha>'` went straight
178
- * to the operator's terminal while the command reported success. Capturing it into a pipe this
179
- * process owns (and discarding it, the failure being handled right here) is what keeps a genuine
180
- * `fatal:` distinguishable from a routine one — that line is how `bug-050`'s forged history
181
- * announced itself.
260
+ * The bytes come from `readRevisionPaths` (`src/storage`, one `git cat-file --batch` for the whole
261
+ * history, `task-278`), so git's stderr lands in a pipe this process owns rather than on the
262
+ * operator's terminal (`bug-071-read-status-at-leaks-git-stderr`). A revision that does not hold the
263
+ * path answers `null`: that is the legitimate case — a commit before the element's creation or after a
264
+ * deletion, the parent of a root commit — and git answers `missing` for it as for an object it cannot
265
+ * read, so this read cannot tell the two apart, and does not try (`bug-097`). What catches a broken
266
+ * walk is the walk itself: `getMemoryHistory` throws when its own `git log` fails, and
267
+ * `dropPreCreationAncestry` when the creation probe and the walk disagree (`task-089`). A batch that
268
+ * cannot run throws `StorageError` `E_GIT_READ_FAILED`.
182
269
  */
183
- function readStatusAt(root, sha, historicalPath) {
184
- let raw;
270
+ function parseStatus(raw, label) {
271
+ if (raw === null)
272
+ return { status: null };
273
+ const { frontmatter } = (0, storage_1.splitFrontmatter)(raw);
274
+ if (!frontmatter)
275
+ return { status: null };
276
+ let parsed;
185
277
  try {
186
- raw = (0, child_process_1.execFileSync)('git', ['-C', root, 'show', `${sha}:${historicalPath}`], {
187
- encoding: 'utf-8',
188
- stdio: ['ignore', 'pipe', 'pipe'],
189
- });
278
+ parsed = (0, validation_1.parseYaml)(frontmatter, label);
190
279
  }
191
- catch {
192
- return null;
280
+ catch (error) {
281
+ // task-171 (`bug-188`): the caller decides what an unreadable revision means — a history entry
282
+ // with no state, or (for the consistency check) a refusal. `parseYaml` throws only
283
+ // `ValidationError.yamlParse`.
284
+ return { status: null, unreadable: error };
193
285
  }
194
- const { frontmatter } = (0, storage_1.splitFrontmatter)(raw);
195
- if (!frontmatter)
196
- return null;
197
- const parsed = (0, validation_1.parseYaml)(frontmatter, `${historicalPath}@${sha}`);
198
286
  if (parsed === null || typeof parsed !== 'object')
199
- return null;
287
+ return { status: null };
200
288
  const status = parsed.status;
201
- return typeof status === 'string' ? status : null;
289
+ return { status: typeof status === 'string' ? status : null };
202
290
  }
203
291
  /**
204
292
  * Reconstruct every transition `relativePath` went through, oldest first, entirely from git log
205
- * (`getMemoryHistory`) plus a frontmatter read at each commit (`git show`) — no separate log file
206
- * (ADR-007). This is the derivation `wingfoil memory history` (P1.10) renders — `src/core`'s
293
+ * (`getMemoryHistory`) plus a frontmatter read at each commit and at its first parent (one `git
294
+ * cat-file --batch`) — no separate log file (ADR-007). This is the derivation `wingfoil memory history` (P1.10) renders — `src/core`'s
207
295
  * `memoryHistory` operation (`task-049-memory-history`) renames and string-formats these fields into
208
296
  * its own entry shape, deriving no further state of its own; this function is the reconstruction
209
297
  * itself, not that command's output formatting.
210
298
  *
211
299
  * **Renames are followed on both halves of the derivation**, which is the correction
212
300
  * `task-097-memory-history-reads-each-commit-at-its-historical-path` made. `getMemoryHistory` always
213
- * walked with `git log --follow`, so it *found* the commits preceding a rename; `readStatusAt` then
214
- * read each of them at the CURRENT path, which those trees do not contain, so all of them reported
215
- * `null` states (`bug-080-…`). The walk now carries the path each commit actually used
301
+ * walked with `git log --follow`, so it *found* the commits preceding a rename; the read then read
302
+ * each of them at the CURRENT path, which those trees do not contain, so all of them reported `null`
303
+ * states (`bug-080-…`). The walk now carries the path each commit actually used
216
304
  * (`MemoryHistoryEntry.path`, from `--follow --name-status`) and this function reads at that path —
217
305
  * the walk is the source of truth for "where was this file at this commit", and the read no longer
218
306
  * guesses.
219
307
  *
308
+ * **`fromState` is read in the commit's first parent** (`task-278`, `bug-308`), at the path that parent
309
+ * used (`MemoryHistoryEntry.parentPath`: a rename's source; `null` for a creation, which reads no
310
+ * parent), never taken from the walk's previous entry. The walk is ordered by commit date, not by
311
+ * ancestry: an `amend` on `main` made while the same element was started on a task branch is walked
312
+ * after the branch's `start`, so the previous entry made it read `in-progress → backlog` although its
313
+ * parent and its own revision both hold `backlog` — and the governance check failed it (`d818c0dd`).
314
+ * A merge commit, which `git log --follow` does not list in that shape, would be judged against its
315
+ * first parent too. On a linear history the two readings agree.
316
+ *
220
317
  * This was never the hypothetical the TSDoc here used to call "a documented edge case, not a live
221
- * defect": `docs/self/docs/04_memory/planning/v1/*` became `planning/rl-v1/*` in a single commit,
318
+ * defect": the Memory folder's `planning/v1/*` became `planning/rl-v1/*` in a single commit,
222
319
  * moving five `release` elements at once, precisely BECAUSE the `release` type's `path` pattern
223
320
  * interpolates a component — the release-line id — that itself changed. Any edit to a `path`
224
321
  * pattern, or to an id one interpolates, renames documents.
@@ -226,62 +323,135 @@ function readStatusAt(root, sha, historicalPath) {
226
323
  * `toState` is still `null` where a commit in the walk genuinely has no document to read — before
227
324
  * the element's creation, or after a deletion. That is a legitimate answer, distinct from the defect
228
325
  * above, and it no longer arrives with a `fatal:` on the operator's stderr (`bug-071`; see
229
- * {@link readStatusAt}).
326
+ * {@link parseStatus}).
230
327
  */
231
- function reconstructMemoryTransitions(root, relativePath) {
328
+ function reconstructMemoryTransitions(root, relativePath, options = {}) {
329
+ const strict = options.strict === true;
232
330
  const history = (0, history_1.getMemoryHistory)(root, relativePath); // oldest first already
331
+ // Each commit is read twice — at itself, and at its first parent where the document was before it
332
+ // (`task-278`, `bug-308`) — all in one batch. A creation has no parent read: its `fromState` is null.
333
+ const requests = [];
334
+ for (const entry of history) {
335
+ requests.push({ rev: entry.sha, path: entry.path });
336
+ if (entry.parentPath !== null)
337
+ requests.push({ rev: `${entry.sha}^1`, path: entry.parentPath });
338
+ }
339
+ // One answer per request, in request order (`readRevisionPaths`).
340
+ const raws = (0, storage_1.readRevisionPaths)(root, requests);
233
341
  const transitions = [];
234
- let previousState = null;
342
+ let next = 0;
235
343
  for (const entry of history) {
236
- const toState = readStatusAt(root, entry.sha, entry.path);
237
- const operationMatch = OPERATION_RE.exec(entry.subject);
344
+ const read = parseStatus(raws[next++], `${entry.path}@${entry.sha}`);
345
+ const before = entry.parentPath === null ? { status: null } : parseStatus(raws[next++], `${entry.parentPath}@${entry.sha}^1`);
346
+ // Strict: neither the commit's revision nor its parent's may go unread (task-171, `bug-188`).
347
+ const strictFailure = read.unreadable ?? before.unreadable;
348
+ if (strict && strictFailure !== undefined)
349
+ throw strictFailure;
350
+ const unreadable = read.unreadable?.issues[0]?.message ?? read.unreadable?.message;
238
351
  transitions.push({
239
352
  sha: entry.sha,
240
353
  authorName: entry.authorName,
241
354
  authorEmail: entry.authorEmail,
242
355
  date: entry.date,
243
356
  subject: entry.subject,
244
- operation: operationMatch?.[1] ?? null,
245
- fromState: previousState,
246
- toState,
357
+ operation: parseMemoryOperation(entry.subject),
358
+ fromState: before.status,
359
+ toState: read.status,
247
360
  approval: parseApprovalMetadata(entry.body),
248
361
  reason: parseCommitReason(entry.body),
362
+ wingfoil: (0, commit_message_1.parseVersionTrailer)(entry.body),
363
+ ...(unreadable !== undefined ? { unreadable: unreadable.split('\n')[0].trim() } : {}),
249
364
  });
250
- previousState = toState;
251
365
  }
252
366
  return transitions;
253
367
  }
254
- // Matches the `[old-state → new-state]` bracket CLAUDE.md §5.1 mandates on approve/reject/deprecate
255
- // subjects (the arrow is the U+2192 character used throughout CLAUDE.md/the memory templates).
256
- const BRACKET_RE = /\[([^[\]→]+?)\s*→\s*([^[\]]+?)\]\s*$/;
368
+ // The trailing `[…]` bracket of a subject — the transition bracket `spec-008` §2 declares, written at
369
+ // the end of the subject. Its content is split into states by {@link BRACKET_ARROW_RE}.
370
+ const TRAILING_BRACKET_RE = /\[([^[\]]*)\]\s*$/;
371
+ // The arrows a bracket's states are separated by: the canonical U+2192, which `./commit-message.ts`
372
+ // writes, and the ASCII `->`, read as its equivalent because hand-written history carries it
373
+ // (`bug-137`). Surrounding whitespace belongs to the arrow.
374
+ const BRACKET_ARROW_RE = /\s*(?:→|->)\s*/;
375
+ // A subject in the Memory commit grammar (`wf({type}): …`) that contains any bracket character — the
376
+ // set of subjects whose trailing bracket must either parse as a transition or be reported as
377
+ // unparseable.
378
+ const WF_SUBJECT_WITH_BRACKET_RE = /^wf\([^)]*\):.*[[\]]/;
379
+ /**
380
+ * The hops a subject's trailing bracket names, in order — one for `[a → b]`, more for a chain
381
+ * (`[a → b → c]`, `spec-008` §2: `sync` may chain) — or `null` when there is no trailing bracket, or
382
+ * it is not a transition: fewer than two states, or an empty one anywhere. Never an empty array.
383
+ * Exported for the governance check (`scripts/check-governance.cjs`, `task-167`), which judges a
384
+ * single hop against the machine where {@link verifyTransitionConsistency} judges only a chain's.
385
+ */
386
+ function parseBracketHops(subject) {
387
+ const match = TRAILING_BRACKET_RE.exec(subject);
388
+ if (!match)
389
+ return null;
390
+ // The group always participates in a match of TRAILING_BRACKET_RE.
391
+ const states = match[1].split(BRACKET_ARROW_RE).map((state) => state.trim());
392
+ if (states.length < 2 || states.some((state) => state === ''))
393
+ return null;
394
+ return states.slice(1).map((to, index) => ({ from: states[index], to }));
395
+ }
257
396
  /**
258
- * Cross-check, for every transition that carries a `[old → new]` bracket in its subject (`approve`/
259
- * `reject`/`deprecate`, per CLAUDE.md §5.1 — a plain `add`/`submit` subject has no bracket and is
260
- * skipped), that the bracket's declared states agree with the states independently derived from the
261
- * document's own frontmatter at that commit ({@link reconstructMemoryTransitions}). Returns `[]` when
262
- * every bracketed transition agrees — REQ-SEC-02/REQ-STATE-02's "no drift between the two views";
263
- * any entry in the returned array is a genuine inconsistency (e.g. a hand-edited commit message that
264
- * doesn't match what was actually written to disk).
397
+ * Cross-check, for every transition that carries a `[old → new]` bracket in its subject, that the
398
+ * bracket's declared states agree with the states independently derived from the document's own
399
+ * frontmatter at that commit ({@link reconstructMemoryTransitions}). A plain `add`/`submit` subject has
400
+ * no bracket and is skipped; so is every subject of a configuration scope
401
+ * ({@link CONFIGURATION_SCOPES}), which records no Memory transition.
402
+ *
403
+ * The bracket is read in either arrow form, `→` or `->`, with the same result, and may **chain**
404
+ * states (`spec-008` §2, `dl-079` (A)): `[a → b → c]` is declared from `a`, to `c` — the only two states
405
+ * the frontmatter can confirm — and, when `machine` (the element type's state machine, resolved by the
406
+ * caller from `memory.yaml`, REQ-STATE-08) is given, every hop of the chain must be an edge of it
407
+ * ({@link isMachineEdge}), or it is an {@link IllegalHop}. Without `machine` the hops cannot be judged
408
+ * and are not: the endpoints are still checked. A single-hop bracket's edge is not re-judged here — it
409
+ * is the write-time engine's to refuse (REQ-STATE-01), and `amend`'s `[s → s]` is a declared self-loop
410
+ * no machine contains.
411
+ *
412
+ * A `wf(…)` subject that carries a bracket readable in neither form is reported as an
413
+ * {@link UnparseableTransition} instead of being passed over; a subject outside the `wf(…)` grammar
414
+ * that merely quotes a bracket in prose is not. Returns `[]` when every bracketed transition was parsed
415
+ * and agrees — REQ-SEC-02/REQ-STATE-02's "no drift between the two views"; any entry is either a
416
+ * genuine inconsistency (e.g. a hand-edited commit message that doesn't match what was actually written
417
+ * to disk), a chain through a non-edge, or a bracket the check could not read.
265
418
  */
266
- function verifyTransitionConsistency(root, relativePath) {
267
- const transitions = reconstructMemoryTransitions(root, relativePath);
268
- const mismatches = [];
419
+ function verifyTransitionConsistency(root, relativePath, machine) {
420
+ // Strict: a revision whose frontmatter does not parse is thrown, never passed (task-171, `bug-188`).
421
+ const transitions = reconstructMemoryTransitions(root, relativePath, { strict: true });
422
+ const findings = [];
269
423
  for (const transition of transitions) {
270
- const match = BRACKET_RE.exec(transition.subject);
271
- if (!match)
424
+ const { sha, subject } = transition;
425
+ const scope = WF_SUBJECT_RE.exec(subject)?.[1];
426
+ if (scope !== undefined && exports.CONFIGURATION_SCOPES.includes(scope))
427
+ continue;
428
+ const hops = parseBracketHops(subject);
429
+ if (!hops) {
430
+ if (WF_SUBJECT_WITH_BRACKET_RE.test(subject)) {
431
+ findings.push({ kind: 'unparseable', sha, subject });
432
+ }
272
433
  continue;
273
- const [, declaredFromRaw = '', declaredToRaw = ''] = match;
274
- const declaredFrom = declaredFromRaw.trim();
275
- const declaredTo = declaredToRaw.trim();
434
+ }
435
+ // parseBracketHops never returns an empty array.
436
+ const declaredFrom = hops[0].from;
437
+ const declaredTo = hops[hops.length - 1].to;
276
438
  if (declaredFrom !== transition.fromState || declaredTo !== transition.toState) {
277
- mismatches.push({
278
- sha: transition.sha,
279
- subject: transition.subject,
439
+ findings.push({
440
+ kind: 'mismatch',
441
+ sha,
442
+ subject,
280
443
  declared: { from: declaredFrom, to: declaredTo },
281
444
  derived: { from: transition.fromState, to: transition.toState },
282
445
  });
283
446
  }
447
+ if (machine && hops.length > 1) {
448
+ for (const hop of hops) {
449
+ if (!(0, state_machine_1.isMachineEdge)(machine, hop.from, hop.to)) {
450
+ findings.push({ kind: 'illegal-hop', sha, subject, hop: { from: hop.from, to: hop.to } });
451
+ }
452
+ }
453
+ }
284
454
  }
285
- return mismatches;
455
+ return findings;
286
456
  }
287
457
  //# sourceMappingURL=audit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"audit.js","sourceRoot":"","sources":["../../src/memory/audit.ts"],"names":[],"mappings":";;AAkFA,gDAMC;AAaD,4CAYC;AA+CD,8CAEC;AAkBD,sDAOC;AA4GD,oEAuBC;AAyBD,kEAuBC;AA9WD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,iDAA6C;AAE7C,kCAA+C;AAC/C,8CAA0C;AAE1C,qDAA8E;AAC9E,uCAA6C;AAC7C,uCAA6C;AAC7C,wCAA8C;AAgB9C,MAAM,QAAQ,GAAG,8BAA8B,CAAC;AAChD,oGAAoG;AACpG,8FAA8F;AAC9F,6FAA6F;AAC7F,MAAM,yBAAyB,GAAG,SAAS,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,kBAAkB,CAAC,IAAY,EAAE,KAAa;IAC5D,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAChC,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAClC,IAAI,CAAC,IAAA,2BAAoB,EAAC,WAAW,EAAE,YAAY,CAAC;QAAE,OAAO,KAAK,CAAC;IACnE,IAAI,YAAY,CAAC,QAAQ,CAAC,yBAAyB,CAAC;QAAE,OAAO,KAAK,CAAC;IACnE,OAAO,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,gBAAgB,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;AAE3D;;;;;;;;GAQG;AACH,SAAgB,gBAAgB,CAAC,IAAY,EAAE,SAA4B;IACzE,MAAM,eAAe,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,IAAI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