@zuzuucodes/cli 1.4.0 → 1.6.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 (211) hide show
  1. package/bin/zuzuu.mjs +20 -4
  2. package/package.json +1 -1
  3. package/web-app/dist/auth.js +91 -0
  4. package/web-app/dist/server.js +16 -79
  5. package/web-app/dist/zuzuu-cli.js +124 -0
  6. package/web-app/dist/{zuzuu-api.js → zuzuu-routes.js} +158 -133
  7. package/web-app/web-dist/assets/CommandPalette-DhBdR7X3.js +45 -0
  8. package/web-app/web-dist/assets/DiffTab-CqxwSjI2.js +1 -0
  9. package/web-app/web-dist/assets/EditorPane-94QPFR9R.js +41 -0
  10. package/web-app/web-dist/assets/MonacoFile-D76epTrG.js +1 -0
  11. package/web-app/web-dist/assets/angular-html-BVBpGdXr.js +1 -0
  12. package/web-app/web-dist/assets/{angular-ts-CD_OonCa.js → angular-ts-BfdufMKP.js} +1 -1
  13. package/web-app/web-dist/assets/{apl-uOGC3x4e.js → apl-DWBSSoBH.js} +1 -1
  14. package/web-app/web-dist/assets/{astro-B6ybQmWG.js → astro-3LtMP0Sq.js} +1 -1
  15. package/web-app/web-dist/assets/{blade-B1QGRlVx.js → blade-llJRbbtR.js} +1 -1
  16. package/web-app/web-dist/assets/c-Wt1voDr2.js +1 -0
  17. package/web-app/web-dist/assets/{cobol-BgqgtYWn.js → cobol-x_HIyl2P.js} +1 -1
  18. package/web-app/web-dist/assets/{coffee-0wIRKYlr.js → coffee-CThvmt4R.js} +1 -1
  19. package/web-app/web-dist/assets/cpp-NtAeskI3.js +1 -0
  20. package/web-app/web-dist/assets/{crystal-CyTK3qFN.js → crystal-DNu_sX0G.js} +1 -1
  21. package/web-app/web-dist/assets/css-DJp_X0uY.js +1 -0
  22. package/web-app/web-dist/assets/{cssMode-B9jnrWOz.js → cssMode-ByQBaInt.js} +1 -1
  23. package/web-app/web-dist/assets/dist-DQqjtuhV.js +153 -0
  24. package/web-app/web-dist/assets/{edge-CvML9pwC.js → edge-ozw5tpLl.js} +1 -1
  25. package/web-app/web-dist/assets/{editor.api2-BmGoRSl4.js → editor.api2-C7skgoRB.js} +1 -1
  26. package/web-app/web-dist/assets/{elixir-CrjqTiSc.js → elixir-VhA6FeZt.js} +1 -1
  27. package/web-app/web-dist/assets/{elm-C4JtJ0Au.js → elm-dREJmIFz.js} +1 -1
  28. package/web-app/web-dist/assets/{erb-Cmeb-29V.js → erb-CIg6G69l.js} +1 -1
  29. package/web-app/web-dist/assets/{freemarker2-B5LAi19B.js → freemarker2-CBBwP9JV.js} +1 -1
  30. package/web-app/web-dist/assets/{git-rebase-CXqdToiP.js → git-rebase-B44mJPta.js} +1 -1
  31. package/web-app/web-dist/assets/{glimmer-js-Kq-kdTyV.js → glimmer-js-vH_gHG0-.js} +1 -1
  32. package/web-app/web-dist/assets/{glimmer-ts-D0RKLJNf.js → glimmer-ts--abOzSAQ.js} +1 -1
  33. package/web-app/web-dist/assets/glsl-Dv5r7kPw.js +1 -0
  34. package/web-app/web-dist/assets/graphql-CB4jsw2E.js +1 -0
  35. package/web-app/web-dist/assets/{hack-trjVF3Po.js → hack-DvEYX148.js} +1 -1
  36. package/web-app/web-dist/assets/haml-zE6W3STP.js +1 -0
  37. package/web-app/web-dist/assets/{handlebars-B8_x7Zx7.js → handlebars-CzBR2SDs.js} +1 -1
  38. package/web-app/web-dist/assets/{handlebars-g7ZhGhI_.js → handlebars-tXdfxEd6.js} +1 -1
  39. package/web-app/web-dist/assets/html-C8UlPnhE.js +1 -0
  40. package/web-app/web-dist/assets/{html-CfvRMgoC.js → html-DgPn1QYH.js} +1 -1
  41. package/web-app/web-dist/assets/{html-derivative-BYX_F_XH.js → html-derivative-CY6NRz-J.js} +1 -1
  42. package/web-app/web-dist/assets/{htmlMode-Bi8vSvwb.js → htmlMode-BtdIDgA2.js} +1 -1
  43. package/web-app/web-dist/assets/{http-BIVDpHT-.js → http-Cyd7bS_S.js} +1 -1
  44. package/web-app/web-dist/assets/{hurl-CFsshMju.js → hurl-CWPsiEpf.js} +1 -1
  45. package/web-app/web-dist/assets/index-B27_WOhS.css +2 -0
  46. package/web-app/web-dist/assets/index-De6DWTZM.js +7 -0
  47. package/web-app/web-dist/assets/java-CGc3VwQr.js +1 -0
  48. package/web-app/web-dist/assets/{javascript-Bxx2wV4w.js → javascript-5m05n-Be.js} +1 -1
  49. package/web-app/web-dist/assets/javascript-CUt1pgmJ.js +1 -0
  50. package/web-app/web-dist/assets/{jinja-_ZS5zWwe.js → jinja-CD-Z-FLd.js} +1 -1
  51. package/web-app/web-dist/assets/{jison-D8mMEpcs.js → jison-imPNup1l.js} +1 -1
  52. package/web-app/web-dist/assets/json-Bg9ijW3F.js +1 -0
  53. package/web-app/web-dist/assets/{jsonMode-C6ELX5GM.js → jsonMode-BG32YnTY.js} +1 -1
  54. package/web-app/web-dist/assets/jsx-CY6oMTks.js +1 -0
  55. package/web-app/web-dist/assets/{julia-D4h2DZrs.js → julia-Dc3O-irA.js} +1 -1
  56. package/web-app/web-dist/assets/{just-bMqQi3xg.js → just-BhOq_Kbv.js} +1 -1
  57. package/web-app/web-dist/assets/{latex-DThYi3CX.js → latex-Cu4Y1d5w.js} +1 -1
  58. package/web-app/web-dist/assets/lib-KIOQTlcs.js +1 -0
  59. package/web-app/web-dist/assets/{liquid-CUjzzP4r.js → liquid-3ZnQzTbs.js} +1 -1
  60. package/web-app/web-dist/assets/{liquid-CesB-zzl.js → liquid-CvXMrjlQ.js} +1 -1
  61. package/web-app/web-dist/assets/{lspLanguageFeatures-gTnJsses.js → lspLanguageFeatures-6KXALSrl.js} +1 -1
  62. package/web-app/web-dist/assets/lua-BjLEUjKY.js +1 -0
  63. package/web-app/web-dist/assets/{marko-yoGoLK2m.js → marko-DvhNOisQ.js} +1 -1
  64. package/web-app/web-dist/assets/{mdc-BvtXU6eH.js → mdc-Bm9TpL1X.js} +1 -1
  65. package/web-app/web-dist/assets/{mdx-DrXGQbNB.js → mdx-DffTEkNE.js} +1 -1
  66. package/web-app/web-dist/assets/{monaco-setup-CsR6EfHe.js → monaco-setup-DM3A5_VI.js} +3 -3
  67. package/web-app/web-dist/assets/{nginx-DoUz032F.js → nginx-Bhc82uuv.js} +1 -1
  68. package/web-app/web-dist/assets/{nim-B0Pl8B4R.js → nim-DXTVBFnF.js} +1 -1
  69. package/web-app/web-dist/assets/{perl-D2tfAALb.js → perl-C7veXV9z.js} +1 -1
  70. package/web-app/web-dist/assets/{php-BImCcX5X.js → php-BRiuMnnr.js} +1 -1
  71. package/web-app/web-dist/assets/{pug-BcnpC8P_.js → pug-C5hz5LQ7.js} +1 -1
  72. package/web-app/web-dist/assets/{python-ypRCBnvu.js → python-DyLAD3Wt.js} +1 -1
  73. package/web-app/web-dist/assets/{qml-DFDAunHY.js → qml-BdUV3aTS.js} +1 -1
  74. package/web-app/web-dist/assets/r-8R7vtdQc.js +1 -0
  75. package/web-app/web-dist/assets/{razor-aqrhpwqZ.js → razor-C49xQTPQ.js} +1 -1
  76. package/web-app/web-dist/assets/{razor-1_376SZM.js → razor-DRL52XO2.js} +1 -1
  77. package/web-app/web-dist/assets/react-vendor-CCIEwYL0.js +9 -0
  78. package/web-app/web-dist/assets/regexp-Omp9DhTb.js +1 -0
  79. package/web-app/web-dist/assets/{rst-2vG6f11Y.js → rst-BHX71KW9.js} +1 -1
  80. package/web-app/web-dist/assets/{ruby-Dj6bCFXR.js → ruby-B--HzjGU.js} +1 -1
  81. package/web-app/web-dist/assets/{sas-BhVZ4qL2.js → sas-DrLaYOK_.js} +1 -1
  82. package/web-app/web-dist/assets/scss-DdSxiZKl.js +1 -0
  83. package/web-app/web-dist/assets/shellscript-DwcUjJBL.js +1 -0
  84. package/web-app/web-dist/assets/{shellsession-CyO2fnhB.js → shellsession-CPZkydE6.js} +1 -1
  85. package/web-app/web-dist/assets/{soy-DIkw6E88.js → soy-Br5FhD7c.js} +1 -1
  86. package/web-app/web-dist/assets/sql-DNssxck8.js +1 -0
  87. package/web-app/web-dist/assets/{stata-DvkM932O.js → stata-DXn1tqOr.js} +1 -1
  88. package/web-app/web-dist/assets/{surrealql-B4-Q8tqV.js → surrealql-IeLNQw0f.js} +1 -1
  89. package/web-app/web-dist/assets/{svelte-p6yBy-Ki.js → svelte-DOdLCIlh.js} +1 -1
  90. package/web-app/web-dist/assets/{templ-C7EkuiZr.js → templ-CIwIngms.js} +1 -1
  91. package/web-app/web-dist/assets/{tex-DkmD8uFC.js → tex-D8QMumu5.js} +1 -1
  92. package/web-app/web-dist/assets/{ts-tags-U-hncHg4.js → ts-tags-BMVY4q-l.js} +1 -1
  93. package/web-app/web-dist/assets/{tsMode-a8OvovQd.js → tsMode-BndVBac5.js} +1 -1
  94. package/web-app/web-dist/assets/tsx-5Eka4NBX.js +1 -0
  95. package/web-app/web-dist/assets/{twig-CU0OP-IA.js → twig-C8o_5mgw.js} +1 -1
  96. package/web-app/web-dist/assets/{typescript-DnLjiKtn.js → typescript-B1w9vqKF.js} +1 -1
  97. package/web-app/web-dist/assets/typescript-DOu2WMV5.js +1 -0
  98. package/web-app/web-dist/assets/{vue-Db7nY3ba.js → vue-BU18DNDL.js} +1 -1
  99. package/web-app/web-dist/assets/{vue-html-BvAbiAw1.js → vue-html-BeluIYX0.js} +1 -1
  100. package/web-app/web-dist/assets/{vue-vine-BEaIQIlA.js → vue-vine-DGUAbOCX.js} +1 -1
  101. package/web-app/web-dist/assets/{xml-an4Nuuqq.js → xml-D8uAlVv5.js} +1 -1
  102. package/web-app/web-dist/assets/xml-DIqSwXR3.js +1 -0
  103. package/web-app/web-dist/assets/{xsl-D3NQgH22.js → xsl-Ct_-YIAy.js} +1 -1
  104. package/web-app/web-dist/assets/xterm-B1ffpRuj.js +36 -0
  105. package/web-app/web-dist/assets/xterm-addons-psDEiUMC.js +136 -0
  106. package/web-app/web-dist/assets/{yaml-Diiu6O9P.js → yaml-Bb7jXyQv.js} +1 -1
  107. package/web-app/web-dist/assets/yaml-DTtCYNlS.js +1 -0
  108. package/web-app/web-dist/index.html +6 -3
  109. package/zuzuu/actions/convert.mjs +10 -9
  110. package/zuzuu/actions/dispatch.mjs +12 -7
  111. package/zuzuu/actions/inbox.mjs +5 -5
  112. package/zuzuu/actions/manifest.mjs +48 -30
  113. package/zuzuu/actions/schema.mjs +9 -3
  114. package/zuzuu/actions/trail.mjs +1 -1
  115. package/zuzuu/commands/act-author.mjs +23 -13
  116. package/zuzuu/commands/act.mjs +4 -6
  117. package/zuzuu/commands/capture.mjs +2 -2
  118. package/zuzuu/commands/code.mjs +2 -2
  119. package/zuzuu/commands/digest.mjs +2 -2
  120. package/zuzuu/commands/distill.mjs +15 -16
  121. package/zuzuu/commands/doctor.mjs +41 -19
  122. package/zuzuu/commands/enable.mjs +1 -1
  123. package/zuzuu/commands/eval.mjs +3 -36
  124. package/zuzuu/commands/explain.mjs +4 -4
  125. package/zuzuu/commands/faculty.mjs +158 -0
  126. package/zuzuu/commands/generation.mjs +5 -8
  127. package/zuzuu/commands/hook.mjs +14 -12
  128. package/zuzuu/commands/inbox.mjs +1 -6
  129. package/zuzuu/commands/init.mjs +18 -4
  130. package/zuzuu/commands/knowledge.mjs +1 -1
  131. package/zuzuu/commands/migrations/home.mjs +96 -0
  132. package/zuzuu/commands/migrations/index.mjs +48 -0
  133. package/zuzuu/commands/migrations/items.mjs +360 -0
  134. package/zuzuu/commands/migrations/proposals.mjs +100 -0
  135. package/zuzuu/commands/proposals.mjs +131 -0
  136. package/zuzuu/commands/review.mjs +13 -227
  137. package/zuzuu/commands/session.mjs +8 -2
  138. package/zuzuu/commands/sessions.mjs +159 -0
  139. package/zuzuu/commands/status.mjs +3 -3
  140. package/zuzuu/commands/trace.mjs +1 -1
  141. package/zuzuu/{capture-core.mjs → core/capture-core.mjs} +3 -3
  142. package/zuzuu/{store.mjs → core/store.mjs} +1 -1
  143. package/zuzuu/digest/compose.mjs +96 -0
  144. package/zuzuu/eval/score.mjs +14 -1
  145. package/zuzuu/faculties/actions/index.mjs +283 -0
  146. package/zuzuu/faculties/guardrails/index.mjs +320 -0
  147. package/zuzuu/faculties/instructions/index.mjs +288 -0
  148. package/zuzuu/faculties/knowledge/index.mjs +185 -0
  149. package/zuzuu/faculties/memory/index.mjs +124 -0
  150. package/zuzuu/faculty/envelope.mjs +290 -0
  151. package/zuzuu/faculty/generation/read.mjs +206 -0
  152. package/zuzuu/faculty/generation/write.mjs +207 -0
  153. package/zuzuu/faculty/items.mjs +81 -0
  154. package/zuzuu/faculty/module.mjs +74 -0
  155. package/zuzuu/faculty/pending.mjs +63 -0
  156. package/zuzuu/faculty/registry.mjs +204 -18
  157. package/zuzuu/faculty/render.mjs +59 -0
  158. package/zuzuu/faculty/trail.mjs +1 -1
  159. package/zuzuu/guardrails/engine.mjs +137 -0
  160. package/zuzuu/{scaffold.mjs → home/scaffold.mjs} +110 -39
  161. package/zuzuu/knowledge/items.mjs +56 -91
  162. package/zuzuu/live/install.mjs +1 -1
  163. package/zuzuu/live/live-store.mjs +2 -2
  164. package/zuzuu/live/reconcile.mjs +2 -2
  165. package/zuzuu/sessions/git.mjs +47 -0
  166. package/zuzuu/{session-git.mjs → sessions/session-git.mjs} +5 -43
  167. package/web-app/web-dist/assets/DiffTab-BuWonUNJ.js +0 -1
  168. package/web-app/web-dist/assets/MonacoFile-CL3DhFKG.js +0 -1
  169. package/web-app/web-dist/assets/angular-html-CmT26mqM.js +0 -1
  170. package/web-app/web-dist/assets/c-BvoqrSVH.js +0 -1
  171. package/web-app/web-dist/assets/cpp-BXsk94m0.js +0 -1
  172. package/web-app/web-dist/assets/css-Z8oOGxII.js +0 -1
  173. package/web-app/web-dist/assets/dist-ChcDQ_7s.js +0 -153
  174. package/web-app/web-dist/assets/glsl-KwyfU2aa.js +0 -1
  175. package/web-app/web-dist/assets/graphql-DSeOUAa2.js +0 -1
  176. package/web-app/web-dist/assets/haml-azVoxQRV.js +0 -1
  177. package/web-app/web-dist/assets/html-D_7P5S4m.js +0 -1
  178. package/web-app/web-dist/assets/index--5yy8RbA.js +0 -267
  179. package/web-app/web-dist/assets/index-BVG4hgk7.css +0 -2
  180. package/web-app/web-dist/assets/java-D4RbCvBe.js +0 -1
  181. package/web-app/web-dist/assets/javascript-Cb010CKM.js +0 -1
  182. package/web-app/web-dist/assets/json-DWgqV4D1.js +0 -1
  183. package/web-app/web-dist/assets/jsx-CZjSJa1f.js +0 -1
  184. package/web-app/web-dist/assets/lua-TGj_6NzO.js +0 -1
  185. package/web-app/web-dist/assets/r-fCpuAR7u.js +0 -1
  186. package/web-app/web-dist/assets/regexp-B4yxx-Ty.js +0 -1
  187. package/web-app/web-dist/assets/scss-QdjMO_xV.js +0 -1
  188. package/web-app/web-dist/assets/shellscript-BnlgeVVx.js +0 -1
  189. package/web-app/web-dist/assets/sql-DGnQv6iD.js +0 -1
  190. package/web-app/web-dist/assets/tsx-MJ0-9sYG.js +0 -1
  191. package/web-app/web-dist/assets/typescript-C17ZkDe8.js +0 -1
  192. package/web-app/web-dist/assets/xml-CA9lHFQV.js +0 -1
  193. package/web-app/web-dist/assets/yaml-CwRYMJka.js +0 -1
  194. package/zuzuu/actions/adapter.mjs +0 -130
  195. package/zuzuu/commands/migrate.mjs +0 -225
  196. package/zuzuu/digest.mjs +0 -149
  197. package/zuzuu/faculty/generation.mjs +0 -392
  198. package/zuzuu/guardrails/adapter.mjs +0 -134
  199. package/zuzuu/guardrails.mjs +0 -89
  200. package/zuzuu/instructions/adapter.mjs +0 -93
  201. package/zuzuu/knowledge/adapter.mjs +0 -99
  202. package/zuzuu/memory/adapter.mjs +0 -121
  203. package/zuzuu/miners/actions.mjs +0 -118
  204. package/zuzuu/miners/guardrails.mjs +0 -179
  205. package/zuzuu/miners/instructions.mjs +0 -157
  206. package/zuzuu/miners/knowledge.mjs +0 -25
  207. package/zuzuu/miners/memory.mjs +0 -27
  208. package/zuzuu/miners/registry.mjs +0 -31
  209. /package/web-app/web-dist/assets/{chunk-QTnfLwEv.js → rolldown-runtime-QTnfLwEv.js} +0 -0
  210. /package/zuzuu/{session.mjs → core/session.mjs} +0 -0
  211. /package/zuzuu/{inject.mjs → home/inject.mjs} +0 -0
