@pikku/cli 0.12.153 → 0.12.155
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.
- package/console-app/assets/{HelpPanel-0XQ4CyKC.js → HelpPanel-Ndvkqpn8.js} +1 -1
- package/console-app/assets/{abnfDiagram-VCTEODGH-DZTF_2aX.js → abnfDiagram-VCTEODGH-DvUR4gej.js} +1 -1
- package/console-app/assets/architecture-7GRP2DOG-DJkDVzM_.js +1 -0
- package/console-app/assets/{architectureDiagram-5GKGNRK7-Re4-6X-k.js → architectureDiagram-5GKGNRK7-HLwJ3llk.js} +1 -1
- package/console-app/assets/{blockDiagram-I7D4REHJ-Dbj7SnRK.js → blockDiagram-I7D4REHJ-LMSdIVfc.js} +1 -1
- package/console-app/assets/{c4Diagram-7LVT6UL2-DUr02Wxh.js → c4Diagram-7LVT6UL2-CcWW9nYv.js} +1 -1
- package/console-app/assets/channel-C6yZyX_m.js +1 -0
- package/console-app/assets/{chunk-4HAMMTFA-DjatzNf_.js → chunk-4HAMMTFA-Dxcu8ptc.js} +1 -1
- package/console-app/assets/{chunk-75Z2AOVW-BGsmWEdU.js → chunk-75Z2AOVW-BBINCcJe.js} +1 -1
- package/console-app/assets/{chunk-DU6HZSFF-CC7WiVgI.js → chunk-DU6HZSFF-BgJhrYpo.js} +1 -1
- package/console-app/assets/{chunk-F27PBJKO-BATuW9Ej.js → chunk-F27PBJKO-CctviqIo.js} +1 -1
- package/console-app/assets/{chunk-GMAD6QVW-CgHNo00B.js → chunk-GMAD6QVW-BJ-InAqp.js} +1 -1
- package/console-app/assets/{chunk-GVQU2GXP-VT_xckd9.js → chunk-GVQU2GXP-DaeerGJS.js} +1 -1
- package/console-app/assets/{chunk-IMKFNOWR-BhSVbWtF.js → chunk-IMKFNOWR-eOSAFAc9.js} +1 -1
- package/console-app/assets/{chunk-L3NEJ4N5-HUF6a3Xl.js → chunk-L3NEJ4N5-DRfMBpkp.js} +1 -1
- package/console-app/assets/{chunk-OSK3NFVY-C_LPDGIB.js → chunk-OSK3NFVY-DMZ2WBA1.js} +1 -1
- package/console-app/assets/{chunk-P2QGCYS3-lWDBgw4Q.js → chunk-P2QGCYS3-d0BFQiY1.js} +1 -1
- package/console-app/assets/{chunk-POPQ4Y6H--6JTzmZJ.js → chunk-POPQ4Y6H-D4zICDtR.js} +1 -1
- package/console-app/assets/{chunk-PWAF6VOD-C1GqaJJs.js → chunk-PWAF6VOD-_v9wUl6m.js} +1 -1
- package/console-app/assets/{chunk-SHT3W25Y-Dd_4Zpdj.js → chunk-SHT3W25Y-DZ3Wa0Mc.js} +1 -1
- package/console-app/assets/{chunk-SVP7TREG-B8OY7dfD.js → chunk-SVP7TREG-2yCR3ywB.js} +1 -1
- package/console-app/assets/{chunk-TICWLB2K-B8S7Hmnu.js → chunk-TICWLB2K-CtulM0X6.js} +1 -1
- package/console-app/assets/chunk-XXDRQBXY-CLsn_tEh.js +1 -0
- package/console-app/assets/classDiagram-ZZMXUADV-D7FKceOo.js +1 -0
- package/console-app/assets/classDiagram-v2-VYDZK3BY-D7FKceOo.js +1 -0
- package/console-app/assets/{cose-bilkent-JH36ORCC-C6RM8oPO.js → cose-bilkent-JH36ORCC-DNc5wiJ_.js} +1 -1
- package/console-app/assets/{cynefin-OW5HDTMX-COh9rFYY.js → cynefin-OW5HDTMX-CQPn9kED.js} +1 -1
- package/console-app/assets/{cynefinDiagram-5FMLGOSQ-Dd9AR17w.js → cynefinDiagram-5FMLGOSQ-CkW1ZG13.js} +1 -1
- package/console-app/assets/{dagre-BDMvDAer.js → dagre-BcTdbH8b.js} +1 -1
- package/console-app/assets/{dagre-GXQ25YYZ-C_nBUPgr.js → dagre-GXQ25YYZ-Cgvwy7_U.js} +1 -1
- package/console-app/assets/{diagram-S7CK7UJ4-BGOobQeC.js → diagram-S7CK7UJ4-JB3GlMwZ.js} +1 -1
- package/console-app/assets/{diagram-UQ7AKVKN-CAF_vcj0.js → diagram-UQ7AKVKN-CaIeYJXa.js} +1 -1
- package/console-app/assets/{diagram-VSXAHHWV-q-aY0Nsc.js → diagram-VSXAHHWV-Cku8J3KG.js} +1 -1
- package/console-app/assets/{diagram-VX7I27RA-CnUibSOe.js → diagram-VX7I27RA-Dp3jeYrS.js} +1 -1
- package/console-app/assets/{diagram-Z3DM3KII-DY0V5kOJ.js → diagram-Z3DM3KII-B56Ys0Pf.js} +1 -1
- package/console-app/assets/{ebnfDiagram-PWID7BFC-CXp4CmEF.js → ebnfDiagram-PWID7BFC-CfxeEpk1.js} +1 -1
- package/console-app/assets/{erDiagram-RLTQ6QDP-CKnfXmPl.js → erDiagram-RLTQ6QDP-Dp9sOoSf.js} +1 -1
- package/console-app/assets/eventmodeling-NTZA5JFV-CccBkMWb.js +1 -0
- package/console-app/assets/flowDiagram-HODETNUW-Cp_XHTFC.js +1 -0
- package/console-app/assets/{ganttDiagram-EL5Y4UJY-D6v_RJ7o.js → ganttDiagram-EL5Y4UJY-BsD1LYkb.js} +1 -1
- package/console-app/assets/{gitGraph-4MIJSDKK-y3kWDddY.js → gitGraph-4MIJSDKK-CSHhAZoD.js} +1 -1
- package/console-app/assets/{gitGraphDiagram-WWUBYQGX-CBaE24KN.js → gitGraphDiagram-WWUBYQGX-CZ_0OI7F.js} +1 -1
- package/console-app/assets/{graphlib-DAA_TPmU.js → graphlib-Bpf494dL.js} +1 -1
- package/console-app/assets/{index-HuTd6kcC.js → index-DXtR4J7Y.js} +68 -68
- package/console-app/assets/{info-A6RAGUB7-BvxfRJ9-.js → info-A6RAGUB7-Cym2YsaS.js} +1 -1
- package/console-app/assets/{infoDiagram-27XIBGKW-BlFmgW96.js → infoDiagram-27XIBGKW-n9atnl-K.js} +1 -1
- package/console-app/assets/{ishikawaDiagram-5VMMS53U-Dpwhnwwq.js → ishikawaDiagram-5VMMS53U-BeLDkr8-.js} +1 -1
- package/console-app/assets/{journeyDiagram-3NMN7TZE-iOSeOQma.js → journeyDiagram-3NMN7TZE-B__R_eOL.js} +1 -1
- package/console-app/assets/{kanban-definition-UXKFOSKX-DFGTB8S5.js → kanban-definition-UXKFOSKX-Cwsl1hYB.js} +1 -1
- package/console-app/assets/{line-B_5qZKoM.js → line-UWFHtT2i.js} +1 -1
- package/console-app/assets/{linear-BmXUYu4J.js → linear-BHDHoGpb.js} +1 -1
- package/console-app/assets/{mermaid-parser.core-DyPi3Lbr.js → mermaid-parser.core-CyGW9xht.js} +3 -3
- package/console-app/assets/{mermaid.core-S4y9jX8K.js → mermaid.core-zeBKxakC.js} +4 -4
- package/console-app/assets/{mindmap-definition-YA3MSWOX-Bl09mCaS.js → mindmap-definition-YA3MSWOX-bZ2kbbMM.js} +1 -1
- package/console-app/assets/{packet-AYTQ26CC-B5zoasmU.js → packet-AYTQ26CC-DtH3ZjsO.js} +1 -1
- package/console-app/assets/{pegDiagram-XKGWAZYB-CAa0SOHf.js → pegDiagram-XKGWAZYB-Cy-M_2Zc.js} +1 -1
- package/console-app/assets/{pie-WAS4IAKB-C91xXCXY.js → pie-WAS4IAKB-DEZDAaJW.js} +1 -1
- package/console-app/assets/{pieDiagram-E7YTZNPT-CmUHVYwz.js → pieDiagram-E7YTZNPT-Ce3Yl--P.js} +1 -1
- package/console-app/assets/{quadrantDiagram-AXDQQJYC-XWsej4ss.js → quadrantDiagram-AXDQQJYC-BTK8v4H5.js} +1 -1
- package/console-app/assets/{radar-RG4KPBEZ-B7ieCnSw.js → radar-RG4KPBEZ-CTPhaLOE.js} +1 -1
- package/console-app/assets/{railroad-74A4TZTK-KTKjMg4U.js → railroad-74A4TZTK-DMa9G1LV.js} +1 -1
- package/console-app/assets/railroad-abnf-HS5TGJTU-K0DgRobv.js +1 -0
- package/console-app/assets/railroad-ebnf-LZEXJU2U-CHEGHd9y.js +1 -0
- package/console-app/assets/railroad-peg-WCYAUIDC-EYHvZbXp.js +1 -0
- package/console-app/assets/{railroadDiagram-O6MQD6OU-oh1FjI2K.js → railroadDiagram-O6MQD6OU-CYbkYMqD.js} +1 -1
- package/console-app/assets/{requirementDiagram-BXWQKSXE-D6z7hLfj.js → requirementDiagram-BXWQKSXE-DjWjfWOk.js} +1 -1
- package/console-app/assets/{sankeyDiagram-P5KCCOFB-DFb92jfp.js → sankeyDiagram-P5KCCOFB-6sAcPgDK.js} +1 -1
- package/console-app/assets/{sequenceDiagram-WJ2MYXX4-BRKj-PG1.js → sequenceDiagram-WJ2MYXX4-DzyU1CIr.js} +1 -1
- package/console-app/assets/{src-DYBVouJk.js → src-0ppm3vZe.js} +1 -1
- package/console-app/assets/{stateDiagram-D77RDMKH-BfTLNw5t.js → stateDiagram-D77RDMKH-S5osVh5p.js} +1 -1
- package/console-app/assets/stateDiagram-v2-MP3YSRHH-BZUe_KiH.js +1 -0
- package/console-app/assets/{swimlanes-42K2YHIH-DXkNYzX9.js → swimlanes-42K2YHIH-Dd7HjelH.js} +1 -1
- package/console-app/assets/swimlanesDiagram-VR7AAH4N-D6xRypPY.js +8 -0
- package/console-app/assets/{timeline-definition-24CTP7MA-B8m2V75P.js → timeline-definition-24CTP7MA-eZ3AIIpc.js} +1 -1
- package/console-app/assets/{treeView-Q6P3EWNA-BisqOzat.js → treeView-Q6P3EWNA-DF5sOT6y.js} +1 -1
- package/console-app/assets/{treemap-WGGIJYW6-DOxEXpb1.js → treemap-WGGIJYW6-Bob0iUUb.js} +1 -1
- package/console-app/assets/{vennDiagram-4TSXK5OY-ZeuU7o23.js → vennDiagram-4TSXK5OY-CeowTqyG.js} +1 -1
- package/console-app/assets/{wardley-WFR3VGLG-sspeOMuz.js → wardley-WFR3VGLG-DrnQFkZZ.js} +1 -1
- package/console-app/assets/{wardleyDiagram-VM6X3IG4-CF2vzNJV.js → wardleyDiagram-VM6X3IG4-Dsfkp6D5.js} +1 -1
- package/console-app/assets/{xychartDiagram-S5SC5T6Z-BR9XBq3s.js → xychartDiagram-S5SC5T6Z-YC_qsmJw.js} +1 -1
- package/console-app/index.html +1 -1
- package/dist/.pikku/addon/index.d.ts +1 -1
- package/dist/.pikku/addon/index.js +1 -1
- package/dist/.pikku/addon/pikku-addon-types.gen.d.ts +1 -1
- package/dist/.pikku/addon/pikku-addon-types.gen.js +1 -1
- package/dist/.pikku/agent/index.d.ts +1 -1
- package/dist/.pikku/agent/index.js +1 -1
- package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +1 -1
- package/dist/.pikku/agent/pikku-model-aliases.gen.js +1 -1
- package/dist/.pikku/analytics/index.d.ts +1 -1
- package/dist/.pikku/analytics/index.js +1 -1
- package/dist/.pikku/analytics/pikku-analytics-types.gen.d.ts +1 -1
- package/dist/.pikku/analytics/pikku-analytics-types.gen.js +1 -1
- package/dist/.pikku/auth/index.d.ts +1 -1
- package/dist/.pikku/auth/index.js +1 -1
- package/dist/.pikku/auth/pikku-auth-types.gen.d.ts +1 -1
- package/dist/.pikku/auth/pikku-auth-types.gen.js +1 -1
- package/dist/.pikku/channel/index.d.ts +1 -1
- package/dist/.pikku/channel/index.js +1 -1
- package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +1 -1
- package/dist/.pikku/channel/pikku-channel-types.gen.js +1 -1
- package/dist/.pikku/cli/index.d.ts +1 -1
- package/dist/.pikku/cli/index.js +1 -1
- package/dist/.pikku/cli/pikku-cli-channel.js +1 -1
- package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-client.gen.js +15 -5
- package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.json +1 -1
- package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-types.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.json +1 -1
- package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-wirings.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli.gen.js +15 -6
- package/dist/.pikku/error/index.d.ts +1 -1
- package/dist/.pikku/error/index.js +1 -1
- package/dist/.pikku/error/pikku-error-types.gen.d.ts +1 -1
- package/dist/.pikku/error/pikku-error-types.gen.js +1 -1
- package/dist/.pikku/function/index.d.ts +1 -1
- package/dist/.pikku/function/index.js +1 -1
- package/dist/.pikku/function/pikku-function-types.gen.d.ts +1 -1
- package/dist/.pikku/function/pikku-function-types.gen.js +1 -1
- package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
- package/dist/.pikku/function/pikku-functions-meta.gen.json +33 -33
- package/dist/.pikku/function/pikku-functions.gen.js +1 -1
- package/dist/.pikku/gateway/index.d.ts +1 -1
- package/dist/.pikku/gateway/index.js +1 -1
- package/dist/.pikku/gateway/pikku-gateway-types.gen.d.ts +1 -1
- package/dist/.pikku/gateway/pikku-gateway-types.gen.js +1 -1
- package/dist/.pikku/http/index.d.ts +1 -1
- package/dist/.pikku/http/index.js +1 -1
- package/dist/.pikku/http/pikku-http-types.gen.d.ts +1 -1
- package/dist/.pikku/http/pikku-http-types.gen.js +1 -1
- package/dist/.pikku/mcp/index.d.ts +1 -1
- package/dist/.pikku/mcp/index.js +1 -1
- package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +1 -1
- package/dist/.pikku/mcp/pikku-mcp-types.gen.js +1 -1
- package/dist/.pikku/middleware/index.d.ts +1 -1
- package/dist/.pikku/middleware/index.js +1 -1
- package/dist/.pikku/middleware/pikku-middleware-types.gen.d.ts +1 -1
- package/dist/.pikku/middleware/pikku-middleware-types.gen.js +1 -1
- package/dist/.pikku/pikku-bootstrap-scenarios.gen.d.ts +1 -1
- package/dist/.pikku/pikku-bootstrap-scenarios.gen.js +1 -1
- package/dist/.pikku/pikku-bootstrap.gen.d.ts +1 -1
- package/dist/.pikku/pikku-bootstrap.gen.js +1 -1
- package/dist/.pikku/pikku-services.gen.d.ts +1 -1
- package/dist/.pikku/queue/index.d.ts +1 -1
- package/dist/.pikku/queue/index.js +1 -1
- package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +1 -1
- package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -1
- package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +1 -1
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +1 -1
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +1 -1
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +1 -1
- package/dist/.pikku/scenarios/index.d.ts +1 -1
- package/dist/.pikku/scenarios/index.js +1 -1
- package/dist/.pikku/scenarios/pikku-personas.gen.js +1 -1
- package/dist/.pikku/scenarios/pikku-scenario-functions-meta.gen.js +1 -1
- package/dist/.pikku/scenarios/pikku-scenario-functions.gen.d.ts +1 -1
- package/dist/.pikku/scenarios/pikku-scenario-types.gen.d.ts +1 -1
- package/dist/.pikku/scenarios/pikku-scenario-wirings-meta.gen.js +1 -1
- package/dist/.pikku/scenarios/pikku-scenario-wirings.gen.d.ts +1 -1
- package/dist/.pikku/scenarios/schemas/register.gen.d.ts +1 -1
- package/dist/.pikku/scenarios/schemas/register.gen.js +1 -1
- package/dist/.pikku/scheduler/index.d.ts +1 -1
- package/dist/.pikku/scheduler/index.js +1 -1
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +1 -1
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
- package/dist/.pikku/schemas/register.gen.js +1 -1
- package/dist/.pikku/scopes/index.d.ts +1 -1
- package/dist/.pikku/scopes/index.js +1 -1
- package/dist/.pikku/scopes/pikku-flags.gen.d.ts +1 -1
- package/dist/.pikku/scopes/pikku-personas.gen.js +1 -1
- package/dist/.pikku/scopes/pikku-roles.gen.d.ts +1 -1
- package/dist/.pikku/scopes/pikku-scope-types.gen.d.ts +1 -1
- package/dist/.pikku/scopes/pikku-scope-types.gen.js +1 -1
- package/dist/.pikku/scopes/pikku-scopes.gen.d.ts +1 -1
- package/dist/.pikku/secrets/index.d.ts +1 -1
- package/dist/.pikku/secrets/index.js +1 -1
- package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +1 -1
- package/dist/.pikku/secrets/pikku-secret-types.gen.js +1 -1
- package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +1 -1
- package/dist/.pikku/secrets/pikku-secrets.gen.js +1 -1
- package/dist/.pikku/services/pikku-meta-service.gen.d.ts +1 -1
- package/dist/.pikku/services/pikku-meta-service.gen.js +1 -1
- package/dist/.pikku/setup/index.d.ts +1 -1
- package/dist/.pikku/setup/index.js +1 -1
- package/dist/.pikku/setup/pikku-setup-types.gen.d.ts +1 -1
- package/dist/.pikku/setup/pikku-setup-types.gen.js +1 -1
- package/dist/.pikku/trigger/index.d.ts +1 -1
- package/dist/.pikku/trigger/index.js +1 -1
- package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +1 -1
- package/dist/.pikku/trigger/pikku-trigger-types.gen.js +1 -1
- package/dist/.pikku/variables/index.d.ts +1 -1
- package/dist/.pikku/variables/index.js +1 -1
- package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +1 -1
- package/dist/.pikku/variables/pikku-variable-types.gen.js +1 -1
- package/dist/.pikku/variables/pikku-variables.gen.d.ts +1 -1
- package/dist/.pikku/variables/pikku-variables.gen.js +1 -1
- package/dist/.pikku/workflow/index.d.ts +1 -1
- package/dist/.pikku/workflow/index.js +1 -1
- package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +1 -1
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js +1 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +1 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
- package/dist/bin/pikku-bin.mjs +2 -2
- package/dist/bin/pikku.js +32 -2
- package/dist/src/deploy/build-pipeline.d.ts +43 -0
- package/dist/src/deploy/build-pipeline.js +79 -30
- package/dist/src/fabric/fabric-commands.js +3 -1
- package/dist/src/fabric/functions/add.function.js +4 -3
- package/dist/src/fabric/functions/changes-file.function.js +2 -1
- package/dist/src/fabric/functions/changes-shot.function.js +3 -2
- package/dist/src/fabric/functions/db-schema.function.js +3 -2
- package/dist/src/fabric/functions/deploy-list.function.js +3 -2
- package/dist/src/fabric/functions/deploy-units.function.js +3 -2
- package/dist/src/fabric/functions/deploy.function.js +4 -4
- package/dist/src/fabric/functions/domains-add.function.js +4 -3
- package/dist/src/fabric/functions/domains-list.function.js +3 -2
- package/dist/src/fabric/functions/domains-remove.function.js +5 -4
- package/dist/src/fabric/functions/errors.function.js +3 -2
- package/dist/src/fabric/functions/findings-flush.function.js +2 -1
- package/dist/src/fabric/functions/init.function.js +3 -2
- package/dist/src/fabric/functions/link.function.js +10 -10
- package/dist/src/fabric/functions/login.function.js +4 -3
- package/dist/src/fabric/functions/logs.function.js +2 -2
- package/dist/src/fabric/functions/metrics.function.js +3 -2
- package/dist/src/fabric/functions/projects-list.function.js +2 -1
- package/dist/src/fabric/functions/publish.function.js +7 -6
- package/dist/src/fabric/functions/report.function.js +4 -3
- package/dist/src/fabric/functions/rollback.function.js +3 -2
- package/dist/src/fabric/functions/secrets-delete.function.js +5 -4
- package/dist/src/fabric/functions/secrets-list.function.js +3 -2
- package/dist/src/fabric/functions/secrets-rotate.function.js +4 -3
- package/dist/src/fabric/functions/secrets-set.function.js +11 -4
- package/dist/src/fabric/functions/smoke.function.js +4 -3
- package/dist/src/fabric/functions/status.function.js +3 -2
- package/dist/src/fabric/functions/trace.function.js +3 -2
- package/dist/src/fabric/functions/variables-get.function.js +3 -2
- package/dist/src/fabric/functions/variables-set.function.js +3 -2
- package/dist/src/fabric/lib/changes.js +3 -2
- package/dist/src/fabric/lib/config.js +2 -1
- package/dist/src/fabric/lib/deployment.js +2 -1
- package/dist/src/fabric/lib/git.d.ts +10 -1
- package/dist/src/fabric/lib/git.js +10 -1
- package/dist/src/fabric/lib/prompt.d.ts +14 -5
- package/dist/src/fabric/lib/prompt.js +78 -15
- package/dist/src/fabric/lib/report-environment.d.ts +5 -4
- package/dist/src/fabric/lib/report-environment.js +18 -4
- package/dist/src/fabric/lib/sealed-box.js +3 -2
- package/dist/src/fabric/lib/stage.js +3 -2
- package/dist/src/functions/commands/deploy-apply.js +1 -0
- package/dist/src/functions/commands/deploy-plan.js +1 -0
- package/dist/src/functions/commands/watch.js +5 -2
- package/dist/src/functions/db/sqlite/scenario-baseline.js +5 -0
- package/dist/src/functions/wirings/agent/serialize-public-agent.js +2 -0
- package/dist/src/functions/wirings/cli/serialize-channel-cli-client.js +18 -4
- package/dist/src/functions/wirings/cli/serialize-local-cli-bootstrap.js +16 -5
- package/dist/src/functions/wirings/functions/pikku-command-addon-types.js +26 -5
- package/dist/src/functions/wirings/functions/serialize-addon-types.d.ts +1 -1
- package/dist/src/functions/wirings/functions/serialize-addon-types.js +46 -1
- package/dist/src/functions/wirings/mcp/pikku-command-mcp.js +3 -1
- package/dist/src/functions/wirings/middleware/pikku-command-middleware.js +13 -1
- package/dist/src/functions/wirings/middleware/serialize-middleware-imports.d.ts +13 -0
- package/dist/src/functions/wirings/middleware/serialize-middleware-imports.js +48 -8
- package/dist/src/utils/pikku-cli-config-error.d.ts +8 -3
- package/dist/src/utils/pikku-cli-config-error.js +8 -3
- package/dist/src/utils/pikku-cli-config.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/surface.json +4 -16
- package/console-app/assets/architecture-7GRP2DOG-NotVOJ5Y.js +0 -1
- package/console-app/assets/channel-DU63_zXh.js +0 -1
- package/console-app/assets/chunk-XXDRQBXY-BLuHuEZN.js +0 -1
- package/console-app/assets/classDiagram-ZZMXUADV-BTYfUi7u.js +0 -1
- package/console-app/assets/classDiagram-v2-VYDZK3BY-BTYfUi7u.js +0 -1
- package/console-app/assets/eventmodeling-NTZA5JFV-CBfQhnG8.js +0 -1
- package/console-app/assets/flowDiagram-HODETNUW-BnY3G7p6.js +0 -1
- package/console-app/assets/railroad-abnf-HS5TGJTU-e9AlsYmr.js +0 -1
- package/console-app/assets/railroad-ebnf-LZEXJU2U-BVX8UG1z.js +0 -1
- package/console-app/assets/railroad-peg-WCYAUIDC-BzWQFvD9.js +0 -1
- package/console-app/assets/stateDiagram-v2-MP3YSRHH-B8sMNnnF.js +0 -1
- package/console-app/assets/swimlanesDiagram-VR7AAH4N-CiZdLDyk.js +0 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { readFile, lstat, readdir } from 'node:fs/promises';
|
|
1
|
+
import { readFile, lstat, readdir, realpath } from 'node:fs/promises';
|
|
2
2
|
import { existsSync } from 'node:fs';
|
|
3
|
-
import { dirname, join } from 'node:path';
|
|
3
|
+
import { dirname, join, sep } from 'node:path';
|
|
4
4
|
/**
|
|
5
5
|
* Walk up from `startDir` for the first `node_modules/@pikku` that holds
|
|
6
6
|
* packages. A monorepo hoists to the root, an app installs locally, and either
|
|
@@ -26,6 +26,21 @@ export async function findPikkuScope(startDir) {
|
|
|
26
26
|
dir = parent;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* A symlink on its own proves nothing: bun and pnpm install every registry
|
|
31
|
+
* package as a link into a store that itself lives under `node_modules`, so
|
|
32
|
+
* reading the link alone marks a whole ordinary install as modified framework
|
|
33
|
+
* code. Only a target outside `node_modules` is a checkout someone can edit.
|
|
34
|
+
*/
|
|
35
|
+
async function resolvesToCheckout(packageDir) {
|
|
36
|
+
const stats = await lstat(packageDir).catch(() => null);
|
|
37
|
+
if (!stats?.isSymbolicLink())
|
|
38
|
+
return false;
|
|
39
|
+
const target = await realpath(packageDir).catch(() => null);
|
|
40
|
+
if (!target)
|
|
41
|
+
return false;
|
|
42
|
+
return !`${target}${sep}`.includes(`${sep}node_modules${sep}`);
|
|
43
|
+
}
|
|
29
44
|
/**
|
|
30
45
|
* Versions read off the installed tree rather than out of `package.json`. A
|
|
31
46
|
* range like `^0.12.35` says nothing about what ran, and the version that ran
|
|
@@ -51,11 +66,10 @@ export async function readPikkuPackages(scopeDir) {
|
|
|
51
66
|
}
|
|
52
67
|
if (typeof version !== 'string')
|
|
53
68
|
continue;
|
|
54
|
-
const stats = await lstat(packageDir).catch(() => null);
|
|
55
69
|
packages.push({
|
|
56
70
|
name: `@pikku/${entry}`,
|
|
57
71
|
version,
|
|
58
|
-
linked:
|
|
72
|
+
linked: await resolvesToCheckout(packageDir),
|
|
59
73
|
});
|
|
60
74
|
}
|
|
61
75
|
return packages;
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* business having one; opening a value happens in the worker.
|
|
17
17
|
*/
|
|
18
18
|
import { createCipheriv, createPublicKey, diffieHellman, generateKeyPairSync, hkdfSync, randomBytes, } from 'node:crypto';
|
|
19
|
+
import { FabricPreconditionError } from './errors.js';
|
|
19
20
|
/** Algorithm tag carried by every sealed value. Must match fabric's. */
|
|
20
21
|
export const SEALED_BOX_ALGORITHM = 'sealed-x25519-v1';
|
|
21
22
|
/** HKDF domain separator. Must match fabric's byte for byte. */
|
|
@@ -60,13 +61,13 @@ function importPublicKey(publicKey) {
|
|
|
60
61
|
});
|
|
61
62
|
}
|
|
62
63
|
catch (error) {
|
|
63
|
-
throw new
|
|
64
|
+
throw new FabricPreconditionError(`Not a valid X25519 public key (${error instanceof Error ? error.message : String(error)})`);
|
|
64
65
|
}
|
|
65
66
|
// A public key of the wrong curve would still ECDH, just against a key the
|
|
66
67
|
// stage's worker cannot match — the failure would surface as an unopenable
|
|
67
68
|
// secret much later, so refuse it at the point the type is still knowable.
|
|
68
69
|
if (key.asymmetricKeyType !== 'x25519') {
|
|
69
|
-
throw new
|
|
70
|
+
throw new FabricPreconditionError(`Stage sealing key is ${key.asymmetricKeyType}, expected x25519 — this CLI is too old for it, run \`npm i -g @pikku/cli\``);
|
|
70
71
|
}
|
|
71
72
|
return key;
|
|
72
73
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FabricPreconditionError } from './errors.js';
|
|
1
2
|
/**
|
|
2
3
|
* Resolve a stage from (projectId, branch) via the `listStages` RPC. The
|
|
3
4
|
* stageId-based read RPCs (listDeployments, listDeploymentWorkers,
|
|
@@ -22,13 +23,13 @@ export async function resolveStage(rpc, projectId, branch) {
|
|
|
22
23
|
if (stages.length === 1 && only) {
|
|
23
24
|
return { stageId: only.stageId, branch: only.branch };
|
|
24
25
|
}
|
|
25
|
-
throw new
|
|
26
|
+
throw new FabricPreconditionError(stages.length === 0
|
|
26
27
|
? 'No stages deployed for this project yet — run `pikku fabric deploy apply <branch>` first.'
|
|
27
28
|
: `--branch is required — this project has ${stages.length} stages: ${known.join(', ')}`);
|
|
28
29
|
}
|
|
29
30
|
const stage = stages.find((s) => s.branch === branch);
|
|
30
31
|
if (!stage) {
|
|
31
|
-
throw new
|
|
32
|
+
throw new FabricPreconditionError(`No stage for branch "${branch}".${known.length ? ` Existing: ${known.join(', ')}` : ''}`);
|
|
32
33
|
}
|
|
33
34
|
return { stageId: stage.stageId, branch: stage.branch };
|
|
34
35
|
}
|
|
@@ -30,8 +30,11 @@ export const watch = pikkuSessionlessFunc({
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
catch (err) {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
// Through the logger, so it obeys --log-level and the dev server's
|
|
34
|
+
// formatting. `console.error(err)` printed a bare stack over the top
|
|
35
|
+
// of the watch output no matter what verbosity was asked for.
|
|
36
|
+
logger.error(`Error running watch: ${err instanceof Error ? err.message : String(err)}`);
|
|
37
|
+
logger.debug(err instanceof Error ? (err.stack ?? '') : String(err));
|
|
35
38
|
}
|
|
36
39
|
};
|
|
37
40
|
// A codegen pass holds a whole ts.Program, so two overlapping passes double
|
|
@@ -6,6 +6,11 @@ export async function captureSqliteScenarioBaseline(resolved, { keep = [] }) {
|
|
|
6
6
|
const shouldKeep = keepMatcher(keep);
|
|
7
7
|
const withDb = (run) => {
|
|
8
8
|
const db = runtime.open(resolved.dbFile);
|
|
9
|
+
// The app under test is still connected to this file. A rollback-journal
|
|
10
|
+
// database gives a writer an exclusive lock, so without a timeout the first
|
|
11
|
+
// statement that overlaps one of the app's reads fails outright with
|
|
12
|
+
// SQLITE_BUSY and takes the scenario with it.
|
|
13
|
+
db.exec('PRAGMA busy_timeout = 10000');
|
|
9
14
|
try {
|
|
10
15
|
return run(db);
|
|
11
16
|
}
|
|
@@ -203,6 +203,7 @@ export const agentRoutes = defineHTTPRoutes({
|
|
|
203
203
|
route: '${globalHTTPPrefix}/rpc/agent/:agentName/stream',
|
|
204
204
|
method: 'post',
|
|
205
205
|
sse: true,
|
|
206
|
+
streamProtocol: 'agui',
|
|
206
207
|
func: agentStreamCaller,
|
|
207
208
|
},
|
|
208
209
|
agentApprove: {
|
|
@@ -214,6 +215,7 @@ export const agentRoutes = defineHTTPRoutes({
|
|
|
214
215
|
route: '${globalHTTPPrefix}/rpc/agent/:agentName/resume',
|
|
215
216
|
method: 'post',
|
|
216
217
|
sse: true,
|
|
218
|
+
streamProtocol: 'agui',
|
|
217
219
|
func: agentResumeCaller,
|
|
218
220
|
},
|
|
219
221
|
},
|
|
@@ -112,6 +112,7 @@ export function serializeChannelCLIClient(programName, programMeta, clientFile,
|
|
|
112
112
|
: '';
|
|
113
113
|
return `
|
|
114
114
|
import { executeRawCLIViaChannel } from '@pikku/core/cli/channel'
|
|
115
|
+
import { formatCLIError, wantsStackTrace } from '@pikku/core/cli'
|
|
115
116
|
import type { CorePikkuCLIClientRender } from '@pikku/core/cli/channel'
|
|
116
117
|
import type { Capabilities } from '@pikku/core/channel'
|
|
117
118
|
import { CorePikkuWebsocket } from '@pikku/websocket'
|
|
@@ -218,12 +219,25 @@ if (isDirectExecution) {
|
|
|
218
219
|
ws = new WebSocket(url)
|
|
219
220
|
}
|
|
220
221
|
|
|
222
|
+
// Whatever comes back is printed the way the rest of the CLI prints errors:
|
|
223
|
+
// a deliberate error as its message, anything unexpected with its stack, and
|
|
224
|
+
// either with a stack under --verbose / PIKKU_DEBUG.
|
|
225
|
+
const reportFatal = (error: unknown): void => {
|
|
226
|
+
// stderr is asynchronous when it is a pipe, so exiting on the next line can
|
|
227
|
+
// truncate the diagnostic. Exit from the write callback, with exitCode set
|
|
228
|
+
// first in case the stream is already gone and the callback never fires.
|
|
229
|
+
process.exitCode = 1
|
|
230
|
+
process.stderr.write(
|
|
231
|
+
formatCLIError(error, { verbose: wantsStackTrace(process.argv.slice(2)) }) + '\\n',
|
|
232
|
+
() => process.exit(1)
|
|
233
|
+
)
|
|
234
|
+
}
|
|
235
|
+
process.on('uncaughtException', reportFatal)
|
|
236
|
+
process.on('unhandledRejection', reportFatal)
|
|
237
|
+
|
|
221
238
|
${capitalizedName}CLIClient(ws, process.argv.slice(2))
|
|
222
239
|
.then((exitCode) => process.exit(exitCode))
|
|
223
|
-
.catch(
|
|
224
|
-
console.error('Fatal channel CLI error:', error)
|
|
225
|
-
process.exit(1)
|
|
226
|
-
})
|
|
240
|
+
.catch(reportFatal)
|
|
227
241
|
}
|
|
228
242
|
`;
|
|
229
243
|
}
|
|
@@ -14,7 +14,7 @@ export function serializeLocalCLIBootstrap(programName, _programMeta, bootstrapF
|
|
|
14
14
|
: null;
|
|
15
15
|
const cliBootstrapPath = getFileImportRelativePath(bootstrapFile, config.bootstrapFile, config.packageMappings);
|
|
16
16
|
return `
|
|
17
|
-
import { executeCLI, CLIError } from '@pikku/core/cli'
|
|
17
|
+
import { executeCLI, CLIError, formatCLIError, wantsStackTrace } from '@pikku/core/cli'
|
|
18
18
|
${pikkuConfigFactory ? `import { ${pikkuConfigFactory.variable} as createConfig } from '${pikkuConfigPath}'` : ''}
|
|
19
19
|
import { ${singletonServicesFactory.variable} as createSingletonServices } from '${singletonServicesPath}'
|
|
20
20
|
${wireServicesFactory ? `import { ${wireServicesFactory.variable} as createWireServices } from '${wireServicesPath}'` : ''}
|
|
@@ -44,10 +44,21 @@ export default ${capitalizedName}CLI
|
|
|
44
44
|
${DIRECT_EXECUTION_GUARD}
|
|
45
45
|
|
|
46
46
|
if (isDirectExecution) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
process.exit(
|
|
50
|
-
|
|
47
|
+
const reportFatal = (error: unknown): void => {
|
|
48
|
+
// executeCLI already printed a CLIError; it carries the exit code, not text.
|
|
49
|
+
if (error instanceof CLIError) process.exit(error.exitCode)
|
|
50
|
+
// stderr is asynchronous when it is a pipe, so exiting on the next line can
|
|
51
|
+
// truncate the diagnostic. Exit from the write callback, with exitCode set
|
|
52
|
+
// first in case the stream is already gone and the callback never fires.
|
|
53
|
+
process.exitCode = 1
|
|
54
|
+
process.stderr.write(
|
|
55
|
+
formatCLIError(error, { verbose: wantsStackTrace(process.argv.slice(2)) }) + '\\n',
|
|
56
|
+
() => process.exit(1)
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
process.on('uncaughtException', reportFatal)
|
|
60
|
+
process.on('unhandledRejection', reportFatal)
|
|
61
|
+
${capitalizedName}CLI(process.argv.slice(2)).catch(reportFatal)
|
|
51
62
|
}
|
|
52
63
|
`;
|
|
53
64
|
}
|
|
@@ -5,6 +5,25 @@ import { checkRequiredTypes } from '../../../utils/check-required-types.js';
|
|
|
5
5
|
import { writeFileInDir } from '../../../utils/file-writer.js';
|
|
6
6
|
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js';
|
|
7
7
|
import { serializeAddonInstallTypes, serializeAddonTypes, } from './serialize-addon-types.js';
|
|
8
|
+
/**
|
|
9
|
+
* The functions each installed addon publishes, by package — what `mcp` on a
|
|
10
|
+
* `wireAddon` is typed against. A package wired twice contributes the same
|
|
11
|
+
* names under both namespaces, and a remote addon contributes none: its
|
|
12
|
+
* functions run on the host, and it is `wireRemoteAddon` that installs it.
|
|
13
|
+
*/
|
|
14
|
+
const addonFunctionNames = (state) => {
|
|
15
|
+
const names = {};
|
|
16
|
+
for (const [namespace, decl] of state.rpc.wireAddonDeclarations) {
|
|
17
|
+
if (decl.remote) {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
const meta = state.addonFunctions[namespace];
|
|
21
|
+
if (meta) {
|
|
22
|
+
names[decl.package] = Object.keys(meta);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return names;
|
|
26
|
+
};
|
|
8
27
|
export const pikkuAddonTypes = pikkuSessionlessFunc({
|
|
9
28
|
func: async ({ logger, config, getInspectorState }, input) => {
|
|
10
29
|
const { addonTypesFile, addonSetupTypesFile, packageMappings, servicesFile, secretsFile, credentialsFile, variablesFile, } = config;
|
|
@@ -15,14 +34,16 @@ export const pikkuAddonTypes = pikkuSessionlessFunc({
|
|
|
15
34
|
await rm(config.addon ? addonTypesFile : addonSetupTypesFile, {
|
|
16
35
|
force: true,
|
|
17
36
|
});
|
|
18
|
-
|
|
19
|
-
//
|
|
20
|
-
// on the bootstrap run
|
|
37
|
+
const bootstrap = input?.bootstrap === true;
|
|
38
|
+
// An application installs addons; an addon package declares itself. The app
|
|
39
|
+
// half is written on the bootstrap run too — `wireAddon` has to resolve
|
|
40
|
+
// before the inspector can read the calls that say which addons are
|
|
41
|
+
// installed — but only the full run knows what each addon publishes, so
|
|
42
|
+
// that is when `mcp` gets its names.
|
|
21
43
|
if (!config.addon) {
|
|
22
|
-
await writeFileInDir(logger, addonTypesFile, serializeAddonInstallTypes());
|
|
44
|
+
await writeFileInDir(logger, addonTypesFile, serializeAddonInstallTypes(bootstrap ? {} : addonFunctionNames(await getInspectorState())));
|
|
23
45
|
return;
|
|
24
46
|
}
|
|
25
|
-
const bootstrap = input?.bootstrap === true;
|
|
26
47
|
if (bootstrap) {
|
|
27
48
|
await writeFileInDir(logger, addonSetupTypesFile, 'export {}\n');
|
|
28
49
|
return;
|
|
@@ -10,5 +10,5 @@
|
|
|
10
10
|
* `#pikku/addon/<leaf>` — a depth at which an application has nothing to match,
|
|
11
11
|
* leaving the resolver to fall back to Node's per-package `imports`.
|
|
12
12
|
*/
|
|
13
|
-
export declare const serializeAddonInstallTypes: () => string;
|
|
13
|
+
export declare const serializeAddonInstallTypes: (addonFunctionNames?: Record<string, string[]>) => string;
|
|
14
14
|
export declare const serializeAddonTypes: (singletonServicesTypeImport: string, singletonServicesTypeName: string, configTypeImport: string, requiredServicesTypeImport: string, typedSecretServiceImport: string, typedVariablesServiceImport: string, typedCredentialServiceImport?: string | null) => string;
|
|
@@ -10,12 +10,57 @@
|
|
|
10
10
|
* `#pikku/addon/<leaf>` — a depth at which an application has nothing to match,
|
|
11
11
|
* leaving the resolver to fall back to Node's per-package `imports`.
|
|
12
12
|
*/
|
|
13
|
-
export const serializeAddonInstallTypes = () =>
|
|
13
|
+
export const serializeAddonInstallTypes = (addonFunctionNames = {}) => {
|
|
14
|
+
const packages = Object.entries(addonFunctionNames).filter(([, names]) => names.length > 0);
|
|
15
|
+
// Nothing installed yet — the bootstrap run writes this before any addon's
|
|
16
|
+
// metadata has been read, and a project with no addons never gets more.
|
|
17
|
+
if (packages.length === 0) {
|
|
18
|
+
return `/**
|
|
14
19
|
* Installing an addon into this application
|
|
15
20
|
*/
|
|
16
21
|
|
|
17
22
|
export { wireAddon, wireRemoteAddon } from '@pikku/core/addon'
|
|
18
23
|
`;
|
|
24
|
+
}
|
|
25
|
+
const entries = packages
|
|
26
|
+
.map(([pkg, names]) => ` ${JSON.stringify(pkg)}: ${names
|
|
27
|
+
.map((name) => JSON.stringify(name))
|
|
28
|
+
.join(' | ')}`)
|
|
29
|
+
.join('\n');
|
|
30
|
+
return `/**
|
|
31
|
+
* Installing an addon into this application
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
import { wireAddon as wireAddonCore } from '@pikku/core/addon'
|
|
35
|
+
import type { WireAddonConfig } from '@pikku/core/addon'
|
|
36
|
+
|
|
37
|
+
export { wireRemoteAddon } from '@pikku/core/addon'
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The functions each installed addon publishes. \`mcp\` names them.
|
|
41
|
+
*/
|
|
42
|
+
type AddonFunctions = {
|
|
43
|
+
${entries}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
type AddonFunctionName<Package extends string> =
|
|
47
|
+
Package extends keyof AddonFunctions ? AddonFunctions[Package] : string
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Installs an addon into this project: its functions, wirings and scopes become
|
|
51
|
+
* part of the app, under the namespace and options given here.
|
|
52
|
+
*
|
|
53
|
+
* \`mcp: true\` offers every function the addon itself declared as a tool; a list
|
|
54
|
+
* names the functions to offer, checked against the ones the addon publishes.
|
|
55
|
+
*/
|
|
56
|
+
export const wireAddon = <Package extends string>(
|
|
57
|
+
config: Omit<WireAddonConfig, 'package' | 'mcp'> & {
|
|
58
|
+
package: Package
|
|
59
|
+
mcp?: boolean | AddonFunctionName<Package>[]
|
|
60
|
+
}
|
|
61
|
+
): void => wireAddonCore(config)
|
|
62
|
+
`;
|
|
63
|
+
};
|
|
19
64
|
export const serializeAddonTypes = (singletonServicesTypeImport, singletonServicesTypeName, configTypeImport, requiredServicesTypeImport, typedSecretServiceImport, typedVariablesServiceImport, typedCredentialServiceImport = null) => {
|
|
20
65
|
return `/**
|
|
21
66
|
* Addon package types for pikkuAddonConfig and pikkuAddonServices
|
|
@@ -44,7 +44,9 @@ const generateArgumentsFromSchema = async (inputSchema, schemaDirectory, typesMa
|
|
|
44
44
|
}
|
|
45
45
|
catch (e) {
|
|
46
46
|
logger.warn(`Command MCP: Could not load schema for type: ${uniqueName} from ${schemaPath}`);
|
|
47
|
-
|
|
47
|
+
// The warning above is the actionable half; the cause is detail, and detail
|
|
48
|
+
// belongs behind the verbosity control rather than on everyone's stderr.
|
|
49
|
+
logger.debug(e instanceof Error ? (e.stack ?? e.message) : String(e));
|
|
48
50
|
return [];
|
|
49
51
|
}
|
|
50
52
|
};
|
|
@@ -13,10 +13,22 @@ export const pikkuMiddleware = pikkuSessionlessFunc({
|
|
|
13
13
|
const hasDefinitions = Object.keys(state.middleware.definitions).length > 0;
|
|
14
14
|
const hasChannelMiddleware = state.channelMiddleware.tagMiddleware.size > 0 ||
|
|
15
15
|
Object.keys(state.channelMiddleware.definitions).length > 0;
|
|
16
|
+
// A project whose only middleware is `addGlobalMiddleware([...])` over
|
|
17
|
+
// middleware defined in a package (a session bridge, say) has no group and
|
|
18
|
+
// no local definition, and used to generate no middleware file at all — so
|
|
19
|
+
// the registration never ran.
|
|
20
|
+
// `globalFiles` is the current record, but the serializer also still reads
|
|
21
|
+
// `global:*` out of `instances` so that a state serialized by an older
|
|
22
|
+
// inspector keeps working. This gate decides whether the serializer runs at
|
|
23
|
+
// all, so it has to accept exactly what the serializer accepts — otherwise
|
|
24
|
+
// an older state is dropped here and the file it needed is never written.
|
|
25
|
+
const hasGlobalMiddleware = (state.middleware.globalFiles?.size ?? 0) > 0 ||
|
|
26
|
+
Object.keys(state.middleware.instances).some((id) => id.startsWith('global:'));
|
|
16
27
|
if (hasHTTPGroups ||
|
|
17
28
|
hasTagGroups ||
|
|
18
29
|
hasDefinitions ||
|
|
19
|
-
hasChannelMiddleware
|
|
30
|
+
hasChannelMiddleware ||
|
|
31
|
+
hasGlobalMiddleware) {
|
|
20
32
|
const metaData = state.middlewareGroupsMeta;
|
|
21
33
|
await writeFileInDir(logger, config.middlewareGroupsMetaJsonFile, JSON.stringify(metaData, null, 2));
|
|
22
34
|
await writeFileInDir(logger, middlewareFile, serializeMiddlewareImports(middlewareFile, middleware, state.http, packageMappings, state));
|
|
@@ -1,2 +1,15 @@
|
|
|
1
1
|
import type { InspectorMiddlewareState, InspectorHTTPState, InspectorState } from '@pikku/inspector';
|
|
2
2
|
export declare const serializeMiddlewareImports: (outputPath: string, middlewareState: InspectorMiddlewareState, httpState: InspectorHTTPState, packageMappings?: Record<string, string>, fullState?: InspectorState) => string;
|
|
3
|
+
/**
|
|
4
|
+
* Fail the build if a file that calls `addGlobalMiddleware` has no side-effect
|
|
5
|
+
* import in the generated middleware file.
|
|
6
|
+
*
|
|
7
|
+
* Auth commonly lives in global middleware, and a deployed unit that misses its
|
|
8
|
+
* import does not fail to build — it serves every authenticated route a 401
|
|
9
|
+
* with a clean build log. Checking the emitted text (rather than the set it was
|
|
10
|
+
* built from) is what makes this a check and not a restatement: it fails if the
|
|
11
|
+
* emit is ever dropped, put behind a condition, or handed a path the import
|
|
12
|
+
* list does not actually carry. It cannot fire on a build that does emit the
|
|
13
|
+
* import.
|
|
14
|
+
*/
|
|
15
|
+
export declare const assertGlobalMiddlewareImported: (outputPath: string, output: string, globalImportPaths: Map<string, string>) => void;
|
|
@@ -54,21 +54,34 @@ export const serializeMiddlewareImports = (outputPath, middlewareState, httpStat
|
|
|
54
54
|
// Global middleware (addGlobalMiddleware) is registered by a top-level call
|
|
55
55
|
// at module evaluation, so a side-effect import of its source file runs the
|
|
56
56
|
// registration. Unlike tag/http middleware it has no associated wire group —
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
//
|
|
62
|
-
// in
|
|
57
|
+
// the inspector records it as a source file in `globalFiles` (and as
|
|
58
|
+
// `global:*` entries in `instances`) — so the per-unit `--names` filter
|
|
59
|
+
// leaves it out of every deployed unit (the `state.http.files` fallback that
|
|
60
|
+
// add-middleware adds gets stripped by that filter). Emitting it here, into
|
|
61
|
+
// the always-bootstrap-imported pikku-middleware.gen.ts, guarantees global
|
|
62
|
+
// middleware registers in every unit. A duplicate import in full builds is
|
|
63
|
+
// harmless — module bodies evaluate once.
|
|
63
64
|
//
|
|
64
65
|
// `isFactoryCall` is not consulted: it distinguishes `mw()` from `mw` as an
|
|
65
66
|
// array element, not a deferred registration behind an exported factory, and
|
|
66
67
|
// addGlobalMiddleware registers at module evaluation under either form.
|
|
68
|
+
//
|
|
69
|
+
// `globalFiles` is the primary source: it is a plain set of file names, where
|
|
70
|
+
// `instances` is a map whose keys an unrelated registration could once
|
|
71
|
+
// collide with. The `global:*` sweep stays as well, so a state serialized by
|
|
72
|
+
// an older inspector (no `globalFiles`) still emits its imports.
|
|
73
|
+
const globalSourceFiles = new Set(middlewareState.globalFiles ?? []);
|
|
67
74
|
for (const [instanceId, instance] of Object.entries(middlewareState.instances)) {
|
|
68
75
|
if (instanceId.startsWith('global:')) {
|
|
69
|
-
|
|
76
|
+
globalSourceFiles.add(instance.sourceFile);
|
|
70
77
|
}
|
|
71
78
|
}
|
|
79
|
+
const globalImportPaths = new Map();
|
|
80
|
+
for (const sourceFile of globalSourceFiles) {
|
|
81
|
+
const filePath = getFileImportRelativePath(outputPath, sourceFile, packageMappings);
|
|
82
|
+
globalImportPaths.set(sourceFile, filePath);
|
|
83
|
+
directImports.add(filePath);
|
|
84
|
+
}
|
|
72
85
|
const allFactories = new Map([
|
|
73
86
|
...httpFactories,
|
|
74
87
|
...tagFactories,
|
|
@@ -90,5 +103,32 @@ export const serializeMiddlewareImports = (outputPath, middlewareState, httpStat
|
|
|
90
103
|
serializedFactoryCalls.push(`${exportName}()`);
|
|
91
104
|
}
|
|
92
105
|
}
|
|
93
|
-
|
|
106
|
+
const output = [...serializedImports, ...serializedFactoryCalls].join('\n');
|
|
107
|
+
assertGlobalMiddlewareImported(outputPath, output, globalImportPaths);
|
|
108
|
+
return output;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Fail the build if a file that calls `addGlobalMiddleware` has no side-effect
|
|
112
|
+
* import in the generated middleware file.
|
|
113
|
+
*
|
|
114
|
+
* Auth commonly lives in global middleware, and a deployed unit that misses its
|
|
115
|
+
* import does not fail to build — it serves every authenticated route a 401
|
|
116
|
+
* with a clean build log. Checking the emitted text (rather than the set it was
|
|
117
|
+
* built from) is what makes this a check and not a restatement: it fails if the
|
|
118
|
+
* emit is ever dropped, put behind a condition, or handed a path the import
|
|
119
|
+
* list does not actually carry. It cannot fire on a build that does emit the
|
|
120
|
+
* import.
|
|
121
|
+
*/
|
|
122
|
+
export const assertGlobalMiddlewareImported = (outputPath, output, globalImportPaths) => {
|
|
123
|
+
const missing = [...globalImportPaths.entries()].filter(([, filePath]) => !output.includes(`import '${filePath}'`));
|
|
124
|
+
if (missing.length === 0) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
throw new Error(`Global middleware would not be registered in ${outputPath}.\n` +
|
|
128
|
+
`These files call addGlobalMiddleware() but no side-effect import for them was emitted:\n` +
|
|
129
|
+
missing.map(([sourceFile]) => ` - ${sourceFile}`).join('\n') +
|
|
130
|
+
`\n\nGlobal middleware — auth gates included — only runs if its module is imported, so ` +
|
|
131
|
+
`this build would start up with it silently missing. Re-run \`pikku all\`; if it persists, ` +
|
|
132
|
+
`register the middleware from a file that also makes a wire registration ` +
|
|
133
|
+
`(e.g. addHTTPMiddleware) and report this as a pikku bug.`);
|
|
94
134
|
};
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import { PikkuError } from '@pikku/core/errors';
|
|
1
2
|
/**
|
|
2
|
-
* A config that was found and parsed, but says something impossible
|
|
3
|
+
* A config that was found and parsed, but says something impossible — or one
|
|
4
|
+
* that could not be found at all.
|
|
3
5
|
*
|
|
4
6
|
* Its message reaches the developer verbatim — every other error out of the
|
|
5
7
|
* loader is reported as "failed to load", which sends the reader hunting for a
|
|
6
|
-
* broken file rather than the line that is wrong.
|
|
8
|
+
* broken file rather than the line that is wrong. A `PikkuError`, so the CLI
|
|
9
|
+
* prints that message alone: a stack through the config loader is never the
|
|
10
|
+
* answer to "which line of my config is wrong", and `--verbose` / `PIKKU_DEBUG`
|
|
11
|
+
* still shows it for the times it is.
|
|
7
12
|
*/
|
|
8
|
-
export declare class PikkuCLIConfigError extends
|
|
13
|
+
export declare class PikkuCLIConfigError extends PikkuError {
|
|
9
14
|
}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import { PikkuError } from '@pikku/core/errors';
|
|
1
2
|
/**
|
|
2
|
-
* A config that was found and parsed, but says something impossible
|
|
3
|
+
* A config that was found and parsed, but says something impossible — or one
|
|
4
|
+
* that could not be found at all.
|
|
3
5
|
*
|
|
4
6
|
* Its message reaches the developer verbatim — every other error out of the
|
|
5
7
|
* loader is reported as "failed to load", which sends the reader hunting for a
|
|
6
|
-
* broken file rather than the line that is wrong.
|
|
8
|
+
* broken file rather than the line that is wrong. A `PikkuError`, so the CLI
|
|
9
|
+
* prints that message alone: a stack through the config loader is never the
|
|
10
|
+
* answer to "which line of my config is wrong", and `--verbose` / `PIKKU_DEBUG`
|
|
11
|
+
* still shows it for the times it is.
|
|
7
12
|
*/
|
|
8
|
-
export class PikkuCLIConfigError extends
|
|
13
|
+
export class PikkuCLIConfigError extends PikkuError {
|
|
9
14
|
}
|
|
@@ -56,7 +56,7 @@ async function findConfigFileOrNull() {
|
|
|
56
56
|
async function findConfigFile() {
|
|
57
57
|
const configFile = await findConfigFileOrNull();
|
|
58
58
|
if (!configFile) {
|
|
59
|
-
throw new
|
|
59
|
+
throw new PikkuCLIConfigError('No Pikku config file (pikku.config.ts, .js or .json) found in this directory or any parent up to the repository root.\nRun this from inside a pikku project, or create one with `pikku init`.');
|
|
60
60
|
}
|
|
61
61
|
return configFile;
|
|
62
62
|
}
|