@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,283 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pikku-workflow
|
|
3
|
+
description: 'Use when building multi-step workflows, state machines, or orchestration pipelines with Pikku. Covers pikkuWorkflowFunc, workflow steps (do, sleep, suspend), graph workflows, and HTTP wiring.
|
|
4
|
+
TRIGGER when: code uses pikkuWorkflowFunc/pikkuWorkflowGraph, user asks about workflows, multi-step processes, durable execution, suspend/resume, or DAG orchestration.
|
|
5
|
+
DO NOT TRIGGER when: user asks about simple background jobs (use pikku-queue) or scheduled tasks (use pikku-cron).'
|
|
6
|
+
installGroups: [core]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Pikku Workflow 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
|
+
Build durable, multi-step workflows with automatic retry, sleep, suspend/resume, and parallel execution. Steps are cached for replay safety.
|
|
22
|
+
|
|
23
|
+
## Before You Start
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pikku info functions --verbose # See existing functions that can be workflow steps
|
|
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
|
+
### `pikkuWorkflowFunc<TInput, TOutput>(fn)`
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { pikkuWorkflowFunc } from '#pikku'
|
|
38
|
+
|
|
39
|
+
const myWorkflow = pikkuWorkflowFunc<InputType, OutputType>(
|
|
40
|
+
async (services, data, { workflow }) => {
|
|
41
|
+
// workflow.do(), workflow.sleep(), workflow.suspend()
|
|
42
|
+
return result
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Workflow Step Types
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
// RPC step — execute a Pikku function as a queue job
|
|
51
|
+
// workflow.do(stepName, funcName, data, options?)
|
|
52
|
+
const result = await workflow.do(
|
|
53
|
+
'Create profile',
|
|
54
|
+
'createUserProfile',
|
|
55
|
+
{
|
|
56
|
+
email: data.email,
|
|
57
|
+
},
|
|
58
|
+
{ retries: 3, retryDelay: '1s' }
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
// Inline step — immediate execution, cached for replay
|
|
62
|
+
// workflow.do(stepName, asyncFn)
|
|
63
|
+
const result = await workflow.do('Generate message', async () => {
|
|
64
|
+
return `Welcome, ${data.email}!`
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
// Sleep — durable pause (duration: '5min', '1h', '30s', '1d')
|
|
68
|
+
await workflow.sleep('Wait 5 minutes', '5min')
|
|
69
|
+
|
|
70
|
+
// Suspend — pause until externally resumed
|
|
71
|
+
await workflow.suspend('Awaiting approval')
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### `pikkuWorkflowGraph(config)` — DAG Workflows
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import { pikkuWorkflowGraph } from '#pikku'
|
|
78
|
+
|
|
79
|
+
pikkuWorkflowGraph({
|
|
80
|
+
description: 'Onboard a new user',
|
|
81
|
+
nodes: {
|
|
82
|
+
createProfile: 'createUserProfile', // nodeName → Pikku function name
|
|
83
|
+
sendWelcome: 'sendEmail',
|
|
84
|
+
},
|
|
85
|
+
config: {
|
|
86
|
+
createProfile: {
|
|
87
|
+
next: ['sendWelcome'], // Nodes to run after this one (parallel)
|
|
88
|
+
},
|
|
89
|
+
sendWelcome: {
|
|
90
|
+
input: (ref) => ({
|
|
91
|
+
// Transform input using refs to prior node outputs
|
|
92
|
+
to: ref('createProfile', 'email'),
|
|
93
|
+
subject: 'Welcome!',
|
|
94
|
+
}),
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
})
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### HTTP Workflow Wiring
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
// Start a workflow
|
|
104
|
+
wireHTTP({
|
|
105
|
+
method: 'post',
|
|
106
|
+
route: '/workflow/onboard',
|
|
107
|
+
func: workflowStart('workflowName'),
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
// Execute workflow steps (called by orchestrator)
|
|
111
|
+
wireHTTP({
|
|
112
|
+
method: 'post',
|
|
113
|
+
route: '/workflow/onboard/run',
|
|
114
|
+
func: workflow('workflowName'),
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
// Check workflow status
|
|
118
|
+
wireHTTP({
|
|
119
|
+
method: 'get',
|
|
120
|
+
route: '/workflow/status/:runId',
|
|
121
|
+
func: workflowStatus('workflowName'),
|
|
122
|
+
})
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Usage Patterns
|
|
126
|
+
|
|
127
|
+
### Sequential Workflow
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
const onboardUser = pikkuWorkflowFunc<
|
|
131
|
+
{ email: string; userId: string },
|
|
132
|
+
{ success: boolean }
|
|
133
|
+
>(async ({}, data, { workflow }) => {
|
|
134
|
+
const user = await workflow.do('Create profile', 'createUserProfile', {
|
|
135
|
+
email: data.email,
|
|
136
|
+
userId: data.userId,
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
const message = await workflow.do(
|
|
140
|
+
'Generate welcome',
|
|
141
|
+
async () => `Welcome, ${data.email}!`
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
await workflow.sleep('Wait 5 minutes', '5min')
|
|
145
|
+
|
|
146
|
+
await workflow.do('Send email', 'sendEmail', {
|
|
147
|
+
to: data.email,
|
|
148
|
+
subject: 'Welcome!',
|
|
149
|
+
body: message,
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
return { success: true }
|
|
153
|
+
})
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Parallel Execution (Fan-out)
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
const users = await Promise.all(
|
|
160
|
+
data.userIds.map(
|
|
161
|
+
async (userId) =>
|
|
162
|
+
await workflow.do(`Get user ${userId}`, 'userGet', { userId })
|
|
163
|
+
)
|
|
164
|
+
)
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Retry with Backoff
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
const payment = await workflow.do(
|
|
171
|
+
'Process payment',
|
|
172
|
+
'processPayment',
|
|
173
|
+
{ amount: 100 },
|
|
174
|
+
{ retries: 3, retryDelay: '1s' }
|
|
175
|
+
)
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Conditional Branching
|
|
179
|
+
|
|
180
|
+
```typescript
|
|
181
|
+
if (user.plan === 'pro') {
|
|
182
|
+
await workflow.do('Apply discount', 'applyDiscount', { userId })
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Suspend and Resume
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
const approval = pikkuWorkflowFunc<
|
|
190
|
+
{ requestId: string },
|
|
191
|
+
{ approved: boolean }
|
|
192
|
+
>(async ({}, data, { workflow }) => {
|
|
193
|
+
await workflow.do('Submit request', 'submitRequest', data)
|
|
194
|
+
await workflow.suspend('Awaiting approval')
|
|
195
|
+
// Workflow pauses here until externally resumed
|
|
196
|
+
const result = await workflow.do('Check result', 'getApprovalResult', data)
|
|
197
|
+
return { approved: result.approved }
|
|
198
|
+
})
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Graph Workflow (DAG)
|
|
202
|
+
|
|
203
|
+
```typescript
|
|
204
|
+
const userOnboarding = pikkuWorkflowGraph({
|
|
205
|
+
description: 'Onboard a new user',
|
|
206
|
+
nodes: {
|
|
207
|
+
createProfile: 'createUserProfile',
|
|
208
|
+
sendWelcome: 'sendEmail',
|
|
209
|
+
setupDefaults: 'createDefaultTodos',
|
|
210
|
+
},
|
|
211
|
+
config: {
|
|
212
|
+
createProfile: {
|
|
213
|
+
next: ['sendWelcome', 'setupDefaults'], // Run in parallel
|
|
214
|
+
},
|
|
215
|
+
sendWelcome: {
|
|
216
|
+
input: (ref) => ({
|
|
217
|
+
to: ref('createProfile', 'email'),
|
|
218
|
+
subject: 'Welcome!',
|
|
219
|
+
}),
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
})
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Complete Example
|
|
226
|
+
|
|
227
|
+
```typescript
|
|
228
|
+
// functions/onboarding.workflow.ts
|
|
229
|
+
export const onboardUser = pikkuWorkflowFunc<
|
|
230
|
+
{ email: string; userId: string; plan: string },
|
|
231
|
+
{ success: boolean }
|
|
232
|
+
>(async ({}, data, { workflow }) => {
|
|
233
|
+
// Step 1: Create user profile
|
|
234
|
+
const user = await workflow.do('Create profile', 'createUserProfile', {
|
|
235
|
+
email: data.email,
|
|
236
|
+
userId: data.userId,
|
|
237
|
+
})
|
|
238
|
+
|
|
239
|
+
// Step 2: Set up defaults based on plan
|
|
240
|
+
if (data.plan === 'pro') {
|
|
241
|
+
await workflow.do('Apply pro features', 'enableProFeatures', {
|
|
242
|
+
userId: data.userId,
|
|
243
|
+
})
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Step 3: Send welcome email
|
|
247
|
+
await workflow.do('Send welcome', 'sendEmail', {
|
|
248
|
+
to: data.email,
|
|
249
|
+
subject: 'Welcome!',
|
|
250
|
+
body: `Welcome to our platform, ${user.name}!`,
|
|
251
|
+
})
|
|
252
|
+
|
|
253
|
+
// Step 4: Wait then send follow-up
|
|
254
|
+
await workflow.sleep('Wait 1 day', '1d')
|
|
255
|
+
|
|
256
|
+
await workflow.do('Send follow-up', 'sendEmail', {
|
|
257
|
+
to: data.email,
|
|
258
|
+
subject: 'Getting started',
|
|
259
|
+
body: 'Here are some tips to get started...',
|
|
260
|
+
})
|
|
261
|
+
|
|
262
|
+
return { success: true }
|
|
263
|
+
})
|
|
264
|
+
|
|
265
|
+
// wirings/workflow.wiring.ts
|
|
266
|
+
wireHTTP({
|
|
267
|
+
method: 'post',
|
|
268
|
+
route: '/onboard',
|
|
269
|
+
func: workflowStart('onboardUser'),
|
|
270
|
+
})
|
|
271
|
+
|
|
272
|
+
wireHTTP({
|
|
273
|
+
method: 'post',
|
|
274
|
+
route: '/onboard/run',
|
|
275
|
+
func: workflow('onboardUser'),
|
|
276
|
+
})
|
|
277
|
+
|
|
278
|
+
wireHTTP({
|
|
279
|
+
method: 'get',
|
|
280
|
+
route: '/onboard/status/:runId',
|
|
281
|
+
func: workflowStatus('onboardUser'),
|
|
282
|
+
})
|
|
283
|
+
```
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pikku-workflows-client
|
|
3
|
+
description: 'Run Pikku workflows from a React frontend and track their progress. Covers `useRunWorkflow` (run-and-wait), `useStartWorkflow` (fire-and-poll), and `useWorkflowStatus` (live status). TRIGGER when: a React component needs to invoke or display the status of a Pikku workflow, the user mentions long-running tasks / background jobs / progress UI tied to a workflow, or asks how to start/track a workflow from the client. DO NOT TRIGGER when: the user is wiring the workflow itself (use pikku-workflow) or only making regular RPC calls (use pikku-react-query).'
|
|
4
|
+
installGroups: [core]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Pikku Workflows — Client Hooks
|
|
8
|
+
|
|
9
|
+
## Agent Operating Procedure
|
|
10
|
+
|
|
11
|
+
Use this skill as an execution checklist, not reference material.
|
|
12
|
+
|
|
13
|
+
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.
|
|
14
|
+
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.
|
|
15
|
+
3. Make the smallest source change that satisfies the task. Keep generated files generated, and avoid hand-editing SDKs, schema output, or typegen.
|
|
16
|
+
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.
|
|
17
|
+
5. If validation fails, fix the source cause and rerun validation. Do not paper over generated errors by editing generated files.
|
|
18
|
+
|
|
19
|
+
When a project has `pikkuWorkflowGraph` workflows, three React Query
|
|
20
|
+
hooks are auto-generated alongside the standard RPC hooks. They handle
|
|
21
|
+
the two common shapes: **run-and-wait** (short workflows where the
|
|
22
|
+
client waits for the result) and **fire-and-poll** (long workflows where
|
|
23
|
+
the client gets a `runId` and polls status).
|
|
24
|
+
|
|
25
|
+
## Discover what workflows exist
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
yarn pikku meta clients --json | jq '.workflows'
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Each entry has `name`, `description`, `mode` (inline | distributed), plus
|
|
32
|
+
`input` / `output` type names. Pass the workflow **name** to the hooks
|
|
33
|
+
below.
|
|
34
|
+
|
|
35
|
+
## Setup
|
|
36
|
+
|
|
37
|
+
These hooks are generated into the same `api.gen.ts` as `usePikkuQuery` —
|
|
38
|
+
no extra setup beyond `PikkuProvider` + `QueryClientProvider` (see the
|
|
39
|
+
**pikku-react** and **pikku-react-query** skills).
|
|
40
|
+
|
|
41
|
+
## `useRunWorkflow(name, options?)` — run and wait
|
|
42
|
+
|
|
43
|
+
For short, synchronous-feeling workflows. Returns a mutation that
|
|
44
|
+
resolves to the workflow's output.
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
import { useRunWorkflow } from './pikku/api.gen'
|
|
48
|
+
|
|
49
|
+
function ChargeButton({ orderId }: { orderId: string }) {
|
|
50
|
+
const run = useRunWorkflow('chargeOrder', {
|
|
51
|
+
onSuccess: (output) => toast.success(`Charged: $${output.amount}`),
|
|
52
|
+
})
|
|
53
|
+
return (
|
|
54
|
+
<button onClick={() => run.mutate({ orderId })} disabled={run.isPending}>
|
|
55
|
+
{run.isPending ? 'Charging…' : 'Charge'}
|
|
56
|
+
</button>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Use this when the workflow finishes in seconds and the UI can hold open
|
|
62
|
+
a loading state until done.
|
|
63
|
+
|
|
64
|
+
## `useStartWorkflow(name, options?)` — fire-and-poll
|
|
65
|
+
|
|
66
|
+
Returns a mutation that resolves to `{ runId: string }` immediately. The
|
|
67
|
+
workflow keeps running on the server. Pair with `useWorkflowStatus` to
|
|
68
|
+
render progress.
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
const start = useStartWorkflow('processVideo', {
|
|
72
|
+
onSuccess: ({ runId }) => setActiveRunId(runId),
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
start.mutate({ videoId: '123' })
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Use this for long-running workflows (uploads, batch jobs, AI generation,
|
|
79
|
+
anything you'd want a progress bar for).
|
|
80
|
+
|
|
81
|
+
## `useWorkflowStatus(workflowName, runId, options?)` — observe
|
|
82
|
+
|
|
83
|
+
Polls the workflow runtime for a run's status. Returns a typed status
|
|
84
|
+
object with `status`, optional `output`, and optional `error`.
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
import { useWorkflowStatus } from './pikku/api.gen'
|
|
88
|
+
|
|
89
|
+
function VideoStatus({ runId }: { runId: string }) {
|
|
90
|
+
const { data: status } = useWorkflowStatus('processVideo', runId, {
|
|
91
|
+
refetchInterval: (query) =>
|
|
92
|
+
query.state.data?.status === 'running' ? 1000 : false,
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
if (!status) return null
|
|
96
|
+
if (status.status === 'running') return <Spinner />
|
|
97
|
+
if (status.status === 'completed') return <Result {...status.output} />
|
|
98
|
+
if (status.status === 'failed')
|
|
99
|
+
return <Error message={status.error?.message} />
|
|
100
|
+
return null
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Status values: `'running' | 'suspended' | 'completed' | 'failed' | 'cancelled'`.
|
|
105
|
+
|
|
106
|
+
The hook stops auto-polling when the run reaches a terminal state (set
|
|
107
|
+
`refetchInterval` to false in those cases — pattern shown above).
|
|
108
|
+
|
|
109
|
+
## Putting it together — start + observe
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
function ProcessVideoFlow({ videoId }: { videoId: string }) {
|
|
113
|
+
const [runId, setRunId] = useState<string>()
|
|
114
|
+
const start = useStartWorkflow('processVideo', {
|
|
115
|
+
onSuccess: ({ runId }) => setRunId(runId),
|
|
116
|
+
})
|
|
117
|
+
const status = useWorkflowStatus('processVideo', runId)
|
|
118
|
+
|
|
119
|
+
if (!runId) {
|
|
120
|
+
return (
|
|
121
|
+
<button
|
|
122
|
+
onClick={() => start.mutate({ videoId })}
|
|
123
|
+
disabled={start.isPending}
|
|
124
|
+
>
|
|
125
|
+
Start
|
|
126
|
+
</button>
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
return <ProgressBar status={status.data?.status} />
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Backend: streaming richer progress
|
|
134
|
+
|
|
135
|
+
The status hook returns a coarse-grained state machine (`running`,
|
|
136
|
+
`completed`, etc.). For step-by-step updates inside a long workflow,
|
|
137
|
+
publish events from the workflow itself via `eventHub` or open a
|
|
138
|
+
WebSocket channel — out of scope for this skill (see workflow + channel
|
|
139
|
+
docs).
|
|
140
|
+
|
|
141
|
+
## What NOT to do
|
|
142
|
+
|
|
143
|
+
- Don't poll status manually — use `useWorkflowStatus` with
|
|
144
|
+
`refetchInterval`. It dedupes and stops on terminal states.
|
|
145
|
+
- Don't call `useRunWorkflow` for workflows that take more than a few
|
|
146
|
+
seconds. The user-facing component will hold a long-running pending
|
|
147
|
+
state with no progress indication; use start + status instead.
|
|
148
|
+
- Don't use these hooks for non-workflow RPCs — they only resolve
|
|
149
|
+
workflow-shaped names. Regular RPCs go through `usePikkuQuery` /
|
|
150
|
+
`usePikkuMutation`.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pikku-ws
|
|
3
|
+
description: 'Use when setting up a WebSocket server with the ws library in a Pikku app. Covers the ws runtime adapter for Pikku channels.
|
|
4
|
+
TRIGGER when: code uses @pikku/ws, user asks about ws library WebSocket server, or Node.js WebSocket runtime.
|
|
5
|
+
DO NOT TRIGGER when: user asks about WebSocket wiring/channels (use pikku-websocket) or uWebSockets (use pikku-deploy-uws).'
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Pikku WS (WebSocket Server Runtime)
|
|
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
|
+
`@pikku/ws` provides a WebSocket server runtime using the [ws](https://github.com/websockets/ws) library, connecting Pikku's channel system to a Node.js WebSocket server.
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
yarn add @pikku/ws ws
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Usage Patterns
|
|
29
|
+
|
|
30
|
+
### Basic Setup
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { PikkuWSServer } from '@pikku/ws'
|
|
34
|
+
|
|
35
|
+
const wsServer = new PikkuWSServer({
|
|
36
|
+
server: httpServer, // Node.js HTTP server
|
|
37
|
+
singletonServices,
|
|
38
|
+
createWireServices,
|
|
39
|
+
channelStore,
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
await wsServer.init()
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
This runtime bridges the `ws` WebSocket library with Pikku's channel wiring. See `pikku-websocket` for channel wiring details and `pikku-deploy-fastify`/`pikku-deploy-express` for integrating with HTTP servers.
|