@pikku/cli 0.12.42 → 0.12.43

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.
Files changed (84) hide show
  1. package/console-app/assets/index-AwGnKyWe.js +254 -0
  2. package/console-app/assets/index-VleHndkw.css +1 -0
  3. package/console-app/index.html +2 -2
  4. package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +1 -1
  5. package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +1 -1
  6. package/dist/.pikku/channel/pikku-channel-types.gen.js +1 -1
  7. package/dist/.pikku/cli/pikku-cli-channel.js +1 -1
  8. package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +10 -0
  9. package/dist/.pikku/cli/pikku-cli-client.gen.js +73 -0
  10. package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +1 -1
  11. package/dist/.pikku/cli/pikku-cli-types.gen.js +1 -1
  12. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +1 -1
  13. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.json +1 -26
  14. package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +1 -1
  15. package/dist/.pikku/cli/pikku-cli-wirings.gen.js +1 -1
  16. package/dist/.pikku/cli/pikku-cli.gen.d.ts +1 -1
  17. package/dist/.pikku/cli/pikku-cli.gen.js +1 -1
  18. package/dist/.pikku/console/pikku-node-types.gen.d.ts +1 -1
  19. package/dist/.pikku/function/pikku-function-types.gen.d.ts +2 -2
  20. package/dist/.pikku/function/pikku-function-types.gen.js +3 -2
  21. package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
  22. package/dist/.pikku/function/pikku-functions-meta.gen.json +80 -80
  23. package/dist/.pikku/function/pikku-functions.gen.js +1 -1
  24. package/dist/.pikku/http/pikku-http-types.gen.d.ts +1 -1
  25. package/dist/.pikku/http/pikku-http-types.gen.js +1 -1
  26. package/dist/.pikku/http/pikku-http-wirings-meta.gen.js +1 -1
  27. package/dist/.pikku/http/pikku-http-wirings.gen.d.ts +1 -1
  28. package/dist/.pikku/http/pikku-http-wirings.gen.js +1 -1
  29. package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +1 -1
  30. package/dist/.pikku/mcp/pikku-mcp-types.gen.js +1 -1
  31. package/dist/.pikku/pikku-bootstrap.gen.d.ts +1 -1
  32. package/dist/.pikku/pikku-bootstrap.gen.js +1 -1
  33. package/dist/.pikku/pikku-meta-service.gen.d.ts +1 -1
  34. package/dist/.pikku/pikku-meta-service.gen.js +1 -1
  35. package/dist/.pikku/pikku-services.gen.d.ts +2 -2
  36. package/dist/.pikku/pikku-types.gen.d.ts +1 -1
  37. package/dist/.pikku/pikku-types.gen.js +1 -1
  38. package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +1 -1
  39. package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -1
  40. package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +1 -1
  41. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +1 -1
  42. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +1 -1
  43. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +1 -1
  44. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +2 -2
  45. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +1 -1
  46. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
  47. package/dist/.pikku/schemas/register.gen.js +3 -3
  48. package/dist/.pikku/schemas/schemas/DeployApplyInput.schema.json +1 -1
  49. package/dist/.pikku/schemas/schemas/DeployPlanInput.schema.json +1 -1
  50. package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +1 -1
  51. package/dist/.pikku/secrets/pikku-secret-types.gen.js +1 -1
  52. package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +1 -1
  53. package/dist/.pikku/secrets/pikku-secrets.gen.js +1 -1
  54. package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +1 -1
  55. package/dist/.pikku/trigger/pikku-trigger-types.gen.js +1 -1
  56. package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +1 -1
  57. package/dist/.pikku/variables/pikku-variable-types.gen.js +1 -1
  58. package/dist/.pikku/variables/pikku-variables.gen.d.ts +1 -1
  59. package/dist/.pikku/variables/pikku-variables.gen.js +1 -1
  60. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +1 -1
  61. package/dist/.pikku/workflow/pikku-workflow-types.gen.js +1 -1
  62. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +1 -1
  63. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
  64. package/dist/bin/pikku-bin.mjs +2 -2
  65. package/dist/src/deploy/build-pipeline.d.ts +2 -0
  66. package/dist/src/deploy/build-pipeline.js +7 -1
  67. package/dist/src/deploy/bundler/bundler.d.ts +2 -0
  68. package/dist/src/deploy/bundler/bundler.js +8 -5
  69. package/dist/src/functions/commands/deploy-apply.d.ts +3 -0
  70. package/dist/src/functions/commands/deploy-apply.js +1 -0
  71. package/dist/src/functions/commands/deploy-plan.d.ts +3 -0
  72. package/dist/src/functions/commands/deploy-plan.js +1 -0
  73. package/dist/src/functions/wirings/auth/pikku-command-auth.js +6 -1
  74. package/dist/src/functions/wirings/auth/serialize-auth-gen.d.ts +4 -1
  75. package/dist/src/functions/wirings/auth/serialize-auth-gen.js +36 -12
  76. package/dist/src/functions/wirings/functions/pikku-command-services.js +5 -4
  77. package/dist/src/functions/wirings/functions/serialize-function-types.js +3 -2
  78. package/dist/src/scaffold/rpc-remote.gen.js +1 -1
  79. package/dist/src/services.d.ts +6 -1
  80. package/dist/src/services.js +6 -12
  81. package/dist/tsconfig.tsbuildinfo +1 -1
  82. package/package.json +3 -3
  83. package/console-app/assets/index-D9Z9rySK.js +0 -233
  84. package/console-app/assets/index-DwUzVI5k.css +0 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.42
