@pikku/cli 0.12.162 → 0.12.163
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-DR6oJReA.js → HelpPanel-C__s-OXa.js} +1 -1
- package/console-app/assets/{abnfDiagram-VCTEODGH-C6mt0F-I.js → abnfDiagram-VCTEODGH-DLIFOOvF.js} +1 -1
- package/console-app/assets/architecture-7GRP2DOG-C3aOtis2.js +1 -0
- package/console-app/assets/{architectureDiagram-5GKGNRK7-BPUTuzrJ.js → architectureDiagram-5GKGNRK7-DTilS9zr.js} +1 -1
- package/console-app/assets/{blockDiagram-I7D4REHJ-IE8X3BZC.js → blockDiagram-I7D4REHJ-CCTMqaSo.js} +1 -1
- package/console-app/assets/{c4Diagram-7LVT6UL2--HhbjXSJ.js → c4Diagram-7LVT6UL2-HTxceuVS.js} +1 -1
- package/console-app/assets/channel-C9rJmzgz.js +1 -0
- package/console-app/assets/{chunk-4HAMMTFA-B2Cljp_-.js → chunk-4HAMMTFA-CB4W3eSt.js} +1 -1
- package/console-app/assets/{chunk-75Z2AOVW-D4684ofZ.js → chunk-75Z2AOVW-C9TP1VXB.js} +1 -1
- package/console-app/assets/{chunk-DU6HZSFF-BXipkMhY.js → chunk-DU6HZSFF-84ww5mPe.js} +1 -1
- package/console-app/assets/{chunk-F27PBJKO-BsSS2TqC.js → chunk-F27PBJKO-B6nEGqlt.js} +1 -1
- package/console-app/assets/{chunk-GMAD6QVW-DJqDw8yU.js → chunk-GMAD6QVW-SJ1Qwv1p.js} +1 -1
- package/console-app/assets/{chunk-GVQU2GXP-CguL9TtP.js → chunk-GVQU2GXP-CpvfZAir.js} +1 -1
- package/console-app/assets/{chunk-IMKFNOWR-DoB5kv29.js → chunk-IMKFNOWR-CdZpInOk.js} +1 -1
- package/console-app/assets/{chunk-L3NEJ4N5-BspKBmrG.js → chunk-L3NEJ4N5-DDwTgcch.js} +1 -1
- package/console-app/assets/{chunk-OSK3NFVY-DzLs9ozF.js → chunk-OSK3NFVY-Ce8laAeV.js} +1 -1
- package/console-app/assets/{chunk-P2QGCYS3-DAxcyv2x.js → chunk-P2QGCYS3-CfBNms3b.js} +1 -1
- package/console-app/assets/{chunk-POPQ4Y6H-DyLFn-sn.js → chunk-POPQ4Y6H-BZI0KZav.js} +1 -1
- package/console-app/assets/{chunk-PWAF6VOD-VPwoG6QJ.js → chunk-PWAF6VOD-Car_F-5i.js} +1 -1
- package/console-app/assets/{chunk-SHT3W25Y-C0R9Ptyj.js → chunk-SHT3W25Y-B7o3qSVw.js} +1 -1
- package/console-app/assets/{chunk-SVP7TREG-cLgcNTyh.js → chunk-SVP7TREG-8bi0TugS.js} +1 -1
- package/console-app/assets/{chunk-TICWLB2K-C3se3Npx.js → chunk-TICWLB2K-BT94BHEH.js} +1 -1
- package/console-app/assets/chunk-XXDRQBXY-CN-XariJ.js +1 -0
- package/console-app/assets/classDiagram-ZZMXUADV-C-G692c4.js +1 -0
- package/console-app/assets/classDiagram-v2-VYDZK3BY-C-G692c4.js +1 -0
- package/console-app/assets/{cose-bilkent-JH36ORCC-L5Nhs9N1.js → cose-bilkent-JH36ORCC-Bpn1bn9K.js} +1 -1
- package/console-app/assets/{cynefin-OW5HDTMX-jbgNKIs_.js → cynefin-OW5HDTMX-CfFkO8xq.js} +1 -1
- package/console-app/assets/{cynefinDiagram-5FMLGOSQ-D10NQDH4.js → cynefinDiagram-5FMLGOSQ-E66AVAFL.js} +1 -1
- package/console-app/assets/{dagre-DrsKN-Kd.js → dagre-54kLhRyV.js} +1 -1
- package/console-app/assets/{dagre-GXQ25YYZ-NDp4fO1z.js → dagre-GXQ25YYZ-D4En0mXW.js} +1 -1
- package/console-app/assets/{diagram-S7CK7UJ4-B-9PMbK8.js → diagram-S7CK7UJ4-DhFYC_I5.js} +1 -1
- package/console-app/assets/{diagram-UQ7AKVKN-NXSn7aYB.js → diagram-UQ7AKVKN-QV1teZ2Z.js} +1 -1
- package/console-app/assets/{diagram-VSXAHHWV-DrZgXRIZ.js → diagram-VSXAHHWV-CTZbzeS4.js} +1 -1
- package/console-app/assets/{diagram-VX7I27RA-V3OLFF3v.js → diagram-VX7I27RA-BFoMlx0h.js} +1 -1
- package/console-app/assets/{diagram-Z3DM3KII-CawCD3BR.js → diagram-Z3DM3KII-DXYj_9Q8.js} +1 -1
- package/console-app/assets/{ebnfDiagram-PWID7BFC-QScQWlzV.js → ebnfDiagram-PWID7BFC-C7TLD6M3.js} +1 -1
- package/console-app/assets/{erDiagram-RLTQ6QDP-DIhmCYb6.js → erDiagram-RLTQ6QDP-hPkM-ewN.js} +1 -1
- package/console-app/assets/eventmodeling-NTZA5JFV-U-EsOY6h.js +1 -0
- package/console-app/assets/flowDiagram-HODETNUW-LmjHrpKd.js +1 -0
- package/console-app/assets/{ganttDiagram-EL5Y4UJY-Bcg0H_3-.js → ganttDiagram-EL5Y4UJY-B6TmOQZX.js} +1 -1
- package/console-app/assets/{gitGraph-4MIJSDKK-BUYXp4LH.js → gitGraph-4MIJSDKK-BwbHr20B.js} +1 -1
- package/console-app/assets/{gitGraphDiagram-WWUBYQGX-DRxwgliX.js → gitGraphDiagram-WWUBYQGX-Dl1TcmWc.js} +1 -1
- package/console-app/assets/{graphlib-BXZn3TnO.js → graphlib-DHZpPJUN.js} +1 -1
- package/console-app/assets/{index-D7ATEpJh.js → index-BzStIuLU.js} +137 -137
- package/console-app/assets/{info-A6RAGUB7-BAfA_BVB.js → info-A6RAGUB7-D708VGlV.js} +1 -1
- package/console-app/assets/{infoDiagram-27XIBGKW-JPbCbDjB.js → infoDiagram-27XIBGKW-UHD7ySe3.js} +1 -1
- package/console-app/assets/{ishikawaDiagram-5VMMS53U-528xNFds.js → ishikawaDiagram-5VMMS53U-GyFZr765.js} +1 -1
- package/console-app/assets/{journeyDiagram-3NMN7TZE-CpnC76my.js → journeyDiagram-3NMN7TZE-CoewHpEg.js} +1 -1
- package/console-app/assets/{kanban-definition-UXKFOSKX-7v_OexVf.js → kanban-definition-UXKFOSKX-F0W6Aec5.js} +1 -1
- package/console-app/assets/{line-BXTtRzTv.js → line-C4wYKh6f.js} +1 -1
- package/console-app/assets/{linear-BXIxFuy8.js → linear-nPQacEjt.js} +1 -1
- package/console-app/assets/{mermaid-parser.core-Bn81UzgU.js → mermaid-parser.core-BVBt0Hmw.js} +3 -3
- package/console-app/assets/{mermaid.core-CShTFU_y.js → mermaid.core-BMrHbMBm.js} +4 -4
- package/console-app/assets/{mindmap-definition-YA3MSWOX-Dozk2qNE.js → mindmap-definition-YA3MSWOX-Dhdn4hmh.js} +1 -1
- package/console-app/assets/{packet-AYTQ26CC-CQ1T9gCW.js → packet-AYTQ26CC-CleVGuC-.js} +1 -1
- package/console-app/assets/{pegDiagram-XKGWAZYB-CAKNYwkF.js → pegDiagram-XKGWAZYB-NDJ5URs9.js} +1 -1
- package/console-app/assets/{pie-WAS4IAKB-XBhMekP0.js → pie-WAS4IAKB-DCgq6z8V.js} +1 -1
- package/console-app/assets/{pieDiagram-E7YTZNPT-CQH9g9Im.js → pieDiagram-E7YTZNPT-BPo__c-e.js} +1 -1
- package/console-app/assets/{quadrantDiagram-AXDQQJYC-BYry9NEL.js → quadrantDiagram-AXDQQJYC-C6AlGJWn.js} +1 -1
- package/console-app/assets/{radar-RG4KPBEZ-BHk3GM2h.js → radar-RG4KPBEZ-iKELPo6S.js} +1 -1
- package/console-app/assets/{railroad-74A4TZTK-B-GsJq3u.js → railroad-74A4TZTK-D7o-4Y2z.js} +1 -1
- package/console-app/assets/railroad-abnf-HS5TGJTU-SJ0ZNV52.js +1 -0
- package/console-app/assets/railroad-ebnf-LZEXJU2U-CoxgM6s2.js +1 -0
- package/console-app/assets/railroad-peg-WCYAUIDC-Dt1jr0ie.js +1 -0
- package/console-app/assets/{railroadDiagram-O6MQD6OU-CAIv58C8.js → railroadDiagram-O6MQD6OU-Bxb416Ip.js} +1 -1
- package/console-app/assets/{requirementDiagram-BXWQKSXE-DJ3f5870.js → requirementDiagram-BXWQKSXE-wpPz84xe.js} +1 -1
- package/console-app/assets/{sankeyDiagram-P5KCCOFB-YrQnQsb7.js → sankeyDiagram-P5KCCOFB-DCtqI-U8.js} +1 -1
- package/console-app/assets/{sequenceDiagram-WJ2MYXX4-B-tyzF2R.js → sequenceDiagram-WJ2MYXX4-B9qErfQU.js} +1 -1
- package/console-app/assets/{src-DV6LWVlf.js → src-CrUEtLgb.js} +1 -1
- package/console-app/assets/{stateDiagram-D77RDMKH-vMePRkxV.js → stateDiagram-D77RDMKH-DVQO4UZZ.js} +1 -1
- package/console-app/assets/stateDiagram-v2-MP3YSRHH-qOQfgOOB.js +1 -0
- package/console-app/assets/{swimlanes-42K2YHIH-CqQsTH0R.js → swimlanes-42K2YHIH-CfBqlUg-.js} +1 -1
- package/console-app/assets/swimlanesDiagram-VR7AAH4N-D6fTU5Cq.js +8 -0
- package/console-app/assets/{timeline-definition-24CTP7MA-D3OGq7c8.js → timeline-definition-24CTP7MA-CPFn_B-h.js} +1 -1
- package/console-app/assets/{treeView-Q6P3EWNA-DZA143I6.js → treeView-Q6P3EWNA-CVWAH-EI.js} +1 -1
- package/console-app/assets/{treemap-WGGIJYW6-N5Dr2J8o.js → treemap-WGGIJYW6-DEBgfaYx.js} +1 -1
- package/console-app/assets/{vennDiagram-4TSXK5OY-CjQrrdPE.js → vennDiagram-4TSXK5OY-BA4GGrwY.js} +1 -1
- package/console-app/assets/{wardley-WFR3VGLG-CWrUebhA.js → wardley-WFR3VGLG-TajUo-aF.js} +1 -1
- package/console-app/assets/{wardleyDiagram-VM6X3IG4-Bd-nerY3.js → wardleyDiagram-VM6X3IG4-Bd1y8DdK.js} +1 -1
- package/console-app/assets/{xychartDiagram-S5SC5T6Z-CK3-JaeF.js → xychartDiagram-S5SC5T6Z-CWQmkOFg.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 +1 -1
- 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-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 +20 -2
- 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 +1 -1
- 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 +14 -14
- 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/schemas/schemas/KnowledgePlanProgressOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/KnowledgePlanSetOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/KnowledgePlanShowOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuNewAddonInput.schema.json +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/src/cli.wiring.js +20 -2
- package/dist/src/functions/commands/dev-credentials.d.ts +18 -0
- package/dist/src/functions/commands/dev-credentials.js +59 -0
- package/dist/src/functions/commands/dev.js +11 -2
- package/dist/src/functions/commands/install-addon.d.ts +45 -0
- package/dist/src/functions/commands/install-addon.js +225 -0
- package/dist/src/functions/commands/knowledge-plan.d.ts +9 -0
- package/dist/src/functions/commands/knowledge-plan.js +13 -3
- package/dist/src/functions/commands/new-addon.d.ts +47 -1
- package/dist/src/functions/commands/new-addon.js +284 -106
- package/dist/src/functions/db/better-auth-schema.d.ts +1 -0
- package/dist/src/functions/db/better-auth-schema.js +75 -2
- package/dist/src/functions/db/ensure-db-types.d.ts +12 -0
- package/dist/src/functions/db/ensure-db-types.js +29 -0
- package/dist/src/functions/knowledge/console-url.d.ts +13 -0
- package/dist/src/functions/knowledge/console-url.js +18 -0
- package/dist/src/functions/knowledge/render.d.ts +7 -3
- package/dist/src/functions/knowledge/render.js +10 -3
- package/dist/src/functions/knowledge/schemas.d.ts +3 -0
- package/dist/src/functions/knowledge/schemas.js +4 -3
- package/dist/src/functions/wirings/rpc/serialize-react-query-hooks.js +6 -0
- package/dist/src/functions/workflows/all.workflow.js +7 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/surface.json +31 -1
- package/console-app/assets/architecture-7GRP2DOG-C3gcY2os.js +0 -1
- package/console-app/assets/channel-CGrTWPVh.js +0 -1
- package/console-app/assets/chunk-XXDRQBXY-DLdC0jYP.js +0 -1
- package/console-app/assets/classDiagram-ZZMXUADV-yt7BCzQS.js +0 -1
- package/console-app/assets/classDiagram-v2-VYDZK3BY-yt7BCzQS.js +0 -1
- package/console-app/assets/eventmodeling-NTZA5JFV-BbwPCOs2.js +0 -1
- package/console-app/assets/flowDiagram-HODETNUW-B-xUNJdv.js +0 -1
- package/console-app/assets/railroad-abnf-HS5TGJTU-Dqco3Udm.js +0 -1
- package/console-app/assets/railroad-ebnf-LZEXJU2U-DZqyOzxq.js +0 -1
- package/console-app/assets/railroad-peg-WCYAUIDC-DtfiBwRd.js +0 -1
- package/console-app/assets/stateDiagram-v2-MP3YSRHH-Cojsq9SW.js +0 -1
- package/console-app/assets/swimlanesDiagram-VR7AAH4N-0DUuvodn.js +0 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was generated by @pikku/cli@0.12.
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.163
|
|
3
3
|
*/
|
|
4
4
|
import { WorkflowCancelledException } from '@pikku/core/workflow';
|
|
5
5
|
import type { PikkuWorkflowGraphConfig, PikkuWorkflowGraphResult } from '@pikku/core/workflow';
|
package/dist/bin/pikku-bin.mjs
CHANGED
|
@@ -11,8 +11,8 @@ async function checkForUpdate() {
|
|
|
11
11
|
})
|
|
12
12
|
if (!res.ok) return
|
|
13
13
|
const { version: latest } = await res.json()
|
|
14
|
-
if (latest !== '0.12.
|
|
15
|
-
process.stderr.write(`\n Update available 0.12.
|
|
14
|
+
if (latest !== '0.12.163') {
|
|
15
|
+
process.stderr.write(`\n Update available 0.12.163 → ${latest}\n brew upgrade pikku or npm install -g @pikku/cli\n\n`)
|
|
16
16
|
}
|
|
17
17
|
} catch {}
|
|
18
18
|
}
|
package/dist/src/cli.wiring.js
CHANGED
|
@@ -958,14 +958,32 @@ wireCLI({
|
|
|
958
958
|
default: false,
|
|
959
959
|
},
|
|
960
960
|
credential: {
|
|
961
|
-
description: '
|
|
961
|
+
description: 'Per-user credential type (apikey, bearer, basic, or oauth2); with --openapi it defaults to what the spec declares',
|
|
962
|
+
},
|
|
963
|
+
auth: {
|
|
964
|
+
description: 'With --openapi: user (default — each user connects their own credential), shared (one secret behind every user), or none (public API)',
|
|
962
965
|
},
|
|
963
966
|
test: {
|
|
964
967
|
description: 'Include test harness (default: true)',
|
|
965
968
|
default: true,
|
|
966
969
|
},
|
|
967
970
|
openapi: {
|
|
968
|
-
description: 'Path
|
|
971
|
+
description: 'Path or URL of an OpenAPI 3.x / Swagger 2.0 spec (YAML or JSON) to generate functions from',
|
|
972
|
+
},
|
|
973
|
+
openapiHeader: {
|
|
974
|
+
description: 'Header sent when fetching --openapi from a URL, as "Name: value" (repeatable), for specs published only to authenticated requests',
|
|
975
|
+
},
|
|
976
|
+
tags: {
|
|
977
|
+
description: 'With --openapi: keep only operations with these tags',
|
|
978
|
+
},
|
|
979
|
+
include: {
|
|
980
|
+
description: 'With --openapi: keep only operations matching these globs (operationId, /path or "METHOD /path")',
|
|
981
|
+
},
|
|
982
|
+
exclude: {
|
|
983
|
+
description: 'With --openapi: drop operations matching these globs (operationId, /path or "METHOD /path")',
|
|
984
|
+
},
|
|
985
|
+
install: {
|
|
986
|
+
description: 'With --openapi inside an app: add the addon to the app — dependencies, wireAddon, auth wiring, base URL (default: on inside an app)',
|
|
969
987
|
},
|
|
970
988
|
authConfig: {
|
|
971
989
|
description: 'Path to an auth-config JSON overriding the spec (custom auth header, delegated login)',
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type CredentialService, type Logger } from '@pikku/core/services';
|
|
2
|
+
export declare const DEV_CREDENTIALS_KEY_ENV = "PIKKU_DEV_CREDENTIALS_KEY";
|
|
3
|
+
/**
|
|
4
|
+
* The key the dev server encrypts stored credentials with. It must outlive the
|
|
5
|
+
* process, or every credential written before a restart becomes unreadable
|
|
6
|
+
* while the session that owns it stays valid.
|
|
7
|
+
*/
|
|
8
|
+
export declare const resolveDevCredentialsKey: (runtimeDir: string, env?: NodeJS.ProcessEnv) => string;
|
|
9
|
+
/**
|
|
10
|
+
* A credential store that survives `pikku dev` restarts when the project has a
|
|
11
|
+
* database with the credential tables, and the in-memory one otherwise.
|
|
12
|
+
*/
|
|
13
|
+
export declare const createDevCredentialService: ({ kysely, runtimeDir, logger, expectsCredentials, }: {
|
|
14
|
+
kysely: unknown;
|
|
15
|
+
runtimeDir: string;
|
|
16
|
+
logger: Logger;
|
|
17
|
+
expectsCredentials: boolean;
|
|
18
|
+
}) => Promise<CredentialService>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { randomBytes } from 'node:crypto';
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { KyselyCredentialService } from '@pikku/kysely';
|
|
5
|
+
import { LocalCredentialService, } from '@pikku/core/services';
|
|
6
|
+
export const DEV_CREDENTIALS_KEY_ENV = 'PIKKU_DEV_CREDENTIALS_KEY';
|
|
7
|
+
const KEY_FILE = 'dev-credentials.key';
|
|
8
|
+
/**
|
|
9
|
+
* The key the dev server encrypts stored credentials with. It must outlive the
|
|
10
|
+
* process, or every credential written before a restart becomes unreadable
|
|
11
|
+
* while the session that owns it stays valid.
|
|
12
|
+
*/
|
|
13
|
+
export const resolveDevCredentialsKey = (runtimeDir, env = process.env) => {
|
|
14
|
+
const fromEnv = env[DEV_CREDENTIALS_KEY_ENV]?.trim();
|
|
15
|
+
if (fromEnv)
|
|
16
|
+
return fromEnv;
|
|
17
|
+
const file = join(runtimeDir, KEY_FILE);
|
|
18
|
+
if (existsSync(file)) {
|
|
19
|
+
const stored = readFileSync(file, 'utf8').trim();
|
|
20
|
+
if (stored)
|
|
21
|
+
return stored;
|
|
22
|
+
}
|
|
23
|
+
const key = randomBytes(32).toString('base64');
|
|
24
|
+
mkdirSync(runtimeDir, { recursive: true });
|
|
25
|
+
try {
|
|
26
|
+
writeFileSync(file, `${key}\n`, {
|
|
27
|
+
encoding: 'utf8',
|
|
28
|
+
mode: 0o600,
|
|
29
|
+
flag: 'wx',
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
if (error.code !== 'EEXIST')
|
|
34
|
+
throw error;
|
|
35
|
+
return readFileSync(file, 'utf8').trim();
|
|
36
|
+
}
|
|
37
|
+
return key;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* A credential store that survives `pikku dev` restarts when the project has a
|
|
41
|
+
* database with the credential tables, and the in-memory one otherwise.
|
|
42
|
+
*/
|
|
43
|
+
export const createDevCredentialService = async ({ kysely, runtimeDir, logger, expectsCredentials, }) => {
|
|
44
|
+
if (!kysely)
|
|
45
|
+
return new LocalCredentialService();
|
|
46
|
+
const service = new KyselyCredentialService(kysely, {
|
|
47
|
+
key: resolveDevCredentialsKey(runtimeDir),
|
|
48
|
+
});
|
|
49
|
+
try {
|
|
50
|
+
await service.init();
|
|
51
|
+
return service;
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
if (expectsCredentials) {
|
|
55
|
+
logger.warn(`Stored credentials will not survive a restart: ${error instanceof Error ? error.message : String(error)}`);
|
|
56
|
+
}
|
|
57
|
+
return new LocalCredentialService();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
@@ -6,7 +6,7 @@ import { pikkuDevReloader, reloadGeneratedMeta, reconcileAddonRegistry, } from '
|
|
|
6
6
|
import { InMemoryQueueService, QueueWebhookService } from '@pikku/core/services';
|
|
7
7
|
import { flattenScopeDefinitions } from '@pikku/core/scope';
|
|
8
8
|
import { flattenSystemRoleDefinitions } from '@pikku/core/role';
|
|
9
|
-
import { ConsoleLogger, LocalEmailService,
|
|
9
|
+
import { ConsoleLogger, LocalEmailService, spy, InMemoryAgentRunStateService, } from '@pikku/core/services';
|
|
10
10
|
import { InMemoryTriggerService } from '@pikku/core/services';
|
|
11
11
|
import { InMemoryWorkflowService } from '@pikku/core/services';
|
|
12
12
|
import { KyselyAgentStorageService, KyselyAgentRunStateService, KyselyAgentRunService, KyselyAnalyticsService, KyselyFeatureFlagStore, KyselyScopeService, KyselyWebhookService, } from '@pikku/kysely';
|
|
@@ -19,6 +19,7 @@ import { InMemorySchedulerService } from '@pikku/schedule';
|
|
|
19
19
|
import { resolveDb, createKysely, parseDatabaseUrl, } from '../db/local-db.js';
|
|
20
20
|
import { loadUserBootstrap, loadUserModule } from './load-user-project.js';
|
|
21
21
|
import { initOrWarn } from './init-or-warn.js';
|
|
22
|
+
import { createDevCredentialService } from './dev-credentials.js';
|
|
22
23
|
import { registerScenarioInstrumentation } from '../wirings/scenarios/register-scenario-instrumentation.js';
|
|
23
24
|
import { startCoverageService } from './start-coverage.js';
|
|
24
25
|
import { resolveDevEnvironmentName } from './environment.js';
|
|
@@ -254,6 +255,14 @@ export const dev = pikkuSessionlessFunc({
|
|
|
254
255
|
if (devWebhookService instanceof KyselyWebhookService) {
|
|
255
256
|
await devWebhookService.init();
|
|
256
257
|
}
|
|
258
|
+
const credentialService = await createDevCredentialService({
|
|
259
|
+
kysely,
|
|
260
|
+
runtimeDir: resolvedRuntimeDir,
|
|
261
|
+
logger,
|
|
262
|
+
expectsCredentials: requiredServices.has('credentialService') ||
|
|
263
|
+
inspectorState.credentials.definitions.length > 0 ||
|
|
264
|
+
inspectorState.rpc.wireAddonDeclarations.size > 0,
|
|
265
|
+
});
|
|
257
266
|
const inMemoryServices = {
|
|
258
267
|
logger: devLogger,
|
|
259
268
|
...(agentRunner ? { agentRunner } : {}),
|
|
@@ -269,7 +278,7 @@ export const dev = pikkuSessionlessFunc({
|
|
|
269
278
|
workflowService,
|
|
270
279
|
workflowRunService: workflowService,
|
|
271
280
|
triggerService: new InMemoryTriggerService(),
|
|
272
|
-
credentialService
|
|
281
|
+
credentialService,
|
|
273
282
|
agentStorage,
|
|
274
283
|
agentRunState,
|
|
275
284
|
agentRunService,
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export type AddonAuthMode = 'delegated' | 'connect' | 'oauth2' | 'shared' | 'none';
|
|
2
|
+
export interface AddonInstall {
|
|
3
|
+
projectRoot: string;
|
|
4
|
+
srcDir: string;
|
|
5
|
+
name: string;
|
|
6
|
+
camelName: string;
|
|
7
|
+
pascalName: string;
|
|
8
|
+
screamingName: string;
|
|
9
|
+
packageName: string;
|
|
10
|
+
addonDir: string;
|
|
11
|
+
inWorkspace: boolean;
|
|
12
|
+
mode: AddonAuthMode;
|
|
13
|
+
/** Generated function file contents by function name. */
|
|
14
|
+
functions: Record<string, string>;
|
|
15
|
+
baseUrl?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface InstallResult {
|
|
18
|
+
written: string[];
|
|
19
|
+
notes: string[];
|
|
20
|
+
}
|
|
21
|
+
/** The package.json that owns `dir`, walking up to `stopAt`. */
|
|
22
|
+
export declare function owningPackageDir(dir: string, stopAt: string): string | undefined;
|
|
23
|
+
export declare function addDependency(packageJsonPath: string, packageName: string, version: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* What a signed-in user may call directly. Per-user modes expose every
|
|
26
|
+
* function, since the upstream enforces the user's own permissions; a shared
|
|
27
|
+
* secret acts with one identity for everyone, so only reads are exposed.
|
|
28
|
+
*/
|
|
29
|
+
export declare function exposedFunctions(install: AddonInstall): string[];
|
|
30
|
+
export declare function wireAddonFile(install: AddonInstall): string;
|
|
31
|
+
/**
|
|
32
|
+
* Wires the addon's auth into the app's Better Auth config: delegated sign-in
|
|
33
|
+
* against the upstream, and upstream credentials carried by scenario actors.
|
|
34
|
+
* Text edits, so each one is skipped (and reported) when its anchor is gone.
|
|
35
|
+
*/
|
|
36
|
+
export declare function wireAuth(source: string, install: AddonInstall): {
|
|
37
|
+
source: string;
|
|
38
|
+
notes: string[];
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Installs a freshly generated addon into the app it was generated in: the
|
|
42
|
+
* dependency on the root and functions packages, the wireAddon file, the auth
|
|
43
|
+
* wiring and the base-URL variable. The caller installs and builds after.
|
|
44
|
+
*/
|
|
45
|
+
export declare function installAddonIntoApp(install: AddonInstall): InstallResult;
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';
|
|
2
|
+
import { dirname, join, relative } from 'path';
|
|
3
|
+
/** The package.json that owns `dir`, walking up to `stopAt`. */
|
|
4
|
+
export function owningPackageDir(dir, stopAt) {
|
|
5
|
+
let current = dir;
|
|
6
|
+
while (current.startsWith(stopAt)) {
|
|
7
|
+
if (existsSync(join(current, 'package.json')))
|
|
8
|
+
return current;
|
|
9
|
+
const parent = dirname(current);
|
|
10
|
+
if (parent === current)
|
|
11
|
+
break;
|
|
12
|
+
current = parent;
|
|
13
|
+
}
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
const readJson = (path) => JSON.parse(readFileSync(path, 'utf8'));
|
|
17
|
+
const writeJson = (path, value) => writeFileSync(path, `${JSON.stringify(value, null, 2)}\n`);
|
|
18
|
+
export function addDependency(packageJsonPath, packageName, version) {
|
|
19
|
+
const pkg = readJson(packageJsonPath);
|
|
20
|
+
if (pkg.dependencies?.[packageName] ?? pkg.devDependencies?.[packageName]) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
pkg.dependencies = Object.fromEntries(Object.entries({ ...pkg.dependencies, [packageName]: version }).sort(([a], [b]) => a.localeCompare(b)));
|
|
24
|
+
writeJson(packageJsonPath, pkg);
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* What a signed-in user may call directly. Per-user modes expose every
|
|
29
|
+
* function, since the upstream enforces the user's own permissions; a shared
|
|
30
|
+
* secret acts with one identity for everyone, so only reads are exposed.
|
|
31
|
+
*/
|
|
32
|
+
export function exposedFunctions(install) {
|
|
33
|
+
const names = Object.keys(install.functions).sort();
|
|
34
|
+
if (install.mode !== 'shared')
|
|
35
|
+
return names;
|
|
36
|
+
return names.filter((fn) => /\.call\("GET"/.test(install.functions[fn]));
|
|
37
|
+
}
|
|
38
|
+
export function wireAddonFile(install) {
|
|
39
|
+
const expose = exposedFunctions(install);
|
|
40
|
+
const list = expose.length
|
|
41
|
+
? `[\n${expose.map((fn) => ` '${fn}',`).join('\n')}\n ]`
|
|
42
|
+
: 'false';
|
|
43
|
+
return `import { wireAddon } from '#pikku/addon'
|
|
44
|
+
|
|
45
|
+
wireAddon({
|
|
46
|
+
name: '${install.camelName}',
|
|
47
|
+
package: '${install.packageName}',
|
|
48
|
+
auth: true,
|
|
49
|
+
expose: ${list},
|
|
50
|
+
})
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
const BETTER_AUTH_IMPORT = /import\s*\{([^}]*)\}\s*from\s*'@pikku\/better-auth'/;
|
|
54
|
+
function addNamedImport(source, name) {
|
|
55
|
+
const match = source.match(BETTER_AUTH_IMPORT);
|
|
56
|
+
if (match) {
|
|
57
|
+
const names = match[1]
|
|
58
|
+
.split(',')
|
|
59
|
+
.map((n) => n.trim())
|
|
60
|
+
.filter(Boolean);
|
|
61
|
+
if (names.includes(name))
|
|
62
|
+
return source;
|
|
63
|
+
return source.replace(match[0], `import { ${[...names, name].join(', ')} } from '@pikku/better-auth'`);
|
|
64
|
+
}
|
|
65
|
+
return `import { ${name} } from '@pikku/better-auth'\n${source}`;
|
|
66
|
+
}
|
|
67
|
+
const FACTORY_SERVICES = /pikkuBetterAuth\(\s*async\s*\(\{([^}]*)\}\)/;
|
|
68
|
+
function addFactoryService(source, service) {
|
|
69
|
+
return source.replace(FACTORY_SERVICES, (whole, services) => {
|
|
70
|
+
const names = services
|
|
71
|
+
.split(',')
|
|
72
|
+
.map((n) => n.trim())
|
|
73
|
+
.filter(Boolean);
|
|
74
|
+
if (names.includes(service))
|
|
75
|
+
return whole;
|
|
76
|
+
return whole.replace(`{${services}}`, `{ ${[...names, service].join(', ')} }`);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function insertAfterImports(source, line) {
|
|
80
|
+
const imports = [
|
|
81
|
+
...source.matchAll(/^import[\s\S]*?from\s+'[^']+'[ \t]*\n/gm),
|
|
82
|
+
];
|
|
83
|
+
const last = imports[imports.length - 1];
|
|
84
|
+
if (!last)
|
|
85
|
+
return `${line}\n${source}`;
|
|
86
|
+
const at = last.index + last[0].length;
|
|
87
|
+
return `${source.slice(0, at)}${line}\n${source.slice(at)}`;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Wires the addon's auth into the app's Better Auth config: delegated sign-in
|
|
91
|
+
* against the upstream, and upstream credentials carried by scenario actors.
|
|
92
|
+
* Text edits, so each one is skipped (and reported) when its anchor is gone.
|
|
93
|
+
*/
|
|
94
|
+
export function wireAuth(source, install) {
|
|
95
|
+
const notes = [];
|
|
96
|
+
const { camelName, pascalName, screamingName, packageName } = install;
|
|
97
|
+
const perUser = install.mode !== 'shared' && install.mode !== 'none';
|
|
98
|
+
if (!perUser)
|
|
99
|
+
return { source, notes };
|
|
100
|
+
if (!FACTORY_SERVICES.test(source)) {
|
|
101
|
+
notes.push('auth.ts: pikkuBetterAuth is not `async ({ … }) =>`, so the upstream sign-in was not wired — add it by hand (see pikku-auth)');
|
|
102
|
+
return { source, notes };
|
|
103
|
+
}
|
|
104
|
+
const storeCredential = `if (!credentialService) throw new Error('credentialService is not configured')`;
|
|
105
|
+
let next = addFactoryService(source, 'credentialService');
|
|
106
|
+
if (install.mode === 'delegated' &&
|
|
107
|
+
!next.includes(`authenticate${pascalName}Upstream`)) {
|
|
108
|
+
if (next.search(/plugins:\s*\[/) === -1) {
|
|
109
|
+
notes.push(`auth.ts has no plugins: [ … ] — add pikkuDelegatedAuth by hand (see pikku-auth)`);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
next = addFactoryService(next, 'variables');
|
|
113
|
+
next = addFactoryService(next, 'scopeService');
|
|
114
|
+
next = addFactoryService(next, 'logger');
|
|
115
|
+
next = addNamedImport(next, 'pikkuDelegatedAuth');
|
|
116
|
+
next = insertAfterImports(next, `import { authenticate${pascalName}Upstream } from '${packageName}'`);
|
|
117
|
+
const fallback = install.baseUrl
|
|
118
|
+
? ` ?? ${JSON.stringify(install.baseUrl)}`
|
|
119
|
+
: '';
|
|
120
|
+
const plugin = `
|
|
121
|
+
pikkuDelegatedAuth({
|
|
122
|
+
authenticate: async (credentials) =>
|
|
123
|
+
authenticate${pascalName}Upstream(
|
|
124
|
+
credentials,
|
|
125
|
+
String((await variables.get('${screamingName}_BASE_URL'))${fallback})
|
|
126
|
+
),
|
|
127
|
+
storeCredential: async (userId, identity) => {
|
|
128
|
+
${storeCredential}
|
|
129
|
+
await credentialService.set('${camelName}', identity.credential, userId)
|
|
130
|
+
},
|
|
131
|
+
scopeService,
|
|
132
|
+
logger,
|
|
133
|
+
}),`;
|
|
134
|
+
const open = next.match(/plugins:\s*\[/);
|
|
135
|
+
const at = open.index + open[0].length;
|
|
136
|
+
next = `${next.slice(0, at)}${plugin}${next.slice(at)}`;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const actorAt = next.search(/pikkuActor\(\{/);
|
|
140
|
+
if (actorAt === -1) {
|
|
141
|
+
notes.push('auth.ts has no pikkuActor — scenario personas will not carry upstream credentials');
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
const actorCall = next.slice(actorAt, next.indexOf('})', actorAt) + 2);
|
|
145
|
+
if (!actorCall.includes('credentials:')) {
|
|
146
|
+
const credentials = `pikkuActor({
|
|
147
|
+
credentials: {
|
|
148
|
+
names: ['${camelName}'],
|
|
149
|
+
store: async (name, value, userId) => {
|
|
150
|
+
${storeCredential}
|
|
151
|
+
await credentialService.set(name, value, userId)
|
|
152
|
+
},
|
|
153
|
+
remove: async (name, userId) => {
|
|
154
|
+
await credentialService?.delete(name, userId)
|
|
155
|
+
},
|
|
156
|
+
},`;
|
|
157
|
+
next = next.replace(/pikkuActor\(\{/, credentials);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return { source: next, notes };
|
|
161
|
+
}
|
|
162
|
+
function addEnvLine(envPath, name, value) {
|
|
163
|
+
const current = existsSync(envPath) ? readFileSync(envPath, 'utf8') : '';
|
|
164
|
+
if (new RegExp(`^\\s*${name}\\s*=`, 'm').test(current))
|
|
165
|
+
return false;
|
|
166
|
+
const sep = current.length > 0 && !current.endsWith('\n') ? '\n' : '';
|
|
167
|
+
writeFileSync(envPath, `${current}${sep}${name}=${value}\n`);
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Installs a freshly generated addon into the app it was generated in: the
|
|
172
|
+
* dependency on the root and functions packages, the wireAddon file, the auth
|
|
173
|
+
* wiring and the base-URL variable. The caller installs and builds after.
|
|
174
|
+
*/
|
|
175
|
+
export function installAddonIntoApp(install) {
|
|
176
|
+
const written = [];
|
|
177
|
+
const notes = [];
|
|
178
|
+
const rel = (path) => relative(install.projectRoot, path);
|
|
179
|
+
const functionsPkg = owningPackageDir(install.srcDir, install.projectRoot);
|
|
180
|
+
const packageDirs = [install.projectRoot];
|
|
181
|
+
if (functionsPkg && functionsPkg !== install.projectRoot)
|
|
182
|
+
packageDirs.push(functionsPkg);
|
|
183
|
+
for (const dir of packageDirs) {
|
|
184
|
+
const path = join(dir, 'package.json');
|
|
185
|
+
const spec = install.inWorkspace
|
|
186
|
+
? 'workspace:*'
|
|
187
|
+
: `file:${relative(dir, install.addonDir)}`;
|
|
188
|
+
if (existsSync(path) && addDependency(path, install.packageName, spec)) {
|
|
189
|
+
written.push(rel(path));
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
const addonsDir = existsSync(join(install.srcDir, 'addons'))
|
|
193
|
+
? join(install.srcDir, 'addons')
|
|
194
|
+
: install.srcDir;
|
|
195
|
+
const wirePath = join(addonsDir, `${install.name}.addon.ts`);
|
|
196
|
+
if (existsSync(wirePath)) {
|
|
197
|
+
notes.push(`${rel(wirePath)} already exists — left as it is`);
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
mkdirSync(addonsDir, { recursive: true });
|
|
201
|
+
writeFileSync(wirePath, wireAddonFile(install));
|
|
202
|
+
written.push(rel(wirePath));
|
|
203
|
+
}
|
|
204
|
+
const authPath = join(install.srcDir, 'auth.ts');
|
|
205
|
+
if (existsSync(authPath)) {
|
|
206
|
+
const before = readFileSync(authPath, 'utf8');
|
|
207
|
+
const { source, notes: authNotes } = wireAuth(before, install);
|
|
208
|
+
notes.push(...authNotes);
|
|
209
|
+
if (source !== before) {
|
|
210
|
+
writeFileSync(authPath, source);
|
|
211
|
+
written.push(rel(authPath));
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
else if (install.mode === 'delegated') {
|
|
215
|
+
notes.push(`no ${rel(authPath)} — add pikkuDelegatedAuth to your Better Auth config by hand (see pikku-auth)`);
|
|
216
|
+
}
|
|
217
|
+
const envPath = join(install.projectRoot, '.env');
|
|
218
|
+
if (addEnvLine(envPath, `${install.screamingName}_BASE_URL`, install.baseUrl ?? '')) {
|
|
219
|
+
written.push(rel(envPath));
|
|
220
|
+
}
|
|
221
|
+
if (!install.baseUrl) {
|
|
222
|
+
notes.push(`the spec names no absolute server — set ${install.screamingName}_BASE_URL in .env`);
|
|
223
|
+
}
|
|
224
|
+
return { written, notes };
|
|
225
|
+
}
|