@beignet/cli 0.0.44 → 0.0.46
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 +25 -0
- package/README.md +78 -16
- package/dist/choices.d.ts +5 -1
- package/dist/choices.d.ts.map +1 -1
- package/dist/choices.js +12 -0
- package/dist/choices.js.map +1 -1
- package/dist/db.d.ts +4 -0
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +12 -6
- package/dist/db.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -13
- package/dist/index.js.map +1 -1
- package/dist/inspect.d.ts.map +1 -1
- package/dist/inspect.js +598 -62
- package/dist/inspect.js.map +1 -1
- package/dist/lib.d.ts +4 -1
- package/dist/lib.d.ts.map +1 -1
- package/dist/lib.js +1 -1
- package/dist/lib.js.map +1 -1
- package/dist/mcp.d.ts +2 -1
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +356 -5
- package/dist/mcp.js.map +1 -1
- package/dist/operational-lifecycle.d.ts +12 -0
- package/dist/operational-lifecycle.d.ts.map +1 -0
- package/dist/operational-lifecycle.js +39 -0
- package/dist/operational-lifecycle.js.map +1 -0
- package/dist/operational-path.d.ts +3 -0
- package/dist/operational-path.d.ts.map +1 -0
- package/dist/operational-path.js +26 -0
- package/dist/operational-path.js.map +1 -0
- package/dist/operational-process.d.ts +78 -0
- package/dist/operational-process.d.ts.map +1 -0
- package/dist/operational-process.js +228 -0
- package/dist/operational-process.js.map +1 -0
- package/dist/operational-runner.d.ts +2 -0
- package/dist/operational-runner.d.ts.map +1 -0
- package/dist/operational-runner.js +168 -0
- package/dist/operational-runner.js.map +1 -0
- package/dist/outbox.d.ts +14 -6
- package/dist/outbox.d.ts.map +1 -1
- package/dist/outbox.js +140 -124
- package/dist/outbox.js.map +1 -1
- package/dist/schedule.d.ts +2 -1
- package/dist/schedule.d.ts.map +1 -1
- package/dist/schedule.js +79 -81
- package/dist/schedule.js.map +1 -1
- package/dist/task.d.ts +2 -1
- package/dist/task.d.ts.map +1 -1
- package/dist/task.js +57 -61
- package/dist/task.js.map +1 -1
- package/dist/templates/agents.d.ts.map +1 -1
- package/dist/templates/agents.js +32 -8
- package/dist/templates/agents.js.map +1 -1
- package/dist/templates/server.d.ts.map +1 -1
- package/dist/templates/server.js +9 -2
- package/dist/templates/server.js.map +1 -1
- package/dist/templates/shadcn.d.ts.map +1 -1
- package/dist/templates/shadcn.js +3 -1
- package/dist/templates/shadcn.js.map +1 -1
- package/dist/templates/shared.js +1 -1
- package/package.json +2 -2
- package/skills/app-structure/SKILL.md +26 -7
- package/src/choices.ts +22 -0
- package/src/db.ts +12 -6
- package/src/index.ts +19 -16
- package/src/inspect.ts +844 -67
- package/src/lib.ts +27 -1
- package/src/mcp.ts +459 -4
- package/src/operational-lifecycle.ts +56 -0
- package/src/operational-path.ts +35 -0
- package/src/operational-process.ts +454 -0
- package/src/operational-runner.ts +221 -0
- package/src/outbox.ts +154 -128
- package/src/schedule.ts +84 -89
- package/src/task.ts +58 -62
- package/src/templates/agents.ts +32 -8
- package/src/templates/server.ts +9 -2
- package/src/templates/shadcn.ts +3 -1
- package/src/templates/shared.ts +1 -1
package/dist/task.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { readFile
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { createJiti } from "jiti";
|
|
4
4
|
import { loadBeignetConfig, normalizePath } from "./config.js";
|
|
5
5
|
import { flushOperationalErrorReporter, reportOperationalFailure, } from "./operational-error-reporting.js";
|
|
6
|
+
import { runWithOperationalCleanup } from "./operational-lifecycle.js";
|
|
7
|
+
import { resolveAppOperationalModulePath } from "./operational-path.js";
|
|
6
8
|
/**
|
|
7
9
|
* Run an app-owned operational task from the app's task registry.
|
|
8
10
|
*/
|
|
@@ -10,7 +12,7 @@ export async function runAppTask(options) {
|
|
|
10
12
|
const cwd = path.resolve(options.cwd ?? process.cwd());
|
|
11
13
|
const config = await loadBeignetConfig(cwd);
|
|
12
14
|
const modulePath = normalizePath(options.modulePath ?? config.paths.tasks);
|
|
13
|
-
const rawInput =
|
|
15
|
+
const rawInput = options.input === undefined ? {} : options.input;
|
|
14
16
|
const startedAt = performance.now();
|
|
15
17
|
const taskModule = await loadTaskModule(cwd, modulePath);
|
|
16
18
|
const task = findTask(taskModule.tasks, options.name, modulePath);
|
|
@@ -27,76 +29,70 @@ export async function runAppTask(options) {
|
|
|
27
29
|
const ctx = taskModule.createTaskContext
|
|
28
30
|
? await taskModule.createTaskContext(contextArgs)
|
|
29
31
|
: {};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"beignet.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
32
|
+
return runWithOperationalCleanup({
|
|
33
|
+
operation: `Task "${task.name}"`,
|
|
34
|
+
cleanupLabel: "stopTaskContext",
|
|
35
|
+
run: async () => {
|
|
36
|
+
let output;
|
|
37
|
+
try {
|
|
38
|
+
output = await runTask(task, {
|
|
39
|
+
input: parsedInput,
|
|
40
|
+
ctx,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
await reportOperationalFailure({
|
|
45
|
+
ctx: toOperationalContext(ctx),
|
|
46
|
+
error,
|
|
47
|
+
reportOptions: {
|
|
48
|
+
level: "error",
|
|
49
|
+
mechanism: "beignet.task.cli",
|
|
50
|
+
handled: false,
|
|
51
|
+
tags: {
|
|
52
|
+
"beignet.kind": "task",
|
|
53
|
+
"beignet.task": task.name,
|
|
54
|
+
},
|
|
55
|
+
contexts: {
|
|
56
|
+
task: {
|
|
57
|
+
name: task.name,
|
|
58
|
+
tenant: options.tenant ?? null,
|
|
59
|
+
source: "beignet-cli",
|
|
60
|
+
},
|
|
55
61
|
},
|
|
56
62
|
},
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
63
|
+
});
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
schemaVersion: 1,
|
|
68
|
+
name: task.name,
|
|
69
|
+
cwd,
|
|
70
|
+
modulePath,
|
|
71
|
+
input: parsedInput,
|
|
72
|
+
...(options.tenant !== undefined ? { tenant: options.tenant } : {}),
|
|
73
|
+
output,
|
|
74
|
+
durationMs: Math.round(performance.now() - startedAt),
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
cleanup: async () => {
|
|
78
|
+
await flushOperationalErrorReporter(toOperationalContext(ctx));
|
|
79
|
+
await taskModule.stopTaskContext?.(ctx, contextArgs);
|
|
80
|
+
},
|
|
81
|
+
});
|
|
76
82
|
}
|
|
77
83
|
function toOperationalContext(ctx) {
|
|
78
84
|
return typeof ctx === "object" && ctx !== null
|
|
79
85
|
? ctx
|
|
80
86
|
: {};
|
|
81
87
|
}
|
|
82
|
-
function parseTaskInputFlag(input) {
|
|
83
|
-
if (input === undefined)
|
|
84
|
-
return {};
|
|
85
|
-
if (typeof input !== "string")
|
|
86
|
-
return input;
|
|
87
|
-
try {
|
|
88
|
-
return JSON.parse(input);
|
|
89
|
-
}
|
|
90
|
-
catch (error) {
|
|
91
|
-
throw new Error(`Invalid --input JSON: ${error instanceof Error ? error.message : String(error)}`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
88
|
async function loadTaskModule(cwd, modulePath) {
|
|
95
|
-
|
|
89
|
+
let absolutePath;
|
|
96
90
|
try {
|
|
97
|
-
await
|
|
91
|
+
absolutePath = await resolveAppOperationalModulePath(cwd, modulePath);
|
|
98
92
|
}
|
|
99
|
-
catch {
|
|
93
|
+
catch (error) {
|
|
94
|
+
if (error.code !== "ENOENT")
|
|
95
|
+
throw error;
|
|
100
96
|
throw new Error(`Could not find app task registry at ${modulePath}. Create it with beignet make task <feature.name> or configure paths.tasks in beignet.config.ts.`);
|
|
101
97
|
}
|
|
102
98
|
const tsconfigPath = path.join(cwd, "tsconfig.json");
|
package/dist/task.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task.js","sourceRoot":"","sources":["../src/task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"task.js","sourceRoot":"","sources":["../src/task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EACL,6BAA6B,EAE7B,wBAAwB,GACzB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAkCxE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,OAA0B;IAE1B,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACvD,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAC5C,MAAM,U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AAwB,EAAE,CAClC,OAAO,SAAS,KAAK,QAAQ;YAC7B,SAAS,KAAK,IAAI;YACjB,SAAqB,CAAC,IAAI,KAAK,MAAM;YACtC,OAAQ,SAAqB,CAAC,IAAI,KAAK,QAAQ,CAClD;aACA,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC;aAClC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CACb,SAAS,CAAC,MAAM,GAAG,CAAC;YAClB,CAAC,CAAC,iBAAiB,IAAI,uBAAuB,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;YACrE,CAAC,CAAC,iBAAiB,IAAI,kCAAkC,UAAU,GAAG,CACzE,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,QAAgB;IACxC,IAAI,CAAC;QACH,MAAM,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/templates/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAExE;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/templates/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAExE;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CAyMrD;AAeD;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CASrD"}
|
package/dist/templates/agents.js
CHANGED
|
@@ -50,6 +50,10 @@ is a silent failure — the file exists but never runs:
|
|
|
50
50
|
in \`server/outbox.ts\`.
|
|
51
51
|
- Listeners must be added to the \`listeners\` array in \`server/listeners.ts\`
|
|
52
52
|
and wired through a \`registerListeners(...)\` call in server provider wiring.
|
|
53
|
+
- Apps using Inngest must also spread feature job registries into
|
|
54
|
+
\`inngestJobs\` in \`server/inngest.ts\`.
|
|
55
|
+
- Apps using runtime integrity must list workflow registries in
|
|
56
|
+
\`defineRuntimeManifest({...})\`.
|
|
53
57
|
|
|
54
58
|
The starter ships no workflow registries — generators create them on first
|
|
55
59
|
use, so their absence is fine. \`${cli} make event\`, \`${cli} make job\`,
|
|
@@ -63,7 +67,14 @@ manual registry instruction in the error.
|
|
|
63
67
|
with \`${cli} doctor --fix --dry-run\`, then apply the returned plan with
|
|
64
68
|
\`${cli} doctor --fix --plan <plan-id>\` and optional
|
|
65
69
|
\`--only <operation-ids>\`. Plain \`${cli} doctor --fix\` remains the
|
|
66
|
-
apply-all shortcut.
|
|
70
|
+
apply-all shortcut. Doctor can append fully unregistered artifacts to
|
|
71
|
+
existing central, Inngest, and runtime-manifest arrays when their imports and
|
|
72
|
+
array anchors are unambiguous. It also syncs missing default Beignet
|
|
73
|
+
provider-table exports when \`infra/db/schema/beignet.ts\` is missing or still
|
|
74
|
+
matches \`${cli} db schema sync\` output and the schema index has no custom
|
|
75
|
+
named re-export for that file. Run \`${cli} db generate\` and
|
|
76
|
+
\`${cli} db migrate\` after accepting that source repair. Custom or ambiguous
|
|
77
|
+
code stays diagnostic-only.
|
|
67
78
|
|
|
68
79
|
## Prefer generators
|
|
69
80
|
|
|
@@ -75,7 +86,9 @@ events, listener registration, jobs, and outbox wiring. After changing the Drizz
|
|
|
75
86
|
\`infra/db/schema/\`, run \`${cli} db generate\` then \`${cli} db migrate\`.
|
|
76
87
|
When MCP is available, use \`db_schema_sync\` for Beignet provider table
|
|
77
88
|
re-exports and \`db\` for \`generate\`, \`migrate\`, \`seed\`, or \`reset\`
|
|
78
|
-
instead of falling back to a shell.
|
|
89
|
+
instead of falling back to a shell. Use \`task_run\`, \`schedule_run\`,
|
|
90
|
+
\`outbox_inspect\`, and \`outbox_run\` for registered operational workflows
|
|
91
|
+
and outbox recovery.
|
|
79
92
|
|
|
80
93
|
## The framework already solves these
|
|
81
94
|
|
|
@@ -88,7 +101,7 @@ apps have reimplemented by accident:
|
|
|
88
101
|
| Ports outside a request — auth callbacks, module-level helpers | \`const { ports } = await getServer()\` (dynamic \`import("@/server")\` breaks module cycles). Do not construct parallel provider clients or fall back to \`console.*\` when \`ports.logger\` exists. |
|
|
89
102
|
| Routes that cannot be contracts — webhooks, third-party callbacks, streaming | \`createWebhookRoute\`, \`createPaymentWebhookRoute\`, \`createScheduleRoute\`, \`createOutboxDrainRoute\` from \`@beignet/next\`; \`server.rawRoute(...)\` for anything else. All run the hooks pipeline — never hand-enforce rate limits in a route body. |
|
|
90
103
|
| Rate limiting or idempotency on a route | Declare \`metadata.rateLimit\` / \`metadata.idempotency\` on the contract (or the \`pipeline\` option on raw routes); hooks enforce it. |
|
|
91
|
-
| Tenant-owned repository access | Pass \`TenantScope\` through app-facing repository methods and unwrap it with \`tenantScopeId(scope)\` in adapters. Raw provider-correlation lookups such as webhook customer IDs are not tenant authorization. |
|
|
104
|
+
| Tenant-owned repository access | Resolve the request tenant from membership-backed app state or provider claims the app explicitly treats as authoritative and current; never trust caller-supplied tenant IDs or unverified session fields. Pass \`TenantScope\` through app-facing repository methods and unwrap it with \`tenantScopeId(scope)\` in adapters. Raw provider-correlation lookups such as webhook customer IDs are not tenant authorization. |
|
|
92
105
|
| Route-level tests that exercise real hooks | \`createTestApp\` / \`createTestRequester\` from \`@beignet/web/testing\`. Bind the rate-limit and idempotency ports in the test app when asserting 429s or replay. |
|
|
93
106
|
| Environment configuration | \`lib/env.ts\` (\`createEnv\`), never ad-hoc \`process.env\` reads in app code. |
|
|
94
107
|
| The same lookup runs several times in one request — context, policy, use case | Wrap the repository read in \`createMemo(...)\` from \`@beignet/core/memo\` where the adapter is wired in infra. The cache lives for exactly one request; pair mutations with \`.invalidate(...)\`. Never hand-roll per-request caches. |
|
|
@@ -105,7 +118,7 @@ ${cli} check
|
|
|
105
118
|
It runs \`${cli} lint\` (Beignet's dependency-direction lint),
|
|
106
119
|
\`${cli} doctor --strict\`, and the app's \`lint\` (Biome), \`typecheck\`, and
|
|
107
120
|
\`test\` scripts in one pass, reporting every failure. Add \`--fix\` to apply
|
|
108
|
-
doctor's low-risk
|
|
121
|
+
doctor's eligible low-risk fixes first. Use \`${format}\` to apply
|
|
109
122
|
formatting. The individual commands (\`${lint}\`, \`${cli} lint\`,
|
|
110
123
|
\`${cli} doctor --strict\`, \`${test}\`, \`${typecheck}\`) still work when you
|
|
111
124
|
need one check alone.
|
|
@@ -153,10 +166,13 @@ skill-loading block.
|
|
|
153
166
|
## MCP server
|
|
154
167
|
|
|
155
168
|
\`.mcp.json\` registers the app-local \`@beignet/cli\` bin at
|
|
156
|
-
\`./node_modules/.bin/beignet mcp\`, which exposes
|
|
157
|
-
|
|
158
|
-
\`check\`, \`db\`, \`db_schema_sync\`, \`
|
|
169
|
+
\`./node_modules/.bin/beignet mcp\`, which exposes app context, validation,
|
|
170
|
+
generation, and operations as structured tools named exactly: \`app_map\`,
|
|
171
|
+
\`explain\`, \`check\`, \`db\`, \`db_schema_sync\`, \`task_run\`,
|
|
172
|
+
\`schedule_run\`, \`outbox_inspect\`, \`outbox_run\`, \`routes\`, \`doctor\`,
|
|
159
173
|
\`doctor_fix_plan\`, \`doctor_fix\`, \`lint\`, \`make\`, \`provider_add\`.
|
|
174
|
+
It also publishes \`beignet://app/guidance\` and focused
|
|
175
|
+
\`beignet://app/features/{feature}\` resources.
|
|
160
176
|
Use \`doctor_fix_plan\` to inspect
|
|
161
177
|
stable operation IDs, hashes, exact patches, and current diagnostics before
|
|
162
178
|
passing its \`planId\` and optional \`fixIds\` to \`doctor_fix\`. Guarded
|
|
@@ -174,7 +190,15 @@ with \`generate\` and \`migrate\`; database output is bounded, commands time
|
|
|
174
190
|
out, and cancellation stops the active process tree. Treat \`seed\` and
|
|
175
191
|
especially \`reset\` as app-owned mutations. Lifecycle \`dryRun\` validates
|
|
176
192
|
and reports the script without executing it; it does not simulate SQL or data
|
|
177
|
-
changes.
|
|
193
|
+
changes. Use \`task_run\` and \`schedule_run\` for registered operational
|
|
194
|
+
workflows, \`outbox_inspect\` for read-only \`list\` and \`show\`, and
|
|
195
|
+
\`outbox_run\` for \`drain\`, \`requeue\`, \`purge\`, or \`prune\`; purge and
|
|
196
|
+
prune support \`dryRun\`. Operational commands run in isolated process trees
|
|
197
|
+
with bounded results, cancellation, and timeouts. Optional \`module\` overrides
|
|
198
|
+
must remain inside the app root where the MCP server started. Cancellation and
|
|
199
|
+
timeouts cannot roll back side effects that already completed. Inspect app
|
|
200
|
+
state before retrying an interrupted operation or one that reports a cleanup
|
|
201
|
+
failure. Clients that do not read \`.mcp.json\` can use the same command from
|
|
178
202
|
the app root; use \`${cli} mcp\` only for terminal debugging.
|
|
179
203
|
`;
|
|
180
204
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/templates/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,aAAa,EAAwB,MAAM,aAAa,CAAC;AAExE;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAoB;IAC3C,MAAM,GAAG,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IAC/B,MAAM,IAAI,GACR,GAAG,CAAC,cAAc,KAAK,KAAK;QAC1B,CAAC,CAAC,cAAc;QAChB,CAAC,CAAC,GAAG,GAAG,CAAC,cAAc,WAAW,CAAC;IACvC,MAAM,IAAI,GACR,GAAG,CAAC,cAAc,KAAK,KAAK;QAC1B,CAAC,CAAC,cAAc;QAChB,CAAC,CAAC,GAAG,GAAG,CAAC,c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C,cAAc,EAAE,CAAC;QAC3B,KAAK,KAAK;YACR,OAAO,6BAA6B,CAAC;QACvC,KAAK,MAAM;YACT,OAAO,kCAAkC,CAAC;QAC5C,KAAK,MAAM;YACT,OAAO,kCAAkC,CAAC;QAC5C;YACE,OAAO,8BAA8B,CAAC;IAC1C,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,IAAqB;IAC3C,OAAO,IAAI,CAAC;QACV,UAAU,EAAE;YACV,OAAO,EAAE;gBACP,OAAO,EAAE,6BAA6B;gBACtC,IAAI,EAAE,CAAC,KAAK,CAAC;aACd;SACF;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/templates/server.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAErB,wBAAgB,eAAe,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CAuD5D;AAED,wBAAgB,KAAK,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CA0ClD;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CA+CvD;AAED,wBAAgB,GAAG,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CAgEhD;AAED,wBAAgB,aAAa,IAAI,MAAM,CAStC;AAED,wBAAgB,eAAe,IAAI,MAAM,CAuBxC;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CA0EvD;AAED,wBAAgB,MAAM,IAAI,MAAM,CA8E/B;AAED,QAAA,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/templates/server.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAErB,wBAAgB,eAAe,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CAuD5D;AAED,wBAAgB,KAAK,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CA0ClD;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CA+CvD;AAED,wBAAgB,GAAG,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CAgEhD;AAED,wBAAgB,aAAa,IAAI,MAAM,CAStC;AAED,wBAAgB,eAAe,IAAI,MAAM,CAuBxC;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CA0EvD;AAED,wBAAgB,MAAM,IAAI,MAAM,CA8E/B;AAED,QAAA,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;CAoYV,CAAC;AAEF,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,CAAC"}
|
package/dist/templates/server.js
CHANGED
|
@@ -580,7 +580,9 @@ export type TenantResolutionInput = {
|
|
|
580
580
|
export function resolveRequestTenant({
|
|
581
581
|
auth,
|
|
582
582
|
}: TenantResolutionInput): ActivityTenant | undefined {
|
|
583
|
-
const tenantId = auth
|
|
583
|
+
const tenantId = auth
|
|
584
|
+
? tenantIdFromAuthoritativeAuthClaims(auth)
|
|
585
|
+
: undefined;
|
|
584
586
|
|
|
585
587
|
return tenantId ? createTenant(tenantId) : undefined;
|
|
586
588
|
}
|
|
@@ -593,7 +595,12 @@ export function resolveServiceTenant(
|
|
|
593
595
|
return normalizedTenantId ? createTenant(normalizedTenantId) : undefined;
|
|
594
596
|
}
|
|
595
597
|
|
|
596
|
-
|
|
598
|
+
/**
|
|
599
|
+
* Resolve only provider-issued claims that the application treats as
|
|
600
|
+
* authoritative. Multi-tenant apps must replace this starter seam with a
|
|
601
|
+
* membership-backed lookup before authorizing tenant-owned resources.
|
|
602
|
+
*/
|
|
603
|
+
function tenantIdFromAuthoritativeAuthClaims(auth: AuthSession) {
|
|
597
604
|
return (
|
|
598
605
|
stringProperty(auth.session, "tenantId") ??
|
|
599
606
|
stringProperty(auth.session, "organizationId") ??
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/templates/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EACL,kBAAkB,EAClB,kBAAkB,GAEnB,MAAM,aAAa,CAAC;AAErB,MAAM,UAAU,eAAe,CAAC,GAAoB;IAClD,MAAM,EAAE,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG;QACd,qCAAqC;QACrC,6DAA6D;QAC7D,gFAAgF;QAChF,YAAY,EAAE,CAAC,eAAe,yCAAyC,EAAE,CAAC,OAAO,IAAI;QACrF,kBAAkB,CAAC,GAAG,EAAE,cAAc,CAAC;YACrC,CAAC,CAAC,6EAA6E;YAC/E,CAAC,CAAC,SAAS;QACb,2EAA2E;QAC3E,kBAAkB,CAAC,GAAG,EAAE,aAAa,CAAC;YACpC,CAAC,CAAC,2EAA2E;YAC7E,CAAC,CAAC,SAAS;QACb,kBAAkB,CAAC,GAAG,EAAE,oBAAoB,CAAC;YAC3C,CAAC,CAAC,wFAAwF;YAC1F,CAAC,CAAC,SAAS;QACb,8CAA8C;QAC9C,qDAAqD;QACrD,kBAAkB,CAAC,GAAG,EAAE,cAAc,CAAC;YACrC,CAAC,CAAC,4CAA4C;YAC9C,CAAC,CAAC,SAAS;QACb,gEAAgE;QAChE,2CAA2C;QAC3C,oEAAoE;KACrE,CAAC,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAElD,MAAM,OAAO,GAAG;QACd,6BAA6B;QAC7B,sEAAsE;QACtE,+BAA+B;QAC/B,KAAK,EAAE,CAAC,gBAAgB,GAAG;QAC3B,4BAA4B;QAC5B,kBAAkB,CAAC,GAAG,EAAE,cAAc,CAAC;YACrC,CAAC,CAAC,mDAAmD;YACrD,CAAC,CAAC,SA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AKnB;IACC,WAAW,EAAE;;;;;;;;;;;;;;;;CAgBd;IACC,UAAU,EAAE;;;;;;;;;;;;;;CAcb;IACC,aAAa,EAAE;;;;;;;;;;;CAWhB;IACC,YAAY,EAAE;;;;;;;;;CASf;IACC,SAAS,EAAE;;;;;;;;;;;;;;;;;;;;;CAqBZ;IACC,YAAY,EAAE;;;;;;;;CAQf;IACC,2EAA2E;IAC3E,wEAAwE;IACxE,4EAA4E;IAC5E,SAAS,EAAE;;;;;;;;;;;;;;;;;;;;;;;CAuBZ;IACC,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BV;IACC,cAAc,EAAE;;;;;CAKjB;CACA,CAAC;AAEF,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shadcn.d.ts","sourceRoot":"","sources":["../../src/templates/shadcn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"shadcn.d.ts","sourceRoot":"","sources":["../../src/templates/shadcn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA8hBhD,wBAAgB,mBAAmB,IAAI,YAAY,EAAE,CAcpD;AAED,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAQrD,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAGxD,CAAC"}
|
package/dist/templates/shadcn.js
CHANGED
|
@@ -179,7 +179,9 @@ const appGlobalsCss = `@import "tailwindcss";
|
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
`;
|
|
182
|
-
const uiButton = `
|
|
182
|
+
const uiButton = `"use client";
|
|
183
|
+
|
|
184
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
183
185
|
import { Slot } from "radix-ui";
|
|
184
186
|
import type * as React from "react";
|
|
185
187
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shadcn.js","sourceRoot":"","sources":["../../src/templates/shadcn.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,MAAM,aAAa,GAAG;;;;;;;CAOrB,CAAC;AAEF,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;CAyBtB,CAAC;AAEF,MAAM,QAAQ,GAAG;;;;;;CAMhB,CAAC;AAEF,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiIrB,CAAC;AAEF,MAAM,QAAQ,GAAG
|
|
1
|
+
{"version":3,"file":"shadcn.js","sourceRoot":"","sources":["../../src/templates/shadcn.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,MAAM,aAAa,GAAG;;;;;;;CAOrB,CAAC;AAEF,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;CAyBtB,CAAC;AAEF,MAAM,QAAQ,GAAG;;;;;;CAMhB,CAAC;AAEF,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiIrB,CAAC;AAEF,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqEhB,CAAC;AAEF,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AE,QAAQ;IACpC,IAAI,EAAE,QAAQ;IACd,cAAc,EAAE,SAAS;IACzB,UAAU,EAAE,QAAQ;IACpB,MAAM,EAAE,QAAQ;IAChB,gBAAgB,EAAE,QAAQ;IAC1B,gBAAgB,EAAE,QAAQ;CAC3B,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAA2B;IAC3D,sBAAsB,EAAE,QAAQ;IAChC,WAAW,EAAE,QAAQ;CACtB,CAAC"}
|
package/dist/templates/shared.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beignet/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.46",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "CLI for creating and maintaining Beignet apps.",
|
|
6
6
|
"main": "./dist/lib.js",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"tsx": "^4.22.4"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@beignet/core": "^0.0.
|
|
72
|
+
"@beignet/core": "^0.0.46",
|
|
73
73
|
"@clack/prompts": "^1.5.1",
|
|
74
74
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
75
75
|
"@stricli/core": "^1.2.7",
|
|
@@ -98,7 +98,13 @@ Run `beignet doctor --strict` after hand edits. Use
|
|
|
98
98
|
`beignet doctor --fix --dry-run` to inspect exact low-risk repair patches, then
|
|
99
99
|
apply the returned plan with `beignet doctor --fix --plan <plan-id>` and
|
|
100
100
|
optional `--only <operation-ids>`. Plain `doctor --fix` remains the apply-all
|
|
101
|
-
shortcut.
|
|
101
|
+
shortcut. Eligible repairs include central route and workflow registration,
|
|
102
|
+
existing Inngest registries, opted-in runtime manifests, managed exports for
|
|
103
|
+
default Beignet provider tables, generated test support, and direct OpenAPI
|
|
104
|
+
arrays. Custom anchors, ambiguous imports, partial individual registration,
|
|
105
|
+
custom schema-index re-exports, and custom table names remain diagnostic-only.
|
|
106
|
+
Provider-table repair changes schema source but never generates or applies SQL
|
|
107
|
+
migrations.
|
|
102
108
|
|
|
103
109
|
## Path Config
|
|
104
110
|
|
|
@@ -190,8 +196,11 @@ Generated apps register:
|
|
|
190
196
|
```
|
|
191
197
|
|
|
192
198
|
The MCP server exposes `app_map`, `explain`, `check`, `db`,
|
|
193
|
-
`db_schema_sync`, `
|
|
194
|
-
`make`, and
|
|
199
|
+
`db_schema_sync`, `task_run`, `schedule_run`, `outbox_inspect`, `outbox_run`,
|
|
200
|
+
`routes`, `doctor`, `doctor_fix_plan`, `doctor_fix`, `lint`, `make`, and
|
|
201
|
+
`provider_add`. It also publishes `beignet://app/guidance` and the
|
|
202
|
+
`beignet://app/features/{feature}` resource template for bounded app-local
|
|
203
|
+
instructions and focused feature maps.
|
|
195
204
|
`doctor_fix_plan` is read-only and returns guarded repair operation IDs,
|
|
196
205
|
hashes, patches, a plan ID, and current diagnostics; pass that ID and optional
|
|
197
206
|
`fixIds` to `doctor_fix`. Guarded apply returns the same plan metadata and
|
|
@@ -212,9 +221,18 @@ accepts `{ dialect?, tables?, output?, dryRun? }` and returns the matching
|
|
|
212
221
|
`beignet db schema sync --json` report. For lifecycle commands, `dryRun`
|
|
213
222
|
validates and reports the app-owned script without executing it; it does not
|
|
214
223
|
simulate SQL or data changes. `reset` remains environment-sensitive even
|
|
215
|
-
though the generated entrypoint has a production guard. `
|
|
216
|
-
|
|
217
|
-
|
|
224
|
+
though the generated entrypoint has a production guard. `task_run` and
|
|
225
|
+
`schedule_run` execute registered app workflows. Use `outbox_inspect` for
|
|
226
|
+
read-only `list` and `show`, and `outbox_run` for state-changing `drain`,
|
|
227
|
+
`requeue`, `purge`, and `prune`; purge and prune support `dryRun`. Operational
|
|
228
|
+
tools isolate app code, bound structured results, and stop the complete process
|
|
229
|
+
tree on request cancellation or timeout. Optional operational `module`
|
|
230
|
+
overrides must stay inside the app root where the MCP server started.
|
|
231
|
+
Cancellation and timeouts cannot roll back side effects that already
|
|
232
|
+
completed. Inspect app state before retrying an interrupted operation or one
|
|
233
|
+
that reports a cleanup failure. `doctor`, `lint`, and their JSON output match
|
|
234
|
+
the CLI's `--json` shape. Run MCP clients from the app root so the local CLI
|
|
235
|
+
version is used.
|
|
218
236
|
|
|
219
237
|
## Validation Loop
|
|
220
238
|
|
|
@@ -237,7 +255,8 @@ When MCP is available, call `check` after edits to run the full validation loop
|
|
|
237
255
|
through the app-local CLI without reconstructing these commands individually.
|
|
238
256
|
For a generated persistent resource, the complete structured workflow is
|
|
239
257
|
`app_map` → `explain` → `make` → `db_schema_sync` when provider tables changed
|
|
240
|
-
→ `db` generate → `db` migrate → `
|
|
258
|
+
→ `db` generate → `db` migrate → the relevant `task_run`, `schedule_run`, or
|
|
259
|
+
outbox tool when operational work is required → `check`.
|
|
241
260
|
|
|
242
261
|
For generated app template changes inside the Beignet monorepo, also run:
|
|
243
262
|
|
package/src/choices.ts
CHANGED
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
* templates or generators at startup.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import type {
|
|
9
|
+
OutboxMessageKind,
|
|
10
|
+
OutboxMessageStatus,
|
|
11
|
+
} from "@beignet/core/outbox";
|
|
12
|
+
|
|
8
13
|
function defineExhaustiveChoices<Choice extends string>() {
|
|
9
14
|
return <const Choices extends readonly Choice[]>(
|
|
10
15
|
choices: Exclude<Choice, Choices[number]> extends never ? Choices : never,
|
|
@@ -31,6 +36,9 @@ export const doctorFixOperationIds = [
|
|
|
31
36
|
"workflows.register-missing",
|
|
32
37
|
"outbox.register-missing",
|
|
33
38
|
"listeners.register-missing",
|
|
39
|
+
"database.sync-provider-tables",
|
|
40
|
+
"inngest.register-missing",
|
|
41
|
+
"runtime-manifest.register-missing",
|
|
34
42
|
"openapi.register-missing",
|
|
35
43
|
] as const;
|
|
36
44
|
|
|
@@ -84,6 +92,20 @@ export const databaseSchemaTableChoices =
|
|
|
84
92
|
"idempotency",
|
|
85
93
|
"outbox",
|
|
86
94
|
]);
|
|
95
|
+
|
|
96
|
+
/** Outbox statuses accepted by CLI and MCP inspection filters. */
|
|
97
|
+
export const outboxMessageStatusChoices =
|
|
98
|
+
defineExhaustiveChoices<OutboxMessageStatus>()([
|
|
99
|
+
"pending",
|
|
100
|
+
"claimed",
|
|
101
|
+
"delivered",
|
|
102
|
+
"deadLettered",
|
|
103
|
+
]);
|
|
104
|
+
|
|
105
|
+
/** Outbox message kinds accepted by CLI and MCP inspection filters. */
|
|
106
|
+
export const outboxMessageKindChoices =
|
|
107
|
+
defineExhaustiveChoices<OutboxMessageKind>()(["event", "job"]);
|
|
108
|
+
|
|
87
109
|
/**
|
|
88
110
|
* Provider setup presets supported by `beignet provider add`.
|
|
89
111
|
*/
|
package/src/db.ts
CHANGED
|
@@ -276,7 +276,8 @@ async function assertDatabaseCommandPreflight(
|
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
-
|
|
279
|
+
/** @internal */
|
|
280
|
+
export async function resolveDatabaseSchemaDialect(
|
|
280
281
|
cwd: string,
|
|
281
282
|
explicitDialect: DatabaseSchemaDialect | undefined,
|
|
282
283
|
): Promise<DatabaseSchemaDialect> {
|
|
@@ -386,7 +387,8 @@ function normalizeAppRelativePath(
|
|
|
386
387
|
return relative.split(path.sep).join("/");
|
|
387
388
|
}
|
|
388
389
|
|
|
389
|
-
|
|
390
|
+
/** @internal */
|
|
391
|
+
export function renderDatabaseSchema(
|
|
390
392
|
dialect: DatabaseSchemaDialect,
|
|
391
393
|
tables: readonly DatabaseSchemaTable[],
|
|
392
394
|
): string {
|
|
@@ -573,6 +575,7 @@ export function spawnCommand(
|
|
|
573
575
|
return new Promise((resolve, reject) => {
|
|
574
576
|
let settled = false;
|
|
575
577
|
let timedOut = false;
|
|
578
|
+
let abortError: Error | undefined;
|
|
576
579
|
let timeout: ReturnType<typeof setTimeout> | undefined;
|
|
577
580
|
let forceKillTimeout: ReturnType<typeof setTimeout> | undefined;
|
|
578
581
|
const ownsProcessGroup = commandOwnsProcessGroup(process.platform, {
|
|
@@ -595,11 +598,10 @@ export function spawnCommand(
|
|
|
595
598
|
options.signal?.removeEventListener("abort", abort);
|
|
596
599
|
};
|
|
597
600
|
const abort = () => {
|
|
598
|
-
if (settled) return;
|
|
599
|
-
|
|
601
|
+
if (settled || abortError) return;
|
|
602
|
+
abortError = commandAbortError(options.signal);
|
|
600
603
|
terminateChild(child, "SIGKILL", ownsProcessGroup);
|
|
601
604
|
cleanup();
|
|
602
|
-
reject(commandAbortError(options.signal));
|
|
603
605
|
};
|
|
604
606
|
|
|
605
607
|
if (options.captureOutput) {
|
|
@@ -611,7 +613,7 @@ export function spawnCommand(
|
|
|
611
613
|
if (settled) return;
|
|
612
614
|
settled = true;
|
|
613
615
|
cleanup();
|
|
614
|
-
reject(error);
|
|
616
|
+
reject(abortError ?? error);
|
|
615
617
|
});
|
|
616
618
|
child.on("close", (code) => {
|
|
617
619
|
if (settled) return;
|
|
@@ -620,6 +622,10 @@ export function spawnCommand(
|
|
|
620
622
|
}
|
|
621
623
|
settled = true;
|
|
622
624
|
cleanup();
|
|
625
|
+
if (abortError) {
|
|
626
|
+
reject(abortError);
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
623
629
|
resolve({
|
|
624
630
|
exitCode: timedOut ? 1 : (code ?? 1),
|
|
625
631
|
...(options.captureOutput
|
package/src/index.ts
CHANGED
|
@@ -33,6 +33,8 @@ import {
|
|
|
33
33
|
type MakeFeatureRecipe,
|
|
34
34
|
makeFeatureAddonChoices,
|
|
35
35
|
makeFeatureRecipeChoices,
|
|
36
|
+
outboxMessageKindChoices,
|
|
37
|
+
outboxMessageStatusChoices,
|
|
36
38
|
type PackageManager,
|
|
37
39
|
type ProviderPresetName,
|
|
38
40
|
packageManagerChoices,
|
|
@@ -171,21 +173,9 @@ type OutboxDrainFlags = {
|
|
|
171
173
|
cwd?: string;
|
|
172
174
|
};
|
|
173
175
|
|
|
174
|
-
type OutboxMessageStatus =
|
|
176
|
+
type OutboxMessageStatus = (typeof outboxMessageStatusChoices)[number];
|
|
175
177
|
|
|
176
|
-
type OutboxMessageKind =
|
|
177
|
-
|
|
178
|
-
const outboxMessageStatusChoices = [
|
|
179
|
-
"pending",
|
|
180
|
-
"claimed",
|
|
181
|
-
"delivered",
|
|
182
|
-
"deadLettered",
|
|
183
|
-
] as const satisfies readonly OutboxMessageStatus[];
|
|
184
|
-
|
|
185
|
-
const outboxMessageKindChoices = [
|
|
186
|
-
"event",
|
|
187
|
-
"job",
|
|
188
|
-
] as const satisfies readonly OutboxMessageKind[];
|
|
178
|
+
type OutboxMessageKind = (typeof outboxMessageKindChoices)[number];
|
|
189
179
|
|
|
190
180
|
type OutboxListFlags = {
|
|
191
181
|
json?: boolean;
|
|
@@ -294,6 +284,19 @@ const parseDate = (input: string): Date => {
|
|
|
294
284
|
}
|
|
295
285
|
return value;
|
|
296
286
|
};
|
|
287
|
+
const parseJsonFlag = (
|
|
288
|
+
input: string | undefined,
|
|
289
|
+
flag: "--input" | "--payload",
|
|
290
|
+
): unknown => {
|
|
291
|
+
if (input === undefined) return undefined;
|
|
292
|
+
try {
|
|
293
|
+
return JSON.parse(input) as unknown;
|
|
294
|
+
} catch (error) {
|
|
295
|
+
throw new Error(
|
|
296
|
+
`Invalid ${flag} JSON: ${error instanceof Error ? error.message : String(error)}`,
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
};
|
|
297
300
|
|
|
298
301
|
const createForceFlag = {
|
|
299
302
|
kind: "boolean",
|
|
@@ -1446,7 +1449,7 @@ const taskRunCommand = buildCommand<TaskRunFlags, [string], CliContext>({
|
|
|
1446
1449
|
const result = await runAppTask({
|
|
1447
1450
|
name,
|
|
1448
1451
|
cwd: flags.cwd,
|
|
1449
|
-
input: flags.input,
|
|
1452
|
+
input: parseJsonFlag(flags.input, "--input"),
|
|
1450
1453
|
tenant: flags.tenant,
|
|
1451
1454
|
modulePath: flags.module,
|
|
1452
1455
|
});
|
|
@@ -1698,7 +1701,7 @@ const scheduleRunCommand = buildCommand<ScheduleRunFlags, [string], CliContext>(
|
|
|
1698
1701
|
name,
|
|
1699
1702
|
cwd: flags.cwd,
|
|
1700
1703
|
modulePath: flags.module,
|
|
1701
|
-
payload: flags.payload,
|
|
1704
|
+
payload: parseJsonFlag(flags.payload, "--payload"),
|
|
1702
1705
|
id: flags.runId,
|
|
1703
1706
|
attempt: flags.attempt,
|
|
1704
1707
|
scheduledAt: flags.scheduledAt,
|