@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,184 @@
|
|
|
1
|
+
import { readdir, readFile, mkdir, writeFile } from 'fs/promises';
|
|
2
|
+
import { existsSync } from 'fs';
|
|
3
|
+
import { join, dirname } from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { pikkuSessionlessFunc } from '#pikku';
|
|
6
|
+
/**
|
|
7
|
+
* Walk up from this compiled file to find the package root (the directory
|
|
8
|
+
* containing the @pikku/cli package.json), then resolve `<root>/skills/`.
|
|
9
|
+
* Works whether the file is loaded from `dist/...` (published package) or
|
|
10
|
+
* `src/...` (local dev via tsx/vitest).
|
|
11
|
+
*/
|
|
12
|
+
async function findSkillsDir() {
|
|
13
|
+
let dir = dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
for (let i = 0; i < 8; i++) {
|
|
15
|
+
const pkgPath = join(dir, 'package.json');
|
|
16
|
+
if (existsSync(pkgPath)) {
|
|
17
|
+
try {
|
|
18
|
+
const pkg = JSON.parse(await readFile(pkgPath, 'utf-8'));
|
|
19
|
+
if (pkg.name === '@pikku/cli') {
|
|
20
|
+
const skills = join(dir, 'skills');
|
|
21
|
+
if (existsSync(skills))
|
|
22
|
+
return skills;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
catch { }
|
|
26
|
+
}
|
|
27
|
+
const parent = dirname(dir);
|
|
28
|
+
if (parent === dir)
|
|
29
|
+
break;
|
|
30
|
+
dir = parent;
|
|
31
|
+
}
|
|
32
|
+
throw new Error('Could not locate bundled skills directory. Was @pikku/cli installed correctly?');
|
|
33
|
+
}
|
|
34
|
+
async function copyDir(src, dest) {
|
|
35
|
+
await mkdir(dest, { recursive: true });
|
|
36
|
+
const entries = await readdir(src, { withFileTypes: true });
|
|
37
|
+
for (const entry of entries) {
|
|
38
|
+
const s = join(src, entry.name);
|
|
39
|
+
const d = join(dest, entry.name);
|
|
40
|
+
if (entry.isDirectory()) {
|
|
41
|
+
await copyDir(s, d);
|
|
42
|
+
}
|
|
43
|
+
else if (entry.isFile()) {
|
|
44
|
+
const content = await readFile(s);
|
|
45
|
+
await writeFile(d, content);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function parseInstallGroups(frontmatter) {
|
|
50
|
+
const inline = frontmatter.match(/^\s*installGroups\s*:\s*\[([^\]]*)\]/m);
|
|
51
|
+
if (inline) {
|
|
52
|
+
return inline[1]
|
|
53
|
+
.split(',')
|
|
54
|
+
.map((value) => value.trim().replace(/^['"]|['"]$/g, ''))
|
|
55
|
+
.filter(Boolean);
|
|
56
|
+
}
|
|
57
|
+
const block = frontmatter.match(/^\s*installGroups\s*:\s*\n((?:\s*-\s*[^\n]+\n?)*)/m);
|
|
58
|
+
if (block) {
|
|
59
|
+
return block[1]
|
|
60
|
+
.split('\n')
|
|
61
|
+
.map((line) => line
|
|
62
|
+
.match(/^\s*-\s*(.+)\s*$/)?.[1]
|
|
63
|
+
?.trim()
|
|
64
|
+
.replace(/^['"]|['"]$/g, ''))
|
|
65
|
+
.filter(Boolean);
|
|
66
|
+
}
|
|
67
|
+
const single = frontmatter.match(/^\s*installGroups\s*:\s*([^\n]+)/m);
|
|
68
|
+
if (single) {
|
|
69
|
+
const value = single[1].trim().replace(/^['"]|['"]$/g, '');
|
|
70
|
+
return value ? [value] : [];
|
|
71
|
+
}
|
|
72
|
+
return [];
|
|
73
|
+
}
|
|
74
|
+
async function readSkillInstallGroups(skillsDir, skillName) {
|
|
75
|
+
const skillPath = join(skillsDir, skillName, 'SKILL.md');
|
|
76
|
+
if (!existsSync(skillPath))
|
|
77
|
+
return [];
|
|
78
|
+
const content = await readFile(skillPath, 'utf-8');
|
|
79
|
+
const match = content.match(/^---\n([\s\S]*?)\n---/);
|
|
80
|
+
if (!match)
|
|
81
|
+
return [];
|
|
82
|
+
return parseInstallGroups(match[1]);
|
|
83
|
+
}
|
|
84
|
+
async function getWantedSkills(skillsDir, allEntries, { only, core = false, fabric = false, }) {
|
|
85
|
+
const wanted = new Set();
|
|
86
|
+
if (only) {
|
|
87
|
+
for (const name of only
|
|
88
|
+
.split(',')
|
|
89
|
+
.map((s) => s.trim())
|
|
90
|
+
.filter(Boolean)) {
|
|
91
|
+
wanted.add(name);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const requestedGroups = [
|
|
95
|
+
...(core ? ['core'] : []),
|
|
96
|
+
...(fabric ? ['fabric'] : []),
|
|
97
|
+
];
|
|
98
|
+
if (requestedGroups.length > 0) {
|
|
99
|
+
for (const name of allEntries) {
|
|
100
|
+
const groups = await readSkillInstallGroups(skillsDir, name);
|
|
101
|
+
if (requestedGroups.some((group) => groups.includes(group))) {
|
|
102
|
+
wanted.add(name);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return wanted.size === 0 ? allEntries : [...wanted].sort();
|
|
107
|
+
}
|
|
108
|
+
export const pikkuSkillsList = pikkuSessionlessFunc({
|
|
109
|
+
func: async ({ logger }) => {
|
|
110
|
+
const skillsDir = await findSkillsDir();
|
|
111
|
+
const entries = (await readdir(skillsDir, { withFileTypes: true }))
|
|
112
|
+
.filter((e) => e.isDirectory())
|
|
113
|
+
.map((e) => e.name)
|
|
114
|
+
.sort();
|
|
115
|
+
const installed = new Set();
|
|
116
|
+
for (const dir of [
|
|
117
|
+
join(process.cwd(), '.claude', 'skills'),
|
|
118
|
+
join(process.cwd(), '.opencode', 'skills'),
|
|
119
|
+
]) {
|
|
120
|
+
if (existsSync(dir)) {
|
|
121
|
+
for (const e of await readdir(dir, { withFileTypes: true })) {
|
|
122
|
+
if (e.isDirectory() || e.isSymbolicLink())
|
|
123
|
+
installed.add(e.name);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
logger.info(`Bundled skills (${entries.length}):`);
|
|
128
|
+
for (const name of entries) {
|
|
129
|
+
const marker = installed.has(name) ? '✓' : ' ';
|
|
130
|
+
console.log(` ${marker} ${name}`);
|
|
131
|
+
}
|
|
132
|
+
console.log('');
|
|
133
|
+
console.log('Run `pikku skills install` to copy them into .claude/skills/');
|
|
134
|
+
console.log('Run `pikku skills install --core --fabric` to install the Fabric sandbox skill set.');
|
|
135
|
+
console.log('Run `pikku skills install --agent opencode` to copy them into .opencode/skills/');
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
export const pikkuSkillsInstall = pikkuSessionlessFunc({
|
|
139
|
+
func: async ({ logger }, { agent = 'claude', only, core = false, fabric = false, update = false }) => {
|
|
140
|
+
const supportedAgents = ['claude', 'opencode'];
|
|
141
|
+
if (!supportedAgents.includes(agent)) {
|
|
142
|
+
logger.error(`Agent "${agent}" is not yet supported. Supported: ${supportedAgents.join(', ')}. ` +
|
|
143
|
+
`(codex/gemini will emit AGENTS.md/GEMINI.md from the same source — coming soon.)`);
|
|
144
|
+
process.exitCode = 1;
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const skillsDir = await findSkillsDir();
|
|
148
|
+
const allEntries = (await readdir(skillsDir, { withFileTypes: true }))
|
|
149
|
+
.filter((e) => e.isDirectory())
|
|
150
|
+
.map((e) => e.name)
|
|
151
|
+
.sort();
|
|
152
|
+
const wanted = await getWantedSkills(skillsDir, allEntries, {
|
|
153
|
+
only,
|
|
154
|
+
core,
|
|
155
|
+
fabric,
|
|
156
|
+
});
|
|
157
|
+
const missing = wanted.filter((n) => !allEntries.includes(n));
|
|
158
|
+
if (missing.length > 0) {
|
|
159
|
+
logger.error(`Unknown skill(s): ${missing.join(', ')}`);
|
|
160
|
+
process.exitCode = 1;
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const installRoot = agent === 'opencode'
|
|
164
|
+
? join(process.cwd(), '.opencode', 'skills')
|
|
165
|
+
: join(process.cwd(), '.claude', 'skills');
|
|
166
|
+
await mkdir(installRoot, { recursive: true });
|
|
167
|
+
let installed = 0;
|
|
168
|
+
let skipped = 0;
|
|
169
|
+
for (const name of wanted) {
|
|
170
|
+
const src = join(skillsDir, name);
|
|
171
|
+
const dest = join(installRoot, name);
|
|
172
|
+
if (existsSync(dest) && !update) {
|
|
173
|
+
skipped++;
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
await copyDir(src, dest);
|
|
177
|
+
installed++;
|
|
178
|
+
}
|
|
179
|
+
const destLabel = agent === 'opencode' ? '.opencode/skills/' : '.claude/skills/';
|
|
180
|
+
logger.info(`Installed ${installed} skill(s) into ${destLabel}${skipped > 0
|
|
181
|
+
? ` (skipped ${skipped} already present — pass --update to overwrite)`
|
|
182
|
+
: ''}`);
|
|
183
|
+
},
|
|
184
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const pikkuTestsCoverage: import("#pikku").PikkuFunctionConfig<{
|
|
2
|
+
noRun?: boolean;
|
|
3
|
+
}, void, "rpc" | "session", import("#pikku").PikkuFunctionSessionless<{
|
|
4
|
+
noRun?: boolean;
|
|
5
|
+
}, void, "rpc" | "session", import("#pikku").Services> | import("#pikku").PikkuFunction<{
|
|
6
|
+
noRun?: boolean;
|
|
7
|
+
}, void, "rpc" | "session", import("#pikku").Services>, undefined, undefined>;
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
2
|
+
import { join, relative, dirname } from 'node:path';
|
|
3
|
+
import { spawnSync } from 'node:child_process';
|
|
4
|
+
import ts from 'typescript';
|
|
5
|
+
import { pikkuSessionlessFunc } from '#pikku';
|
|
6
|
+
function innerBody(init) {
|
|
7
|
+
if (!ts.isCallExpression(init))
|
|
8
|
+
return null;
|
|
9
|
+
for (const arg of init.arguments) {
|
|
10
|
+
if (ts.isArrowFunction(arg) || ts.isFunctionExpression(arg))
|
|
11
|
+
return arg.body;
|
|
12
|
+
if (ts.isObjectLiteralExpression(arg)) {
|
|
13
|
+
for (const p of arg.properties) {
|
|
14
|
+
if (ts.isPropertyAssignment(p) &&
|
|
15
|
+
ts.isIdentifier(p.name) &&
|
|
16
|
+
p.name.text === 'func' &&
|
|
17
|
+
(ts.isArrowFunction(p.initializer) ||
|
|
18
|
+
ts.isFunctionExpression(p.initializer)))
|
|
19
|
+
return p.initializer.body;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
function bodySpan(file, exportedName, astCache) {
|
|
26
|
+
let sf = astCache.get(file);
|
|
27
|
+
if (!sf) {
|
|
28
|
+
sf = ts.createSourceFile(file, readFileSync(file, 'utf8'), ts.ScriptTarget.Latest, true);
|
|
29
|
+
astCache.set(file, sf);
|
|
30
|
+
}
|
|
31
|
+
const lineOf = (pos) => sf.getLineAndCharacterOfPosition(pos).line + 1;
|
|
32
|
+
const isExported = (node) => ts.canHaveModifiers(node) &&
|
|
33
|
+
ts.getModifiers(node)?.some((m) => m.kind === ts.SyntaxKind.ExportKeyword);
|
|
34
|
+
const spanOfBody = (body) => {
|
|
35
|
+
if (ts.isBlock(body) && body.statements.length) {
|
|
36
|
+
return {
|
|
37
|
+
start: lineOf(body.statements[0].getStart(sf)),
|
|
38
|
+
end: lineOf(body.statements[body.statements.length - 1].getEnd()),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return { start: lineOf(body.getStart(sf)), end: lineOf(body.getEnd()) };
|
|
42
|
+
};
|
|
43
|
+
let span = null;
|
|
44
|
+
sf.forEachChild((node) => {
|
|
45
|
+
if (span)
|
|
46
|
+
return;
|
|
47
|
+
if (ts.isVariableStatement(node) && isExported(node)) {
|
|
48
|
+
for (const decl of node.declarationList.declarations) {
|
|
49
|
+
if (ts.isIdentifier(decl.name) &&
|
|
50
|
+
decl.name.text === exportedName &&
|
|
51
|
+
decl.initializer) {
|
|
52
|
+
const body = innerBody(decl.initializer);
|
|
53
|
+
span = body
|
|
54
|
+
? spanOfBody(body)
|
|
55
|
+
: {
|
|
56
|
+
start: lineOf(decl.initializer.getStart(sf)),
|
|
57
|
+
end: lineOf(decl.initializer.getEnd()),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else if (ts.isFunctionDeclaration(node) &&
|
|
63
|
+
node.name?.text === exportedName &&
|
|
64
|
+
isExported(node) &&
|
|
65
|
+
node.body) {
|
|
66
|
+
span = spanOfBody(node.body);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
return span;
|
|
70
|
+
}
|
|
71
|
+
function lineCoverage(fileCov, span) {
|
|
72
|
+
const covered = new Set();
|
|
73
|
+
const missed = new Set();
|
|
74
|
+
if (fileCov) {
|
|
75
|
+
for (const id of Object.keys(fileCov.statementMap)) {
|
|
76
|
+
const ln = fileCov.statementMap[id].start.line;
|
|
77
|
+
if (ln >= span.start && ln <= span.end) {
|
|
78
|
+
if (fileCov.s[id] > 0)
|
|
79
|
+
covered.add(ln);
|
|
80
|
+
else
|
|
81
|
+
missed.add(ln);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
for (const ln of covered)
|
|
86
|
+
missed.delete(ln);
|
|
87
|
+
return {
|
|
88
|
+
covered: [...covered].sort((a, b) => a - b),
|
|
89
|
+
missed: [...missed].sort((a, b) => a - b),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
export const pikkuTestsCoverage = pikkuSessionlessFunc({
|
|
93
|
+
func: async ({ logger, config }, input) => {
|
|
94
|
+
const noRun = input?.noRun ?? false;
|
|
95
|
+
const packageMappings = config.packageMappings ?? {};
|
|
96
|
+
const srcDirs = config.srcDirectories ?? [];
|
|
97
|
+
const functionsRelDir = Object.keys(packageMappings).find((key) => srcDirs.some((src) => src === key || src.startsWith(key + '/'))) ?? Object.keys(packageMappings)[0];
|
|
98
|
+
if (!functionsRelDir) {
|
|
99
|
+
logger.error('packageMappings must have at least one entry pointing to your functions package');
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
const functionsDir = join(config.rootDir, functionsRelDir);
|
|
103
|
+
const ftestDir = join(functionsDir, 'tests');
|
|
104
|
+
if (!existsSync(ftestDir)) {
|
|
105
|
+
logger.error(`tests directory not found at ${ftestDir}. Run 'pikku tests init' first.`);
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
const verboseMetaPath = join(config.outDir, 'function', 'pikku-functions-meta-verbose.gen.json');
|
|
109
|
+
if (!existsSync(verboseMetaPath)) {
|
|
110
|
+
logger.error(`Verbose metadata not found at ${verboseMetaPath}. Run 'pikku all' first.`);
|
|
111
|
+
process.exit(1);
|
|
112
|
+
}
|
|
113
|
+
const coverageFinal = join(functionsDir, 'coverage', 'coverage-final.json');
|
|
114
|
+
const outDir = join(ftestDir, 'coverage');
|
|
115
|
+
const outFile = join(outDir, 'function-coverage.json');
|
|
116
|
+
if (!noRun) {
|
|
117
|
+
const findBin = (name, searchFrom) => {
|
|
118
|
+
let dir = searchFrom;
|
|
119
|
+
for (let i = 0; i < 6; i++) {
|
|
120
|
+
const candidate = join(dir, 'node_modules', '.bin', name);
|
|
121
|
+
if (existsSync(candidate))
|
|
122
|
+
return candidate;
|
|
123
|
+
const parent = dirname(dir);
|
|
124
|
+
if (parent === dir)
|
|
125
|
+
break;
|
|
126
|
+
dir = parent;
|
|
127
|
+
}
|
|
128
|
+
return name; // fallback: assume on PATH
|
|
129
|
+
};
|
|
130
|
+
const c8 = findBin('c8', ftestDir);
|
|
131
|
+
const cucumber = findBin('cucumber-js', ftestDir);
|
|
132
|
+
const envFile = join(ftestDir, '.env.test');
|
|
133
|
+
const spawnEnv = { ...process.env };
|
|
134
|
+
if (existsSync(envFile)) {
|
|
135
|
+
for (const line of readFileSync(envFile, 'utf8').split('\n')) {
|
|
136
|
+
const trimmed = line.trim();
|
|
137
|
+
if (!trimmed || trimmed.startsWith('#'))
|
|
138
|
+
continue;
|
|
139
|
+
const eq = trimmed.indexOf('=');
|
|
140
|
+
if (eq < 0)
|
|
141
|
+
continue;
|
|
142
|
+
spawnEnv[trimmed.slice(0, eq).trim()] = trimmed
|
|
143
|
+
.slice(eq + 1)
|
|
144
|
+
.trim()
|
|
145
|
+
.replace(/^['"]|['"]$/g, '');
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
logger.info('Running function tests under c8...');
|
|
149
|
+
const res = spawnSync(process.execPath, [
|
|
150
|
+
c8,
|
|
151
|
+
'--src',
|
|
152
|
+
'src',
|
|
153
|
+
'--include',
|
|
154
|
+
'src/**',
|
|
155
|
+
'--reporter',
|
|
156
|
+
'json',
|
|
157
|
+
'--reporter',
|
|
158
|
+
'text-summary',
|
|
159
|
+
cucumber,
|
|
160
|
+
'--require-module',
|
|
161
|
+
'tsx',
|
|
162
|
+
'--require',
|
|
163
|
+
'tests/tests/support/**/*.ts',
|
|
164
|
+
'tests/tests/features/**/*.feature',
|
|
165
|
+
], { cwd: functionsDir, stdio: 'inherit', env: spawnEnv });
|
|
166
|
+
if (res.status !== 0) {
|
|
167
|
+
logger.error(`Test run failed (exit ${res.status})`);
|
|
168
|
+
process.exit(res.status ?? 1);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (!existsSync(coverageFinal)) {
|
|
172
|
+
logger.error(`coverage-final.json not found at ${coverageFinal}. Run without --no-run.`);
|
|
173
|
+
process.exit(1);
|
|
174
|
+
}
|
|
175
|
+
const coverage = JSON.parse(readFileSync(coverageFinal, 'utf8'));
|
|
176
|
+
const meta = JSON.parse(readFileSync(verboseMetaPath, 'utf8'));
|
|
177
|
+
const astCache = new Map();
|
|
178
|
+
const functions = Object.values(meta)
|
|
179
|
+
.filter((m) => m.sourceFile && !m.sourceFile.endsWith('.gen.ts'))
|
|
180
|
+
.map((m) => {
|
|
181
|
+
const span = bodySpan(m.sourceFile, m.exportedName, astCache);
|
|
182
|
+
const { covered, missed } = span
|
|
183
|
+
? lineCoverage(coverage[m.sourceFile], span)
|
|
184
|
+
: { covered: [], missed: [] };
|
|
185
|
+
const total = covered.length + missed.length;
|
|
186
|
+
const ratio = total ? covered.length / total : 0;
|
|
187
|
+
const status = total === 0
|
|
188
|
+
? 'unknown'
|
|
189
|
+
: covered.length === 0
|
|
190
|
+
? 'uncovered'
|
|
191
|
+
: missed.length === 0
|
|
192
|
+
? 'covered'
|
|
193
|
+
: 'partial';
|
|
194
|
+
return {
|
|
195
|
+
name: m.name,
|
|
196
|
+
sourceFile: relative(functionsDir, m.sourceFile),
|
|
197
|
+
exposed: m.expose !== false,
|
|
198
|
+
description: m.description ?? null,
|
|
199
|
+
coveredLines: covered.length,
|
|
200
|
+
totalLines: total,
|
|
201
|
+
missedLines: missed,
|
|
202
|
+
ratio: Number(ratio.toFixed(3)),
|
|
203
|
+
status,
|
|
204
|
+
};
|
|
205
|
+
})
|
|
206
|
+
.sort((a, b) => a.ratio - b.ratio || a.name.localeCompare(b.name));
|
|
207
|
+
const summary = {
|
|
208
|
+
total: functions.length,
|
|
209
|
+
covered: 0,
|
|
210
|
+
partial: 0,
|
|
211
|
+
uncovered: 0,
|
|
212
|
+
unknown: 0,
|
|
213
|
+
};
|
|
214
|
+
for (const f of functions)
|
|
215
|
+
summary[f.status]++;
|
|
216
|
+
const overallRatio = functions.length
|
|
217
|
+
? Number((functions.reduce((a, f) => a + f.ratio, 0) / functions.length).toFixed(3))
|
|
218
|
+
: 0;
|
|
219
|
+
mkdirSync(outDir, { recursive: true });
|
|
220
|
+
writeFileSync(outFile, JSON.stringify({
|
|
221
|
+
generatedAt: new Date().toISOString(),
|
|
222
|
+
summary: { ...summary, overallRatio },
|
|
223
|
+
functions,
|
|
224
|
+
}, null, 2) + '\n');
|
|
225
|
+
const uncovered = functions.filter((f) => f.status === 'uncovered');
|
|
226
|
+
console.log(`\nFunction coverage → ${relative(config.rootDir, outFile)}`);
|
|
227
|
+
console.log(` ${summary.covered} covered · ${summary.partial} partial · ${summary.uncovered} uncovered · ${summary.unknown} unknown (overall ${(overallRatio * 100).toFixed(1)}%)`);
|
|
228
|
+
if (uncovered.length)
|
|
229
|
+
console.log(` uncovered: ${uncovered.map((f) => f.name).join(', ')}`);
|
|
230
|
+
},
|
|
231
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const pikkuTestsInit: import("#pikku").PikkuFunctionConfig<{
|
|
2
|
+
force?: boolean;
|
|
3
|
+
}, void, "rpc" | "session", import("#pikku").PikkuFunctionSessionless<{
|
|
4
|
+
force?: boolean;
|
|
5
|
+
}, void, "rpc" | "session", import("#pikku").Services> | import("#pikku").PikkuFunction<{
|
|
6
|
+
force?: boolean;
|
|
7
|
+
}, void, "rpc" | "session", import("#pikku").Services>, undefined, undefined>;
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { existsSync } from 'fs';
|
|
2
|
+
import { mkdir, writeFile } from 'fs/promises';
|
|
3
|
+
import { dirname, join, relative } from 'path';
|
|
4
|
+
import { pikkuSessionlessFunc } from '#pikku';
|
|
5
|
+
const toJs = (p) => p.replace(/\.(?:d\.)?ts$/, '.js');
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
// Template generators
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
function packageJson() {
|
|
10
|
+
return JSON.stringify({
|
|
11
|
+
name: 'tests',
|
|
12
|
+
version: '0.0.1',
|
|
13
|
+
private: true,
|
|
14
|
+
type: 'module',
|
|
15
|
+
description: 'Function test harness — Cucumber over in-process Pikku RPC with stubbed services.',
|
|
16
|
+
scripts: {
|
|
17
|
+
test: "node --env-file=.env.test node_modules/.bin/cucumber-js --config tests/cucumber.mjs --tags 'not @skip'",
|
|
18
|
+
'test:tag': 'node --env-file=.env.test node_modules/.bin/cucumber-js --config tests/cucumber.mjs --tags',
|
|
19
|
+
coverage: 'pikku tests coverage',
|
|
20
|
+
tsc: 'tsc --noEmit',
|
|
21
|
+
},
|
|
22
|
+
dependencies: {
|
|
23
|
+
'@pikku/cucumber': '^0.12.0',
|
|
24
|
+
'@pikku/kysely-node-sqlite': '^0.12.0',
|
|
25
|
+
},
|
|
26
|
+
devDependencies: {
|
|
27
|
+
'@cucumber/cucumber': '^11.0.0',
|
|
28
|
+
'@types/node': '^22',
|
|
29
|
+
c8: '^10.0.0',
|
|
30
|
+
tsx: '^4.21.0',
|
|
31
|
+
typescript: '~5.8.0',
|
|
32
|
+
},
|
|
33
|
+
}, null, 2);
|
|
34
|
+
}
|
|
35
|
+
function tsconfig() {
|
|
36
|
+
return JSON.stringify({
|
|
37
|
+
compilerOptions: {
|
|
38
|
+
target: 'ES2022',
|
|
39
|
+
module: 'NodeNext',
|
|
40
|
+
moduleResolution: 'NodeNext',
|
|
41
|
+
types: ['node'],
|
|
42
|
+
noEmit: true,
|
|
43
|
+
skipLibCheck: true,
|
|
44
|
+
esModuleInterop: true,
|
|
45
|
+
resolveJsonModule: true,
|
|
46
|
+
strict: true,
|
|
47
|
+
},
|
|
48
|
+
include: ['tests/**/*.ts'],
|
|
49
|
+
}, null, 2);
|
|
50
|
+
}
|
|
51
|
+
function envTest() {
|
|
52
|
+
return `# Environment variables required by createConfig() during tests.
|
|
53
|
+
# Add any env vars your config.ts reads at module load time.
|
|
54
|
+
# This file is loaded via --env-file and is NOT committed to version control.
|
|
55
|
+
NODE_ENV=test
|
|
56
|
+
`;
|
|
57
|
+
}
|
|
58
|
+
function cucumberMjs() {
|
|
59
|
+
return `export default {
|
|
60
|
+
requireModule: ['tsx'],
|
|
61
|
+
require: ['tests/support/**/*.ts', 'tests/steps/**/*.ts'],
|
|
62
|
+
paths: ['tests/features/**/*.feature'],
|
|
63
|
+
format: ['progress', 'html:tests/reports/cucumber-report.html'],
|
|
64
|
+
forceExit: true,
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
}
|
|
68
|
+
function hooksTs(bootstrapImport) {
|
|
69
|
+
return `import '${bootstrapImport}'
|
|
70
|
+
import { Before, After, BeforeAll, AfterAll, setDefaultTimeout, Given, When, Then } from '@cucumber/cucumber'
|
|
71
|
+
import { registerHooks, registerCommonSteps } from '@pikku/cucumber'
|
|
72
|
+
import { db } from './services.js'
|
|
73
|
+
|
|
74
|
+
registerHooks({ Before, After, BeforeAll, AfterAll, setDefaultTimeout }, db)
|
|
75
|
+
registerCommonSteps({ Given, When, Then })
|
|
76
|
+
`;
|
|
77
|
+
}
|
|
78
|
+
function worldTs() {
|
|
79
|
+
return `import { World, setWorldConstructor } from '@cucumber/cucumber'
|
|
80
|
+
import { createFunctionWorld } from '@pikku/cucumber'
|
|
81
|
+
import { createStubServices } from './services.js'
|
|
82
|
+
|
|
83
|
+
createFunctionWorld(World, setWorldConstructor, createStubServices)
|
|
84
|
+
`;
|
|
85
|
+
}
|
|
86
|
+
function servicesTs(configImport, servicesImport, schemaImport, coercionImport, configVar, servicesVar, repoRootRel, hasDb) {
|
|
87
|
+
if (!hasDb) {
|
|
88
|
+
return `import { createDbUtils, type StubTracker } from '@pikku/cucumber'
|
|
89
|
+
import { ${configVar} } from '${configImport}'
|
|
90
|
+
import { ${servicesVar} } from '${servicesImport}'
|
|
91
|
+
|
|
92
|
+
export const db = createDbUtils({ migrationsDir: '', seedFile: '' })
|
|
93
|
+
|
|
94
|
+
export async function createStubServices(_dbFile: string, tracker: StubTracker) {
|
|
95
|
+
const injected = new Proxy({} as Record<string, unknown>, {
|
|
96
|
+
get(_, prop: string) { return tracker.stub(prop) },
|
|
97
|
+
})
|
|
98
|
+
const config = await ${configVar}()
|
|
99
|
+
const services = await ${servicesVar}(config as never, injected as never)
|
|
100
|
+
return { services }
|
|
101
|
+
}
|
|
102
|
+
`;
|
|
103
|
+
}
|
|
104
|
+
return `import { createNodeSqliteKysely, createCoercionPlugin } from '@pikku/kysely-node-sqlite'
|
|
105
|
+
import { createDbUtils, type StubTracker } from '@pikku/cucumber'
|
|
106
|
+
import { ${configVar} } from '${configImport}'
|
|
107
|
+
import { ${servicesVar} } from '${servicesImport}'
|
|
108
|
+
import { coercionMap } from '${coercionImport}'
|
|
109
|
+
import type { DB } from '${schemaImport}'
|
|
110
|
+
import { dirname, resolve } from 'node:path'
|
|
111
|
+
import { fileURLToPath } from 'node:url'
|
|
112
|
+
|
|
113
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
114
|
+
const repoRoot = (p: string) => resolve(__dirname, '${repoRootRel}', p)
|
|
115
|
+
|
|
116
|
+
export const db = createDbUtils({
|
|
117
|
+
migrationsDir: repoRoot('db/migrations'),
|
|
118
|
+
seedFile: repoRoot('db/seed.sql'),
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
type StubKysely = ReturnType<typeof createNodeSqliteKysely<DB>>
|
|
122
|
+
|
|
123
|
+
const REAL_SERVICES = (kysely: StubKysely) => ({ kysely })
|
|
124
|
+
|
|
125
|
+
export async function createStubServices(dbFile: string, tracker: StubTracker) {
|
|
126
|
+
const kysely = createNodeSqliteKysely<DB>({
|
|
127
|
+
filename: dbFile,
|
|
128
|
+
camelCase: true,
|
|
129
|
+
plugins: [createCoercionPlugin({ map: coercionMap })],
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
const real = REAL_SERVICES(kysely)
|
|
133
|
+
const injected = new Proxy(real as Record<string, unknown>, {
|
|
134
|
+
get(target, prop: string) {
|
|
135
|
+
if (prop in target) return target[prop]
|
|
136
|
+
return tracker.stub(prop)
|
|
137
|
+
},
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
const config = await ${configVar}()
|
|
141
|
+
const services = await ${servicesVar}(
|
|
142
|
+
{ ...config, dev: { db: { file: dbFile } } } as never,
|
|
143
|
+
injected as never,
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
return { services, kysely }
|
|
147
|
+
}
|
|
148
|
+
`;
|
|
149
|
+
}
|
|
150
|
+
// ---------------------------------------------------------------------------
|
|
151
|
+
// Command
|
|
152
|
+
// ---------------------------------------------------------------------------
|
|
153
|
+
export const pikkuTestsInit = pikkuSessionlessFunc({
|
|
154
|
+
func: async ({ logger, config, getInspectorState }, input) => {
|
|
155
|
+
const force = input?.force;
|
|
156
|
+
const state = await getInspectorState(true);
|
|
157
|
+
const { pikkuConfigFactory, singletonServicesFactory } = state.filesAndMethods;
|
|
158
|
+
if (!pikkuConfigFactory) {
|
|
159
|
+
logger.error('createConfig not found — ensure it is exported from your project');
|
|
160
|
+
process.exit(1);
|
|
161
|
+
}
|
|
162
|
+
if (!singletonServicesFactory) {
|
|
163
|
+
logger.error('createSingletonServices not found — ensure it is exported from your project');
|
|
164
|
+
process.exit(1);
|
|
165
|
+
}
|
|
166
|
+
const packageMappings = config.packageMappings ?? {};
|
|
167
|
+
const srcDirs = config.srcDirectories ?? [];
|
|
168
|
+
const functionsRelDir = Object.keys(packageMappings).find((key) => srcDirs.some((src) => src === key || src.startsWith(key + '/'))) ?? Object.keys(packageMappings)[0];
|
|
169
|
+
if (!functionsRelDir) {
|
|
170
|
+
logger.error('packageMappings must have at least one entry pointing to your functions package');
|
|
171
|
+
process.exit(1);
|
|
172
|
+
}
|
|
173
|
+
const functionsDir = join(config.rootDir, functionsRelDir);
|
|
174
|
+
const ftestDir = join(functionsDir, 'tests');
|
|
175
|
+
if (existsSync(ftestDir) && !force) {
|
|
176
|
+
logger.error(`tests directory already exists at ${ftestDir}. Use --force to overwrite.`);
|
|
177
|
+
process.exit(1);
|
|
178
|
+
}
|
|
179
|
+
const supportDir = join(ftestDir, 'tests', 'support');
|
|
180
|
+
const rel = (abs) => {
|
|
181
|
+
const r = relative(supportDir, abs);
|
|
182
|
+
return r.startsWith('.') ? r : './' + r;
|
|
183
|
+
};
|
|
184
|
+
const bootstrapImport = toJs(rel(join(config.outDir, 'pikku-bootstrap.gen.ts')));
|
|
185
|
+
const configImport = toJs(rel(pikkuConfigFactory.file));
|
|
186
|
+
const servicesImport = toJs(rel(singletonServicesFactory.file));
|
|
187
|
+
// coercion/schema may live under outDir/db (new default) or rootDir/db (legacy)
|
|
188
|
+
const schemaInOutDir = join(config.outDir, 'db', 'schema.d.ts');
|
|
189
|
+
const schemaInRootDir = join(config.rootDir, 'db', 'schema.d.ts');
|
|
190
|
+
const schemaFile = existsSync(schemaInOutDir)
|
|
191
|
+
? schemaInOutDir
|
|
192
|
+
: schemaInRootDir;
|
|
193
|
+
const coercionInOutDir = join(config.outDir, 'db', 'coercion.gen.ts');
|
|
194
|
+
const coercionInRootDir = join(config.rootDir, 'db', 'coercion.gen.ts');
|
|
195
|
+
const coercionFile = existsSync(coercionInOutDir)
|
|
196
|
+
? coercionInOutDir
|
|
197
|
+
: coercionInRootDir;
|
|
198
|
+
const schemaImport = toJs(rel(schemaFile));
|
|
199
|
+
const coercionImport = toJs(rel(coercionFile));
|
|
200
|
+
const repoRootRel = relative(supportDir, config.rootDir);
|
|
201
|
+
const hasDb = existsSync(join(config.rootDir, 'db', 'migrations'));
|
|
202
|
+
const files = [
|
|
203
|
+
[join(ftestDir, '.env.test'), envTest()],
|
|
204
|
+
[join(ftestDir, 'package.json'), packageJson()],
|
|
205
|
+
[join(ftestDir, 'tsconfig.json'), tsconfig()],
|
|
206
|
+
[join(ftestDir, 'tests', 'cucumber.mjs'), cucumberMjs()],
|
|
207
|
+
[join(supportDir, 'hooks.ts'), hooksTs(bootstrapImport)],
|
|
208
|
+
[join(supportDir, 'world.ts'), worldTs()],
|
|
209
|
+
[
|
|
210
|
+
join(supportDir, 'services.ts'),
|
|
211
|
+
servicesTs(configImport, servicesImport, schemaImport, coercionImport, pikkuConfigFactory.variable, singletonServicesFactory.variable, repoRootRel, hasDb),
|
|
212
|
+
],
|
|
213
|
+
[join(ftestDir, 'tests', 'features', '.gitkeep'), ''],
|
|
214
|
+
];
|
|
215
|
+
for (const [filePath, content] of files) {
|
|
216
|
+
await mkdir(dirname(filePath), { recursive: true });
|
|
217
|
+
await writeFile(filePath, content, 'utf-8');
|
|
218
|
+
logger.info(` created ${relative(config.rootDir, filePath)}`);
|
|
219
|
+
}
|
|
220
|
+
logger.info('\nFunction test harness initialized.');
|
|
221
|
+
logger.info('Next steps:');
|
|
222
|
+
logger.info(' 1. Add your first .feature file under tests/features/');
|
|
223
|
+
logger.info(' 2. Install @pikku/cucumber and run: yarn test');
|
|
224
|
+
},
|
|
225
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const pikkuVersionsCheck: import("#pikku").PikkuFunctionConfig<void, void, "
|
|
1
|
+
export declare const pikkuVersionsCheck: import("#pikku").PikkuFunctionConfig<void, void, "rpc" | "session", import("#pikku").PikkuFunctionSessionless<void, void, "rpc" | "session", import("#pikku").Services> | import("#pikku").PikkuFunction<void, void, "rpc" | "session", import("#pikku").Services>, undefined, undefined>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const pikkuVersionsInit: import("#pikku").PikkuFunctionConfig<{
|
|
2
2
|
force?: boolean;
|
|
3
|
-
}, void, "
|
|
3
|
+
}, void, "rpc" | "session", import("#pikku").PikkuFunctionSessionless<{
|
|
4
4
|
force?: boolean;
|
|
5
|
-
}, void, "
|
|
5
|
+
}, void, "rpc" | "session", import("#pikku").Services> | import("#pikku").PikkuFunction<{
|
|
6
6
|
force?: boolean;
|
|
7
|
-
}, void, "
|
|
7
|
+
}, void, "rpc" | "session", import("#pikku").Services>, undefined, undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const pikkuVersionsUpdate: import("#pikku").PikkuFunctionConfig<void, void, "
|
|
1
|
+
export declare const pikkuVersionsUpdate: import("#pikku").PikkuFunctionConfig<void, void, "rpc" | "session", import("#pikku").PikkuFunctionSessionless<void, void, "rpc" | "session", import("#pikku").Services> | import("#pikku").PikkuFunction<void, void, "rpc" | "session", import("#pikku").Services>, undefined, undefined>;
|