@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,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const FabricSecretsSetInput: z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
branch: z.ZodString;
|
|
5
|
+
value: z.ZodOptional<z.ZodString>;
|
|
6
|
+
force: z.ZodOptional<z.ZodBoolean>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export declare const FabricSecretsSetOutput: z.ZodObject<{
|
|
9
|
+
ok: z.ZodBoolean;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export declare const FabricSecretsSet: import("../../../.pikku/pikku-types.gen.js").PikkuFunctionConfig<{
|
|
12
|
+
name: string;
|
|
13
|
+
branch: string;
|
|
14
|
+
value?: string | undefined;
|
|
15
|
+
force?: boolean | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
ok: boolean;
|
|
18
|
+
}, "rpc" | "session", import("../../../.pikku/pikku-types.gen.js").PikkuFunctionSessionless<{
|
|
19
|
+
name: string;
|
|
20
|
+
branch: string;
|
|
21
|
+
value?: string | undefined;
|
|
22
|
+
force?: boolean | undefined;
|
|
23
|
+
}, {
|
|
24
|
+
ok: boolean;
|
|
25
|
+
}, "rpc" | "session", import("../../../types/application-types.js").Services> | import("../../../.pikku/pikku-types.gen.js").PikkuFunction<{
|
|
26
|
+
name: string;
|
|
27
|
+
branch: string;
|
|
28
|
+
value?: string | undefined;
|
|
29
|
+
force?: boolean | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
ok: boolean;
|
|
32
|
+
}, "rpc" | "session", import("../../../types/application-types.js").Services>, undefined, undefined>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { pikkuSessionlessFunc } from '../../../.pikku/pikku-types.gen.js';
|
|
3
|
+
import { resolveApiContext } from '../lib/config.js';
|
|
4
|
+
import { getFabricRPC } from '../lib/http.js';
|
|
5
|
+
import { promptSecret } from '../lib/prompt.js';
|
|
6
|
+
export const FabricSecretsSetInput = z.object({
|
|
7
|
+
name: z.string(),
|
|
8
|
+
branch: z.string(),
|
|
9
|
+
value: z.string().optional(),
|
|
10
|
+
force: z.boolean().optional(),
|
|
11
|
+
});
|
|
12
|
+
export const FabricSecretsSetOutput = z.object({ ok: z.boolean() });
|
|
13
|
+
export const FabricSecretsSet = pikkuSessionlessFunc({
|
|
14
|
+
description: 'Set a stage-scoped secret. Encrypted with the stage KEK and stored in the project D1.',
|
|
15
|
+
input: FabricSecretsSetInput,
|
|
16
|
+
output: FabricSecretsSetOutput,
|
|
17
|
+
func: async (_services, { name, branch, value }) => {
|
|
18
|
+
const ctx = await resolveApiContext();
|
|
19
|
+
if (!ctx.token)
|
|
20
|
+
throw new Error('Not logged in. Run `pikku fabric login` first.');
|
|
21
|
+
if (!ctx.projectId)
|
|
22
|
+
throw new Error('No fabric project linked. Run `pikku fabric link` first.');
|
|
23
|
+
const plaintext = value ?? (await promptSecret(`${name} value`));
|
|
24
|
+
if (!plaintext)
|
|
25
|
+
throw new Error('Empty secret value — aborting.');
|
|
26
|
+
const rpc = getFabricRPC({ apiUrl: ctx.apiUrl, token: ctx.token });
|
|
27
|
+
const result = await rpc.invoke('setStageSecret', {
|
|
28
|
+
projectId: ctx.projectId,
|
|
29
|
+
branch,
|
|
30
|
+
name,
|
|
31
|
+
value: plaintext,
|
|
32
|
+
});
|
|
33
|
+
console.log(`[fabric] ${name} set on ${branch}.`);
|
|
34
|
+
return result;
|
|
35
|
+
},
|
|
36
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const FabricStatusInput: z.ZodObject<{}, z.core.$strip>;
|
|
3
|
+
export declare const FabricStatusOutput: z.ZodObject<{
|
|
4
|
+
projectId: z.ZodString;
|
|
5
|
+
status: z.ZodAny;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export declare const FabricStatus: import("../../../.pikku/pikku-types.gen.js").PikkuFunctionConfig<Record<string, never>, {
|
|
8
|
+
projectId: string;
|
|
9
|
+
status: any;
|
|
10
|
+
}, "rpc" | "session", import("../../../.pikku/pikku-types.gen.js").PikkuFunctionSessionless<Record<string, never>, {
|
|
11
|
+
projectId: string;
|
|
12
|
+
status: any;
|
|
13
|
+
}, "rpc" | "session", import("../../../types/application-types.js").Services> | import("../../../.pikku/pikku-types.gen.js").PikkuFunction<Record<string, never>, {
|
|
14
|
+
projectId: string;
|
|
15
|
+
status: any;
|
|
16
|
+
}, "rpc" | "session", import("../../../types/application-types.js").Services>, undefined, undefined>;
|
|
17
|
+
type StageState = {
|
|
18
|
+
stageBranch: string;
|
|
19
|
+
gitSha?: string | null;
|
|
20
|
+
status: string;
|
|
21
|
+
url?: string | null;
|
|
22
|
+
};
|
|
23
|
+
type ProjectStatus = {
|
|
24
|
+
exists: boolean;
|
|
25
|
+
projectName?: string | null;
|
|
26
|
+
active?: StageState | null;
|
|
27
|
+
deploying?: StageState | null;
|
|
28
|
+
mcpUrl?: string | null;
|
|
29
|
+
};
|
|
30
|
+
export declare const renderStatus: (_s: unknown, { projectId, status }: {
|
|
31
|
+
projectId: string;
|
|
32
|
+
status: ProjectStatus;
|
|
33
|
+
}) => void;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { pikkuSessionlessFunc } from '../../../.pikku/pikku-types.gen.js';
|
|
3
|
+
import { resolveApiContext } from '../lib/config.js';
|
|
4
|
+
import { getFabricRPC } from '../lib/http.js';
|
|
5
|
+
import { keyValue, statusColor, dim } from '../lib/output.js';
|
|
6
|
+
export const FabricStatusInput = z.object({});
|
|
7
|
+
export const FabricStatusOutput = z.object({
|
|
8
|
+
projectId: z.string(),
|
|
9
|
+
status: z.any(),
|
|
10
|
+
});
|
|
11
|
+
export const FabricStatus = pikkuSessionlessFunc({
|
|
12
|
+
description: 'Show the linked project status (active + in-flight deployment)',
|
|
13
|
+
input: FabricStatusInput,
|
|
14
|
+
output: FabricStatusOutput,
|
|
15
|
+
func: async (_services) => {
|
|
16
|
+
const ctx = await resolveApiContext();
|
|
17
|
+
if (!ctx.token)
|
|
18
|
+
throw new Error('Not logged in. Run `pikku fabric login` first.');
|
|
19
|
+
if (!ctx.projectId)
|
|
20
|
+
throw new Error('No fabric project linked. Run `pikku fabric link` first.');
|
|
21
|
+
const rpc = getFabricRPC({ apiUrl: ctx.apiUrl, token: ctx.token });
|
|
22
|
+
const status = await rpc.invoke('getProjectStatus', {
|
|
23
|
+
projectId: ctx.projectId,
|
|
24
|
+
});
|
|
25
|
+
return { projectId: ctx.projectId, status };
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
const stageLine = (s) => `${s.stageBranch} @ ${(s.gitSha ?? '').slice(0, 7)} · ${statusColor(s.status)}${s.url ? ` · ${s.url}` : ''}`;
|
|
29
|
+
export const renderStatus = (_s, { projectId, status }) => {
|
|
30
|
+
if (!status.exists) {
|
|
31
|
+
console.log(dim('Project not found or no access.'));
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const rows = [
|
|
35
|
+
['project', status.projectName ?? projectId],
|
|
36
|
+
['active', status.active ? stageLine(status.active) : dim('(none)')],
|
|
37
|
+
];
|
|
38
|
+
if (status.deploying)
|
|
39
|
+
rows.push(['deploying', stageLine(status.deploying)]);
|
|
40
|
+
if (status.mcpUrl)
|
|
41
|
+
rows.push(['mcp', status.mcpUrl]);
|
|
42
|
+
console.log(keyValue(rows));
|
|
43
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const FabricTraceInput: z.ZodObject<{
|
|
3
|
+
branch: z.ZodString;
|
|
4
|
+
traceId: z.ZodString;
|
|
5
|
+
json: z.ZodOptional<z.ZodBoolean>;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export declare const FabricTraceOutput: z.ZodObject<{
|
|
8
|
+
count: z.ZodNumber;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export declare const FabricTrace: import("../../../.pikku/pikku-types.gen.js").PikkuFunctionConfig<{
|
|
11
|
+
branch: string;
|
|
12
|
+
traceId: string;
|
|
13
|
+
json?: boolean | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
count: number;
|
|
16
|
+
}, "rpc" | "session", import("../../../.pikku/pikku-types.gen.js").PikkuFunctionSessionless<{
|
|
17
|
+
branch: string;
|
|
18
|
+
traceId: string;
|
|
19
|
+
json?: boolean | undefined;
|
|
20
|
+
}, {
|
|
21
|
+
count: number;
|
|
22
|
+
}, "rpc" | "session", import("../../../types/application-types.js").Services> | import("../../../.pikku/pikku-types.gen.js").PikkuFunction<{
|
|
23
|
+
branch: string;
|
|
24
|
+
traceId: string;
|
|
25
|
+
json?: boolean | undefined;
|
|
26
|
+
}, {
|
|
27
|
+
count: number;
|
|
28
|
+
}, "rpc" | "session", import("../../../types/application-types.js").Services>, undefined, undefined>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { pikkuSessionlessFunc } from '../../../.pikku/pikku-types.gen.js';
|
|
3
|
+
import { resolveApiContext } from '../lib/config.js';
|
|
4
|
+
import { getFabricRPC } from '../lib/http.js';
|
|
5
|
+
export const FabricTraceInput = z.object({
|
|
6
|
+
branch: z.string(),
|
|
7
|
+
traceId: z.string(),
|
|
8
|
+
json: z.boolean().optional(),
|
|
9
|
+
});
|
|
10
|
+
export const FabricTraceOutput = z.object({ count: z.number() });
|
|
11
|
+
function formatEvent(e) {
|
|
12
|
+
const dur = e.totalDuration !== undefined ? ` ${e.totalDuration.toFixed(0)}ms` : '';
|
|
13
|
+
const wire = e.wireType ? ` ${e.wireType}:${e.wireId ?? ''}` : '';
|
|
14
|
+
const detail = e.errorMessage ?? e.message ?? e.outcome ?? '';
|
|
15
|
+
return `${e.timestamp} ${e.scriptName}${wire}${dur} — ${detail}`;
|
|
16
|
+
}
|
|
17
|
+
export const FabricTrace = pikkuSessionlessFunc({
|
|
18
|
+
description: 'Fetch all events for a single trace id across an environment.',
|
|
19
|
+
input: FabricTraceInput,
|
|
20
|
+
output: FabricTraceOutput,
|
|
21
|
+
func: async (_services, { branch, traceId, json }) => {
|
|
22
|
+
const ctx = await resolveApiContext();
|
|
23
|
+
if (!ctx.token)
|
|
24
|
+
throw new Error('Not logged in. Run `pikku fabric login` first.');
|
|
25
|
+
if (!ctx.projectId)
|
|
26
|
+
throw new Error('No fabric project linked. Run `pikku fabric link` first.');
|
|
27
|
+
const rpc = getFabricRPC({ apiUrl: ctx.apiUrl, token: ctx.token });
|
|
28
|
+
const res = await rpc.invoke('getTraceByStageKind', {
|
|
29
|
+
projectId: ctx.projectId,
|
|
30
|
+
branch,
|
|
31
|
+
traceId,
|
|
32
|
+
});
|
|
33
|
+
if (json) {
|
|
34
|
+
console.log(JSON.stringify({ branch, traceId, events: res.events }, null, 2));
|
|
35
|
+
}
|
|
36
|
+
else if (res.events.length === 0) {
|
|
37
|
+
console.log(`[fabric] no events for trace ${traceId} on ${branch}`);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
for (const e of res.events)
|
|
41
|
+
console.log(formatEvent(e));
|
|
42
|
+
}
|
|
43
|
+
return { count: res.events.length };
|
|
44
|
+
},
|
|
45
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const FabricValidateInput: z.ZodObject<{}, z.core.$strip>;
|
|
3
|
+
export declare const FabricValidateOutput: z.ZodObject<{
|
|
4
|
+
ok: z.ZodBoolean;
|
|
5
|
+
root: z.ZodString;
|
|
6
|
+
findings: z.ZodArray<z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
severity: z.ZodEnum<{
|
|
9
|
+
info: "info";
|
|
10
|
+
warn: "warn";
|
|
11
|
+
error: "error";
|
|
12
|
+
}>;
|
|
13
|
+
message: z.ZodString;
|
|
14
|
+
path: z.ZodString;
|
|
15
|
+
fixHint: z.ZodString;
|
|
16
|
+
}, z.core.$strip>>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export declare function runValidate(startDir?: string): Promise<z.infer<typeof FabricValidateOutput>>;
|
|
19
|
+
export declare const FabricValidate: import("../../../.pikku/pikku-types.gen.js").PikkuFunctionConfig<Record<string, never>, {
|
|
20
|
+
ok: boolean;
|
|
21
|
+
root: string;
|
|
22
|
+
findings: {
|
|
23
|
+
id: string;
|
|
24
|
+
severity: "info" | "warn" | "error";
|
|
25
|
+
message: string;
|
|
26
|
+
path: string;
|
|
27
|
+
fixHint: string;
|
|
28
|
+
}[];
|
|
29
|
+
}, "rpc" | "session", import("../../../.pikku/pikku-types.gen.js").PikkuFunctionSessionless<Record<string, never>, {
|
|
30
|
+
ok: boolean;
|
|
31
|
+
root: string;
|
|
32
|
+
findings: {
|
|
33
|
+
id: string;
|
|
34
|
+
severity: "info" | "warn" | "error";
|
|
35
|
+
message: string;
|
|
36
|
+
path: string;
|
|
37
|
+
fixHint: string;
|
|
38
|
+
}[];
|
|
39
|
+
}, "rpc" | "session", import("../../../types/application-types.js").Services> | import("../../../.pikku/pikku-types.gen.js").PikkuFunction<Record<string, never>, {
|
|
40
|
+
ok: boolean;
|
|
41
|
+
root: string;
|
|
42
|
+
findings: {
|
|
43
|
+
id: string;
|
|
44
|
+
severity: "info" | "warn" | "error";
|
|
45
|
+
message: string;
|
|
46
|
+
path: string;
|
|
47
|
+
fixHint: string;
|
|
48
|
+
}[];
|
|
49
|
+
}, "rpc" | "session", import("../../../types/application-types.js").Services>, undefined, undefined>;
|
|
50
|
+
export declare const renderValidate: (_s: unknown, { ok, root, findings }: z.infer<typeof FabricValidateOutput>) => void;
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { readFile, readdir } from 'node:fs/promises';
|
|
3
|
+
import { existsSync } from 'node:fs';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
import { pikkuSessionlessFunc } from '../../../.pikku/pikku-types.gen.js';
|
|
6
|
+
import { added, changed, removed, dim } from '../lib/output.js';
|
|
7
|
+
const FindingSchema = z.object({
|
|
8
|
+
id: z.string(),
|
|
9
|
+
severity: z.enum(['error', 'warn', 'info']),
|
|
10
|
+
message: z.string(),
|
|
11
|
+
path: z.string(),
|
|
12
|
+
fixHint: z.string(),
|
|
13
|
+
});
|
|
14
|
+
export const FabricValidateInput = z.object({});
|
|
15
|
+
export const FabricValidateOutput = z.object({
|
|
16
|
+
ok: z.boolean(),
|
|
17
|
+
root: z.string(),
|
|
18
|
+
findings: z.array(FindingSchema),
|
|
19
|
+
});
|
|
20
|
+
async function findProjectRoot(startDir) {
|
|
21
|
+
let dir = startDir;
|
|
22
|
+
while (true) {
|
|
23
|
+
if (existsSync(join(dir, 'fabric.config.json')))
|
|
24
|
+
return dir;
|
|
25
|
+
if (existsSync(join(dir, 'package.json'))) {
|
|
26
|
+
try {
|
|
27
|
+
const pkg = JSON.parse(await readFile(join(dir, 'package.json'), 'utf8'));
|
|
28
|
+
if (pkg.workspaces)
|
|
29
|
+
return dir;
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// ignore parse errors
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const parent = dirname(dir);
|
|
36
|
+
if (parent === dir)
|
|
37
|
+
return startDir;
|
|
38
|
+
dir = parent;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async function readJsonSafe(path) {
|
|
42
|
+
if (!existsSync(path))
|
|
43
|
+
return null;
|
|
44
|
+
try {
|
|
45
|
+
return JSON.parse(await readFile(path, 'utf8'));
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async function readTextSafe(path) {
|
|
52
|
+
if (!existsSync(path))
|
|
53
|
+
return null;
|
|
54
|
+
try {
|
|
55
|
+
return await readFile(path, 'utf8');
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// PostgreSQL-specific syntax that won't work on SQLite/libSQL (Turso)
|
|
62
|
+
const POSTGRES_SQL_PATTERNS = [
|
|
63
|
+
{
|
|
64
|
+
re: /\b(?:SMALL|BIG)?SERIAL\b/i,
|
|
65
|
+
label: 'SERIAL / BIGSERIAL / SMALLSERIAL',
|
|
66
|
+
},
|
|
67
|
+
{ re: /\bJSONB\b/i, label: 'JSONB' },
|
|
68
|
+
{ re: /\bCREATE\s+SEQUENCE\b/i, label: 'CREATE SEQUENCE' },
|
|
69
|
+
{ re: /\bgen_random_uuid\s*\(\s*\)/i, label: 'gen_random_uuid()' },
|
|
70
|
+
{ re: /::[a-z_]+/i, label: ':: type cast' },
|
|
71
|
+
{ re: /\bTSVECTOR\b/i, label: 'TSVECTOR' },
|
|
72
|
+
{ re: /\bARRAY\s*\[/i, label: 'ARRAY[…]' },
|
|
73
|
+
];
|
|
74
|
+
export async function runValidate(startDir = process.cwd()) {
|
|
75
|
+
const root = await findProjectRoot(startDir);
|
|
76
|
+
const findings = [];
|
|
77
|
+
const e = (id, message, path, fixHint) => {
|
|
78
|
+
findings.push({ id, severity: 'error', message, path, fixHint });
|
|
79
|
+
};
|
|
80
|
+
const w = (id, message, path, fixHint) => {
|
|
81
|
+
findings.push({ id, severity: 'warn', message, path, fixHint });
|
|
82
|
+
};
|
|
83
|
+
const info = (id, message, path, fixHint) => {
|
|
84
|
+
findings.push({ id, severity: 'info', message, path, fixHint });
|
|
85
|
+
};
|
|
86
|
+
// ── fabric.config.json ─────────────────────────────────────────────────
|
|
87
|
+
// Not required to run validate — downgraded to info so any pikku project
|
|
88
|
+
// can be checked for compatibility before it is linked to a fabric account.
|
|
89
|
+
const fabricConfigPath = join(root, 'fabric.config.json');
|
|
90
|
+
const fabricConfig = await readJsonSafe(fabricConfigPath);
|
|
91
|
+
if (!fabricConfig) {
|
|
92
|
+
info('fabric-config-missing', 'fabric.config.json not found — project has not been linked to fabric yet', fabricConfigPath, 'Run `pikku fabric link` to create it, or create manually: {"projectId": "__PROJECT_ID__"}');
|
|
93
|
+
}
|
|
94
|
+
else if (!fabricConfig.projectId) {
|
|
95
|
+
info('fabric-config-no-project-id', 'fabric.config.json is missing "projectId"', fabricConfigPath, 'Add "projectId": "<your-project-id>" to fabric.config.json, or run `pikku fabric link`');
|
|
96
|
+
}
|
|
97
|
+
else if (fabricConfig.projectId === '__PROJECT_ID__') {
|
|
98
|
+
info('fabric-config-placeholder-project-id', 'fabric.config.json has a placeholder projectId ("__PROJECT_ID__") — project is not linked', fabricConfigPath, 'Run `pikku fabric link` to replace the placeholder with a real project ID');
|
|
99
|
+
}
|
|
100
|
+
// ── root pikku.config.json ─────────────────────────────────────────────
|
|
101
|
+
const pikkuConfigPath = join(root, 'pikku.config.json');
|
|
102
|
+
const pikkuConfig = await readJsonSafe(pikkuConfigPath);
|
|
103
|
+
if (!pikkuConfig) {
|
|
104
|
+
e('pikku-config-missing', 'pikku.config.json not found at project root', pikkuConfigPath, 'Create pikku.config.json with srcDirectories pointing to packages/functions/src, outDir, and clientFiles');
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
if (!pikkuConfig.srcDirectories) {
|
|
108
|
+
e('pikku-config-no-src-dirs', 'pikku.config.json missing "srcDirectories"', pikkuConfigPath, 'Add "srcDirectories": ["packages/functions/src"] to pikku.config.json');
|
|
109
|
+
}
|
|
110
|
+
if (!pikkuConfig.outDir) {
|
|
111
|
+
e('pikku-config-no-out-dir', 'pikku.config.json missing "outDir"', pikkuConfigPath, 'Add "outDir": "packages/functions/.pikku" to pikku.config.json');
|
|
112
|
+
}
|
|
113
|
+
if (!pikkuConfig.clientFiles) {
|
|
114
|
+
info('pikku-config-no-client-files', 'pikku.config.json missing "clientFiles" — no generated SDK or React Query hooks', pikkuConfigPath, 'Add clientFiles.rpcMapDeclarationFile and clientFiles.reactQueryFile pointing to packages/functions-sdk/src/pikku/');
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const rootPkgPath = join(root, 'package.json');
|
|
118
|
+
const rootPkg = await readJsonSafe(rootPkgPath);
|
|
119
|
+
if (!rootPkg) {
|
|
120
|
+
e('root-package-missing', 'root package.json not found', rootPkgPath, 'Create a root package.json with workspaces: {"workspaces": ["packages/*", "apps/*"]}');
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
if (!rootPkg.workspaces) {
|
|
124
|
+
w('root-package-no-workspaces', 'root package.json missing "workspaces"', rootPkgPath, 'Add "workspaces": ["packages/*", "apps/*"] to enable yarn workspaces');
|
|
125
|
+
}
|
|
126
|
+
const allDeps = {
|
|
127
|
+
...rootPkg.dependencies,
|
|
128
|
+
...rootPkg.devDependencies,
|
|
129
|
+
};
|
|
130
|
+
if (!allDeps['@pikku/fabric-cli']) {
|
|
131
|
+
info('missing-fabric-cli', '@pikku/fabric-cli not in devDependencies — fabric CLI commands (validate, deploy) will not be available', rootPkgPath, 'Add "@pikku/fabric-cli" to devDependencies: use "file:./vendor/pikku-fabric-cli.tgz" (bundled release) or "portal:/path/to/pikku/packages/fabric-cli" (local dev)');
|
|
132
|
+
}
|
|
133
|
+
if (!allDeps['@pikku/core']) {
|
|
134
|
+
e('missing-core', '@pikku/core not in dependencies', rootPkgPath, 'Add "@pikku/core": "file:./vendor/pikku-core.tgz" to dependencies');
|
|
135
|
+
}
|
|
136
|
+
// Vendor tgz presence — only check file: deps that reference a vendor/ path
|
|
137
|
+
for (const [pkg, spec] of Object.entries(allDeps)) {
|
|
138
|
+
if (typeof spec !== 'string' || !spec.startsWith('file:'))
|
|
139
|
+
continue;
|
|
140
|
+
const relPath = spec.slice(5); // strip 'file:'
|
|
141
|
+
if (!relPath.includes('vendor'))
|
|
142
|
+
continue;
|
|
143
|
+
const absPath = join(root, relPath);
|
|
144
|
+
if (!existsSync(absPath)) {
|
|
145
|
+
w(`vendor-missing-${pkg.replace(/[@/]/g, '-')}`, `Vendor file missing for ${pkg}: ${relPath}`, absPath, `Run \`pikku pack\` in the pikku source repo and copy the output to ${relPath}`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
// ── packages/functions/ ────────────────────────────────────────────────
|
|
150
|
+
const fnDir = join(root, 'packages', 'functions');
|
|
151
|
+
const functionsSdkPkgName = (await readJsonSafe(join(root, 'packages', 'functions-sdk', 'package.json')))?.name;
|
|
152
|
+
const themePkgName = (await readJsonSafe(join(root, 'packages', 'theme', 'package.json')))?.name;
|
|
153
|
+
const componentsPkgName = (await readJsonSafe(join(root, 'packages', 'components', 'package.json')))?.name;
|
|
154
|
+
if (!existsSync(fnDir)) {
|
|
155
|
+
e('functions-pkg-missing', 'packages/functions/ directory not found', fnDir, 'Create packages/functions/ as a yarn workspace containing pikku.config.json, src/, and db/migrations/');
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
const fnPkgPath = join(fnDir, 'package.json');
|
|
159
|
+
const fnPkg = await readJsonSafe(fnPkgPath);
|
|
160
|
+
if (fnPkg) {
|
|
161
|
+
if (fnPkg.type !== 'module') {
|
|
162
|
+
w('functions-pkg-no-esm', 'packages/functions/package.json is missing "type": "module"', fnPkgPath, 'Add "type": "module" to packages/functions/package.json — Cloudflare Workers require ES modules');
|
|
163
|
+
}
|
|
164
|
+
const fnAllDeps = {
|
|
165
|
+
...fnPkg.dependencies,
|
|
166
|
+
...fnPkg.devDependencies,
|
|
167
|
+
...fnPkg.peerDependencies,
|
|
168
|
+
};
|
|
169
|
+
if (fnAllDeps['@pikku/kysely-postgres']) {
|
|
170
|
+
e('fn-pkg-postgres-dep', '@pikku/kysely-postgres is in packages/functions dependencies — Fabric uses SQLite/libSQL (Turso), not PostgreSQL', fnPkgPath, 'Remove @pikku/kysely-postgres and use @pikku/kysely-sqlite with LibsqlWebDialect instead');
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
// services.ts
|
|
174
|
+
const servicesPath = join(fnDir, 'src', 'services.ts');
|
|
175
|
+
const servicesText = await readTextSafe(servicesPath);
|
|
176
|
+
if (!servicesText) {
|
|
177
|
+
w('services-missing', 'packages/functions/src/services.ts not found', servicesPath, 'Create services.ts using pikkuServices() with LibsqlWebDialect from @pikku/kysely-sqlite — fabric injects DATABASE_URL at runtime');
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
const usesKysely = /\bKysely\b/.test(servicesText);
|
|
181
|
+
const usesLibsql = servicesText.includes('@pikku/kysely-sqlite') ||
|
|
182
|
+
servicesText.includes('LibsqlWebDialect');
|
|
183
|
+
const usesProcessEnv = /\bprocess\.env\.[A-Z_]/.test(servicesText);
|
|
184
|
+
if (usesKysely && !usesLibsql) {
|
|
185
|
+
e('services-wrong-db-adapter', 'services.ts uses Kysely but not LibsqlWebDialect — Fabric injects a Turso/libSQL DATABASE_URL at runtime, not a PostgreSQL URL', servicesPath, 'Import LibsqlWebDialect from @pikku/kysely-sqlite and replace the dialect: new Kysely({ dialect: new LibsqlWebDialect({ url: databaseUrl }) })');
|
|
186
|
+
}
|
|
187
|
+
if (usesProcessEnv) {
|
|
188
|
+
info('services-process-env', 'services.ts reads process.env directly — prefer variables.get() for portable secret/variable access', servicesPath, 'Replace process.env.SOME_VAR with await variables.get("SOME_VAR") — declare the binding with wireVariable/wireSecret; process.env is fine for optional/non-secret config');
|
|
189
|
+
}
|
|
190
|
+
if (usesLibsql &&
|
|
191
|
+
rootPkg &&
|
|
192
|
+
!rootPkg.dependencies?.['@pikku/kysely-sqlite'] &&
|
|
193
|
+
!rootPkg.devDependencies?.['@pikku/kysely-sqlite']) {
|
|
194
|
+
e('missing-kysely-sqlite', 'services.ts imports @pikku/kysely-sqlite but it is not in root package.json', rootPkgPath, 'Add "@pikku/kysely-sqlite": "file:./vendor/pikku-kysely-sqlite.tgz" to dependencies');
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
// db/migrations/ — numbering and SQL dialect
|
|
198
|
+
const migrationsDir = join(fnDir, 'db', 'migrations');
|
|
199
|
+
if (existsSync(migrationsDir)) {
|
|
200
|
+
try {
|
|
201
|
+
const files = (await readdir(migrationsDir))
|
|
202
|
+
.filter((f) => f.endsWith('.sql'))
|
|
203
|
+
.sort();
|
|
204
|
+
const nums = [];
|
|
205
|
+
for (const f of files) {
|
|
206
|
+
const m = f.match(/^(\d+)/);
|
|
207
|
+
if (m)
|
|
208
|
+
nums.push(parseInt(m[1], 10));
|
|
209
|
+
}
|
|
210
|
+
for (let idx = 1; idx < nums.length; idx++) {
|
|
211
|
+
if (nums[idx] !== nums[idx - 1] + 1) {
|
|
212
|
+
const missing = `${nums[idx - 1] + 1}..${nums[idx] - 1}`;
|
|
213
|
+
e('migration-gap', `Migration numbering gap: IDs ${missing} are missing`, migrationsDir, 'Migrations must be consecutive (postgres-migrations refuses gaps). Add the missing .sql file or renumber if not yet applied.');
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
// Check for PostgreSQL-specific syntax — Fabric uses Turso (SQLite/libSQL)
|
|
218
|
+
for (const f of files) {
|
|
219
|
+
const sql = await readTextSafe(join(migrationsDir, f));
|
|
220
|
+
if (!sql)
|
|
221
|
+
continue;
|
|
222
|
+
const hits = POSTGRES_SQL_PATTERNS.filter(({ re }) => re.test(sql)).map(({ label }) => label);
|
|
223
|
+
if (hits.length > 0) {
|
|
224
|
+
e(`migration-postgres-sql-${f.replace(/[^a-z0-9]/gi, '-')}`, `${f} contains PostgreSQL syntax (${hits.join(', ')}) — Fabric uses SQLite/libSQL (Turso)`, join(migrationsDir, f), "Rewrite the migration using SQLite-compatible syntax: TEXT instead of JSONB, INTEGER PRIMARY KEY for auto-increment, datetime('now') instead of NOW(), no :: casts");
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
// readdir failure — skip
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
// db.types.ts — should only re-export from .pikku
|
|
233
|
+
const dbTypesPath = join(fnDir, 'src', 'types', 'db.types.ts');
|
|
234
|
+
const dbTypesText = await readTextSafe(dbTypesPath);
|
|
235
|
+
if (dbTypesText) {
|
|
236
|
+
const isReexport = dbTypesText.includes('.pikku/db/schema') ||
|
|
237
|
+
dbTypesText.includes('.pikku\\db\\schema');
|
|
238
|
+
const hasInlineTypes = /(?:^|\n)\s*(?:export\s+)?(?:interface\s+\w|type\s+\w+\s*=)/.test(dbTypesText);
|
|
239
|
+
if (hasInlineTypes && !isReexport) {
|
|
240
|
+
w('db-types-hand-edited', 'src/types/db.types.ts contains inline type definitions — it should only re-export from .pikku', dbTypesPath, "Replace the file with a single line: export type { DB } from '../../.pikku/db/schema.js' then run `yarn db:types` to regenerate");
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
// Structure: src/functions/, src/wirings/, src/config.ts
|
|
244
|
+
if (!existsSync(join(fnDir, 'src', 'functions'))) {
|
|
245
|
+
info('functions-dir-missing', 'packages/functions/src/functions/ not found', join(fnDir, 'src', 'functions'), 'Create src/functions/ to hold pikkuSessionlessFunc definitions (one function per file)');
|
|
246
|
+
}
|
|
247
|
+
if (!existsSync(join(fnDir, 'src', 'wirings'))) {
|
|
248
|
+
info('wirings-dir-missing', 'packages/functions/src/wirings/ not found', join(fnDir, 'src', 'wirings'), 'Create src/wirings/ for transport bindings: *.http.ts, *.queue.ts, *.schedule.ts, *.channel.ts, *.cli.ts');
|
|
249
|
+
}
|
|
250
|
+
if (!existsSync(join(fnDir, 'src', 'config.ts'))) {
|
|
251
|
+
info('config-missing', 'packages/functions/src/config.ts not found', join(fnDir, 'src', 'config.ts'), 'Create src/config.ts: export const createConfig = pikkuConfig(async () => ({ dev: { db: true } }))');
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
// ── apps/ vs fabric.config.json frontends ─────────────────────────────
|
|
255
|
+
const appsDir = join(root, 'apps');
|
|
256
|
+
if (existsSync(appsDir)) {
|
|
257
|
+
// Check declared frontends have a real directory on disk
|
|
258
|
+
if (fabricConfig) {
|
|
259
|
+
const frontends = (fabricConfig.frontends ?? {});
|
|
260
|
+
for (const [slug, fe] of Object.entries(frontends)) {
|
|
261
|
+
const cwd = fe.cwd?.replace(/^\.\//, '');
|
|
262
|
+
if (cwd && !existsSync(join(root, cwd))) {
|
|
263
|
+
e(`frontend-cwd-missing-${slug}`, `fabric.config.json frontend "${slug}" declares cwd "${cwd}" but that directory does not exist`, join(root, cwd), `Create the directory or update the cwd in fabric.config.json`);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
// Check each app/ subdir is declared and has correct local deps
|
|
268
|
+
let appEntries = [];
|
|
269
|
+
try {
|
|
270
|
+
appEntries = (await readdir(appsDir, { withFileTypes: true }))
|
|
271
|
+
.filter((e) => e.isDirectory())
|
|
272
|
+
.map((e) => e.name);
|
|
273
|
+
}
|
|
274
|
+
catch {
|
|
275
|
+
/* ignore */
|
|
276
|
+
}
|
|
277
|
+
const declaredCwds = fabricConfig
|
|
278
|
+
? new Set(Object.values((fabricConfig.frontends ?? {})).map((f) => f.cwd?.replace(/^\.\//, '') ?? ''))
|
|
279
|
+
: null;
|
|
280
|
+
for (const name of appEntries) {
|
|
281
|
+
const appPath = join(appsDir, name);
|
|
282
|
+
const cwd = `apps/${name}`;
|
|
283
|
+
if (declaredCwds && !declaredCwds.has(cwd)) {
|
|
284
|
+
w(`app-not-declared-${name}`, `apps/${name} is not declared in fabric.config.json frontends`, appPath, `Add an entry to fabric.config.json: { "frontends": { "${name}": { "cwd": "${cwd}", "kind": "ssr" } } }`);
|
|
285
|
+
}
|
|
286
|
+
const appPkg = await readJsonSafe(join(appPath, 'package.json'));
|
|
287
|
+
if (!appPkg)
|
|
288
|
+
continue;
|
|
289
|
+
const appDeps = { ...appPkg.dependencies };
|
|
290
|
+
if (functionsSdkPkgName && !appDeps[functionsSdkPkgName]) {
|
|
291
|
+
info(`app-missing-functions-sdk-${name}`, `apps/${name} does not depend on ${functionsSdkPkgName} — the generated RPC client and React Query hooks`, join(appPath, 'package.json'), `Add "${functionsSdkPkgName}: workspace:*" to apps/${name}/package.json dependencies`);
|
|
292
|
+
}
|
|
293
|
+
if (themePkgName && !appDeps[themePkgName]) {
|
|
294
|
+
info(`app-missing-theme-${name}`, `apps/${name} does not depend on ${themePkgName}`, join(appPath, 'package.json'), `Add "${themePkgName}: workspace:*" to apps/${name}/package.json dependencies`);
|
|
295
|
+
}
|
|
296
|
+
if (componentsPkgName && !appDeps[componentsPkgName]) {
|
|
297
|
+
info(`app-missing-components-${name}`, `apps/${name} does not depend on ${componentsPkgName}`, join(appPath, 'package.json'), `Add "${componentsPkgName}: workspace:*" to apps/${name}/package.json dependencies`);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
// ── packages/theme + packages/components ──────────────────────────────
|
|
302
|
+
const designDocUrl = 'https://pikkufabric.dev/docs/design';
|
|
303
|
+
if (!existsSync(join(root, 'packages', 'theme'))) {
|
|
304
|
+
info('theme-missing', 'packages/theme/ not found — Fabric design features require a theme package', join(root, 'packages', 'theme'), `Create packages/theme/ with your Mantine theme tokens. See ${designDocUrl}`);
|
|
305
|
+
}
|
|
306
|
+
if (!existsSync(join(root, 'packages', 'components'))) {
|
|
307
|
+
info('components-missing', 'packages/components/ not found — Fabric design features require a components package', join(root, 'packages', 'components'), `Create packages/components/ with your shared UI components. See ${designDocUrl}`);
|
|
308
|
+
}
|
|
309
|
+
// ── packages/functions/tests/ ─────────────────────────────────────────
|
|
310
|
+
const testsDir = join(fnDir, 'tests');
|
|
311
|
+
if (!existsSync(testsDir)) {
|
|
312
|
+
info('tests-missing', 'packages/functions/tests/ not found — no function test harness', testsDir, 'Run `pikku tests init` to scaffold the Cucumber test harness under packages/functions/tests/');
|
|
313
|
+
}
|
|
314
|
+
// ── packages/functions-sdk/ ───────────────────────────────────────────
|
|
315
|
+
const sdkDir = join(root, 'packages', 'functions-sdk');
|
|
316
|
+
if (!existsSync(sdkDir)) {
|
|
317
|
+
info('functions-sdk-missing', 'packages/functions-sdk/ not found — generated RPC client and React Query hooks will not be available', sdkDir, 'Create packages/functions-sdk/ as a workspace with src/pikku/ subdirectory; configure clientFiles in root pikku.config.json to point to packages/functions-sdk/src/pikku/');
|
|
318
|
+
}
|
|
319
|
+
const ok = !findings.some((f) => f.severity === 'error');
|
|
320
|
+
return { ok, root, findings };
|
|
321
|
+
}
|
|
322
|
+
export const FabricValidate = pikkuSessionlessFunc({
|
|
323
|
+
description: 'Check the current project structure for fabric compatibility. Prints all missing or misconfigured items with fix hints so an AI agent or developer can resolve them.',
|
|
324
|
+
input: FabricValidateInput,
|
|
325
|
+
output: FabricValidateOutput,
|
|
326
|
+
func: async (_services) => runValidate(),
|
|
327
|
+
});
|
|
328
|
+
export const renderValidate = (_s, { ok, root, findings }) => {
|
|
329
|
+
if (findings.length === 0) {
|
|
330
|
+
console.log(added('✓ All checks passed — project is fabric-compatible'));
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
const relPath = (p) => p.startsWith(root + '/') || p.startsWith(root + '\\')
|
|
334
|
+
? p.slice(root.length + 1)
|
|
335
|
+
: p;
|
|
336
|
+
const errors = findings.filter((f) => f.severity === 'error');
|
|
337
|
+
const warns = findings.filter((f) => f.severity === 'warn');
|
|
338
|
+
const infos = findings.filter((f) => f.severity === 'info');
|
|
339
|
+
for (const f of [...errors, ...warns, ...infos]) {
|
|
340
|
+
const icon = f.severity === 'error'
|
|
341
|
+
? removed('✗')
|
|
342
|
+
: f.severity === 'warn'
|
|
343
|
+
? changed('⚠')
|
|
344
|
+
: dim('ℹ');
|
|
345
|
+
console.log(`${icon} ${f.message}`);
|
|
346
|
+
console.log(` ${dim('path:')} ${relPath(f.path)}`);
|
|
347
|
+
console.log(` ${dim('fix:')} ${f.fixHint}`);
|
|
348
|
+
console.log();
|
|
349
|
+
}
|
|
350
|
+
const counts = [];
|
|
351
|
+
if (errors.length)
|
|
352
|
+
counts.push(removed(`${errors.length} error${errors.length !== 1 ? 's' : ''}`));
|
|
353
|
+
if (warns.length)
|
|
354
|
+
counts.push(changed(`${warns.length} warning${warns.length !== 1 ? 's' : ''}`));
|
|
355
|
+
if (infos.length)
|
|
356
|
+
counts.push(dim(`${infos.length} info`));
|
|
357
|
+
console.log('─'.repeat(40));
|
|
358
|
+
console.log(counts.join(' '));
|
|
359
|
+
if (ok) {
|
|
360
|
+
console.log();
|
|
361
|
+
console.log(added('✓') + ' ' + dim('no errors — project can be linked to fabric'));
|
|
362
|
+
}
|
|
363
|
+
};
|