@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,177 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pikku-trigger
|
|
3
|
+
description: 'Use when adding event-driven functions that respond to system events like Redis pub/sub, PostgreSQL LISTEN/NOTIFY, or custom event sources. Covers wireTrigger, wireTriggerSource, and pikkuTriggerFunc.
|
|
4
|
+
TRIGGER when: code uses wireTrigger/wireTriggerSource/pikkuTriggerFunc, user asks about event-driven functions, Redis pub/sub, PostgreSQL LISTEN/NOTIFY, or reacting to external events.
|
|
5
|
+
DO NOT TRIGGER when: user asks about scheduled tasks (use pikku-cron) or background job queues (use pikku-queue).'
|
|
6
|
+
installGroups: [core]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Pikku Trigger Wiring
|
|
10
|
+
|
|
11
|
+
## Agent Operating Procedure
|
|
12
|
+
|
|
13
|
+
Use this skill as an execution checklist, not reference material.
|
|
14
|
+
|
|
15
|
+
1. Discover before editing. Prefer OpenCode tools such as `pikku-meta` when available; otherwise run the relevant `pikku meta ... --json` command and inspect only the focused output you need.
|
|
16
|
+
2. Identify the source files that own the behavior. Do not start by reading generated output, `.pikku`, `node_modules`, vendored packages, or broad build artifacts.
|
|
17
|
+
3. Make the smallest source change that satisfies the task. Keep generated files generated, and avoid hand-editing SDKs, schema output, or typegen.
|
|
18
|
+
4. Validate with the narrowest relevant command first, then run `pikku-verify` or `pikku all` when functions, wirings, schemas, or generated clients may have changed.
|
|
19
|
+
5. If validation fails, fix the source cause and rerun validation. Do not paper over generated errors by editing generated files.
|
|
20
|
+
|
|
21
|
+
Wire Pikku functions to fire when external events occur. Triggers connect event sources (Redis pub/sub, PostgreSQL LISTEN/NOTIFY, polling, webhooks) to Pikku functions.
|
|
22
|
+
|
|
23
|
+
## Before You Start
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pikku info functions --verbose # See existing functions and their types
|
|
27
|
+
pikku info tags --verbose # Understand project organization
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
See `pikku-concepts` for the core mental model.
|
|
31
|
+
|
|
32
|
+
## API Reference
|
|
33
|
+
|
|
34
|
+
### `wireTrigger(config)`
|
|
35
|
+
|
|
36
|
+
Define the target function that handles trigger events:
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { wireTrigger } from '@pikku/core/trigger'
|
|
40
|
+
|
|
41
|
+
wireTrigger({
|
|
42
|
+
name: string, // Trigger name (matches source)
|
|
43
|
+
func: PikkuFunc, // Function to call when event fires
|
|
44
|
+
})
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### `wireTriggerSource(config)`
|
|
48
|
+
|
|
49
|
+
Define the event source that fires triggers:
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import { wireTriggerSource } from '@pikku/core/trigger'
|
|
53
|
+
|
|
54
|
+
wireTriggerSource({
|
|
55
|
+
name: string, // Must match wireTrigger name
|
|
56
|
+
func: PikkuTriggerFunc, // Source function (sets up listener)
|
|
57
|
+
input: object, // Configuration for the source
|
|
58
|
+
})
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### `pikkuTriggerFunc<TInput, TEvent>`
|
|
62
|
+
|
|
63
|
+
Define a trigger source function. Returns a cleanup function.
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
import { pikkuTriggerFunc } from '#pikku'
|
|
67
|
+
|
|
68
|
+
const source = pikkuTriggerFunc<
|
|
69
|
+
InputType, // Configuration input
|
|
70
|
+
EventType // Shape of events it emits
|
|
71
|
+
>(async (services, input, { trigger }) => {
|
|
72
|
+
// Set up listener...
|
|
73
|
+
trigger.invoke(eventData) // Fire the trigger
|
|
74
|
+
|
|
75
|
+
// Return cleanup function
|
|
76
|
+
return async () => {
|
|
77
|
+
/* teardown */
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Usage Patterns
|
|
83
|
+
|
|
84
|
+
### Redis Pub/Sub Source
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
const redisSubscribe = pikkuTriggerFunc<
|
|
88
|
+
{ channels: string[] },
|
|
89
|
+
{ channel: string; message: any }
|
|
90
|
+
>(async ({ redis }, { channels }, { trigger }) => {
|
|
91
|
+
const subscriber = redis.duplicate()
|
|
92
|
+
|
|
93
|
+
subscriber.on('message', (channel, message) => {
|
|
94
|
+
trigger.invoke({ channel, message: JSON.parse(message) })
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
await subscriber.subscribe(...channels)
|
|
98
|
+
|
|
99
|
+
return async () => {
|
|
100
|
+
await subscriber.unsubscribe()
|
|
101
|
+
await subscriber.quit()
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
// Target function
|
|
106
|
+
const onOrderEvent = pikkuSessionlessFunc({
|
|
107
|
+
title: 'On Order Event',
|
|
108
|
+
func: async ({ db, logger }, { channel, message }) => {
|
|
109
|
+
logger.info(`Order event on ${channel}`, message)
|
|
110
|
+
await db.processOrderEvent(message)
|
|
111
|
+
},
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
// Wire them together
|
|
115
|
+
wireTrigger({
|
|
116
|
+
name: 'order-events',
|
|
117
|
+
func: onOrderEvent,
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
wireTriggerSource({
|
|
121
|
+
name: 'order-events',
|
|
122
|
+
func: redisSubscribe,
|
|
123
|
+
input: { channels: ['orders:created', 'orders:updated'] },
|
|
124
|
+
})
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Triggers vs Queues
|
|
128
|
+
|
|
129
|
+
| Feature | Trigger | Queue |
|
|
130
|
+
| ----------- | ---------------------------------- | ------------------------------ |
|
|
131
|
+
| Execution | Synchronous, in-process | Async, distributed |
|
|
132
|
+
| Reliability | At-most-once | At-least-once (with retries) |
|
|
133
|
+
| Use case | React to events immediately | Reliable background processing |
|
|
134
|
+
| Source | External systems (Redis, PG, etc.) | Enqueued programmatically |
|
|
135
|
+
|
|
136
|
+
Use triggers for real-time reactions. Use queues for reliable, retryable background work.
|
|
137
|
+
|
|
138
|
+
## Complete Example
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
// functions/triggers.functions.ts
|
|
142
|
+
const pgListen = pikkuTriggerFunc<{ channel: string }, { payload: any }>(
|
|
143
|
+
async ({ db }, { channel }, { trigger }) => {
|
|
144
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(channel)) {
|
|
145
|
+
throw new Error(`Invalid channel name: ${channel}`)
|
|
146
|
+
}
|
|
147
|
+
const client = await db.pool.connect()
|
|
148
|
+
|
|
149
|
+
client.on('notification', (msg) => {
|
|
150
|
+
trigger.invoke({ payload: JSON.parse(msg.payload) })
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
await client.query(`LISTEN ${channel}`)
|
|
154
|
+
|
|
155
|
+
return async () => {
|
|
156
|
+
await client.query(`UNLISTEN ${channel}`)
|
|
157
|
+
client.release()
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
const onUserCreated = pikkuSessionlessFunc({
|
|
163
|
+
title: 'On User Created',
|
|
164
|
+
func: async ({ emailService, logger }, { payload }) => {
|
|
165
|
+
logger.info('New user created', { userId: payload.id })
|
|
166
|
+
await emailService.sendWelcome(payload.email)
|
|
167
|
+
},
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
// wirings/triggers.wiring.ts
|
|
171
|
+
wireTrigger({ name: 'user-created', func: onUserCreated })
|
|
172
|
+
wireTriggerSource({
|
|
173
|
+
name: 'user-created',
|
|
174
|
+
func: pgListen,
|
|
175
|
+
input: { channel: 'user_created' },
|
|
176
|
+
})
|
|
177
|
+
```
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pikku-versioning
|
|
3
|
+
description: 'Use when versioning Pikku function contracts, detecting breaking changes, or managing API backward compatibility. Covers the version property, versions.pikku.json manifest, contract hashing, and CI integration.
|
|
4
|
+
TRIGGER when: code uses version: on a pikkuFunc, user asks about API versioning, breaking changes, contract hashes, backward compatibility, or "pikku versions" CLI commands.
|
|
5
|
+
DO NOT TRIGGER when: user asks about secrets/variables/OAuth2 (use pikku-config) or general function definitions (use pikku-concepts).'
|
|
6
|
+
installGroups: [core]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Pikku Function Versioning
|
|
10
|
+
|
|
11
|
+
## Agent Operating Procedure
|
|
12
|
+
|
|
13
|
+
Use this skill as an execution checklist, not reference material.
|
|
14
|
+
|
|
15
|
+
1. Discover before editing. Prefer OpenCode tools such as `pikku-meta` when available; otherwise run the relevant `pikku meta ... --json` command and inspect only the focused output you need.
|
|
16
|
+
2. Identify the source files that own the behavior. Do not start by reading generated output, `.pikku`, `node_modules`, vendored packages, or broad build artifacts.
|
|
17
|
+
3. Make the smallest source change that satisfies the task. Keep generated files generated, and avoid hand-editing SDKs, schema output, or typegen.
|
|
18
|
+
4. Validate with the narrowest relevant command first, then run `pikku-verify` or `pikku all` when functions, wirings, schemas, or generated clients may have changed.
|
|
19
|
+
5. If validation fails, fix the source cause and rerun validation. Do not paper over generated errors by editing generated files.
|
|
20
|
+
|
|
21
|
+
Track and protect function contracts across releases. Pikku hashes each function's input/output schema into a manifest so you can detect breaking changes before they ship.
|
|
22
|
+
|
|
23
|
+
## Before You Start
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pikku info functions --verbose # See existing functions and their versions
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
See `pikku-concepts` for the core mental model.
|
|
30
|
+
|
|
31
|
+
## Function Versioning
|
|
32
|
+
|
|
33
|
+
When you need to introduce a breaking change, keep the old function as a pinned version and let the new one become the latest.
|
|
34
|
+
|
|
35
|
+
**The pattern:**
|
|
36
|
+
|
|
37
|
+
1. Create a new file `my-function-v1.function.ts` — export a variable with the `V1` suffix
|
|
38
|
+
2. Set `override: 'myFunction'` — this is the contract key the manifest groups under
|
|
39
|
+
3. Set `version: 1` — pins this as version 1 of the contract
|
|
40
|
+
4. The existing `my-function.function.ts` (no `version:` field) automatically becomes the latest version
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
// my-function-v1.function.ts — old contract, kept for running workflows/agents
|
|
44
|
+
export const getBookV1 = pikkuFunc({
|
|
45
|
+
override: 'getBook', // REQUIRED — links this to the 'getBook' contract family
|
|
46
|
+
version: 1,
|
|
47
|
+
input: z.object({ bookId: z.string() }),
|
|
48
|
+
output: z.object({ title: z.string() }),
|
|
49
|
+
func: async ({ db }, { bookId }) => {
|
|
50
|
+
return db.getBook(bookId)
|
|
51
|
+
},
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
// my-function.function.ts — latest contract, no version: field
|
|
55
|
+
export const getBook = pikkuFunc({
|
|
56
|
+
input: z.object({
|
|
57
|
+
bookId: z.string(),
|
|
58
|
+
format: z.enum(['full', 'summary']),
|
|
59
|
+
}),
|
|
60
|
+
output: z.object({
|
|
61
|
+
title: z.string(),
|
|
62
|
+
author: z.string(),
|
|
63
|
+
isbn: z.string(),
|
|
64
|
+
}),
|
|
65
|
+
func: async ({ db }, { bookId, format }) => {
|
|
66
|
+
return db.getBook(bookId, format)
|
|
67
|
+
},
|
|
68
|
+
})
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Why `override` is required:** The manifest groups functions by a shared contract key. Without `override: 'getBook'`, `getBookV1` is stored internally as `getBookV1@v1` (key: `getBookV1`), which is a different contract family from `getBook`. With `override: 'getBook'`, it becomes `getBook@v1` (key: `getBook`), which groups with the unversioned `getBook` — and the unversioned one is automatically promoted to `getBook@v2`.
|
|
72
|
+
|
|
73
|
+
## Version Manifest (`versions.pikku.json`)
|
|
74
|
+
|
|
75
|
+
Pikku tracks contract hashes to detect breaking changes:
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"manifestVersion": 1,
|
|
80
|
+
"contracts": {
|
|
81
|
+
"createTodo": {
|
|
82
|
+
"latest": 1,
|
|
83
|
+
"versions": {
|
|
84
|
+
"1": { "inputHash": "a1b2c3d4", "outputHash": "e5f6a7b8" }
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"getTodos": {
|
|
88
|
+
"latest": 2,
|
|
89
|
+
"versions": {
|
|
90
|
+
"1": { "inputHash": "i9j0k1l2", "outputHash": "m3n4o5p6" },
|
|
91
|
+
"2": { "inputHash": "q7r8s9t0", "outputHash": "u1v2w3x4" }
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Each hash is derived from the function's input and output schemas plus the contract key. If a schema changes without a version bump, `pikku versions check` will fail.
|
|
99
|
+
|
|
100
|
+
## CLI Commands
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
npx pikku versions init # Initialize versioning manifest (run once)
|
|
104
|
+
npx pikku versions check # Detect contract changes (use in CI)
|
|
105
|
+
npx pikku versions update # Update contract hashes after version bump
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Workflow:**
|
|
109
|
+
|
|
110
|
+
1. `pikku versions init` — run once to create `versions.pikku.json`
|
|
111
|
+
2. Develop normally — add/modify functions
|
|
112
|
+
3. `pikku versions check` — CI catches unversioned breaking changes
|
|
113
|
+
4. If intentional: create `my-function-v1.function.ts` with `override` + `version: 1`, then `pikku versions update`
|
|
114
|
+
|
|
115
|
+
## CI Integration
|
|
116
|
+
|
|
117
|
+
```yaml
|
|
118
|
+
# .github/workflows/ci.yml
|
|
119
|
+
name: CI
|
|
120
|
+
on: [push, pull_request]
|
|
121
|
+
|
|
122
|
+
jobs:
|
|
123
|
+
check:
|
|
124
|
+
runs-on: ubuntu-latest
|
|
125
|
+
steps:
|
|
126
|
+
- uses: actions/checkout@v4
|
|
127
|
+
- run: npm ci
|
|
128
|
+
- run: npx pikku versions check
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Complete Example
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
// create-todo-v1.function.ts — v1 locked contract
|
|
135
|
+
export const createTodoV1 = pikkuSessionlessFunc({
|
|
136
|
+
override: 'createTodo', // groups under 'createTodo' contract family
|
|
137
|
+
version: 1,
|
|
138
|
+
input: z.object({ title: z.string() }),
|
|
139
|
+
output: z.object({ id: z.string(), title: z.string() }),
|
|
140
|
+
func: async ({ todoStore }, { title }) => todoStore.add(title),
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
// create-todo.function.ts — v2 (latest), called by default
|
|
144
|
+
export const createTodo = pikkuSessionlessFunc({
|
|
145
|
+
input: z.object({
|
|
146
|
+
title: z.string(),
|
|
147
|
+
priority: z.enum(['low', 'medium', 'high']),
|
|
148
|
+
}),
|
|
149
|
+
output: z.object({
|
|
150
|
+
id: z.string(),
|
|
151
|
+
title: z.string(),
|
|
152
|
+
priority: z.string(),
|
|
153
|
+
}),
|
|
154
|
+
func: async ({ todoStore }, { title, priority }) =>
|
|
155
|
+
todoStore.add(title, priority),
|
|
156
|
+
})
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Result in manifest:
|
|
160
|
+
|
|
161
|
+
```json
|
|
162
|
+
"createTodo": {
|
|
163
|
+
"latest": 2,
|
|
164
|
+
"versions": {
|
|
165
|
+
"1": { "inputHash": "...", "outputHash": "..." },
|
|
166
|
+
"2": { "inputHash": "...", "outputHash": "..." }
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
```
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pikku-websocket
|
|
3
|
+
description: 'Use when adding real-time features, WebSocket channels, live updates, chat, or pub/sub to a Pikku app. Covers wireChannel, action routing, auth, EventHub pub/sub, channel middleware, and generated WebSocket client.
|
|
4
|
+
TRIGGER when: code uses wireChannel, user asks about WebSocket, real-time, live updates, chat, pub/sub, or the generated WebSocket client.
|
|
5
|
+
DO NOT TRIGGER when: user asks about HTTP/REST (use pikku-http), SSE (use pikku-http with sse: true), or WebSocket deployment specifics (use pikku-deploy-uws).'
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Pikku WebSocket Wiring
|
|
9
|
+
|
|
10
|
+
## Agent Operating Procedure
|
|
11
|
+
|
|
12
|
+
Use this skill as an execution checklist, not reference material.
|
|
13
|
+
|
|
14
|
+
1. Discover before editing. Prefer OpenCode tools such as `pikku-meta` when available; otherwise run the relevant `pikku meta ... --json` command and inspect only the focused output you need.
|
|
15
|
+
2. Identify the source files that own the behavior. Do not start by reading generated output, `.pikku`, `node_modules`, vendored packages, or broad build artifacts.
|
|
16
|
+
3. Make the smallest source change that satisfies the task. Keep generated files generated, and avoid hand-editing SDKs, schema output, or typegen.
|
|
17
|
+
4. Validate with the narrowest relevant command first, then run `pikku-verify` or `pikku all` when functions, wirings, schemas, or generated clients may have changed.
|
|
18
|
+
5. If validation fails, fix the source cause and rerun validation. Do not paper over generated errors by editing generated files.
|
|
19
|
+
|
|
20
|
+
Wire Pikku functions to WebSocket channels with structured message routing, auth per-action, pub/sub via EventHub, and auto-generated type-safe clients.
|
|
21
|
+
|
|
22
|
+
## Before You Start
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pikku info functions --verbose # See existing functions and their types
|
|
26
|
+
pikku info tags --verbose # Understand project organization
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Follow existing patterns. See `pikku-concepts` for the core mental model.
|
|
30
|
+
|
|
31
|
+
## API Reference
|
|
32
|
+
|
|
33
|
+
### `wireChannel(config)`
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
import { wireChannel } from '@pikku/core/channel'
|
|
37
|
+
|
|
38
|
+
wireChannel({
|
|
39
|
+
name: string, // Channel name (e.g. 'todos')
|
|
40
|
+
onConnect: async () => {}, // Called when client connects
|
|
41
|
+
onDisconnect: async () => {}, // Called when client disconnects
|
|
42
|
+
onMessageWiring: { // Action → function mapping
|
|
43
|
+
[actionName: string]: {
|
|
44
|
+
func: PikkuFunc,
|
|
45
|
+
auth?: boolean, // Override channel-level auth
|
|
46
|
+
permissions?: Record<string, PikkuPermission | PikkuPermission[]>,
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
channelMiddleware?: PikkuChannelMiddleware[],
|
|
50
|
+
})
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### `pikkuChannelMiddleware(fn)`
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
import { pikkuChannelMiddleware } from '@pikku/core'
|
|
57
|
+
|
|
58
|
+
const middleware = pikkuChannelMiddleware(async (services, event, next) => {
|
|
59
|
+
// Transform or filter events before/after
|
|
60
|
+
await next(event) // Pass modified event, or next(null) to drop
|
|
61
|
+
})
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### `addChannelMiddleware(domain, middlewares)`
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
addChannelMiddleware('todos', [addTimestamp, filterSensitive])
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Usage Patterns
|
|
71
|
+
|
|
72
|
+
### Basic Channel
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
wireChannel({
|
|
76
|
+
name: 'todos',
|
|
77
|
+
onConnect: async () => {},
|
|
78
|
+
onDisconnect: async () => {},
|
|
79
|
+
onMessageWiring: {
|
|
80
|
+
create: { func: createTodo },
|
|
81
|
+
list: { func: listTodos, auth: false },
|
|
82
|
+
},
|
|
83
|
+
})
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Action Routing with Auth
|
|
87
|
+
|
|
88
|
+
Clients send `{ action: 'create', data: {...} }`. Pikku routes to the matching function.
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
const authenticate = pikkuFunc({
|
|
92
|
+
title: 'Authenticate',
|
|
93
|
+
func: async ({ setSession }, { token }) => {
|
|
94
|
+
const session = await verifyJWT(token)
|
|
95
|
+
setSession(session)
|
|
96
|
+
return { success: true }
|
|
97
|
+
},
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
wireChannel({
|
|
101
|
+
name: 'todos',
|
|
102
|
+
onConnect: async () => {},
|
|
103
|
+
onDisconnect: async () => {},
|
|
104
|
+
onMessageWiring: {
|
|
105
|
+
auth: { func: authenticate, auth: false }, // No session required
|
|
106
|
+
subscribe: { func: subscribeTodos }, // Session required
|
|
107
|
+
create: { func: createTodo },
|
|
108
|
+
},
|
|
109
|
+
})
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Pub/Sub with EventHub
|
|
113
|
+
|
|
114
|
+
Use EventHub for real-time broadcasting across connections:
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
wireChannel({
|
|
118
|
+
name: 'todos',
|
|
119
|
+
onConnect: async ({ eventHub, channel }) => {
|
|
120
|
+
eventHub.subscribe('todos:updated', (data) => {
|
|
121
|
+
channel.send(data)
|
|
122
|
+
})
|
|
123
|
+
},
|
|
124
|
+
onDisconnect: async () => {},
|
|
125
|
+
onMessageWiring: {
|
|
126
|
+
create: {
|
|
127
|
+
func: pikkuFunc({
|
|
128
|
+
title: 'Create Todo',
|
|
129
|
+
func: async ({ db, eventHub }, { text }) => {
|
|
130
|
+
const todo = await db.createTodo({ text })
|
|
131
|
+
eventHub.publish('todos:updated', {
|
|
132
|
+
event: 'created',
|
|
133
|
+
todo,
|
|
134
|
+
})
|
|
135
|
+
return { todo }
|
|
136
|
+
},
|
|
137
|
+
}),
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
})
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Channel Middleware
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
const addTimestamp = pikkuChannelMiddleware(
|
|
147
|
+
async ({ logger }, event, next) => {
|
|
148
|
+
logger.info({ phase: 'before-send', event })
|
|
149
|
+
await next({ ...event, sentAt: Date.now() })
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
const filterSensitive = pikkuChannelMiddleware(
|
|
154
|
+
async (_services, event, next) => {
|
|
155
|
+
if (event.internal) return await next(null) // Drop event
|
|
156
|
+
await next(event)
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
// Apply globally to a domain
|
|
161
|
+
addChannelMiddleware('todos', [addTimestamp, filterSensitive])
|
|
162
|
+
|
|
163
|
+
// Or inline on wiring
|
|
164
|
+
wireChannel({
|
|
165
|
+
name: 'todos',
|
|
166
|
+
channelMiddleware: [addTimestamp],
|
|
167
|
+
onConnect: async () => {},
|
|
168
|
+
onDisconnect: async () => {},
|
|
169
|
+
onMessageWiring: { ... },
|
|
170
|
+
})
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Generated WebSocket Client
|
|
174
|
+
|
|
175
|
+
After `npx pikku prebuild`:
|
|
176
|
+
|
|
177
|
+
```typescript
|
|
178
|
+
import { PikkuWebSocket } from '.pikku/pikku-websocket.gen.js'
|
|
179
|
+
|
|
180
|
+
const pikku = new PikkuWebSocket(ws)
|
|
181
|
+
const todosRoute = pikku.getRoute('todos')
|
|
182
|
+
|
|
183
|
+
// Send action (type-safe)
|
|
184
|
+
const result = await todosRoute.send('create', { text: 'Buy milk' })
|
|
185
|
+
|
|
186
|
+
// Subscribe to events
|
|
187
|
+
todosRoute.subscribe('todos:updated', (data) => {
|
|
188
|
+
console.log(data.event, data.todo)
|
|
189
|
+
})
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Complete Example
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
// functions/chat.functions.ts
|
|
196
|
+
export const authenticate = pikkuFunc({
|
|
197
|
+
title: 'Authenticate',
|
|
198
|
+
func: async ({ jwt }, { token }, { setSession }) => {
|
|
199
|
+
const payload = await jwt.verify(token)
|
|
200
|
+
setSession({ userId: payload.userId })
|
|
201
|
+
return { success: true }
|
|
202
|
+
},
|
|
203
|
+
})
|
|
204
|
+
|
|
205
|
+
export const sendMessage = pikkuFunc({
|
|
206
|
+
title: 'Send Message',
|
|
207
|
+
func: async ({ db, eventHub }, { text }, { session }) => {
|
|
208
|
+
const message = await db.createMessage({
|
|
209
|
+
text,
|
|
210
|
+
userId: session.userId,
|
|
211
|
+
})
|
|
212
|
+
eventHub.publish('chat:message', { message })
|
|
213
|
+
return { message }
|
|
214
|
+
},
|
|
215
|
+
})
|
|
216
|
+
|
|
217
|
+
export const listMessages = pikkuSessionlessFunc({
|
|
218
|
+
title: 'List Messages',
|
|
219
|
+
func: async ({ db }, { limit }) => {
|
|
220
|
+
return { messages: await db.listMessages(limit) }
|
|
221
|
+
},
|
|
222
|
+
})
|
|
223
|
+
|
|
224
|
+
// wirings/chat.channel.ts
|
|
225
|
+
wireChannel({
|
|
226
|
+
name: 'chat',
|
|
227
|
+
onConnect: async ({ eventHub, channel }) => {
|
|
228
|
+
eventHub.subscribe('chat:message', (data) => {
|
|
229
|
+
channel.send(data)
|
|
230
|
+
})
|
|
231
|
+
},
|
|
232
|
+
onDisconnect: async () => {},
|
|
233
|
+
onMessageWiring: {
|
|
234
|
+
auth: { func: authenticate, auth: false },
|
|
235
|
+
send: { func: sendMessage },
|
|
236
|
+
history: { func: listMessages, auth: false },
|
|
237
|
+
},
|
|
238
|
+
})
|
|
239
|
+
```
|