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
@@ -0,0 +1,83 @@
1
+ /**
2
+ * `wingfoil workflow status [<ref>]` (task-225; `spec-017` §5.1–§5.4, §7.4, §8 `StatusResult` /
3
+ * `PendingApproval`, §10, §11; BDD P4.5, P4.14, P4.15, X1.1, X1.2).
4
+ *
5
+ * **Baseline: `HEAD`, declared** (`spec-017` §1.1, approver ruling R15): the same snapshot and deduction
6
+ * `workflow next` answers from (`readDeductionSnapshotAtHead`, `deduceWorkflowState`), so the two never disagree;
7
+ * the working tree only explains (`W_UNCOMMITTED_INPUTS`, §1.2).
8
+ *
9
+ * **What it reports** (§7.4): every open instance, or the one `<ref>` selects — active first and marked — with its
10
+ * top-level phase progress, its frontier (each step built by `workflow next`'s `buildStep`), and its `late`
11
+ * candidates (§4.7); the **pending approvals** of those steps (§5.1), each routed to `dna.yaml` members; then the
12
+ * **ungated elements**: Memory elements sitting in a `gates` state of their type that no pending approval of **any**
13
+ * open instance carries. Nothing is recorded: a pending approval changes nothing in Memory (§5.1).
14
+ *
15
+ * **The v0.3 notification channel** (§5.3, ruling R13): the console view prints one "human needed" line per pending
16
+ * approval and per ungated element, naming the action (`approve or reject`, or `finalize` for an approval record),
17
+ * the element id(s) or the step key, and the routed members. An ungated element has no workflow to route it, so its
18
+ * line names the holders of the `approver` role, the one role that may decide it (REQ-SEC-03).
19
+ */
20
+ import type { Diagnostic } from '../validation';
21
+ import { type Baseline, type Deduction, type ElementRef, type Instance, type PhaseProgress, type TrailEntry } from '../workflow/deduce';
22
+ import { type CoreResult } from './types';
23
+ import { type Awaiting, type Member, type NextInputs, type Step } from './workflow-next';
24
+ /** One pending approval (`spec-017` §5.1, §8 `PendingApproval`): a frontier step whose approval awaits. */
25
+ export interface PendingApproval {
26
+ /** The step's key (§4.9). */
27
+ readonly step: string | null;
28
+ /** The instance the step belongs to. */
29
+ readonly instance: string | null;
30
+ readonly trail: readonly TrailEntry[];
31
+ readonly awaiting: Extract<Awaiting, {
32
+ readonly kind: 'approval';
33
+ }>;
34
+ }
35
+ /** One open instance as `status` reports it (`spec-017` §7.4, §8). */
36
+ export interface StatusEntry {
37
+ readonly instance: Instance;
38
+ readonly complete: boolean;
39
+ /** Its top-level phases (`complete` | `current` | `pending` | `skipped`). */
40
+ readonly phases: readonly PhaseProgress[];
41
+ /** Its frontier, in frontier order (§1.3). */
42
+ readonly frontier: readonly Step[];
43
+ /** The candidates a live query matched after a later phase closed it (§4.7). */
44
+ readonly late: readonly ElementRef[];
45
+ }
46
+ /** `workflow status`'s payload (`spec-017` §8). */
47
+ export interface StatusResult {
48
+ readonly baseline: Baseline;
49
+ /** The active instance's id (the most recently started open one), or `null`. */
50
+ readonly active: string | null;
51
+ readonly open: readonly StatusEntry[];
52
+ /** The pending approvals of the listed instances, in frontier order. */
53
+ readonly pendingApprovals: readonly PendingApproval[];
54
+ /** The elements in a gate state that no pending approval of an open instance carries, ascending `(type, id)`. */
55
+ readonly ungated: readonly ElementRef[];
56
+ /**
57
+ * Whom an ungated element's "human needed" line names (§5.3): no workflow routes it, so the holders of the
58
+ * `approver` role, the one role that may decide it (REQ-SEC-03), ascending `(name, email)`; `[]` when none does.
59
+ */
60
+ readonly ungatedRoutedTo: readonly Member[];
61
+ /** `no open workflows` when no instance is open (BDD P4.5 sc. 3), whatever is ungated. */
62
+ readonly message?: string;
63
+ readonly diagnostics: readonly Diagnostic[];
64
+ }
65
+ /**
66
+ * `workflow status`'s answer from one deduction (`spec-017` §7.4, §10). Pure. Exit `0` in every deduced case;
67
+ * `NOT_FOUND` for a `ref` naming no open instance — `workflow is not open: <ref>` for a loaded workflow or an
68
+ * instance plan, `unknown workflow: <ref>` otherwise, as `workflow next` (`unresolvedRef`).
69
+ */
70
+ export declare function statusWorkflow(inputs: NextInputs, deduction: Deduction, ref?: string): CoreResult<StatusResult>;
71
+ /**
72
+ * `workflow status [<ref>]` at `HEAD` (`spec-017` §7.4): the deduction snapshot (with `bindings.yaml` and
73
+ * `dna.yaml`), then `roles.yaml` and the directive files at the snapshot's commit, read only when a step is
74
+ * reported.
75
+ *
76
+ * @throws `DiagnosticsError` (`VALIDATION`) when the registry at `HEAD` has a `spec-003` error; a
77
+ * `ValidationError` for an invalid `roles.yaml` or directive file at `HEAD`; `StorageError` when git
78
+ * cannot answer.
79
+ */
80
+ export declare function workflowStatusAtHead(root: string, ref?: string): CoreResult<StatusResult>;
81
+ /** `workflow status`'s `--format console` rendering (`spec-017` §5.3, §8). Pure. */
82
+ export declare function renderStatusConsole(result: StatusResult): string;
83
+ //# sourceMappingURL=workflow-status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-status.d.ts","sourceRoot":"","sources":["../../src/core/workflow-status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAA2C,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,KAAK,QAAQ,EAAE,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGjL,OAAO,EAAU,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAWL,KAAK,QAAQ,EACb,KAAK,MAAM,EACX,KAAK,UAAU,EACf,KAAK,IAAI,EACV,MAAM,iBAAiB,CAAC;AAGzB,2GAA2G;AAC3G,MAAM,WAAW,eAAe;IAC9B,6BAA6B;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,wCAAwC;IACxC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;KAAE,CAAC,CAAC;CACrE;AAED,sEAAsE;AACtE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,QAAQ,E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.statusWorkflow = statusWorkflow;
4
+ exports.workflowStatusAtHead = workflowStatusAtHead;
5
+ exports.renderStatusConsole = renderStatusConsole;
6
+ const deduce_1 = require("../workflow/deduce");
7
+ const approval_authority_1 = require("./approval-authority");
8
+ const types_1 = require("./types");
9
+ const workflow_next_1 = require("./workflow-next");
10
+ const workflow_deduction_1 = require("./workflow-deduction");
11
+ /** `<type>:<id>`. */
12
+ function keyOf(element) {
13
+ return `${element.type}:${element.id}`;
14
+ }
15
+ /**
16
+ * `workflow status`'s answer from one deduction (`spec-017` §7.4, §10). Pure. Exit `0` in every deduced case;
17
+ * `NOT_FOUND` for a `ref` naming no open instance — `workflow is not open: <ref>` for a loaded workflow or an
18
+ * instance plan, `unknown workflow: <ref>` otherwise, as `workflow next` (`unresolvedRef`).
19
+ */
20
+ function statusWorkflow(inputs, deduction, ref) {
21
+ let shown = deduction.instances;
22
+ if (ref !== undefined) {
23
+ const selected = (0, deduce_1.resolveInstanceRef)(deduction, ref);
24
+ if (selected === null)
25
+ return (0, workflow_next_1.unresolvedRef)(inputs, ref);
26
+ shown = [selected];
27
+ }
28
+ const open = shown.map((entry) => ({
29
+ instance: entry.instance,
30
+ complete: entry.complete,
31
+ phases: entry.phases,
32
+ frontier: entry.frontier.map((step) => (0, workflow_next_1.buildStep)(step, inputs)),
33
+ late: entry.late,
34
+ }));
35
+ const steps = open.flatMap((entry) => entry.frontier);
36
+ const pendingApprovals = steps.flatMap((step) => step.awaiting?.kind === 'approval' ? [{ step: step.key, instance: step.instance, trail: step.trail, awaiting: step.awaiting }] : []);
37
+ // Carried by a pending approval of any open instance, `<ref>` or not (§5.1): its awaiting elements.
38
+ const carried = new Set(deduction.instances.flatMap((entry) => entry.frontier.flatMap((step) => (step.approval?.elements ?? []).map(keyOf))));
39
+ const ungated = deduction.gated.filter((element) => !carried.has(keyOf(element)));
40
+ // BDD P4.5 sc. 3: the message says no instance is open; the ungated elements are listed after it.
41
+ const nothing = deduction.instances.length === 0;
42
+ return (0, types_1.coreOk)({
43
+ baseline: deduction.baseline,
44
+ active: deduction.active,
45
+ open,
46
+ pendingApprovals,
47
+ ungated,
48
+ ungatedRoutedTo: (0, workflow_next_1.membersHoldingRole)(inputs.dnaYaml, approval_authority_1.APPROVER_ROLE),
49
+ ...(nothing ? { message: workflow_next_1.NO_OPEN_WORKFLOWS } : {}),
50
+ diagnostics: [...deduction.diagnostics, ...(0, workflow_next_1.approvalDiagnostics)(steps, inputs.dnaYaml)],
51
+ });
52
+ }
53
+ /**
54
+ * `workflow status [<ref>]` at `HEAD` (`spec-017` §7.4): the deduction snapshot (with `bindings.yaml` and
55
+ * `dna.yaml`), then `roles.yaml` and the directive files at the snapshot's commit, read only when a step is
56
+ * reported.
57
+ *
58
+ * @throws `DiagnosticsError` (`VALIDATION`) when the registry at `HEAD` has a `spec-003` error; a
59
+ * `ValidationError` for an invalid `roles.yaml` or directive file at `HEAD`; `StorageError` when git
60
+ * cannot answer.
61
+ */
62
+ function workflowStatusAtHead(root, ref) {
63
+ const snapshot = (0, workflow_deduction_1.readDeductionSnapshotAtHead)(root);
64
+ const deduction = (0, deduce_1.deduceWorkflowState)(snapshot);
65
+ return statusWorkflow((0, workflow_next_1.readNextInputs)(root, snapshot, deduction), deduction, ref);
66
+ }
67
+ // --- console --------------------------------------------------------------------------------------
68
+ /** One phase as `<name> <state>`, with its iteration counts or `(vacuous)`. */
69
+ function describePhase(progress) {
70
+ const counts = progress.iterations;
71
+ const parts = counts === undefined
72
+ ? []
73
+ : ['eligible', 'entered', 'complete', 'late'].filter((name) => counts[name] > 0).map((name) => `${name} ${counts[name]}`);
74
+ const note = counts?.note !== undefined ? [counts.note] : progress.vacuous === true ? ['vacuous'] : [];
75
+ const detail = [...parts, ...note];
76
+ return `${progress.phase} ${progress.state}${detail.length === 0 ? '' : ` (${detail.join(', ')})`}`;
77
+ }
78
+ /** The console lines of one open instance. */
79
+ function instanceLines(entry) {
80
+ const { instance } = entry;
81
+ const flags = [instance.active ? 'active' : null, entry.complete ? 'complete' : null, instance.abandoned ? 'abandoned' : null].filter((flag) => flag !== null);
82
+ const lines = [`${instance.active ? '*' : ' '} ${instance.id} (${instance.workflow})${flags.length === 0 ? '' : ` — ${flags.join(', ')}`}`];
83
+ const element = instance.element;
84
+ lines.push(` element: ${element === null ? '(none)' : `${element.type}:${element.id} (${element.status})`}`);
85
+ if (entry.phases.length > 0)
86
+ lines.push(` phases: ${entry.phases.map(describePhase).join(', ')}`);
87
+ if (entry.frontier.length > 0)
88
+ lines.push(' frontier:');
89
+ for (const step of entry.frontier) {
90
+ const missing = step.evidence.missing.length === 0 ? '' : `; missing: ${step.evidence.missing.join(', ')}`;
91
+ lines.push(` - ${step.key} (${step.role ?? 'no role'}${missing})${step.reentered ? ` re-entered after ${step.reentryCommit}` : ''}`);
92
+ // A third party's line is the step's own; approvals are listed once, below.
93
+ if (step.awaiting?.kind === 'party')
94
+ lines.push(` ${(0, workflow_next_1.humanNeededLine)(step)}`);
95
+ }
96
+ if (entry.late.length > 0)
97
+ lines.push(` late: ${entry.late.map((late) => `${late.type}:${late.id} (${late.status})`).join(', ')}`);
98
+ return lines;
99
+ }
100
+ /** `workflow status`'s `--format console` rendering (`spec-017` §5.3, §8). Pure. */
101
+ function renderStatusConsole(result) {
102
+ const lines = [];
103
+ if (result.message !== undefined)
104
+ lines.push(result.message);
105
+ else
106
+ lines.push(`open workflows: ${result.open.length}`); // no message: some instance is open
107
+ for (const entry of result.open)
108
+ lines.push(...instanceLines(entry));
109
+ if (result.pendingApprovals.length > 0) {
110
+ lines.push(`pending approvals: ${result.pendingApprovals.length}`);
111
+ for (const approval of result.pendingApprovals)
112
+ lines.push(` ${(0, workflow_next_1.approvalLine)(approval.awaiting, approval.step)} (${approval.instance}, ${approval.step})`);
113
+ }
114
+ if (result.ungated.length > 0) {
115
+ lines.push(`ungated elements: ${result.ungated.length}`);
116
+ for (const element of result.ungated) {
117
+ const routed = (0, workflow_next_1.describeMembers)(result.ungatedRoutedTo, (0, workflow_next_1.noApproverMessage)(approval_authority_1.APPROVER_ROLE));
118
+ lines.push(` human needed: approve or reject ${element.id} (${element.type}, ${element.status}; no open workflow carries it) — routed to ${routed}`);
119
+ }
120
+ }
121
+ if (result.diagnostics.length > 0)
122
+ lines.push(`${result.diagnostics.length} diagnostic(s): --format json lists them`);
123
+ return `${lines.join('\n')}\n`;
124
+ }
125
+ //# sourceMappingURL=workflow-status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-status.js","sourceRoot":"","sources":["../../src/core/workflow-status.ts"],"names":[],"mappings":";;AA8FA,wCAoCC;AAWD,oDAIC;AAoCD,kDAkBC;AAnLD,+CAAiL;AAEjL,6DAAqD;AACrD,mCAAkD;AAClD,mDAeyB;AACzB,6DAAmE;AA4CnE,qBAAqB;AACrB,SAAS,KAAK,CAAC,OAAmB;IAChC,OAAO,GAAG,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,SAAgB,cAAc,CAAC,MAAkB,EAAE,SAAoB,EAAE,GAAY;IACnF,IAAI,KAAK,GAAG,SAAS,CAAC,SAAS,CAAC;IAChC,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,MAAM,QAAQ,GAAG,IAAA,2BAAkB,EAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QACpD,IAAI,QAAQ,KAAK,IAAI;YAAE,OAAO,IAAA,6BAAa,EAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QACzD,KAAK,GAAG,CAAC,QAAQ,CAAC,CAAC;IACrB,CAAC;IAED,MAAM,IAAI,GAAkB,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAChD,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,GAA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CAAC;YACrC,MAAM,MAAM,GAAG,IAAA,+BAAe,EAAC,MAAM,CAAC,eAAe,EAAE,IAAA,iCAAiB,EAAC,kCAAa,CAAC,CAAC,CAAC;YACzF,KAAK,CAAC,IAAI,CAAC,qCAAqC,OAAO,CAAC,EAAE,KAAK,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,MAAM,8CAA8C,MAAM,EAAE,CAAC,CAAC;QACxJ,CAAC;IACH,CAAC;IACD,IAAI,MAAM,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,0CAA0C,CAAC,CAAC;IACtH,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC"}
@@ -10,6 +10,34 @@ export interface WriteTargetContract {
10
10
  }