@@ -1 +0,0 @@
1
- import{n as e}from"./chunk-QTnfLwEv.js";var t=e({default:()=>n}),n=[Object.freeze(JSON.parse(`{"displayName":"YAML","fileTypes":["yaml","yml","rviz","reek","clang-format","yaml-tmlanguage","syntax","sublime-syntax"],"firstLineMatch":"^%YAML( ?1.\\\\d+)?","name":"yaml","patterns":[{"include":"#comment"},{"include":"#property"},{"include":"#directive"},{"match":"^---","name":"entity.other.document.begin.yaml"},{"match":"^\\\\.{3}","name":"entity.other.document.end.yaml"},{"include":"#node"}],"repository":{"block-collection":{"patterns":[{"include":"#block-sequence"},{"include":"#block-mapping"}]},"block-mapping":{"patterns":[{"include":"#block-pair"}]},"block-node":{"patterns":[{"include":"#prototype"},{"include":"#block-scalar"},{"include":"#block-collection"},{"include":"#flow-scalar-plain-out"},{"include":"#flow-node"}]},"block-pair":{"patterns":[{"begin":"\\\\?","beginCaptures":{"1":{"name":"punctuation.definition.key-value.begin.yaml"}},"end":"(?=\\\\?)|^ *(:)|(:)","endCaptures":{"1":{"name":"punctuation.separator.key-value.mapping.yaml"},"2":{"name":"invalid.illegal.expected-newline.yaml"}},"name":"meta.block-mapping.yaml","patterns":[{"include":"#block-node"}]},{"begin":"(?=(?:[^-\\\\]!\\"#%\\\\&'*,:>?@\\\\[\`{|}\\\\s]|[-:?]\\\\S)([^:\\\\s]|:\\\\S|\\\\s+(?![#\\\\s]))*\\\\s*:(\\\\s|$))","end":"(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$))","patterns":[{"include":"#flow-scalar-plain-out-implicit-type"},{"begin":"[^-\\\\]!\\"#%\\\\&'*,:>?@\\\\[\`{|}\\\\s]|[-:?]\\\\S","beginCaptures":{"0":{"name":"entity.name.tag.yaml"}},"contentName":"entity.name.tag.yaml","end":"(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$))","name":"string.unquoted.plain.out.yaml"}]},{"match":":(?=\\\\s|$)","name":"punctuation.separator.key-value.mapping.yaml"}]},"block-scalar":{"begin":"(?:(\\\\|)|(>))([1-9])?([-+])?(.*\\\\n?)","beginCaptures":{"1":{"name":"keyword.control.flow.block-scalar.literal.yaml"},"2":{"name":"keyword.control.flow.block-scalar.folded.yaml"},"3":{"name":"constant.numeric.indentation-indicator.yaml"},"4":{"name":"storage.modifier.chomping-indicator.yaml"},"5":{"patterns":[{"include":"#comment"},{"match":".+","name":"invalid.illegal.expected-comment-or-newline.yaml"}]}},"end":"^(?=\\\\S)|(?!\\\\G)","patterns":[{"begin":"^( +)(?! )","end":"^(?!\\\\1|\\\\s*$)","name":"string.unquoted.block.yaml"}]},"block-sequence":{"match":"(-)(?!\\\\S)","name":"punctuation.definition.block.sequence.item.yaml"},"comment":{"begin":"(?:^([\\\\t ]*)|[\\\\t ]+)(?=#\\\\p{print}*$)","beginCaptures":{"1":{"name":"punctuation.whitespace.comment.leading.yaml"}},"end":"(?!\\\\G)","patterns":[{"begin":"#","beginCaptures":{"0":{"name":"punctuation.definition.comment.yaml"}},"end":"\\\\n","name":"comment.line.number-sign.yaml"}]},"directive":{"begin":"^%","beginCaptures":{"0":{"name":"punctuation.definition.directive.begin.yaml"}},"end":"(?=$|[\\\\t ]+($|#))","name":"meta.directive.yaml","patterns":[{"captures":{"1":{"name":"keyword.other.directive.yaml.yaml"},"2":{"name":"constant.numeric.yaml-version.yaml"}},"match":"\\\\G(YAML)[\\\\t ]+(\\\\d+\\\\.\\\\d+)"},{"captures":{"1":{"name":"keyword.other.directive.tag.yaml"},"2":{"name":"storage.type.tag-handle.yaml"},"3":{"name":"support.type.tag-prefix.yaml"}},"match":"\\\\G(TAG)(?:[\\\\t ]+(!(?:[-0-9A-Za-z]*!)?)(?:[\\\\t ]+(!(?:%\\\\h{2}|[]!#$\\\\&-;=?-\\\\[_a-z~])*|(?![]!,\\\\[{}])(?:%\\\\h{2}|[]!#$\\\\&-;=?-\\\\[_a-z~])+))?)?"},{"captures":{"1":{"name":"support.other.directive.reserved.yaml"},"2":{"name":"string.unquoted.directive-name.yaml"},"3":{"name":"string.unquoted.directive-parameter.yaml"}},"match":"\\\\G(\\\\w+)(?:[\\\\t ]+(\\\\w+)(?:[\\\\t ]+(\\\\w+))?)?"},{"match":"\\\\S+","name":"invalid.illegal.unrecognized.yaml"}]},"flow-alias":{"captures":{"1":{"name":"keyword.control.flow.alias.yaml"},"2":{"name":"punctuation.definition.alias.yaml"},"3":{"name":"variable.other.alias.yaml"},"4":{"name":"invalid.illegal.character.anchor.yaml"}},"match":"((\\\\*))([^],/\\\\[{}\\\\s]+)([^],}\\\\s]\\\\S*)?"},"flow-collection":{"patterns":[{"include":"#flow-sequence"},{"include":"#flow-mapping"}]},"flow-mapping":{"begin":"\\\\{","beginCaptures":{"0":{"name":"punctuation.definition.mapping.begin.yaml"}},"end":"}","endCaptures":{"0":{"name":"punctuation.definition.mapping.end.yaml"}},"name":"meta.flow-mapping.yaml","patterns":[{"include":"#prototype"},{"match":",","name":"punctuation.separator.mapping.yaml"},{"include":"#flow-pair"}]},"flow-node":{"patterns":[{"include":"#prototype"},{"include":"#flow-alias"},{"include":"#flow-collection"},{"include":"#flow-scalar"}]},"flow-pair":{"patterns":[{"begin":"\\\\?","beginCaptures":{"0":{"name":"punctuation.definition.key-value.begin.yaml"}},"end":"(?=[],}])","name":"meta.flow-pair.explicit.yaml","patterns":[{"include":"#prototype"},{"include":"#flow-pair"},{"include":"#flow-node"},{"begin":":(?=\\\\s|$|[],\\\\[{}])","beginCaptures":{"0":{"name":"punctuation.separator.key-value.mapping.yaml"}},"end":"(?=[],}])","patterns":[{"include":"#flow-value"}]}]},{"begin":"(?=(?:[^-\\\\]!\\"#%\\\\&'*,:>?@\\\\[\`{|}\\\\s]|[-:?][^],\\\\[{}\\\\s])([^],:\\\\[{}\\\\s]|:[^],\\\\[{}\\\\s]|\\\\s+(?![#\\\\s]))*\\\\s*:(\\\\s|$))","end":"(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$)|\\\\s*:[],\\\\[{}]|\\\\s*[],\\\\[{}])","name":"meta.flow-pair.key.yaml","patterns":[{"include":"#flow-scalar-plain-in-implicit-type"},{"begin":"[^-\\\\]!\\"#%\\\\&'*,:>?@\\\\[\`{|}\\\\s]|[-:?][^],\\\\[{}\\\\s]","beginCaptures":{"0":{"name":"entity.name.tag.yaml"}},"contentName":"entity.name.tag.yaml","end":"(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$)|\\\\s*:[],\\\\[{}]|\\\\s*[],\\\\[{}])","name":"string.unquoted.plain.in.yaml"}]},{"include":"#flow-node"},{"begin":":(?=\\\\s|$|[],\\\\[{}])","captures":{"0":{"name":"punctuation.separator.key-value.mapping.yaml"}},"end":"(?=[],}])","name":"meta.flow-pair.yaml","patterns":[{"include":"#flow-value"}]}]},"flow-scalar":{"patterns":[{"include":"#flow-scalar-double-quoted"},{"include":"#flow-scalar-single-quoted"},{"include":"#flow-scalar-plain-in"}]},"flow-scalar-double-quoted":{"begin":"\\"","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.yaml"}},"end":"\\"","endCaptures":{"0":{"name":"punctuation.definition.string.end.yaml"}},"name":"string.quoted.double.yaml","patterns":[{"match":"\\\\\\\\([ \\"/0LN\\\\\\\\_abefnprtv]|x\\\\d\\\\d|u\\\\d{4}|U\\\\d{8})","name":"constant.character.escape.yaml"},{"match":"\\\\\\\\\\\\n","name":"constant.character.escape.double-quoted.newline.yaml"}]},"flow-scalar-plain-in":{"patterns":[{"include":"#flow-scalar-plain-in-implicit-type"},{"begin":"[^-\\\\]!\\"#%\\\\&'*,:>?@\\\\[\`{|}\\\\s]|[-:?][^],\\\\[{}\\\\s]","end":"(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$)|\\\\s*:[],\\\\[{}]|\\\\s*[],\\\\[{}])","name":"string.unquoted.plain.in.yaml"}]},"flow-scalar-plain-in-implicit-type":{"patterns":[{"captures":{"1":{"name":"constant.language.null.yaml"},"2":{"name":"constant.language.boolean.yaml"},"3":{"name":"constant.numeric.integer.yaml"},"4":{"name":"constant.numeric.float.yaml"},"5":{"name":"constant.other.timestamp.yaml"},"6":{"name":"constant.language.value.yaml"},"7":{"name":"constant.language.merge.yaml"}},"match":"(?:(null|Null|NULL|~)|([Yy]|yes|Yes|YES|[Nn]|no|No|NO|true|True|TRUE|false|False|FALSE|on|On|ON|off|Off|OFF)|([-+]?0b[01_]+|[-+]?0[0-7_]+|[-+]?(?:0|[1-9][0-9_]*)|[-+]?0x[_\\\\h]+|[-+]?[1-9][0-9_]*(?::[0-5]?[0-9])+)|([-+]?(?:[0-9][0-9_]*)?\\\\.[.0-9]*(?:[Ee][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\\\.[0-9_]*|[-+]?\\\\.(?:inf|Inf|INF)|\\\\.(?:nan|NaN|NAN))|(\\\\d{4}-\\\\d{2}-\\\\d{2}|\\\\d{4}-\\\\d{1,2}-\\\\d{1,2}(?:[Tt]|[\\\\t ]+)\\\\d{1,2}:\\\\d{2}:\\\\d{2}(?:\\\\.\\\\d*)?(?:[\\\\t ]*Z|[-+]\\\\d{1,2}(?::\\\\d{1,2})?)?)|(=)|(<<))(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$)|\\\\s*:[],\\\\[{}]|\\\\s*[],\\\\[{}])"}]},"flow-scalar-plain-out":{"patterns":[{"include":"#flow-scalar-plain-out-implicit-type"},{"begin":"[^-\\\\]!\\"#%\\\\&'*,:>?@\\\\[\`{|}\\\\s]|[-:?]\\\\S","end":"(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$))","name":"string.unquoted.plain.out.yaml"}]},"flow-scalar-plain-out-implicit-type":{"patterns":[{"captures":{"1":{"name":"constant.language.null.yaml"},"2":{"name":"constant.language.boolean.yaml"},"3":{"name":"constant.numeric.integer.yaml"},"4":{"name":"constant.numeric.float.yaml"},"5":{"name":"constant.other.timestamp.yaml"},"6":{"name":"constant.language.value.yaml"},"7":{"name":"constant.language.merge.yaml"}},"match":"(?:(null|Null|NULL|~)|([Yy]|yes|Yes|YES|[Nn]|no|No|NO|true|True|TRUE|false|False|FALSE|on|On|ON|off|Off|OFF)|([-+]?0b[01_]+|[-+]?0[0-7_]+|[-+]?(?:0|[1-9][0-9_]*)|[-+]?0x[_\\\\h]+|[-+]?[1-9][0-9_]*(?::[0-5]?[0-9])+)|([-+]?(?:[0-9][0-9_]*)?\\\\.[.0-9]*(?:[Ee][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\\\.[0-9_]*|[-+]?\\\\.(?:inf|Inf|INF)|\\\\.(?:nan|NaN|NAN))|(\\\\d{4}-\\\\d{2}-\\\\d{2}|\\\\d{4}-\\\\d{1,2}-\\\\d{1,2}(?:[Tt]|[\\\\t ]+)\\\\d{1,2}:\\\\d{2}:\\\\d{2}(?:\\\\.\\\\d*)?(?:[\\\\t ]*Z|[-+]\\\\d{1,2}(?::\\\\d{1,2})?)?)|(=)|(<<))(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$))"}]},"flow-scalar-single-quoted":{"begin":"'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.yaml"}},"end":"'(?!')","endCaptures":{"0":{"name":"punctuation.definition.string.end.yaml"}},"name":"string.quoted.single.yaml","patterns":[{"match":"''","name":"constant.character.escape.single-quoted.yaml"}]},"flow-sequence":{"begin":"\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.sequence.begin.yaml"}},"end":"]","endCaptures":{"0":{"name":"punctuation.definition.sequence.end.yaml"}},"name":"meta.flow-sequence.yaml","patterns":[{"include":"#prototype"},{"match":",","name":"punctuation.separator.sequence.yaml"},{"include":"#flow-pair"},{"include":"#flow-node"}]},"flow-value":{"patterns":[{"begin":"\\\\G(?![],}])","end":"(?=[],}])","name":"meta.flow-pair.value.yaml","patterns":[{"include":"#flow-node"}]}]},"node":{"patterns":[{"include":"#block-node"}]},"property":{"begin":"(?=[!\\\\&])","end":"(?!\\\\G)","name":"meta.property.yaml","patterns":[{"captures":{"1":{"name":"keyword.control.property.anchor.yaml"},"2":{"name":"punctuation.definition.anchor.yaml"},"3":{"name":"entity.name.type.anchor.yaml"},"4":{"name":"invalid.illegal.character.anchor.yaml"}},"match":"\\\\G((&))([^],/\\\\[{}\\\\s]+)(\\\\S+)?"},{"match":"\\\\G!(?:<(?:%\\\\h{2}|[]!#$\\\\&-;=?-\\\\[_a-z~])+>|(?:[-0-9A-Za-z]*!)?(?:%\\\\h{2}|[#$\\\\&-+\\\\--;=?-Z_a-z~])+|)(?=[\\\\t ]|$)","name":"storage.type.tag-handle.yaml"},{"match":"\\\\S+","name":"invalid.illegal.tag-handle.yaml"}]},"prototype":{"patterns":[{"include":"#comment"},{"include":"#property"}]}},"scopeName":"source.yaml","aliases":["yml"]}`))];export{t as n,n as t};
@@ -1,130 +0,0 @@
1
- // zuzuu/actions/adapter.mjs
2
- // The Actions faculty adapter (WS2-T3). Wraps the EXISTING Actions inbox gate
3
- // (proposed dirs under .zuzuu/actions/inbox/<slug>/) behind the faculty-spine
4
- // adapter contract — { name, ingest, validate, apply, render } — so the generic
5
- // `zuzuu review` gate can drive Actions the same way it drives Knowledge.
6
- //
7
- // Actions payloads are DIRECTORIES (run.mjs/SKILL.md + action.json), not JSON.
8
- // Strategy (lowest-risk): the inbox stays a dir; this adapter emits/reads a
9
- // spine-shaped proposal RECORD that REFERENCES the dir
10
- // (payload = { slug, kind, dir:'inbox/<slug>' }). The gate resolves a single
11
- // record via `getProposal`, lists pending via `listProposals`, and — because
12
- // the payload is dir-shaped — archives rejections via `rejectDir` (a dir move
13
- // into actions/proposals/archive/, not a JSON archive).
14
- //
15
- // Registers itself on import.
16
-
17
- import { join } from 'node:path';
18
- import { existsSync, readFileSync } from 'node:fs';
19
- import { listActions, inboxDir, isSafeSlug } from './manifest.mjs';
20
- import { activateAction, rejectAction } from './inbox.mjs';
21
- import { validateInputs } from './schema.mjs';
22
- import * as registry from '../faculty/registry.mjs';
23
-
24
- const name = 'actions';
25
-
26
- /** Build a spine-shaped proposal record for one proposed action. */
27
- function recordFor(a) {
28
- return {
29
- id: a.slug,
30
- faculty: name,
31
- kind: 'action',
32
- status: 'pending',
33
- source: 'agent',
34
- payload: { slug: a.slug, kind: a.kind, dir: `inbox/${a.slug}` },
35
- // carry render hints alongside the payload (cheap, dir read already done)
36
- title: a.title,
37
- promptSnippet: a.promptSnippet,
38
- analysis: {},
39
- evidence: {},
40
- provenance: [],
41
- };
42
- }
43
-
44
- /**
45
- * Pending action proposals (dirs in .zuzuu/actions/inbox/), surfaced as
46
- * spine-shaped records so the gate can render/approve/reject them uniformly.
47
- */
48
- function listProposals(agentDir) {
49
- return listActions(inboxDir(agentDir)).map(recordFor);
50
- }
51
-
52
- /** Resolve a single proposed action by slug → spine-shaped record, or null. */
53
- function getProposal(agentDir, slug) {
54
- if (!isSafeSlug(slug)) return null;
55
- return listProposals(agentDir).find((p) => p.id === slug) ?? null;
56
- }
57
-
58
- /**
59
- * Ingest is a pass-through for Actions: proposing scaffolds a dir
60
- * (zuzuu act propose / act-author). Kept for adapter-contract symmetry.
61
- */
62
- function ingest(_agentDir, raw) {
63
- return { payload: raw?.payload ?? raw ?? {}, analysis: {} };
64
- }
65
-
66
- /**
67
- * Validate a proposed action's manifest against the schema subset and confirm
68
- * the manifest slug matches the dir. Missing manifest → accept (slug fallback).
69
- * @returns {{ok:boolean, errors:string[], warnings:string[]}}
70
- */
71
- function validate(agentDir, payload) {
72
- const slug = payload?.slug;
73
- if (!isSafeSlug(slug)) return { ok: false, errors: [`invalid slug '${slug}'`], warnings: [] };
74
- const manPath = join(inboxDir(agentDir), slug, 'action.json');
75
- if (!existsSync(manPath)) return { ok: true, errors: [], warnings: [] };
76
- let man;
77
- try { man = JSON.parse(readFileSync(manPath, 'utf8')); }
78
- catch { return { ok: false, errors: ['manifest is not valid JSON'], warnings: [] }; }
79
- if (man.slug && man.slug !== slug) return { ok: false, errors: [`manifest slug '${man.slug}' ≠ dir '${slug}'`], warnings: [] };
80
- const errors = [];
81
- // the manifest schema is itself JSON-Schema-subset shaped; sanity-check both ends
82
- if (man.inputs) {
83
- const vi = validateInputs(man.inputs, man.default_args, {});
84
- // inputs schema is for caller args, not the manifest — only flag a structurally
85
- // broken schema (validateInputs is permissive on empty args), so this is a no-op
86
- // for well-formed manifests. Kept for symmetry with the knowledge adapter.
87
- if (vi.ok === false && !/required/i.test(vi.error ?? '')) errors.push(vi.error);
88
- }
89
- if (man.outputs && typeof man.outputs !== 'object') errors.push('outputs schema must be an object');
90
- return { ok: errors.length === 0, errors, warnings: [] };
91
- }
92
-
93
- /**
94
- * Apply an approved action proposal: activate it (move inbox/<slug> → <slug>).
95
- * Preserves the "already exists" guard from activateAction.
96
- * @returns {{ok:boolean, action:string, itemIds:string[], warnings:string[]}}
97
- */
98
- function apply(agentDir, proposal) {
99
- const slug = proposal?.payload?.slug ?? proposal?.id;
100
- const r = activateAction(agentDir, slug);
101
- if (!r.ok) return { ok: false, action: r.error, itemIds: [], warnings: [] };
102
- return { ok: true, action: `activated ${slug}`, itemIds: [slug], warnings: [] };
103
- }
104
-
105
- /**
106
- * Reject path: dir-shaped, so the gate calls this instead of the JSON archive.
107
- * Moves inbox/<slug> → actions/proposals/archive/<slug> (archive, not delete).
108
- */
109
- function rejectDir(agentDir, slug, _reason = '') {
110
- return rejectAction(agentDir, slug);
111
- }
112
-
113
- /**
114
- * Render a proposed action for the human gate. `card` mirrors the current review
115
- * card (slug ── kind, then the prompt snippet); `line` is the one-line list form.
116
- * @returns {{line:string, card:string}}
117
- */
118
- function render(proposal) {
119
- const slug = proposal?.id ?? proposal?.payload?.slug ?? '';
120
- const kind = proposal?.payload?.kind ?? proposal?.kind ?? 'action';
121
- const snippet = proposal?.promptSnippet ?? '';
122
- return {
123
- line: `${slug} [${kind}] ${snippet}`,
124
- card: `${slug} ── ${kind}\n ${snippet}`,
125
- };
126
- }
127
-
128
- export const adapter = { name, ingest, validate, apply, render, listProposals, getProposal, rejectDir };
129
-
130
- registry.register(adapter);
@@ -1,225 +0,0 @@
1
- // zuzuu/commands/migrate.mjs
2
- // `zuzuu migrate` — one-time migrators.
3
- //
4
- // (default) proposal schema: legacy {candidate, er} → spine {payload, analysis, faculty} (WS2-T5)
5
- // --home faculty home: visible agent/ → hidden .zuzuu/ (W1, 2026-06-12)
6
- //
7
- // Pure cores: migrateProposals(agentDir) → { scanned, migrated, skipped }
8
- // migrateHome(root) → { migrated }
9
- // CLI surface: migrate(args) — resolves paths, runs the core, prints summary.
10
-
11
- import { existsSync, readdirSync, readFileSync, writeFileSync, renameSync, rmSync } from 'node:fs';
12
- import { join } from 'node:path';
13
- import { paths, repoRoot } from '../store.mjs';
14
- import { proposalsDir, archiveDir } from '../faculty/contract.mjs';
15
- import { ensureGitignore } from '../scaffold.mjs';
16
- import { injectBlock, BLOCK_VERSION } from '../inject.mjs';
17
-
18
- // ---------------------------------------------------------------------------
19
- // pure core — testable without process.*
20
- // ---------------------------------------------------------------------------
21
-
22
- /**
23
- * Determine whether a parsed JSON record is already in the new shape.
24
- * A record is "new" when it has `payload` AND `faculty` set.
25
- * If it only has `candidate` and/or lacks `faculty` it is legacy.
26
- */
27
- function isLegacy(rec) {
28
- if (!rec || typeof rec !== 'object') return false;
29
- // already migrated: has payload and faculty
30
- if (rec.payload !== undefined && rec.faculty !== undefined) return false;
31
- // legacy if it has candidate or er keys, or is simply missing faculty/payload
32
- return rec.candidate !== undefined || rec.er !== undefined || rec.faculty === undefined;
33
- }
34
-
35
- /**
36
- * Convert a legacy record to the new unified shape.
37
- * Returns the migrated record (caller writes it back).
38
- */
39
- function migrateRecord(rec) {
40
- const out = { ...rec };
41
-
42
- // payload = candidate (drop candidate)
43
- if (out.candidate !== undefined) {
44
- if (out.payload === undefined) out.payload = out.candidate;
45
- delete out.candidate;
46
- }
47
-
48
- // analysis = { er } (drop er)
49
- if (out.er !== undefined) {
50
- if (out.analysis === undefined) out.analysis = { er: out.er };
51
- delete out.er;
52
- }
53
-
54
- // faculty defaults to 'knowledge' (only knowledge proposals exist pre-spine)
55
- if (!out.faculty) out.faculty = 'knowledge';
56
-
57
- return out;
58
- }
59
-
60
- /**
61
- * Scan one directory of *.json files and migrate legacy records in-place.
62
- * Fail-soft: bad JSON files are counted as skipped and never throw.
63
- * Returns { migrated, scanned, skipped } for this directory.
64
- */
65
- function migrateDir(dir) {
66
- if (!existsSync(dir)) return { migrated: 0, scanned: 0, skipped: 0 };
67
-
68
- const files = readdirSync(dir).filter((f) => f.endsWith('.json'));
69
- let migrated = 0;
70
- let skipped = 0;
71
-
72
- for (const file of files) {
73
- const fpath = join(dir, file);
74
- let rec;
75
- try {
76
- rec = JSON.parse(readFileSync(fpath, 'utf8'));
77
- } catch {
78
- skipped++;
79
- continue;
80
- }
81
-
82
- if (!isLegacy(rec)) {
83
- skipped++;
84
- continue;
85
- }
86
-
87
- try {
88
- const migrated_rec = migrateRecord(rec);
89
- writeFileSync(fpath, JSON.stringify(migrated_rec, null, 2) + '\n');
90
- migrated++;
91
- } catch {
92
- skipped++;
93
- }
94
- }
95
-
96
- return { migrated, scanned: files.length, skipped };
97
- }
98
-
99
- /**
100
- * Scan both pending and archived Knowledge proposals.
101
- * Returns { scanned, migrated, skipped }.
102
- */
103
- export function migrateProposals(agentDir) {
104
- const pending = migrateDir(proposalsDir(agentDir, 'knowledge'));
105
- const archived = migrateDir(archiveDir(agentDir, 'knowledge'));
106
-
107
- return {
108
- scanned: pending.scanned + archived.scanned,
109
- migrated: pending.migrated + archived.migrated,
110
- skipped: pending.skipped + archived.skipped,
111
- };
112
- }
113
-
114
- // ---------------------------------------------------------------------------
115
- // home migration — agent/ → .zuzuu/ (W1, 2026-06-12)
116
- // ---------------------------------------------------------------------------
117
-
118
- // The denies the old visible-agent/ home installed; scrubbed here (NOT kept in
119
- // install.mjs — clean break) and replaced by the current narrow .zuzuu/ pair.
120
- const LEGACY_DENY_RULES = ['Read(./agent/.traces/**)', 'Read(./agent/.live/**)'];
121
- const NEW_DENY_RULES = ['Read(./.zuzuu/.traces/**)', 'Read(./.zuzuu/.live/**)'];
122
-
123
- /**
124
- * One-shot HOME migration: visible `agent/` → hidden `.zuzuu/` (byte-identical
125
- * inner layout). Gated on `agent/agent.json` — `agent/` is a common dir name,
126
- * so an unrelated agent/ dir in a brownfield repo must NEVER be touched (the
127
- * one place this differs from the old `.mns→agent` precedent). Idempotent +
128
- * fail-soft; NEVER clobbers an existing .zuzuu/. Pure FS move (renameSync).
129
- * @returns {{migrated: boolean}}
130
- */
131
- export function migrateHome(root = repoRoot()) {
132
- const legacy = join(root, 'agent');
133
- const home = join(root, '.zuzuu');
134
- if (existsSync(home) || !existsSync(join(legacy, 'agent.json'))) return { migrated: false };
135
-
136
- renameSync(legacy, home); // move the whole home (atomic on same filesystem)
137
-
138
- rewriteTraceRefs(home);
139
- rewriteGitignore(root);
140
- scrubLegacyDenies(root);
141
- // derived index: drop, it rebuilds on the next recall/reindex
142
- try { rmSync(join(home, 'knowledge', '.index.db'), { force: true }); } catch { /* fail-soft */ }
143
- return { migrated: true };
144
- }
145
-
146
- /** sessions.json stores repo-relative traceRefs (`agent/.traces/…`) — re-point them. */
147
- function rewriteTraceRefs(home) {
148
- const index = join(home, 'sessions.json');
149
- if (!existsSync(index)) return;
150
- try {
151
- const idx = JSON.parse(readFileSync(index, 'utf8'));
152
- for (const s of idx.sessions || []) {
153
- if (typeof s.traceRef === 'string' && s.traceRef.startsWith('agent/')) {
154
- s.traceRef = '.zuzuu/' + s.traceRef.slice('agent/'.length);
155
- }
156
- }
157
- writeFileSync(index, JSON.stringify(idx, null, 2) + '\n');
158
- } catch { /* fail-soft: a bad index never blocks the move */ }
159
- }
160
-
161
- /** Drop legacy `agent/` ignore lines, then append the canonical .zuzuu/ ones. */
162
- function rewriteGitignore(root) {
163
- const path = join(root, '.gitignore');
164
- if (existsSync(path)) {
165
- const kept = readFileSync(path, 'utf8')
166
- .split('\n')
167
- .filter((l) => !l.trim().startsWith('agent/'))
168
- .join('\n');
169
- writeFileSync(path, kept.endsWith('\n') || kept === '' ? kept : kept + '\n');
170
- }
171
- ensureGitignore(root); // appends .zuzuu/.traces/, .zuzuu/.live/, .zuzuu/knowledge/.index.db
172
- }
173
-
174
- /** Swap the old agent/ deny rules for the .zuzuu/ pair in any .claude settings file. */
175
- function scrubLegacyDenies(root) {
176
- for (const f of ['settings.json', 'settings.local.json']) {
177
- const path = join(root, '.claude', f);
178
- if (!existsSync(path)) continue;
179
- try {
180
- const s = JSON.parse(readFileSync(path, 'utf8'));
181
- const deny = s?.permissions?.deny;
182
- if (!Array.isArray(deny)) continue;
183
- const hadOurs = deny.some((r) => LEGACY_DENY_RULES.includes(r));
184
- if (!hadOurs) continue;
185
- s.permissions.deny = deny.filter((r) => !LEGACY_DENY_RULES.includes(r));
186
- for (const rule of NEW_DENY_RULES) if (!s.permissions.deny.includes(rule)) s.permissions.deny.push(rule);
187
- writeFileSync(path, JSON.stringify(s, null, 2) + '\n');
188
- } catch { /* fail-soft: never break settings we can't parse */ }
189
- }
190
- }
191
-
192
- /** Re-inject the current faculties block into any existing host instruction files. */
193
- function reinjectHostBlocks(root) {
194
- for (const f of ['CLAUDE.md', 'AGENTS.md', 'GEMINI.md']) {
195
- const p = join(root, f);
196
- if (existsSync(p)) {
197
- const text = readFileSync(p, 'utf8');
198
- if (!text.includes(`zuzuu:faculties:v${BLOCK_VERSION}`)) writeFileSync(p, injectBlock(text));
199
- }
200
- }
201
- }
202
-
203
- // ---------------------------------------------------------------------------
204
- // CLI surface
205
- // ---------------------------------------------------------------------------
206
-
207
- export function migrate(args = {}) {
208
- if (args.home) {
209
- const root = repoRoot(process.cwd());
210
- const { migrated } = migrateHome(root);
211
- if (!migrated) { console.log('migrate --home: nothing to do (already .zuzuu/, or no zuzuu home at agent/)'); return; }
212
- try { reinjectHostBlocks(root); } catch { /* fail-open */ }
213
- console.log(`migrate --home: agent/ → .zuzuu/ (hidden, like .git; block v${BLOCK_VERSION}, gitignore + deny rules rewritten)`);
214
- console.log(' transparency lives in porcelain now: zuzuu status · explain · digest');
215
- return;
216
- }
217
- const agentDir = paths().dir;
218
- const { scanned, migrated, skipped } = migrateProposals(agentDir);
219
- console.log(`migrate: scanned ${scanned} proposal(s) — migrated ${migrated}, skipped ${skipped}`);
220
- if (migrated > 0) {
221
- console.log(' legacy candidate/er keys rewritten to payload/analysis.er + faculty:knowledge');
222
- } else {
223
- console.log(' nothing to migrate (all records already in new shape)');
224
- }
225
- }
package/zuzuu/digest.mjs DELETED
@@ -1,149 +0,0 @@
1
- // zuzuu/digest.mjs
2
- // The grounding digest — a pure, deterministic, zero-network, no-model brief of
3
- // the faculty home, injected at session start. Returns { text, sections }.
4
- // I/O-free: callers (the CLI + the SessionStart hook) handle output. Every
5
- // reader is wrapped so a single broken faculty never sinks the whole digest.
6
-
7
- import { readFileSync } from 'node:fs';
8
- import { join } from 'node:path';
9
- import { allItems } from './knowledge/items.mjs';
10
- import { listProposals } from './knowledge/proposals.mjs';
11
- import { loadRules } from './guardrails.mjs';
12
- import { allActions } from './actions/manifest.mjs';
13
-
14
- const PLACEHOLDER_MARK = '<!-- Fill in:';
15
-
16
- /** Read instructions/project.md; classify empty vs steering text. */
17
- function readInstructions(agentDir) {
18
- const path = join(agentDir, 'instructions', 'project.md');
19
- let raw = '';
20
- try {
21
- raw = readFileSync(path, 'utf8');
22
- } catch { /* missing or unreadable → treat as empty */ }
23
- const stripped = raw.replace(/^#.*$/gm, '').trim();
24
- const empty = !stripped || raw.includes(PLACEHOLDER_MARK);
25
- return { empty, text: empty ? '' : raw.trim() };
26
- }
27
-
28
- const INTERVIEW = [
29
- 'Project steering is empty. Before substantive work, interview your human',
30
- '(what is this project, its conventions, its priorities), draft',
31
- '.zuzuu/instructions/project.md from their answers, and get their approval.',
32
- ].join(' ');
33
-
34
- function knowledgeSection(agentDir, limit) {
35
- try {
36
- const { items } = allItems(agentDir);
37
- const ranked = [...items]
38
- .sort((a, b) => String(b.created_at).localeCompare(String(a.created_at)))
39
- .slice(0, limit);
40
- return { count: items.length, shown: ranked.map((i) => ({ id: i.id, type: i.type, body: i.body })) };
41
- } catch {
42
- return { count: 0, shown: [] };
43
- }
44
- }
45
-
46
- function proposalsSection(agentDir) {
47
- try {
48
- // count only pending — defensive if listProposals ever returns archived too
49
- const pending = listProposals(agentDir).filter((p) => p.status === 'pending');
50
- return { pending: pending.length };
51
- } catch {
52
- return { pending: 0 };
53
- }
54
- }
55
-
56
- function actionsSection(agentDir, limit) {
57
- try {
58
- const list = allActions(agentDir);
59
- return { count: list.length, shown: list.slice(0, limit).map((a) => ({ slug: a.slug, kind: a.kind, promptSnippet: a.promptSnippet })) };
60
- } catch {
61
- return { count: 0, shown: [] };
62
- }
63
- }
64
-
65
- function guardrailsSection(agentDir) {
66
- try {
67
- const loaded = loadRules(join(agentDir, 'guardrails', 'rules.json'));
68
- return { ok: loaded.ok, count: loaded.ok ? loaded.rules.length : 0 };
69
- } catch {
70
- return { ok: false, count: 0 };
71
- }
72
- }
73
-
74
- /**
75
- * Compute the digest for a faculty home.
76
- * @param {string} agentDir path to the .zuzuu/ directory
77
- * @param {{ knowledgeLimit?: number, budget?: number }} options
78
- * @returns {{ text: string, sections: object }}
79
- */
80
- export function computeDigest(agentDir, { knowledgeLimit = 5, budget = 1500 } = {}) {
81
- const charBudget = budget * 4;
82
- const sections = {};
83
- const lines = ['# zuzuu faculty digest', ''];
84
-
85
- const instr = readInstructions(agentDir);
86
- sections.instructions = instr;
87
- lines.push('## Instructions');
88
- lines.push(instr.empty ? INTERVIEW : instr.text);
89
- lines.push('');
90
-
91
- const knowledge = knowledgeSection(agentDir, knowledgeLimit);
92
- lines.push('## Knowledge');
93
- if (!knowledge.count) {
94
- lines.push('(no items yet — propose facts to knowledge/inbox/)');
95
- sections.knowledge = { ...knowledge, renderedCount: 0 };
96
- } else {
97
- lines.push(`${knowledge.count} item(s); most recent:`);
98
- let shown = 0;
99
- for (const it of knowledge.shown) {
100
- const line = `- ${it.id} · ${it.type} · ${it.body.split('\n')[0].slice(0, 80)}`;
101
- // join is O(items²) but trivial: once-per-session, knowledgeLimit default 5
102
- if (lines.join('\n').length + line.length > charBudget && shown > 0) break;
103
- lines.push(line);
104
- shown++;
105
- }
106
- const dropped = knowledge.count - shown;
107
- if (dropped > 0) lines.push(`- … (${dropped} more — \`zuzuu recall\`)`);
108
- // `shown` = items actually rendered (after budget); `count` = total available
109
- sections.knowledge = { ...knowledge, shown: knowledge.shown.slice(0, shown), renderedCount: shown };
110
- }
111
- lines.push('');
112
-
113
- const actions = actionsSection(agentDir, knowledgeLimit);
114
- sections.actions = actions;
115
- if (actions.count) {
116
- lines.push('## Actions');
117
- lines.push(`${actions.count} available; run with \`zuzuu act <slug>\`:`);
118
- let shownA = 0;
119
- for (const a of actions.shown) {
120
- const line = `- ${a.slug} · ${a.promptSnippet}`;
121
- if (lines.join('\n').length + line.length > charBudget && shownA > 0) break;
122
- lines.push(line);
123
- shownA++;
124
- }
125
- const droppedA = actions.count - shownA;
126
- if (droppedA > 0) lines.push(`- … (${droppedA} more — \`zuzuu act list\`)`);
127
- lines.push('');
128
- // mirror the Knowledge contract: shown reflects what actually rendered
129
- sections.actions = { ...actions, shown: actions.shown.slice(0, shownA), renderedCount: shownA };
130
- } else {
131
- sections.actions = { ...actions, renderedCount: 0 };
132
- }
133
-
134
- const proposals = proposalsSection(agentDir);
135
- sections.proposals = proposals;
136
- if (proposals.pending > 0) {
137
- lines.push('## Proposals');
138
- lines.push(`${proposals.pending} proposal(s) await your approval — run \`zuzuu review\`; approving mints a generation (your checkpoint).`);
139
- lines.push('');
140
- }
141
-
142
- const guardrails = guardrailsSection(agentDir);
143
- sections.guardrails = guardrails;
144
- lines.push('## Guardrails');
145
- lines.push(guardrails.count ? `${guardrails.count} rule(s) — the enforced gate is on; refusals are policy.` : 'no rules configured.');
146
- lines.push('');
147
-
148
- return { text: lines.join('\n').trimEnd() + '\n', sections };
149
- }