2
+ * This file was generated by @pikku/cli@0.12.43
3
3
  */
4
4
  /**
5
5
  * Queue-specific type definitions for tree-shaking optimization
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.42
2
+ * This file was generated by @pikku/cli@0.12.43
3
3
  */
4
4
  /**
5
5
  * Queue-specific type definitions for tree-shaking optimization
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.42
2
+ * This file was generated by @pikku/cli@0.12.43
3
3
  */
4
4
  import { pikkuState } from '@pikku/core/internal';
5
5
  import metaData from './pikku-queue-workers-wirings-meta.gen.json' with { type: 'json' };
@@ -1,4 +1,4 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.42
2
+ * This file was generated by @pikku/cli@0.12.43
3
3
  */
4
4
  import '../../src/scaffold/rpc-remote.gen.js';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.42
2
+ * This file was generated by @pikku/cli@0.12.43
3
3
  */
4
4
  /* The files with an addQueueWorkers function call */
5
5
  import '../../src/scaffold/rpc-remote.gen.js';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.42
2
+ * This file was generated by @pikku/cli@0.12.43
3
3
  */
4
4
  import { pikkuState } from '@pikku/core/internal';
5
5
  import metaData from './pikku-rpc-wirings-meta.internal.gen.json' with { type: 'json' };
@@ -100,11 +100,11 @@
100
100
  "pikkuAIAgentTypes": "pikkuAIAgentTypes",
101
101
  "pikkuAIAgent": "pikkuAIAgent",
102
102
  "pikkuPublicAgent": "pikkuPublicAgent",
103
- "pikkuAuth": "pikkuAuth",
104
103
  "pikkuChannels": "pikkuChannels",
105
104
  "pikkuChannelTypes": "pikkuChannelTypes",
106
105
  "pikkuChannelsMap": "pikkuChannelsMap",
107
106
  "pikkuCommandChannels": "pikkuCommandChannels",
107
+ "pikkuAuth": "pikkuAuth",
108
108
  "pikkuCLIEntry": "pikkuCLIEntry",
109
109
  "pikkuCLI": "pikkuCLI",
110
110
  "pikkuConsoleFunctions": "pikkuConsoleFunctions",
@@ -136,12 +136,12 @@
136
136
  "pikkuEventsScaffold": "pikkuEventsScaffold",
137
137
  "pikkuSchedulerTypes": "pikkuSchedulerTypes",
138
138
  "pikkuScheduler": "pikkuScheduler",
139
+ "pikkuSecrets": "pikkuSecrets",
139
140
  "pikkuPublicRPC": "pikkuPublicRPC",
140
141
  "pikkuRemoteRPC": "pikkuRemoteRPC",
141
142
  "pikkuRPCInternalMap": "pikkuRPCInternalMap",
142
143
  "pikkuRPCExposedMap": "pikkuRPCExposedMap",
143
144
  "pikkuRPC": "pikkuRPC",
144
- "pikkuSecrets": "pikkuSecrets",
145
145
  "pikkuTriggerTypes": "pikkuTriggerTypes",
146
146
  "pikkuTrigger": "pikkuTrigger",
147
147
  "pikkuVariables": "pikkuVariables",
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.42
2
+ * This file was generated by @pikku/cli@0.12.43
3
3
  */
4
4
  /**
5
5
  * Scheduler-specific type definitions for tree-shaking optimization
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.42
2
+ * This file was generated by @pikku/cli@0.12.43
3
3
  */
4
4
  /**
5
5
  * Scheduler-specific type definitions for tree-shaking optimization
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.42
2
+ * This file was generated by @pikku/cli@0.12.43
3
3
  */
4
4
  import { addSchema } from '@pikku/core/schema';