11
11
  /** The contract every non-transition write verb refuses under (`dna set`, the `directive` verbs, `init`). */
12
12
  export declare const CONFIG_WRITE_CONTRACT: WriteTargetContract;
13
+ /**
14
+ * Refuse, before anything is written, a target git **cannot report on** because a directory on the
15
+ * way to it is a symbolic link (task-131, `bug-118`, `bug-124`) — or cannot be read at all.
16
+ *
17
+ * For a path behind a symlink `git status --porcelain` is empty whether the file is modified or not,
18
+ * and the `git add` that `commitPaths` runs afterwards fails ("beyond a symbolic link") — after the
19
+ * write or the unlink has already happened. "I have nothing to report about this path" is not "this
20
+ * path is clean"; this is the check that keeps the two apart, so the guards below never read silence
21
+ * as consent. Exit `1` (`VALIDATION`), naming the path and the reason.
22
+ */
23
+ export declare function requireInspectableTarget(root: string, path: string, contract?: WriteTargetContract): CoreResult<undefined>;
24
+ /**
25
+ * Refuse, before anything is written, a target whose **index** holds a version that differs from both
26
+ * `HEAD` and the working tree (task-131, `bug-182`) — the one loss a content-carrying verb can still
27
+ * cause.
28
+ *
29
+ * `memory submit` and `memory amend` own the whole document: its working-tree bytes are the content of
30
+ * record, so {@link requireUnmodifiedTarget} cannot apply to them. But `commitPaths` runs
31
+ * `git add -- <path>` before committing, and that silently overwrites a staged version the user
32
+ * prepared separately. When the staged version equals `HEAD` (nothing staged) or the working tree
33
+ * (the user staged what is about to be committed) nothing is lost and the verb proceeds; only the
34
+ * three-way divergence — git's own `XY` with both columns set — is refused. The answer is git's
35
+ * (`pathPorcelainStatus`), for the reason the module header gives. Also asks
36
+ * {@link requireInspectableTarget} first, since an empty porcelain is not an answer behind a symlink.
37
+ *
38
+ * @param path - Root-relative POSIX path of the document the verb is about to commit.
39
+ */
40
+ export declare function requireNoDivergentStage(root: string, path: string, contract?: WriteTargetContract): CoreResult<undefined>;
13
41
  /**
14
42
  * Refuse, before anything is written, a target that already carries modifications this operation
15
43
  * does not own — `dl-080`'s ratified write rule for a command that **edits a file in place**.
@@ -41,12 +69,14 @@ export declare function requireUnmodifiedTargets(root: string, paths: readonly s
41
69
  * absent path and for a clean, tracked one — so each of the three places a file can live is checked
42
70
  * explicitly.
43
71
  *
44
- * Reachable because `memory add` derives its id's sequence number from `readdirSync` of the working
45
- * tree (`nextSequenceNumber`, `../memory/add.ts`), so a working tree that disagrees with `HEAD` about
46
- * how many elements exist can generate an id that lands on an occupied path; the write that follows
47
- * is unconditional, and the commit's diff then becomes `HEAD` → scaffold rather than absent →
48
- * scaffold. A commit whose subject says "add" and whose diff removes lines is `bug-078` at its
49
- * sharpest.
72
+ * Reachable because an id can land on an occupied path. A slug-only `id_pattern` (`note-{slug}`)
73
+ * does whenever a title repeats. A `{n}` id does when the occupant is a **git-ignored** file: since
74
+ * task-128 `nextSequenceNumber` takes the highest number every ref and the working tree hold, but
75
+ * the working tree as git sees it, so an ignored file reserves no number. (Before task-128 it counted
76
+ * the working tree's files, so a gap reissued a taken number, `bug-087`.) The guard refuses; it never
77
+ * overwrites. The write that follows is unconditional, and the
78
+ * commit's diff would then be `HEAD` → scaffold rather than absent → scaffold. A commit whose subject
79
+ * says "add" and whose diff removes lines is `bug-078` at its sharpest.
50
80
  *
51
81
  * @param path - Root-relative POSIX path of the file about to be created.
52
82
  */
