@pikku/cli 0.12.4 → 0.12.7
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-AX4YS8AA.js → index-sUj3oFEL.js} +1 -1
- package/console-app/index.html +1 -1
- package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +6 -6
- package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.js +1 -1
- package/dist/.pikku/agent/pikku-agent-wirings.gen.d.ts +1 -1
- package/dist/.pikku/agent/pikku-agent-wirings.gen.js +1 -1
- package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +1 -1
- package/dist/.pikku/channel/pikku-channel-types.gen.js +1 -1
- package/dist/.pikku/channel/pikku-channels-meta.gen.js +1 -1
- package/dist/.pikku/channel/pikku-channels.gen.d.ts +1 -1
- package/dist/.pikku/channel/pikku-channels.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-channel.js +1 -1
- package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-client.gen.js +1 -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 +11 -2
- 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 +13 -13
- package/dist/.pikku/function/pikku-function-types.gen.js +1 -1
- package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
- package/dist/.pikku/function/pikku-functions-meta.gen.json +88 -86
- package/dist/.pikku/function/pikku-functions.gen.js +1 -1
- 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/mcp/pikku-mcp-wirings-meta.gen.js +1 -1
- package/dist/.pikku/mcp/pikku-mcp-wirings.gen.d.ts +1 -1
- package/dist/.pikku/mcp/pikku-mcp-wirings.gen.js +1 -1
- package/dist/.pikku/pikku-bootstrap.gen.js +1 -1
- package/dist/.pikku/pikku-services.gen.d.ts +1 -1
- package/dist/.pikku/pikku-types.gen.d.ts +1 -1
- package/dist/.pikku/pikku-types.gen.js +1 -1
- package/dist/.pikku/pikku-websocket.gen.d.ts +1 -1
- package/dist/.pikku/pikku-websocket.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.js +1 -1
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +1 -1
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +1 -1
- package/dist/.pikku/rpc/pikku-remote-rpc-workers.gen.js +1 -1
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +1 -1
- 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/scheduler/pikku-schedulers-wirings-meta.gen.js +1 -1
- package/dist/.pikku/scheduler/pikku-schedulers-wirings.gen.d.ts +1 -1
- package/dist/.pikku/scheduler/pikku-schedulers-wirings.gen.js +1 -1
- package/dist/.pikku/schemas/register.gen.js +5 -3
- package/dist/.pikku/schemas/schemas/ConsoleCommandInput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/WatchInput.schema.json +1 -0
- 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/pikku-workflow-types.gen.d.ts +34 -5
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js +5 -5
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +1 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.d.ts +1 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
- package/dist/src/cli.wiring.js +11 -1
- package/dist/src/functions/commands/all.js +16 -1
- package/dist/src/functions/commands/console.d.ts +3 -0
- package/dist/src/functions/commands/console.js +8 -1
- package/dist/src/functions/commands/new-addon.js +24 -18
- package/dist/src/functions/commands/versions-check.js +4 -4
- package/dist/src/functions/commands/versions-init.js +1 -1
- package/dist/src/functions/commands/versions-update.js +1 -1
- package/dist/src/functions/commands/watch.d.ts +7 -1
- package/dist/src/functions/commands/watch.js +10 -3
- package/dist/src/functions/runtimes/nextjs/pikku-command-nextjs.js +2 -2
- package/dist/src/functions/runtimes/nextjs/serialize-nextjs-backend-wrapper.d.ts +1 -1
- package/dist/src/functions/runtimes/nextjs/serialize-nextjs-backend-wrapper.js +2 -2
- 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 +2 -2
- package/dist/src/functions/wirings/ai-agent/pikku-command-public-agent.js +1 -1
- package/dist/src/functions/wirings/ai-agent/serialize-ai-agent-types.js +12 -6
- package/dist/src/functions/wirings/ai-agent/serialize-public-agent.d.ts +1 -1
- package/dist/src/functions/wirings/ai-agent/serialize-public-agent.js +5 -5
- package/dist/src/functions/wirings/cli/pikku-command-cli-entry.js +1 -1
- package/dist/src/functions/wirings/cli/serialize-channel-cli.d.ts +1 -1
- package/dist/src/functions/wirings/cli/serialize-channel-cli.js +2 -2
- package/dist/src/functions/wirings/console/pikku-command-console-functions.js +1 -1
- package/dist/src/functions/wirings/console/serialize-console-functions.d.ts +1 -1
- package/dist/src/functions/wirings/console/serialize-console-functions.js +15 -2
- package/dist/src/functions/wirings/functions/serialize-function-types.js +15 -15
- package/dist/src/functions/wirings/rpc/pikku-command-public-rpc.js +1 -1
- package/dist/src/functions/wirings/rpc/pikku-command-rpc-client.js +1 -1
- package/dist/src/functions/wirings/rpc/serialize-public-rpc.d.ts +1 -1
- package/dist/src/functions/wirings/rpc/serialize-public-rpc.js +4 -4
- package/dist/src/functions/wirings/rpc/serialize-rpc-wrapper.d.ts +1 -1
- package/dist/src/functions/wirings/rpc/serialize-rpc-wrapper.js +6 -6
- package/dist/src/functions/wirings/workflow/serialize-workflow-types.js +63 -8
- package/dist/src/services.js +1 -1
- package/dist/src/utils/pikku-cli-config.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -4
- package/dist/src/utils/openapi/codegen.d.ts +0 -20
- package/dist/src/utils/openapi/codegen.js +0 -456
- package/dist/src/utils/openapi/naming.d.ts +0 -30
- package/dist/src/utils/openapi/naming.js +0 -167
- package/dist/src/utils/openapi/parse-openapi.d.ts +0 -61
- package/dist/src/utils/openapi/parse-openapi.js +0 -306
- package/dist/src/utils/openapi/zod-codegen.d.ts +0 -1
- package/dist/src/utils/openapi/zod-codegen.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was generated by @pikku/cli@0.12.
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.7
|
|
3
3
|
*/
|
|
4
4
|
export { wireVariable } from '@pikku/core/variable';
|
|
5
5
|
export type { CoreVariable, VariableDefinitionMeta, VariableDefinitionsMeta } from '@pikku/core/variable';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was generated by @pikku/cli@0.12.
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.7
|
|
3
3
|
*/
|
|
4
4
|
import { WorkflowCancelledException } from '@pikku/core/workflow';
|
|
5
5
|
import { template } from '@pikku/core/workflow';
|
|
@@ -7,16 +7,45 @@ import { type PikkuWorkflowGraphConfig, type PikkuWorkflowGraphResult } from '@p
|
|
|
7
7
|
import type { PikkuWorkflowWire, WorkflowStepOptions } from '@pikku/core/workflow';
|
|
8
8
|
export { WorkflowCancelledException };
|
|
9
9
|
import type { PikkuFunctionSessionless, PikkuFunctionConfig } from '../function/pikku-function-types.gen.js';
|
|
10
|
-
import type {
|
|
10
|
+
import type { FlattenedRPCMap } from '../rpc/pikku-rpc-wirings-map.internal.gen.d.js';
|
|
11
11
|
import type { WorkflowMap, GraphsMap } from './pikku-workflow-map.gen.d.js';
|
|
12
12
|
export { template };
|
|
13
13
|
export interface TypedWorkflow extends PikkuWorkflowWire {
|
|
14
|
-
do<K extends keyof
|
|
14
|
+
do<K extends keyof FlattenedRPCMap>(stepName: string, rpcName: K, data: FlattenedRPCMap[K]['input'], options?: WorkflowStepOptions): Promise<FlattenedRPCMap[K]['output']>;
|
|
15
|
+
do<K extends keyof WorkflowMap>(stepName: string, workflowName: K, data: WorkflowMap[K]['input'], options?: WorkflowStepOptions): Promise<WorkflowMap[K]['output']>;
|
|
15
16
|
do<T>(stepName: string, fn: () => T | Promise<T>, options?: WorkflowStepOptions): Promise<T>;
|
|
16
17
|
}
|
|
18
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
19
|
+
import type { InferSchemaOutput, PikkuPermission, PikkuMiddleware, NodeConfig, PikkuApprovalDescription } from '../function/pikku-function-types.gen.js';
|
|
20
|
+
import { PikkuError } from '@pikku/core/errors';
|
|
21
|
+
import type { CorePermissionGroup } from '@pikku/core';
|
|
17
22
|
export type PikkuFunctionWorkflow<In = unknown, Out = never> = PikkuFunctionSessionless<In, Out, 'workflow'>;
|
|
18
|
-
export
|
|
19
|
-
|
|
23
|
+
export type PikkuWorkflowConfigWithSchema<InputSchema extends StandardSchemaV1 | undefined = undefined, OutputSchema extends StandardSchemaV1 | undefined = undefined> = {
|
|
24
|
+
title?: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
tags?: string[];
|
|
27
|
+
expose?: boolean;
|
|
28
|
+
internal?: boolean;
|
|
29
|
+
override?: string;
|
|
30
|
+
version?: number;
|
|
31
|
+
remote?: boolean;
|
|
32
|
+
mcp?: boolean;
|
|
33
|
+
readonly?: boolean;
|
|
34
|
+
approvalRequired?: boolean;
|
|
35
|
+
approvalDescription?: InputSchema extends StandardSchemaV1 ? PikkuApprovalDescription<InferSchemaOutput<InputSchema>> : never;
|
|
36
|
+
func: PikkuFunctionWorkflow<InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown>;
|
|
37
|
+
auth?: boolean;
|
|
38
|
+
permissions?: InputSchema extends StandardSchemaV1 ? CorePermissionGroup<PikkuPermission<InferSchemaOutput<InputSchema>>> : undefined;
|
|
39
|
+
middleware?: PikkuMiddleware[];
|
|
40
|
+
input?: InputSchema;
|
|
41
|
+
output?: OutputSchema;
|
|
42
|
+
node?: NodeConfig;
|
|
43
|
+
errors?: Array<typeof PikkuError>;
|
|
44
|
+
};
|
|
45
|
+
export declare function pikkuWorkflowFunc<InputSchema extends StandardSchemaV1 | undefined = undefined, OutputSchema extends StandardSchemaV1 | undefined = undefined>(config: PikkuWorkflowConfigWithSchema<InputSchema, OutputSchema>): PikkuFunctionConfig<InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown, 'workflow', PikkuFunctionWorkflow<InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown>, InputSchema, OutputSchema>;
|
|
46
|
+
export declare function pikkuWorkflowFunc<In, Out = unknown>(func: PikkuFunctionWorkflow<In, Out> | PikkuFunctionConfig<In, Out, 'workflow', PikkuFunctionWorkflow<In, Out>>): PikkuFunctionConfig<In, Out, 'workflow'>;
|
|
47
|
+
export declare function pikkuWorkflowComplexFunc<InputSchema extends StandardSchemaV1 | undefined = undefined, OutputSchema extends StandardSchemaV1 | undefined = undefined>(config: PikkuWorkflowConfigWithSchema<InputSchema, OutputSchema>): PikkuFunctionConfig<InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown, 'workflow', PikkuFunctionWorkflow<InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown>, InputSchema, OutputSchema>;
|
|
48
|
+
export declare function pikkuWorkflowComplexFunc<In, Out = unknown>(func: PikkuFunctionWorkflow<In, Out> | PikkuFunctionConfig<In, Out, 'workflow', PikkuFunctionWorkflow<In, Out>>): PikkuFunctionConfig<In, Out, 'workflow'>;
|
|
20
49
|
type TypedRef<T> = {
|
|
21
50
|
$ref: string;
|
|
22
51
|
path?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was generated by @pikku/cli@0.12.
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.7
|
|
3
3
|
*/
|
|
4
4
|
import { WorkflowCancelledException } from '@pikku/core/workflow';
|
|
5
5
|
import { workflow as coreWorkflow, workflowStart as coreWorkflowStart, workflowStatus as coreWorkflowStatus, graphStart as coreGraphStart, } from '@pikku/core/workflow';
|
|
@@ -7,12 +7,12 @@ import { template } from '@pikku/core/workflow';
|
|
|
7
7
|
import { pikkuWorkflowGraph as corePikkuWorkflowGraph, } from '@pikku/core/workflow';
|
|
8
8
|
export { WorkflowCancelledException };
|
|
9
9
|
export { template };
|
|
10
|
-
export
|
|
10
|
+
export function pikkuWorkflowFunc(func) {
|
|
11
11
|
return typeof func === 'function' ? { func } : func;
|
|
12
|
-
}
|
|
13
|
-
export
|
|
12
|
+
}
|
|
13
|
+
export function pikkuWorkflowComplexFunc(func) {
|
|
14
14
|
return typeof func === 'function' ? { func } : func;
|
|
15
|
-
}
|
|
15
|
+
}
|
|
16
16
|
export function pikkuWorkflowGraph(config) {
|
|
17
17
|
return corePikkuWorkflowGraph(config);
|
|
18
18
|
}
|
package/dist/src/cli.wiring.js
CHANGED
|
@@ -87,6 +87,12 @@ wireCLI({
|
|
|
87
87
|
watch: pikkuCLICommand({
|
|
88
88
|
func: watch,
|
|
89
89
|
description: 'Watch for file changes and regenerate automatically',
|
|
90
|
+
options: {
|
|
91
|
+
hmr: {
|
|
92
|
+
description: 'Enable hot module reload for registered functions',
|
|
93
|
+
default: false,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
90
96
|
}),
|
|
91
97
|
console: pikkuCLICommand({
|
|
92
98
|
func: consoleCommand,
|
|
@@ -102,6 +108,10 @@ wireCLI({
|
|
|
102
108
|
default: 'false',
|
|
103
109
|
short: 'o',
|
|
104
110
|
},
|
|
111
|
+
hmr: {
|
|
112
|
+
description: 'Enable hot module reload for registered functions',
|
|
113
|
+
default: false,
|
|
114
|
+
},
|
|
105
115
|
},
|
|
106
116
|
}),
|
|
107
117
|
schemas: pikkuCLICommand({
|
|
@@ -279,7 +289,7 @@ wireCLI({
|
|
|
279
289
|
subcommands: {
|
|
280
290
|
init: pikkuCLICommand({
|
|
281
291
|
func: pikkuVersionsInit,
|
|
282
|
-
description: 'Initialize the version manifest (versions.json)',
|
|
292
|
+
description: 'Initialize the version manifest (versions.pikku.json)',
|
|
283
293
|
options: {
|
|
284
294
|
force: {
|
|
285
295
|
description: 'Overwrite existing manifest',
|
|
@@ -21,6 +21,21 @@ export const all = pikkuVoidFunc({
|
|
|
21
21
|
func: async ({ logger, config, getInspectorState }, _data, { rpc }) => {
|
|
22
22
|
const allImports = [];
|
|
23
23
|
let typesDeclarationFileExists = true;
|
|
24
|
+
if (!existsSync(config.outDir)) {
|
|
25
|
+
logger.debug(`• .pikku directory not found, running bootstrap first...`);
|
|
26
|
+
await getInspectorState(false, false, true);
|
|
27
|
+
await rpc.invoke('pikkuFunctionTypes', null);
|
|
28
|
+
await rpc.invoke('pikkuFunctionTypesSplit', null);
|
|
29
|
+
await rpc.invoke('pikkuHTTPTypes', null);
|
|
30
|
+
await rpc.invoke('pikkuChannelTypes', null);
|
|
31
|
+
await rpc.invoke('pikkuSchedulerTypes', null);
|
|
32
|
+
await rpc.invoke('pikkuQueueTypes', null);
|
|
33
|
+
await rpc.invoke('pikkuWorkflow', null);
|
|
34
|
+
await rpc.invoke('pikkuMCPTypes', null);
|
|
35
|
+
await rpc.invoke('pikkuAIAgentTypes', null);
|
|
36
|
+
await rpc.invoke('pikkuCLITypes', null);
|
|
37
|
+
await getInspectorState(true);
|
|
38
|
+
}
|
|
24
39
|
if (!existsSync(config.typesDeclarationFile)) {
|
|
25
40
|
typesDeclarationFileExists = false;
|
|
26
41
|
}
|
|
@@ -163,7 +178,7 @@ export const all = pikkuVoidFunc({
|
|
|
163
178
|
await rpc.invoke('pikkuVersionsUpdate', null);
|
|
164
179
|
}
|
|
165
180
|
catch {
|
|
166
|
-
logger.warn(`Run 'pikku init' to enable contract versioning.`);
|
|
181
|
+
logger.warn(`Run 'pikku versions init' to enable contract versioning.`);
|
|
167
182
|
}
|
|
168
183
|
await rpc.invoke('pikkuBootstrap', { allImports });
|
|
169
184
|
await rpc.invoke('pikkuSummary', null);
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
export declare const consoleCommand: import("#pikku").PikkuFunctionConfig<{
|
|
2
2
|
port?: string;
|
|
3
3
|
open?: string;
|
|
4
|
+
hmr?: boolean;
|
|
4
5
|
}, void, "session" | "rpc", import("#pikku").PikkuFunctionSessionless<{
|
|
5
6
|
port?: string;
|
|
6
7
|
open?: string;
|
|
8
|
+
hmr?: boolean;
|
|
7
9
|
}, void, "session" | "rpc", import("#pikku").Services> | import("#pikku").PikkuFunction<{
|
|
8
10
|
port?: string;
|
|
9
11
|
open?: string;
|
|
12
|
+
hmr?: boolean;
|
|
10
13
|
}, void, "session" | "rpc", import("#pikku").Services>, undefined, undefined>;
|
|
@@ -5,6 +5,7 @@ import { fileURLToPath } from 'url';
|
|
|
5
5
|
import { pikkuSessionlessFunc } from '#pikku';
|
|
6
6
|
import chokidar from 'chokidar';
|
|
7
7
|
import open from 'open';
|
|
8
|
+
import { pikkuDevReloader } from '@pikku/core/dev';
|
|
8
9
|
const MIME_TYPES = {
|
|
9
10
|
'.html': 'text/html',
|
|
10
11
|
'.js': 'application/javascript',
|
|
@@ -21,7 +22,7 @@ const MIME_TYPES = {
|
|
|
21
22
|
};
|
|
22
23
|
export const consoleCommand = pikkuSessionlessFunc({
|
|
23
24
|
remote: true,
|
|
24
|
-
func: async ({ logger, config }, { port, open: openBrowser }, { rpc }) => {
|
|
25
|
+
func: async ({ logger, config }, { port, open: openBrowser, hmr }, { rpc }) => {
|
|
25
26
|
if (!config.scaffold?.console) {
|
|
26
27
|
logger.error('Console is not enabled. Add { "scaffold": { "console": "no-auth" } } to your pikku.config.json');
|
|
27
28
|
return;
|
|
@@ -65,6 +66,12 @@ export const consoleCommand = pikkuSessionlessFunc({
|
|
|
65
66
|
open(`http://localhost:${resolvedPort}`);
|
|
66
67
|
}
|
|
67
68
|
});
|
|
69
|
+
if (hmr) {
|
|
70
|
+
await pikkuDevReloader({
|
|
71
|
+
srcDirectories: config.srcDirectories,
|
|
72
|
+
logger,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
68
75
|
const configWatcher = chokidar.watch(config.srcDirectories, {
|
|
69
76
|
ignoreInitial: true,
|
|
70
77
|
ignored: /.*\.gen\.tsx?/,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { existsSync } from 'fs';
|
|
2
2
|
import { join } from 'path';
|
|
3
3
|
import { mkdir, writeFile } from 'fs/promises';
|
|
4
|
+
import { createEmptyManifest, saveManifest, } from '../../utils/contract-versions.js';
|
|
4
5
|
import { pikkuSessionlessFunc } from '#pikku';
|
|
5
|
-
import { parseOpenAPISpec } from '
|
|
6
|
-
import { generateAddonFromOpenAPI } from '../../utils/openapi/codegen.js';
|
|
6
|
+
import { parseOpenAPISpec, computeContractHash, generateAddonFromOpenAPI, } from '@pikku/openapi-parser';
|
|
7
7
|
function toCamelCase(str) {
|
|
8
8
|
return str.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
9
9
|
}
|
|
@@ -31,14 +31,15 @@ function getAddonFiles(vars, flags) {
|
|
|
31
31
|
types: './dist/src/index.d.ts',
|
|
32
32
|
import: './dist/src/index.js',
|
|
33
33
|
},
|
|
34
|
-
'./.pikku/*': '
|
|
35
|
-
'./.pikku/pikku-metadata.gen.json': '
|
|
34
|
+
'./.pikku/*': './dist/.pikku/*',
|
|
35
|
+
'./.pikku/pikku-metadata.gen.json': './dist/.pikku/pikku-metadata.gen.json',
|
|
36
36
|
'./.pikku/rpc/pikku-rpc-wirings-map.internal.gen.js': {
|
|
37
|
-
types: '
|
|
37
|
+
types: './dist/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts',
|
|
38
38
|
},
|
|
39
39
|
},
|
|
40
|
-
files: ['dist'
|
|
40
|
+
files: ['dist'],
|
|
41
41
|
scripts: {
|
|
42
|
+
prepublishOnly: 'yarn build',
|
|
42
43
|
prebuild: 'pikku all',
|
|
43
44
|
build: 'tsc && cp -r .pikku dist/',
|
|
44
45
|
pikku: 'pikku all',
|
|
@@ -463,24 +464,16 @@ function getTestFiles(vars) {
|
|
|
463
464
|
wireAddon({ name: '${name}', package: '@pikku/addon-${name}' })
|
|
464
465
|
`;
|
|
465
466
|
// test/src/services.ts
|
|
466
|
-
files['src/services.ts'] = `import
|
|
467
|
-
SingletonServices,
|
|
468
|
-
} from '../types/application-types.js'
|
|
469
|
-
import {
|
|
470
|
-
CreateSingletonServices,
|
|
471
|
-
} from '@pikku/core'
|
|
472
|
-
import {
|
|
467
|
+
files['src/services.ts'] = `import {
|
|
473
468
|
ConsoleLogger,
|
|
474
469
|
LocalVariablesService,
|
|
475
470
|
LocalSecretService,
|
|
476
471
|
} from '@pikku/core/services'
|
|
472
|
+
import { pikkuServices } from '#pikku'
|
|
477
473
|
|
|
478
474
|
import '../.pikku/pikku-bootstrap.gen.js'
|
|
479
475
|
|
|
480
|
-
export const createSingletonServices
|
|
481
|
-
{},
|
|
482
|
-
SingletonServices
|
|
483
|
-
> = async (_config, existingServices) => {
|
|
476
|
+
export const createSingletonServices = pikkuServices(async (_config, existingServices) => {
|
|
484
477
|
const variables = existingServices?.variables ?? new LocalVariablesService(process.env)
|
|
485
478
|
const secrets = existingServices?.secrets ?? new LocalSecretService(variables)
|
|
486
479
|
|
|
@@ -489,7 +482,7 @@ export const createSingletonServices: CreateSingletonServices<
|
|
|
489
482
|
variables,
|
|
490
483
|
secrets,
|
|
491
484
|
}
|
|
492
|
-
}
|
|
485
|
+
})
|
|
493
486
|
`;
|
|
494
487
|
// test/src/{name}-tests.function.ts
|
|
495
488
|
files[`src/${name}-tests.function.ts`] =
|
|
@@ -621,6 +614,16 @@ export const pikkuNewAddon = pikkuSessionlessFunc({
|
|
|
621
614
|
mcp,
|
|
622
615
|
});
|
|
623
616
|
Object.assign(addonFiles, openapiFiles);
|
|
617
|
+
// Inject openapi metadata into pikku.config.json
|
|
618
|
+
const config = JSON.parse(addonFiles['pikku.config.json']);
|
|
619
|
+
if (typeof config.addon === 'boolean' || !config.addon) {
|
|
620
|
+
config.addon = {};
|
|
621
|
+
}
|
|
622
|
+
config.addon.openapi = {
|
|
623
|
+
version: spec.info.version,
|
|
624
|
+
hash: computeContractHash(spec),
|
|
625
|
+
};
|
|
626
|
+
addonFiles['pikku.config.json'] = JSON.stringify(config, null, 2);
|
|
624
627
|
}
|
|
625
628
|
const written = await writeFiles(addonDir, addonFiles);
|
|
626
629
|
// Test harness
|
|
@@ -629,6 +632,9 @@ export const pikkuNewAddon = pikkuSessionlessFunc({
|
|
|
629
632
|
const testWritten = await writeFiles(join(addonDir, 'test'), testFiles);
|
|
630
633
|
written.push(...testWritten);
|
|
631
634
|
}
|
|
635
|
+
// Initialize version manifest
|
|
636
|
+
const manifestPath = join(addonDir, 'versions.pikku.json');
|
|
637
|
+
await saveManifest(manifestPath, createEmptyManifest());
|
|
632
638
|
logger.info(`Created addon at ${addonDir}`);
|
|
633
639
|
for (const f of written) {
|
|
634
640
|
logger.debug({ message: ` ${f}`, type: 'success' });
|
|
@@ -13,7 +13,7 @@ export const pikkuVersionsCheck = pikkuSessionlessFunc({
|
|
|
13
13
|
func: async ({ logger, config, getInspectorState }) => {
|
|
14
14
|
const visitState = await getInspectorState();
|
|
15
15
|
if (!visitState.manifest.initial) {
|
|
16
|
-
const manifestPath = join(config.
|
|
16
|
+
const manifestPath = join(config.rootDir, 'versions.pikku.json');
|
|
17
17
|
throw new Error(`[${ErrorCode.MANIFEST_MISSING}] Version manifest not found at ${manifestPath}. Run 'pikku versions init' to create one.`);
|
|
18
18
|
}
|
|
19
19
|
if (visitState.manifest.errors.length > 0) {
|
|
@@ -50,9 +50,9 @@ export const pikkuVersionsCheck = pikkuSessionlessFunc({
|
|
|
50
50
|
if (error.latestVersion !== undefined) {
|
|
51
51
|
logger.info(` Latest recorded version: ${error.latestVersion}`);
|
|
52
52
|
}
|
|
53
|
-
logger.info(` Version ${error.version} exists in code but not in versions.json`);
|
|
53
|
+
logger.info(` Version ${error.version} exists in code but not in versions.pikku.json`);
|
|
54
54
|
logger.info(``);
|
|
55
|
-
logger.info(` This usually means a merge conflict in versions.json.`);
|
|
55
|
+
logger.info(` This usually means a merge conflict in versions.pikku.json.`);
|
|
56
56
|
logger.info(` Resolve the conflict, then run:`);
|
|
57
57
|
logger.info(` npx pikku versions-update`);
|
|
58
58
|
}
|
|
@@ -76,7 +76,7 @@ export const pikkuVersionsCheck = pikkuSessionlessFunc({
|
|
|
76
76
|
}
|
|
77
77
|
else if (error.code === ErrorCode.MANIFEST_INTEGRITY_ERROR &&
|
|
78
78
|
error.functionKey) {
|
|
79
|
-
logger.info(`✗ ${error.functionKey} — versions.json integrity error`);
|
|
79
|
+
logger.info(`✗ ${error.functionKey} — versions.pikku.json integrity error`);
|
|
80
80
|
if (error.latestVersion !== undefined) {
|
|
81
81
|
logger.info(` "latest" field: ${error.latestVersion}`);
|
|
82
82
|
}
|
|
@@ -4,7 +4,7 @@ import { pikkuSessionlessFunc } from '#pikku';
|
|
|
4
4
|
import { createEmptyManifest, saveManifest, } from '../../utils/contract-versions.js';
|
|
5
5
|
export const pikkuVersionsInit = pikkuSessionlessFunc({
|
|
6
6
|
func: async ({ logger, config }, { force }) => {
|
|
7
|
-
const manifestPath = join(config.
|
|
7
|
+
const manifestPath = join(config.rootDir, 'versions.pikku.json');
|
|
8
8
|
if (existsSync(manifestPath) && !force) {
|
|
9
9
|
logger.error(`Version manifest already exists at ${manifestPath}. Use --force to overwrite.`);
|
|
10
10
|
process.exit(1);
|
|
@@ -4,7 +4,7 @@ import { ErrorCode } from '@pikku/inspector';
|
|
|
4
4
|
import { saveManifest } from '../../utils/contract-versions.js';
|
|
5
5
|
export const pikkuVersionsUpdate = pikkuSessionlessFunc({
|
|
6
6
|
func: async ({ logger, config, getInspectorState }) => {
|
|
7
|
-
const manifestPath = join(config.
|
|
7
|
+
const manifestPath = join(config.rootDir, 'versions.pikku.json');
|
|
8
8
|
const visitState = await getInspectorState();
|
|
9
9
|
if (!visitState.manifest.initial) {
|
|
10
10
|
throw new Error(`Version manifest not found at ${manifestPath}. Run 'pikku versions init' to create one.`);
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
export declare const watch: import("#pikku").PikkuFunctionConfig<
|
|
1
|
+
export declare const watch: import("#pikku").PikkuFunctionConfig<{
|
|
2
|
+
hmr?: boolean;
|
|
3
|
+
}, void, "session" | "rpc", import("#pikku").PikkuFunctionSessionless<{
|
|
4
|
+
hmr?: boolean;
|
|
5
|
+
}, void, "session" | "rpc", import("#pikku").Services> | import("#pikku").PikkuFunction<{
|
|
6
|
+
hmr?: boolean;
|
|
7
|
+
}, void, "session" | "rpc", import("#pikku").Services>, undefined, undefined>;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { pikkuSessionlessFunc } from '#pikku';
|
|
2
2
|
import chokidar from 'chokidar';
|
|
3
|
-
|
|
3
|
+
import { pikkuDevReloader } from '@pikku/core/dev';
|
|
4
|
+
export const watch = pikkuSessionlessFunc({
|
|
4
5
|
remote: true,
|
|
5
|
-
func: async ({ logger, config },
|
|
6
|
+
func: async ({ logger, config }, { hmr }, { rpc }) => {
|
|
7
|
+
if (hmr) {
|
|
8
|
+
await pikkuDevReloader({
|
|
9
|
+
srcDirectories: config.srcDirectories,
|
|
10
|
+
logger,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
6
13
|
const configWatcher = chokidar.watch(config.srcDirectories, {
|
|
7
14
|
ignoreInitial: true,
|
|
8
15
|
ignored: /.*\.gen\.tsx?/,
|
|
@@ -43,14 +43,14 @@ export const pikkuNext = pikkuSessionlessFunc({
|
|
|
43
43
|
const bootstrapPath = getFileImportRelativePath(nextBackendFile, config.bootstrapFile, packageMappings);
|
|
44
44
|
const routesMapDeclarationPath = getFileImportRelativePath(nextBackendFile, httpMapDeclarationFile, packageMappings);
|
|
45
45
|
const rpcMapDeclarationPath = getFileImportRelativePath(nextBackendFile, rpcMapDeclarationFile, packageMappings);
|
|
46
|
-
const content = serializeNextBackendWrapper(bootstrapPath, routesMapDeclarationPath, rpcMapDeclarationPath, pikkuConfigImport, singletonServicesImport, wireServicesImport);
|
|
46
|
+
const content = serializeNextBackendWrapper(bootstrapPath, routesMapDeclarationPath, rpcMapDeclarationPath, pikkuConfigImport, singletonServicesImport, wireServicesImport, config.globalHTTPPrefix || '');
|
|
47
47
|
await writeFileInDir(logger, nextBackendFile, content);
|
|
48
48
|
}
|
|
49
49
|
if (nextHTTPFile && fetchFile) {
|
|
50
50
|
const routesMapDeclarationPath = getFileImportRelativePath(nextHTTPFile, httpMapDeclarationFile, packageMappings);
|
|
51
51
|
const rpcMapDeclarationPath = getFileImportRelativePath(nextHTTPFile, rpcMapDeclarationFile, packageMappings);
|
|
52
52
|
const fetchPath = getFileImportRelativePath(nextHTTPFile, fetchFile, packageMappings);
|
|
53
|
-
const content = serializeNextHTTPWrapper(routesMapDeclarationPath, rpcMapDeclarationPath, fetchPath);
|
|
53
|
+
const content = serializeNextHTTPWrapper(routesMapDeclarationPath, rpcMapDeclarationPath, fetchPath, config.globalHTTPPrefix || '');
|
|
54
54
|
await writeFileInDir(logger, nextHTTPFile, content);
|
|
55
55
|
}
|
|
56
56
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const serializeNextJsBackendWrapper: (bootstrapPath: string, routesMapPath: string, rpcMapPath: string, configImport: string, singleServicesFactoryImport: string, wireServicesImport: string | undefined) => string;
|
|
1
|
+
export declare const serializeNextJsBackendWrapper: (bootstrapPath: string, routesMapPath: string, rpcMapPath: string, configImport: string, singleServicesFactoryImport: string, wireServicesImport: string | undefined, globalHTTPPrefix?: string) => string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const serializeNextJsBackendWrapper = (bootstrapPath, routesMapPath, rpcMapPath, configImport, singleServicesFactoryImport, wireServicesImport) => {
|
|
1
|
+
export const serializeNextJsBackendWrapper = (bootstrapPath, routesMapPath, rpcMapPath, configImport, singleServicesFactoryImport, wireServicesImport, globalHTTPPrefix = '') => {
|
|
2
2
|
return `'server-only'
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -194,7 +194,7 @@ export const pikku = (_options?: any) => {
|
|
|
194
194
|
rpcName: Name,
|
|
195
195
|
data: FlattenedRPCMap[Name]['input']
|
|
196
196
|
): Promise<FlattenedRPCMap[Name]['output']> => {
|
|
197
|
-
return dynamicActionRequest('/rpc/:rpcName' as '/rpc/:rpcName', 'POST', { rpcName, data: data ?? null }) as unknown as FlattenedRPCMap[Name]['output']
|
|
197
|
+
return dynamicActionRequest('${globalHTTPPrefix}/rpc/:rpcName' as '${globalHTTPPrefix}/rpc/:rpcName', 'POST', { rpcName, data: data ?? null }) as unknown as FlattenedRPCMap[Name]['output']
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const serializeNextJsHTTPWrapper: (routesMapPath: string, rpcMapPath: string, pikkuFetchImport: string) => string;
|
|
1
|
+
export declare const serializeNextJsHTTPWrapper: (routesMapPath: string, rpcMapPath: string, pikkuFetchImport: string, globalHTTPPrefix?: string) => string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const serializeNextJsHTTPWrapper = (routesMapPath, rpcMapPath, pikkuFetchImport) => {
|
|
1
|
+
export const serializeNextJsHTTPWrapper = (routesMapPath, rpcMapPath, pikkuFetchImport, globalHTTPPrefix = '') => {
|
|
2
2
|
return `'server-only'
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -173,7 +173,7 @@ export const pikku = (options?: CorePikkuFetchOptions) => {
|
|
|
173
173
|
rpcName: Name,
|
|
174
174
|
data: FlattenedRPCMap[Name]['input']
|
|
175
175
|
): Promise<FlattenedRPCMap[Name]['output']> => {
|
|
176
|
-
return dynamicActionRequest('/rpc/:rpcName' as '/rpc/:rpcName', 'POST', { rpcName, data: data ?? null }) as unknown as FlattenedRPCMap[Name]['output']
|
|
176
|
+
return dynamicActionRequest('${globalHTTPPrefix}/rpc/:rpcName' as '${globalHTTPPrefix}/rpc/:rpcName', 'POST', { rpcName, data: data ?? null }) as unknown as FlattenedRPCMap[Name]['output']
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
/**
|
|
@@ -7,7 +7,7 @@ export const pikkuPublicAgent = pikkuSessionlessFunc({
|
|
|
7
7
|
func: async ({ logger, config }) => {
|
|
8
8
|
if (config.scaffold?.agent) {
|
|
9
9
|
const pathToPikkuTypes = getFileImportRelativePath(config.publicAgentFile, config.typesDeclarationFile, config.packageMappings);
|
|
10
|
-
await writeFileInDir(logger, config.publicAgentFile, serializePublicAgent(pathToPikkuTypes, config.scaffold.agent === 'auth'));
|
|
10
|
+
await writeFileInDir(logger, config.publicAgentFile, serializePublicAgent(pathToPikkuTypes, config.scaffold.agent === 'auth', config.globalHTTPPrefix || ''));
|
|
11
11
|
return true;
|
|
12
12
|
}
|
|
13
13
|
return false;
|
|
@@ -14,16 +14,22 @@ import type { StandardSchemaV1 } from '@standard-schema/spec'
|
|
|
14
14
|
import type { AIAgentMemoryConfig, AIAgentInput } from '@pikku/core/ai-agent'
|
|
15
15
|
import type { AgentMap } from '${agentMapImportPath}'
|
|
16
16
|
|
|
17
|
-
type AIAgentConfig
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
type AIAgentConfig<
|
|
18
|
+
InputSchema extends StandardSchemaV1 | undefined = undefined,
|
|
19
|
+
OutputSchema extends StandardSchemaV1 | undefined = undefined
|
|
20
|
+
> = Omit<CoreAIAgent<PikkuPermission, PikkuMiddleware>, 'tools' | 'agents' | 'memory' | 'input' | 'output'> & {
|
|
21
|
+
input?: InputSchema
|
|
22
|
+
output?: OutputSchema
|
|
20
23
|
memory?: Omit<AIAgentMemoryConfig, 'workingMemory'> & { workingMemory?: StandardSchemaV1 }
|
|
21
24
|
tools?: object[]
|
|
22
|
-
agents?: AIAgentConfig[]
|
|
25
|
+
agents?: AIAgentConfig<StandardSchemaV1 | undefined, StandardSchemaV1 | undefined>[]
|
|
23
26
|
}
|
|
24
27
|
|
|
25
|
-
export const pikkuAIAgent =
|
|
26
|
-
|
|
28
|
+
export const pikkuAIAgent = <
|
|
29
|
+
InputSchema extends StandardSchemaV1 | undefined = undefined,
|
|
30
|
+
OutputSchema extends StandardSchemaV1 | undefined = undefined
|
|
31
|
+
>(
|
|
32
|
+
agent: AIAgentConfig<InputSchema, OutputSchema>
|
|
27
33
|
) => {
|
|
28
34
|
return agent
|
|
29
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const serializePublicAgent: (pathToPikkuTypes: string, requireAuth?: boolean) => string;
|
|
1
|
+
export declare const serializePublicAgent: (pathToPikkuTypes: string, requireAuth?: boolean, globalHTTPPrefix?: string) => string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const serializePublicAgent = (pathToPikkuTypes, requireAuth = true) => {
|
|
1
|
+
export const serializePublicAgent = (pathToPikkuTypes, requireAuth = true, globalHTTPPrefix = '') => {
|
|
2
2
|
const authFlag = requireAuth ? 'true' : 'false';
|
|
3
3
|
return `import { pikkuSessionlessFunc, defineHTTPRoutes, wireHTTPRoutes } from '${pathToPikkuTypes}'
|
|
4
4
|
|
|
@@ -58,23 +58,23 @@ export const agentRoutes = defineHTTPRoutes({
|
|
|
58
58
|
tags: ['pikku:public'],
|
|
59
59
|
routes: {
|
|
60
60
|
agentRun: {
|
|
61
|
-
route: '/rpc/agent/:agentName',
|
|
61
|
+
route: '${globalHTTPPrefix}/rpc/agent/:agentName',
|
|
62
62
|
method: 'post',
|
|
63
63
|
func: agentCaller,
|
|
64
64
|
},
|
|
65
65
|
agentStream: {
|
|
66
|
-
route: '/rpc/agent/:agentName/stream',
|
|
66
|
+
route: '${globalHTTPPrefix}/rpc/agent/:agentName/stream',
|
|
67
67
|
method: 'post',
|
|
68
68
|
sse: true,
|
|
69
69
|
func: agentStreamCaller,
|
|
70
70
|
},
|
|
71
71
|
agentApprove: {
|
|
72
|
-
route: '/rpc/agent/:agentName/approve',
|
|
72
|
+
route: '${globalHTTPPrefix}/rpc/agent/:agentName/approve',
|
|
73
73
|
method: 'post',
|
|
74
74
|
func: agentApproveCaller,
|
|
75
75
|
},
|
|
76
76
|
agentResume: {
|
|
77
|
-
route: '/rpc/agent/:agentName/resume',
|
|
77
|
+
route: '${globalHTTPPrefix}/rpc/agent/:agentName/resume',
|
|
78
78
|
method: 'post',
|
|
79
79
|
sse: true,
|
|
80
80
|
func: agentResumeCaller,
|
|
@@ -56,7 +56,7 @@ export const pikkuCLIEntry = pikkuSessionlessFunc({
|
|
|
56
56
|
`Move it to a source directory like "src/wirings/cli-channel.gen.ts".`);
|
|
57
57
|
}
|
|
58
58
|
const channelWireFile = resolvedWirePath;
|
|
59
|
-
const channelCode = serializeChannelCLI(programName, programMeta, channelWireFile, visitState.functions.files, config.packageMappings, config.channelsTypesFile, config.functionTypesFile, channelName, channelRoute);
|
|
59
|
+
const channelCode = serializeChannelCLI(programName, programMeta, channelWireFile, visitState.functions.files, config.packageMappings, config.channelsTypesFile, config.functionTypesFile, channelName, channelRoute, config.globalHTTPPrefix || '');
|
|
60
60
|
await writeFileInDir(logger, channelWireFile, channelCode);
|
|
61
61
|
logger.debug(`Serialized CLI channel for ${programName}: ${channelWireFile}`);
|
|
62
62
|
// Generate client code if clientPath is provided
|
|
@@ -6,4 +6,4 @@ import type { CLIProgramMeta } from '@pikku/core/cli';
|
|
|
6
6
|
export declare function serializeChannelCLI(programName: string, programMeta: CLIProgramMeta, channelFile: string, functionFiles: Map<string, {
|
|
7
7
|
path: string;
|
|
8
8
|
exportedName: string;
|
|
9
|
-
}>, packageMappings: Record<string, string>, channelTypesFile: string, functionTypesFile: string, channelName?: string, channelRoute?: string): string;
|
|
9
|
+
}>, packageMappings: Record<string, string>, channelTypesFile: string, functionTypesFile: string, channelName?: string, channelRoute?: string, globalHTTPPrefix?: string): string;
|
|
@@ -3,9 +3,9 @@ import { getFileImportRelativePath } from '../../../utils/file-import-path.js';
|
|
|
3
3
|
* Serializes a wireChannel call from CLI metadata
|
|
4
4
|
* This creates a WebSocket backend for all CLI commands
|
|
5
5
|
*/
|
|
6
|
-
export function serializeChannelCLI(programName, programMeta, channelFile, functionFiles, packageMappings, channelTypesFile, functionTypesFile, channelName, channelRoute) {
|
|
6
|
+
export function serializeChannelCLI(programName, programMeta, channelFile, functionFiles, packageMappings, channelTypesFile, functionTypesFile, channelName, channelRoute, globalHTTPPrefix = '') {
|
|
7
7
|
const finalChannelName = channelName || `${programName}-cli`;
|
|
8
|
-
const finalChannelRoute = channelRoute ||
|
|
8
|
+
const finalChannelRoute = channelRoute || `${globalHTTPPrefix}/cli/${programName}`;
|
|
9
9
|
// Flatten all commands into a single routing map
|
|
10
10
|
const commandMap = {};
|
|
11
11
|
const collectCommands = (commands, path = []) => {
|
|
@@ -8,7 +8,7 @@ export const pikkuConsoleFunctions = pikkuSessionlessFunc({
|
|
|
8
8
|
if (config.scaffold?.console) {
|
|
9
9
|
const pathToPikkuTypes = getFileImportRelativePath(config.consoleFunctionsFile, config.typesDeclarationFile, config.packageMappings);
|
|
10
10
|
const pathToAgentTypes = getFileImportRelativePath(config.consoleFunctionsFile, config.agentTypesFile, config.packageMappings);
|
|
11
|
-
await writeFileInDir(logger, config.consoleFunctionsFile, serializeConsoleFunctions(pathToPikkuTypes, pathToAgentTypes));
|
|
11
|
+
await writeFileInDir(logger, config.consoleFunctionsFile, serializeConsoleFunctions(pathToPikkuTypes, pathToAgentTypes, config.globalHTTPPrefix || ''));
|
|
12
12
|
return true;
|
|
13
13
|
}
|
|
14
14
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const serializeConsoleFunctions: (pathToPikkuTypes: string, _pathToAgentTypes: string) => string;
|
|
1
|
+
export declare const serializeConsoleFunctions: (pathToPikkuTypes: string, _pathToAgentTypes: string, globalHTTPPrefix?: string) => string;
|