@pikku/cli 0.12.128 → 0.12.134

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 (274) hide show
  1. package/CHANGELOG.md +274 -0
  2. package/console-app/assets/{abnfDiagram-N423BO3Z-BY2LM8wi.js → abnfDiagram-N423BO3Z-BQPUva28.js} +1 -1
  3. package/console-app/assets/architecture-TIHT7OUA-G_ldr-C2.js +1 -0
  4. package/console-app/assets/{architectureDiagram-T3A2C74G-CeqjY3Kw.js → architectureDiagram-T3A2C74G-Cjzy66o9.js} +1 -1
  5. package/console-app/assets/{blockDiagram-VBNYF7ZC-BW5174xj.js → blockDiagram-VBNYF7ZC-DVasSXpX.js} +1 -1
  6. package/console-app/assets/{c4Diagram-5PPSVZJV-B7zXAFL0.js → c4Diagram-5PPSVZJV-FB0YMoOr.js} +1 -1
  7. package/console-app/assets/channel-CuDpOUYn.js +1 -0
  8. package/console-app/assets/{chunk-2GRJ4B5K-BfRYzQ4t.js → chunk-2GRJ4B5K-BLGsmyy4.js} +1 -1
  9. package/console-app/assets/{chunk-4I5QYGJK-DBA7-Nu4.js → chunk-4I5QYGJK-DCgTj78f.js} +1 -1
  10. package/console-app/assets/{chunk-5RXB4S5H-D03lNzwi.js → chunk-5RXB4S5H-CX9hS68x.js} +1 -1
  11. package/console-app/assets/{chunk-6Q2QTUOP-DloGRHJZ.js → chunk-6Q2QTUOP-xrgFRP4Y.js} +1 -1
  12. package/console-app/assets/{chunk-7Z6QIM7H-DH3uHtl2.js → chunk-7Z6QIM7H-CbBMe7ej.js} +1 -1
  13. package/console-app/assets/{chunk-GF5L2VYU-Cu252lza.js → chunk-GF5L2VYU-BXraqZ7w.js} +1 -1
  14. package/console-app/assets/{chunk-I66GZJ75-DH54FcuO.js → chunk-I66GZJ75-CbpQtX8e.js} +1 -1
  15. package/console-app/assets/{chunk-JQJVKLGR-CeFuTL-V.js → chunk-JQJVKLGR-Cp9FHSH6.js} +1 -1
  16. package/console-app/assets/{chunk-KBJHAD2P-B-prFo0-.js → chunk-KBJHAD2P-Brvmen34.js} +1 -1
  17. package/console-app/assets/{chunk-NSK5VX7P-C10iA4GS.js → chunk-NSK5VX7P-Bo-dbDZD.js} +1 -1
  18. package/console-app/assets/{chunk-QR6OTTB3-Cd8apAsA.js → chunk-QR6OTTB3-B5Al5KEo.js} +1 -1
  19. package/console-app/assets/{chunk-RYQCIY6F-rfPUp2Fj.js → chunk-RYQCIY6F-WOZyn5It.js} +1 -1
  20. package/console-app/assets/{chunk-UBXNYLIW-D25wqJBc.js → chunk-UBXNYLIW-D9OoHV5X.js} +1 -1
  21. package/console-app/assets/{chunk-W5SLKNZC-CJvxkxuK.js → chunk-W5SLKNZC-BNTcVpi3.js} +1 -1
  22. package/console-app/assets/{chunk-WRU74C26-B9Wju92P.js → chunk-WRU74C26-DXijYjrx.js} +1 -1
  23. package/console-app/assets/chunk-XXDRQBXY-DRMEt0Gf.js +1 -0
  24. package/console-app/assets/classDiagram-JCYQIIEL-Bjgk6QkN.js +1 -0
  25. package/console-app/assets/classDiagram-v2-OCEON4UE-Bjgk6QkN.js +1 -0
  26. package/console-app/assets/{cose-bilkent-JH36ORCC-CwA1VCP5.js → cose-bilkent-JH36ORCC-CPN5VkQC.js} +1 -1
  27. package/console-app/assets/{cynefin-VYW2F7L2-C_qsD7eR.js → cynefin-VYW2F7L2-CuBPO3Z0.js} +1 -1
  28. package/console-app/assets/{cynefinDiagram-MW4NZA55-CkSLreFW.js → cynefinDiagram-MW4NZA55-BYc2PGXv.js} +1 -1
  29. package/console-app/assets/{dagre-WqgBlKb7.js → dagre-7HV9Jfb_.js} +1 -1
  30. package/console-app/assets/{dagre-VZM6K2ZE-0ssqLoHs.js → dagre-VZM6K2ZE-BpPyuM7i.js} +1 -1
  31. package/console-app/assets/{diagram-7IWD3JNH-DmRL3lmL.js → diagram-7IWD3JNH-DTH9ID9z.js} +1 -1
  32. package/console-app/assets/{diagram-B4RE2ZJO-Bsr9wG4I.js → diagram-B4RE2ZJO-DwZb9gPm.js} +1 -1
  33. package/console-app/assets/{diagram-LBJQPF4R-DdMw1FSY.js → diagram-LBJQPF4R-DfvBayzk.js} +1 -1
  34. package/console-app/assets/{diagram-Q27KOJAE-TPx5TB2B.js → diagram-Q27KOJAE-hksFpSxs.js} +1 -1
  35. package/console-app/assets/{diagram-UB23O5K3-e_1zSlZR.js → diagram-UB23O5K3-5hEVCouO.js} +1 -1
  36. package/console-app/assets/{ebnfDiagram-BXEA7PRR-BACajh2b.js → ebnfDiagram-BXEA7PRR-D0v6RJvf.js} +1 -1
  37. package/console-app/assets/{erDiagram-JOGREHBK-CojomKqL.js → erDiagram-JOGREHBK-DGps-M4l.js} +1 -1
  38. package/console-app/assets/eventmodeling-45OFAUF4-DWRslJcU.js +1 -0
  39. package/console-app/assets/flowDiagram-UKHOOZJN-CE3qN_pH.js +1 -0
  40. package/console-app/assets/{ganttDiagram-PKOTCBZU-yoOX4Xj2.js → ganttDiagram-PKOTCBZU-Dok7ME1t.js} +1 -1
  41. package/console-app/assets/{gitGraph-TEB2WS4Q-BcUY5hIc.js → gitGraph-TEB2WS4Q-8492lYYh.js} +1 -1
  42. package/console-app/assets/{gitGraphDiagram-DS77QQ5N-BtuIPjuB.js → gitGraphDiagram-DS77QQ5N-sPOnBy5f.js} +1 -1
  43. package/console-app/assets/{index-CzWW052c.js → index-DqNqujdF.js} +184 -184
  44. package/console-app/assets/{info-DKCQHKI2-B-iR9PUz.js → info-DKCQHKI2-U4uEmX4H.js} +1 -1
  45. package/console-app/assets/{infoDiagram-6WML65LV-CuXKIFH2.js → infoDiagram-6WML65LV-CNV12_Nx.js} +1 -1
  46. package/console-app/assets/{ishikawaDiagram-WSZJBQD7-CSueMFD6.js → ishikawaDiagram-WSZJBQD7-CcnTBGLj.js} +1 -1
  47. package/console-app/assets/{journeyDiagram-NVQOT4AX-kvnKStZp.js → journeyDiagram-NVQOT4AX-MX-UQBJ7.js} +1 -1
  48. package/console-app/assets/{kanban-definition-27J2QSJJ-CGGDEz30.js → kanban-definition-27J2QSJJ-BXh1Eu4D.js} +1 -1
  49. package/console-app/assets/{line-mtMM5-xO.js → line-2B2dlQbw.js} +1 -1
  50. package/console-app/assets/{linear-CLSje0O_.js → linear-DAVRH-Dp.js} +1 -1
  51. package/console-app/assets/{mermaid-parser.core-Cx6yvn3j.js → mermaid-parser.core-DxPo1qbR.js} +3 -3
  52. package/console-app/assets/{mermaid.core-BebGyklS.js → mermaid.core-DpvXaF3y.js} +4 -4
  53. package/console-app/assets/{mindmap-definition-FAOFIHXS-C2_WUUJ9.js → mindmap-definition-FAOFIHXS-wIEKn4qe.js} +1 -1
  54. package/console-app/assets/{packet-7NZHBO7P-Dh5yNCA8.js → packet-7NZHBO7P-CXySycDQ.js} +1 -1
  55. package/console-app/assets/{pegDiagram-VL7TDLO6-XgUxesi8.js → pegDiagram-VL7TDLO6-CDGkzO6q.js} +1 -1
  56. package/console-app/assets/{pie-RZYD4A2V-D2x2RAXI.js → pie-RZYD4A2V-9woSahH7.js} +1 -1
  57. package/console-app/assets/{pieDiagram-7S7Q4E2Y-Bbor0KbG.js → pieDiagram-7S7Q4E2Y-DLoZWnVF.js} +1 -1
  58. package/console-app/assets/{quadrantDiagram-CIZ2JOQS-DZmnMHpM.js → quadrantDiagram-CIZ2JOQS-NBGRoga7.js} +1 -1
  59. package/console-app/assets/{radar-I7S5WNFK-CPeriDtN.js → radar-I7S5WNFK-BYhW66ZA.js} +1 -1
  60. package/console-app/assets/{railroad-3IZDKUUU-2iKAyaie.js → railroad-3IZDKUUU-BqHXlwF5.js} +1 -1
  61. package/console-app/assets/railroad-abnf-AHOZXSZD-BfGOy69e.js +1 -0
  62. package/console-app/assets/railroad-ebnf-EBAXGLYW-BbGv9WfS.js +1 -0
  63. package/console-app/assets/railroad-peg-LSFZ7HO6-CCiPI8BL.js +1 -0
  64. package/console-app/assets/{railroadDiagram-AXF67PYL-DVEqCXoo.js → railroadDiagram-AXF67PYL-FYQaHJ6A.js} +1 -1
  65. package/console-app/assets/{requirementDiagram-LRYGKXZP-CSgSNL8p.js → requirementDiagram-LRYGKXZP-ihhW1kgC.js} +1 -1
  66. package/console-app/assets/{sankeyDiagram-W5VNT64P-CFk11odN.js → sankeyDiagram-W5VNT64P-Dw2EbW8v.js} +1 -1
  67. package/console-app/assets/{sequenceDiagram-SI44F4Z6-Cb5u6FsJ.js → sequenceDiagram-SI44F4Z6-C6i_U4QX.js} +1 -1
  68. package/console-app/assets/{src-LceHEY_Q.js → src-DF-84qwJ.js} +1 -1
  69. package/console-app/assets/{stateDiagram-OKZ733FA-DM1jWlkU.js → stateDiagram-OKZ733FA-xH4wcMO4.js} +1 -1
  70. package/console-app/assets/stateDiagram-v2-UEYNNEHI-BJln5PLd.js +1 -0
  71. package/console-app/assets/{swimlanes-SLNWSIFB-DD6MchlE.js → swimlanes-SLNWSIFB-CkFlU1Qc.js} +1 -1
  72. package/console-app/assets/swimlanesDiagram-ULZ7WXOC-CSLhmtbh.js +8 -0
  73. package/console-app/assets/{timeline-definition-Z64GVDOM-zu5cNnVv.js → timeline-definition-Z64GVDOM-BQE9-7mm.js} +1 -1
  74. package/console-app/assets/{treeView-QDETBFTQ-D_4IbvCG.js → treeView-QDETBFTQ-C4hse2Wn.js} +1 -1
  75. package/console-app/assets/{treemap-6X3UGDF4-DNc6bjUc.js → treemap-6X3UGDF4-Bi7ORgq6.js} +1 -1
  76. package/console-app/assets/{vennDiagram-T6HMQDX7-DfqoG28f.js → vennDiagram-T6HMQDX7-DbUdNREA.js} +1 -1
  77. package/console-app/assets/{wardley-OPB4EBWU-BqpI2Lx-.js → wardley-OPB4EBWU-BHqXIxRe.js} +1 -1
  78. package/console-app/assets/{wardleyDiagram-T6FBY63Y-CLIZSvNi.js → wardleyDiagram-T6FBY63Y-1VOvM_bb.js} +1 -1
  79. package/console-app/assets/{xychartDiagram-ELKLHX3M-Cni-XXa6.js → xychartDiagram-ELKLHX3M-C3DVfSR9.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 +26 -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 +13 -10
  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 +98 -10
  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 +98 -3
  123. package/dist/.pikku/function/pikku-functions.gen.js +1 -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 +5 -0
  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 +21 -1
  169. package/dist/.pikku/schemas/schemas/FabricDeployApplyInput.schema.json +1 -1
  170. package/dist/.pikku/schemas/schemas/KnowledgePlanDeferInput.schema.json +1 -0
  171. package/dist/.pikku/schemas/schemas/KnowledgePlanDeferOutput.schema.json +1 -0
  172. package/dist/.pikku/schemas/schemas/KnowledgePlanProgressInput.schema.json +1 -0
  173. package/dist/.pikku/schemas/schemas/KnowledgePlanProgressOutput.schema.json +1 -0
  174. package/dist/.pikku/schemas/schemas/KnowledgePlanSchemaInput.schema.json +1 -0
  175. package/dist/.pikku/schemas/schemas/KnowledgePlanSchemaOutput.schema.json +1 -0
  176. package/dist/.pikku/schemas/schemas/KnowledgePlanSetInput.schema.json +1 -0
  177. package/dist/.pikku/schemas/schemas/KnowledgePlanSetOutput.schema.json +1 -0
  178. package/dist/.pikku/schemas/schemas/KnowledgePlanShowInput.schema.json +1 -0
  179. package/dist/.pikku/schemas/schemas/KnowledgePlanShowOutput.schema.json +1 -0
  180. package/dist/.pikku/scopes/index.d.ts +1 -1
  181. package/dist/.pikku/scopes/index.js +1 -1
  182. package/dist/.pikku/scopes/pikku-personas.gen.js +1 -1
  183. package/dist/.pikku/scopes/pikku-roles.gen.d.ts +1 -1
  184. package/dist/.pikku/scopes/pikku-scope-types.gen.d.ts +1 -1
  185. package/dist/.pikku/scopes/pikku-scope-types.gen.js +1 -1
  186. package/dist/.pikku/scopes/pikku-scopes.gen.d.ts +1 -1
  187. package/dist/.pikku/secrets/index.d.ts +1 -1
  188. package/dist/.pikku/secrets/index.js +1 -1
  189. package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +1 -1
  190. package/dist/.pikku/secrets/pikku-secret-types.gen.js +1 -1
  191. package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +1 -1
  192. package/dist/.pikku/secrets/pikku-secrets.gen.js +1 -1
  193. package/dist/.pikku/services/pikku-meta-service.gen.d.ts +1 -1
  194. package/dist/.pikku/services/pikku-meta-service.gen.js +1 -1
  195. package/dist/.pikku/setup/index.d.ts +1 -1
  196. package/dist/.pikku/setup/index.js +1 -1
  197. package/dist/.pikku/setup/pikku-setup-types.gen.d.ts +1 -1
  198. package/dist/.pikku/setup/pikku-setup-types.gen.js +1 -1
  199. package/dist/.pikku/trigger/index.d.ts +1 -1
  200. package/dist/.pikku/trigger/index.js +1 -1
  201. package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +1 -1
  202. package/dist/.pikku/trigger/pikku-trigger-types.gen.js +1 -1
  203. package/dist/.pikku/variables/index.d.ts +1 -1
  204. package/dist/.pikku/variables/index.js +1 -1
  205. package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +1 -1
  206. package/dist/.pikku/variables/pikku-variable-types.gen.js +1 -1
  207. package/dist/.pikku/variables/pikku-variables.gen.d.ts +1 -1
  208. package/dist/.pikku/variables/pikku-variables.gen.js +1 -1
  209. package/dist/.pikku/workflow/index.d.ts +1 -1
  210. package/dist/.pikku/workflow/index.js +1 -1
  211. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +1 -1
  212. package/dist/.pikku/workflow/pikku-workflow-types.gen.js +1 -1
  213. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +1 -1
  214. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
  215. package/dist/bin/pikku-bin.mjs +2 -2
  216. package/dist/src/cli.wiring.js +47 -0
  217. package/dist/src/deploy/analyzer/analyzer.js +42 -6
  218. package/dist/src/deploy/build-pipeline.js +92 -4
  219. package/dist/src/deploy/codegen/per-unit-codegen.d.ts +10 -0
  220. package/dist/src/deploy/codegen/per-unit-codegen.js +12 -1
  221. package/dist/src/deploy/server-entry.js +14 -1
  222. package/dist/src/fabric/fabric-commands.d.ts +3 -3
  223. package/dist/src/fabric/fabric-commands.js +7 -6
  224. package/dist/src/fabric/functions/deploy.function.d.ts +14 -5
  225. package/dist/src/fabric/functions/deploy.function.js +49 -20
  226. package/dist/src/fabric/lib/stage.js +1 -1
  227. package/dist/src/functions/commands/knowledge-plan.d.ts +112 -0
  228. package/dist/src/functions/commands/knowledge-plan.js +35 -0
  229. package/dist/src/functions/db/local-db.d.ts +1 -1
  230. package/dist/src/functions/db/local-db.js +5 -5
  231. package/dist/src/functions/db/postgres/postgres-introspector.js +1 -1
  232. package/dist/src/functions/db/sqlite/dev-seed.d.ts +1 -1
  233. package/dist/src/functions/db/sqlite/sqlite-introspector.d.ts +1 -1
  234. package/dist/src/functions/db/sqlite/sqlite-introspector.js +1 -1
  235. package/dist/src/functions/db/sqlite/sqlite-kysely.d.ts +1 -1
  236. package/dist/src/functions/knowledge/render.d.ts +6 -1
  237. package/dist/src/functions/knowledge/render.js +74 -0
  238. package/dist/src/functions/knowledge/schemas.d.ts +45 -0
  239. package/dist/src/functions/knowledge/schemas.js +11 -1
  240. package/dist/src/functions/surface/surface-editorial.js +12 -12
  241. package/dist/src/functions/validate/shared-checks.js +1 -1
  242. package/dist/src/functions/wirings/realtime/serialize-events-scaffold.d.ts +1 -1
  243. package/dist/src/functions/wirings/realtime/serialize-events-scaffold.js +2 -2
  244. package/dist/tsconfig.tsbuildinfo +1 -1
  245. package/package.json +11 -10
  246. package/surface.json +23 -29
  247. package/console-app/assets/architecture-TIHT7OUA-CWwmvxZF.js +0 -1
  248. package/console-app/assets/channel-pOkwZ_Ot.js +0 -1
  249. package/console-app/assets/chunk-XXDRQBXY-BU_UP6f5.js +0 -1
  250. package/console-app/assets/classDiagram-JCYQIIEL-CLBKUuxj.js +0 -1
  251. package/console-app/assets/classDiagram-v2-OCEON4UE-CLBKUuxj.js +0 -1
  252. package/console-app/assets/eventmodeling-45OFAUF4-DkN2KCrT.js +0 -1
  253. package/console-app/assets/flowDiagram-UKHOOZJN-DL0M9lBc.js +0 -1
  254. package/console-app/assets/railroad-abnf-AHOZXSZD-D26xz4MM.js +0 -1
  255. package/console-app/assets/railroad-ebnf-EBAXGLYW-CCAiMPWc.js +0 -1
  256. package/console-app/assets/railroad-peg-LSFZ7HO6-BA1zcisq.js +0 -1
  257. package/console-app/assets/stateDiagram-v2-UEYNNEHI-COVnPYic.js +0 -1
  258. package/console-app/assets/swimlanesDiagram-ULZ7WXOC-B5q8iRCQ.js +0 -8
  259. package/dist/src/functions/db/db-migrator.d.ts +0 -63
  260. package/dist/src/functions/db/db-migrator.js +0 -136
  261. package/dist/src/functions/db/migration-identifiers.d.ts +0 -58
  262. package/dist/src/functions/db/migration-identifiers.js +0 -262
  263. package/dist/src/functions/db/postgres/postgres-migrator.d.ts +0 -15
  264. package/dist/src/functions/db/postgres/postgres-migrator.js +0 -40
  265. package/dist/src/functions/db/schema-sql.d.ts +0 -43
  266. package/dist/src/functions/db/schema-sql.js +0 -135
  267. package/dist/src/functions/db/sqlite/sqlite-migrator.d.ts +0 -11
  268. package/dist/src/functions/db/sqlite/sqlite-migrator.js +0 -41
  269. package/dist/src/functions/db/sqlite/sqlite-runtime-bun.d.ts +0 -2
  270. package/dist/src/functions/db/sqlite/sqlite-runtime-bun.js +0 -62
  271. package/dist/src/functions/db/sqlite/sqlite-runtime-node.d.ts +0 -2
  272. package/dist/src/functions/db/sqlite/sqlite-runtime-node.js +0 -78
  273. package/dist/src/functions/db/sqlite/sqlite-runtime.d.ts +0 -20
  274. package/dist/src/functions/db/sqlite/sqlite-runtime.js +0 -13
@@ -127,15 +127,17 @@ export function analyzeDeployment(state, options) {
127
127
  if (handlers.length === 0) {
128
128
  continue;
129
129
  }
130
+ const invokedAgents = collectInvokedAgents(state, funcId);
130
131
  units.push({
131
132
  name: toSafeKebab(funcId),
132
133
  role: 'function',
133
134
  target: resolveDeployTarget(funcMeta, serverlessIncompatible, funcId, defaultTarget),
134
135
  functionIds: [funcId],
135
- services: collectServicesForFunction(funcMeta),
136
+ services: withAgentServices(collectServicesForFunction(funcMeta), invokedAgents),
136
137
  dependsOn: [],
137
138
  handlers,
138
139
  tags: funcMeta.tags ?? [],
140
+ ...(invokedAgents.length > 0 && { invokedAgents }),
139
141
  });
140
142
  }
141
143
  // ── Step 2: Agent gateways ─────────────────────────────────────────
@@ -147,10 +149,7 @@ export function analyzeDeployment(state, options) {
147
149
  const toolUnitNames = toolIds.map((id) => toSafeKebab(id));
148
150
  const subAgentUnitNames = subAgentNames.map((sa) => `agent-${toSafeKebab(sa)}`);
149
151
  // Agent needs AI services
150
- const agentServices = [
151
- { capability: 'ai-model', sourceServiceName: 'agentRunner' },
152
- { capability: 'ai-storage', sourceServiceName: 'agentStorage' },
153
- ];
152
+ const agentServices = agentServiceRequirements();
154
153
  // Concrete routes for this agent via catch-all
155
154
  const agentRoutes = [
156
155
  {
@@ -282,15 +281,17 @@ export function analyzeDeployment(state, options) {
282
281
  const funcId = fromKebab(dep);
283
282
  const funcMeta = functionsMeta[funcId];
284
283
  if (funcMeta) {
284
+ const invokedAgents = collectInvokedAgents(state, funcId);
285
285
  units.push({
286
286
  name: dep,
287
287
  role: 'function',
288
288
  target: resolveDeployTarget(funcMeta, serverlessIncompatible, funcId, defaultTarget),
289
289
  functionIds: [funcId],
290
- services: collectServicesForFunction(funcMeta),
290
+ services: withAgentServices(collectServicesForFunction(funcMeta), invokedAgents),
291
291
  dependsOn: [],
292
292
  handlers: [{ type: 'fetch', routes: [] }],
293
293
  tags: funcMeta.tags ?? [],
294
+ ...(invokedAgents.length > 0 && { invokedAgents }),
294
295
  });
295
296
  existingUnitNames.add(dep);
296
297
  }
@@ -597,6 +598,41 @@ function mapServiceToRequirement(serviceName) {
597
598
  return null;
598
599
  return { capability, sourceServiceName: serviceName };
599
600
  }
601
+ function agentServiceRequirements() {
602
+ return [
603
+ { capability: 'ai-model', sourceServiceName: 'agentRunner' },
604
+ { capability: 'ai-storage', sourceServiceName: 'agentStorage' },
605
+ ];
606
+ }
607
+ /**
608
+ * Agents named by a `runAgent`/`rpc.agent.run` call inside a function body.
609
+ *
610
+ * The inspector attributes those calls to the source FILE, so every function
611
+ * declared alongside the caller inherits them. That is deliberate: the unit
612
+ * bundles the file either way, and registering an agent the caller never
613
+ * reaches is cheaper than the run-time "AI agent not found" a missed one
614
+ * causes.
615
+ */
616
+ function collectInvokedAgents(state, funcId) {
617
+ const path = state.functions?.files?.get(funcId)?.path;
618
+ if (!path)
619
+ return [];
620
+ const invoked = state.agents?.invokedAgentsByFile?.get(path);
621
+ if (!invoked)
622
+ return [];
623
+ return [...invoked].filter((name) => Boolean(state.agents?.agentsMeta[name]));
624
+ }
625
+ function withAgentServices(services, invokedAgents) {
626
+ if (invokedAgents.length === 0)
627
+ return services;
628
+ const merged = [...services];
629
+ for (const requirement of agentServiceRequirements()) {
630
+ if (!merged.some((s) => s.capability === requirement.capability)) {
631
+ merged.push(requirement);
632
+ }
633
+ }
634
+ return merged;
635
+ }
600
636
  function collectServicesForFunction(funcMeta) {
601
637
  if (!funcMeta?.services?.services)
602
638
  return [];
@@ -4,9 +4,9 @@
4
4
  * Runs: analyze → per-unit codegen → entry generation → bundle → configs
5
5
  * Outputs everything to .deploy/<provider>/ without deploying.
6
6
  */
7
- import { join } from 'node:path';
8
- import { existsSync } from 'node:fs';
9
- import { mkdir, writeFile, copyFile } from 'node:fs/promises';
7
+ import { join, relative } from 'node:path';
8
+ import { existsSync, readFileSync } from 'node:fs';
9
+ import { cp, mkdir, writeFile, copyFile } from 'node:fs/promises';
10
10
  import { PikkuError } from '@pikku/core/errors';
11
11
  import { analyzeDeployment } from './analyzer/index.js';
12
12
  import { withoutScenarios } from '../functions/wirings/scenarios/scenario-partition.js';
@@ -61,6 +61,88 @@ function findLockfile(projectDir) {
61
61
  }
62
62
  return null;
63
63
  }
64
+ /**
65
+ * The database a standalone bundle has to open for itself.
66
+ *
67
+ * Every other provider deploys onto a host that supplies `kysely` — `pikku dev`
68
+ * builds one, a Cloudflare deploy binds one — so `createSingletonServices` is
69
+ * written expecting it. A standalone artifact has no host, and shipped one that
70
+ * never got a connection at all: the app booted straight into whatever its
71
+ * services factory does when the database is missing, which for the generated
72
+ * templates is a throw.
73
+ *
74
+ * Engine comes from the migrations directory rather than the user config,
75
+ * because that is the same signal `loadUserConfigForDb` falls back to and it
76
+ * needs no module loading here. `db/sqlite` and `db/postgres` are the two
77
+ * conventions the migrator already writes to, so a project declares its engine
78
+ * by having written migrations for it.
79
+ *
80
+ * Both at once is refused rather than resolved. Picking one would be picking
81
+ * which database the deployed app talks to on the strength of directory order,
82
+ * and the failure — an app running happily against the wrong, fully valid
83
+ * schema — is invisible until someone reads the data.
84
+ *
85
+ * The migrations are copied in beside the bundle under the same `db/<engine>/`
86
+ * path they have in the project, which is also where Fabric's build container
87
+ * stages them. Two producers writing the artifact cannot disagree about where
88
+ * the SQL lives, and `bundle.js db migrate` finds it either way.
89
+ */
90
+ /**
91
+ * The project's declared version, or nothing.
92
+ *
93
+ * Absent is a real answer — a project need not version itself — and is better
94
+ * reported as unknown than as a number this made up.
95
+ */
96
+ function resolveProjectVersion(projectDir) {
97
+ try {
98
+ const pkg = JSON.parse(readFileSync(join(projectDir, 'package.json'), 'utf-8'));
99
+ return typeof pkg.version === 'string' ? pkg.version : undefined;
100
+ }
101
+ catch {
102
+ return undefined;
103
+ }
104
+ }
105
+ async function resolveStandaloneDb(projectDir, pikkuDir, unitDir) {
106
+ const hasSqlite = existsSync(join(projectDir, 'db', 'sqlite'));
107
+ const hasPostgres = existsSync(join(projectDir, 'db', 'postgres'));
108
+ if (hasSqlite && hasPostgres) {
109
+ throw new Error('This project has both db/sqlite and db/postgres migrations, so a standalone build cannot tell which database the app is meant to open. Keep the one this app deploys against.');
110
+ }
111
+ const engine = hasSqlite ? 'sqlite' : hasPostgres ? 'postgres' : undefined;
112
+ if (!engine)
113
+ return undefined;
114
+ await cp(join(projectDir, 'db', engine), join(unitDir, 'db', engine), {
115
+ recursive: true,
116
+ });
117
+ // Absent for an app that annotates no columns, which is a database with
118
+ // nothing to coerce rather than a reason to hand the app no database.
119
+ const coercionFile = join(pikkuDir, 'db', 'coercion.gen.ts');
120
+ if (!existsSync(coercionFile))
121
+ return { engine };
122
+ let rel = relative(unitDir, coercionFile).replace(/\\/g, '/');
123
+ if (!rel.startsWith('.'))
124
+ rel = `./${rel}`;
125
+ return { engine, coercionImportPath: rel.replace(/\.ts$/, '.js') };
126
+ }
127
+ /**
128
+ * The app's server lifecycle, for entries that can call it.
129
+ *
130
+ * The hooks are resolved to an import rather than read at build time because
131
+ * they are the app's own code and have to run in the app's own process, with
132
+ * the services that process built.
133
+ */
134
+ function resolveLifecycle(unitDir, state) {
135
+ const factory = state.filesAndMethods.serverLifecycleFactory;
136
+ if (!factory)
137
+ return undefined;
138
+ let rel = relative(unitDir, factory.file).replace(/\\/g, '/');
139
+ if (!rel.startsWith('.'))
140
+ rel = `./${rel}`;
141
+ return {
142
+ importPath: rel.replace(/\.tsx?$/, '.js'),
143
+ variable: factory.variable,
144
+ };
145
+ }
64
146
  export async function runBuildPipeline(options) {
65
147
  const { projectDir, projectId, provider, inspectorState, getEntryContext, debugArtifacts, logger, bundler, } = options;
66
148
  const deployDir = options.deployDir ?? join(projectDir, '.deploy');
@@ -115,6 +197,9 @@ export async function runBuildPipeline(options) {
115
197
  const ctx = {
116
198
  ...getEntryContext(unitDir, pikkuDir, singleUnit, inspectorState),
117
199
  frontend: frontendMount,
200
+ version: resolveProjectVersion(projectDir),
201
+ db: await resolveStandaloneDb(projectDir, pikkuDir, unitDir),
202
+ lifecycle: resolveLifecycle(unitDir, inspectorState),
118
203
  };
119
204
  const source = provider.generateEntrySource(ctx);
120
205
  const entryPath = join(unitDir, 'entry.ts');
@@ -228,7 +313,10 @@ export async function runBuildPipeline(options) {
228
313
  const unitDir = unit.target === 'server' ? containerDir : join(unitsDir, unit.name);
229
314
  const entryPath = join(unitDir, 'entry.ts');
230
315
  await mkdir(unitDir, { recursive: true });
231
- const ctx = getEntryContext(unitDir, pikkuDir, unit, inspectorState);
316
+ const ctx = {
317
+ ...getEntryContext(unitDir, pikkuDir, unit, inspectorState),
318
+ lifecycle: resolveLifecycle(unitDir, inspectorState),
319
+ };
232
320
  const source = unit.target === 'server'
233
321
  ? (provider.generateServerEntrySource?.(ctx) ??
234
322
  generateServerEntrySource(ctx))
@@ -42,6 +42,16 @@ export interface PerUnitCodegenResult {
42
42
  error: string;
43
43
  }>;
44
44
  }
45
+ /**
46
+ * Collect the full set of filter names for a deployment unit.
47
+ *
48
+ * The --names filter matches against different identifier types depending
49
+ * on the metadata being filtered (function names, agent names, channel
50
+ * names, etc.). For a unit to get its complete metadata, we need to
51
+ * include both the function IDs and any wiring-level names (e.g. agent
52
+ * names, channel names) that reference those functions.
53
+ */
54
+ export declare function collectFilterNames(unit: DeploymentUnit, manifest: DeploymentManifest, inspectorState: InspectorState, workflowQueues: boolean): string[];
45
55
  /**
46
56
  * Runs filtered codegen for each deployment unit.
47
57
  *
@@ -34,7 +34,7 @@ function resolvePikkuBin() {
34
34
  * include both the function IDs and any wiring-level names (e.g. agent
35
35
  * names, channel names) that reference those functions.
36
36
  */
37
- function collectFilterNames(unit, manifest, inspectorState, workflowQueues) {
37
+ export function collectFilterNames(unit, manifest, inspectorState, workflowQueues) {
38
38
  const names = new Set(unit.functionIds);
39
39
  // Include catch-all scaffold routes based on unit contents
40
40
  const functionsMeta = inspectorState.functions.meta;
@@ -103,6 +103,17 @@ function collectFilterNames(unit, manifest, inspectorState, workflowQueues) {
103
103
  if (handler.type === 'scheduled')
104
104
  names.add(handler.taskName);
105
105
  }
106
+ // `runAgent(...)` / `rpc.agent.run(...)` look the agent up in the
107
+ // in-process registry, so a function that calls one needs the agent's
108
+ // wiring — and its tools — bundled into its OWN unit, not just into
109
+ // the agent gateway unit.
110
+ for (const agentName of unit.invokedAgents ?? []) {
111
+ names.add(agentName);
112
+ const agentDef = manifest.agents.find((a) => a.name === agentName);
113
+ for (const id of agentDef?.toolFunctionIds ?? [])
114
+ names.add(id);
115
+ names.add('/rpc/:rpcName');
116
+ }
106
117
  // Function units with workflow-state capability (workflow-starter,
107
118
  // workflow-runner, workflow-status-checker) call rpc.startWorkflow
108
119
  // and look workflows up by name in the registry. The registry is
@@ -18,6 +18,11 @@ export function generateServerEntrySource(ctx) {
18
18
  ctx.configImport,
19
19
  ctx.servicesImport,
20
20
  ctx.mcpImport,
21
+ ...(ctx.lifecycle
22
+ ? [
23
+ `import { ${ctx.lifecycle.variable} as __pikkuLifecycle } from '${ctx.lifecycle.importPath}'`,
24
+ ]
25
+ : []),
21
26
  `import '${ctx.bootstrapPath}'`,
22
27
  ``,
23
28
  `const PORT = Number(process.env.PORT ?? 8080)`,
@@ -33,9 +38,17 @@ export function generateServerEntrySource(ctx) {
33
38
  ` singletonServices.logger,`,
34
39
  ` { ${ctx.mcpServerOption}}`,
35
40
  ` )`,
36
- ` server.enableExitOnSignals()`,
41
+ ` server.enableExitOnSignals(${ctx.lifecycle
42
+ ? `{ beforeStop: () => __pikkuLifecycle?.beforeStop?.(singletonServices), afterStop: () => __pikkuLifecycle?.afterStop?.(singletonServices) }`
43
+ : ''})`,
37
44
  ` await server.init()`,
45
+ ...(ctx.lifecycle
46
+ ? [` await __pikkuLifecycle?.beforeStart?.(singletonServices)`]
47
+ : []),
38
48
  ` await server.start()`,
49
+ ...(ctx.lifecycle
50
+ ? [` await __pikkuLifecycle?.afterStart?.(singletonServices)`]
51
+ : []),
39
52
  `}`,
40
53
  ``,
41
54
  `main().catch((err) => {`,
@@ -284,7 +284,7 @@ export declare const fabricCommands: {
284
284
  production?: boolean | undefined;
285
285
  ref?: string | undefined;
286
286
  deploymentId?: string | undefined;
287
- sync?: boolean | undefined;
287
+ detach?: boolean | undefined;
288
288
  autoApprove?: boolean | undefined;
289
289
  allowDestructive?: boolean | undefined;
290
290
  timeout?: number | undefined;
@@ -347,7 +347,7 @@ export declare const fabricCommands: {
347
347
  production?: boolean | undefined;
348
348
  ref?: string | undefined;
349
349
  deploymentId?: string | undefined;
350
- sync?: boolean | undefined;
350
+ detach?: boolean | undefined;
351
351
  autoApprove?: boolean | undefined;
352
352
  allowDestructive?: boolean | undefined;
353
353
  timeout?: number | undefined;
@@ -410,7 +410,7 @@ export declare const fabricCommands: {
410
410
  production?: boolean | undefined;
411
411
  ref?: string | undefined;
412
412
  deploymentId?: string | undefined;
413
- sync?: boolean | undefined;
413
+ detach?: boolean | undefined;
414
414
  autoApprove?: boolean | undefined;
415
415
  allowDestructive?: boolean | undefined;
416
416
  timeout?: number | undefined;
@@ -160,11 +160,11 @@ export const fabricCommands = defineCLICommands({
160
160
  description: 'Apply and inspect deploys for a named branch or production',
161
161
  subcommands: {
162
162
  apply: pikkuCLICommand({
163
+ parameters: '[branch]',
163
164
  func: FabricDeployApply,
164
165
  render: renderDeployApply,
165
166
  description: 'Build + deploy a named branch or production (main), or attach to an existing deployment',
166
167
  options: {
167
- branch: { description: 'Target branch to deploy', short: 'b' },
168
168
  production: {
169
169
  description: 'Deploy production (always main)',
170
170
  default: false,
@@ -173,22 +173,23 @@ export const fabricCommands = defineCLICommands({
173
173
  description: 'Deploy a specific ref instead of the branch head',
174
174
  },
175
175
  deploymentId: {
176
- description: 'Attach to an existing deployment instead of creating one (not with --branch/--production)',
176
+ description: 'Attach to an existing deployment instead of creating one (not with a branch/--production)',
177
177
  },
178
- sync: {
179
- description: 'Wait for the deployment to finish and exit non-zero unless it went live',
178
+ detach: {
179
+ description: 'Queue the deployment and exit without waiting, reporting nothing about whether it landed',
180
180
  default: false,
181
181
  },
182
182
  autoApprove: {
183
183
  description: 'Answer the confirmation prompt and publish a plan parked at the approval gate',
184
+ short: 'y',
184
185
  default: false,
185
186
  },
186
187
  allowDestructive: {
187
- description: 'Approve a plan whose migrations drop or rewrite data (--auto-approve alone will not)',
188
+ description: 'Approve a plan whose migrations drop or rewrite data (-y alone will not)',
188
189
  default: false,
189
190
  },
190
191
  timeout: {
191
- description: 'Seconds to wait under --sync (default 900)',
192
+ description: 'Seconds to wait for the deployment (default 900)',
192
193
  },
193
194
  json: {
194
195
  description: 'Machine-readable output (NDJSON)',
@@ -4,7 +4,7 @@ export declare const FabricDeployInput: z.ZodObject<{
4
4
  production: z.ZodOptional<z.ZodBoolean>;
5
5
  ref: z.ZodOptional<z.ZodString>;
6
6
  deploymentId: z.ZodOptional<z.ZodString>;
7
- sync: z.ZodOptional<z.ZodBoolean>;
7
+ detach: z.ZodOptional<z.ZodBoolean>;
8
8
  autoApprove: z.ZodOptional<z.ZodBoolean>;
9
9
  allowDestructive: z.ZodOptional<z.ZodBoolean>;
10
10
  timeout: z.ZodOptional<z.ZodNumber>;
@@ -15,7 +15,7 @@ export declare const FabricDeployValidatedInput: z.ZodObject<{
15
15
  production: z.ZodOptional<z.ZodBoolean>;
16
16
  ref: z.ZodOptional<z.ZodString>;
17
17
  deploymentId: z.ZodOptional<z.ZodString>;
18
- sync: z.ZodOptional<z.ZodBoolean>;
18
+ detach: z.ZodOptional<z.ZodBoolean>;
19
19
  autoApprove: z.ZodOptional<z.ZodBoolean>;
20
20
  allowDestructive: z.ZodOptional<z.ZodBoolean>;
21
21
  timeout: z.ZodOptional<z.ZodNumber>;
@@ -90,12 +90,21 @@ export declare const FabricDeployApplyOutput: z.ZodObject<{
90
90
  timeoutSeconds: z.ZodOptional<z.ZodNumber>;
91
91
  }, z.core.$strip>;
92
92
  type ApplyOutput = z.infer<typeof FabricDeployApplyOutput>;
93
+ /**
94
+ * The branch to deploy when none was named, read off the checkout.
95
+ *
96
+ * `git rev-parse --abbrev-ref HEAD` answers the literal string `HEAD` on a
97
+ * detached checkout, which is not a branch and would be reported downstream as
98
+ * a branch that does not exist locally. Naming the real problem here is the
99
+ * difference between "check out a branch" and a puzzle.
100
+ */
101
+ export declare const branchFromHead: (head: string) => string;
93
102
  export declare const FabricDeployApply: import("../../../.pikku/function/pikku-function-types.gen.js").PikkuFunctionConfig<{
94
103
  branch?: string | undefined;
95
104
  production?: boolean | undefined;
96
105
  ref?: string | undefined;
97
106
  deploymentId?: string | undefined;
98
- sync?: boolean | undefined;
107
+ detach?: boolean | undefined;
99
108
  autoApprove?: boolean | undefined;
100
109
  allowDestructive?: boolean | undefined;
101
110
  timeout?: number | undefined;
@@ -158,7 +167,7 @@ export declare const FabricDeployApply: import("../../../.pikku/function/pikku-f
158
167
  production?: boolean | undefined;
159
168
  ref?: string | undefined;
160
169
  deploymentId?: string | undefined;
161
- sync?: boolean | undefined;
170
+ detach?: boolean | undefined;
162
171
  autoApprove?: boolean | undefined;
163
172
  allowDestructive?: boolean | undefined;
164
173
  timeout?: number | undefined;
@@ -221,7 +230,7 @@ export declare const FabricDeployApply: import("../../../.pikku/function/pikku-f
221
230
  production?: boolean | undefined;
222
231
  ref?: string | undefined;
223
232
  deploymentId?: string | undefined;
224
- sync?: boolean | undefined;
233
+ detach?: boolean | undefined;
225
234
  autoApprove?: boolean | undefined;
226
235
  allowDestructive?: boolean | undefined;
227
236
  timeout?: number | undefined;
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import { pikkuSessionlessFunc } from '../../../.pikku/function/index.js';
3
3
  import { resolveApiContext } from '../lib/config.js';
4
4
  import { getFabricRPC } from '../lib/http.js';
5
- import { assertNamedBranchDeploySafety, resolveRef } from '../lib/git.js';
5
+ import { assertNamedBranchDeploySafety, currentBranch, resolveRef, } from '../lib/git.js';
6
6
  import { promptConfirm } from '../lib/prompt.js';
7
7
  import { added, changed, removed, dim, table } from '../lib/output.js';
8
8
  import { blockedReason, blockedSummary, missingConfigHints, changesAreEmpty, classifyStatus, describeDeployment, destructiveMigrations, isApprovable, readDeploymentStatus, readWorkers, reconcileDeployedRef, stateLabel, waitForDeployment, } from '../lib/deployment.js';
@@ -12,7 +12,7 @@ export const FabricDeployInput = z.object({
12
12
  production: z.boolean().optional(),
13
13
  ref: z.string().optional(),
14
14
  deploymentId: z.string().optional(),
15
- sync: z.boolean().optional(),
15
+ detach: z.boolean().optional(),
16
16
  autoApprove: z.boolean().optional(),
17
17
  allowDestructive: z.boolean().optional(),
18
18
  timeout: z.number().optional(),
@@ -23,15 +23,15 @@ export const FabricDeployValidatedInput = FabricDeployInput.superRefine((value,
23
23
  if (value.branch || value.production) {
24
24
  ctx.addIssue({
25
25
  code: z.ZodIssueCode.custom,
26
- message: '--deployment-id already names its target — drop --branch/--production.',
26
+ message: '--deployment-id already names its target — drop the branch/--production.',
27
27
  });
28
28
  }
29
29
  return;
30
30
  }
31
- if (!!value.branch === !!value.production) {
31
+ if (value.branch && value.production) {
32
32
  ctx.addIssue({
33
33
  code: z.ZodIssueCode.custom,
34
- message: 'Pass exactly one of --branch or --production.',
34
+ message: 'Pass a branch or --production, not both — --production is always main.',
35
35
  });
36
36
  }
37
37
  });
@@ -96,16 +96,25 @@ async function prepDeploy({ branch, production, ref }) {
96
96
  if (!ctx.projectId) {
97
97
  throw new Error('No fabric project linked. Run `pikku fabric link` first.');
98
98
  }
99
- // Guarded rather than asserted: the schema-level refine is bypassed whenever
100
- // the function is called outside CLI arg parsing, and `branch!` turned that
101
- // into "local branch undefined does not exist" — an error that names nothing.
102
- if (!production && !branch) {
103
- throw new Error('Pass exactly one of --branch or --production.');
104
- }
105
- const targetBranch = production ? 'main' : branch;
99
+ // With no target named, deploy the branch that is checked out — the common
100
+ // case, and the one worth not making people type twice. It is only safe to
101
+ // infer because `assertNamedBranchDeploySafety` below refuses any branch that
102
+ // is missing an upstream or out of sync with it, so an inferred target cannot
103
+ // ship something that was never pushed.
104
+ const inferred = !production && !branch;
105
+ const targetBranch = production
106
+ ? 'main'
107
+ : (branch ?? branchFromHead(await currentBranch()));
106
108
  const safety = await assertNamedBranchDeploySafety(targetBranch);
107
109
  const resolved = ref ? ((await resolveRef(ref)) ?? ref) : safety.headSha;
108
- return { ctx, projectId: ctx.projectId, targetBranch, resolved, safety };
110
+ return {
111
+ ctx,
112
+ projectId: ctx.projectId,
113
+ targetBranch,
114
+ resolved,
115
+ safety,
116
+ inferred,
117
+ };
109
118
  }
110
119
  async function prepAttach() {
111
120
  const ctx = await resolveApiContext();
@@ -124,6 +133,20 @@ const EXIT_BY_OUTCOME = {
124
133
  blocked: 3,
125
134
  timeout: 4,
126
135
  };
136
+ /**
137
+ * The branch to deploy when none was named, read off the checkout.
138
+ *
139
+ * `git rev-parse --abbrev-ref HEAD` answers the literal string `HEAD` on a
140
+ * detached checkout, which is not a branch and would be reported downstream as
141
+ * a branch that does not exist locally. Naming the real problem here is the
142
+ * difference between "check out a branch" and a puzzle.
143
+ */
144
+ export const branchFromHead = (head) => {
145
+ if (head === 'HEAD' || head === '') {
146
+ throw new Error('Deployment blocked: HEAD is detached, so there is no current branch to deploy.\nCheck out a branch, or name the target: `pikku fabric deploy apply <branch>`.');
147
+ }
148
+ return head;
149
+ };
127
150
  export const FabricDeployApply = pikkuSessionlessFunc({
128
151
  description: 'Build + deploy a named branch or production (main), or attach to an existing deployment.',
129
152
  input: FabricDeployValidatedInput,
@@ -137,7 +160,7 @@ export const FabricDeployApply = pikkuSessionlessFunc({
137
160
  throw new Error('--timeout must be a positive number of seconds.');
138
161
  }
139
162
  if (input.deploymentId && (input.branch || input.production)) {
140
- throw new Error('--deployment-id already names its target — drop --branch/--production.');
163
+ throw new Error('--deployment-id already names its target — drop the branch/--production.');
141
164
  }
142
165
  const attaching = Boolean(input.deploymentId);
143
166
  let projectId;
@@ -158,11 +181,17 @@ export const FabricDeployApply = pikkuSessionlessFunc({
158
181
  emit({ event: 'attached', deploymentId, status: current.status });
159
182
  }
160
183
  else {
161
- const { ctx, projectId: id, targetBranch, resolved, safety, } = await prepDeploy(input);
184
+ const { ctx, projectId: id, targetBranch, resolved, safety, inferred, } = await prepDeploy(input);
162
185
  projectId = id;
163
186
  branch = targetBranch;
164
187
  ref = resolved;
165
188
  rpc = getFabricRPC({ apiUrl: ctx.apiUrl, token: ctx.token });
189
+ // An inferred target is said out loud before anything is built. Under -y
190
+ // there is no confirmation prompt to name it, and a deploy that never
191
+ // told you which branch it picked is the one that ships the wrong branch.
192
+ if (inferred && !input.json) {
193
+ console.log(dim(`Deploying the current branch: ${targetBranch}`));
194
+ }
166
195
  if (!input.autoApprove) {
167
196
  const target = `${branch} @ ${resolved.slice(0, 8)}`;
168
197
  if (!process.stdin.isTTY) {
@@ -202,7 +231,7 @@ export const FabricDeployApply = pikkuSessionlessFunc({
202
231
  ...(stageId ? { stageId } : {}),
203
232
  ...(runId ? { runId } : {}),
204
233
  };
205
- if (!input.sync && !attaching) {
234
+ if (input.detach && !attaching) {
206
235
  return { ...base, outcome: 'queued' };
207
236
  }
208
237
  let approvalWithheld;
@@ -225,7 +254,7 @@ export const FabricDeployApply = pikkuSessionlessFunc({
225
254
  : '';
226
255
  return promptConfirm(`Plan for ${branch ?? deploymentId} is ready to publish (${stateLabel(status.status, status.statusReason)}).${warning} Approve?`);
227
256
  };
228
- if (!input.sync) {
257
+ if (input.detach) {
229
258
  const status = await readDeploymentStatus(rpc, deploymentId);
230
259
  const klass = classifyStatus(status.status);
231
260
  const outcome = klass === 'in_flight' ? 'queued' : klass;
@@ -324,7 +353,7 @@ const missingLines = (label, entries) => {
324
353
  ...entries.map((e) => ` ${e.name}${e.displayName ? dim(` (${e.displayName})`) : ''}${e.docsUrl ? dim(` — ${e.docsUrl}`) : ''}`),
325
354
  ];
326
355
  };
327
- const reattachHint = (deploymentId) => dim(`Re-attach with \`pikku fabric deploy apply --deployment-id ${deploymentId} --sync\`.`);
356
+ const reattachHint = (deploymentId) => dim(`Re-attach with \`pikku fabric deploy apply --deployment-id ${deploymentId}\`.`);
328
357
  export const renderDeployApply = (_s, result) => {
329
358
  const { outcome, branch, ref, deploymentId, status, statusReason, changes, workers, url, elapsedMs, timeoutSeconds, approved, } = result;
330
359
  const where = branch ?? 'deployment';
@@ -363,10 +392,10 @@ export const renderDeployApply = (_s, result) => {
363
392
  console.log(line);
364
393
  if (result.approvalWithheld === 'destructive_migrations') {
365
394
  console.log(dim('The plan drops or rewrites data. Nothing was published — review the migrations above, then re-run with `--allow-destructive` to accept them.'));
366
- console.log(dim(`\`pikku fabric deploy apply --deployment-id ${deploymentId} --sync --auto-approve --allow-destructive\``));
395
+ console.log(dim(`\`pikku fabric deploy apply --deployment-id ${deploymentId} -y --allow-destructive\``));
367
396
  }
368
397
  else if (isApprovable(reason) && !approved) {
369
- console.log(dim(`Approve it with \`pikku fabric deploy apply --deployment-id ${deploymentId} --sync --auto-approve\`.`));
398
+ console.log(dim(`Approve it with \`pikku fabric deploy apply --deployment-id ${deploymentId} -y\`.`));
370
399
  }
371
400
  else if (reason === 'needs_config') {
372
401
  for (const hint of missingConfigHints(result.missingSecrets, result.missingVariables)) {
@@ -23,7 +23,7 @@ export async function resolveStage(rpc, projectId, branch) {
23
23
  return { stageId: only.stageId, branch: only.branch };
24
24
  }
25
25
  throw new Error(stages.length === 0
26
- ? 'No stages deployed for this project yet — run `pikku fabric deploy apply --branch <branch>` first.'
26
+ ? 'No stages deployed for this project yet — run `pikku fabric deploy apply <branch>` first.'
27
27
  : `--branch is required — this project has ${stages.length} stages: ${known.join(', ')}`);
28
28
  }
29
29
  const stage = stages.find((s) => s.branch === branch);