@@ -71,8 +101,11 @@ export declare function undeclaredCommittedPaths(root: string, sha: string, decl
71
101
  *
72
102
  * `verifyCommittedScope` delegates its content half to `verifyDocumentEdit`, which compares *owned
73
103
  * frontmatter fields* and a body. `dna.yaml` and `roles.yaml` have no frontmatter block at all, so
74
- * for them the right — and strictly stronger — question is byte equality: the commit must carry, for
75
- * each declared path, exactly the text this operation wrote, and nothing else.
104
+ * for them the right — and strictly stronger — question is content equality: the commit must carry, for
105
+ * each declared path, exactly the text this operation wrote, and nothing else. "Exactly" is judged as
106
+ * git stores it: when the bytes differ from `git show`'s, the written text is hashed through git's
107
+ * filters for that path and compared with the committed blob (`committedBlobMatches`), so a CRLF file
108
+ * that `core.autocrlf=true` stores LF is not reported as a foreign change (task-193 review).
76
109
  *
77
110
  * Same shape as `task-080`'s lockfile guard and `task-088`'s post-condition: assert the diff, not the
78
111
  * end state. Reading the file back from disk answers "does `dna.yaml` now say `Renamed`?" — true no
@@ -96,4 +129,14 @@ export declare function verifyCommittedPaths(root: string, sha: string, expected
96
129
  * @param content - The text the operation wrote, or `null` when it removed the path.
97
130
  */
98
131
  export declare function committedScopeError(root: string, sha: string, path: string, content: string | null): CoreResult<never> | undefined;
132
+ /**
133
+ * Refuse an empty commit while the index holds staged changes (task-226, `dl-106`): `workflow finalize`'s
134
+ * phase record changes no file, so a staged change has no place in it. `commitEmpty`
135
+ * (`src/storage/commit.ts`) commits with `--only` and would leave it staged anyway; refusing first is the
136
+ * predictable answer `dl-106` asks for — the operator learns the record was not written beside their
137
+ * change, rather than finding the two interleaved. A read, so a dry run refuses too.
138
+ *
139
+ * @param subject - The subject of the commit about to be made, named in the refusal.
140
+ */
141
+ export declare function requireCleanIndex(root: string, subject: string): CoreResult<undefined>;
99
142
  //# sourceMappingURL=write-guard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"write-guard.d.ts","sourceRoot":"","sources":["../../src/core/write-guard.ts"],"names":[],"m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,EAAE,SAAS,MAAM,EAAE,EACxB,QAAQ,GAAE,mBAA2C,GACpD,UAAU,CAAC,SAAS,CAAC,CAMvB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC,SAAS,CAAC,CAkBrF;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,SAAS,MAAM,EAAE,GAC1B;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAMxC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,GAC3C,MAAM,EAAE,CAgBV;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GAAG,IAAI,GACrB,UAAU,CAAC,KAAK,CAAC,GAAG,SAAS,CAO/B;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,UAAU,CAAC,SAAS,CAAC,CAUtF"}
@@ -1,12 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CONFIG_WRITE_CONTRACT = void 0;
4
+ exports.requireInspectableTarget = requireInspectableTarget;
5
+ exports.requireNoDivergentStage = requireNoDivergentStage;
4
6
  exports.requireUnmodifiedTarget = requireUnmodifiedTarget;
5
7
  exports.requireUnmodifiedTargets = requireUnmodifiedTargets;
6
8
  exports.requireAbsentTarget = requireAbsentTarget;
7
9
  exports.undeclaredCommittedPaths = undeclaredCommittedPaths;
8
10
  exports.verifyCommittedPaths = verifyCommittedPaths;
9
11
  exports.committedScopeError = committedScopeError;
12
+ exports.requireCleanIndex = requireCleanIndex;
10
13
  /**
11
14
  * The write-side half of `dl-080-which-baseline-each-command-reads`, ratified as option **(B)**:
12
15
  * *a write refuses while its target carries modifications the command does not own*
@@ -43,6 +46,13 @@ exports.committedScopeError = committedScopeError;
43
46
  * rejected: "an unrelated uncommitted edit blocks a verb, so designing a new type in `memory.yaml`
44
47
  * would prevent approving an element that has nothing to do with it".
45
48
  *
49
+ * **What git cannot see, the guard refuses** (task-131, `bug-118`). `git status --porcelain` prints
50
+ * nothing for a path that lies beyond a symbolic link — `git ls-files` carries the link blob and never
51
+ * what it points at — so "no output" there means *invisible*, not *clean*. Every guard here therefore
52
+ * asks {@link requireInspectableTarget} first, on the filesystem (`dl-086`: a guard over an imminent
53
+ * syscall resolves where the syscall will land), and refuses a target git cannot report on, whether
54
+ * the link points inside the project (`bug-124`) or out of it.
55
+ *
46
56
  * **Exit code.** Every refusal here is a `CoreResult.error` with `code: 'VALIDATION'`, which
47
57
  * `exitCodeForError` maps to **1**. `spec-005-cli-command-contract` § "1. Exit-code contract
48
58
  * (REQ-INT-04)" reserves `2` for a malformed *invocation*; a dirty target is a repository-state
@@ -84,6 +94,89 @@ function readWorktree(root, path) {
84
94
  const absolute = (0, node_path_1.join)(root, path);
85
95
  return (0, node_fs_1.existsSync)(absolute) ? (0, storage_1.readDocument)(absolute) : null;
86
96
  }
97
+ /**
98
+ * Why git cannot report on `path`, or `null` when it can: the first proper ancestor of `path` — a
99
+ * directory on the way to it, never `path` itself — that is a symbolic link, or that the filesystem
100
+ * refuses to `lstat` (a directory without search permission). Stops at the first missing segment: a
101
+ * path whose parent does not exist yet is not beyond anything (the creating verbs `mkdir` it).
102
+ *
103
+ * The leaf is deliberately excluded. A target that is ITSELF a symlink is one git does track (as a
104
+ * mode-120000 blob) and reports on, which is what keeps `directive remove` of a symlinked directive
105
+ * file working (`bug-044`'s benign case); whether a *write* may follow such a leaf is the confinement
106
+ * module's question (`requireConfinedWriteTarget`, `bug-120`), not this guard's.
107
+ */
108
+ function uninspectableAncestor(root, path) {
109
+ const segments = path.split('/').filter((segment) => segment.length > 0);
110
+ for (let end = 1; end < segments.length; end += 1) {
111
+ const ancestor = segments.slice(0, end).join('/');
112
+ try {
113
+ if ((0, node_fs_1.lstatSync)((0, node_path_1.join)(root, ancestor)).isSymbolicLink())
114
+ return `'${ancestor}' is a symbolic link`;
115
+ }
116
+ catch (error) {
117
+ const code = error.code;
118
+ if (code === 'ENOENT' || code === 'ENOTDIR')
119
+ return null;
120
+ return `'${ancestor}' cannot be read (${String(code)})`;
121
+ }
122
+ }
123
+ return null;
124
+ }
125
+ /**
126
+ * Refuse, before anything is written, a target git **cannot report on** because a directory on the
127
+ * way to it is a symbolic link (task-131, `bug-118`, `bug-124`) — or cannot be read at all.
128
+ *
129
+ * For a path behind a symlink `git status --porcelain` is empty whether the file is modified or not,
130
+ * and the `git add` that `commitPaths` runs afterwards fails ("beyond a symbolic link") — after the
131
+ * write or the unlink has already happened. "I have nothing to report about this path" is not "this
132
+ * path is clean"; this is the check that keeps the two apart, so the guards below never read silence
133
+ * as consent. Exit `1` (`VALIDATION`), naming the path and the reason.
134
+ */
135
+ function requireInspectableTarget(root, path, contract = exports.CONFIG_WRITE_CONTRACT) {
136
+ const reason = uninspectableAncestor(root, path);
137
+ if (reason === null)
138
+ return (0, types_1.coreOk)(undefined);
139
+ return (0, types_1.coreErr)({
140
+ code: 'VALIDATION',
141
+ message: `refusing to commit ${path}: ${reason}, and git cannot stage or inspect a path beyond a symbolic link or an ` +
142
+ `unreadable directory, so whether this ${contract.noun} carries modifications this ${contract.owner} does not ` +
143
+ 'own cannot be inspected. Nothing has been written; replace a symbolic link with the directory it points ' +
144
+ 'to, then retry.',
145
+ });
146
+ }
147
+ /**
148
+ * Refuse, before anything is written, a target whose **index** holds a version that differs from both
149
+ * `HEAD` and the working tree (task-131, `bug-182`) — the one loss a content-carrying verb can still
150
+ * cause.
151
+ *
152
+ * `memory submit` and `memory amend` own the whole document: its working-tree bytes are the content of
153
+ * record, so {@link requireUnmodifiedTarget} cannot apply to them. But `commitPaths` runs
154
+ * `git add -- <path>` before committing, and that silently overwrites a staged version the user
155
+ * prepared separately. When the staged version equals `HEAD` (nothing staged) or the working tree
156
+ * (the user staged what is about to be committed) nothing is lost and the verb proceeds; only the
157
+ * three-way divergence — git's own `XY` with both columns set — is refused. The answer is git's
158
+ * (`pathPorcelainStatus`), for the reason the module header gives. Also asks
159
+ * {@link requireInspectableTarget} first, since an empty porcelain is not an answer behind a symlink.
160
+ *
161
+ * @param path - Root-relative POSIX path of the document the verb is about to commit.
162
+ */
163
+ function requireNoDivergentStage(root, path, contract = exports.CONFIG_WRITE_CONTRACT) {
164
+ const inspectable = requireInspectableTarget(root, path, contract);
165
+ if (!inspectable.ok)
166
+ return inspectable;
167
+ // Porcelain `XY`: X is index vs HEAD, Y is working tree vs index. Both set (and X not the
168
+ // untracked/ignored marker) is the three-way divergence; '' (clean) has neither.
169
+ const porcelain = (0, storage_1.pathPorcelainStatus)(root, path);
170
+ if (' ?!'.includes(porcelain.charAt(0)) || porcelain.charAt(1) === ' ')
171
+ return (0, types_1.coreOk)(undefined);
172
+ return (0, types_1.coreErr)({
173
+ code: 'VALIDATION',
174
+ message: `refusing to commit ${path}: the index holds a staged version that differs from both HEAD and the working ` +
175
+ `tree [git status '${porcelain}']. This ${contract.owner} commits the working-tree ${contract.noun}, so staging ` +
176
+ `it would silently discard the staged version; run 'git restore --staged -- ${path}' to drop it, or ` +
177
+ `'git add -- ${path}' to keep the working tree, then retry.`,
178
+ });
179
+ }
87
180
  /**
88
181
  * Refuse, before anything is written, a target that already carries modifications this operation
89
182
  * does not own — `dl-080`'s ratified write rule for a command that **edits a file in place**.
@@ -103,6 +196,10 @@ function readWorktree(root, path) {
103
196
  * have); omitted, it is read here.
104
197
  */
105
198
  function requireUnmodifiedTarget(root, path, contract = exports.CONFIG_WRITE_CONTRACT, worktree) {
199
+ const inspectable = requireInspectableTarget(root, path, contract);
200
+ if (!inspectable.ok)
201
+ return inspectable;
202
+ // Empty porcelain means clean only for a path git can see — guaranteed by the check above.
106
203
  const porcelain = (0, storage_1.pathPorcelainStatus)(root, path);
107
204
  if (porcelain === '')
108
205
  return (0, types_1.coreOk)(undefined);
@@ -146,16 +243,23 @@ function requireUnmodifiedTargets(root, paths, contract = exports.CONFIG_WRITE_C
146
243
  * absent path and for a clean, tracked one — so each of the three places a file can live is checked
147
244
  * explicitly.
148
245
  *
149
- * Reachable because `memory add` derives its id's sequence number from `readdirSync` of the working
150
- * tree (`nextSequenceNumber`, `../memory/add.ts`), so a working tree that disagrees with `HEAD` about
151
- * how many elements exist can generate an id that lands on an occupied path; the write that follows
152
- * is unconditional, and the commit's diff then becomes `HEAD` → scaffold rather than absent →
153
- * scaffold. A commit whose subject says "add" and whose diff removes lines is `bug-078` at its
154
- * sharpest.
246
+ * Reachable because an id can land on an occupied path. A slug-only `id_pattern` (`note-{slug}`)
247
+ * does whenever a title repeats. A `{n}` id does when the occupant is a **git-ignored** file: since
248
+ * task-128 `nextSequenceNumber` takes the highest number every ref and the working tree hold, but
249
+ * the working tree as git sees it, so an ignored file reserves no number. (Before task-128 it counted
250
+ * the working tree's files, so a gap reissued a taken number, `bug-087`.) The guard refuses; it never
251
+ * overwrites. The write that follows is unconditional, and the
252
+ * commit's diff would then be `HEAD` → scaffold rather than absent → scaffold. A commit whose subject
253
+ * says "add" and whose diff removes lines is `bug-078` at its sharpest.
155
254
  *
156
255
  * @param path - Root-relative POSIX path of the file about to be created.
157
256
  */
158
257
  function requireAbsentTarget(root, path) {
258
+ // Beyond a symlink, `HEAD` and the index report nothing and `git add` refuses after the write
259
+ // (task-131, the `bug-124` order in `memory add`'s shape).
260
+ const inspectable = requireInspectableTarget(root, path);
261
+ if (!inspectable.ok)
262
+ return inspectable;
159
263
  const occupied = [];
160
264
  if ((0, storage_1.readPathAtRev)(root, 'HEAD', path) !== null)
161
265
  occupied.push('at HEAD');
@@ -195,8 +299,11 @@ function undeclaredCommittedPaths(root, sha, declared) {
195
299
  *
196
300
  * `verifyCommittedScope` delegates its content half to `verifyDocumentEdit`, which compares *owned
197
301
  * frontmatter fields* and a body. `dna.yaml` and `roles.yaml` have no frontmatter block at all, so
198
- * for them the right — and strictly stronger — question is byte equality: the commit must carry, for
199
- * each declared path, exactly the text this operation wrote, and nothing else.
302
+ * for them the right — and strictly stronger — question is content equality: the commit must carry, for
303
+ * each declared path, exactly the text this operation wrote, and nothing else. "Exactly" is judged as
304
+ * git stores it: when the bytes differ from `git show`'s, the written text is hashed through git's
305
+ * filters for that path and compared with the committed blob (`committedBlobMatches`), so a CRLF file
306
+ * that `core.autocrlf=true` stores LF is not reported as a foreign change (task-193 review).
200
307
  *
201
308
  * Same shape as `task-080`'s lockfile guard and `task-088`'s post-condition: assert the diff, not the
202
309
  * end state. Reading the file back from disk answers "does `dna.yaml` now say `Renamed`?" — true no
@@ -223,7 +330,10 @@ function verifyCommittedPaths(root, sha, expected) {
223
330
  else if (after === null) {
224
331
  problems.push(`it does not contain '${path}'`);
225
332
  }
226
- else if (after !== content) {
333
+ else if (after !== content && !(0, storage_1.committedBlobMatches)(root, sha, path, content)) {
334
+ // A byte difference alone is not a foreign change: git may have stored the written text through
335
+ // its filters (`core.autocrlf=true` keeps a CRLF file LF in the blob, task-193 review). Only a
336
+ // blob that the written bytes do not hash to, under those same filters, is one.
227
337
  problems.push(`'${path}' at the commit differs from what this operation wrote`);
228
338
  }
229
339
  }
@@ -244,4 +354,24 @@ function committedScopeError(root, sha, path, content) {
244
354
  message: `commit ${sha} carries more than the change it declares: ${leaked.join('; ')}`,
245
355
  });
246
356
  }
357
+ /**
358
+ * Refuse an empty commit while the index holds staged changes (task-226, `dl-106`): `workflow finalize`'s
359
+ * phase record changes no file, so a staged change has no place in it. `commitEmpty`
360
+ * (`src/storage/commit.ts`) commits with `--only` and would leave it staged anyway; refusing first is the
361
+ * predictable answer `dl-106` asks for — the operator learns the record was not written beside their
362
+ * change, rather than finding the two interleaved. A read, so a dry run refuses too.
363
+ *
364
+ * @param subject - The subject of the commit about to be made, named in the refusal.
365
+ */
366
+ function requireCleanIndex(root, subject) {
367
+ const staged = (0, storage_1.stagedPaths)(root);
368
+ if (staged.length === 0)
369
+ return (0, types_1.coreOk)(undefined);
370
+ return (0, types_1.coreErr)({
371
+ code: 'VALIDATION',
372
+ message: `refusing to commit '${subject}': the index holds staged changes (${staged.join(', ')}), and this commit records ` +
373
+ 'no file change; commit or unstage them first, then retry.',
374
+ details: { staged },
375
+ });
376
+ }
247
377
  //# sourceMappingURL=write-guard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"write-guard.js","sourceRoot":"","sources":["../../src/core/write-guard.ts"],"names":[],"mappings":";;;AAoHA,0DA6BC;AAGD,4DAUC;AAqBD,kDAcC;AAWD,4DAUC;AA0BD,oDAiBC;AAQD,kDAYC;AArRD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,qCAAqC;AACrC,yCAAiC;AAEjC,sCAAoD;AACpD,wCAOoB;AAEpB,mCAA2D;AAY3D,6GAA6G;AAChG,QAAA,qBAAqB,GAAwB;IACxD,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,WAAW;IAClB,OAAO,EAAE,6EAA6E;CACvF,CAAC;AAEF;;;;;;;;;GASG;AACH,SAAS,qBAAqB,CAAC,MAAqB,EAAE,KAAa,EAAE,IAAY;IAC/E,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,CAAC,OAAO,IAAI,yBAAyB,CAAC,CAAC;IACnE,IAAI,MAAM,KAAK,KAAK;QAAE,OAAO,EAAE,CAAC;IAChC,IAAI,IAAA,0BAAgB,EAAC,MAAM,CAAC,CAAC,WAAW,KAAK,IAAI,IAAI,IAAA,0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M,MAAM,GAAG,oBAAoB,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3E,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC1C,OAAO,IAAA,eAAO,EAAC;QACb,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,UAAU,GAAG,8CAA8C,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;KACxF,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,iBAAiB,CAAC,IAAY,EAAE,OAAe;IAC7D,MAAM,MAAM,GAAG,IAAA,qBAAW,EAAC,IAAI,CAAC,CAAC;IACjC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAA,cAAM,EAAC,SAAS,CAAC,CAAC;IAClD,OAAO,IAAA,eAAO,EAAC;QACb,IAAI,EAAE,YAAY;QAClB,OAAO,EACL,uBAAuB,OAAO,sCAAsC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,6BAA6B;YAClH,2DAA2D;QAC7D,OAAO,EAAE,EAAE,MAAM,EAAE;KACpB,CAAC,CAAC;AACL,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * `directives` module — Project Directives pillar; role-based rules (built-in + custom) (P3.5/P3.8).
3
- * `DirectiveFrontmatter` (an [AUTHORING]-level minimal schema — see `./schema` for why there is no
4
- * dedicated tech-spec yet) lives here — the pillar owns its own independent schema (REQ-SYS-02);
3
+ * `DirectiveFrontmatter` (the frontmatter shape `spec-013-directive-frontmatter-schema` specifies, with
4
+ * `./version`'s check of its `version` key) lives here — the pillar owns its own independent schema (REQ-SYS-02);
5
5
  * `src/core`'s loader wires it through the shared validation pipeline. `./create`
6
6
  * (task-050-directive-create, P3.1) adds the pillar's first *authoring* helpers — the kebab-case
7
7
  * name rule and the generated file's content — which `src/core`'s `directiveCreate` operation
@@ -15,6 +15,7 @@
15
15
  */
16
16
  export declare const MODULE_NAME: "directives";
17
17
  export { DirectiveFrontmatter, RolesYaml } from './schema';
18
+ export { checkDirectiveVersion, type DirectiveVersionCheck } from './version';
18
19
  export { INVALID_DIRECTIVE_NAME_MESSAGE, directiveTitleFromName, isValidDirectiveName, renderCustomDirective, } from './create';
19
20
  export { parseDirectiveIds, setRoleAssignmentsInText, withAssignedDirectives } from './roles-edit';
20
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/directives/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW,EAAG,YAAqB,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE3D,OAAO,EACL,8BAA8B,EAC9B,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/directives/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW,EAAG,YAAqB,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAE,KAAK,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAE9E,OAAO,EACL,8BAA8B,EAC9B,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC"}
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.withAssignedDirectives = exports.setRoleAssignmentsInText = exports.parseDirectiveIds = exports.renderCustomDirective = exports.isValidDirectiveName = exports.directiveTitleFromName = exports.INVALID_DIRECTIVE_NAME_MESSAGE = exports.RolesYaml = exports.DirectiveFrontmatter = exports.MODULE_NAME = void 0;
3
+ exports.withAssignedDirectives = exports.setRoleAssignmentsInText = exports.parseDirectiveIds = exports.renderCustomDirective = exports.isValidDirectiveName = exports.directiveTitleFromName = exports.INVALID_DIRECTIVE_NAME_MESSAGE = exports.checkDirectiveVersion = exports.RolesYaml = exports.DirectiveFrontmatter = exports.MODULE_NAME = void 0;
4
4
  /**
5
5
  * `directives` module — Project Directives pillar; role-based rules (built-in + custom) (P3.5/P3.8).
6
- * `DirectiveFrontmatter` (an [AUTHORING]-level minimal schema — see `./schema` for why there is no
7
- * dedicated tech-spec yet) lives here — the pillar owns its own independent schema (REQ-SYS-02);
6
+ * `DirectiveFrontmatter` (the frontmatter shape `spec-013-directive-frontmatter-schema` specifies, with
7
+ * `./version`'s check of its `version` key) lives here — the pillar owns its own independent schema (REQ-SYS-02);
8
8
  * `src/core`'s loader wires it through the shared validation pipeline. `./create`
9
9
  * (task-050-directive-create, P3.1) adds the pillar's first *authoring* helpers — the kebab-case
10
10
  * name rule and the generated file's content — which `src/core`'s `directiveCreate` operation
@@ -20,6 +20,8 @@ exports.MODULE_NAME = 'directives';
20
20
  var schema_1 = require("./schema");
21
21
  Object.defineProperty(exports, "DirectiveFrontmatter", { enumerable: true, get: function () { return schema_1.DirectiveFrontmatter; } });
22
22
  Object.defineProperty(exports, "RolesYaml", { enumerable: true, get: function () { return schema_1.RolesYaml; } });
23
+ var version_1 = require("./version");
24
+ Object.defineProperty(exports, "checkDirectiveVersion", { enumerable: true, get: function () { return version_1.checkDirectiveVersion; } });
23
25
  var create_1 = require("./create");
24
26
  Object.defineProperty(exports, "INVALID_DIRECTIVE_NAME_MESSAGE", { enumerable: true, get: function () { return create_1.INVALID_DIRECTIVE_NAME_MESSAGE; } });
25
27
  Object.defineProperty(exports, "directiveTitleFromName", { enumerable: true, get: function () { return create_1.directiveTitleFromName; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/directives/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACU,QAAA,WAAW,GAAG,YAAqB,CAAC;AAEjD,mCAA2D;AAAlD,8GAAA,oBAAoB,OAAA;AAAE,mGAAA,SAAS,OAAA;AAExC,mCAKkB;AAJhB,wHAAA,8BAA8B,OAAA;AAC9B,gHAAA,sBAAsB,OAAA;AACtB,8GAAA,oBAAoB,OAAA;AACpB,+GAAA,qBAAqB,OAAA;AAGvB,2CAAmG;AAA1F,+GAAA,iBAAiB,OAAA;AAAE,sHAAA,wBAAwB,OAAA;AAAE,oHAAA,sBAAsB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/directives/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACU,QAAA,WAAW,GAAG,YAAqB,CAAC;AAEjD,mCAA2D;AAAlD,8GAAA,oBAAoB,OAAA;AAAE,mGAAA,SAAS,OAAA;AAExC,qCAA8E;AAArE,gHAAA,qBAAqB,OAAA;AAE9B,mCAKkB;AAJhB,wHAAA,8BAA8B,OAAA;AAC9B,gHAAA,sBAAsB,OAAA;AACtB,8GAAA,oBAAoB,OAAA;AACpB,+GAAA,qBAAqB,OAAA;AAGvB,2CAAmG;AAA1F,+GAAA,iBAAiB,OAAA;AAAE,sHAAA,wBAAwB,OAAA;AAAE,oHAAA,sBAAsB,OAAA"}