5
5
  import * as PikkuSchemasOutput from './schemas/PikkuSchemasOutput.schema.json' with { type: 'json' };
@@ -202,14 +202,14 @@ import * as PikkuConsoleFunctionsOutput from './schemas/PikkuConsoleFunctionsOut
202
202
  addSchema('PikkuConsoleFunctionsOutput', PikkuConsoleFunctionsOutput);
203
203
  import * as PikkuNodesMetaOutput from './schemas/PikkuNodesMetaOutput.schema.json' with { type: 'json' };
204
204
  addSchema('PikkuNodesMetaOutput', PikkuNodesMetaOutput);
205
- import * as PikkuGatewayOutput from './schemas/PikkuGatewayOutput.schema.json' with { type: 'json' };
206
- addSchema('PikkuGatewayOutput', PikkuGatewayOutput);
207
205
  import * as PikkuFunctionTypesSplitInput from './schemas/PikkuFunctionTypesSplitInput.schema.json' with { type: 'json' };
208
206
  addSchema('PikkuFunctionTypesSplitInput', PikkuFunctionTypesSplitInput);
209
207
  import * as PikkuFunctionTypesInput from './schemas/PikkuFunctionTypesInput.schema.json' with { type: 'json' };
210
208
  addSchema('PikkuFunctionTypesInput', PikkuFunctionTypesInput);
211
209
  import * as PikkuFunctionsOutput from './schemas/PikkuFunctionsOutput.schema.json' with { type: 'json' };
212
210
  addSchema('PikkuFunctionsOutput', PikkuFunctionsOutput);
211
+ import * as PikkuGatewayOutput from './schemas/PikkuGatewayOutput.schema.json' with { type: 'json' };
212
+ addSchema('PikkuGatewayOutput', PikkuGatewayOutput);
213
213
  import * as PikkuCommandHTTPOutput from './schemas/PikkuCommandHTTPOutput.schema.json' with { type: 'json' };
214
214
  addSchema('PikkuCommandHTTPOutput', PikkuCommandHTTPOutput);
215
215
  import * as PikkuHTTPOutput from './schemas/PikkuHTTPOutput.schema.json' with { type: 'json' };
@@ -1 +1 @@
1
- { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "fromPlan": { "type": "boolean" }, "provider": { "type": "string" }, "resultFile": { "type": "string" } }, "additionalProperties": false, "definitions": {} }
1
+ { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "fromPlan": { "type": "boolean" }, "provider": { "type": "string" }, "resultFile": { "type": "string" }, "debugArtifacts": { "type": "boolean" } }, "additionalProperties": false, "definitions": {} }
@@ -1 +1 @@
1
- { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "resultFile": { "type": "string" }, "provider": { "type": "string" } }, "additionalProperties": false, "definitions": {} }
1
+ { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "resultFile": { "type": "string" }, "provider": { "type": "string" }, "debugArtifacts": { "type": "boolean" } }, "additionalProperties": false, "definitions": {} }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.42
2
+ * This file was generated by @pikku/cli@0.12.43
3
3
  */
4
4
  export { wireSecret } from '@pikku/core/secret';
5
5
  export type { CoreSecret, SecretDefinitionMeta, SecretDefinitionsMeta } from '@pikku/core/secret';
@@ -1,4 +1,4 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.42
2
+ * This file was generated by @pikku/cli@0.12.43
3
3
  */
4
4
  export { wireSecret } from '@pikku/core/secret';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.42
2
+ * This file was generated by @pikku/cli@0.12.43
3
3
  */
4
4
  import { TypedSecretService as CoreTypedSecretService } from '@pikku/core/services';
5
5
  import type { SecretService } from '@pikku/core/services';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.42
2
+ * This file was generated by @pikku/cli@0.12.43
3
3
  */
4
4
  import { TypedSecretService as CoreTypedSecretService } from '@pikku/core/services';
5
5
  const CREDENTIALS_META = {};
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.42
2
+ * This file was generated by @pikku/cli@0.12.43
3
3
  */
4
4
  /**
5
5
  * Trigger-specific type definitions for tree-shaking optimization
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.42
2
+ * This file was generated by @pikku/cli@0.12.43
3
3
  */
4
4
  /**
5
5
  * Trigger-specific type definitions for tree-shaking optimization
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.42
2
+ * This file was generated by @pikku/cli@0.12.43
3
3
  */
4
4
  export { wireVariable } from '@pikku/core/variable';
5
5
  export type { CoreVariable, VariableDefinitionMeta, VariableDefinitionsMeta } from '@pikku/core/variable';
@@ -1,4 +1,4 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.42
2
+ * This file was generated by @pikku/cli@0.12.43
3
3
  */
