@pikku/cli 0.12.117 → 0.12.118
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/CHANGELOG.md +44 -0
- package/dist/.pikku/addon/index.d.ts +1 -1
- package/dist/.pikku/addon/index.js +1 -1
- package/dist/.pikku/addon/pikku-addon-types.gen.d.ts +1 -1
- package/dist/.pikku/addon/pikku-addon-types.gen.js +1 -1
- package/dist/.pikku/agent/index.d.ts +1 -1
- package/dist/.pikku/agent/index.js +1 -1
- package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +1 -1
- package/dist/.pikku/agent/pikku-model-aliases.gen.js +1 -1
- package/dist/.pikku/auth/index.d.ts +1 -1
- package/dist/.pikku/auth/index.js +1 -1
- package/dist/.pikku/auth/pikku-auth-types.gen.d.ts +1 -1
- package/dist/.pikku/auth/pikku-auth-types.gen.js +1 -1
- package/dist/.pikku/channel/index.d.ts +1 -1
- package/dist/.pikku/channel/index.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/cli/index.d.ts +1 -1
- package/dist/.pikku/cli/index.js +1 -1
- package/dist/.pikku/cli/pikku-cli-channel.js +6 -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-contracts-meta.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-contracts-meta.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 +12 -0
- 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/error/index.d.ts +1 -1
- package/dist/.pikku/error/index.js +1 -1
- package/dist/.pikku/error/pikku-error-types.gen.d.ts +1 -1
- package/dist/.pikku/error/pikku-error-types.gen.js +1 -1
- package/dist/.pikku/function/index.d.ts +1 -1
- package/dist/.pikku/function/index.js +1 -1
- package/dist/.pikku/function/pikku-function-types.gen.d.ts +1 -1
- 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 +18 -1
- package/dist/.pikku/function/pikku-functions.gen.js +1 -1
- package/dist/.pikku/gateway/index.d.ts +1 -1
- package/dist/.pikku/gateway/index.js +1 -1
- package/dist/.pikku/gateway/pikku-gateway-types.gen.d.ts +1 -1
- package/dist/.pikku/gateway/pikku-gateway-types.gen.js +1 -1
- package/dist/.pikku/http/index.d.ts +1 -1
- package/dist/.pikku/http/index.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/mcp/index.d.ts +1 -1
- package/dist/.pikku/mcp/index.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/middleware/index.d.ts +1 -1
- package/dist/.pikku/middleware/index.js +1 -1
- package/dist/.pikku/middleware/pikku-middleware-types.gen.d.ts +1 -1
- package/dist/.pikku/middleware/pikku-middleware-types.gen.js +1 -1
- package/dist/.pikku/pikku-bootstrap-scenarios.gen.d.ts +1 -1
- package/dist/.pikku/pikku-bootstrap-scenarios.gen.js +1 -1
- package/dist/.pikku/pikku-bootstrap.gen.d.ts +1 -1
- package/dist/.pikku/pikku-bootstrap.gen.js +1 -1
- package/dist/.pikku/pikku-services.gen.d.ts +1 -1
- package/dist/.pikku/queue/index.d.ts +1 -1
- package/dist/.pikku/queue/index.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-rpc-wirings-meta.internal.gen.js +1 -1
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +1 -0
- package/dist/.pikku/scenarios/index.d.ts +1 -1
- package/dist/.pikku/scenarios/index.js +1 -1
- package/dist/.pikku/scenarios/pikku-personas.gen.js +1 -1
- package/dist/.pikku/scenarios/pikku-scenario-functions-meta.gen.js +1 -1
- package/dist/.pikku/scenarios/pikku-scenario-functions.gen.d.ts +1 -1
- package/dist/.pikku/scenarios/pikku-scenario-types.gen.d.ts +1 -1
- package/dist/.pikku/scenarios/pikku-scenario-wirings-meta.gen.js +1 -1
- package/dist/.pikku/scenarios/pikku-scenario-wirings.gen.d.ts +1 -1
- package/dist/.pikku/scenarios/schemas/register.gen.d.ts +1 -1
- package/dist/.pikku/scenarios/schemas/register.gen.js +1 -1
- package/dist/.pikku/scheduler/index.d.ts +1 -1
- package/dist/.pikku/scheduler/index.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/schemas/register.gen.js +3 -1
- package/dist/.pikku/schemas/schemas/PikkuMetaApplyInput.schema.json +1 -0
- package/dist/.pikku/scopes/index.d.ts +1 -1
- package/dist/.pikku/scopes/index.js +1 -1
- package/dist/.pikku/scopes/pikku-personas.gen.js +1 -1
- package/dist/.pikku/scopes/pikku-roles.gen.d.ts +1 -1
- package/dist/.pikku/scopes/pikku-scope-types.gen.d.ts +1 -1
- package/dist/.pikku/scopes/pikku-scope-types.gen.js +1 -1
- package/dist/.pikku/scopes/pikku-scopes.gen.d.ts +1 -1
- package/dist/.pikku/secrets/index.d.ts +1 -1
- package/dist/.pikku/secrets/index.js +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/services/pikku-meta-service.gen.d.ts +1 -1
- package/dist/.pikku/services/pikku-meta-service.gen.js +1 -1
- package/dist/.pikku/setup/index.d.ts +1 -1
- package/dist/.pikku/setup/index.js +1 -1
- package/dist/.pikku/setup/pikku-setup-types.gen.d.ts +1 -1
- package/dist/.pikku/setup/pikku-setup-types.gen.js +1 -1
- package/dist/.pikku/trigger/index.d.ts +1 -1
- package/dist/.pikku/trigger/index.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/index.d.ts +1 -1
- package/dist/.pikku/variables/index.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/index.d.ts +1 -1
- package/dist/.pikku/workflow/index.js +1 -1
- 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 +2 -2
- package/dist/src/cli.wiring.js +6 -1
- package/dist/src/fabric/functions/smoke.function.js +2 -2
- package/dist/src/fabric/functions/validate.function.js +2 -2
- package/dist/src/functions/commands/meta.d.ts +7 -0
- package/dist/src/functions/commands/meta.js +65 -0
- package/package.json +4 -3
- package/surface.json +1 -1
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { pikkuSessionlessFunc } from '#pikku/function';
|
|
2
2
|
import { getSchema } from '@pikku/core/schema';
|
|
3
|
+
import { CodeEditService } from '@pikku/code-edit';
|
|
4
|
+
import { readFile } from 'node:fs/promises';
|
|
5
|
+
import { relative, resolve } from 'node:path';
|
|
3
6
|
function out(value) {
|
|
4
7
|
console.log(JSON.stringify(value));
|
|
5
8
|
}
|
|
@@ -452,3 +455,65 @@ export const pikkuMetaClients = pikkuSessionlessFunc({
|
|
|
452
455
|
});
|
|
453
456
|
},
|
|
454
457
|
});
|
|
458
|
+
async function readOperationsInput(file) {
|
|
459
|
+
const raw = file
|
|
460
|
+
? await readFile(resolve(file), 'utf-8')
|
|
461
|
+
: await new Promise((res, rej) => {
|
|
462
|
+
let buffer = '';
|
|
463
|
+
process.stdin.setEncoding('utf-8');
|
|
464
|
+
process.stdin.on('data', (chunk) => (buffer += chunk));
|
|
465
|
+
process.stdin.on('end', () => res(buffer));
|
|
466
|
+
process.stdin.on('error', rej);
|
|
467
|
+
});
|
|
468
|
+
if (!raw.trim()) {
|
|
469
|
+
throw new Error(file
|
|
470
|
+
? `${file} is empty`
|
|
471
|
+
: 'No operations on stdin. Pass a file, or pipe JSON in.');
|
|
472
|
+
}
|
|
473
|
+
try {
|
|
474
|
+
return JSON.parse(raw);
|
|
475
|
+
}
|
|
476
|
+
catch (e) {
|
|
477
|
+
throw new Error(`Could not parse operations as JSON: ${e.message}`);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
function parseOperations(input) {
|
|
481
|
+
const operations = Array.isArray(input)
|
|
482
|
+
? input
|
|
483
|
+
: input?.operations;
|
|
484
|
+
if (!Array.isArray(operations)) {
|
|
485
|
+
throw new Error('Expected an array of operations, or an object with an "operations" array');
|
|
486
|
+
}
|
|
487
|
+
const kinds = ['functionConfig', 'functionBody', 'agentConfig'];
|
|
488
|
+
operations.forEach((operation, index) => {
|
|
489
|
+
const at = `operations[${index}]`;
|
|
490
|
+
if (!operation || typeof operation !== 'object') {
|
|
491
|
+
throw new Error(`${at} is not an object`);
|
|
492
|
+
}
|
|
493
|
+
const { kind, sourceFile, exportedName } = operation;
|
|
494
|
+
if (typeof kind !== 'string' || !kinds.includes(kind)) {
|
|
495
|
+
throw new Error(`${at}.kind must be one of ${kinds.join(', ')}`);
|
|
496
|
+
}
|
|
497
|
+
if (typeof sourceFile !== 'string' || !sourceFile) {
|
|
498
|
+
throw new Error(`${at}.sourceFile must be a non-empty string`);
|
|
499
|
+
}
|
|
500
|
+
if (typeof exportedName !== 'string' || !exportedName) {
|
|
501
|
+
throw new Error(`${at}.exportedName must be a non-empty string`);
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
return operations;
|
|
505
|
+
}
|
|
506
|
+
export const pikkuMetaApply = pikkuSessionlessFunc({
|
|
507
|
+
func: async ({ config }, data) => {
|
|
508
|
+
const operations = parseOperations(await readOperationsInput(data.file));
|
|
509
|
+
const rootDir = config.rootDir ?? process.cwd();
|
|
510
|
+
const codeEdit = new CodeEditService(rootDir);
|
|
511
|
+
const files = await codeEdit.applyOperations(operations);
|
|
512
|
+
out({
|
|
513
|
+
schemaVersion: 'meta-apply.v1',
|
|
514
|
+
applied: operations.length,
|
|
515
|
+
files: files.map((f) => relative(rootDir, f)),
|
|
516
|
+
generatedMetaIsStale: operations.some((o) => o.kind !== 'functionBody'),
|
|
517
|
+
});
|
|
518
|
+
},
|
|
519
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pikku/cli",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.118",
|
|
4
4
|
"description": "Pikku CLI — code generation, dev server, migrations and deployment",
|
|
5
5
|
"author": "yasser.fadl@gmail.com",
|
|
6
6
|
"license": "BUSL-1.1",
|
|
@@ -32,7 +32,8 @@
|
|
|
32
32
|
"@openapi-contrib/json-schema-to-openapi-schema": "^4.3.4",
|
|
33
33
|
"@pikku/ai-vercel": "^0.12.13",
|
|
34
34
|
"@pikku/better-auth": "^0.12.29",
|
|
35
|
-
"@pikku/bun-server": "^0.12.
|
|
35
|
+
"@pikku/bun-server": "^0.12.9",
|
|
36
|
+
"@pikku/code-edit": "^0.12.1",
|
|
36
37
|
"@pikku/deploy": "^0.12.1",
|
|
37
38
|
"@pikku/deploy-cloudflare": "^0.12.13",
|
|
38
39
|
"@pikku/fetch": "^0.12.9",
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
"@pikku/node-http-server": "^0.12.11",
|
|
44
45
|
"@pikku/openapi-parser": "^0.12.20",
|
|
45
46
|
"@pikku/schedule": "^0.12.7",
|
|
46
|
-
"@pikku/skills": "^0.12.
|
|
47
|
+
"@pikku/skills": "^0.12.15",
|
|
47
48
|
"@pikku/ws": "^0.12.9",
|
|
48
49
|
"@types/cookie": "^1.0.0",
|
|
49
50
|
"@types/json-schema": "^7.0.15",
|
package/surface.json
CHANGED