@pikku/cli 0.12.20 → 0.12.22
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/cli.schema.json +1 -1
- package/console-app/assets/index-C52h1B_L.css +1 -0
- package/console-app/assets/index-CAk106ji.js +232 -0
- package/console-app/index.html +3 -6
- package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +1 -1
- package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +3 -3
- package/dist/.pikku/channel/pikku-channel-types.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-channel.d.ts +6 -6
- package/dist/.pikku/cli/pikku-cli-channel.js +280 -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 +792 -8
- 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/console/pikku-node-types.gen.d.ts +1 -1
- package/dist/.pikku/function/pikku-function-types.gen.d.ts +44 -70
- package/dist/.pikku/function/pikku-function-types.gen.js +33 -40
- package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
- package/dist/.pikku/function/pikku-functions-meta.gen.json +1439 -316
- package/dist/.pikku/function/pikku-functions.gen.js +21 -9
- 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/http/pikku-http-wirings-meta.gen.js +1 -1
- package/dist/.pikku/http/pikku-http-wirings.gen.d.ts +1 -1
- package/dist/.pikku/http/pikku-http-wirings.gen.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/pikku-bootstrap.gen.d.ts +3 -1
- package/dist/.pikku/pikku-bootstrap.gen.js +3 -1
- package/dist/.pikku/pikku-meta-service.gen.d.ts +1 -1
- package/dist/.pikku/pikku-meta-service.gen.js +1 -1
- package/dist/.pikku/pikku-services.gen.d.ts +2 -1
- package/dist/.pikku/pikku-services.gen.js +1 -0
- package/dist/.pikku/pikku-types.gen.d.ts +1 -1
- package/dist/.pikku/pikku-types.gen.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.d.ts +1 -0
- package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +6 -0
- package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.json +250 -0
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +4 -0
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +5 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +1 -1
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +66 -10
- 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 +157 -11
- package/dist/.pikku/schemas/schemas/BinaryInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/DbMigrateInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/DbResetInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/DbSeedInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDbSchemaInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDbSchemaOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDeployApplyInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDeployApplyOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDeployListInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDeployListOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDeployPlanInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDeployPlanOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDeployUnitsInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDeployUnitsOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDomainsAddInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDomainsAddOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDomainsListInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDomainsListOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDomainsRemoveInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricDomainsRemoveOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricErrorsInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricErrorsOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricInitInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricInitOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricLLMKeyInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricLLMKeyOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricLinkInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricLinkOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricLoginInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricLoginOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricLogsInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricLogsOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricMetricsInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricMetricsOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricRollbackInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricRollbackOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricSecretsListInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricSecretsListOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricSecretsSetInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricSecretsSetOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricStatusInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricStatusOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricTraceInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricTraceOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricValidateInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/FabricValidateOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuCommandChannelsOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuCommandHTTPOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuCommandQueueOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuEventsScaffoldOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaClientsInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaContextInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaFunctionsGetInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaFunctionsListInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaMiddlewareGetInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaMiddlewareListInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaPermissionsGetInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaPermissionsListInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaSchemasGetInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaSchemasListInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaWiresChannelInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaWiresHttpInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaWiresListInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaWiresQueueInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaWiresSchedulerInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaWiresTriggerInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaWiresTypeInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaWorkflowsGetInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMetaWorkflowsListInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuSkillsInstallInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuSkillsListInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuTestsCoverageInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuTestsInitInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/WorkflowRunStatus.schema.json +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/trigger/pikku-trigger-types.gen.d.ts +1 -1
- package/dist/.pikku/trigger/pikku-trigger-types.gen.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/meta/allWorkflow.gen.json +237 -629
- 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 +23 -0
- package/dist/bin/pikku.js +28 -1
- package/dist/src/cli.wiring.js +286 -10
- package/dist/src/deploy/analyzer/analyzer.d.ts +16 -1
- package/dist/src/deploy/analyzer/analyzer.js +83 -43
- package/dist/src/deploy/analyzer/manifest.d.ts +10 -0
- package/dist/src/deploy/build-pipeline.d.ts +2 -0
- package/dist/src/deploy/build-pipeline.js +123 -19
- package/dist/src/deploy/bundler/bundler.d.ts +3 -1
- package/dist/src/deploy/bundler/bundler.js +40 -9
- package/dist/src/deploy/bundler/dep-extractor.d.ts +5 -2
- package/dist/src/deploy/bundler/dep-extractor.js +103 -23
- package/dist/src/deploy/bundler/types.d.ts +5 -1
- package/dist/src/deploy/codegen/per-unit-codegen.d.ts +11 -1
- package/dist/src/deploy/codegen/per-unit-codegen.js +49 -6
- package/dist/src/deploy/plan/planner.js +25 -3
- package/dist/src/deploy/plan/provider.d.ts +2 -0
- package/dist/src/deploy/provider-adapter.d.ts +34 -0
- package/dist/src/deploy/server-entry.d.ts +16 -0
- package/dist/src/deploy/server-entry.js +81 -0
- package/dist/src/fabric/fabric-commands.d.ts +522 -0
- package/dist/src/fabric/fabric-commands.js +299 -0
- package/dist/src/fabric/functions/db-schema.function.d.ts +35 -0
- package/dist/src/fabric/functions/db-schema.function.js +37 -0
- package/dist/src/fabric/functions/deploy-list.function.d.ts +41 -0
- package/dist/src/fabric/functions/deploy-list.function.js +43 -0
- package/dist/src/fabric/functions/deploy-units.function.d.ts +35 -0
- package/dist/src/fabric/functions/deploy-units.function.js +41 -0
- package/dist/src/fabric/functions/deploy.function.d.ts +105 -0
- package/dist/src/fabric/functions/deploy.function.js +122 -0
- package/dist/src/fabric/functions/domains-add.function.d.ts +35 -0
- package/dist/src/fabric/functions/domains-add.function.js +46 -0
- package/dist/src/fabric/functions/domains-list.function.d.ts +20 -0
- package/dist/src/fabric/functions/domains-list.function.js +50 -0
- package/dist/src/fabric/functions/domains-remove.function.d.ts +24 -0
- package/dist/src/fabric/functions/domains-remove.function.js +44 -0
- package/dist/src/fabric/functions/errors.function.d.ts +44 -0
- package/dist/src/fabric/functions/errors.function.js +50 -0
- package/dist/src/fabric/functions/init.function.d.ts +51 -0
- package/dist/src/fabric/functions/init.function.js +54 -0
- package/dist/src/fabric/functions/link.function.d.ts +28 -0
- package/dist/src/fabric/functions/link.function.js +77 -0
- package/dist/src/fabric/functions/llm-key.function.d.ts +46 -0
- package/dist/src/fabric/functions/llm-key.function.js +76 -0
- package/dist/src/fabric/functions/login.function.d.ts +42 -0
- package/dist/src/fabric/functions/login.function.js +68 -0
- package/dist/src/fabric/functions/logs.function.d.ts +40 -0
- package/dist/src/fabric/functions/logs.function.js +84 -0
- package/dist/src/fabric/functions/metrics.function.d.ts +32 -0
- package/dist/src/fabric/functions/metrics.function.js +49 -0
- package/dist/src/fabric/functions/rollback.function.d.ts +76 -0
- package/dist/src/fabric/functions/rollback.function.js +69 -0
- package/dist/src/fabric/functions/secrets-list.function.d.ts +24 -0
- package/dist/src/fabric/functions/secrets-list.function.js +37 -0
- package/dist/src/fabric/functions/secrets-set.function.d.ts +32 -0
- package/dist/src/fabric/functions/secrets-set.function.js +36 -0
- package/dist/src/fabric/functions/status.function.d.ts +34 -0
- package/dist/src/fabric/functions/status.function.js +43 -0
- package/dist/src/fabric/functions/trace.function.d.ts +28 -0
- package/dist/src/fabric/functions/trace.function.js +45 -0
- package/dist/src/fabric/functions/validate.function.d.ts +50 -0
- package/dist/src/fabric/functions/validate.function.js +363 -0
- package/dist/src/fabric/lib/config.d.ts +64 -0
- package/dist/src/fabric/lib/config.js +62 -0
- package/dist/src/fabric/lib/console-url.d.ts +5 -0
- package/dist/src/fabric/lib/console-url.js +13 -0
- package/dist/src/fabric/lib/git.d.ts +53 -0
- package/dist/src/fabric/lib/git.js +151 -0
- package/dist/src/fabric/lib/http.d.ts +4 -0
- package/dist/src/fabric/lib/http.js +12 -0
- package/dist/src/fabric/lib/not-implemented.d.ts +5 -0
- package/dist/src/fabric/lib/not-implemented.js +8 -0
- package/dist/src/fabric/lib/output.d.ts +23 -0
- package/dist/src/fabric/lib/output.js +39 -0
- package/dist/src/fabric/lib/prompt.d.ts +12 -0
- package/dist/src/fabric/lib/prompt.js +32 -0
- package/dist/src/fabric/lib/stage.d.ts +7 -0
- package/dist/src/fabric/lib/stage.js +14 -0
- package/dist/src/fabric/sdk/pikku-fetch.gen.d.ts +14 -0
- package/dist/src/fabric/sdk/pikku-fetch.gen.js +30 -0
- package/dist/src/fabric/sdk/pikku-rpc.gen.d.ts +105 -0
- package/dist/src/fabric/sdk/pikku-rpc.gen.js +126 -0
- package/dist/src/functions/commands/all.d.ts +1 -1
- package/dist/src/functions/commands/binary.d.ts +7 -0
- package/dist/src/functions/commands/binary.js +40 -0
- package/dist/src/functions/commands/bootstrap.d.ts +1 -1
- package/dist/src/functions/commands/bootstrap.js +7 -4
- package/dist/src/functions/commands/console.d.ts +3 -3
- package/dist/src/functions/commands/db-migrate.d.ts +1 -0
- package/dist/src/functions/commands/db-migrate.js +35 -0
- package/dist/src/functions/commands/db-reset.d.ts +1 -0
- package/dist/src/functions/commands/db-reset.js +36 -0
- package/dist/src/functions/commands/db-seed.d.ts +1 -0
- package/dist/src/functions/commands/db-seed.js +27 -0
- package/dist/src/functions/commands/db-shared.d.ts +32 -0
- package/dist/src/functions/commands/db-shared.js +26 -0
- package/dist/src/functions/commands/deploy-apply.d.ts +3 -3
- package/dist/src/functions/commands/deploy-apply.js +6 -4
- package/dist/src/functions/commands/deploy-info.d.ts +1 -1
- package/dist/src/functions/commands/deploy-plan.d.ts +3 -3
- package/dist/src/functions/commands/deploy-plan.js +7 -1
- package/dist/src/functions/commands/dev.d.ts +3 -3
- package/dist/src/functions/commands/dev.js +142 -86
- package/dist/src/functions/commands/enable.d.ts +5 -4
- package/dist/src/functions/commands/enable.js +4 -0
- package/dist/src/functions/commands/info.d.ts +4 -4
- package/dist/src/functions/commands/load-user-project.d.ts +11 -0
- package/dist/src/functions/commands/load-user-project.js +40 -0
- package/dist/src/functions/commands/meta.d.ts +82 -0
- package/dist/src/functions/commands/meta.js +454 -0
- package/dist/src/functions/commands/new-addon.d.ts +3 -3
- package/dist/src/functions/commands/new-function.d.ts +3 -3
- package/dist/src/functions/commands/new-middleware.d.ts +3 -3
- package/dist/src/functions/commands/new-permission.d.ts +3 -3
- package/dist/src/functions/commands/new-wiring.d.ts +3 -3
- package/dist/src/functions/commands/pikku-command-bootstrap.d.ts +1 -1
- package/dist/src/functions/commands/pikku-command-bootstrap.js +15 -1
- package/dist/src/functions/commands/pikku-command-summary.d.ts +1 -1
- package/dist/src/functions/commands/pikku-command-summary.js +7 -1
- package/dist/src/functions/commands/skills.d.ts +26 -0
- package/dist/src/functions/commands/skills.js +184 -0
- package/dist/src/functions/commands/tests-coverage.d.ts +7 -0
- package/dist/src/functions/commands/tests-coverage.js +231 -0
- package/dist/src/functions/commands/tests-init.d.ts +7 -0
- package/dist/src/functions/commands/tests-init.js +225 -0
- package/dist/src/functions/commands/versions-check.d.ts +1 -1
- package/dist/src/functions/commands/versions-init.d.ts +3 -3
- package/dist/src/functions/commands/versions-update.d.ts +1 -1
- package/dist/src/functions/commands/versions-update.js +4 -2
- package/dist/src/functions/commands/watch.d.ts +3 -3
- package/dist/src/functions/commands/watch.js +1 -1
- package/dist/src/functions/db/local-db.d.ts +48 -0
- package/dist/src/functions/db/local-db.js +106 -0
- package/dist/src/functions/db/seed.d.ts +11 -0
- package/dist/src/functions/db/seed.js +22 -0
- package/dist/src/functions/db/sql-migrator.d.ts +26 -0
- package/dist/src/functions/db/sql-migrator.js +104 -0
- package/dist/src/functions/db/sqlite-codegen.d.ts +45 -0
- package/dist/src/functions/db/sqlite-codegen.js +294 -0
- package/dist/src/functions/db/zod-codegen.d.ts +10 -0
- package/dist/src/functions/db/zod-codegen.js +109 -0
- package/dist/src/functions/runtimes/fetch/index.d.ts +1 -1
- package/dist/src/functions/runtimes/nextjs/pikku-command-nextjs.d.ts +1 -1
- package/dist/src/functions/runtimes/nextjs/pikku-command-nextjs.js +21 -2
- package/dist/src/functions/runtimes/nextjs/serialize-nextjs-backend-worker-rpc-wrapper.d.ts +1 -0
- package/dist/src/functions/runtimes/nextjs/serialize-nextjs-backend-worker-rpc-wrapper.js +163 -0
- package/dist/src/functions/runtimes/nextjs/serialize-nextjs-http-wrapper.d.ts +1 -1
- package/dist/src/functions/runtimes/nextjs/serialize-nextjs-http-wrapper.js +5 -2
- package/dist/src/functions/runtimes/tanstack-start/pikku-command-tanstack-start.d.ts +1 -0
- package/dist/src/functions/runtimes/tanstack-start/pikku-command-tanstack-start.js +32 -0
- package/dist/src/functions/runtimes/tanstack-start/serialize-tanstack-start-shim.d.ts +11 -0
- package/dist/src/functions/runtimes/tanstack-start/serialize-tanstack-start-shim.js +36 -0
- package/dist/src/functions/runtimes/websocket/pikku-command-websocket-typed.d.ts +1 -1
- package/dist/src/functions/wirings/ai-agent/pikku-command-ai-agent-types.d.ts +1 -1
- package/dist/src/functions/wirings/ai-agent/pikku-command-ai-agent.d.ts +1 -1
- package/dist/src/functions/wirings/ai-agent/pikku-command-ai-agent.js +1 -10
- package/dist/src/functions/wirings/ai-agent/pikku-command-public-agent.d.ts +1 -1
- package/dist/src/functions/wirings/ai-agent/serialize-public-agent.js +76 -1
- package/dist/src/functions/wirings/channels/pikku-channels.d.ts +1 -1
- package/dist/src/functions/wirings/channels/pikku-command-channel-types.d.ts +1 -1
- package/dist/src/functions/wirings/channels/pikku-command-channels-map.d.ts +1 -1
- package/dist/src/functions/wirings/channels/pikku-command-channels.d.ts +1 -1
- package/dist/src/functions/wirings/channels/pikku-command-channels.js +1 -1
- package/dist/src/functions/wirings/cli/pikku-command-cli-entry.d.ts +1 -1
- package/dist/src/functions/wirings/cli/pikku-command-cli-entry.js +5 -2
- package/dist/src/functions/wirings/cli/pikku-command-cli-types.d.ts +5 -1
- package/dist/src/functions/wirings/cli/pikku-command-cli-types.js +8 -2
- package/dist/src/functions/wirings/cli/pikku-command-cli.d.ts +1 -1
- package/dist/src/functions/wirings/cli/serialize-channel-cli-client.js +27 -9
- package/dist/src/functions/wirings/cli/serialize-channel-cli.d.ts +5 -1
- package/dist/src/functions/wirings/cli/serialize-channel-cli.js +13 -3
- package/dist/src/functions/wirings/console/pikku-command-console-functions.d.ts +1 -1
- package/dist/src/functions/wirings/console/pikku-command-console-functions.js +5 -1
- package/dist/src/functions/wirings/console/pikku-command-node-types.d.ts +1 -1
- package/dist/src/functions/wirings/console/pikku-command-nodes-meta.d.ts +1 -1
- package/dist/src/functions/wirings/console/serialize-console-functions.js +5 -0
- package/dist/src/functions/wirings/credentials/pikku-command-credentials.d.ts +1 -1
- package/dist/src/functions/wirings/functions/pikku-command-addon-types.d.ts +5 -1
- package/dist/src/functions/wirings/functions/pikku-command-addon-types.js +7 -2
- package/dist/src/functions/wirings/functions/pikku-command-function-types-split.d.ts +1 -1
- package/dist/src/functions/wirings/functions/pikku-command-function-types-split.js +1 -1
- package/dist/src/functions/wirings/functions/pikku-command-function-types.d.ts +1 -1
- package/dist/src/functions/wirings/functions/pikku-command-functions.d.ts +1 -1
- package/dist/src/functions/wirings/functions/pikku-command-services.d.ts +1 -1
- package/dist/src/functions/wirings/functions/schemas.d.ts +1 -1
- package/dist/src/functions/wirings/functions/serialize-function-types.js +105 -80
- package/dist/src/functions/wirings/gateway/pikku-command-gateway.d.ts +1 -1
- package/dist/src/functions/wirings/http/pikku-command-http-map.d.ts +1 -1
- package/dist/src/functions/wirings/http/pikku-command-http-routes.d.ts +1 -1
- package/dist/src/functions/wirings/http/pikku-command-http-routes.js +1 -1
- package/dist/src/functions/wirings/http/pikku-command-http-types.d.ts +1 -1
- package/dist/src/functions/wirings/http/pikku-command-openapi.d.ts +1 -1
- package/dist/src/functions/wirings/http/pikku-http-routes.d.ts +1 -1
- package/dist/src/functions/wirings/mcp/pikku-command-mcp-json.d.ts +1 -1
- package/dist/src/functions/wirings/mcp/pikku-command-mcp-types.d.ts +1 -1
- package/dist/src/functions/wirings/mcp/pikku-command-mcp.d.ts +1 -1
- package/dist/src/functions/wirings/middleware/pikku-command-middleware.d.ts +1 -1
- package/dist/src/functions/wirings/package/pikku-command-package-types.d.ts +2 -2
- package/dist/src/functions/wirings/package/pikku-command-package.d.ts +1 -1
- package/dist/src/functions/wirings/permissions/pikku-command-permissions.d.ts +1 -1
- package/dist/src/functions/wirings/queue/pikku-command-queue-map.d.ts +1 -1
- package/dist/src/functions/wirings/queue/pikku-command-queue-map.js +1 -1
- package/dist/src/functions/wirings/queue/pikku-command-queue-service.d.ts +1 -1
- package/dist/src/functions/wirings/queue/pikku-command-queue-types.d.ts +1 -1
- package/dist/src/functions/wirings/queue/pikku-command-queue.d.ts +1 -1
- package/dist/src/functions/wirings/queue/pikku-command-queue.js +1 -1
- package/dist/src/functions/wirings/queue/pikku-queue-map.d.ts +1 -1
- package/dist/src/functions/wirings/queue/pikku-queue.d.ts +1 -1
- package/dist/src/functions/wirings/realtime/pikku-command-events-scaffold.d.ts +1 -0
- package/dist/src/functions/wirings/realtime/pikku-command-events-scaffold.js +26 -0
- package/dist/src/functions/wirings/realtime/pikku-command-realtime.d.ts +1 -0
- package/dist/src/functions/wirings/realtime/pikku-command-realtime.js +35 -0
- package/dist/src/functions/wirings/realtime/serialize-events-scaffold.d.ts +23 -0
- package/dist/src/functions/wirings/realtime/serialize-events-scaffold.js +98 -0
- package/dist/src/functions/wirings/realtime/serialize-realtime-client.d.ts +22 -0
- package/dist/src/functions/wirings/realtime/serialize-realtime-client.js +337 -0
- package/dist/src/functions/wirings/rpc/pikku-command-public-rpc.d.ts +1 -1
- package/dist/src/functions/wirings/rpc/pikku-command-public-rpc.js +5 -1
- package/dist/src/functions/wirings/rpc/pikku-command-react-query.d.ts +1 -1
- package/dist/src/functions/wirings/rpc/pikku-command-remote-rpc.d.ts +1 -1
- package/dist/src/functions/wirings/rpc/pikku-command-remote-rpc.js +5 -1
- package/dist/src/functions/wirings/rpc/pikku-command-rpc-client.d.ts +1 -1
- package/dist/src/functions/wirings/rpc/pikku-command-rpc-client.js +3 -1
- package/dist/src/functions/wirings/rpc/pikku-command-rpc-map.d.ts +2 -2
- package/dist/src/functions/wirings/rpc/pikku-command-rpc.d.ts +2 -1
- package/dist/src/functions/wirings/rpc/pikku-command-rpc.js +13 -7
- package/dist/src/functions/wirings/rpc/serialize-public-rpc.js +1 -0
- package/dist/src/functions/wirings/rpc/serialize-react-query-hooks.js +1 -1
- package/dist/src/functions/wirings/rpc/serialize-remote-rpc.js +7 -1
- package/dist/src/functions/wirings/rpc/serialize-typed-rpc-map.js +16 -2
- package/dist/src/functions/wirings/scheduler/pikku-command-scheduler-types.d.ts +1 -1
- package/dist/src/functions/wirings/scheduler/pikku-command-scheduler.d.ts +1 -1
- package/dist/src/functions/wirings/secrets/pikku-command-secrets.d.ts +1 -1
- package/dist/src/functions/wirings/triggers/pikku-command-trigger-types.d.ts +1 -1
- package/dist/src/functions/wirings/triggers/pikku-command-trigger-types.js +1 -1
- package/dist/src/functions/wirings/triggers/pikku-command-trigger.d.ts +1 -1
- package/dist/src/functions/wirings/variables/pikku-command-variables.d.ts +1 -1
- package/dist/src/functions/wirings/workflow/pikku-command-workflow-routes.d.ts +1 -1
- package/dist/src/functions/wirings/workflow/pikku-command-workflow-routes.js +1 -1
- package/dist/src/functions/wirings/workflow/pikku-command-workflow.d.ts +5 -1
- package/dist/src/functions/wirings/workflow/pikku-command-workflow.js +18 -4
- package/dist/src/functions/wirings/workflow/serialize-workflow-bootstrap-map.d.ts +3 -0
- package/dist/src/functions/wirings/workflow/serialize-workflow-bootstrap-map.js +40 -0
- package/dist/src/functions/wirings/workflow/serialize-workflow-routes.js +56 -2
- package/dist/src/functions/workflows/all.workflow.js +45 -12
- package/dist/src/scaffold/rpc-remote.gen.d.ts +3 -3
- package/dist/src/scaffold/rpc-remote.gen.js +7 -2
- package/dist/src/scaffold/workflow-routes.gen.d.ts +18 -18
- package/dist/src/scaffold/workflow-routes.gen.js +33 -1
- package/dist/src/services/cli-logger.service.d.ts +22 -3
- package/dist/src/services/cli-logger.service.js +107 -41
- package/dist/src/services.js +32 -67
- package/dist/src/utils/generate-bootstrap-file.js +3 -0
- package/dist/src/utils/parse-cli-filters.d.ts +18 -0
- package/dist/src/utils/parse-cli-filters.js +99 -0
- package/dist/src/utils/pikku-cli-config.js +29 -9
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -4
- package/skills/pikku-addon/SKILL.md +330 -0
- package/skills/pikku-ai-agent/SKILL.md +227 -0
- package/skills/pikku-ai-vercel/SKILL.md +78 -0
- package/skills/pikku-ai-voice/SKILL.md +85 -0
- package/skills/pikku-auth-js/SKILL.md +106 -0
- package/skills/pikku-aws/SKILL.md +107 -0
- package/skills/pikku-backblaze/SKILL.md +70 -0
- package/skills/pikku-cli/SKILL.md +281 -0
- package/skills/pikku-concepts/SKILL.md +281 -0
- package/skills/pikku-concepts/references/concept-mapping.md +528 -0
- package/skills/pikku-config/SKILL.md +208 -0
- package/skills/pikku-cron/SKILL.md +211 -0
- package/skills/pikku-deploy-azure/SKILL.md +69 -0
- package/skills/pikku-deploy-cloudflare/SKILL.md +80 -0
- package/skills/pikku-deploy-express/SKILL.md +83 -0
- package/skills/pikku-deploy-fastify/SKILL.md +70 -0
- package/skills/pikku-deploy-lambda/SKILL.md +107 -0
- package/skills/pikku-deploy-nextjs/SKILL.md +76 -0
- package/skills/pikku-deploy-uws/SKILL.md +85 -0
- package/skills/pikku-fabric/SKILL.md +245 -0
- package/skills/pikku-feature/SKILL.md +258 -0
- package/skills/pikku-gateway-slack/SKILL.md +112 -0
- package/skills/pikku-http/SKILL.md +317 -0
- package/skills/pikku-i18n/SKILL.md +208 -0
- package/skills/pikku-info/SKILL.md +95 -0
- package/skills/pikku-jose/SKILL.md +102 -0
- package/skills/pikku-kysely/SKILL.md +145 -0
- package/skills/pikku-mcp/SKILL.md +237 -0
- package/skills/pikku-mongodb/SKILL.md +102 -0
- package/skills/pikku-n8n-addon-map/SKILL.md +178 -0
- package/skills/pikku-n8n-code-translate/SKILL.md +166 -0
- package/skills/pikku-pino/SKILL.md +77 -0
- package/skills/pikku-queue/SKILL.md +237 -0
- package/skills/pikku-react/SKILL.md +183 -0
- package/skills/pikku-react-query/SKILL.md +205 -0
- package/skills/pikku-realtime/SKILL.md +285 -0
- package/skills/pikku-redis/SKILL.md +87 -0
- package/skills/pikku-rpc/SKILL.md +168 -0
- package/skills/pikku-rtl/SKILL.md +205 -0
- package/skills/pikku-schedule/SKILL.md +54 -0
- package/skills/pikku-schema-ajv/SKILL.md +60 -0
- package/skills/pikku-schema-cfworker/SKILL.md +60 -0
- package/skills/pikku-security/SKILL.md +243 -0
- package/skills/pikku-services/SKILL.md +247 -0
- package/skills/pikku-template-clone/SKILL.md +39 -0
- package/skills/pikku-testing/SKILL.md +428 -0
- package/skills/pikku-trigger/SKILL.md +177 -0
- package/skills/pikku-versioning/SKILL.md +169 -0
- package/skills/pikku-websocket/SKILL.md +239 -0
- package/skills/pikku-workflow/SKILL.md +283 -0
- package/skills/pikku-workflows-client/SKILL.md +150 -0
- package/skills/pikku-ws/SKILL.md +45 -0
- package/console-app/assets/index-BpY2pSuA.css +0 -10
- package/console-app/assets/index-DXLy-_D4.js +0 -717
- package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +0 -10
- package/dist/.pikku/cli/pikku-cli-client.gen.js +0 -44
- /package/dist/.pikku/schemas/schemas/{PikkuChannelsOutput.schema.json → PikkuCLIEntryOutput.schema.json} +0 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { pikkuSessionlessFunc } from '../../../.pikku/pikku-types.gen.js';
|
|
3
|
+
import { resolveApiContext } from '../lib/config.js';
|
|
4
|
+
import { getFabricRPC } from '../lib/http.js';
|
|
5
|
+
import { assertNamedBranchDeploySafety, resolveRef } from '../lib/git.js';
|
|
6
|
+
import { promptConfirm } from '../lib/prompt.js';
|
|
7
|
+
import { added, changed, dim } from '../lib/output.js';
|
|
8
|
+
export const FabricDeployInput = z.object({
|
|
9
|
+
branch: z.string().optional(),
|
|
10
|
+
production: z.boolean().optional(),
|
|
11
|
+
ref: z.string().optional(),
|
|
12
|
+
message: z.string().optional(),
|
|
13
|
+
autoApply: z.boolean().optional(),
|
|
14
|
+
});
|
|
15
|
+
export const FabricDeployValidatedInput = FabricDeployInput.superRefine((value, ctx) => {
|
|
16
|
+
if (!!value.branch === !!value.production) {
|
|
17
|
+
ctx.addIssue({
|
|
18
|
+
code: z.ZodIssueCode.custom,
|
|
19
|
+
message: 'Pass exactly one of --branch or --production.',
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
// `plan` resolves the target ref and reports what a deploy would do — nothing
|
|
24
|
+
// is queued, so there is no deploymentId/stageId/runId yet. `apply` carries
|
|
25
|
+
// those once the deploy is queued. The two intentionally have distinct shapes
|
|
26
|
+
// rather than one shape padded with empty-string sentinels.
|
|
27
|
+
export const FabricDeployPlanOutput = z.object({
|
|
28
|
+
projectId: z.string(),
|
|
29
|
+
branch: z.string(),
|
|
30
|
+
ref: z.string(),
|
|
31
|
+
requestedRef: z.string().optional(),
|
|
32
|
+
});
|
|
33
|
+
export const FabricDeployApplyOutput = z.object({
|
|
34
|
+
projectId: z.string(),
|
|
35
|
+
branch: z.string(),
|
|
36
|
+
ref: z.string(),
|
|
37
|
+
deploymentId: z.string(),
|
|
38
|
+
stageId: z.string(),
|
|
39
|
+
runId: z.string(),
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* Shared prep for `deploy plan` and `deploy apply`: authenticate, resolve the
|
|
43
|
+
* target branch, and resolve the ref to a concrete sha. Returns everything both
|
|
44
|
+
* subcommands need; neither prints — human output lives in the renders.
|
|
45
|
+
*/
|
|
46
|
+
async function prepDeploy({ branch, production, ref }) {
|
|
47
|
+
const ctx = await resolveApiContext();
|
|
48
|
+
if (!ctx.token) {
|
|
49
|
+
throw new Error('Not logged in. Run `pikku fabric login` first.');
|
|
50
|
+
}
|
|
51
|
+
if (!ctx.projectId) {
|
|
52
|
+
throw new Error('No fabric project linked. Run `pikku fabric link` first.');
|
|
53
|
+
}
|
|
54
|
+
const targetBranch = production ? 'main' : branch;
|
|
55
|
+
const safety = await assertNamedBranchDeploySafety(targetBranch);
|
|
56
|
+
const resolved = ref ? ((await resolveRef(ref)) ?? ref) : safety.headSha;
|
|
57
|
+
const requestedRef = ref && resolved !== safety.headSha ? ref : undefined;
|
|
58
|
+
return {
|
|
59
|
+
ctx,
|
|
60
|
+
projectId: ctx.projectId,
|
|
61
|
+
targetBranch,
|
|
62
|
+
resolved,
|
|
63
|
+
requestedRef,
|
|
64
|
+
safety,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export const FabricDeployPlan = pikkuSessionlessFunc({
|
|
68
|
+
description: 'Resolve the target ref and report what a deploy would do.',
|
|
69
|
+
input: FabricDeployValidatedInput,
|
|
70
|
+
output: FabricDeployPlanOutput,
|
|
71
|
+
func: async (_services, input) => {
|
|
72
|
+
const { projectId, targetBranch, resolved, requestedRef } = await prepDeploy(input);
|
|
73
|
+
return { projectId, branch: targetBranch, ref: resolved, requestedRef };
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
export const FabricDeployApply = pikkuSessionlessFunc({
|
|
77
|
+
description: 'Build + deploy a named branch or production (main).',
|
|
78
|
+
input: FabricDeployValidatedInput,
|
|
79
|
+
output: FabricDeployApplyOutput,
|
|
80
|
+
func: async (_services, input) => {
|
|
81
|
+
const { ctx, projectId, targetBranch, resolved, safety } = await prepDeploy(input);
|
|
82
|
+
// Classic yes/no guard. `--auto-apply` skips it; a non-interactive session
|
|
83
|
+
// has no human to answer, so we refuse rather than hang.
|
|
84
|
+
if (!input.autoApply) {
|
|
85
|
+
const target = `${targetBranch} @ ${resolved.slice(0, 8)}`;
|
|
86
|
+
if (!process.stdin.isTTY) {
|
|
87
|
+
throw new Error(`Refusing to deploy ${target} without confirmation — re-run with --auto-apply to deploy non-interactively.`);
|
|
88
|
+
}
|
|
89
|
+
const ok = await promptConfirm(`Deploy ${target}?`);
|
|
90
|
+
if (!ok) {
|
|
91
|
+
throw new Error('Deploy aborted.');
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const rpc = getFabricRPC({ apiUrl: ctx.apiUrl, token: ctx.token });
|
|
95
|
+
const result = await rpc.invoke('deployByStageKind', {
|
|
96
|
+
projectId,
|
|
97
|
+
branch: targetBranch,
|
|
98
|
+
ref: resolved,
|
|
99
|
+
expectedHeadSha: safety.headSha,
|
|
100
|
+
});
|
|
101
|
+
return {
|
|
102
|
+
projectId,
|
|
103
|
+
branch: targetBranch,
|
|
104
|
+
ref: resolved,
|
|
105
|
+
deploymentId: result.deploymentId,
|
|
106
|
+
stageId: result.stageId,
|
|
107
|
+
runId: result.runId,
|
|
108
|
+
};
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
export const renderDeployPlan = (_s, { projectId, branch, ref, requestedRef, }) => {
|
|
112
|
+
if (requestedRef) {
|
|
113
|
+
console.log(dim(`retargeted ${requestedRef} → ${ref.slice(0, 8)}`));
|
|
114
|
+
}
|
|
115
|
+
console.log(`${changed('plan')} ${dim('would deploy')} ${branch} ${dim('@')} ${ref.slice(0, 8)} ${dim(`(${projectId})`)}`);
|
|
116
|
+
// The coloured added/changed/removed manifest diff lands here once `plan`
|
|
117
|
+
// returns it from the preview workflow.
|
|
118
|
+
console.log(dim('Run `pikku fabric deploy apply` to execute.'));
|
|
119
|
+
};
|
|
120
|
+
export const renderDeployApply = (_s, { branch, ref, deploymentId }) => {
|
|
121
|
+
console.log(`${added('queued')} deploy ${branch} ${dim('@')} ${ref.slice(0, 8)} ${dim('·')} ${deploymentId}`);
|
|
122
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const FabricDomainsAddInput: z.ZodObject<{
|
|
3
|
+
hostname: z.ZodString;
|
|
4
|
+
target: z.ZodOptional<z.ZodEnum<{
|
|
5
|
+
api: "api";
|
|
6
|
+
app: "app";
|
|
7
|
+
}>>;
|
|
8
|
+
apiUrl: z.ZodOptional<z.ZodString>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export declare const FabricDomainsAddOutput: z.ZodObject<{
|
|
11
|
+
hostname: z.ZodString;
|
|
12
|
+
cnameTarget: z.ZodString;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
export declare const FabricDomainsAdd: import("../../../.pikku/pikku-types.gen.js").PikkuFunctionConfig<{
|
|
15
|
+
hostname: string;
|
|
16
|
+
target?: "api" | "app" | undefined;
|
|
17
|
+
apiUrl?: string | undefined;
|
|
18
|
+
}, {
|
|
19
|
+
hostname: string;
|
|
20
|
+
cnameTarget: string;
|
|
21
|
+
}, "rpc" | "session", import("../../../.pikku/pikku-types.gen.js").PikkuFunctionSessionless<{
|
|
22
|
+
hostname: string;
|
|
23
|
+
target?: "api" | "app" | undefined;
|
|
24
|
+
apiUrl?: string | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
hostname: string;
|
|
27
|
+
cnameTarget: string;
|
|
28
|
+
}, "rpc" | "session", import("../../../types/application-types.js").Services> | import("../../../.pikku/pikku-types.gen.js").PikkuFunction<{
|
|
29
|
+
hostname: string;
|
|
30
|
+
target?: "api" | "app" | undefined;
|
|
31
|
+
apiUrl?: string | undefined;
|
|
32
|
+
}, {
|
|
33
|
+
hostname: string;
|
|
34
|
+
cnameTarget: string;
|
|
35
|
+
}, "rpc" | "session", import("../../../types/application-types.js").Services>, undefined, undefined>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { pikkuSessionlessFunc } from '../../../.pikku/pikku-types.gen.js';
|
|
3
|
+
import { findProjectConfig, resolveApiContext } from '../lib/config.js';
|
|
4
|
+
import { getFabricRPC } from '../lib/http.js';
|
|
5
|
+
export const FabricDomainsAddInput = z.object({
|
|
6
|
+
hostname: z.string(),
|
|
7
|
+
target: z.enum(['api', 'app']).optional(),
|
|
8
|
+
apiUrl: z.string().optional(),
|
|
9
|
+
});
|
|
10
|
+
export const FabricDomainsAddOutput = z.object({
|
|
11
|
+
hostname: z.string(),
|
|
12
|
+
cnameTarget: z.string(),
|
|
13
|
+
});
|
|
14
|
+
export const FabricDomainsAdd = pikkuSessionlessFunc({
|
|
15
|
+
description: 'Add a custom domain to the production stage.',
|
|
16
|
+
input: FabricDomainsAddInput,
|
|
17
|
+
output: FabricDomainsAddOutput,
|
|
18
|
+
func: async (_services, { hostname, target = 'api', apiUrl: apiUrlOverride }) => {
|
|
19
|
+
const ctx = await resolveApiContext({ apiUrlOverride });
|
|
20
|
+
if (!ctx.token)
|
|
21
|
+
throw new Error('Not logged in. Run `pikku fabric login` first.');
|
|
22
|
+
const local = await findProjectConfig();
|
|
23
|
+
if (!local)
|
|
24
|
+
throw new Error('No fabric.config.json found. Run `pikku fabric link` first.');
|
|
25
|
+
const rpc = getFabricRPC({ apiUrl: ctx.apiUrl, token: ctx.token });
|
|
26
|
+
const stagesResult = await rpc.invoke('listStages', {
|
|
27
|
+
projectId: local.config.projectId,
|
|
28
|
+
});
|
|
29
|
+
const production = stagesResult.stages.find((s) => s.type === 'production');
|
|
30
|
+
if (!production)
|
|
31
|
+
throw new Error('No production stage exists yet — deploy the project first.');
|
|
32
|
+
const result = await rpc.invoke('addStageCustomHostname', {
|
|
33
|
+
stageId: production.stageId,
|
|
34
|
+
hostname,
|
|
35
|
+
target,
|
|
36
|
+
});
|
|
37
|
+
console.log('');
|
|
38
|
+
console.log(` ✓ added ${hostname} (${target})`);
|
|
39
|
+
console.log(` CNAME: ${hostname} → ${result.cnameTarget}`);
|
|
40
|
+
if (result.ownershipVerification?.name) {
|
|
41
|
+
console.log(` Ownership: ${result.ownershipVerification.type ?? 'TXT'} ${result.ownershipVerification.name} = ${result.ownershipVerification.value}`);
|
|
42
|
+
}
|
|
43
|
+
console.log('');
|
|
44
|
+
return { hostname, cnameTarget: result.cnameTarget };
|
|
45
|
+
},
|
|
46
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const FabricDomainsListInput: z.ZodObject<{
|
|
3
|
+
apiUrl: z.ZodOptional<z.ZodString>;
|
|
4
|
+
}, z.core.$strip>;
|
|
5
|
+
export declare const FabricDomainsListOutput: z.ZodObject<{
|
|
6
|
+
count: z.ZodNumber;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export declare const FabricDomainsList: import("../../../.pikku/pikku-types.gen.js").PikkuFunctionConfig<{
|
|
9
|
+
apiUrl?: string | undefined;
|
|
10
|
+
}, {
|
|
11
|
+
count: number;
|
|
12
|
+
}, "rpc" | "session", import("../../../.pikku/pikku-types.gen.js").PikkuFunctionSessionless<{
|
|
13
|
+
apiUrl?: string | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
count: number;
|
|
16
|
+
}, "rpc" | "session", import("../../../types/application-types.js").Services> | import("../../../.pikku/pikku-types.gen.js").PikkuFunction<{
|
|
17
|
+
apiUrl?: string | undefined;
|
|
18
|
+
}, {
|
|
19
|
+
count: number;
|
|
20
|
+
}, "rpc" | "session", import("../../../types/application-types.js").Services>, undefined, undefined>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { pikkuSessionlessFunc } from '../../../.pikku/pikku-types.gen.js';
|
|
3
|
+
import { findProjectConfig, resolveApiContext } from '../lib/config.js';
|
|
4
|
+
import { getFabricRPC } from '../lib/http.js';
|
|
5
|
+
export const FabricDomainsListInput = z.object({
|
|
6
|
+
apiUrl: z.string().optional(),
|
|
7
|
+
});
|
|
8
|
+
export const FabricDomainsListOutput = z.object({
|
|
9
|
+
count: z.number(),
|
|
10
|
+
});
|
|
11
|
+
export const FabricDomainsList = pikkuSessionlessFunc({
|
|
12
|
+
description: 'List custom domains for the linked project.',
|
|
13
|
+
input: FabricDomainsListInput,
|
|
14
|
+
output: FabricDomainsListOutput,
|
|
15
|
+
func: async (_services, { apiUrl: apiUrlOverride }) => {
|
|
16
|
+
const ctx = await resolveApiContext({ apiUrlOverride });
|
|
17
|
+
if (!ctx.token)
|
|
18
|
+
throw new Error('Not logged in. Run `pikku fabric login` first.');
|
|
19
|
+
const local = await findProjectConfig();
|
|
20
|
+
if (!local)
|
|
21
|
+
throw new Error('No fabric.config.json found. Run `pikku fabric link` first.');
|
|
22
|
+
const rpc = getFabricRPC({ apiUrl: ctx.apiUrl, token: ctx.token });
|
|
23
|
+
const stagesResult = await rpc.invoke('listStages', {
|
|
24
|
+
projectId: local.config.projectId,
|
|
25
|
+
});
|
|
26
|
+
const production = stagesResult.stages.find((s) => s.type === 'production');
|
|
27
|
+
if (!production) {
|
|
28
|
+
console.log('');
|
|
29
|
+
console.log(`Project: ${local.config.projectId}`);
|
|
30
|
+
console.log(' No production stage exists yet.');
|
|
31
|
+
console.log('');
|
|
32
|
+
return { count: 0 };
|
|
33
|
+
}
|
|
34
|
+
const result = await rpc.invoke('listStageCustomHostnames', {
|
|
35
|
+
stageId: production.stageId,
|
|
36
|
+
});
|
|
37
|
+
console.log('');
|
|
38
|
+
console.log(`Project: ${local.config.projectId}`);
|
|
39
|
+
if (result.hostnames.length === 0) {
|
|
40
|
+
console.log(' No custom domains attached.');
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
for (const h of result.hostnames) {
|
|
44
|
+
console.log(` ${h.hostname.padEnd(40)} ${h.target.padEnd(4)} ${h.status.padEnd(12)} CNAME → ${h.cnameTarget}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
console.log('');
|
|
48
|
+
return { count: result.hostnames.length };
|
|
49
|
+
},
|
|
50
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const FabricDomainsRemoveInput: z.ZodObject<{
|
|
3
|
+
hostname: z.ZodString;
|
|
4
|
+
apiUrl: z.ZodOptional<z.ZodString>;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export declare const FabricDomainsRemoveOutput: z.ZodObject<{
|
|
7
|
+
removed: z.ZodBoolean;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export declare const FabricDomainsRemove: import("../../../.pikku/pikku-types.gen.js").PikkuFunctionConfig<{
|
|
10
|
+
hostname: string;
|
|
11
|
+
apiUrl?: string | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
removed: boolean;
|
|
14
|
+
}, "rpc" | "session", import("../../../.pikku/pikku-types.gen.js").PikkuFunctionSessionless<{
|
|
15
|
+
hostname: string;
|
|
16
|
+
apiUrl?: string | undefined;
|
|
17
|
+
}, {
|
|
18
|
+
removed: boolean;
|
|
19
|
+
}, "rpc" | "session", import("../../../types/application-types.js").Services> | import("../../../.pikku/pikku-types.gen.js").PikkuFunction<{
|
|
20
|
+
hostname: string;
|
|
21
|
+
apiUrl?: string | undefined;
|
|
22
|
+
}, {
|
|
23
|
+
removed: boolean;
|
|
24
|
+
}, "rpc" | "session", import("../../../types/application-types.js").Services>, undefined, undefined>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { pikkuSessionlessFunc } from '../../../.pikku/pikku-types.gen.js';
|
|
3
|
+
import { findProjectConfig, resolveApiContext } from '../lib/config.js';
|
|
4
|
+
import { getFabricRPC } from '../lib/http.js';
|
|
5
|
+
export const FabricDomainsRemoveInput = z.object({
|
|
6
|
+
hostname: z.string(),
|
|
7
|
+
apiUrl: z.string().optional(),
|
|
8
|
+
});
|
|
9
|
+
export const FabricDomainsRemoveOutput = z.object({
|
|
10
|
+
removed: z.boolean(),
|
|
11
|
+
});
|
|
12
|
+
export const FabricDomainsRemove = pikkuSessionlessFunc({
|
|
13
|
+
description: 'Remove a custom domain from the production stage.',
|
|
14
|
+
input: FabricDomainsRemoveInput,
|
|
15
|
+
output: FabricDomainsRemoveOutput,
|
|
16
|
+
func: async (_services, { hostname, apiUrl: apiUrlOverride }) => {
|
|
17
|
+
const ctx = await resolveApiContext({ apiUrlOverride });
|
|
18
|
+
if (!ctx.token)
|
|
19
|
+
throw new Error('Not logged in. Run `pikku fabric login` first.');
|
|
20
|
+
const local = await findProjectConfig();
|
|
21
|
+
if (!local)
|
|
22
|
+
throw new Error('No fabric.config.json found. Run `pikku fabric link` first.');
|
|
23
|
+
const rpc = getFabricRPC({ apiUrl: ctx.apiUrl, token: ctx.token });
|
|
24
|
+
const stagesResult = await rpc.invoke('listStages', {
|
|
25
|
+
projectId: local.config.projectId,
|
|
26
|
+
});
|
|
27
|
+
const production = stagesResult.stages.find((s) => s.type === 'production');
|
|
28
|
+
if (!production)
|
|
29
|
+
throw new Error('No production stage found.');
|
|
30
|
+
const hostnamesResult = await rpc.invoke('listStageCustomHostnames', {
|
|
31
|
+
stageId: production.stageId,
|
|
32
|
+
});
|
|
33
|
+
const match = hostnamesResult.hostnames.find((h) => h.hostname === hostname.toLowerCase());
|
|
34
|
+
if (!match)
|
|
35
|
+
throw new Error(`Hostname "${hostname}" is not attached to this project.`);
|
|
36
|
+
await rpc.invoke('removeStageCustomHostname', {
|
|
37
|
+
customHostnameId: match.customHostnameId,
|
|
38
|
+
});
|
|
39
|
+
console.log('');
|
|
40
|
+
console.log(` ✓ removed ${hostname}`);
|
|
41
|
+
console.log('');
|
|
42
|
+
return { removed: true };
|
|
43
|
+
},
|
|
44
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const FabricErrorsInput: z.ZodObject<{
|
|
3
|
+
branch: z.ZodDefault<z.ZodString>;
|
|
4
|
+
function: z.ZodOptional<z.ZodString>;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export declare const FabricErrorsOutput: z.ZodObject<{
|
|
7
|
+
branch: z.ZodString;
|
|
8
|
+
errors: z.ZodArray<z.ZodAny>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
/**
|
|
11
|
+
* Recent error-level events for a stage — minimal and actionable, not a
|
|
12
|
+
* persisted/grouped error tracker. Each row carries a traceId so you can hand
|
|
13
|
+
* off to `pikku fabric trace <traceId>`. Reuses the existing logs RPC.
|
|
14
|
+
*/
|
|
15
|
+
export declare const FabricErrors: import("../../../.pikku/pikku-types.gen.js").PikkuFunctionConfig<{
|
|
16
|
+
branch: string;
|
|
17
|
+
function?: string | undefined;
|
|
18
|
+
}, {
|
|
19
|
+
branch: string;
|
|
20
|
+
errors: any[];
|
|
21
|
+
}, "rpc" | "session", import("../../../.pikku/pikku-types.gen.js").PikkuFunctionSessionless<{
|
|
22
|
+
branch: string;
|
|
23
|
+
function?: string | undefined;
|
|
24
|
+
}, {
|
|
25
|
+
branch: string;
|
|
26
|
+
errors: any[];
|
|
27
|
+
}, "rpc" | "session", import("../../../types/application-types.js").Services> | import("../../../.pikku/pikku-types.gen.js").PikkuFunction<{
|
|
28
|
+
branch: string;
|
|
29
|
+
function?: string | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
branch: string;
|
|
32
|
+
errors: any[];
|
|
33
|
+
}, "rpc" | "session", import("../../../types/application-types.js").Services>, undefined, undefined>;
|
|
34
|
+
type ErrorRow = {
|
|
35
|
+
timestamp: string;
|
|
36
|
+
functionName: string;
|
|
37
|
+
message: string;
|
|
38
|
+
traceId?: string;
|
|
39
|
+
};
|
|
40
|
+
export declare const renderErrors: (_s: unknown, { branch, errors }: {
|
|
41
|
+
branch: string;
|
|
42
|
+
errors: ErrorRow[];
|
|
43
|
+
}) => void;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { pikkuSessionlessFunc } from '../../../.pikku/pikku-types.gen.js';
|
|
3
|
+
import { resolveApiContext } from '../lib/config.js';
|
|
4
|
+
import { getFabricRPC } from '../lib/http.js';
|
|
5
|
+
import { table, removed, dim } from '../lib/output.js';
|
|
6
|
+
export const FabricErrorsInput = z.object({
|
|
7
|
+
branch: z.string().default('main'),
|
|
8
|
+
function: z.string().optional(),
|
|
9
|
+
});
|
|
10
|
+
export const FabricErrorsOutput = z.object({
|
|
11
|
+
branch: z.string(),
|
|
12
|
+
errors: z.array(z.any()),
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* Recent error-level events for a stage — minimal and actionable, not a
|
|
16
|
+
* persisted/grouped error tracker. Each row carries a traceId so you can hand
|
|
17
|
+
* off to `pikku fabric trace <traceId>`. Reuses the existing logs RPC.
|
|
18
|
+
*/
|
|
19
|
+
export const FabricErrors = pikkuSessionlessFunc({
|
|
20
|
+
description: 'Show recent error-level events for a branch (with traceIds)',
|
|
21
|
+
input: FabricErrorsInput,
|
|
22
|
+
output: FabricErrorsOutput,
|
|
23
|
+
func: async (_services, { branch, function: functionName }) => {
|
|
24
|
+
const ctx = await resolveApiContext();
|
|
25
|
+
if (!ctx.token)
|
|
26
|
+
throw new Error('Not logged in. Run `pikku fabric login` first.');
|
|
27
|
+
if (!ctx.projectId)
|
|
28
|
+
throw new Error('No fabric project linked. Run `pikku fabric link` first.');
|
|
29
|
+
const rpc = getFabricRPC({ apiUrl: ctx.apiUrl, token: ctx.token });
|
|
30
|
+
const { logs } = await rpc.invoke('getFabricLogsByStageKind', {
|
|
31
|
+
projectId: ctx.projectId,
|
|
32
|
+
branch,
|
|
33
|
+
level: 'error',
|
|
34
|
+
...(functionName ? { functionName } : {}),
|
|
35
|
+
});
|
|
36
|
+
return { branch, errors: logs };
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
export const renderErrors = (_s, { branch, errors }) => {
|
|
40
|
+
if (errors.length === 0) {
|
|
41
|
+
console.log(dim(`No errors for ${branch}.`));
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
console.log(table(['WHEN', 'FUNCTION', 'TRACE', 'MESSAGE'], errors.map((l) => [
|
|
45
|
+
l.timestamp,
|
|
46
|
+
l.functionName,
|
|
47
|
+
l.traceId ?? '',
|
|
48
|
+
removed(l.message.replace(/\s+/g, ' ').slice(0, 100)),
|
|
49
|
+
])));
|
|
50
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const FabricInitInput: z.ZodObject<{
|
|
3
|
+
repo: z.ZodString;
|
|
4
|
+
name: z.ZodOptional<z.ZodString>;
|
|
5
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
6
|
+
force: z.ZodOptional<z.ZodBoolean>;
|
|
7
|
+
apiUrl: z.ZodOptional<z.ZodString>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export declare const FabricInitOutput: z.ZodObject<{
|
|
10
|
+
projectId: z.ZodString;
|
|
11
|
+
projectSlug: z.ZodString;
|
|
12
|
+
path: z.ZodString;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
/**
|
|
15
|
+
* Adopt an existing repo as a fabric project. Calls `importProject` on
|
|
16
|
+
* fabric-api which inserts the project + stage rows synchronously, then
|
|
17
|
+
* writes `fabric.config.json` next to `pikku.config.json` so subsequent
|
|
18
|
+
* `pikku fabric deploy / secretsSet / rollback` commands resolve the link
|
|
19
|
+
* automatically.
|
|
20
|
+
*/
|
|
21
|
+
export declare const FabricInit: import("../../../.pikku/pikku-types.gen.js").PikkuFunctionConfig<{
|
|
22
|
+
repo: string;
|
|
23
|
+
name?: string | undefined;
|
|
24
|
+
branch?: string | undefined;
|
|
25
|
+
force?: boolean | undefined;
|
|
26
|
+
apiUrl?: string | undefined;
|
|
27
|
+
}, {
|
|
28
|
+
projectId: string;
|
|
29
|
+
projectSlug: string;
|
|
30
|
+
path: string;
|
|
31
|
+
}, "rpc" | "session", import("../../../.pikku/pikku-types.gen.js").PikkuFunctionSessionless<{
|
|
32
|
+
repo: string;
|
|
33
|
+
name?: string | undefined;
|
|
34
|
+
branch?: string | undefined;
|
|
35
|
+
force?: boolean | undefined;
|
|
36
|
+
apiUrl?: string | undefined;
|
|
37
|
+
}, {
|
|
38
|
+
projectId: string;
|
|
39
|
+
projectSlug: string;
|
|
40
|
+
path: string;
|
|
41
|
+
}, "rpc" | "session", import("../../../types/application-types.js").Services> | import("../../../.pikku/pikku-types.gen.js").PikkuFunction<{
|
|
42
|
+
repo: string;
|
|
43
|
+
name?: string | undefined;
|
|
44
|
+
branch?: string | undefined;
|
|
45
|
+
force?: boolean | undefined;
|
|
46
|
+
apiUrl?: string | undefined;
|
|
47
|
+
}, {
|
|
48
|
+
projectId: string;
|
|
49
|
+
projectSlug: string;
|
|
50
|
+
path: string;
|
|
51
|
+
}, "rpc" | "session", import("../../../types/application-types.js").Services>, undefined, undefined>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { pikkuSessionlessFunc } from '../../../.pikku/pikku-types.gen.js';
|
|
3
|
+
import { findProjectConfig, resolveApiContext, writeProjectConfig, } from '../lib/config.js';
|
|
4
|
+
import { getFabricRPC } from '../lib/http.js';
|
|
5
|
+
export const FabricInitInput = z.object({
|
|
6
|
+
repo: z.string(),
|
|
7
|
+
name: z.string().optional(),
|
|
8
|
+
branch: z.string().optional(),
|
|
9
|
+
force: z.boolean().optional(),
|
|
10
|
+
apiUrl: z.string().optional(),
|
|
11
|
+
});
|
|
12
|
+
export const FabricInitOutput = z.object({
|
|
13
|
+
projectId: z.string(),
|
|
14
|
+
projectSlug: z.string(),
|
|
15
|
+
path: z.string(),
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Adopt an existing repo as a fabric project. Calls `importProject` on
|
|
19
|
+
* fabric-api which inserts the project + stage rows synchronously, then
|
|
20
|
+
* writes `fabric.config.json` next to `pikku.config.json` so subsequent
|
|
21
|
+
* `pikku fabric deploy / secretsSet / rollback` commands resolve the link
|
|
22
|
+
* automatically.
|
|
23
|
+
*/
|
|
24
|
+
export const FabricInit = pikkuSessionlessFunc({
|
|
25
|
+
description: 'Adopt an existing repo as a fabric project (writes fabric.config.json).',
|
|
26
|
+
input: FabricInitInput,
|
|
27
|
+
output: FabricInitOutput,
|
|
28
|
+
func: async (_services, { repo, name, branch, force, apiUrl: apiUrlOverride }) => {
|
|
29
|
+
const ctx = await resolveApiContext({ apiUrlOverride });
|
|
30
|
+
if (!ctx.token)
|
|
31
|
+
throw new Error('Not logged in. Run `pikku fabric login` first.');
|
|
32
|
+
const existing = await findProjectConfig();
|
|
33
|
+
if (existing && !force) {
|
|
34
|
+
throw new Error(`Already linked: ${existing.config.projectId} at ${existing.path}. Pass --force to replace.`);
|
|
35
|
+
}
|
|
36
|
+
const rpc = getFabricRPC({ apiUrl: ctx.apiUrl, token: ctx.token });
|
|
37
|
+
const result = await rpc.invoke('importProject', {
|
|
38
|
+
repoUrl: repo,
|
|
39
|
+
name,
|
|
40
|
+
defaultBranch: branch,
|
|
41
|
+
});
|
|
42
|
+
const path = await writeProjectConfig(process.cwd(), {
|
|
43
|
+
projectId: result.projectId,
|
|
44
|
+
...(apiUrlOverride ? { apiUrl: apiUrlOverride } : {}),
|
|
45
|
+
});
|
|
46
|
+
console.log(`[fabric] imported ${result.projectSlug} (${result.projectId}) → ${path}`);
|
|
47
|
+
console.log(`[fabric] main stage: ${result.mainStageId}`);
|
|
48
|
+
return {
|
|
49
|
+
projectId: result.projectId,
|
|
50
|
+
projectSlug: result.projectSlug,
|
|
51
|
+
path,
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const FabricLinkInput: z.ZodObject<{
|
|
3
|
+
apiUrl: z.ZodOptional<z.ZodString>;
|
|
4
|
+
}, z.core.$strip>;
|
|
5
|
+
export declare const FabricLinkOutput: z.ZodObject<{
|
|
6
|
+
projectSlug: z.ZodString;
|
|
7
|
+
deploymentId: z.ZodString;
|
|
8
|
+
stageId: z.ZodString;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export declare const FabricLink: import("../../../.pikku/pikku-types.gen.js").PikkuFunctionConfig<{
|
|
11
|
+
apiUrl?: string | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
projectSlug: string;
|
|
14
|
+
deploymentId: string;
|
|
15
|
+
stageId: string;
|
|
16
|
+
}, "rpc" | "session", import("../../../.pikku/pikku-types.gen.js").PikkuFunctionSessionless<{
|
|
17
|
+
apiUrl?: string | undefined;
|
|
18
|
+
}, {
|
|
19
|
+
projectSlug: string;
|
|
20
|
+
deploymentId: string;
|
|
21
|
+
stageId: string;
|
|
22
|
+
}, "rpc" | "session", import("../../../types/application-types.js").Services> | import("../../../.pikku/pikku-types.gen.js").PikkuFunction<{
|
|
23
|
+
apiUrl?: string | undefined;
|
|
24
|
+
}, {
|
|
25
|
+
projectSlug: string;
|
|
26
|
+
deploymentId: string;
|
|
27
|
+
stageId: string;
|
|
28
|
+
}, "rpc" | "session", import("../../../types/application-types.js").Services>, undefined, undefined>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { pikkuSessionlessFunc } from '../../../.pikku/pikku-types.gen.js';
|
|
3
|
+
import { resolveApiContext, writeProjectConfig } from '../lib/config.js';
|
|
4
|
+
import { getFabricRPC } from '../lib/http.js';
|
|
5
|
+
import { assertDeploySafety, getRemoteUrl } from '../lib/git.js';
|
|
6
|
+
export const FabricLinkInput = z.object({
|
|
7
|
+
apiUrl: z.string().optional(),
|
|
8
|
+
});
|
|
9
|
+
export const FabricLinkOutput = z.object({
|
|
10
|
+
projectSlug: z.string(),
|
|
11
|
+
deploymentId: z.string(),
|
|
12
|
+
stageId: z.string(),
|
|
13
|
+
});
|
|
14
|
+
const GITHUB_POLL_INTERVAL_MS = 2000;
|
|
15
|
+
const GITHUB_POLL_TIMEOUT_MS = 5 * 60 * 1000;
|
|
16
|
+
export const FabricLink = pikkuSessionlessFunc({
|
|
17
|
+
description: 'Register the current git repo as a fabric project and queue an initial deploy.',
|
|
18
|
+
input: FabricLinkInput,
|
|
19
|
+
output: FabricLinkOutput,
|
|
20
|
+
func: async (_services, { apiUrl: apiUrlOverride }) => {
|
|
21
|
+
const ctx = await resolveApiContext({ apiUrlOverride });
|
|
22
|
+
if (!ctx.token) {
|
|
23
|
+
throw new Error('Not logged in. Run `pikku fabric login` first.');
|
|
24
|
+
}
|
|
25
|
+
const remoteUrl = await getRemoteUrl();
|
|
26
|
+
const safety = await assertDeploySafety();
|
|
27
|
+
const rpc = getFabricRPC({ apiUrl: ctx.apiUrl, token: ctx.token });
|
|
28
|
+
// Only check GitHub App installation for github.com repos.
|
|
29
|
+
// Gitea (local dev) and other hosts use shared tokens — no App needed.
|
|
30
|
+
const isGithub = /github\.com/i.test(remoteUrl);
|
|
31
|
+
if (isGithub) {
|
|
32
|
+
const ghInstall = await rpc.invoke('checkGithubInstall', {});
|
|
33
|
+
if (!ghInstall.installed) {
|
|
34
|
+
if (!ghInstall.installUrl) {
|
|
35
|
+
throw new Error('GitHub App is not configured on this fabric deployment.');
|
|
36
|
+
}
|
|
37
|
+
console.log('');
|
|
38
|
+
console.log(' GitHub App not installed. Connect GitHub to continue:');
|
|
39
|
+
console.log('');
|
|
40
|
+
console.log(` ${ghInstall.installUrl}`);
|
|
41
|
+
console.log('');
|
|
42
|
+
console.log(' Waiting for GitHub App installation...');
|
|
43
|
+
const deadline = Date.now() + GITHUB_POLL_TIMEOUT_MS;
|
|
44
|
+
let installed = false;
|
|
45
|
+
while (Date.now() < deadline) {
|
|
46
|
+
await new Promise((r) => setTimeout(r, GITHUB_POLL_INTERVAL_MS));
|
|
47
|
+
const check = await rpc.invoke('checkGithubInstall', {});
|
|
48
|
+
if (check.installed) {
|
|
49
|
+
installed = true;
|
|
50
|
+
console.log(` GitHub connected (${check.accountLogin})`);
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (!installed) {
|
|
55
|
+
throw new Error('Timed out waiting for GitHub App installation. Run `pikku fabric link` again after installing.');
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const project = await rpc.invoke('importProject', { repoUrl: remoteUrl });
|
|
60
|
+
await writeProjectConfig(process.cwd(), {
|
|
61
|
+
projectId: project.projectId,
|
|
62
|
+
...(apiUrlOverride ? { apiUrl: apiUrlOverride } : {}),
|
|
63
|
+
});
|
|
64
|
+
console.log(`[fabric] linked ${project.projectSlug}`);
|
|
65
|
+
const deploy = await rpc.invoke('deployByStageKind', {
|
|
66
|
+
projectId: project.projectId,
|
|
67
|
+
branch: safety.branch,
|
|
68
|
+
expectedHeadSha: safety.headSha,
|
|
69
|
+
});
|
|
70
|
+
console.log(`[fabric] queued deploy: branch=${safety.branch} deploymentId=${deploy.deploymentId}`);
|
|
71
|
+
return {
|
|
72
|
+
projectSlug: project.projectSlug,
|
|
73
|
+
deploymentId: deploy.deploymentId,
|
|
74
|
+
stageId: deploy.stageId,
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
});
|