4
4
  export { wireVariable } from '@pikku/core/variable';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.42
2
+ * This file was generated by @pikku/cli@0.12.43
3
3
  */
4
4
  import { TypedVariablesService as CoreTypedVariablesService } from '@pikku/core/services';
5
5
  import type { VariablesService } from '@pikku/core/services';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.42
2
+ * This file was generated by @pikku/cli@0.12.43
3
3
  */
4
4
  import { TypedVariablesService as CoreTypedVariablesService } from '@pikku/core/services';
5
5
  const VARIABLES_META = {};
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.42
2
+ * This file was generated by @pikku/cli@0.12.43
3
3
  */
4
4
  import { WorkflowCancelledException } from '@pikku/core/workflow';
5
5
  import { template } from '@pikku/core/workflow';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.42
2
+ * This file was generated by @pikku/cli@0.12.43
3
3
  */
4
4
  import { WorkflowCancelledException } from '@pikku/core/workflow';
5
5
  import { template } from '@pikku/core/workflow';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.42
2
+ * This file was generated by @pikku/cli@0.12.43
3
3
  */
4
4
  import { pikkuState } from '@pikku/core/internal';
5
5
  import allWorkflowMeta from './meta/allWorkflow.gen.json' with { type: 'json' };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.42
2
+ * This file was generated by @pikku/cli@0.12.43
3
3
  */
4
4
  import { addWorkflow } from '@pikku/core/workflow';
5
5
  import './pikku-workflow-wirings-meta.gen.js';
@@ -11,8 +11,8 @@ async function checkForUpdate() {
11
11
  })
12
12
  if (!res.ok) return
13
13
  const { version: latest } = await res.json()
14
- if (latest !== '0.12.42') {
15
- process.stderr.write(`\n Update available 0.12.42 → ${latest}\n brew upgrade pikku or npm install -g @pikku/cli\n\n`)
14
+ if (latest !== '0.12.43') {
15
+ process.stderr.write(`\n Update available 0.12.43 → ${latest}\n brew upgrade pikku or npm install -g @pikku/cli\n\n`)
16
16
  }
17
17
  } catch {}
18
18
  }
@@ -38,5 +38,7 @@ export declare function runBuildPipeline(options: {
38
38
  getEntryContext: (unitDir: string, pikkuDir: string, unit: DeploymentManifest['units'][0], state: InspectorState) => unknown;
39
39
  deployDir?: string;
40
40
  outDir?: string;
41
+ /** Emit sourcemaps + per-unit `metafile.json` (debug-only). Default false. */
42
+ debugArtifacts?: boolean;
41
43
  logger: BuildLogger;
42
44
  }): Promise<BuildPipelineResult>;
@@ -38,7 +38,7 @@ function findLockfile(projectDir) {
38
38
  return null;
39
39
  }
40
40
  export async function runBuildPipeline(options) {
41
- const { projectDir, projectId, provider, inspectorState, getEntryContext, logger, } = options;
41
+ const { projectDir, projectId, provider, inspectorState, getEntryContext, debugArtifacts, logger, } = options;
42
42
  const deployDir = options.deployDir ?? join(projectDir, '.deploy');
43
43
  const providerDir = join(deployDir, provider.deployDirName);
44
44
  // Step 1: Analyze
@@ -86,6 +86,8 @@ export async function runBuildPipeline(options) {
86
86
  platform: provider.getPlatform?.(),
87
87
  format: provider.getFormat?.(),
88
88
  noRequireShim: provider.getNoRequireShim?.(),
89
+ sourcemap: debugArtifacts,
90
+ emitMetafile: debugArtifacts,
89
91
  });
90
92
  bundled = bundleResult.results;
91
93
  bundleErrors = bundleResult.errors;
@@ -209,6 +211,8 @@ export async function runBuildPipeline(options) {
209
211
  platform: provider.getPlatform?.(),
210
212
  format: provider.getFormat?.(),
211
213
  noRequireShim: provider.getNoRequireShim?.(),
214
+ sourcemap: debugArtifacts,
215
+ emitMetafile: debugArtifacts,
212
216
  resolveOutputDir: (unit) => join(unitsDir, unit.name),
213
217
  });
214
218
  aggregated.push(...result.results);
@@ -231,6 +235,8 @@ export async function runBuildPipeline(options) {
231
235
  platform: 'node',
232
236
  format: 'esm',
233
237
  noRequireShim: false,
238
+ sourcemap: debugArtifacts,
239
+ emitMetafile: debugArtifacts,
234
240
  resolveOutputDir: () => containerDir,
235
241
  });
236
242
  aggregated.push(...result.results);
