@pikku/cli 0.12.137 → 0.12.143

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 (300) hide show
  1. package/CHANGELOG.md +153 -0
  2. package/console-app/assets/{abnfDiagram-N423BO3Z-W1UI4BWy.js → abnfDiagram-N423BO3Z-CG60mMUd.js} +1 -1
  3. package/console-app/assets/architecture-TIHT7OUA-DSzfLiV3.js +1 -0
  4. package/console-app/assets/{architectureDiagram-T3A2C74G-Dgnhu9J8.js → architectureDiagram-T3A2C74G-Ch6qWsLf.js} +1 -1
  5. package/console-app/assets/{blockDiagram-VBNYF7ZC-Da-H9pFU.js → blockDiagram-VBNYF7ZC-yRgqjgqW.js} +1 -1
  6. package/console-app/assets/{c4Diagram-5PPSVZJV-CPQ006DM.js → c4Diagram-5PPSVZJV-NvawOgnU.js} +1 -1
  7. package/console-app/assets/channel-DYUdcfEK.js +1 -0
  8. package/console-app/assets/{chunk-2GRJ4B5K-B3QE8g_6.js → chunk-2GRJ4B5K-BJ9-Roz7.js} +1 -1
  9. package/console-app/assets/{chunk-4I5QYGJK-D04DssN0.js → chunk-4I5QYGJK-DZwmcj48.js} +1 -1
  10. package/console-app/assets/{chunk-5RXB4S5H-CXe_vAKZ.js → chunk-5RXB4S5H-BTBwIEIt.js} +1 -1
  11. package/console-app/assets/{chunk-6Q2QTUOP-DhpMC5UR.js → chunk-6Q2QTUOP-C55aqlA-.js} +1 -1
  12. package/console-app/assets/{chunk-7Z6QIM7H-CtoQQGfm.js → chunk-7Z6QIM7H-DRmYZ-SZ.js} +1 -1
  13. package/console-app/assets/{chunk-GF5L2VYU-BovriS0p.js → chunk-GF5L2VYU-InZeM4Hr.js} +1 -1
  14. package/console-app/assets/{chunk-I66GZJ75-Goasace2.js → chunk-I66GZJ75-BNvijc65.js} +1 -1
  15. package/console-app/assets/{chunk-JQJVKLGR-Dy3HStoh.js → chunk-JQJVKLGR-CIMXqmif.js} +1 -1
  16. package/console-app/assets/{chunk-KBJHAD2P-Cm5EwbeQ.js → chunk-KBJHAD2P-C9h3FBoE.js} +1 -1
  17. package/console-app/assets/{chunk-NSK5VX7P-DZ-VVQUA.js → chunk-NSK5VX7P-lz8xBTRo.js} +1 -1
  18. package/console-app/assets/{chunk-QR6OTTB3-W5GRG-wW.js → chunk-QR6OTTB3-CjOfjLMq.js} +1 -1
  19. package/console-app/assets/{chunk-RYQCIY6F-_xvZ8Hx8.js → chunk-RYQCIY6F-CV3667Qm.js} +1 -1
  20. package/console-app/assets/{chunk-UBXNYLIW-C0L1Tpxq.js → chunk-UBXNYLIW-CBN7usxw.js} +1 -1
  21. package/console-app/assets/{chunk-W5SLKNZC-DAyLbBQq.js → chunk-W5SLKNZC-5TkpffRm.js} +1 -1
  22. package/console-app/assets/{chunk-WRU74C26-BrL4inwu.js → chunk-WRU74C26-GBek0Nby.js} +1 -1
  23. package/console-app/assets/chunk-XXDRQBXY-B3U_w_pW.js +1 -0
  24. package/console-app/assets/classDiagram-JCYQIIEL-Mg8_8GSE.js +1 -0
  25. package/console-app/assets/classDiagram-v2-OCEON4UE-Mg8_8GSE.js +1 -0
  26. package/console-app/assets/{cose-bilkent-JH36ORCC-DxHzzMQL.js → cose-bilkent-JH36ORCC-BkGyb7Kn.js} +1 -1
  27. package/console-app/assets/{cynefin-VYW2F7L2-7ytt-CDO.js → cynefin-VYW2F7L2-qMmeyMja.js} +1 -1
  28. package/console-app/assets/{cynefinDiagram-MW4NZA55-Cq-zIV7s.js → cynefinDiagram-MW4NZA55-7MuIYiO4.js} +1 -1
  29. package/console-app/assets/{dagre-Dl-9JF5i.js → dagre-BbESpUs5.js} +1 -1
  30. package/console-app/assets/{dagre-VZM6K2ZE-DLlanPb9.js → dagre-VZM6K2ZE-I6YsMazW.js} +1 -1
  31. package/console-app/assets/{diagram-7IWD3JNH-NTCRs_uw.js → diagram-7IWD3JNH-CJPB2T6d.js} +1 -1
  32. package/console-app/assets/{diagram-B4RE2ZJO-Dwf7hoRU.js → diagram-B4RE2ZJO-CmFGMFPx.js} +1 -1
  33. package/console-app/assets/{diagram-LBJQPF4R-2h_a7jsr.js → diagram-LBJQPF4R-BMzRMe8g.js} +1 -1
  34. package/console-app/assets/{diagram-Q27KOJAE-DuOfl1WJ.js → diagram-Q27KOJAE-CeJb7xQ2.js} +1 -1
  35. package/console-app/assets/{diagram-UB23O5K3-Blp2hikL.js → diagram-UB23O5K3-BQkhJgYU.js} +1 -1
  36. package/console-app/assets/{ebnfDiagram-BXEA7PRR-BwdeYz2Z.js → ebnfDiagram-BXEA7PRR-C1F_8089.js} +1 -1
  37. package/console-app/assets/{erDiagram-JOGREHBK-DY_x1XSg.js → erDiagram-JOGREHBK-DRwpdW4v.js} +1 -1
  38. package/console-app/assets/eventmodeling-45OFAUF4-C5L7A6YY.js +1 -0
  39. package/console-app/assets/flowDiagram-UKHOOZJN-D6GmsM3x.js +1 -0
  40. package/console-app/assets/{ganttDiagram-PKOTCBZU-DxiIwMWB.js → ganttDiagram-PKOTCBZU-CfsGz3Lj.js} +1 -1
  41. package/console-app/assets/{gitGraph-TEB2WS4Q-C3DsIpZV.js → gitGraph-TEB2WS4Q-BBt9AGD3.js} +1 -1
  42. package/console-app/assets/{gitGraphDiagram-DS77QQ5N-C2pPy08m.js → gitGraphDiagram-DS77QQ5N-y5WPOR-G.js} +1 -1
  43. package/console-app/assets/{index-D6aBqNnO.js → index-BmvyL35Z.js} +150 -150
  44. package/console-app/assets/{info-DKCQHKI2-FJuVYZ8D.js → info-DKCQHKI2-mYDlDDyA.js} +1 -1
  45. package/console-app/assets/{infoDiagram-6WML65LV-Bih5T82B.js → infoDiagram-6WML65LV-uOP7AjEu.js} +1 -1
  46. package/console-app/assets/{ishikawaDiagram-WSZJBQD7-jOkuIgMl.js → ishikawaDiagram-WSZJBQD7-BUMKV94t.js} +1 -1
  47. package/console-app/assets/{journeyDiagram-NVQOT4AX-CZ9yVscx.js → journeyDiagram-NVQOT4AX-C8_km86P.js} +1 -1
  48. package/console-app/assets/{kanban-definition-27J2QSJJ-Dpmgfv5c.js → kanban-definition-27J2QSJJ-Ce5oUBPR.js} +1 -1
  49. package/console-app/assets/{line-DjmQl1gv.js → line-D-6c8Gxs.js} +1 -1
  50. package/console-app/assets/{linear-B8fAzric.js → linear-CyrGkJOO.js} +1 -1
  51. package/console-app/assets/{mermaid-parser.core-BxoecV24.js → mermaid-parser.core-CYuFKArA.js} +3 -3
  52. package/console-app/assets/{mermaid.core-D2Ux-Rs7.js → mermaid.core-CXQhu3yO.js} +4 -4
  53. package/console-app/assets/{mindmap-definition-FAOFIHXS-5xpWfvPY.js → mindmap-definition-FAOFIHXS-CTMHna5d.js} +1 -1
  54. package/console-app/assets/{packet-7NZHBO7P-Bq9JPqWg.js → packet-7NZHBO7P-Bu7Wxek6.js} +1 -1
  55. package/console-app/assets/{pegDiagram-VL7TDLO6-BKWLK1GI.js → pegDiagram-VL7TDLO6-CQOikBgW.js} +1 -1
  56. package/console-app/assets/{pie-RZYD4A2V-CsGG-f-c.js → pie-RZYD4A2V-Co7qIvyZ.js} +1 -1
  57. package/console-app/assets/{pieDiagram-7S7Q4E2Y-BRy6lUc2.js → pieDiagram-7S7Q4E2Y-Dh6jYgnj.js} +1 -1
  58. package/console-app/assets/{quadrantDiagram-CIZ2JOQS-OcYHZLLg.js → quadrantDiagram-CIZ2JOQS-Boongjy-.js} +1 -1
  59. package/console-app/assets/{radar-I7S5WNFK-8MO05jdC.js → radar-I7S5WNFK-CSJyAKYA.js} +1 -1
  60. package/console-app/assets/{railroad-3IZDKUUU-CLs1yR0q.js → railroad-3IZDKUUU-DklknXem.js} +1 -1
  61. package/console-app/assets/railroad-abnf-AHOZXSZD-D-2EAJOD.js +1 -0
  62. package/console-app/assets/railroad-ebnf-EBAXGLYW-C5XxxCx7.js +1 -0
  63. package/console-app/assets/railroad-peg-LSFZ7HO6-D8fXoMuX.js +1 -0
  64. package/console-app/assets/{railroadDiagram-AXF67PYL-DjpHDwhw.js → railroadDiagram-AXF67PYL-DEapZRM_.js} +1 -1
  65. package/console-app/assets/{requirementDiagram-LRYGKXZP-CyKaqOMR.js → requirementDiagram-LRYGKXZP-CqFLtnyL.js} +1 -1
  66. package/console-app/assets/{sankeyDiagram-W5VNT64P-0WoWlmdY.js → sankeyDiagram-W5VNT64P-CNu-G1MH.js} +1 -1
  67. package/console-app/assets/{sequenceDiagram-SI44F4Z6-kd31YoP4.js → sequenceDiagram-SI44F4Z6-CoEKUR3G.js} +1 -1
  68. package/console-app/assets/{src-CGPyCqg2.js → src-C1UIZ0TF.js} +1 -1
  69. package/console-app/assets/{stateDiagram-OKZ733FA-Cwy-Xwqp.js → stateDiagram-OKZ733FA-CJka40EH.js} +1 -1
  70. package/console-app/assets/stateDiagram-v2-UEYNNEHI-Bfuo66an.js +1 -0
  71. package/console-app/assets/{swimlanes-SLNWSIFB-Cq0Pq-Qq.js → swimlanes-SLNWSIFB-Dv3MGmvW.js} +1 -1
  72. package/console-app/assets/swimlanesDiagram-ULZ7WXOC-CyQmsXKP.js +8 -0
  73. package/console-app/assets/{timeline-definition-Z64GVDOM-CgFH2I_j.js → timeline-definition-Z64GVDOM-CO8etJHi.js} +1 -1
  74. package/console-app/assets/{treeView-QDETBFTQ-CmeHYUxi.js → treeView-QDETBFTQ-BjLcvY-V.js} +1 -1
  75. package/console-app/assets/{treemap-6X3UGDF4-B6JWxyQe.js → treemap-6X3UGDF4-xC9XqGfS.js} +1 -1
  76. package/console-app/assets/{vennDiagram-T6HMQDX7-DdGYpKcz.js → vennDiagram-T6HMQDX7-CJGsYvlQ.js} +1 -1
  77. package/console-app/assets/{wardley-OPB4EBWU-BVF8AOCQ.js → wardley-OPB4EBWU-DkMc876g.js} +1 -1
  78. package/console-app/assets/{wardleyDiagram-T6FBY63Y-BUFon1WP.js → wardleyDiagram-T6FBY63Y-CTe7zAVZ.js} +1 -1
  79. package/console-app/assets/{xychartDiagram-ELKLHX3M-Bu-WJdeF.js → xychartDiagram-ELKLHX3M-CABg-MLE.js} +1 -1
  80. package/console-app/index.html +1 -1
  81. package/dist/.pikku/addon/index.d.ts +1 -1
  82. package/dist/.pikku/addon/index.js +1 -1
  83. package/dist/.pikku/addon/pikku-addon-types.gen.d.ts +1 -1
  84. package/dist/.pikku/addon/pikku-addon-types.gen.js +1 -1
  85. package/dist/.pikku/agent/index.d.ts +1 -1
  86. package/dist/.pikku/agent/index.js +1 -1
  87. package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +1 -1
  88. package/dist/.pikku/agent/pikku-model-aliases.gen.js +1 -1
  89. package/dist/.pikku/auth/index.d.ts +1 -1
  90. package/dist/.pikku/auth/index.js +1 -1
  91. package/dist/.pikku/auth/pikku-auth-types.gen.d.ts +1 -1
  92. package/dist/.pikku/auth/pikku-auth-types.gen.js +1 -1
  93. package/dist/.pikku/channel/index.d.ts +1 -1
  94. package/dist/.pikku/channel/index.js +1 -1
  95. package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +1 -1
  96. package/dist/.pikku/channel/pikku-channel-types.gen.js +1 -1
  97. package/dist/.pikku/cli/index.d.ts +1 -1
  98. package/dist/.pikku/cli/index.js +1 -1
  99. package/dist/.pikku/cli/pikku-cli-channel.js +11 -1
  100. package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +1 -1
  101. package/dist/.pikku/cli/pikku-cli-client.gen.js +1 -1
  102. package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.d.ts +1 -1
  103. package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.js +1 -1
  104. package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.json +11 -0
  105. package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +1 -1
  106. package/dist/.pikku/cli/pikku-cli-types.gen.js +1 -1
  107. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +1 -1
  108. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.json +24 -0
  109. package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +1 -1
  110. package/dist/.pikku/cli/pikku-cli-wirings.gen.js +1 -1
  111. package/dist/.pikku/cli/pikku-cli.gen.d.ts +1 -1
  112. package/dist/.pikku/cli/pikku-cli.gen.js +1 -1
  113. package/dist/.pikku/error/index.d.ts +1 -1
  114. package/dist/.pikku/error/index.js +1 -1
  115. package/dist/.pikku/error/pikku-error-types.gen.d.ts +1 -1
  116. package/dist/.pikku/error/pikku-error-types.gen.js +1 -1
  117. package/dist/.pikku/function/index.d.ts +1 -1
  118. package/dist/.pikku/function/index.js +1 -1
  119. package/dist/.pikku/function/pikku-function-types.gen.d.ts +1 -1
  120. package/dist/.pikku/function/pikku-function-types.gen.js +1 -1
  121. package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
  122. package/dist/.pikku/function/pikku-functions-meta.gen.json +77 -89
  123. package/dist/.pikku/function/pikku-functions.gen.js +3 -1
  124. package/dist/.pikku/gateway/index.d.ts +1 -1
  125. package/dist/.pikku/gateway/index.js +1 -1
  126. package/dist/.pikku/gateway/pikku-gateway-types.gen.d.ts +1 -1
  127. package/dist/.pikku/gateway/pikku-gateway-types.gen.js +1 -1
  128. package/dist/.pikku/http/index.d.ts +1 -1
  129. package/dist/.pikku/http/index.js +1 -1
  130. package/dist/.pikku/http/pikku-http-types.gen.d.ts +1 -1
  131. package/dist/.pikku/http/pikku-http-types.gen.js +1 -1
  132. package/dist/.pikku/mcp/index.d.ts +1 -1
  133. package/dist/.pikku/mcp/index.js +1 -1
  134. package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +1 -1
  135. package/dist/.pikku/mcp/pikku-mcp-types.gen.js +1 -1
  136. package/dist/.pikku/middleware/index.d.ts +1 -1
  137. package/dist/.pikku/middleware/index.js +1 -1
  138. package/dist/.pikku/middleware/pikku-middleware-types.gen.d.ts +1 -1
  139. package/dist/.pikku/middleware/pikku-middleware-types.gen.js +1 -1
  140. package/dist/.pikku/pikku-bootstrap-scenarios.gen.d.ts +1 -1
  141. package/dist/.pikku/pikku-bootstrap-scenarios.gen.js +1 -1
  142. package/dist/.pikku/pikku-bootstrap.gen.d.ts +1 -1
  143. package/dist/.pikku/pikku-bootstrap.gen.js +1 -1
  144. package/dist/.pikku/pikku-services.gen.d.ts +1 -1
  145. package/dist/.pikku/queue/index.d.ts +1 -1
  146. package/dist/.pikku/queue/index.js +1 -1
  147. package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +1 -1
  148. package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -1
  149. package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +1 -1
  150. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +1 -1
  151. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +1 -1
  152. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +1 -1
  153. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +3 -3
  154. package/dist/.pikku/scenarios/index.d.ts +1 -1
  155. package/dist/.pikku/scenarios/index.js +1 -1
  156. package/dist/.pikku/scenarios/pikku-personas.gen.js +1 -1
  157. package/dist/.pikku/scenarios/pikku-scenario-functions-meta.gen.js +1 -1
  158. package/dist/.pikku/scenarios/pikku-scenario-functions.gen.d.ts +1 -1
  159. package/dist/.pikku/scenarios/pikku-scenario-types.gen.d.ts +1 -1
  160. package/dist/.pikku/scenarios/pikku-scenario-wirings-meta.gen.js +1 -1
  161. package/dist/.pikku/scenarios/pikku-scenario-wirings.gen.d.ts +1 -1
  162. package/dist/.pikku/scenarios/schemas/register.gen.d.ts +1 -1
  163. package/dist/.pikku/scenarios/schemas/register.gen.js +1 -1
  164. package/dist/.pikku/scheduler/index.d.ts +1 -1
  165. package/dist/.pikku/scheduler/index.js +1 -1
  166. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +1 -1
  167. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
  168. package/dist/.pikku/schemas/register.gen.js +7 -5
  169. package/dist/.pikku/schemas/schemas/FabricLinkInput.schema.json +1 -1
  170. package/dist/.pikku/schemas/schemas/KnowledgeReconcileInput.schema.json +1 -0
  171. package/dist/.pikku/schemas/schemas/KnowledgeReconcileOutput.schema.json +1 -0
  172. package/dist/.pikku/scopes/index.d.ts +1 -1
  173. package/dist/.pikku/scopes/index.js +1 -1
  174. package/dist/.pikku/scopes/pikku-personas.gen.js +1 -1
  175. package/dist/.pikku/scopes/pikku-roles.gen.d.ts +1 -1
  176. package/dist/.pikku/scopes/pikku-scope-types.gen.d.ts +1 -1
  177. package/dist/.pikku/scopes/pikku-scope-types.gen.js +1 -1
  178. package/dist/.pikku/scopes/pikku-scopes.gen.d.ts +1 -1
  179. package/dist/.pikku/secrets/index.d.ts +1 -1
  180. package/dist/.pikku/secrets/index.js +1 -1
  181. package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +1 -1
  182. package/dist/.pikku/secrets/pikku-secret-types.gen.js +1 -1
  183. package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +1 -1
  184. package/dist/.pikku/secrets/pikku-secrets.gen.js +1 -1
  185. package/dist/.pikku/services/pikku-meta-service.gen.d.ts +1 -1
  186. package/dist/.pikku/services/pikku-meta-service.gen.js +1 -1
  187. package/dist/.pikku/setup/index.d.ts +1 -1
  188. package/dist/.pikku/setup/index.js +1 -1
  189. package/dist/.pikku/setup/pikku-setup-types.gen.d.ts +1 -1
  190. package/dist/.pikku/setup/pikku-setup-types.gen.js +1 -1
  191. package/dist/.pikku/trigger/index.d.ts +1 -1
  192. package/dist/.pikku/trigger/index.js +1 -1
  193. package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +1 -1
  194. package/dist/.pikku/trigger/pikku-trigger-types.gen.js +1 -1
  195. package/dist/.pikku/variables/index.d.ts +1 -1
  196. package/dist/.pikku/variables/index.js +1 -1
  197. package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +1 -1
  198. package/dist/.pikku/variables/pikku-variable-types.gen.js +1 -1
  199. package/dist/.pikku/variables/pikku-variables.gen.d.ts +1 -1
  200. package/dist/.pikku/variables/pikku-variables.gen.js +1 -1
  201. package/dist/.pikku/workflow/index.d.ts +1 -1
  202. package/dist/.pikku/workflow/index.js +1 -1
  203. package/dist/.pikku/workflow/meta/allWorkflow.gen.json +8 -2
  204. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +1 -1
  205. package/dist/.pikku/workflow/pikku-workflow-types.gen.js +1 -1
  206. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +1 -1
  207. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
  208. package/dist/bin/pikku-bin.mjs +2 -2
  209. package/dist/src/cli.wiring.js +11 -1
  210. package/dist/src/deploy/analyzer/analyzer.js +29 -0
  211. package/dist/src/deploy/build-pipeline.js +2 -0
  212. package/dist/src/deploy/bundler/bun-bundler.js +5 -2
  213. package/dist/src/deploy/bundler/bundler.interface.d.ts +9 -1
  214. package/dist/src/deploy/bundler/bundler.js +1 -0
  215. package/dist/src/deploy/bundler/node-bundler.js +12 -2
  216. package/dist/src/deploy/bundler/service-module-map.js +2 -2
  217. package/dist/src/fabric/fabric-commands.d.ts +18 -9
  218. package/dist/src/fabric/fabric-commands.js +11 -0
  219. package/dist/src/fabric/functions/deploy.function.d.ts +5 -5
  220. package/dist/src/fabric/functions/link.function.d.ts +12 -0
  221. package/dist/src/fabric/functions/link.function.js +95 -6
  222. package/dist/src/fabric/functions/llm-key.function.d.ts +4 -4
  223. package/dist/src/fabric/functions/smoke.function.d.ts +4 -4
  224. package/dist/src/fabric/lib/git.d.ts +27 -0
  225. package/dist/src/fabric/lib/git.js +70 -2
  226. package/dist/src/functions/commands/db-export.js +4 -9
  227. package/dist/src/functions/commands/dev.js +12 -18
  228. package/dist/src/functions/commands/enable.d.ts +1 -0
  229. package/dist/src/functions/commands/enable.js +3 -0
  230. package/dist/src/functions/commands/knowledge-reconcile.d.ts +45 -0
  231. package/dist/src/functions/commands/knowledge-reconcile.js +11 -0
  232. package/dist/src/functions/commands/serve.js +12 -18
  233. package/dist/src/functions/db/local-db.d.ts +12 -2
  234. package/dist/src/functions/db/local-db.js +86 -14
  235. package/dist/src/functions/knowledge/render.d.ts +12 -1
  236. package/dist/src/functions/knowledge/render.js +48 -0
  237. package/dist/src/functions/knowledge/schemas.d.ts +23 -0
  238. package/dist/src/functions/knowledge/schemas.js +3 -1
  239. package/dist/src/functions/wirings/agent/pikku-command-agent.js +11 -14
  240. package/dist/src/functions/wirings/channels/pikku-command-channels.js +10 -13
  241. package/dist/src/functions/wirings/cli/pikku-command-cli.js +10 -13
  242. package/dist/src/functions/wirings/console/pikku-command-nodes-meta.js +7 -15
  243. package/dist/src/functions/wirings/credentials/serialize-credentials-types.js +2 -8
  244. package/dist/src/functions/wirings/functions/pikku-command-functions.js +21 -18
  245. package/dist/src/functions/wirings/gateway/pikku-command-gateway.js +11 -10
  246. package/dist/src/functions/wirings/http/pikku-command-http-routes.js +10 -13
  247. package/dist/src/functions/wirings/mcp/pikku-command-mcp.js +11 -17
  248. package/dist/src/functions/wirings/personas/serialize-personas-types.js +2 -2
  249. package/dist/src/functions/wirings/queue/pikku-command-queue.js +11 -14
  250. package/dist/src/functions/wirings/remote-jobs/pikku-command-remote-jobs.d.ts +1 -0
  251. package/dist/src/functions/wirings/remote-jobs/pikku-command-remote-jobs.js +31 -0
  252. package/dist/src/functions/wirings/remote-jobs/serialize-remote-jobs.d.ts +16 -0
  253. package/dist/src/functions/wirings/remote-jobs/serialize-remote-jobs.js +78 -0
  254. package/dist/src/functions/wirings/roles/serialize-roles-types.js +2 -2
  255. package/dist/src/functions/wirings/scheduler/pikku-command-scheduler.js +11 -12
  256. package/dist/src/functions/wirings/scopes/serialize-scopes-client.js +2 -2
  257. package/dist/src/functions/wirings/scopes/serialize-scopes-types.js +5 -3
  258. package/dist/src/functions/wirings/secrets/serialize-secrets-types.js +4 -10
  259. package/dist/src/functions/wirings/triggers/pikku-command-trigger.js +11 -11
  260. package/dist/src/functions/wirings/variables/serialize-variables-types.js +2 -8
  261. package/dist/src/functions/wirings/workflow/pikku-command-workflow.js +7 -8
  262. package/dist/src/functions/workflows/all.workflow.js +8 -0
  263. package/dist/src/services.js +13 -0
  264. package/dist/src/utils/pikku-cli-config.js +4 -0
  265. package/dist/src/utils/remote-jobs-schemas-file.d.ts +6 -0
  266. package/dist/src/utils/remote-jobs-schemas-file.js +9 -0
  267. package/dist/src/utils/remove-legacy-scaffold-file.js +3 -0
  268. package/dist/src/utils/strip-verbose-meta.d.ts +9 -10
  269. package/dist/src/utils/strip-verbose-meta.js +15 -19
  270. package/dist/src/utils/ts-literal.d.ts +7 -0
  271. package/dist/src/utils/ts-literal.js +7 -0
  272. package/dist/src/utils/write-wiring-meta.d.ts +43 -0
  273. package/dist/src/utils/write-wiring-meta.js +45 -0
  274. package/dist/tsconfig.tsbuildinfo +1 -1
  275. package/package.json +10 -10
  276. package/surface.json +15 -15
  277. package/console-app/assets/architecture-TIHT7OUA-ChuyZvLt.js +0 -1
  278. package/console-app/assets/channel-Bk5Nkkn2.js +0 -1
  279. package/console-app/assets/chunk-XXDRQBXY-CCdCi2uV.js +0 -1
  280. package/console-app/assets/classDiagram-JCYQIIEL-Dgekxp3j.js +0 -1
  281. package/console-app/assets/classDiagram-v2-OCEON4UE-Dgekxp3j.js +0 -1
  282. package/console-app/assets/eventmodeling-45OFAUF4-2ImzjrgM.js +0 -1
  283. package/console-app/assets/flowDiagram-UKHOOZJN-DmrgHe66.js +0 -1
  284. package/console-app/assets/railroad-abnf-AHOZXSZD-CA9-7Fw1.js +0 -1
  285. package/console-app/assets/railroad-ebnf-EBAXGLYW-BhkwTTAW.js +0 -1
  286. package/console-app/assets/railroad-peg-LSFZ7HO6-BEaB8UlJ.js +0 -1
  287. package/console-app/assets/stateDiagram-v2-UEYNNEHI-DExEOOCw.js +0 -1
  288. package/console-app/assets/swimlanesDiagram-ULZ7WXOC-B0RUxlCH.js +0 -8
  289. package/dist/.pikku/schemas/schemas/PikkuQueueOutput.schema.json +0 -1
  290. package/dist/src/fabric/lib/not-implemented.d.ts +0 -5
  291. package/dist/src/fabric/lib/not-implemented.js +0 -8
  292. package/dist/src/functions/wirings/channels/pikku-channels.d.ts +0 -1
  293. package/dist/src/functions/wirings/channels/pikku-channels.js +0 -38
  294. package/dist/src/functions/wirings/http/pikku-http-routes.d.ts +0 -1
  295. package/dist/src/functions/wirings/http/pikku-http-routes.js +0 -30
  296. package/dist/src/functions/wirings/queue/pikku-queue.d.ts +0 -1
  297. package/dist/src/functions/wirings/queue/pikku-queue.js +0 -31
  298. package/dist/src/utils/pikku-files-and-methods.d.ts +0 -20
  299. package/dist/src/utils/pikku-files-and-methods.js +0 -25
  300. /package/dist/.pikku/schemas/schemas/{PikkuHTTPOutput.schema.json → PikkuRemoteJobsOutput.schema.json} +0 -0
