@lunora/cli 1.0.0-alpha.14 → 1.0.0-alpha.141
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/LICENSE.md +6 -0
- package/README.md +1 -1
- package/__assets__/package-og.svg +1 -1
- package/dist/bin.mjs +2 -10
- package/dist/index.d.mts +468 -329
- package/dist/index.d.ts +468 -329
- package/dist/index.mjs +1 -19
- package/dist/packem_chunks/handler.mjs +1 -150
- package/dist/packem_chunks/handler10.mjs +1 -22
- package/dist/packem_chunks/handler11.mjs +1 -192
- package/dist/packem_chunks/handler12.mjs +2 -131
- package/dist/packem_chunks/handler13.mjs +2 -65
- package/dist/packem_chunks/handler14.mjs +1 -58
- package/dist/packem_chunks/handler15.mjs +1 -79
- package/dist/packem_chunks/handler16.mjs +1 -43
- package/dist/packem_chunks/handler17.mjs +1 -105
- package/dist/packem_chunks/handler18.mjs +3 -170
- package/dist/packem_chunks/handler19.mjs +1 -89
- package/dist/packem_chunks/handler2.mjs +2 -114
- package/dist/packem_chunks/handler20.mjs +1 -94
- package/dist/packem_chunks/handler21.mjs +7 -311
- package/dist/packem_chunks/handler22.mjs +2 -0
- package/dist/packem_chunks/handler23.mjs +1 -0
- package/dist/packem_chunks/handler24.mjs +99 -0
- package/dist/packem_chunks/handler25.mjs +11 -0
- package/dist/packem_chunks/handler3.mjs +2 -204
- package/dist/packem_chunks/handler4.mjs +2 -33
- package/dist/packem_chunks/handler5.mjs +1 -49
- package/dist/packem_chunks/handler6.mjs +1 -91
- package/dist/packem_chunks/handler7.mjs +1 -42
- package/dist/packem_chunks/handler8.mjs +1 -174
- package/dist/packem_chunks/handler9.mjs +3 -16
- package/dist/packem_chunks/planDevCommand.mjs +7 -500
- package/dist/packem_chunks/runCodegenCommand.mjs +4 -52
- package/dist/packem_chunks/runDeployCommand.mjs +1 -504
- package/dist/packem_chunks/runInitCommand.mjs +1018 -1315
- package/dist/packem_chunks/runMigrateGenerateCommand.mjs +9 -395
- package/dist/packem_chunks/runResetCommand.mjs +1 -41
- package/dist/packem_chunks/runRpcCommand.mjs +1 -68
- package/dist/packem_shared/COMMANDS-C7e5qiYV.mjs +1 -0
- package/dist/packem_shared/DEFAULT_IMPORT_BATCH_SIZE-xn-frBqK.mjs +12 -0
- package/dist/packem_shared/admin-token-DV5A9T5b.mjs +1 -0
- package/dist/packem_shared/admin-url-Ca-KI3d_.mjs +1 -0
- package/dist/packem_shared/advisory-gate-yaOOyUQl.mjs +1 -0
- package/dist/packem_shared/api-spec-BENwiyUa.mjs +1 -0
- package/dist/packem_shared/buildRegistryIndex-DwySASBu.mjs +1 -0
- package/dist/packem_shared/cli-DdEKv4ng.mjs +3 -0
- package/dist/packem_shared/codegen-error-DJN6pTH5.mjs +3 -0
- package/dist/packem_shared/command-Bjv4VmYA.mjs +1 -0
- package/dist/packem_shared/commands-BvfzxKAa.mjs +19 -0
- package/dist/packem_shared/createLogger--C3x1FNE.mjs +2 -0
- package/dist/packem_shared/createRecordingSpawner-SKs4R1fc.mjs +1 -0
- package/dist/packem_shared/deploy-target-Dvr9vxpR.mjs +1 -0
- package/dist/packem_shared/detect-package-manager-D9r2z_X6.mjs +1 -0
- package/dist/packem_shared/diffSnapshots-9bDd9nOK.mjs +5 -0
- package/dist/packem_shared/docker-CKvYE9YF.mjs +1 -0
- package/dist/packem_shared/insertSchemaExtension-DZReBZ4_.mjs +8 -0
- package/dist/packem_shared/lint-ignore-report-CSeEIMkV.mjs +2 -0
- package/dist/packem_shared/open-url-CTU_g9gr.mjs +1 -0
- package/dist/packem_shared/output-format-D7cKB-O5.mjs +2 -0
- package/dist/packem_shared/parseManifest-x3WsxKHz.mjs +1 -0
- package/dist/packem_shared/platform-diagnostics-C4TFj5Pu.mjs +4 -0
- package/dist/packem_shared/post-codegen-hook-reEtIN59.mjs +1 -0
- package/dist/packem_shared/prompt-cancelled-C8Sj7OqI.mjs +1 -0
- package/dist/packem_shared/resolve-target-CeiNrCAx.mjs +1 -0
- package/dist/packem_shared/runAddCommand-oQMYPkp6.mjs +1 -0
- package/dist/packem_shared/schema-drift-gate-d12lMICD.mjs +1 -0
- package/dist/packem_shared/schemaIrToSnapshot-Clwd2A8e.mjs +1 -0
- package/dist/packem_shared/tui-prompts-CCt3jm1k.mjs +4 -0
- package/dist/packem_shared/vectorize-metadata-BvZbbqUD.mjs +1 -0
- package/dist/packem_shared/wrangler-name-CHDf3rMP.mjs +1 -0
- package/dist/packem_shared/wrangler-secrets-DzYgUxU-.mjs +1 -0
- package/package.json +37 -17
- package/skills/README.md +28 -14
- package/skills/lunora/SKILL.md +48 -9
- package/skills/lunora-functions/SKILL.md +38 -3
- package/skills/lunora-migration-helper/SKILL.md +70 -17
- package/skills/lunora-performance-audit/SKILL.md +36 -6
- package/skills/lunora-quickstart/SKILL.md +86 -24
- package/skills/lunora-realtime/SKILL.md +43 -30
- package/dist/packem_shared/COMMANDS-D3h9Iwvl.mjs +0 -944
- package/dist/packem_shared/DEFAULT_IMPORT_BATCH_SIZE-Ck-2bU08.mjs +0 -244
- package/dist/packem_shared/admin-url-4UzT-CI4.mjs +0 -19
- package/dist/packem_shared/api-spec-CtA6ilu4.mjs +0 -13
- package/dist/packem_shared/buildRegistryIndex-BcYe607_.mjs +0 -38
- package/dist/packem_shared/command-BC30oSBW.mjs +0 -14
- package/dist/packem_shared/commands-hl0mRqqg.mjs +0 -845
- package/dist/packem_shared/createLogger-B40gPzQo.mjs +0 -78
- package/dist/packem_shared/createRecordingSpawner-DxI3mebw.mjs +0 -43
- package/dist/packem_shared/detect-package-manager-DYp7n3mJ.mjs +0 -61
- package/dist/packem_shared/diffSnapshots-BeDvvNiF.mjs +0 -161
- package/dist/packem_shared/docker-hMQ97KSQ.mjs +0 -21
- package/dist/packem_shared/insertSchemaExtension-DAqbfr9Z.mjs +0 -64
- package/dist/packem_shared/open-url-Dfq6fAyT.mjs +0 -41
- package/dist/packem_shared/output-format-wUvAN6AL.mjs +0 -17
- package/dist/packem_shared/parseArgs-YXFuKdEk.mjs +0 -56
- package/dist/packem_shared/parseManifest--vZf2FY1.mjs +0 -94
- package/dist/packem_shared/resolve-target-qbsJ_5sF.mjs +0 -16
- package/dist/packem_shared/runAddCommand-vJdgiR5t.mjs +0 -4
- package/dist/packem_shared/schema-drift-gate-BtBt0as0.mjs +0 -79
- package/dist/packem_shared/schemaIrToSnapshot-DdsljJT-.mjs +0 -43
- package/dist/packem_shared/storage-B7hHSTZP.mjs +0 -84
- package/dist/packem_shared/tui-prompts-M6OWsuyw.mjs +0 -663
- package/dist/packem_shared/wrangler-name-cy4yhm9j.mjs +0 -12
package/dist/index.d.mts
CHANGED
|
@@ -1,33 +1,34 @@
|
|
|
1
|
-
import { CodegenOptions, SchemaIR } from '@lunora/codegen';
|
|
1
|
+
import { CodegenOptions, Finding, SchemaIR } from '@lunora/codegen';
|
|
2
2
|
import '@visulima/cerebro';
|
|
3
|
-
import { ensureDevVariables, ensureDevVarsExample,
|
|
4
|
-
|
|
3
|
+
import { ensureDevVariables, ensureDevVarsExample, fillDevSecrets, LintTool, LintIgnoreOutcome } from '@lunora/config';
|
|
4
|
+
import { materializeRemoteWranglerConfig } from '@lunora/config/cloudflare';
|
|
5
|
+
export { REQUIRED_COMPATIBILITY_DATE, REQUIRED_FLAG, type WranglerProjectValidationOptions as WranglerValidationOptions, type WranglerValidationReport, type WranglerProjectValidationResult as WranglerValidationResult, validateWranglerProject as validateWrangler, validateWranglerConfig } from '@lunora/config/cloudflare';
|
|
5
6
|
/** Every command name the CLI registers (drives the `CommandName` type + tests). */
|
|
6
|
-
declare const COMMANDS: readonly ["init", "add", "dev", "codegen", "build", "deploy", "containers", "prepare", "link", "deployments", "logs", "run", "insights", "reset", "migrate", "export", "import", "seed", "backup", "verify", "info", "doctor", "env", "analyze", "view", "docs", "registry", "rules"];
|
|
7
|
+
declare const COMMANDS: readonly ["init", "add", "dev", "codegen", "build", "deploy", "containers", "prepare", "link", "deployments", "logs", "run", "insights", "reset", "migrate", "export", "import", "seed", "backup", "eval", "verify", "info", "doctor", "env", "analyze", "view", "docs", "registry", "rules", "mcp"];
|
|
7
8
|
type CommandName = (typeof COMMANDS)[number];
|
|
8
9
|
declare const VERSION: string;
|
|
9
10
|
interface RunCliOptions {
|
|
10
11
|
argv?: ReadonlyArray<string>;
|
|
11
12
|
cwd?: string;
|
|
12
13
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
* Inject a console-like logger so callers (tests) can capture cerebro's
|
|
15
|
+
* help / version / usage rendering. Omitted in production, where cerebro
|
|
16
|
+
* uses its default stdout/stderr logger.
|
|
17
|
+
*/
|
|
17
18
|
logger?: Console;
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
|
-
* Run the CLI and resolve to the process exit code. cerebro handles help,
|
|
21
|
-
* version, usage, and unknown commands (the latter throws, caught here as 1).
|
|
22
|
-
* `shouldExitProcess: false` keeps the process alive so callers/tests read the
|
|
23
|
-
* captured exit code.
|
|
24
|
-
*/
|
|
21
|
+
* Run the CLI and resolve to the process exit code. cerebro handles help,
|
|
22
|
+
* version, usage, and unknown commands (the latter throws, caught here as 1).
|
|
23
|
+
* `shouldExitProcess: false` keeps the process alive so callers/tests read the
|
|
24
|
+
* captured exit code.
|
|
25
|
+
*/
|
|
25
26
|
declare const runCli: (options?: RunCliOptions) => Promise<number>;
|
|
26
27
|
/**
|
|
27
|
-
* The `--api-spec` flag's accepted values, mirroring `@lunora/codegen`'s
|
|
28
|
-
* `CodegenOptions["apiSpec"]`. `"openapi"` (the default) emits `openapi.json`;
|
|
29
|
-
* `"openrpc"` emits `openrpc.json`; `"both"` emits both; `"none"` emits neither.
|
|
30
|
-
*/
|
|
28
|
+
* The `--api-spec` flag's accepted values, mirroring `@lunora/codegen`'s
|
|
29
|
+
* `CodegenOptions["apiSpec"]`. `"openapi"` (the default) emits `openapi.json`;
|
|
30
|
+
* `"openrpc"` emits `openrpc.json`; `"both"` emits both; `"none"` emits neither.
|
|
31
|
+
*/
|
|
31
32
|
type ApiSpec = NonNullable<CodegenOptions["apiSpec"]>;
|
|
32
33
|
interface Logger {
|
|
33
34
|
debug?: (message: string) => void;
|
|
@@ -37,11 +38,11 @@ interface Logger {
|
|
|
37
38
|
warn: (message: string) => void;
|
|
38
39
|
}
|
|
39
40
|
/**
|
|
40
|
-
* Narrowed view over the pail instance. `createPail` returns an intersection
|
|
41
|
-
* type that includes a constructor signature and `(...args: any[])` logger
|
|
42
|
-
* overloads, which the type-aware linter cannot safely resolve. We only ever
|
|
43
|
-
* call the level methods with a string, so we describe exactly that surface.
|
|
44
|
-
*/
|
|
41
|
+
* Narrowed view over the pail instance. `createPail` returns an intersection
|
|
42
|
+
* type that includes a constructor signature and `(...args: any[])` logger
|
|
43
|
+
* overloads, which the type-aware linter cannot safely resolve. We only ever
|
|
44
|
+
* call the level methods with a string, so we describe exactly that surface.
|
|
45
|
+
*/
|
|
45
46
|
interface PailLogger {
|
|
46
47
|
debug: (message: string) => void;
|
|
47
48
|
error: (message: string) => void;
|
|
@@ -51,25 +52,12 @@ interface PailLogger {
|
|
|
51
52
|
}
|
|
52
53
|
declare const createLogger: () => Logger;
|
|
53
54
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
|
|
59
|
-
*/
|
|
60
|
-
/**
|
|
61
|
-
* Direct access to the underlying pail instance for advanced use-cases.
|
|
62
|
-
* A Proxy keeps the public `pail` binding lazy: the real pail is only
|
|
63
|
-
* constructed on first property access, so importing this module (and thus
|
|
64
|
-
* the package barrel) stays side-effect-free.
|
|
65
|
-
*/
|
|
55
|
+
* Direct access to the underlying pail instance for advanced use-cases.
|
|
56
|
+
* A Proxy keeps the public `pail` binding lazy: the real pail is only
|
|
57
|
+
* constructed on first property access, so importing this module (and thus
|
|
58
|
+
* the package barrel) stays side-effect-free.
|
|
59
|
+
*/
|
|
66
60
|
declare const pail: PailLogger;
|
|
67
|
-
/**
|
|
68
|
-
* Emit a badged step line through the shared pail (the `init` flow's off-TTY
|
|
69
|
-
* fallback for the create-astro-style transcript). The `message` may contain
|
|
70
|
-
* newlines — `LunoraReporter` indents continuation lines under the badge so a
|
|
71
|
-
* dimmed answer sits below its question.
|
|
72
|
-
*/
|
|
73
61
|
interface CodegenCommandOptions {
|
|
74
62
|
/** Which API spec(s) to emit. Defaults to codegen's `"openapi"` when omitted. */
|
|
75
63
|
apiSpec?: ApiSpec;
|
|
@@ -77,28 +65,37 @@ interface CodegenCommandOptions {
|
|
|
77
65
|
/** Output format: `pretty` (default) or `json`. */
|
|
78
66
|
format?: string;
|
|
79
67
|
logger: Logger;
|
|
68
|
+
/**
|
|
69
|
+
* Fail the run when any ERROR-level advisory is reported. Defaults to CI
|
|
70
|
+
* detection so a local `lunora codegen` stays advisory while a pipeline
|
|
71
|
+
* gates on it; `--no-strict-advisories` forces it off either way.
|
|
72
|
+
*/
|
|
73
|
+
strictAdvisories?: boolean;
|
|
74
|
+
/** Deploy target the emitted `ctx.*` surface is tailored to. Resolved by the caller; falls back to `"target"` in `lunora.json`, then `"cloudflare"`. */
|
|
75
|
+
target?: string;
|
|
80
76
|
}
|
|
81
77
|
interface CodegenCommandResult {
|
|
82
78
|
advisories: ReadonlyArray<{
|
|
83
79
|
detail: string;
|
|
84
|
-
level:
|
|
80
|
+
level: Finding["level"];
|
|
85
81
|
name: string;
|
|
86
82
|
remediation: string;
|
|
87
83
|
}>;
|
|
88
84
|
cronTriggers: ReadonlyArray<string>;
|
|
89
|
-
/** Set when the run
|
|
85
|
+
/** Set when the run failed: an invalid `--format`, an unregistered target, or an error-level platform diagnostic. */
|
|
90
86
|
error?: string;
|
|
87
|
+
/** ERROR-level advisories that made the run fail, when strict mode is on. */
|
|
88
|
+
failedAdvisories: number;
|
|
91
89
|
outputDirectory: string;
|
|
92
90
|
}
|
|
93
91
|
declare const runCodegenCommand: (options: CodegenCommandOptions) => CodegenCommandResult;
|
|
94
|
-
/** `lunora codegen` handler (lazy-loaded via the command's `loader`). */
|
|
95
92
|
/** Rows per HTTP request when importing. Convex uses ~500; same here. */
|
|
96
93
|
declare const DEFAULT_IMPORT_BATCH_SIZE = 500;
|
|
97
94
|
/**
|
|
98
|
-
* Minimal projection of `globalThis.fetch` for the export path — we need
|
|
99
|
-
* `body` as a stream-iterable, which the shared {@link FetchLike} type
|
|
100
|
-
* intentionally hides for the JSON-only commands.
|
|
101
|
-
*/
|
|
95
|
+
* Minimal projection of `globalThis.fetch` for the export path — we need
|
|
96
|
+
* `body` as a stream-iterable, which the shared {@link FetchLike} type
|
|
97
|
+
* intentionally hides for the JSON-only commands.
|
|
98
|
+
*/
|
|
102
99
|
type StreamingFetchLike = (input: string, init?: {
|
|
103
100
|
body?: string;
|
|
104
101
|
headers?: Record<string, string>;
|
|
@@ -132,10 +129,10 @@ interface ExportCommandResult {
|
|
|
132
129
|
rows: number;
|
|
133
130
|
}
|
|
134
131
|
/**
|
|
135
|
-
* Stream an export. The worker emits NDJSON; we count newlines as we go and
|
|
136
|
-
* pipe straight to the output sink, so a 10M-row export doesn't materialise
|
|
137
|
-
* the body in memory.
|
|
138
|
-
*/
|
|
132
|
+
* Stream an export. The worker emits NDJSON; we count newlines as we go and
|
|
133
|
+
* pipe straight to the output sink, so a 10M-row export doesn't materialise
|
|
134
|
+
* the body in memory.
|
|
135
|
+
*/
|
|
139
136
|
declare const runExportCommand: (options: ExportCommandOptions) => Promise<ExportCommandResult>;
|
|
140
137
|
interface ImportCommandOptions {
|
|
141
138
|
/** Rows per HTTP request. Defaults to {@link DEFAULT_IMPORT_BATCH_SIZE}. */
|
|
@@ -147,13 +144,15 @@ interface ImportCommandOptions {
|
|
|
147
144
|
logger: Logger;
|
|
148
145
|
prod?: boolean;
|
|
149
146
|
/**
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
147
|
+
* Wrap each line as `{table:<name>,doc:<line>}`. Use when the source NDJSON
|
|
148
|
+
* is bare docs from a single table — Convex's `convex import --table users`
|
|
149
|
+
* shape.
|
|
150
|
+
*/
|
|
154
151
|
table?: string;
|
|
155
152
|
token?: string;
|
|
156
153
|
url?: string;
|
|
154
|
+
/** Confirm bulk-writing production. Required alongside `--prod`. */
|
|
155
|
+
yes?: boolean;
|
|
157
156
|
}
|
|
158
157
|
interface ImportCommandResult {
|
|
159
158
|
body: unknown;
|
|
@@ -162,70 +161,111 @@ interface ImportCommandResult {
|
|
|
162
161
|
inserted: number;
|
|
163
162
|
}
|
|
164
163
|
/**
|
|
165
|
-
* Stream an NDJSON file
|
|
166
|
-
* `/_lunora/admin/import`.
|
|
167
|
-
* multi-GiB
|
|
168
|
-
|
|
164
|
+
* Stream an NDJSON file — or a `npx convex export --path <dir>` directory — in
|
|
165
|
+
* chunks, POSTing each batch to `/_lunora/admin/import`. The line buffer stays
|
|
166
|
+
* bounded by `batchSize`, so a multi-GiB source imports without buffering
|
|
167
|
+
* everything in memory.
|
|
168
|
+
*/
|
|
169
169
|
declare const runImportCommand: (options: ImportCommandOptions) => Promise<ImportCommandResult>;
|
|
170
170
|
/**
|
|
171
|
-
* Injectable probe for a Docker-compatible container engine. Tests pass a
|
|
172
|
-
* stub; production uses {@link isDockerAvailable}.
|
|
173
|
-
*/
|
|
171
|
+
* Injectable probe for a Docker-compatible container engine. Tests pass a
|
|
172
|
+
* stub; production uses {@link isDockerAvailable}.
|
|
173
|
+
*/
|
|
174
174
|
type DockerProbe = () => boolean;
|
|
175
|
-
/**
|
|
176
|
-
* True when a Docker-compatible engine answers `docker info` — the same
|
|
177
|
-
* prerequisite `wrangler deploy` has for building and pushing a container
|
|
178
|
-
* image from a local Dockerfile. Quiet by design (output discarded): callers
|
|
179
|
-
* own the messaging.
|
|
180
|
-
*/
|
|
181
175
|
interface SpawnDescriptor {
|
|
182
176
|
args: ReadonlyArray<string>;
|
|
183
177
|
/**
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
178
|
+
* Capture the child's stderr (in addition to streaming it to the parent).
|
|
179
|
+
* Needed when a tool reports the *expected* outcome as an error there —
|
|
180
|
+
* `wrangler vectorize create-metadata-index` writes "already exists" to
|
|
181
|
+
* stderr, and without this the caller can only see a bare exit code and
|
|
182
|
+
* would warn on every re-run. Composes with `stdoutToStderr`, so a caller
|
|
183
|
+
* can keep stdout clean for `--format json` and still read the reason.
|
|
184
|
+
*/
|
|
185
|
+
captureStderr?: boolean;
|
|
186
|
+
/**
|
|
187
|
+
* Capture the child's stdout (in addition to streaming it to the parent), so
|
|
188
|
+
* the caller can parse it — used by `deploy` to read the deployed URL from
|
|
189
|
+
* `wrangler deploy` output. Each chunk is still teed to the parent's stdout
|
|
190
|
+
* so the user sees live progress. Mutually exclusive with `stdoutToStderr`
|
|
191
|
+
* and `captureStdoutSilently`.
|
|
192
|
+
*/
|
|
189
193
|
captureStdout?: boolean;
|
|
194
|
+
/**
|
|
195
|
+
* Capture the child's stdout WITHOUT teeing it to the parent's stdout —
|
|
196
|
+
* for output that is parsed, never displayed (e.g. `wrangler secret list
|
|
197
|
+
* --format json`). Unlike `captureStdout`, nothing is written to
|
|
198
|
+
* `process.stdout`, so it can't interleave with — and corrupt — a
|
|
199
|
+
* caller's own stdout (notably `lunora deploy --format json`, which must
|
|
200
|
+
* emit exactly one JSON document). Mutually exclusive with `captureStdout`
|
|
201
|
+
* and `stdoutToStderr`.
|
|
202
|
+
*/
|
|
203
|
+
captureStdoutSilently?: boolean;
|
|
190
204
|
command: string;
|
|
191
205
|
cwd?: string;
|
|
192
206
|
env?: Readonly<Record<string, string>>;
|
|
193
207
|
/**
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
208
|
+
* Pipe this string into the child's stdin and close it. Used to feed
|
|
209
|
+
* `wrangler secret put` its value without exposing it on the command
|
|
210
|
+
* line or in env. When absent, stdin is inherited from the parent.
|
|
211
|
+
*/
|
|
198
212
|
input?: string;
|
|
199
213
|
/**
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
214
|
+
* Route the child's stdout to the parent's STDERR instead of stdout. Set in
|
|
215
|
+
* `--format json` mode so a spawned tool's human output (e.g. `wrangler
|
|
216
|
+
* deploy`'s progress + the deployed URL) can't interleave with — and corrupt
|
|
217
|
+
* — the single JSON document the command prints to stdout.
|
|
218
|
+
*/
|
|
205
219
|
stdoutToStderr?: boolean;
|
|
206
220
|
}
|
|
207
221
|
interface SpawnResult {
|
|
208
222
|
code: number;
|
|
209
|
-
/** The captured
|
|
223
|
+
/** The captured stderr, present only when the descriptor set `captureStderr`. */
|
|
224
|
+
stderr?: string;
|
|
225
|
+
/** The captured stdout, present only when the descriptor set `captureStdout` or `captureStdoutSilently`. */
|
|
210
226
|
stdout?: string;
|
|
211
227
|
}
|
|
212
228
|
/**
|
|
213
|
-
* Injectable spawner. Tests pass a stub that just records the descriptor
|
|
214
|
-
* instead of executing a real subprocess.
|
|
215
|
-
*/
|
|
229
|
+
* Injectable spawner. Tests pass a stub that just records the descriptor
|
|
230
|
+
* instead of executing a real subprocess.
|
|
231
|
+
*/
|
|
216
232
|
type Spawner = (descriptor: SpawnDescriptor) => Promise<SpawnResult>;
|
|
217
233
|
declare const defaultSpawner: Spawner;
|
|
218
234
|
interface RecordedSpawn {
|
|
219
235
|
descriptor: SpawnDescriptor;
|
|
220
236
|
}
|
|
221
237
|
/**
|
|
222
|
-
* Test helper: returns a spawner that records every invocation and resolves
|
|
223
|
-
* with the configured exit code.
|
|
224
|
-
*/
|
|
238
|
+
* Test helper: returns a spawner that records every invocation and resolves
|
|
239
|
+
* with the configured exit code.
|
|
240
|
+
*/
|
|
225
241
|
declare const createRecordingSpawner: (exitCode?: number) => {
|
|
226
242
|
calls: RecordedSpawn[];
|
|
227
243
|
spawner: Spawner;
|
|
228
244
|
};
|
|
245
|
+
interface SecretListRunnerResult {
|
|
246
|
+
code: number;
|
|
247
|
+
stderr: string;
|
|
248
|
+
stdout: string;
|
|
249
|
+
}
|
|
250
|
+
/** Runs an argv and resolves its captured output. Injected in tests. */
|
|
251
|
+
type SecretListRunner = (command: string, args: ReadonlyArray<string>, cwd: string) => Promise<SecretListRunnerResult>;
|
|
252
|
+
interface ListRemoteSecretsInputs {
|
|
253
|
+
cwd: string;
|
|
254
|
+
/** Cloudflare environment name (`--env`). */
|
|
255
|
+
env?: string;
|
|
256
|
+
/** Injected command runner; defaults to a real `wrangler secret list`. */
|
|
257
|
+
runner?: SecretListRunner;
|
|
258
|
+
/** Target a temporary-account deployment (`--temporary`). */
|
|
259
|
+
temporary?: boolean;
|
|
260
|
+
}
|
|
261
|
+
interface ListRemoteSecretsResult {
|
|
262
|
+
/** Diagnostic message when `ok` is false. */
|
|
263
|
+
error?: string;
|
|
264
|
+
/** Remote secret names (sorted), empty when none or on failure. */
|
|
265
|
+
names: ReadonlyArray<string>;
|
|
266
|
+
/** False when wrangler failed or its output could not be parsed. */
|
|
267
|
+
ok: boolean;
|
|
268
|
+
}
|
|
229
269
|
type FetchLike = (input: string, init?: {
|
|
230
270
|
body?: string;
|
|
231
271
|
headers?: Record<string, string>;
|
|
@@ -238,11 +278,17 @@ type FetchLike = (input: string, init?: {
|
|
|
238
278
|
}>;
|
|
239
279
|
interface RunCommandOptions {
|
|
240
280
|
args?: string;
|
|
281
|
+
/** Forge this user id for the call (dispatches through the admin-gated `runAs` op). */
|
|
282
|
+
as?: string;
|
|
283
|
+
/** JSON-encoded extra identity claims to accompany {@link RunCommandOptions.as}. */
|
|
284
|
+
claims?: string;
|
|
241
285
|
cwd?: string;
|
|
242
286
|
fetchImpl?: FetchLike;
|
|
243
287
|
functionPath: string;
|
|
244
288
|
logger: Logger;
|
|
245
289
|
shard?: string;
|
|
290
|
+
/** Admin bearer for the `runAs` dispatch; resolved from the environment / `.dev.vars` when absent. */
|
|
291
|
+
token?: string;
|
|
246
292
|
url?: string;
|
|
247
293
|
}
|
|
248
294
|
interface RunCommandResult {
|
|
@@ -251,7 +297,6 @@ interface RunCommandResult {
|
|
|
251
297
|
requestUrl: string;
|
|
252
298
|
}
|
|
253
299
|
declare const runRpcCommand: (options: RunCommandOptions) => Promise<RunCommandResult>;
|
|
254
|
-
/** `lunora run <functionPath>` handler (lazy-loaded via the command's `loader`). */
|
|
255
300
|
interface DeployCommandOptions {
|
|
256
301
|
/** Override the schema-drift gate — deploy even with breaking drift and no new migration. */
|
|
257
302
|
allowSchemaDrift?: boolean;
|
|
@@ -261,10 +306,10 @@ interface DeployCommandOptions {
|
|
|
261
306
|
/** Docker-availability probe injected in tests. Defaults to a real `docker info` check. */
|
|
262
307
|
dockerAvailable?: DockerProbe;
|
|
263
308
|
/**
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
309
|
+
* Validate, bundle, and run all pre-deploy gates without publishing
|
|
310
|
+
* (`wrangler deploy --dry-run`). Post-deploy steps (data migrations, schema
|
|
311
|
+
* baseline re-bless) are skipped since nothing shipped.
|
|
312
|
+
*/
|
|
268
313
|
dryRun?: boolean;
|
|
269
314
|
env?: string;
|
|
270
315
|
/** Fetch implementation injected in tests for `--migrate` RPC calls. */
|
|
@@ -275,59 +320,81 @@ interface DeployCommandOptions {
|
|
|
275
320
|
interactive?: boolean;
|
|
276
321
|
logger: Logger;
|
|
277
322
|
/**
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
323
|
+
* When true, after a successful `wrangler deploy`, discover and run all
|
|
324
|
+
* pending data migrations via the worker's `/_lunora/migrate` admin RPC.
|
|
325
|
+
* The worker must be live (exit 0) before migrations are attempted.
|
|
326
|
+
*
|
|
327
|
+
* Implementation note: the status RPC returns the full shard-level
|
|
328
|
+
* migration state, but there is no single authoritative "list of pending
|
|
329
|
+
* migration ids" that can be read client-side before running the worker.
|
|
330
|
+
* Instead, `--migrate` runs `migrate status` followed by `migrate up` for
|
|
331
|
+
* each migration id discovered locally via `discoverMigrations`. The
|
|
332
|
+
* worker's `MigrationRunner` is idempotent — running `up` on an already-
|
|
333
|
+
* applied migration is a no-op — so this approach is safe.
|
|
334
|
+
*/
|
|
290
335
|
migrate?: boolean;
|
|
291
336
|
/** Admin bearer token for `--migrate` (falls back to `LUNORA_ADMIN_TOKEN`). */
|
|
292
337
|
migrateToken?: string;
|
|
293
338
|
/**
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
339
|
+
* Worker URL for `--migrate`. REQUIRED when `--migrate` is set — the deploy
|
|
340
|
+
* handler never captures the URL `wrangler deploy` published to, so there is
|
|
341
|
+
* no safe default; omitting it would silently target `http://localhost:8787`
|
|
342
|
+
* (the dev worker), applying the migration to local state instead of prod.
|
|
343
|
+
*/
|
|
299
344
|
migrateUrl?: string;
|
|
300
345
|
/**
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
346
|
+
* Confirm a production data migration triggered via `--migrate` (the
|
|
347
|
+
* `migrate up --prod` confirmation the standalone command requires). Without
|
|
348
|
+
* it a `--migrate --migrate-url <prod>` deploy refuses to run the migration.
|
|
349
|
+
*/
|
|
305
350
|
migrateYes?: boolean;
|
|
306
351
|
/**
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
352
|
+
* Emit the bundled worker to this directory via `wrangler deploy --outdir`
|
|
353
|
+
* (paired with `dryRun` by `lunora build`). Also writes esbuild metadata to
|
|
354
|
+
* `<outDir>/bundle-meta.json`. When unset, no artifact is written.
|
|
355
|
+
*/
|
|
311
356
|
outDir?: string;
|
|
312
357
|
/**
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
358
|
+
* Upload a preview version (`wrangler versions upload`) instead of a live
|
|
359
|
+
* `wrangler deploy`. Codegen + the drift gate + validation still run, but
|
|
360
|
+
* the post-deploy finalize (migrations, baseline re-bless, auto-link, the
|
|
361
|
+
* production summary) is skipped — a preview never shifts live traffic.
|
|
362
|
+
*/
|
|
318
363
|
preview?: boolean;
|
|
319
364
|
/** Railpack-availability probe injected in tests. Defaults to a real `railpack --version` + `BUILDKIT_HOST` check. */
|
|
320
365
|
railpackAvailable?: DockerProbe;
|
|
366
|
+
/** Confirm prompt for the missing-secret offer; injected in tests. Defaults to the TTY prompt. */
|
|
367
|
+
secretConfirm?: (message: string) => Promise<boolean>;
|
|
368
|
+
/** Remote-secret lister for the missing-secret offer; injected in tests. Defaults to `wrangler secret list`. */
|
|
369
|
+
secretLister?: (inputs: ListRemoteSecretsInputs) => Promise<ListRemoteSecretsResult>;
|
|
321
370
|
skipCodegen?: boolean;
|
|
322
371
|
spawner?: Spawner;
|
|
323
372
|
/**
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
373
|
+
* Fail the deploy when codegen reports an ERROR-level advisory. Same
|
|
374
|
+
* option `lunora codegen` exposes as `--no-strict-advisories`; defaults to
|
|
375
|
+
* CI detection (on in CI, off locally) so a legitimately-partial target
|
|
376
|
+
* can still be shipped interactively. Does NOT gate platform diagnostics
|
|
377
|
+
* (`platform_unsupported_feature` / `platform_unknown_target`), which
|
|
378
|
+
* always block — those mean the emitted `ctx.*` surface does not match
|
|
379
|
+
* what the target can serve, not merely a style nit.
|
|
380
|
+
*/
|
|
381
|
+
strictAdvisories?: boolean;
|
|
382
|
+
/**
|
|
383
|
+
* Deploy target. Falls back to `"target"` in `lunora.json`, then
|
|
384
|
+
* `"cloudflare"`, which selects the wrangler
|
|
385
|
+
* toolchain — i.e. today's behavior for every project. An unregistered name
|
|
386
|
+
* throws rather than falling back, so a typo can never ship the app to the
|
|
387
|
+
* wrong provider.
|
|
388
|
+
*/
|
|
389
|
+
target?: string;
|
|
390
|
+
/**
|
|
391
|
+
* Deploy to a temporary Cloudflare account (`wrangler deploy --temporary`).
|
|
392
|
+
* For unauthenticated use only: wrangler provisions a short-lived account +
|
|
393
|
+
* token, deploys, and prints a claim URL; the deployment stays live ~60
|
|
394
|
+
* minutes before the unclaimed account is deleted. Wrangler itself errors
|
|
395
|
+
* if credentials are already present (OAuth / `CLOUDFLARE_API_TOKEN` /
|
|
396
|
+
* global API key), so we pass the flag straight through without guarding.
|
|
397
|
+
*/
|
|
331
398
|
temporary?: boolean;
|
|
332
399
|
/** Re-bless the committed schema baseline with the current shape (accepts breaking drift). */
|
|
333
400
|
updateSchemaBaseline?: boolean;
|
|
@@ -337,6 +404,14 @@ interface DeployCommandResult {
|
|
|
337
404
|
descriptor: SpawnDescriptor | undefined;
|
|
338
405
|
/** Set when the run aborted before reaching the wrangler invocation. */
|
|
339
406
|
error?: string;
|
|
407
|
+
/**
|
|
408
|
+
* The `.dev.vars`-shaped filename (never a full path, never a value) a
|
|
409
|
+
* secret minted during this run was recorded into, when the missing-
|
|
410
|
+
* secret gate minted one — `.dev.vars` for the default environment, or a
|
|
411
|
+
* `.dev.vars.<env>` sibling for an explicit `--env`. `undefined` when
|
|
412
|
+
* nothing was minted this run.
|
|
413
|
+
*/
|
|
414
|
+
mintedSecretsFile?: string;
|
|
340
415
|
/** The schema-drift gate verdict, when it ran (skipped on `--skip-codegen`). */
|
|
341
416
|
schemaDrift?: {
|
|
342
417
|
blocked: boolean;
|
|
@@ -348,18 +423,17 @@ interface DeployCommandResult {
|
|
|
348
423
|
};
|
|
349
424
|
}
|
|
350
425
|
/**
|
|
351
|
-
* Run a deploy, then (in `--format json` mode) serialize the structured
|
|
352
|
-
* {@link DeployCommandResult} to stdout. Human/progress logging is routed to
|
|
353
|
-
* stderr for json output so stdout carries only the single JSON document.
|
|
354
|
-
*/
|
|
426
|
+
* Run a deploy, then (in `--format json` mode) serialize the structured
|
|
427
|
+
* {@link DeployCommandResult} to stdout. Human/progress logging is routed to
|
|
428
|
+
* stderr for json output so stdout carries only the single JSON document.
|
|
429
|
+
*/
|
|
355
430
|
declare const runDeployCommand: (options: DeployCommandOptions) => Promise<DeployCommandResult>;
|
|
356
|
-
/** `lunora deploy` handler (lazy-loaded via the command's `loader`). */
|
|
357
431
|
/**
|
|
358
|
-
* Start the codegen watch loop and return a handle to stop it. Regenerates on
|
|
359
|
-
* startup, then on debounced changes under `lunora/` (ignoring writes to the
|
|
360
|
-
* `_generated/` output to avoid a feedback loop). If the platform can't do a
|
|
361
|
-
* recursive watch, it logs once and falls back to startup-only codegen.
|
|
362
|
-
*/
|
|
432
|
+
* Start the codegen watch loop and return a handle to stop it. Regenerates on
|
|
433
|
+
* startup, then on debounced changes under `lunora/` (ignoring writes to the
|
|
434
|
+
* `_generated/` output to avoid a feedback loop). If the platform can't do a
|
|
435
|
+
* recursive watch, it logs once and falls back to startup-only codegen.
|
|
436
|
+
*/
|
|
363
437
|
declare const startCodegenWatch: (options: CodegenWatcherOptions) => CodegenWatcherHandle;
|
|
364
438
|
interface CodegenWatcherOptions {
|
|
365
439
|
/** Which API spec(s) to emit. Defaults to codegen's `"openapi"` when omitted. */
|
|
@@ -371,23 +445,25 @@ interface CodegenWatcherOptions {
|
|
|
371
445
|
lunoraDirectory?: string;
|
|
372
446
|
/** Project root containing the `lunora/` directory. */
|
|
373
447
|
projectRoot: string;
|
|
448
|
+
/** Deploy target the emitted `ctx.*` surface is tailored to. Resolved by the caller; falls back to `"target"` in `lunora.json`, then `"cloudflare"`. */
|
|
449
|
+
target?: string;
|
|
374
450
|
}
|
|
375
451
|
interface CodegenWatcherHandle {
|
|
376
452
|
/** Stop watching and cancel any pending regeneration. */
|
|
377
453
|
close: () => void;
|
|
378
454
|
/**
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
455
|
+
* `true` when the platform supports recursive watch and the loop is active.
|
|
456
|
+
* `false` when `fs.watch({ recursive })` threw — startup-only codegen was run
|
|
457
|
+
* but schema edits will NOT auto-regenerate. Callers can surface this in the
|
|
458
|
+
* dev banner so the degraded state is visible beyond the single startup warning.
|
|
459
|
+
*/
|
|
384
460
|
watchAvailable: boolean;
|
|
385
461
|
}
|
|
386
462
|
/**
|
|
387
|
-
* Start the studio server and resolve once it is listening. Loads the static
|
|
388
|
-
* bundle + renders the host HTML once up front; serves them and proxies
|
|
389
|
-
* `/_lunora/*` (HTTP + WS) to the worker.
|
|
390
|
-
*/
|
|
463
|
+
* Start the studio server and resolve once it is listening. Loads the static
|
|
464
|
+
* bundle + renders the host HTML once up front; serves them and proxies
|
|
465
|
+
* `/_lunora/*` (HTTP + WS) to the worker.
|
|
466
|
+
*/
|
|
391
467
|
declare const startStudioServer: (options: StudioServerOptions) => Promise<StudioServerHandle>;
|
|
392
468
|
interface StudioServerOptions {
|
|
393
469
|
/** Project root — `.dev.vars` is read from here for the admin token. */
|
|
@@ -409,6 +485,24 @@ interface StudioServerHandle {
|
|
|
409
485
|
/** The URL to open in a browser. */
|
|
410
486
|
url: string;
|
|
411
487
|
}
|
|
488
|
+
/**
|
|
489
|
+
* How the dev child runs. `wrangler` is the classic `lunora dev` stack (wrangler
|
|
490
|
+
* worker + embedded studio + codegen watch) for a standalone class-C project.
|
|
491
|
+
* `vite` is a project on `@lunora/vite`: the plugin already runs the worker,
|
|
492
|
+
* studio, and codegen inside the Vite dev server, so `lunora dev` runs the
|
|
493
|
+
* project's own dev script and gets out of the way — this also covers class-B
|
|
494
|
+
* frameworks whose own dev server runs the worker in `workerd` (Astro 6 +
|
|
495
|
+
* `@astrojs/cloudflare`, which embeds `@cloudflare/vite-plugin` in `astro dev`:
|
|
496
|
+
* SSR + `/_lunora/*` + `ShardDO` in one process, HMR intact). `framework-worker`
|
|
497
|
+
* is a class-B framework whose dev server CANNOT host the `ShardDO` Durable
|
|
498
|
+
* Object (SvelteKit / Nuxt: their adapters use wrangler's `getPlatformProxy()`,
|
|
499
|
+
* which runs an empty-script Miniflare and does not emulate internal DOs); there
|
|
500
|
+
* `lunora dev` runs the framework's own dev server (front door, HMR, and — via
|
|
501
|
+
* its `@lunora/vite` plugin — studio + codegen) AND a second `wrangler dev`
|
|
502
|
+
* sidecar that owns the real `ShardDO` in `workerd`, wired via the committed
|
|
503
|
+
* `wrangler.dev.jsonc`.
|
|
504
|
+
*/
|
|
505
|
+
type DevFlavor = "framework-worker" | "vite" | "wrangler";
|
|
412
506
|
/** A running worker child the orchestrator controls: send signals, await its exit. */
|
|
413
507
|
interface WorkerProcess {
|
|
414
508
|
/** Resolves with the worker's exit code (1 if it failed to start). */
|
|
@@ -429,6 +523,14 @@ interface DevCommandOptions {
|
|
|
429
523
|
ensureEnv?: typeof ensureDevVariables;
|
|
430
524
|
/** Injection seam for tests — defaults to the real `.dev.vars.example` package-aware scaffolder. */
|
|
431
525
|
ensureExample?: typeof ensureDevVarsExample;
|
|
526
|
+
/** Injection seam for tests — defaults to the real empty-secret/admin-token filler. */
|
|
527
|
+
fillSecrets?: typeof fillDevSecrets;
|
|
528
|
+
/** Injection seam for tests — defaults to the real free-port probe ({@link findAvailablePort}). */
|
|
529
|
+
findFreePort?: (preferred: number) => Promise<number>;
|
|
530
|
+
/** Dev flavor override (tests / callers that already detected it) — defaults to {@link detectDevFlavor}. */
|
|
531
|
+
flavor?: DevFlavor;
|
|
532
|
+
/** Injection seam for tests — defaults to the real IPv6-loopback probe ({@link hasIpv6Loopback}). */
|
|
533
|
+
hasIpv6Loopback?: () => boolean;
|
|
432
534
|
logger: Logger;
|
|
433
535
|
/** Injection seam for tests — defaults to the real remote-config materializer. */
|
|
434
536
|
materializeRemote?: typeof materializeRemoteWranglerConfig;
|
|
@@ -444,6 +546,10 @@ interface DevCommandOptions {
|
|
|
444
546
|
startWorker?: WorkerSpawner;
|
|
445
547
|
/** Disable the embedded studio server. */
|
|
446
548
|
studio?: boolean;
|
|
549
|
+
/** Deploy target the emitted `ctx.*` surface is tailored to. Resolved by the caller; falls back to `"target"` in `lunora.json`, then `"cloudflare"`. */
|
|
550
|
+
target?: string;
|
|
551
|
+
/** Disable the `wrangler dev` spawn — an external task runner owns the worker. */
|
|
552
|
+
worker?: boolean;
|
|
447
553
|
/** `wrangler dev` port. */
|
|
448
554
|
workerPort?: number;
|
|
449
555
|
}
|
|
@@ -451,10 +557,10 @@ interface DevRemotePlan {
|
|
|
451
557
|
/** Short binding labels remoted (e.g. `"DB (D1)"`), for the banner. */
|
|
452
558
|
bindings: string[];
|
|
453
559
|
/**
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
560
|
+
* Removes the generated temp wrangler config when dev exits. Always present
|
|
561
|
+
* and idempotent — a no-op when remote mode is off or nothing was
|
|
562
|
+
* materialized. The dev loop calls it on every shutdown path.
|
|
563
|
+
*/
|
|
458
564
|
cleanup: () => void;
|
|
459
565
|
/** Whether remote mode was requested. */
|
|
460
566
|
enabled: boolean;
|
|
@@ -463,57 +569,83 @@ interface DevRemotePlan {
|
|
|
463
569
|
}
|
|
464
570
|
interface DevCommandPlan {
|
|
465
571
|
codegenEnabled: boolean;
|
|
572
|
+
/** Which stack the child runs — see {@link DevFlavor}. */
|
|
573
|
+
flavor: DevFlavor;
|
|
574
|
+
/**
|
|
575
|
+
* One-line redirect hint printed when a meta-framework is detected on the
|
|
576
|
+
* wrangler flavor: without `@lunora/vite` in the dependencies the worker
|
|
577
|
+
* still runs *inside* the framework's dev server, so the user should run
|
|
578
|
+
* their framework dev script for the full app. `undefined` for the vite
|
|
579
|
+
* flavor (`lunora dev` already runs the project's dev script there) and
|
|
580
|
+
* for a standalone project. Purely informational: the wrangler spawn runs
|
|
581
|
+
* regardless.
|
|
582
|
+
*/
|
|
583
|
+
frameworkHint?: string;
|
|
584
|
+
/**
|
|
585
|
+
* True when `wrangler dev` was given `--ip 127.0.0.1` because the host has no
|
|
586
|
+
* IPv6 loopback (`::1`) — surfaced so the dev loop can note the rebind.
|
|
587
|
+
* Always `false` for the vite flavor (the plugin owns its own bind).
|
|
588
|
+
*/
|
|
589
|
+
ipv4LoopbackForced: boolean;
|
|
466
590
|
/** The remote-binding decision: which D1/KV/R2 bindings hit the deployed worker. */
|
|
467
591
|
remote: DevRemotePlan;
|
|
592
|
+
/**
|
|
593
|
+
* The `wrangler dev` sidecar for the `framework-worker` flavor (SvelteKit /
|
|
594
|
+
* Nuxt): a second child that owns the real `ShardDO` in `workerd`, wired via
|
|
595
|
+
* the committed `wrangler.dev.jsonc`. `undefined` for every other flavor —
|
|
596
|
+
* only the two-process class-B stack has a sidecar. When present, `wrangler`
|
|
597
|
+
* (above) is the framework's own dev server (the front door / HMR) and this
|
|
598
|
+
* is the Lunora realtime plane.
|
|
599
|
+
*/
|
|
600
|
+
sidecar?: SpawnDescriptor & {
|
|
601
|
+
tag: string;
|
|
602
|
+
};
|
|
468
603
|
studioEnabled: boolean;
|
|
469
604
|
studioPort: number;
|
|
605
|
+
/**
|
|
606
|
+
* Whether this process spawns `wrangler dev`.
|
|
607
|
+
*
|
|
608
|
+
* `--no-worker` turns it off so an external task runner (Turbo, Nx, vis, a
|
|
609
|
+
* Procfile) can own worker supervision while `lunora dev` still provides
|
|
610
|
+
* codegen-watch and Studio. Without it, `lunora dev` insisted on being the
|
|
611
|
+
* process root, which is what blocked running the Lunora worker as one node
|
|
612
|
+
* in a larger dev graph.
|
|
613
|
+
*/
|
|
614
|
+
workerEnabled: boolean;
|
|
470
615
|
workerOrigin: string;
|
|
471
616
|
workerPort: number;
|
|
472
|
-
/** The
|
|
617
|
+
/** The primary child `lunora dev` spawns: `wrangler dev` (wrangler flavor) or the framework/`vite dev` server (vite / framework-worker). */
|
|
473
618
|
wrangler: SpawnDescriptor & {
|
|
474
619
|
tag: string;
|
|
475
620
|
};
|
|
476
621
|
}
|
|
477
622
|
/**
|
|
478
|
-
*
|
|
479
|
-
*
|
|
480
|
-
*
|
|
481
|
-
*
|
|
482
|
-
*
|
|
483
|
-
|
|
484
|
-
*/
|
|
485
|
-
/**
|
|
486
|
-
* Plan `lunora dev`: it runs the worker via `wrangler dev` and nothing else as a
|
|
487
|
-
* child process. Vite is intentionally NOT spawned — a project may not use Vite,
|
|
488
|
-
* and when it does, the `@lunora/vite` plugin already runs the worker inside
|
|
489
|
-
* Vite, so the user runs `vite` themselves. Pure + synchronous so it's unit-testable.
|
|
490
|
-
*/
|
|
623
|
+
* Plan `lunora dev`. Wrangler flavor: the worker runs via `wrangler dev` and
|
|
624
|
+
* nothing else as a child process. Vite flavor (`@lunora/vite` declared): the
|
|
625
|
+
* plugin already runs the worker inside the Vite dev server, so the one child
|
|
626
|
+
* is the project's own dev script (`vite dev`, `astro dev`, …) and every CLI
|
|
627
|
+
* sibling is disabled. Pure + synchronous so it's unit-testable.
|
|
628
|
+
*/
|
|
491
629
|
declare const planDevCommand: (options: DevCommandOptions) => DevCommandPlan;
|
|
492
630
|
/**
|
|
493
|
-
* Start codegen watch + the studio server, spawn `wrangler dev`, print the
|
|
494
|
-
* banner, and resolve when the worker exits or the user interrupts — tearing
|
|
495
|
-
* down the sibling servers either way. The three side-effecting pieces (worker,
|
|
496
|
-
* studio, codegen) are injectable so this is testable without real I/O.
|
|
497
|
-
*/
|
|
631
|
+
* Start codegen watch + the studio server, spawn `wrangler dev`, print the
|
|
632
|
+
* banner, and resolve when the worker exits or the user interrupts — tearing
|
|
633
|
+
* down the sibling servers either way. The three side-effecting pieces (worker,
|
|
634
|
+
* studio, codegen) are injectable so this is testable without real I/O.
|
|
635
|
+
*/
|
|
498
636
|
declare const runDevCommand: (options: DevCommandOptions) => Promise<{
|
|
499
637
|
code: number;
|
|
500
638
|
plan: DevCommandPlan;
|
|
501
639
|
}>;
|
|
502
|
-
/** `lunora dev` handler (lazy-loaded via the command's `loader`). */
|
|
503
|
-
/** Supported CI providers. */
|
|
504
|
-
type CiProvider = "github" | "gitlab";
|
|
505
640
|
type PackageManager = "pnpm" | "npm" | "yarn" | "bun";
|
|
506
641
|
/** True when `manager` is on PATH — probed by running `<manager> --version`. Injectable for tests. */
|
|
507
642
|
type PackageManagerProbe = (manager: PackageManager) => boolean;
|
|
508
|
-
/**
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
* picks from. Empty when none are found.
|
|
513
|
-
*/
|
|
643
|
+
/** Supported CI providers. */
|
|
644
|
+
type CiProvider = "github" | "gitlab";
|
|
645
|
+
/** The per-framework auth-UI registry items (`auth-ui` resolves to one of these). */
|
|
646
|
+
type AuthUiItem = "auth-ui-angular" | "auth-ui-react" | "auth-ui-solid" | "auth-ui-svelte" | "auth-ui-vue";
|
|
514
647
|
/** A registry item a feature can install. */
|
|
515
|
-
type FeatureItem = "auth" | "auth-auth0" | "auth-clerk" | "mail";
|
|
516
|
-
/** The auth-provider choices offered for `add auth` / the init auth prompt. Each value is a registry item name. */
|
|
648
|
+
type FeatureItem = "auth" | "auth-auth0" | "auth-clerk" | AuthUiItem | "mail";
|
|
517
649
|
/** A single file the item scaffolds into the project. */
|
|
518
650
|
interface RegistryFile {
|
|
519
651
|
/** Source path inside the item dir (e.g. `schema.ts`). */
|
|
@@ -529,10 +661,10 @@ interface RegistryBinding {
|
|
|
529
661
|
value: unknown;
|
|
530
662
|
}
|
|
531
663
|
/**
|
|
532
|
-
* An environment variable an item needs. Scaffolded into `.dev.vars` (Workers'
|
|
533
|
-
* local-secrets file) on add — non-secrets get their `value`; secrets get an
|
|
534
|
-
* empty placeholder and a reminder to run `wrangler secret put` for production.
|
|
535
|
-
*/
|
|
664
|
+
* An environment variable an item needs. Scaffolded into `.dev.vars` (Workers'
|
|
665
|
+
* local-secrets file) on add — non-secrets get their `value`; secrets get an
|
|
666
|
+
* empty placeholder and a reminder to run `wrangler secret put` for production.
|
|
667
|
+
*/
|
|
536
668
|
interface RegistryEnvVariable {
|
|
537
669
|
/** Human note on what the variable is for. */
|
|
538
670
|
description?: string;
|
|
@@ -543,6 +675,13 @@ interface RegistryEnvVariable {
|
|
|
543
675
|
/** A default/example value for non-secret vars. */
|
|
544
676
|
value?: string;
|
|
545
677
|
}
|
|
678
|
+
/** A re-export the item needs injected into the worker entry point (class-B/C only). */
|
|
679
|
+
interface EntrypointReexport {
|
|
680
|
+
/** Optional JS comment placed above the re-export line. */
|
|
681
|
+
comment?: string;
|
|
682
|
+
/** Module specifier (e.g. `"_generated/workflows"` → `export * from "./lunora/_generated/workflows"`). */
|
|
683
|
+
module: string;
|
|
684
|
+
}
|
|
546
685
|
/** The `registry.json` manifest shape. */
|
|
547
686
|
interface RegistryManifest {
|
|
548
687
|
/** wrangler.jsonc additions (best-effort structural edits). */
|
|
@@ -554,6 +693,8 @@ interface RegistryManifest {
|
|
|
554
693
|
devDependencies?: Readonly<Record<string, string>>;
|
|
555
694
|
/** Post-install guidance printed after the item is added (per-item next steps). */
|
|
556
695
|
docs?: string;
|
|
696
|
+
/** Worker-entry re-exports the item needs (class-B/C only). */
|
|
697
|
+
entrypointReexports?: ReadonlyArray<EntrypointReexport>;
|
|
557
698
|
/** Environment variables the item needs; scaffolded into `.dev.vars`. */
|
|
558
699
|
envVars?: ReadonlyArray<RegistryEnvVariable>;
|
|
559
700
|
files: ReadonlyArray<RegistryFile>;
|
|
@@ -593,11 +734,11 @@ interface AddCommandOptions {
|
|
|
593
734
|
/** Override the remote registry source base (default gh:anolilab/lunora/registry). */
|
|
594
735
|
source?: string;
|
|
595
736
|
/**
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
737
|
+
* Customize each resolved manifest after it is loaded but before the plan is
|
|
738
|
+
* printed / reconciled — used to inject user-chosen values into otherwise
|
|
739
|
+
* static manifests (e.g. the R2 `bucket_name` the init storage prompt asks
|
|
740
|
+
* for). Applied to every item; return the manifest unchanged to leave it as-is.
|
|
741
|
+
*/
|
|
601
742
|
transformManifest?: (manifest: RegistryManifest) => RegistryManifest;
|
|
602
743
|
/** Skip the package.json mutation confirmation prompt. */
|
|
603
744
|
yes?: boolean;
|
|
@@ -613,21 +754,20 @@ interface AddCommandResult {
|
|
|
613
754
|
/** Files written (absolute paths). */
|
|
614
755
|
written: ReadonlyArray<string>;
|
|
615
756
|
}
|
|
616
|
-
/** One resolved item: its parsed manifest plus the (possibly staged) directory it lives in. */
|
|
617
757
|
/**
|
|
618
|
-
* A feature offered in the post-scaffold multi-select. `auth`/`email` carry a
|
|
619
|
-
* sub-prompt or alias; every other value IS the registry item name applied
|
|
620
|
-
* directly (`storage` → the `storage` registry item, etc.).
|
|
621
|
-
*/
|
|
622
|
-
type StackFeature = "auth" | "backup" | "crons" | "email" | "presence" | "
|
|
758
|
+
* A feature offered in the post-scaffold multi-select. `auth`/`email` carry a
|
|
759
|
+
* sub-prompt or alias; every other value IS the registry item name applied
|
|
760
|
+
* directly (`storage` → the `storage` registry item, etc.).
|
|
761
|
+
*/
|
|
762
|
+
type StackFeature = "ai" | "auth" | "auth-ui" | "backup" | "browser" | "cloudflare-access" | "crons" | "email" | "flags" | "hyperdrive" | "payment" | "presence" | "queue" | "storage" | "workflow";
|
|
623
763
|
/** Customize a resolved manifest before it is written (e.g. inject the chosen R2 bucket name). */
|
|
624
764
|
type OfferTransformManifest = (manifest: RegistryManifest) => RegistryManifest;
|
|
625
765
|
/**
|
|
626
|
-
* One feature ready to apply: the registry item name(s), an optional manifest
|
|
627
|
-
* transform, and a short `label` (the feature value) shown on the combined
|
|
628
|
-
* progress line. Built up-front by the collectors so every prompt is answered
|
|
629
|
-
* before any apply runs.
|
|
630
|
-
*/
|
|
766
|
+
* One feature ready to apply: the registry item name(s), an optional manifest
|
|
767
|
+
* transform, and a short `label` (the feature value) shown on the combined
|
|
768
|
+
* progress line. Built up-front by the collectors so every prompt is answered
|
|
769
|
+
* before any apply runs.
|
|
770
|
+
*/
|
|
631
771
|
interface FeatureApply {
|
|
632
772
|
label: string;
|
|
633
773
|
names: ReadonlyArray<string>;
|
|
@@ -635,11 +775,11 @@ interface FeatureApply {
|
|
|
635
775
|
}
|
|
636
776
|
interface OfferDeps {
|
|
637
777
|
/**
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
778
|
+
* Apply the collected features into the new project in one batch — resolves
|
|
779
|
+
* `true` when every item succeeds. The CLI renders this as a single progress
|
|
780
|
+
* line whose label changes per feature; each plan's `transformManifest`
|
|
781
|
+
* customizes that item's manifest before it is written.
|
|
782
|
+
*/
|
|
643
783
|
applyAll: (plans: ReadonlyArray<FeatureApply>) => Promise<boolean>;
|
|
644
784
|
/** When `false`, skip all prompts and print the later-setup hint. */
|
|
645
785
|
interactive: boolean;
|
|
@@ -653,13 +793,19 @@ interface OfferDeps {
|
|
|
653
793
|
defaults?: ReadonlyArray<StackFeature>;
|
|
654
794
|
}) => Promise<StackFeature[]>;
|
|
655
795
|
/**
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
796
|
+
* Features chosen non-interactively (the `--add` flag). When set, the
|
|
797
|
+
* multi-select and every sub-prompt are skipped — each feature is applied with
|
|
798
|
+
* its shipped defaults (base registry item, placeholder bindings).
|
|
799
|
+
*/
|
|
660
800
|
preselected?: ReadonlyArray<StackFeature>;
|
|
661
801
|
/** The new project's name — seeds smart defaults like the `project-uploads` bucket name. */
|
|
662
802
|
projectName: string;
|
|
803
|
+
/**
|
|
804
|
+
* Resolve which per-framework auth-UI item (`auth-ui-react|vue|…`) fits the
|
|
805
|
+
* scaffolded project. Injected by the CLI (detected from the template's deps);
|
|
806
|
+
* defaults to `auth-ui-react` when absent so this module stays pure/testable.
|
|
807
|
+
*/
|
|
808
|
+
resolveAuthUiItem?: () => string;
|
|
663
809
|
/** Single-select among the auth providers (TTY-backed in production). */
|
|
664
810
|
select: (message: string, options: ReadonlyArray<{
|
|
665
811
|
description?: string;
|
|
@@ -674,114 +820,127 @@ interface OfferDeps {
|
|
|
674
820
|
placeholder?: string;
|
|
675
821
|
}) => Promise<string>;
|
|
676
822
|
}
|
|
677
|
-
/**
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
823
|
+
/** One choice in the multi-select. */
|
|
824
|
+
interface LintToolOption {
|
|
825
|
+
description: string;
|
|
826
|
+
label: string;
|
|
827
|
+
value: LintTool;
|
|
828
|
+
}
|
|
829
|
+
interface LintToolOfferDeps {
|
|
830
|
+
/** Write the ignores for the chosen tools — `applyLintIgnores` in production. */
|
|
831
|
+
apply: (tools: ReadonlyArray<LintTool>) => LintIgnoreOutcome[];
|
|
832
|
+
/** Tools already detectable in the scaffolded project — pre-selected in the prompt. */
|
|
833
|
+
detected: ReadonlyArray<LintTool>;
|
|
834
|
+
/** False in CI / `--yes` / off a TTY: skip the prompt and configure whatever was detected. */
|
|
835
|
+
interactive: boolean;
|
|
836
|
+
logger: Logger;
|
|
837
|
+
multiSelect: (message: string, choices: ReadonlyArray<LintToolOption>, settings?: {
|
|
838
|
+
defaults?: ReadonlyArray<LintTool>;
|
|
839
|
+
}) => Promise<LintTool[]>;
|
|
840
|
+
}
|
|
841
|
+
type Template = "analog" | "astro" | "expo" | "next" | "nuxt" | "react-router" | "standalone" | "sveltekit" | "tanstack-start-react" | "tanstack-start-solid";
|
|
689
842
|
interface InitCommandOptions {
|
|
690
843
|
/**
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
844
|
+
* Add features non-interactively after scaffolding (the `--add` flag): a
|
|
845
|
+
* comma-separated list of `ai | auth | backup | browser | cloudflare-access | crons | email | flags | hyperdrive | payment | presence | queue | storage | workflow`.
|
|
846
|
+
* Bypasses the interactive multi-select and sub-prompts —
|
|
847
|
+
* each named feature is applied with its shipped defaults.
|
|
848
|
+
*/
|
|
696
849
|
add?: string;
|
|
697
850
|
/**
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
851
|
+
* When true, accept `--source` values that don't start with `gh:` /
|
|
852
|
+
* `github:` / `https://` or that contain `..`. Defaults to false; the CLI
|
|
853
|
+
* gate exists to stop arbitrary filesystem / scheme sources from being
|
|
854
|
+
* pulled without the caller opting in.
|
|
855
|
+
*/
|
|
703
856
|
allowUnsafeSource?: boolean;
|
|
704
857
|
/** When set, also scaffold a CI deploy pipeline for the given provider. */
|
|
705
858
|
ci?: CiProvider;
|
|
706
859
|
cwd?: string;
|
|
707
860
|
/**
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
861
|
+
* Walk the whole flow — prompts, task list, next-steps, mascot — but make no
|
|
862
|
+
* changes: skip the template fetch/copy, the feature applies, the dependency
|
|
863
|
+
* install, and `git init`. Each skipped action logs a `would …` line instead.
|
|
864
|
+
*/
|
|
712
865
|
dryRun?: boolean;
|
|
713
866
|
/**
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
867
|
+
* Local directory containing the template subdirs (e.g. `vite/`,
|
|
868
|
+
* `standalone/`). When provided, skips the network fetch entirely.
|
|
869
|
+
* Useful for offline runs, the clean-machine smoke test, and unit tests.
|
|
870
|
+
*/
|
|
718
871
|
from?: string;
|
|
719
872
|
/**
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
873
|
+
* When true, configure Lunora into the CURRENT project (`cwd`) instead of
|
|
874
|
+
* scaffolding a new directory. Finds an existing `vite.config.*` and
|
|
875
|
+
* patches it via `patchViteConfig`, or creates a minimal one when absent.
|
|
876
|
+
* All other scaffold options (`name`, `templateType`, `source`, `from`)
|
|
877
|
+
* are ignored in this mode.
|
|
878
|
+
*/
|
|
726
879
|
inPlace?: boolean;
|
|
727
880
|
/**
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
881
|
+
* Inject the post-scaffold install offer's prompts (tests). When set, the
|
|
882
|
+
* offer runs regardless of TTY: `confirmInstall` drives the yes/no, and
|
|
883
|
+
* `selectManager` picks among the detected managers.
|
|
884
|
+
*/
|
|
732
885
|
installPrompt?: {
|
|
733
886
|
confirmInstall: () => Promise<boolean>;
|
|
734
887
|
selectManager: (managers: ReadonlyArray<PackageManager>) => Promise<PackageManager>;
|
|
735
888
|
};
|
|
736
889
|
/**
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
890
|
+
* Force the post-scaffold "add auth / email?" offer on (the `--interactive`
|
|
891
|
+
* flag). When omitted, the offer runs only when stdin is a TTY. `--yes`
|
|
892
|
+
* suppresses it regardless. Has no effect once {@link prompt} is injected.
|
|
893
|
+
*/
|
|
741
894
|
interactive?: boolean;
|
|
895
|
+
/**
|
|
896
|
+
* Test seam for the lint/formatter multi-select. Separate from {@link prompt}
|
|
897
|
+
* because that one is pinned to the feature-offer's value union — reusing it
|
|
898
|
+
* here would only typecheck through a cast.
|
|
899
|
+
*/
|
|
900
|
+
lintPrompt?: LintToolOfferDeps["multiSelect"];
|
|
742
901
|
logger: Logger;
|
|
743
902
|
name?: string;
|
|
744
903
|
/**
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
904
|
+
* Local directory holding create-vite bases (one `template-<id>/` subdir per
|
|
905
|
+
* framework). When set with `vite`, the overlay copies the base from disk
|
|
906
|
+
* instead of fetching `create-vite` over the network — offline mode + tests.
|
|
907
|
+
*/
|
|
749
908
|
overlayBaseFrom?: string;
|
|
750
909
|
/** Probe for which package managers are installed (tests). Defaults to a real `<pm> --version` check. */
|
|
751
910
|
packageManagerProbe?: PackageManagerProbe;
|
|
752
911
|
/**
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
912
|
+
* Inject the offer's prompts (tests). When set, the offer is treated as
|
|
913
|
+
* interactive regardless of TTY, and these drive the feature multi-select,
|
|
914
|
+
* the auth-provider sub-select, and the storage bucket-name text input.
|
|
915
|
+
*/
|
|
757
916
|
prompt?: Pick<OfferDeps, "multiSelect" | "select" | "text">;
|
|
758
917
|
/**
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
918
|
+
* Override the git ref (branch, tag, or commit) the default template source
|
|
919
|
+
* is fetched from. Takes precedence over the version-derived ref. Ignored
|
|
920
|
+
* when `source` or `from` is set.
|
|
921
|
+
*/
|
|
763
922
|
ref?: string;
|
|
764
923
|
/** Local registry root for the offer's `runAddCommand` (offline / tests). Mirrors `from` but for registry items. */
|
|
765
924
|
registryFrom?: string;
|
|
766
925
|
/** Override the remote registry source base for the offer (default `gh:anolilab/lunora/registry`). */
|
|
767
926
|
registrySource?: string;
|
|
768
927
|
/**
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
928
|
+
* Override the remote source giget downloads from. Default:
|
|
929
|
+
* `gh:anolilab/lunora/templates/<templateType>#<ref>`, where `<ref>` is
|
|
930
|
+
* the `ref` option when set, else derived from the CLI version (pre-release
|
|
931
|
+
* channels → their branch, stable → `main`). Tests typically use `from`
|
|
932
|
+
* instead to skip the network.
|
|
933
|
+
*/
|
|
775
934
|
source?: string;
|
|
776
935
|
/** Spawner for the post-scaffold dependency install (tests inject a recording stub). Defaults to a real subprocess. */
|
|
777
936
|
spawner?: Spawner;
|
|
778
937
|
templateType?: Template;
|
|
779
938
|
/**
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
939
|
+
* Scaffold via the **create-vite overlay** for this framework (`react`,
|
|
940
|
+
* `vue`, `solid`, `svelte`, `vanilla`) instead of a bespoke template: fetch
|
|
941
|
+
* the official create-vite base and apply the Lunora layer on top. Takes
|
|
942
|
+
* precedence over `templateType`.
|
|
943
|
+
*/
|
|
785
944
|
vite?: string;
|
|
786
945
|
/** Suppress the offer entirely (the `--yes` flag): scaffold only, print the later-setup hint. */
|
|
787
946
|
yes?: boolean;
|
|
@@ -792,7 +951,6 @@ interface InitCommandResult {
|
|
|
792
951
|
target: string;
|
|
793
952
|
}
|
|
794
953
|
declare const runInitCommand: (options: InitCommandOptions) => Promise<InitCommandResult>;
|
|
795
|
-
/** Narrow a raw `--template` value to a known {@link Template}. */
|
|
796
954
|
interface MigrateGenerateCommandOptions {
|
|
797
955
|
cwd?: string;
|
|
798
956
|
logger: Logger;
|
|
@@ -818,29 +976,27 @@ interface CatalogItem {
|
|
|
818
976
|
interface IndexItem extends CatalogItem {
|
|
819
977
|
title?: string;
|
|
820
978
|
}
|
|
821
|
-
/** Names of the subdirectories under `root` that ship a `registry.json`. */
|
|
822
|
-
|
|
823
979
|
/**
|
|
824
|
-
* Build the catalog (`index.json` contents) from a local registry root by
|
|
825
|
-
* reading every item's `registry.json`. Used by both `lunora registry build`
|
|
826
|
-
* and the registry tests so the committed index can't drift from the item dirs.
|
|
827
|
-
*/
|
|
980
|
+
* Build the catalog (`index.json` contents) from a local registry root by
|
|
981
|
+
* reading every item's `registry.json`. Used by both `lunora registry build`
|
|
982
|
+
* and the registry tests so the committed index can't drift from the item dirs.
|
|
983
|
+
*/
|
|
828
984
|
declare const buildRegistryIndex: (root: string) => {
|
|
829
985
|
items: IndexItem[];
|
|
830
986
|
};
|
|
831
987
|
/** `lunora registry add` (one or more item names): scaffold items into the project. */
|
|
832
988
|
declare const runAddCommand: (options: AddCommandOptions) => Promise<AddCommandResult>;
|
|
833
989
|
/**
|
|
834
|
-
* `lunora registry view` — inspect a registry item without installing it:
|
|
835
|
-
* print its plan (files / deps / env vars) followed by the full contents of each
|
|
836
|
-
* file it would scaffold. Resolves only the named item — no `requires` expansion.
|
|
837
|
-
*/
|
|
990
|
+
* `lunora registry view` — inspect a registry item without installing it:
|
|
991
|
+
* print its plan (files / deps / env vars) followed by the full contents of each
|
|
992
|
+
* file it would scaffold. Resolves only the named item — no `requires` expansion.
|
|
993
|
+
*/
|
|
838
994
|
declare const runRegistryViewCommand: (options: AddCommandOptions) => Promise<AddCommandResult>;
|
|
839
995
|
/**
|
|
840
|
-
* `lunora registry build` — regenerate `index.json` from the item directories
|
|
841
|
-
* (the catalog `list` reads). With `--check`, verify the committed index matches
|
|
842
|
-
* instead of rewriting it (exits non-zero on drift) — a CI guard.
|
|
843
|
-
*/
|
|
996
|
+
* `lunora registry build` — regenerate `index.json` from the item directories
|
|
997
|
+
* (the catalog `list` reads). With `--check`, verify the committed index matches
|
|
998
|
+
* instead of rewriting it (exits non-zero on drift) — a CI guard.
|
|
999
|
+
*/
|
|
844
1000
|
declare const runBuildIndexCommand: (options: AddCommandOptions) => Promise<AddCommandResult>;
|
|
845
1001
|
/** Validate + narrow a parsed JSON value into a {@link RegistryManifest}. */
|
|
846
1002
|
declare const parseManifest: (raw: unknown, itemName: string) => RegistryManifest;
|
|
@@ -858,23 +1014,6 @@ interface ResetCommandResult {
|
|
|
858
1014
|
removed: ReadonlyArray<string>;
|
|
859
1015
|
}
|
|
860
1016
|
declare const runResetCommand: (options: ResetCommandOptions) => Promise<ResetCommandResult>;
|
|
861
|
-
/** `lunora reset` handler (lazy-loaded via the command's `loader`). */
|
|
862
|
-
/**
|
|
863
|
-
* Tiny argv parser.
|
|
864
|
-
*
|
|
865
|
-
* Supports long options (`--name value`, `--name=value`, `--flag`), short
|
|
866
|
-
* options (`-x value`, `-xvalue`), positional arguments (everything else, in
|
|
867
|
-
* order), and a `--` terminator after which everything is positional.
|
|
868
|
-
*
|
|
869
|
-
* Intentionally small — replaces a full CLI library for the handful of
|
|
870
|
-
* subcommands we need.
|
|
871
|
-
*/
|
|
872
|
-
interface ParsedArgs {
|
|
873
|
-
flags: Record<string, boolean>;
|
|
874
|
-
options: Record<string, string>;
|
|
875
|
-
positional: ReadonlyArray<string>;
|
|
876
|
-
}
|
|
877
|
-
declare const parseArgs: (argv: ReadonlyArray<string>, booleanFlags?: ReadonlySet<string>) => ParsedArgs;
|
|
878
1017
|
type InsertSchemaExtensionResult = {
|
|
879
1018
|
ok: true;
|
|
880
1019
|
text: string;
|
|
@@ -883,12 +1022,12 @@ type InsertSchemaExtensionResult = {
|
|
|
883
1022
|
reason: "already-applied" | "invalid-identifier" | "no-define-schema" | "non-object-argument";
|
|
884
1023
|
};
|
|
885
1024
|
/**
|
|
886
|
-
* Append `.extend(<key>.extension)` and a managed import to an existing
|
|
887
|
-
* `lunora/schema.ts`. Idempotent: a second call for the same `key` returns
|
|
888
|
-
* `already-applied` and leaves the text unchanged.
|
|
889
|
-
* @param source the current `lunora/schema.ts` contents
|
|
890
|
-
* @param key the registry item key (e.g. `"ratelimit"`)
|
|
891
|
-
*/
|
|
1025
|
+
* Append `.extend(<key>.extension)` and a managed import to an existing
|
|
1026
|
+
* `lunora/schema.ts`. Idempotent: a second call for the same `key` returns
|
|
1027
|
+
* `already-applied` and leaves the text unchanged.
|
|
1028
|
+
* @param source the current `lunora/schema.ts` contents
|
|
1029
|
+
* @param key the registry item key (e.g. `"ratelimit"`)
|
|
1030
|
+
*/
|
|
892
1031
|
declare const insertSchemaExtension: (source: string, key: string) => InsertSchemaExtensionResult;
|
|
893
1032
|
/** Compact snapshot of a single global table — what we persist + diff. */
|
|
894
1033
|
interface TableSnapshot {
|
|
@@ -931,10 +1070,10 @@ interface SchemaDiff {
|
|
|
931
1070
|
unsupported: ReadonlyArray<UnsupportedEntry>;
|
|
932
1071
|
}
|
|
933
1072
|
/**
|
|
934
|
-
* Map a Lunora validator kind to a SQLite type affinity — the canonical
|
|
935
|
-
* `@lunora/d1/dialect` mapping. Re-exported under this name because
|
|
936
|
-
* `schema-snapshot.ts` builds the persisted snapshot from it.
|
|
937
|
-
*/
|
|
1073
|
+
* Map a Lunora validator kind to a SQLite type affinity — the canonical
|
|
1074
|
+
* `@lunora/d1/dialect` mapping. Re-exported under this name because
|
|
1075
|
+
* `schema-snapshot.ts` builds the persisted snapshot from it.
|
|
1076
|
+
*/
|
|
938
1077
|
declare const validatorKindToSqlType: (kind: string) => ColumnSnapshot["sqlType"];
|
|
939
1078
|
/** Emit `CREATE TABLE` SQL for a new global table. */
|
|
940
1079
|
declare const renderCreateTable: (table: TableSnapshot) => string;
|
|
@@ -943,14 +1082,14 @@ declare const renderAddColumn: (tableName: string, columnName: string, column: C
|
|
|
943
1082
|
declare const renderCreateIndex: (tableName: string, index: IndexSnapshot) => string;
|
|
944
1083
|
declare const renderDropIndex: (tableName: string, indexName: string) => string;
|
|
945
1084
|
/**
|
|
946
|
-
* Compute a {@link SchemaDiff} from two snapshots. Pure function — no I/O.
|
|
947
|
-
*/
|
|
1085
|
+
* Compute a {@link SchemaDiff} from two snapshots. Pure function — no I/O.
|
|
1086
|
+
*/
|
|
948
1087
|
declare const diffSnapshots: (previous: SchemaSnapshot | undefined, next: SchemaSnapshot) => SchemaDiff;
|
|
949
1088
|
/**
|
|
950
|
-
* Render a complete migration file body from a diff. Includes a header,
|
|
951
|
-
* each SQL statement, and (if any) a trailing comment block describing the
|
|
952
|
-
* manual SQL the user needs to fill in for unsupported deltas.
|
|
953
|
-
*/
|
|
1089
|
+
* Render a complete migration file body from a diff. Includes a header,
|
|
1090
|
+
* each SQL statement, and (if any) a trailing comment block describing the
|
|
1091
|
+
* manual SQL the user needs to fill in for unsupported deltas.
|
|
1092
|
+
*/
|
|
954
1093
|
declare const renderMigrationFile: (name: string, diff: SchemaDiff, generatedAt: string) => string;
|
|
955
1094
|
declare const schemaIrToSnapshot: (ir: SchemaIR) => SchemaSnapshot;
|
|
956
|
-
export { type AddCommandOptions, type AddCommandResult, COMMANDS, type ColumnSnapshot, type CommandName, DEFAULT_IMPORT_BATCH_SIZE, type DeployCommandOptions, type DeployCommandResult, type DevCommandOptions, type DevCommandPlan, type DiffEntry, type ExportCommandOptions, type ExportCommandResult, type FetchLike, type ImportCommandOptions, type ImportCommandResult, type IndexSnapshot, type InitCommandOptions, type InitCommandResult, type InsertSchemaExtensionResult, type Logger, type MigrateGenerateCommandOptions, type MigrateGenerateCommandResult, type RecordedSpawn, type RegistryBinding, type RegistryFile, type RegistryManifest, type ResetCommandOptions, type ResetCommandResult, type RunCliOptions, type RunCommandOptions, type RunCommandResult, type SchemaDiff, type SchemaSnapshot, type SpawnDescriptor, type SpawnResult, type Spawner, type StreamingFetchLike, type TableSnapshot, type Template, type UnsupportedEntry, VERSION, buildRegistryIndex, createLogger, createRecordingSpawner, defaultSpawner, diffSnapshots, insertSchemaExtension, pail,
|
|
1095
|
+
export { type AddCommandOptions, type AddCommandResult, COMMANDS, type ColumnSnapshot, type CommandName, DEFAULT_IMPORT_BATCH_SIZE, type DeployCommandOptions, type DeployCommandResult, type DevCommandOptions, type DevCommandPlan, type DiffEntry, type ExportCommandOptions, type ExportCommandResult, type FetchLike, type ImportCommandOptions, type ImportCommandResult, type IndexSnapshot, type InitCommandOptions, type InitCommandResult, type InsertSchemaExtensionResult, type Logger, type MigrateGenerateCommandOptions, type MigrateGenerateCommandResult, type RecordedSpawn, type RegistryBinding, type RegistryFile, type RegistryManifest, type ResetCommandOptions, type ResetCommandResult, type RunCliOptions, type RunCommandOptions, type RunCommandResult, type SchemaDiff, type SchemaSnapshot, type SpawnDescriptor, type SpawnResult, type Spawner, type StreamingFetchLike, type TableSnapshot, type Template, type UnsupportedEntry, VERSION, buildRegistryIndex, createLogger, createRecordingSpawner, defaultSpawner, diffSnapshots, insertSchemaExtension, pail, parseManifest, planDevCommand, renderAddColumn, renderCreateIndex, renderCreateTable, renderDropIndex, renderDropTable, renderMigrationFile, runAddCommand, runBuildIndexCommand, runCli, runCodegenCommand, runDeployCommand, runDevCommand, runExportCommand, runImportCommand, runInitCommand, runMigrateGenerateCommand, runRegistryViewCommand, runResetCommand, runRpcCommand, schemaIrToSnapshot, validatorKindToSqlType };
|