@@ -28,5 +28,7 @@ export declare function bundleUnits(projectDir: string, manifest: DeploymentMani
28
28
  platform?: 'node' | 'neutral' | 'browser';
29
29
  format?: 'esm' | 'cjs';
30
30
  noRequireShim?: boolean;
31
+ sourcemap?: boolean;
32
+ emitMetafile?: boolean;
31
33
  resolveOutputDir?: (unit: DeploymentUnit, baseOutputDir: string) => string;
32
34
  }): Promise<BundleOutput>;
@@ -81,7 +81,7 @@ const EXACT_DEPENDENCIES_FILENAME = 'exact-dependencies.json';
81
81
  * - package.json: Minimal manifest with only the external deps this unit needs
82
82
  */
83
83
  async function bundleUnit(options) {
84
- const { unit, entryPath, unitOutputDir, projectDir, externals, aliases, define, platform, format, } = options;
84
+ const { unit, entryPath, unitOutputDir, projectDir, externals, aliases, define, platform, format, sourcemap, emitMetafile, } = options;
85
85
  await mkdir(unitOutputDir, { recursive: true });
86
86
  const bundlePath = join(unitOutputDir, BUNDLE_FILENAME);
87
87
  const metafilePath = join(unitOutputDir, METAFILE_FILENAME);
@@ -133,7 +133,7 @@ async function bundleUnit(options) {
133
133
  target: 'es2022',
134
134
  outfile: bundlePath,
135
135
  minify: false,
136
- sourcemap: true,
136
+ sourcemap: sourcemap ?? false,
137
137
  logLevel: 'warning',
138
138
  loader: { '.ts': 'ts' },
139
139
  external: externals ?? ['node:*'],
@@ -141,9 +141,12 @@ async function bundleUnit(options) {
141
141
  define,
142
142
  plugins: [createDeadModuleStubPlugin(deadPatterns)],
143
143
  });
144
- // Write metafile
145
- const metafileJson = JSON.stringify(result.metafile, null, 2);
146
- await writeFile(metafilePath, metafileJson, 'utf-8');
144
+ // Always produced in-memory (drives dependency extraction); only persisted
145
+ // when requested — it's large (~1.6MB/unit) and never needed at runtime.
146
+ if (emitMetafile) {
147
+ const metafileJson = JSON.stringify(result.metafile, null, 2);
148
+ await writeFile(metafilePath, metafileJson, 'utf-8');
149
+ }
147
150
  // Extract dependencies and generate minimal package.json
148
151
  const { exactDependencies, exactOptionalDependencies } = await extractDependencies(result.metafile, projectDir);
149
152
  const packageJson = generateMinimalPackageJson(unit.name, exactDependencies, exactOptionalDependencies);
@@ -11,12 +11,15 @@ export declare const deployApply: import("#pikku").PikkuFunctionConfig<{
11
11
  fromPlan?: boolean;
12
12
  provider?: string;
13
13
  resultFile?: string;
14
+ debugArtifacts?: boolean;
14
15
  }, void, "session" | "rpc", import("#pikku").PikkuFunctionSessionless<{
15
16
  fromPlan?: boolean;
16
17
  provider?: string;
17
18
  resultFile?: string;
19
+ debugArtifacts?: boolean;
18
20
  }, void, "session" | "rpc", import("#pikku").Services> | import("#pikku").PikkuFunction<{
19
21
  fromPlan?: boolean;
20
22
  provider?: string;
21
23
  resultFile?: string;
24
+ debugArtifacts?: boolean;
22
25
  }, void, "session" | "rpc", import("#pikku").Services>, undefined, undefined>;
@@ -180,6 +180,7 @@ export const deployApply = pikkuSessionlessFunc({
180
180
  serverlessIncompatible: config.deploy?.serverlessIncompatible,
181
181
  getEntryContext,
182
182
  outDir: config.outDir,
183
+ debugArtifacts: data?.debugArtifacts ?? false,
183
184
  logger,
184
185
  });
185
186
  if (buildResult.manifest.units.length === 0) {
@@ -1,10 +1,13 @@
1
1
  export declare const deployPlan: import("#pikku").PikkuFunctionConfig<{
2
2
  resultFile?: string;
3
3
  provider?: string;
4
+ debugArtifacts?: boolean;
4
5
  }, void, "session" | "rpc", import("#pikku").PikkuFunctionSessionless<{
5
6
  resultFile?: string;
6
7
  provider?: string;
8
+ debugArtifacts?: boolean;
7
9
  }, void, "session" | "rpc", import("#pikku").Services> | import("#pikku").PikkuFunction<{
8
10
  resultFile?: string;
9
11
  provider?: string;
12
+ debugArtifacts?: boolean;
10
13
  }, void, "session" | "rpc", import("#pikku").Services>, undefined, undefined>;
@@ -56,6 +56,7 @@ export const deployPlan = pikkuSessionlessFunc({
56
56
  serverlessIncompatible: config.deploy?.serverlessIncompatible,
57
57
  getEntryContext,
58
58
  outDir: config.outDir,
59
+ debugArtifacts: data?.debugArtifacts ?? false,
59
60
  logger,
60
61
  });
61
62
  if (result.manifest.units.length === 0) {
@@ -16,13 +16,18 @@ export const pikkuAuth = pikkuSessionlessFunc({
16
16
  // has no OAuth providers — still generates its /auth/* wiring.
17
17
  if (!state.auth.definition)
18
18
  return;
19
- const { wiring, secrets } = serializeAuthGen(state.auth.definition, state.auth.providers, authFile, typesDeclarationFile, packageMappings ?? {});
19
+ const { wiring, secrets, middleware } = serializeAuthGen(state.auth.definition, state.auth.providers, authFile, typesDeclarationFile, packageMappings ?? {});
20
20
  // The secrets file sits alongside authFile so re-inspection rediscovers it.
21
21
  // It is kept separate from the wiring file because the CLI forbids Zod
22
22
  // schemas and HTTP wiring (wireHTTPRoutes) in the same file (PKU490).
23
23
  const secretsFile = join(dirname(authFile), 'auth-secrets.gen.ts');
24
24
  await writeFileInDir(logger, authFile, wiring);
25
25
  await writeFileInDir(logger, secretsFile, secrets);
26
+ // Stateless split: session middleware in its own file (see serializeAuthGen).
27
+ const middlewareFile = join(dirname(authFile), 'auth-middleware.gen.ts');
28
+ if (middleware) {
29
+ await writeFileInDir(logger, middlewareFile, middleware);
30
+ }
26
31
  // Static metadata of the enabled providers/plugins for the console SSO page,
27
32
  // following the `*-meta.gen.json` convention. Read at runtime by the console
28
33
  // getAuthProviders function instead of a runtime registry.
@@ -10,10 +10,13 @@ import type { AuthDefinition } from '@pikku/inspector';
10
10
  * separated out.
11
11
  */
12
12
  export interface AuthGenOutput {
13
- /** The HTTP wiring file (authFile): handler + catch-all routes + session middleware. */
13
+ /** Handler + catch-all routes (+ session middleware, unless split out). */
14
14
  wiring: string;
15
15
  /** The secrets file: Zod schemas + wireSecret/wireVariable. */
16
16
  secrets: string;
17
+ /** Global session-middleware registration, split into its own file only when
18
+ * `session.cookieCache` is enabled (stateless path); undefined otherwise. */
19
+ middleware?: string;
17
20
  }
18
21
  /**
19
22
  * Generates the `auth.gen.ts` (HTTP wiring) and `auth-secrets.gen.ts` (schemas +
@@ -111,15 +111,20 @@ export const serializeAuthGen = (definition, providers, authFile, typesDeclarati
111
111
  secrets.push('');
112
112
  }
113
113
  }
114
- // ─── Wiring file: handler + catch-all routes + session middleware ─────────
115
- // Provider/plugin metadata for the console SSO page is emitted separately as
116
- // `auth-meta.gen.json` (see serializeAuthMeta) rather than wired into the
117
- // runtime, so it is available without evaluating the better-auth factory.
114
+ // Wiring file: handler + catch-all routes. When cookieCache is enabled the
115
+ // global session middleware is split into its own file (see below) so this
116
+ // file's auth.wiring import (the full better-auth server) isn't dragged into
117
+ // every unit only the auth unit bundles it.
118
+ const stateless = definition.cookieCache;
118
119
  const wiring = [
119
120
  '// AUTO-GENERATED by pikku CLI — do not edit',
120
121
  '',
121
- `import { pikkuSessionlessFunc, wireHTTPRoutes, addHTTPMiddleware } from '${pikkuTypesImportPath}'`,
122
- `import { createAuthHandler, betterAuthSession } from '@pikku/better-auth'`,
122
+ stateless
123
+ ? `import { pikkuSessionlessFunc, wireHTTPRoutes } from '${pikkuTypesImportPath}'`
124
+ : `import { pikkuSessionlessFunc, wireHTTPRoutes, addHTTPMiddleware } from '${pikkuTypesImportPath}'`,
125
+ stateless
126
+ ? `import { createAuthHandler } from '@pikku/better-auth'`
127
+ : `import { createAuthHandler, betterAuthSession } from '@pikku/better-auth'`,
123
128
  `import '${configImportPath}'`,
124
129
  '',
125
130
  // createAuthHandler is called once at module load; the exported handler is a
@@ -132,12 +137,13 @@ export const serializeAuthGen = (definition, providers, authFile, typesDeclarati
132
137
  ` authConfigHandler.func(services, data, interaction),`,
133
138
  `})`,
134
139
  '',
135
- // Bridge the better-auth session into the Pikku session on every request.
136
- `addHTTPMiddleware('*', [betterAuthSession()])`,
137
- '',
138
- `wireHTTPRoutes({`,
139
- ` routes: {`,
140
140
  ];
141
+ if (!stateless) {
142
+ // Stateful: betterAuthSession calls services.auth(), so it stays here with
143
+ // the auth.wiring import.
144
+ wiring.push(`addHTTPMiddleware('*', [betterAuthSession()])`, '');
145
+ }
146
+ wiring.push(`wireHTTPRoutes({`, ` routes: {`);
141
147
  // One catch-all route per method. `{/*splat}` matches both the bare basePath
142
148
  // and every sub-path under it, so better-auth's internal router sees the full
143
149
  // request and handles all of its own endpoints.
@@ -147,5 +153,23 @@ export const serializeAuthGen = (definition, providers, authFile, typesDeclarati
147
153
  wiring.push(` },`);
148
154
  wiring.push(`})`);
149
155
  wiring.push('');
150
- return { wiring: wiring.join('\n'), secrets: secrets.join('\n') };
156
+ const output = {
157
+ wiring: wiring.join('\n'),
158
+ secrets: secrets.join('\n'),
159
+ };
160
+ if (stateless) {
161
+ // Stateless session middleware in its own file — imports neither auth.wiring
162
+ // nor the better-auth server, so every unit's bootstrap stays lean.
163
+ const middleware = [
164
+ '// AUTO-GENERATED by pikku CLI — do not edit',
165
+ '',
166
+ `import { addHTTPMiddleware } from '${pikkuTypesImportPath}'`,
167
+ `import { betterAuthStatelessSession } from '@pikku/better-auth'`,
168
+ '',
169
+ `addHTTPMiddleware('*', [betterAuthStatelessSession()])`,
170
+ '',
171
+ ];
172
+ output.middleware = middleware.join('\n');
173
+ }
174
+ return output;
151
175
  };
@@ -34,8 +34,9 @@ export const serializeServicesMap = (allSingletonServices, allWireServices, requ
34
34
  defaultServices.forEach((service) => usedServices.add(service));
35
35
  // When a pikkuBetterAuth factory is present, the generated `pikkuServices`
36
36
  // wrapper always injects a resolved `auth` singleton. Mark it required so
37
- // RequiredSingletonServices keeps `auth` non-optional and stays assignable
38
- // to a SingletonServices type that types `auth` from the factory's return.
37
+ // RequiredSingletonServices can mark `auth` as a required property and stay
38
+ // assignable to a SingletonServices type that types `auth` from the
39
+ // factory's return.
39
40
  if (authInjected) {
40
41
  usedServices.add('auth');
41
42
  }
@@ -79,11 +80,11 @@ export const serializeServicesMap = (allSingletonServices, allWireServices, requ
79
80
  '',
80
81
  '// Type exports',
81
82
  requiredSingletonServiceNames.length > 0
82
- ? `export type RequiredSingletonServices = Pick<SingletonServices, ${requiredSingletonServiceNames.map((key) => `'${key}'`).join(' | ')}> & Partial<Omit<SingletonServices, ${requiredSingletonServiceNames.map((key) => `'${key}'`).join(' | ')}>>`
83
+ ? `export type RequiredSingletonServices = Required<Pick<SingletonServices, ${requiredSingletonServiceNames.map((key) => `'${key}'`).join(' | ')}>> & Partial<Omit<SingletonServices, ${requiredSingletonServiceNames.map((key) => `'${key}'`).join(' | ')}>>`
83
84
  : 'export type RequiredSingletonServices = Partial<SingletonServices>',
84
85
  '',
85
86
  requiredWireServiceNames.length > 0
86
- ? `export type RequiredWireServices = Pick<Services, ${requiredWireServiceNames.map((key) => `'${key}'`).join(' | ')}> & Partial<Omit<Services, ${requiredWireServiceNames.map((key) => `'${key}'`).join(' | ')}>>`
87
+ ? `export type RequiredWireServices = Required<Pick<Services, ${requiredWireServiceNames.map((key) => `'${key}'`).join(' | ')}>> & Partial<Omit<Services, ${requiredWireServiceNames.map((key) => `'${key}'`).join(' | ')}>>`
87
88
  : 'export type RequiredWireServices = Partial<Services>',
88
89
  '',
89
90
  ...(addonRequiredParentServices.length > 0
@@ -629,10 +629,11 @@ export const pikkuConfig = (
629
629
  * \`\`\`
630
630
  */
631
631
  export const pikkuServices = (
632
- func: (config: Config, existingServices: Partial<SingletonServices>) => Promise<Omit<RequiredSingletonServices, 'auth'>>
632
+ func: (config: Config, existingServices: Partial<SingletonServices>) => Promise<Partial<Omit<RequiredSingletonServices, 'auth'>>>
633
633
  ) => {
634
634
  return async (config: Config, existingServices: Partial<SingletonServices> = {}) => {
635
- const services = await func(config, existingServices)
635
+ const createdServices = await func(config, existingServices)
636
+ const services = { ...existingServices, ...createdServices }
636
637
  const authFactory = __pikkuState(null, 'package', 'authFactory')
637
638
  if (authFactory) {
638
639
  let authInstance: Promise<unknown> | undefined
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.42
2
+ * This file was generated by @pikku/cli@0.12.43
3
3
  */
4
4
  /**
5
5
  * Auto-generated remote internal RPC queue worker and HTTP endpoint
@@ -1,12 +1,17 @@
1
1
  import type { Config, Services, SingletonServices, UserSession } from '../types/application-types.js';
2
2
  import type { CreateConfig } from '@pikku/core';
3
3
  import type { CreateWireServices, CreateSingletonServices } from '@pikku/core/internal';
4
+ import { LogLevel } from '@pikku/core/services';
4
5
  import type { PikkuCLIConfig } from '../types/config.js';
5
6
  import type { ForwardedLogMessage } from './services/cli-logger-forwarder.service.js';
6
7
  /**
7
8
  * Default CLI renderer that logs output using the logger
8
9
  */
9
- export declare const defaultCLIRenderer: import("@pikku/core/cli").CorePikkuCLIRender<ForwardedLogMessage, SingletonServices, import("@pikku/core").CoreUserSession>;
10
+ export declare const defaultCLIRenderer: import("@pikku/core/cli").CorePikkuCLIRender<ForwardedLogMessage, import("@pikku/core").CoreSingletonServices<{
11
+ logLevel?: LogLevel;
12
+ secrets?: {};
13
+ workflow?: import("@pikku/core/workflow").WorkflowServiceConfig;
14
+ }>, import("@pikku/core").CoreUserSession>;
10
15
  export declare const createConfig: CreateConfig<Config, [PikkuCLIConfig]>;
11
16
  /**
12
17
  * Singleton services factory for the Pikku CLI
@@ -32,7 +32,7 @@ const logger = new CLILogger({ logLogo: false, silent: false });
32
32
  /**
33
33
  * Default CLI renderer that logs output using the logger
34
34
  */
35
- export const defaultCLIRenderer = pikkuCLIRender(({ logger }, data) => {
35
+ export const defaultCLIRenderer = pikkuCLIRender((_services, data) => {
36
36
  if (!data)
37
37
  return;
38
38
  const validLevels = [
@@ -46,17 +46,6 @@ export const defaultCLIRenderer = pikkuCLIRender(({ logger }, data) => {
46
46
  return;
47
47
  logger[data.level]({ message: data.message, type: data.type });
48
48
  });
49
- // /**
50
- // * Client-safe CLI renderer that outputs to console (no service dependencies)
51
- // * This renderer can be used in CLI-over-channel clients
52
- // */
53
- // export const clientCLIRenderer = pikkuCLIRender<ForwardedLogMessage>(
54
- // ({ logger }, data) => {
55
- // if (data) {
56
- // logger[data.level]?.({ message: data.message, type: data.type } as any)
57
- // }
58
- // }
59
- // )
60
49
  export const createConfig = async (_variablesService, data) => {
61
50
  // Determine log level based on CLI flags with precedence:
62
51
  // --silent > --loglevel > --verbose > --info > default (info)
@@ -195,6 +184,11 @@ export const createSingletonServices = async (config) => {
195
184
  config.authFile
196
185
  ? path.join(path.dirname(config.authFile), 'auth-secrets.gen.ts')
197
186
  : undefined,
187
+ // Stateless-session split: middleware-only file nothing imports, so it's
188
+ // unreachable via the import graph — add it explicitly to get inspected.
189
+ config.authFile
190
+ ? path.join(path.dirname(config.authFile), 'auth-middleware.gen.ts')
191
+ : undefined,
198
192
  ];
199
193
  for (const file of scaffoldFiles) {
200
194
  if (file && !wiringFiles.includes(file) && existsSync(file)) {