@@ -41,11 +41,11 @@ function envWithoutInheritedRepo() {
41
41
  }
42
42
  return env;
43
43
  }
44
- function git(args, cwd = process.cwd()) {
44
+ function git(args, cwd = process.cwd(), extraEnv) {
45
45
  return new Promise((resolve, reject) => {
46
46
  const child = spawn('git', args, {
47
47
  cwd,
48
- env: envWithoutInheritedRepo(),
48
+ env: { ...envWithoutInheritedRepo(), ...extraEnv },
49
49
  stdio: ['ignore', 'pipe', 'pipe'],
50
50
  });
51
51
  let stdout = '';
@@ -218,3 +218,71 @@ export async function isGitRepo(cwd = process.cwd()) {
218
218
  return false;
219
219
  }
220
220
  }
221
+ /**
222
+ * Does this repository have the given remote?
223
+ *
224
+ * Separate from `getRemoteUrl` throwing, because "no origin" is an ordinary
225
+ * state that `link` acts on rather than an error it reports: a developer who
226
+ * has not pushed anywhere yet is exactly who repo provisioning is for.
227
+ */
228
+ export async function hasRemote(remote = 'origin', cwd) {
229
+ try {
230
+ await git(['remote', 'get-url', remote], cwd);
231
+ return true;
232
+ }
233
+ catch {
234
+ return false;
235
+ }
236
+ }
237
+ /** Does HEAD resolve? False in a repository with no commits yet. */
238
+ export async function hasCommits(cwd) {
239
+ try {
240
+ await git(['rev-parse', '--verify', 'HEAD'], cwd);
241
+ return true;
242
+ }
243
+ catch {
244
+ return false;
245
+ }
246
+ }
247
+ export async function addRemote(name, url, cwd) {
248
+ await git(['remote', 'add', name, url], cwd);
249
+ }
250
+ export async function removeRemote(name, cwd) {
251
+ try {
252
+ await git(['remote', 'remove', name], cwd);
253
+ }
254
+ catch {
255
+ /* best-effort: only used to undo a remote we just added */
256
+ }
257
+ }
258
+ /**
259
+ * Push `branch` to `remote` and set it as upstream, authenticating with a
260
+ * one-shot credential.
261
+ *
262
+ * The credential is passed through the ENVIRONMENT and read back by an inline
263
+ * credential helper, rather than embedded in the remote URL. Both a URL like
264
+ * `https://user:token@host/...` and `-c http.<url>.extraheader=...` put the
265
+ * secret in the process's argv, where any other user on the machine can read it
266
+ * out of `ps`. This way argv holds only the shape of the helper, and the token
267
+ * never reaches `.git/config` either — so it cannot outlive the push.
268
+ */
269
+ export async function pushWithCredential(remote, branch, credential, cwd) {
270
+ await git([
271
+ '-c',
272
+ 'credential.helper=',
273
+ '-c',
274
+ 'credential.helper=!f() { echo "username=$PIKKU_GIT_USERNAME"; echo "password=$PIKKU_GIT_PASSWORD"; }; f',
275
+ 'push',
276
+ '-u',
277
+ remote,
278
+ `HEAD:refs/heads/${branch}`,
279
+ ], cwd, {
280
+ PIKKU_GIT_USERNAME: credential.username,
281
+ PIKKU_GIT_PASSWORD: credential.password,
282
+ // Any configured interactive helper (osxkeychain, a GUI prompt) would be
283
+ // consulted first and could hang a CLI with no one at the terminal. The
284
+ // empty `credential.helper=` above resets the inherited list; this stops
285
+ // git falling back to a terminal prompt if ours somehow yields nothing.
286
+ GIT_TERMINAL_PROMPT: '0',
287
+ });
288
+ }
@@ -1,7 +1,5 @@
1
- import { mkdirSync, writeFileSync } from 'node:fs';
2
- import { dirname, join } from 'node:path';
3
1
  import { pikkuSessionlessFunc } from '#pikku/function';
4
- import { exportSchema } from '../db/local-db.js';
2
+ import { writeSchemaArtifact } from '../db/local-db.js';
5
3
  /**
6
4
  * Publish this package's schema so a project consuming it as an addon can
7
5
  * create its tables.
@@ -16,15 +14,12 @@ import { exportSchema } from '../db/local-db.js';
16
14
  export const dbExport = pikkuSessionlessFunc({
17
15
  remote: true,
18
16
  func: async ({ logger, config }) => {
19
- const artifact = await exportSchema(config.rootDir, config.db?.pgliteExtensions);
20
- const dialects = Object.keys(artifact);
17
+ const { file, dialects } = await writeSchemaArtifact(config.rootDir, config.outDir, config.db?.pgliteExtensions);
21
18
  if (dialects.length === 0) {
22
- logger.info('db export: no db/sqlite or db/postgres migrations — nothing to publish');
19
+ logger.info(`db export: no db/sqlite or db/postgres migrations — wrote ${file} empty, ` +
20
+ 'which is how a consumer tells "no tables" from "never published"');
23
21
  return;
24
22
  }
25
- const file = join(config.outDir, 'db', 'pikku-db-meta.gen.json');
26
- mkdirSync(dirname(file), { recursive: true });
27
- writeFileSync(file, `${JSON.stringify(artifact, null, 2)}\n`, 'utf8');
28
23
  logger.info(`db export: wrote ${file} for ${dialects.join(', ')}`);
29
24
  logger.info(' Ship it with the package — a consumer resolves it through the package name.');
30
25
  },
@@ -159,23 +159,17 @@ export const dev = pikkuSessionlessFunc({
159
159
  ? await createKysely(resolvedLocalDb)
160
160
  : undefined;
161
161
  const resolvedRuntimeDir = config.runtimeDir ?? join(config.rootDir, '.pikku-runtime');
162
- const localContentConfig = userConfig.content
163
- ? {
164
- localFileUploadPath: userConfig.content.contentPath
165
- ? resolve(config.rootDir, userConfig.content.contentPath)
166
- : join(resolvedRuntimeDir, 'content'),
167
- uploadUrlPrefix: userConfig.content.uploadUrlPrefix ?? '/upload',
168
- assetUrlPrefix: userConfig.content.assetUrlPrefix ?? '/assets',
169
- server: `http://${hostname}:${resolvedPort}`,
170
- sizeLimit: userConfig.content.sizeLimit,
171
- }
172
- : undefined;
173
- const contentSigningJWT = localContentConfig
174
- ? createEphemeralContentSigningJWT()
175
- : undefined;
176
- const localContent = localContentConfig && contentSigningJWT
177
- ? new LocalContent(localContentConfig, logger, contentSigningJWT)
178
- : undefined;
162
+ const localContentConfig = {
163
+ localFileUploadPath: userConfig.content?.contentPath
164
+ ? resolve(config.rootDir, userConfig.content.contentPath)
165
+ : join(resolvedRuntimeDir, 'content'),
166
+ uploadUrlPrefix: userConfig.content?.uploadUrlPrefix ?? '/upload',
167
+ assetUrlPrefix: userConfig.content?.assetUrlPrefix ?? '/assets',
168
+ server: `http://${hostname}:${resolvedPort}`,
169
+ sizeLimit: userConfig.content?.sizeLimit,
170
+ };
171
+ const contentSigningJWT = createEphemeralContentSigningJWT();
172
+ const localContent = new LocalContent(localContentConfig, logger, contentSigningJWT);
179
173
  const schedulerService = new InMemorySchedulerService();
180
174
  const agentStorage = kysely
181
175
  ? new KyselyAgentStorageService(kysely)
@@ -236,7 +230,7 @@ export const dev = pikkuSessionlessFunc({
236
230
  agentRunService,
237
231
  eventHub,
238
232
  ...(kysely ? { kysely } : {}),
239
- ...(localContent ? { content: localContent } : {}),
233
+ content: localContent,
240
234
  };
241
235
  const singletonServices = await userCreateSingletonServices(userConfig, {
242
236
  ...inMemoryServices,
@@ -5,4 +5,5 @@ export declare const enableAgent: import("#pikku/function").PikkuFunctionConfig<
5
5
  export declare const enableWorkflow: import("#pikku/function").PikkuFunctionConfig<void, void, "rpc" | "session", import("#pikku/function").PikkuFunctionSessionless<void, void, "rpc" | "session", import("#pikku/function").WiredServices, unknown> | import("#pikku/function").PikkuFunction<void, void, "rpc" | "session", import("#pikku/function").WiredServices>, undefined, undefined>;
6
6
  export declare const enableEvents: import("#pikku/function").PikkuFunctionConfig<void, void, "rpc" | "session", import("#pikku/function").PikkuFunctionSessionless<void, void, "rpc" | "session", import("#pikku/function").WiredServices, unknown> | import("#pikku/function").PikkuFunction<void, void, "rpc" | "session", import("#pikku/function").WiredServices>, undefined, undefined>;
7
7
  export declare const enableRemoteRpc: import("#pikku/function").PikkuFunctionConfig<void, void, "rpc" | "session", import("#pikku/function").PikkuFunctionSessionless<void, void, "rpc" | "session", import("#pikku/function").WiredServices, unknown> | import("#pikku/function").PikkuFunction<void, void, "rpc" | "session", import("#pikku/function").WiredServices>, undefined, undefined>;
8
+ export declare const enableRemoteJobs: import("#pikku/function").PikkuFunctionConfig<void, void, "rpc" | "session", import("#pikku/function").PikkuFunctionSessionless<void, void, "rpc" | "session", import("#pikku/function").WiredServices, unknown> | import("#pikku/function").PikkuFunction<void, void, "rpc" | "session", import("#pikku/function").WiredServices>, undefined, undefined>;
8
9
  export declare const enableWebhook: import("#pikku/function").PikkuFunctionConfig<void, void, "rpc" | "session", import("#pikku/function").PikkuFunctionSessionless<void, void, "rpc" | "session", import("#pikku/function").WiredServices, unknown> | import("#pikku/function").PikkuFunction<void, void, "rpc" | "session", import("#pikku/function").WiredServices>, undefined, undefined>;
@@ -37,6 +37,9 @@ export const enableEvents = pikkuVoidFunc({
37
37
  export const enableRemoteRpc = pikkuVoidFunc({
38
38
  func: async ({ logger, config }) => enableFeature('remoteRpc', logger, config),
39
39
  });
40
+ export const enableRemoteJobs = pikkuVoidFunc({
41
+ func: async ({ logger, config }) => enableFeature('remoteJobs', logger, config),
42
+ });
40
43
  export const enableWebhook = pikkuVoidFunc({
41
44
  func: async ({ logger, config }) => enableFeature('webhook', logger, config),
42
45
  });
@@ -0,0 +1,45 @@
1
+ import { renderKnowledgeReconcile } from '../knowledge/render.js';
2
+ export declare const knowledgeReconcile: import("#pikku/function").PikkuFunctionConfig<Record<string, never>, {
3
+ kind: "hold" | "idle" | "repair-note" | "write-plan" | "ask-user" | "dispatch";
4
+ reason: string;
5
+ note?: string | undefined;
6
+ hold?: string | undefined;
7
+ notes?: string[] | undefined;
8
+ question?: {
9
+ header: string;
10
+ question: string;
11
+ options: {
12
+ label: string;
13
+ description?: string | undefined;
14
+ }[];
15
+ } | undefined;
16
+ }, "rpc" | "session", import("#pikku/function").PikkuFunctionSessionless<Record<string, never>, {
17
+ kind: "hold" | "idle" | "repair-note" | "write-plan" | "ask-user" | "dispatch";
18
+ reason: string;
19
+ note?: string | undefined;
20
+ hold?: string | undefined;
21
+ notes?: string[] | undefined;
22
+ question?: {
23
+ header: string;
24
+ question: string;
25
+ options: {
26
+ label: string;
27
+ description?: string | undefined;
28
+ }[];
29
+ } | undefined;
30
+ }, "rpc" | "session", import("#pikku/function").WiredServices, unknown> | import("#pikku/function").PikkuFunction<Record<string, never>, {
31
+ kind: "hold" | "idle" | "repair-note" | "write-plan" | "ask-user" | "dispatch";
32
+ reason: string;
33
+ note?: string | undefined;
34
+ hold?: string | undefined;
35
+ notes?: string[] | undefined;
36
+ question?: {
37
+ header: string;
38
+ question: string;
39
+ options: {
40
+ label: string;
41
+ description?: string | undefined;
42
+ }[];
43
+ } | undefined;
44
+ }, "rpc" | "session", import("#pikku/function").WiredServices>, undefined, undefined>;
45
+ export { renderKnowledgeReconcile };
@@ -0,0 +1,11 @@
1
+ import { pikkuSessionlessFunc } from '#pikku/function';
2
+ import { runKnowledgeReconcile } from '@pikku/knowledge';
3
+ import { renderKnowledgeReconcile } from '../knowledge/render.js';
4
+ import { KnowledgeReconcileInputSchema, KnowledgeReconcileOutputSchema, } from '../knowledge/schemas.js';
5
+ export const knowledgeReconcile = pikkuSessionlessFunc({
6
+ description: 'Say the one thing to do next with the knowledge base — repair a note, write a plan, ask the user, dispatch a build, or nothing — derived from what is on disk rather than from what a previous step remembered to announce.',
7
+ input: KnowledgeReconcileInputSchema,
8
+ output: KnowledgeReconcileOutputSchema,
9
+ func: async ({ config }) => runKnowledgeReconcile(config.rootDir),
10
+ });
11
+ export { renderKnowledgeReconcile };
@@ -62,23 +62,17 @@ export const serve = pikkuSessionlessFunc({
62
62
  ? await createKysely(resolvedLocalDb)
63
63
  : undefined;
64
64
  const resolvedRuntimeDir = config.runtimeDir ?? join(config.rootDir, '.pikku-runtime');
65
- const localContentConfig = userConfig.content
66
- ? {
67
- localFileUploadPath: userConfig.content.contentPath
68
- ? resolve(config.rootDir, userConfig.content.contentPath)
69
- : join(resolvedRuntimeDir, 'content'),
70
- uploadUrlPrefix: userConfig.content.uploadUrlPrefix ?? '/upload',
71
- assetUrlPrefix: userConfig.content.assetUrlPrefix ?? '/assets',
72
- server: `http://${hostname}:${resolvedPort}`,
73
- sizeLimit: userConfig.content.sizeLimit,
74
- }
75
- : undefined;
76
- const contentSigningJWT = localContentConfig
77
- ? createEphemeralContentSigningJWT()
78
- : undefined;
79
- const localContent = localContentConfig && contentSigningJWT
80
- ? new LocalContent(localContentConfig, logger, contentSigningJWT)
81
- : undefined;
65
+ const localContentConfig = {
66
+ localFileUploadPath: userConfig.content?.contentPath
67
+ ? resolve(config.rootDir, userConfig.content.contentPath)
68
+ : join(resolvedRuntimeDir, 'content'),
69
+ uploadUrlPrefix: userConfig.content?.uploadUrlPrefix ?? '/upload',
70
+ assetUrlPrefix: userConfig.content?.assetUrlPrefix ?? '/assets',
71
+ server: `http://${hostname}:${resolvedPort}`,
72
+ sizeLimit: userConfig.content?.sizeLimit,
73
+ };
74
+ const contentSigningJWT = createEphemeralContentSigningJWT();
75
+ const localContent = new LocalContent(localContentConfig, logger, contentSigningJWT);
82
76
  const schedulerService = new InMemorySchedulerService();
83
77
  const agentStorage = kysely
84
78
  ? new KyselyAgentStorageService(kysely)
@@ -121,7 +115,7 @@ export const serve = pikkuSessionlessFunc({
121
115
  agentRunService,
122
116
  eventHub,
123
117
  ...(kysely ? { kysely } : {}),
124
- ...(localContent ? { content: localContent } : {}),
118
+ content: localContent,
125
119
  };
126
120
  const singletonServices = await userCreateSingletonServices(userConfig, {
127
121
  ...inMemoryServices,
@@ -74,8 +74,6 @@ export declare function resolveDb(userConfig: UserConfigShape, rootDir: string,
74
74
  defaultSchema?: string;
75
75
  pgliteExtensions?: string[];
76
76
  } | string): ResolvedDb | null;
77
- /** @deprecated Use resolveDb(userConfig, ...) instead. */
78
- export declare function resolveLocalDb(sqliteDb: string | undefined, rootDir: string, outDir: string, runtimeDir?: string): ResolvedSqliteDb | null;
79
77
  /**
80
78
  * What an embedded PGlite instance needs beyond its data directory: where to
81
79
  * resolve extension packages from, and which ones to load.
@@ -356,6 +354,18 @@ export interface AddonDeclaration {
356
354
  * projects on either engine.
357
355
  */
358
356
  export declare function exportSchema(rootDir: string, pgliteExtensions?: string[]): Promise<SchemaArtifact>;
357
+ /**
358
+ * Write the artifact a consumer reads, whether or not this package has tables.
359
+ *
360
+ * An addon with no tables still publishes, because the consumer's only other
361
+ * reading of an absent file is "this package cannot say", which it must treat
362
+ * as a broken publish. The empty artifact is the addon stating, in a file that
363
+ * ships, that it needs nothing.
364
+ */
365
+ export declare function writeSchemaArtifact(rootDir: string, outDir: string, pgliteExtensions?: string[]): Promise<{
366
+ file: string;
367
+ dialects: string[];
368
+ }>;
359
369
  /**
360
370
  * The schema every wired addon publishes, as sources.
361
371
  *
@@ -10,7 +10,7 @@ import { applyPikkuSchemas, compilePikkuSchemas, pikkuSchemas, requiredPikkuSche
10
10
  import { loadAuthOptions, getAuthMigrations } from './better-auth-schema.js';
11
11
  import { generateSchemaTypes } from './db-codegen.js';
12
12
  import { generateZodTypes } from './zod-codegen.js';
13
- import { tableCreationSql } from '@pikku/migrator-sql';
13
+ import { tableCreationSql, tablesInSourceOrder } from '@pikku/migrator-sql';
14
14
  import { SqliteMigrationExecutor } from '@pikku/migrator-sql/sqlite';
15
15
  import { SqliteIntrospector } from './sqlite/sqlite-introspector.js';
16
16
  import { createSqliteKysely } from './sqlite/sqlite-kysely.js';
@@ -114,13 +114,6 @@ export function resolveDb(userConfig, rootDir, outDir, runtimeDir, dbConfig) {
114
114
  }
115
115
  return null;
116
116
  }
117
- /** @deprecated Use resolveDb(userConfig, ...) instead. */
118
- export function resolveLocalDb(sqliteDb, rootDir, outDir, runtimeDir) {
119
- if (!sqliteDb)
120
- return null;
121
- const result = resolveDb({ sqliteDb }, rootDir, outDir, runtimeDir);
122
- return result;
123
- }
124
117
  function resolveAgainst(root, p) {
125
118
  return isAbsolute(p) ? p : resolve(root, p);
126
119
  }
@@ -242,7 +235,14 @@ async function createEmbeddedPostgres(context, dataDir) {
242
235
  embeddedPostgresWasm,
243
236
  loadPGliteExtensions(context.rootDir, context.pgliteExtensions),
244
237
  ]);
245
- return new PGlite({
238
+ // PGlite runs Postgres as an Emscripten module, and Emscripten's exit handler
239
+ // writes the WASM program's status straight to `process.exitCode` — booting a
240
+ // database leaves it at 99 even though nothing failed. The CLI's bin then
241
+ // ends with `process.exit(process.exitCode ?? 0)`, so any command that merely
242
+ // touched the embedded database reported failure after doing all of its work
243
+ // correctly. Restore whatever the process had before the boot.
244
+ const exitCodeBeforeBoot = process.exitCode;
245
+ const db = new PGlite({
246
246
  ...(dataDir ? { dataDir } : {}),
247
247
  ...wasm,
248
248
  extensions: {
@@ -250,6 +250,13 @@ async function createEmbeddedPostgres(context, dataDir) {
250
250
  ...declared,
251
251
  },
252
252
  });
253
+ await db.waitReady;
254
+ if (process.exitCode !== exitCodeBeforeBoot) {
255
+ // `?? 0` because assigning `undefined` does not clear an already-set
256
+ // exitCode under bun, which is the runtime the boot pollutes it on.
257
+ process.exitCode = exitCodeBeforeBoot ?? 0;
258
+ }
259
+ return db;
253
260
  }
254
261
  /**
255
262
  * PGlite reports an extension it was never given as a plain
@@ -1066,6 +1073,59 @@ export async function exportSchema(rootDir, pgliteExtensions = []) {
1066
1073
  }
1067
1074
  return artifact;
1068
1075
  }
1076
+ /**
1077
+ * Write the artifact a consumer reads, whether or not this package has tables.
1078
+ *
1079
+ * An addon with no tables still publishes, because the consumer's only other
1080
+ * reading of an absent file is "this package cannot say", which it must treat
1081
+ * as a broken publish. The empty artifact is the addon stating, in a file that
1082
+ * ships, that it needs nothing.
1083
+ */
1084
+ export async function writeSchemaArtifact(rootDir, outDir, pgliteExtensions) {
1085
+ const artifact = await exportSchema(rootDir, pgliteExtensions);
1086
+ const file = join(outDir, 'db', 'pikku-db-meta.gen.json');
1087
+ mkdirSync(dirname(file), { recursive: true });
1088
+ writeFileSync(file, `${JSON.stringify(artifact, null, 2)}\n`, 'utf8');
1089
+ return { file, dialects: Object.keys(artifact) };
1090
+ }
1091
+ /**
1092
+ * Read and check one addon's published artifact.
1093
+ *
1094
+ * The file is generated, so a malformed one is not an authoring mistake to be
1095
+ * explained away — it is a broken publish, and every branch here says which
1096
+ * package to go and rebuild. Answering with half an artifact would be worse
1097
+ * than refusing: a dialect carrying tables but no SQL generates a migration
1098
+ * that creates nothing, and the schema silently drifts from what the addon's
1099
+ * own functions expect.
1100
+ */
1101
+ function readSchemaArtifact(artifactPath, pkg) {
1102
+ let parsed;
1103
+ try {
1104
+ parsed = JSON.parse(readFileSync(artifactPath, 'utf8'));
1105
+ }
1106
+ catch (error) {
1107
+ throw new Error(`The '${pkg}' addon publishes an unreadable ${ADDON_DB_ARTIFACT} ` +
1108
+ `(${artifactPath}): ${error.message}. Rebuild the addon.`);
1109
+ }
1110
+ if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
1111
+ throw new Error(`The '${pkg}' addon publishes a ${ADDON_DB_ARTIFACT} that is not an ` +
1112
+ 'object of dialects. Rebuild the addon.');
1113
+ }
1114
+ for (const [dialect, exported] of Object.entries(parsed)) {
1115
+ const entry = exported;
1116
+ const hasSql = typeof entry?.sql === 'string' && entry.sql.trim().length > 0;
1117
+ const hasTables = typeof entry?.tables === 'object' &&
1118
+ entry.tables !== null &&
1119
+ !Array.isArray(entry.tables);
1120
+ if (!hasSql || !hasTables) {
1121
+ throw new Error(`The '${pkg}' addon publishes a ${dialect} schema that is incomplete — ` +
1122
+ `it needs both the SQL to run and the tables that SQL creates, and it ` +
1123
+ `has ${!hasSql ? 'no sql' : 'sql'} and ${!hasTables ? 'no tables' : 'tables'}. ` +
1124
+ 'Rebuild the addon.');
1125
+ }
1126
+ }
1127
+ return parsed;
1128
+ }
1069
1129
  /**
1070
1130
  * The schema every wired addon publishes, as sources.
1071
1131
  *
@@ -1089,11 +1149,23 @@ export async function addonSchemaSources(rootDir, dialect, addons, logger) {
1089
1149
  artifactPath = require.resolve(`${addon.package}/${ADDON_DB_ARTIFACT}`);
1090
1150
  }
1091
1151
  catch {
1092
- // Most addons have no schema at all, so an unresolvable artifact is the
1093
- // ordinary case and says nothing is contributed — not that anything failed.
1094
- continue;
1152
+ // Every addon publishes this file, and one with no tables publishes an
1153
+ // empty one. Absence is therefore never "contributes nothing" — it is a
1154
+ // package that cannot say, and the two used to be indistinguishable:
1155
+ // the addon was skipped in silence and the mistake surfaced much later,
1156
+ // as a function querying a table nobody created.
1157
+ throw new Error(`The '${addon.package}' addon does not publish ${ADDON_DB_ARTIFACT}, so ` +
1158
+ 'there is no way to tell whether it ships tables. Build it with a ' +
1159
+ "current CLI (`pikku all` writes the file, empty when there are no " +
1160
+ 'tables), and make sure the package exports and packs it:\n' +
1161
+ ` "exports": { "./${ADDON_DB_ARTIFACT}": "./dist/.pikku/addon/db/pikku-db-meta.gen.json" }\n` +
1162
+ ' "files": ["dist"]');
1095
1163
  }
1096
- const artifact = JSON.parse(readFileSync(artifactPath, 'utf8'));
1164
+ const artifact = readSchemaArtifact(artifactPath, addon.package);
1165
+ // An addon with no tables says so with an empty artifact, which is the
1166
+ // ordinary case and contributes nothing.
1167
+ if (Object.keys(artifact).length === 0)
1168
+ continue;
1097
1169
  const exported = artifact[dialect];
1098
1170
  if (!exported) {
1099
1171
  logger.error(`The '${addon.package}' addon publishes a schema, but not for ${dialect} — ` +
@@ -1232,7 +1304,7 @@ export async function generateMigrations(resolved, rootDir, srcDirectories, logg
1232
1304
  }
1233
1305
  else {
1234
1306
  const statements = [];
1235
- for (const table of missingTables) {
1307
+ for (const table of tablesInSourceOrder(source.desired.sql, missingTables)) {
1236
1308
  // A wholly new table is the first-time case in miniature: nothing to
1237
1309
  // diff against, and the source's own SQL already says exactly how to
1238
1310
  // build it. Rendering the column map instead would drop the primary
@@ -1,4 +1,4 @@
1
- import type { KnowledgeIndexResult, KnowledgePlanDeferResult, KnowledgePlanProgressResult, KnowledgePlanSchemaResult, KnowledgePlanSetResult, KnowledgePlanShowResult, KnowledgeValidateResult } from '@pikku/knowledge';
1
+ import type { KnowledgeIndexResult, KnowledgePlanDeferResult, KnowledgePlanProgressResult, KnowledgePlanSchemaResult, KnowledgePlanSetResult, KnowledgePlanShowResult, KnowledgeReconcileResult, KnowledgeValidateResult } from '@pikku/knowledge';
2
2
  export declare const renderKnowledgeValidate: (_services: unknown, { ok, notes, findings }: KnowledgeValidateResult) => void;
3
3
  export declare const renderKnowledgeIndex: (_services: unknown, { ok, check, files }: KnowledgeIndexResult) => void;
4
4
  export declare const renderKnowledgePlanSchema: (_services: unknown, { schema }: KnowledgePlanSchemaResult) => void;
@@ -6,3 +6,14 @@ export declare const renderKnowledgePlanShow: (_services: unknown, { ok, path, b
6
6
  export declare const renderKnowledgePlanProgress: (_services: unknown, { ok, path, message, done, missing, deferred, problems, }: KnowledgePlanProgressResult) => void;
7
7
  export declare const renderKnowledgePlanSet: (_services: unknown, { ok, path, problems, schema }: KnowledgePlanSetResult) => void;
8
8
  export declare const renderKnowledgePlanDefer: (_services: unknown, { ok, message }: KnowledgePlanDeferResult) => void;
9
+ /**
10
+ * What to do next, and — when only a person can settle it — the question to put to
11
+ * them.
12
+ *
13
+ * The action's `reason` is machine wording that names the note and the frontmatter
14
+ * key; on `ask-user` it is deliberately NOT what gets printed as the question, because
15
+ * the reader there has never seen a note. The options are numbered rather than
16
+ * rendered as a picker: this is the fallback every harness has, and one that can do
17
+ * better reads the same answer as JSON.
18
+ */
19
+ export declare const renderKnowledgeReconcile: (_services: unknown, { kind, reason, note, hold, notes, question }: KnowledgeReconcileResult) => void;
@@ -138,3 +138,51 @@ export const renderKnowledgePlanDefer = (_services, { ok, message }) => {
138
138
  if (!ok)
139
139
  process.exitCode = 1;
140
140
  };
141
+ /**
142
+ * What to do next, and — when only a person can settle it — the question to put to
143
+ * them.
144
+ *
145
+ * The action's `reason` is machine wording that names the note and the frontmatter
146
+ * key; on `ask-user` it is deliberately NOT what gets printed as the question, because
147
+ * the reader there has never seen a note. The options are numbered rather than
148
+ * rendered as a picker: this is the fallback every harness has, and one that can do
149
+ * better reads the same answer as JSON.
150
+ */
151
+ export const renderKnowledgeReconcile = (_services, { kind, reason, note, hold, notes, question }) => {
152
+ if (kind === 'idle') {
153
+ console.log(`${dim('=')} ${dim(reason)}`);
154
+ return;
155
+ }
156
+ const label = {
157
+ 'repair-note': 'REPAIR',
158
+ 'write-plan': 'PLAN',
159
+ 'ask-user': 'ASK',
160
+ dispatch: 'BUILD',
161
+ hold: 'HELD',
162
+ };
163
+ const paint = kind === 'dispatch' ? added : kind === 'hold' ? dim : changed;
164
+ console.log(`${paint(label[kind] ?? kind.toUpperCase())} ${note ?? ''}`.trim());
165
+ console.log();
166
+ if (question) {
167
+ console.log(`${dim(question.header)}`);
168
+ console.log(question.question);
169
+ question.options.forEach((option, index) => {
170
+ const description = option.description
171
+ ? ` ${dim(option.description)}`
172
+ : '';
173
+ console.log(` ${index + 1}. ${option.label}${description}`);
174
+ });
175
+ if (question.options.length === 0)
176
+ console.log(dim(' (free text)'));
177
+ console.log();
178
+ console.log(`${dim('why:')} ${dim(reason)}`);
179
+ return;
180
+ }
181
+ console.log(reason);
182
+ if (hold) {
183
+ console.log();
184
+ console.log(`${dim('held on:')} ${hold}`);
185
+ for (const path of notes ?? [])
186
+ console.log(` ${dim(path)}`);
187
+ }
188
+ };
@@ -94,3 +94,26 @@ export declare const KnowledgePlanDeferOutputSchema: import("zod").ZodObject<{
94
94
  path: import("zod").ZodString;
95
95
  message: import("zod").ZodString;
96
96
  }, import("zod/v4/core").$strip>;
97
+ export declare const KnowledgeReconcileInputSchema: import("zod").ZodObject<{}, import("zod/v4/core").$strip>;
98
+ export declare const KnowledgeReconcileOutputSchema: import("zod").ZodObject<{
99
+ kind: import("zod").ZodEnum<{
100
+ idle: "idle";
101
+ "repair-note": "repair-note";
102
+ "write-plan": "write-plan";
103
+ "ask-user": "ask-user";
104
+ dispatch: "dispatch";
105
+ hold: "hold";
106
+ }>;
107
+ reason: import("zod").ZodString;
108
+ note: import("zod").ZodOptional<import("zod").ZodString>;
109
+ hold: import("zod").ZodOptional<import("zod").ZodString>;
110
+ notes: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
111
+ question: import("zod").ZodOptional<import("zod").ZodObject<{
112
+ header: import("zod").ZodString;
113
+ question: import("zod").ZodString;
114
+ options: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodObject<{
115
+ label: import("zod").ZodString;
116
+ description: import("zod").ZodOptional<import("zod").ZodString>;
117
+ }, import("zod/v4/core").$strip>>>;
118
+ }, import("zod/v4/core").$strip>>;
119
+ }, import("zod/v4/core").$strip>;
@@ -1,4 +1,4 @@
1
- import { KnowledgeIndexInput, KnowledgeIndexOutput, KnowledgePlanDeferInput, KnowledgePlanDeferOutput, KnowledgePlanProgressInput, KnowledgePlanProgressOutput, KnowledgePlanSchemaInput, KnowledgePlanSchemaOutput, KnowledgePlanSetInput, KnowledgePlanSetOutput, KnowledgePlanShowInput, KnowledgePlanShowOutput, KnowledgeValidateInput, KnowledgeValidateOutput, } from '@pikku/knowledge';
1
+ import { KnowledgeIndexInput, KnowledgeIndexOutput, KnowledgePlanDeferInput, KnowledgePlanDeferOutput, KnowledgePlanProgressInput, KnowledgePlanProgressOutput, KnowledgePlanSchemaInput, KnowledgePlanSchemaOutput, KnowledgePlanSetInput, KnowledgePlanSetOutput, KnowledgePlanShowInput, KnowledgePlanShowOutput, KnowledgeReconcileInput, KnowledgeReconcileOutput, KnowledgeValidateInput, KnowledgeValidateOutput, } from '@pikku/knowledge';
2
2
  /**
3
3
  * The knowledge command schemas, re-bound to variables declared HERE rather than
4
4
  * imported straight into the command files.
@@ -33,3 +33,5 @@ export const KnowledgePlanSetInputSchema = KnowledgePlanSetInput;
33
33
  export const KnowledgePlanSetOutputSchema = KnowledgePlanSetOutput;
34
34
  export const KnowledgePlanDeferInputSchema = KnowledgePlanDeferInput;
35
35
  export const KnowledgePlanDeferOutputSchema = KnowledgePlanDeferOutput;
36
+ export const KnowledgeReconcileInputSchema = KnowledgeReconcileInput;
37
+ export const KnowledgeReconcileOutputSchema = KnowledgeReconcileOutput;
@@ -2,7 +2,7 @@ import { pikkuSessionlessFunc } from '#pikku/function';
2
2
  import { writeFileInDir } from '../../../utils/file-writer.js';
3
3
  import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js';
4
4
  import { getFileImportRelativePath } from '../../../utils/file-import-path.js';
5
- import { stripVerboseFields, hasVerboseFields, } from '../../../utils/strip-verbose-meta.js';
5
+ import { writeWiringMeta } from '../../../utils/write-wiring-meta.js';
6
6
  import { serializeAgentMap } from './serialize-agent-map.js';
7
7
  import { serializeModelAliases } from './serialize-model-aliases.js';
8
8
  export const pikkuAgent = pikkuSessionlessFunc({
@@ -38,21 +38,18 @@ export const pikkuAgent = pikkuSessionlessFunc({
38
38
  const metaData = {
39
39
  agentsMeta: agents.agentsMeta,
40
40
  };
41
- const minimalMeta = stripVerboseFields(metaData);
42
- await writeFileInDir(logger, agentWiringMetaJsonFile, JSON.stringify(minimalMeta, null, 2));
43
- if (hasVerboseFields(metaData)) {
44
- const verbosePath = agentWiringMetaJsonFile.replace(/\.gen\.json$/, '-verbose.gen.json');
45
- await writeFileInDir(logger, verbosePath, JSON.stringify(metaData, null, 2));
46
- }
47
- const jsonImportPath = getFileImportRelativePath(agentWiringMetaFile, agentWiringMetaJsonFile, packageMappings);
48
- const supportsImportAttributes = schema?.supportsImportAttributes ?? false;
49
- const importStatement = supportsImportAttributes
50
- ? `import metaData from '${jsonImportPath}' with { type: 'json' }`
51
- : `import metaData from '${jsonImportPath}'`;
52
- await writeFileInDir(logger, agentWiringMetaFile, `import { pikkuState } from '@pikku/core/state'
41
+ await writeWiringMeta({
42
+ logger,
43
+ meta: metaData,
44
+ metaJsonFile: agentWiringMetaJsonFile,
45
+ metaFile: agentWiringMetaFile,
46
+ packageMappings,
47
+ supportsImportAttributes: schema?.supportsImportAttributes ?? false,
48
+ serializeMetaTS: ({ importStatement }) => `import { pikkuState } from '@pikku/core/state'
53
49
  import type { AgentsMeta } from '@pikku/core/agent'
54
50
  ${importStatement}
55
- pikkuState(${addonName ? `'${addonName}'` : 'null'}, 'agent', 'agentsMeta', metaData.agentsMeta as AgentsMeta)`);
51
+ pikkuState(${addonName ? `'${addonName}'` : 'null'}, 'agent', 'agentsMeta', metaData.agentsMeta as AgentsMeta)`,
52
+ });
56
53
  await writeFileInDir(logger, agentMapDeclarationFile, serializeAgentMap(logger, agentMapDeclarationFile, packageMappings, functions.typesMap, agents.agentsMeta));
57
54
  return true;
58
55
  },