@lunora/cli 1.0.0-alpha.12 → 1.0.0-alpha.121

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/LICENSE.md +6 -0
  2. package/__assets__/package-og.svg +1 -1
  3. package/dist/bin.mjs +2 -10
  4. package/dist/index.d.mts +357 -321
  5. package/dist/index.d.ts +357 -321
  6. package/dist/index.mjs +1 -19
  7. package/dist/packem_chunks/handler.mjs +1 -150
  8. package/dist/packem_chunks/handler10.mjs +1 -22
  9. package/dist/packem_chunks/handler11.mjs +1 -192
  10. package/dist/packem_chunks/handler12.mjs +2 -131
  11. package/dist/packem_chunks/handler13.mjs +2 -65
  12. package/dist/packem_chunks/handler14.mjs +1 -58
  13. package/dist/packem_chunks/handler15.mjs +1 -79
  14. package/dist/packem_chunks/handler16.mjs +1 -43
  15. package/dist/packem_chunks/handler17.mjs +1 -105
  16. package/dist/packem_chunks/handler18.mjs +3 -170
  17. package/dist/packem_chunks/handler19.mjs +1 -89
  18. package/dist/packem_chunks/handler2.mjs +2 -114
  19. package/dist/packem_chunks/handler20.mjs +1 -94
  20. package/dist/packem_chunks/handler21.mjs +2 -311
  21. package/dist/packem_chunks/handler22.mjs +99 -0
  22. package/dist/packem_chunks/handler23.mjs +11 -0
  23. package/dist/packem_chunks/handler3.mjs +2 -204
  24. package/dist/packem_chunks/handler4.mjs +1 -33
  25. package/dist/packem_chunks/handler5.mjs +1 -49
  26. package/dist/packem_chunks/handler6.mjs +1 -91
  27. package/dist/packem_chunks/handler7.mjs +1 -42
  28. package/dist/packem_chunks/handler8.mjs +1 -174
  29. package/dist/packem_chunks/handler9.mjs +8 -16
  30. package/dist/packem_chunks/planDevCommand.mjs +7 -500
  31. package/dist/packem_chunks/runCodegenCommand.mjs +4 -52
  32. package/dist/packem_chunks/runDeployCommand.mjs +1 -504
  33. package/dist/packem_chunks/runInitCommand.mjs +996 -1265
  34. package/dist/packem_chunks/runMigrateGenerateCommand.mjs +9 -395
  35. package/dist/packem_chunks/runResetCommand.mjs +1 -41
  36. package/dist/packem_chunks/runRpcCommand.mjs +1 -68
  37. package/dist/packem_shared/COMMANDS-P8RHe9Zp.mjs +3 -0
  38. package/dist/packem_shared/DEFAULT_IMPORT_BATCH_SIZE-DL87PIEl.mjs +8 -0
  39. package/dist/packem_shared/admin-url-DfVehV3e.mjs +1 -0
  40. package/dist/packem_shared/api-spec-BENwiyUa.mjs +1 -0
  41. package/dist/packem_shared/buildRegistryIndex-DwySASBu.mjs +1 -0
  42. package/dist/packem_shared/codegen-error-DJN6pTH5.mjs +3 -0
  43. package/dist/packem_shared/command-Bjv4VmYA.mjs +1 -0
  44. package/dist/packem_shared/commands-BhX2Bo9B.mjs +19 -0
  45. package/dist/packem_shared/createLogger--C3x1FNE.mjs +2 -0
  46. package/dist/packem_shared/createRecordingSpawner-ByIqBepG.mjs +1 -0
  47. package/dist/packem_shared/detect-package-manager-B2eIuAiP.mjs +1 -0
  48. package/dist/packem_shared/diffSnapshots-9bDd9nOK.mjs +5 -0
  49. package/dist/packem_shared/docker-CKvYE9YF.mjs +1 -0
  50. package/dist/packem_shared/insertSchemaExtension-DZReBZ4_.mjs +8 -0
  51. package/dist/packem_shared/open-url-CTU_g9gr.mjs +1 -0
  52. package/dist/packem_shared/output-format-D7cKB-O5.mjs +2 -0
  53. package/dist/packem_shared/parseManifest-x3WsxKHz.mjs +1 -0
  54. package/dist/packem_shared/prompt-cancelled-C8Sj7OqI.mjs +1 -0
  55. package/dist/packem_shared/resolve-target-vxaXHmvg.mjs +1 -0
  56. package/dist/packem_shared/runAddCommand--TBYJQYi.mjs +1 -0
  57. package/dist/packem_shared/schema-drift-gate-CpqG-xP4.mjs +1 -0
  58. package/dist/packem_shared/schemaIrToSnapshot-Clwd2A8e.mjs +1 -0
  59. package/dist/packem_shared/storage-DOvAKGi4.mjs +1 -0
  60. package/dist/packem_shared/tui-prompts-CCt3jm1k.mjs +4 -0
  61. package/dist/packem_shared/vectorize-metadata-BvZbbqUD.mjs +1 -0
  62. package/dist/packem_shared/wrangler-name-HIl0Z6yx.mjs +1 -0
  63. package/dist/packem_shared/wrangler-secrets-BMRJwKQU.mjs +1 -0
  64. package/package.json +35 -16
  65. package/skills/README.md +28 -14
  66. package/skills/lunora/SKILL.md +48 -9
  67. package/skills/lunora-functions/SKILL.md +38 -3
  68. package/skills/lunora-migration-helper/SKILL.md +36 -17
  69. package/skills/lunora-performance-audit/SKILL.md +36 -6
  70. package/skills/lunora-quickstart/SKILL.md +86 -24
  71. package/skills/lunora-realtime/SKILL.md +43 -30
  72. package/dist/packem_shared/COMMANDS-D3h9Iwvl.mjs +0 -944
  73. package/dist/packem_shared/DEFAULT_IMPORT_BATCH_SIZE-Ck-2bU08.mjs +0 -244
  74. package/dist/packem_shared/admin-url-4UzT-CI4.mjs +0 -19
  75. package/dist/packem_shared/api-spec-CtA6ilu4.mjs +0 -13
  76. package/dist/packem_shared/buildRegistryIndex-BcYe607_.mjs +0 -38
  77. package/dist/packem_shared/command-BC30oSBW.mjs +0 -14
  78. package/dist/packem_shared/commands-DVr4lduS.mjs +0 -812
  79. package/dist/packem_shared/createLogger-B40gPzQo.mjs +0 -78
  80. package/dist/packem_shared/createRecordingSpawner-DxI3mebw.mjs +0 -43
  81. package/dist/packem_shared/detect-package-manager-DYp7n3mJ.mjs +0 -61
  82. package/dist/packem_shared/diffSnapshots-BeDvvNiF.mjs +0 -161
  83. package/dist/packem_shared/docker-hMQ97KSQ.mjs +0 -21
  84. package/dist/packem_shared/insertSchemaExtension-DAqbfr9Z.mjs +0 -64
  85. package/dist/packem_shared/open-url-Dfq6fAyT.mjs +0 -41
  86. package/dist/packem_shared/output-format-wUvAN6AL.mjs +0 -17
  87. package/dist/packem_shared/parseArgs-YXFuKdEk.mjs +0 -56
  88. package/dist/packem_shared/parseManifest--vZf2FY1.mjs +0 -94
  89. package/dist/packem_shared/resolve-target-qbsJ_5sF.mjs +0 -16
  90. package/dist/packem_shared/runAddCommand-C-NOz8NJ.mjs +0 -4
  91. package/dist/packem_shared/schema-drift-gate-BtBt0as0.mjs +0 -79
  92. package/dist/packem_shared/schemaIrToSnapshot-DdsljJT-.mjs +0 -43
  93. package/dist/packem_shared/storage-DL9OE4oE.mjs +0 -84
  94. package/dist/packem_shared/tui-prompts-M6OWsuyw.mjs +0 -663
  95. package/dist/packem_shared/wrangler-name-cy4yhm9j.mjs +0 -12
package/dist/index.d.ts CHANGED
@@ -1,33 +1,33 @@
1
1
  import { CodegenOptions, SchemaIR } from '@lunora/codegen';
2
2
  import '@visulima/cerebro';
3
- import { ensureDevVariables, ensureDevVarsExample, materializeRemoteWranglerConfig } from '@lunora/config';
3
+ import { ensureDevVariables, ensureDevVarsExample, fillDevSecrets, materializeRemoteWranglerConfig } from '@lunora/config';
4
4
  export { REQUIRED_COMPATIBILITY_DATE, REQUIRED_FLAG, type WranglerProjectValidationOptions as WranglerValidationOptions, type WranglerValidationReport, type WranglerProjectValidationResult as WranglerValidationResult, validateWranglerProject as validateWrangler, validateWranglerConfig } from '@lunora/config';
5
5
  /** 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"];
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", "mcp"];
7
7
  type CommandName = (typeof COMMANDS)[number];
8
8
  declare const VERSION: string;
9
9
  interface RunCliOptions {
10
10
  argv?: ReadonlyArray<string>;
11
11
  cwd?: string;
12
12
  /**
13
- * Inject a console-like logger so callers (tests) can capture cerebro's
14
- * help / version / usage rendering. Omitted in production, where cerebro
15
- * uses its default stdout/stderr logger.
16
- */
13
+ * Inject a console-like logger so callers (tests) can capture cerebro's
14
+ * help / version / usage rendering. Omitted in production, where cerebro
15
+ * uses its default stdout/stderr logger.
16
+ */
17
17
  logger?: Console;
18
18
  }
19
19
  /**
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
- */
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
+ */
25
25
  declare const runCli: (options?: RunCliOptions) => Promise<number>;
26
26
  /**
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
- */
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
+ */
31
31
  type ApiSpec = NonNullable<CodegenOptions["apiSpec"]>;
32
32
  interface Logger {
33
33
  debug?: (message: string) => void;
@@ -37,11 +37,11 @@ interface Logger {
37
37
  warn: (message: string) => void;
38
38
  }
39
39
  /**
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
- */
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
+ */
45
45
  interface PailLogger {
46
46
  debug: (message: string) => void;
47
47
  error: (message: string) => void;
@@ -51,25 +51,12 @@ interface PailLogger {
51
51
  }
52
52
  declare const createLogger: () => Logger;
53
53
  /**
54
- * Logger whose every channel writes to `process.stderr`. Used by commands in
55
- * `--format json` mode so all human/progress output stays off stdout leaving
56
- * stdout for the single JSON document the command prints, so `… --format json`
57
- * stays cleanly pipeable (`| jq`). Each line carries a one-character level tag
58
- * so the stream is still readable when a human watches it.
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
- */
54
+ * Direct access to the underlying pail instance for advanced use-cases.
55
+ * A Proxy keeps the public `pail` binding lazy: the real pail is only
56
+ * constructed on first property access, so importing this module (and thus
57
+ * the package barrel) stays side-effect-free.
58
+ */
66
59
  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
60
  interface CodegenCommandOptions {
74
61
  /** Which API spec(s) to emit. Defaults to codegen's `"openapi"` when omitted. */
75
62
  apiSpec?: ApiSpec;
@@ -91,14 +78,13 @@ interface CodegenCommandResult {
91
78
  outputDirectory: string;
92
79
  }
93
80
  declare const runCodegenCommand: (options: CodegenCommandOptions) => CodegenCommandResult;
94
- /** `lunora codegen` handler (lazy-loaded via the command's `loader`). */
95
81
  /** Rows per HTTP request when importing. Convex uses ~500; same here. */
96
82
  declare const DEFAULT_IMPORT_BATCH_SIZE = 500;
97
83
  /**
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
- */
84
+ * Minimal projection of `globalThis.fetch` for the export path — we need
85
+ * `body` as a stream-iterable, which the shared {@link FetchLike} type
86
+ * intentionally hides for the JSON-only commands.
87
+ */
102
88
  type StreamingFetchLike = (input: string, init?: {
103
89
  body?: string;
104
90
  headers?: Record<string, string>;
@@ -132,10 +118,10 @@ interface ExportCommandResult {
132
118
  rows: number;
133
119
  }
134
120
  /**
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
- */
121
+ * Stream an export. The worker emits NDJSON; we count newlines as we go and
122
+ * pipe straight to the output sink, so a 10M-row export doesn't materialise
123
+ * the body in memory.
124
+ */
139
125
  declare const runExportCommand: (options: ExportCommandOptions) => Promise<ExportCommandResult>;
140
126
  interface ImportCommandOptions {
141
127
  /** Rows per HTTP request. Defaults to {@link DEFAULT_IMPORT_BATCH_SIZE}. */
@@ -147,13 +133,15 @@ interface ImportCommandOptions {
147
133
  logger: Logger;
148
134
  prod?: boolean;
149
135
  /**
150
- * Wrap each line as `{table:&lt;name>,doc:&lt;line>}`. Use when the source NDJSON
151
- * is bare docs from a single table — Convex's `convex import --table users`
152
- * shape.
153
- */
136
+ * Wrap each line as `{table:&lt;name>,doc:&lt;line>}`. Use when the source NDJSON
137
+ * is bare docs from a single table — Convex's `convex import --table users`
138
+ * shape.
139
+ */
154
140
  table?: string;
155
141
  token?: string;
156
142
  url?: string;
143
+ /** Confirm bulk-writing production. Required alongside `--prod`. */
144
+ yes?: boolean;
157
145
  }
158
146
  interface ImportCommandResult {
159
147
  body: unknown;
@@ -162,70 +150,99 @@ interface ImportCommandResult {
162
150
  inserted: number;
163
151
  }
164
152
  /**
165
- * Stream an NDJSON file in chunks, POSTing each batch to
166
- * `/_lunora/admin/import`. We keep the line buffer bounded by `batchSize` so a
167
- * multi-GiB file imports without buffering everything in memory.
168
- */
153
+ * Stream an NDJSON file in chunks, POSTing each batch to
154
+ * `/_lunora/admin/import`. We keep the line buffer bounded by `batchSize` so a
155
+ * multi-GiB file imports without buffering everything in memory.
156
+ */
169
157
  declare const runImportCommand: (options: ImportCommandOptions) => Promise<ImportCommandResult>;
170
158
  /**
171
- * Injectable probe for a Docker-compatible container engine. Tests pass a
172
- * stub; production uses {@link isDockerAvailable}.
173
- */
159
+ * Injectable probe for a Docker-compatible container engine. Tests pass a
160
+ * stub; production uses {@link isDockerAvailable}.
161
+ */
174
162
  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
163
  interface SpawnDescriptor {
182
164
  args: ReadonlyArray<string>;
183
165
  /**
184
- * Capture the child's stdout (in addition to streaming it to the parent), so
185
- * the caller can parse it used by `deploy` to read the deployed URL from
186
- * `wrangler deploy` output. Each chunk is still teed to the parent's stdout
187
- * so the user sees live progress. Mutually exclusive with `stdoutToStderr`.
188
- */
166
+ * Capture the child's stderr (in addition to streaming it to the parent).
167
+ * Needed when a tool reports the *expected* outcome as an error there
168
+ * `wrangler vectorize create-metadata-index` writes "already exists" to
169
+ * stderr, and without this the caller can only see a bare exit code and
170
+ * would warn on every re-run. Composes with `stdoutToStderr`, so a caller
171
+ * can keep stdout clean for `--format json` and still read the reason.
172
+ */
173
+ captureStderr?: boolean;
174
+ /**
175
+ * Capture the child's stdout (in addition to streaming it to the parent), so
176
+ * the caller can parse it — used by `deploy` to read the deployed URL from
177
+ * `wrangler deploy` output. Each chunk is still teed to the parent's stdout
178
+ * so the user sees live progress. Mutually exclusive with `stdoutToStderr`.
179
+ */
189
180
  captureStdout?: boolean;
190
181
  command: string;
191
182
  cwd?: string;
192
183
  env?: Readonly<Record<string, string>>;
193
184
  /**
194
- * Pipe this string into the child's stdin and close it. Used to feed
195
- * `wrangler secret put` its value without exposing it on the command
196
- * line or in env. When absent, stdin is inherited from the parent.
197
- */
185
+ * Pipe this string into the child's stdin and close it. Used to feed
186
+ * `wrangler secret put` its value without exposing it on the command
187
+ * line or in env. When absent, stdin is inherited from the parent.
188
+ */
198
189
  input?: string;
199
190
  /**
200
- * Route the child's stdout to the parent's STDERR instead of stdout. Set in
201
- * `--format json` mode so a spawned tool's human output (e.g. `wrangler
202
- * deploy`'s progress + the deployed URL) can't interleave with — and corrupt
203
- * — the single JSON document the command prints to stdout.
204
- */
191
+ * Route the child's stdout to the parent's STDERR instead of stdout. Set in
192
+ * `--format json` mode so a spawned tool's human output (e.g. `wrangler
193
+ * deploy`'s progress + the deployed URL) can't interleave with — and corrupt
194
+ * — the single JSON document the command prints to stdout.
195
+ */
205
196
  stdoutToStderr?: boolean;
206
197
  }
207
198
  interface SpawnResult {
208
199
  code: number;
200
+ /** The captured stderr, present only when the descriptor set `captureStderr`. */
201
+ stderr?: string;
209
202
  /** The captured stdout, present only when the descriptor set `captureStdout`. */
210
203
  stdout?: string;
211
204
  }
212
205
  /**
213
- * Injectable spawner. Tests pass a stub that just records the descriptor
214
- * instead of executing a real subprocess.
215
- */
206
+ * Injectable spawner. Tests pass a stub that just records the descriptor
207
+ * instead of executing a real subprocess.
208
+ */
216
209
  type Spawner = (descriptor: SpawnDescriptor) => Promise<SpawnResult>;
217
210
  declare const defaultSpawner: Spawner;
218
211
  interface RecordedSpawn {
219
212
  descriptor: SpawnDescriptor;
220
213
  }
221
214
  /**
222
- * Test helper: returns a spawner that records every invocation and resolves
223
- * with the configured exit code.
224
- */
215
+ * Test helper: returns a spawner that records every invocation and resolves
216
+ * with the configured exit code.
217
+ */
225
218
  declare const createRecordingSpawner: (exitCode?: number) => {
226
219
  calls: RecordedSpawn[];
227
220
  spawner: Spawner;
228
221
  };
222
+ interface SecretListRunnerResult {
223
+ code: number;
224
+ stderr: string;
225
+ stdout: string;
226
+ }
227
+ /** Runs an argv and resolves its captured output. Injected in tests. */
228
+ type SecretListRunner = (command: string, args: ReadonlyArray<string>, cwd: string) => Promise<SecretListRunnerResult>;
229
+ interface ListRemoteSecretsInputs {
230
+ cwd: string;
231
+ /** Cloudflare environment name (`--env`). */
232
+ env?: string;
233
+ /** Injected command runner; defaults to a real `wrangler secret list`. */
234
+ runner?: SecretListRunner;
235
+ /** Target a temporary-account deployment (`--temporary`). */
236
+ temporary?: boolean;
237
+ }
238
+ interface ListRemoteSecretsResult {
239
+ /** Diagnostic message when `ok` is false. */
240
+ error?: string;
241
+ /** Remote secret names (sorted), empty when none or on failure. */
242
+ names: ReadonlyArray<string>;
243
+ /** False when wrangler failed or its output could not be parsed. */
244
+ ok: boolean;
245
+ }
229
246
  type FetchLike = (input: string, init?: {
230
247
  body?: string;
231
248
  headers?: Record<string, string>;
@@ -251,7 +268,6 @@ interface RunCommandResult {
251
268
  requestUrl: string;
252
269
  }
253
270
  declare const runRpcCommand: (options: RunCommandOptions) => Promise<RunCommandResult>;
254
- /** `lunora run &lt;functionPath>` handler (lazy-loaded via the command's `loader`). */
255
271
  interface DeployCommandOptions {
256
272
  /** Override the schema-drift gate — deploy even with breaking drift and no new migration. */
257
273
  allowSchemaDrift?: boolean;
@@ -261,10 +277,10 @@ interface DeployCommandOptions {
261
277
  /** Docker-availability probe injected in tests. Defaults to a real `docker info` check. */
262
278
  dockerAvailable?: DockerProbe;
263
279
  /**
264
- * Validate, bundle, and run all pre-deploy gates without publishing
265
- * (`wrangler deploy --dry-run`). Post-deploy steps (data migrations, schema
266
- * baseline re-bless) are skipped since nothing shipped.
267
- */
280
+ * Validate, bundle, and run all pre-deploy gates without publishing
281
+ * (`wrangler deploy --dry-run`). Post-deploy steps (data migrations, schema
282
+ * baseline re-bless) are skipped since nothing shipped.
283
+ */
268
284
  dryRun?: boolean;
269
285
  env?: string;
270
286
  /** Fetch implementation injected in tests for `--migrate` RPC calls. */
@@ -275,59 +291,63 @@ interface DeployCommandOptions {
275
291
  interactive?: boolean;
276
292
  logger: Logger;
277
293
  /**
278
- * When true, after a successful `wrangler deploy`, discover and run all
279
- * pending data migrations via the worker's `/_lunora/migrate` admin RPC.
280
- * The worker must be live (exit 0) before migrations are attempted.
281
- *
282
- * Implementation note: the status RPC returns the full shard-level
283
- * migration state, but there is no single authoritative "list of pending
284
- * migration ids" that can be read client-side before running the worker.
285
- * Instead, `--migrate` runs `migrate status` followed by `migrate up` for
286
- * each migration id discovered locally via `discoverMigrations`. The
287
- * worker's `MigrationRunner` is idempotent — running `up` on an already-
288
- * applied migration is a no-op — so this approach is safe.
289
- */
294
+ * When true, after a successful `wrangler deploy`, discover and run all
295
+ * pending data migrations via the worker's `/_lunora/migrate` admin RPC.
296
+ * The worker must be live (exit 0) before migrations are attempted.
297
+ *
298
+ * Implementation note: the status RPC returns the full shard-level
299
+ * migration state, but there is no single authoritative "list of pending
300
+ * migration ids" that can be read client-side before running the worker.
301
+ * Instead, `--migrate` runs `migrate status` followed by `migrate up` for
302
+ * each migration id discovered locally via `discoverMigrations`. The
303
+ * worker's `MigrationRunner` is idempotent — running `up` on an already-
304
+ * applied migration is a no-op — so this approach is safe.
305
+ */
290
306
  migrate?: boolean;
291
307
  /** Admin bearer token for `--migrate` (falls back to `LUNORA_ADMIN_TOKEN`). */
292
308
  migrateToken?: string;
293
309
  /**
294
- * Worker URL for `--migrate`. REQUIRED when `--migrate` is set — the deploy
295
- * handler never captures the URL `wrangler deploy` published to, so there is
296
- * no safe default; omitting it would silently target `http://localhost:8787`
297
- * (the dev worker), applying the migration to local state instead of prod.
298
- */
310
+ * Worker URL for `--migrate`. REQUIRED when `--migrate` is set — the deploy
311
+ * handler never captures the URL `wrangler deploy` published to, so there is
312
+ * no safe default; omitting it would silently target `http://localhost:8787`
313
+ * (the dev worker), applying the migration to local state instead of prod.
314
+ */
299
315
  migrateUrl?: string;
300
316
  /**
301
- * Confirm a production data migration triggered via `--migrate` (the
302
- * `migrate up --prod` confirmation the standalone command requires). Without
303
- * it a `--migrate --migrate-url &lt;prod>` deploy refuses to run the migration.
304
- */
317
+ * Confirm a production data migration triggered via `--migrate` (the
318
+ * `migrate up --prod` confirmation the standalone command requires). Without
319
+ * it a `--migrate --migrate-url &lt;prod>` deploy refuses to run the migration.
320
+ */
305
321
  migrateYes?: boolean;
306
322
  /**
307
- * Emit the bundled worker to this directory via `wrangler deploy --outdir`
308
- * (paired with `dryRun` by `lunora build`). Also writes esbuild metadata to
309
- * `&lt;outDir>/bundle-meta.json`. When unset, no artifact is written.
310
- */
323
+ * Emit the bundled worker to this directory via `wrangler deploy --outdir`
324
+ * (paired with `dryRun` by `lunora build`). Also writes esbuild metadata to
325
+ * `&lt;outDir>/bundle-meta.json`. When unset, no artifact is written.
326
+ */
311
327
  outDir?: string;
312
328
  /**
313
- * Upload a preview version (`wrangler versions upload`) instead of a live
314
- * `wrangler deploy`. Codegen + the drift gate + validation still run, but
315
- * the post-deploy finalize (migrations, baseline re-bless, auto-link, the
316
- * production summary) is skipped — a preview never shifts live traffic.
317
- */
329
+ * Upload a preview version (`wrangler versions upload`) instead of a live
330
+ * `wrangler deploy`. Codegen + the drift gate + validation still run, but
331
+ * the post-deploy finalize (migrations, baseline re-bless, auto-link, the
332
+ * production summary) is skipped — a preview never shifts live traffic.
333
+ */
318
334
  preview?: boolean;
319
335
  /** Railpack-availability probe injected in tests. Defaults to a real `railpack --version` + `BUILDKIT_HOST` check. */
320
336
  railpackAvailable?: DockerProbe;
337
+ /** Confirm prompt for the missing-secret offer; injected in tests. Defaults to the TTY prompt. */
338
+ secretConfirm?: (message: string) => Promise<boolean>;
339
+ /** Remote-secret lister for the missing-secret offer; injected in tests. Defaults to `wrangler secret list`. */
340
+ secretLister?: (inputs: ListRemoteSecretsInputs) => Promise<ListRemoteSecretsResult>;
321
341
  skipCodegen?: boolean;
322
342
  spawner?: Spawner;
323
343
  /**
324
- * Deploy to a temporary Cloudflare account (`wrangler deploy --temporary`).
325
- * For unauthenticated use only: wrangler provisions a short-lived account +
326
- * token, deploys, and prints a claim URL; the deployment stays live ~60
327
- * minutes before the unclaimed account is deleted. Wrangler itself errors
328
- * if credentials are already present (OAuth / `CLOUDFLARE_API_TOKEN` /
329
- * global API key), so we pass the flag straight through without guarding.
330
- */
344
+ * Deploy to a temporary Cloudflare account (`wrangler deploy --temporary`).
345
+ * For unauthenticated use only: wrangler provisions a short-lived account +
346
+ * token, deploys, and prints a claim URL; the deployment stays live ~60
347
+ * minutes before the unclaimed account is deleted. Wrangler itself errors
348
+ * if credentials are already present (OAuth / `CLOUDFLARE_API_TOKEN` /
349
+ * global API key), so we pass the flag straight through without guarding.
350
+ */
331
351
  temporary?: boolean;
332
352
  /** Re-bless the committed schema baseline with the current shape (accepts breaking drift). */
333
353
  updateSchemaBaseline?: boolean;
@@ -348,18 +368,17 @@ interface DeployCommandResult {
348
368
  };
349
369
  }
350
370
  /**
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
- */
371
+ * Run a deploy, then (in `--format json` mode) serialize the structured
372
+ * {@link DeployCommandResult} to stdout. Human/progress logging is routed to
373
+ * stderr for json output so stdout carries only the single JSON document.
374
+ */
355
375
  declare const runDeployCommand: (options: DeployCommandOptions) => Promise<DeployCommandResult>;
356
- /** `lunora deploy` handler (lazy-loaded via the command's `loader`). */
357
376
  /**
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
- */
377
+ * Start the codegen watch loop and return a handle to stop it. Regenerates on
378
+ * startup, then on debounced changes under `lunora/` (ignoring writes to the
379
+ * `_generated/` output to avoid a feedback loop). If the platform can't do a
380
+ * recursive watch, it logs once and falls back to startup-only codegen.
381
+ */
363
382
  declare const startCodegenWatch: (options: CodegenWatcherOptions) => CodegenWatcherHandle;
364
383
  interface CodegenWatcherOptions {
365
384
  /** Which API spec(s) to emit. Defaults to codegen's `"openapi"` when omitted. */
@@ -376,18 +395,18 @@ interface CodegenWatcherHandle {
376
395
  /** Stop watching and cancel any pending regeneration. */
377
396
  close: () => void;
378
397
  /**
379
- * `true` when the platform supports recursive watch and the loop is active.
380
- * `false` when `fs.watch({ recursive })` threw — startup-only codegen was run
381
- * but schema edits will NOT auto-regenerate. Callers can surface this in the
382
- * dev banner so the degraded state is visible beyond the single startup warning.
383
- */
398
+ * `true` when the platform supports recursive watch and the loop is active.
399
+ * `false` when `fs.watch({ recursive })` threw — startup-only codegen was run
400
+ * but schema edits will NOT auto-regenerate. Callers can surface this in the
401
+ * dev banner so the degraded state is visible beyond the single startup warning.
402
+ */
384
403
  watchAvailable: boolean;
385
404
  }
386
405
  /**
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
- */
406
+ * Start the studio server and resolve once it is listening. Loads the static
407
+ * bundle + renders the host HTML once up front; serves them and proxies
408
+ * `/_lunora/*` (HTTP + WS) to the worker.
409
+ */
391
410
  declare const startStudioServer: (options: StudioServerOptions) => Promise<StudioServerHandle>;
392
411
  interface StudioServerOptions {
393
412
  /** Project root — `.dev.vars` is read from here for the admin token. */
@@ -409,6 +428,24 @@ interface StudioServerHandle {
409
428
  /** The URL to open in a browser. */
410
429
  url: string;
411
430
  }
431
+ /**
432
+ * How the dev child runs. `wrangler` is the classic `lunora dev` stack (wrangler
433
+ * worker + embedded studio + codegen watch) for a standalone class-C project.
434
+ * `vite` is a project on `@lunora/vite`: the plugin already runs the worker,
435
+ * studio, and codegen inside the Vite dev server, so `lunora dev` runs the
436
+ * project's own dev script and gets out of the way — this also covers class-B
437
+ * frameworks whose own dev server runs the worker in `workerd` (Astro 6 +
438
+ * `@astrojs/cloudflare`, which embeds `@cloudflare/vite-plugin` in `astro dev`:
439
+ * SSR + `/_lunora/*` + `ShardDO` in one process, HMR intact). `framework-worker`
440
+ * is a class-B framework whose dev server CANNOT host the `ShardDO` Durable
441
+ * Object (SvelteKit / Nuxt: their adapters use wrangler's `getPlatformProxy()`,
442
+ * which runs an empty-script Miniflare and does not emulate internal DOs); there
443
+ * `lunora dev` runs the framework's own dev server (front door, HMR, and — via
444
+ * its `@lunora/vite` plugin — studio + codegen) AND a second `wrangler dev`
445
+ * sidecar that owns the real `ShardDO` in `workerd`, wired via the committed
446
+ * `wrangler.dev.jsonc`.
447
+ */
448
+ type DevFlavor = "framework-worker" | "vite" | "wrangler";
412
449
  /** A running worker child the orchestrator controls: send signals, await its exit. */
413
450
  interface WorkerProcess {
414
451
  /** Resolves with the worker's exit code (1 if it failed to start). */
@@ -429,6 +466,14 @@ interface DevCommandOptions {
429
466
  ensureEnv?: typeof ensureDevVariables;
430
467
  /** Injection seam for tests — defaults to the real `.dev.vars.example` package-aware scaffolder. */
431
468
  ensureExample?: typeof ensureDevVarsExample;
469
+ /** Injection seam for tests — defaults to the real empty-secret/admin-token filler. */
470
+ fillSecrets?: typeof fillDevSecrets;
471
+ /** Injection seam for tests — defaults to the real free-port probe ({@link findAvailablePort}). */
472
+ findFreePort?: (preferred: number) => Promise<number>;
473
+ /** Dev flavor override (tests / callers that already detected it) — defaults to {@link detectDevFlavor}. */
474
+ flavor?: DevFlavor;
475
+ /** Injection seam for tests — defaults to the real IPv6-loopback probe ({@link hasIpv6Loopback}). */
476
+ hasIpv6Loopback?: () => boolean;
432
477
  logger: Logger;
433
478
  /** Injection seam for tests — defaults to the real remote-config materializer. */
434
479
  materializeRemote?: typeof materializeRemoteWranglerConfig;
@@ -451,10 +496,10 @@ interface DevRemotePlan {
451
496
  /** Short binding labels remoted (e.g. `"DB (D1)"`), for the banner. */
452
497
  bindings: string[];
453
498
  /**
454
- * Removes the generated temp wrangler config when dev exits. Always present
455
- * and idempotent — a no-op when remote mode is off or nothing was
456
- * materialized. The dev loop calls it on every shutdown path.
457
- */
499
+ * Removes the generated temp wrangler config when dev exits. Always present
500
+ * and idempotent — a no-op when remote mode is off or nothing was
501
+ * materialized. The dev loop calls it on every shutdown path.
502
+ */
458
503
  cleanup: () => void;
459
504
  /** Whether remote mode was requested. */
460
505
  enabled: boolean;
@@ -463,57 +508,71 @@ interface DevRemotePlan {
463
508
  }
464
509
  interface DevCommandPlan {
465
510
  codegenEnabled: boolean;
511
+ /** Which stack the child runs — see {@link DevFlavor}. */
512
+ flavor: DevFlavor;
513
+ /**
514
+ * One-line redirect hint printed when a meta-framework is detected on the
515
+ * wrangler flavor: without `@lunora/vite` in the dependencies the worker
516
+ * still runs *inside* the framework's dev server, so the user should run
517
+ * their framework dev script for the full app. `undefined` for the vite
518
+ * flavor (`lunora dev` already runs the project's dev script there) and
519
+ * for a standalone project. Purely informational: the wrangler spawn runs
520
+ * regardless.
521
+ */
522
+ frameworkHint?: string;
523
+ /**
524
+ * True when `wrangler dev` was given `--ip 127.0.0.1` because the host has no
525
+ * IPv6 loopback (`::1`) — surfaced so the dev loop can note the rebind.
526
+ * Always `false` for the vite flavor (the plugin owns its own bind).
527
+ */
528
+ ipv4LoopbackForced: boolean;
466
529
  /** The remote-binding decision: which D1/KV/R2 bindings hit the deployed worker. */
467
530
  remote: DevRemotePlan;
531
+ /**
532
+ * The `wrangler dev` sidecar for the `framework-worker` flavor (SvelteKit /
533
+ * Nuxt): a second child that owns the real `ShardDO` in `workerd`, wired via
534
+ * the committed `wrangler.dev.jsonc`. `undefined` for every other flavor —
535
+ * only the two-process class-B stack has a sidecar. When present, `wrangler`
536
+ * (above) is the framework's own dev server (the front door / HMR) and this
537
+ * is the Lunora realtime plane.
538
+ */
539
+ sidecar?: SpawnDescriptor & {
540
+ tag: string;
541
+ };
468
542
  studioEnabled: boolean;
469
543
  studioPort: number;
470
544
  workerOrigin: string;
471
545
  workerPort: number;
472
- /** The single child process `lunora dev` spawns: `wrangler dev`. */
546
+ /** The primary child `lunora dev` spawns: `wrangler dev` (wrangler flavor) or the framework/`vite dev` server (vite / framework-worker). */
473
547
  wrangler: SpawnDescriptor & {
474
548
  tag: string;
475
549
  };
476
550
  }
477
551
  /**
478
- * Resolve remote-binding mode into the extra `wrangler dev` args + a banner
479
- * summary. When `--remote`/`LUNORA_REMOTE` is set we materialize a temp wrangler
480
- * config with `"remote": true` on each D1/KV/R2 binding (Durable Object shards
481
- * stay local) and point `wrangler dev --config` at it, so the local worker reads
482
- * and writes the **deployed** resources. When disabled, or when there's nothing
483
- * to remote, the args stay empty and dev runs fully local.
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
- */
552
+ * Plan `lunora dev`. Wrangler flavor: the worker runs via `wrangler dev` and
553
+ * nothing else as a child process. Vite flavor (`@lunora/vite` declared): the
554
+ * plugin already runs the worker inside the Vite dev server, so the one child
555
+ * is the project's own dev script (`vite dev`, `astro dev`, …) and every CLI
556
+ * sibling is disabled. Pure + synchronous so it's unit-testable.
557
+ */
491
558
  declare const planDevCommand: (options: DevCommandOptions) => DevCommandPlan;
492
559
  /**
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
- */
560
+ * Start codegen watch + the studio server, spawn `wrangler dev`, print the
561
+ * banner, and resolve when the worker exits or the user interrupts — tearing
562
+ * down the sibling servers either way. The three side-effecting pieces (worker,
563
+ * studio, codegen) are injectable so this is testable without real I/O.
564
+ */
498
565
  declare const runDevCommand: (options: DevCommandOptions) => Promise<{
499
566
  code: number;
500
567
  plan: DevCommandPlan;
501
568
  }>;
502
- /** `lunora dev` handler (lazy-loaded via the command's `loader`). */
503
569
  /** Supported CI providers. */
504
570
  type CiProvider = "github" | "gitlab";
505
571
  type PackageManager = "pnpm" | "npm" | "yarn" | "bun";
506
572
  /** True when `manager` is on PATH — probed by running `&lt;manager> --version`. Injectable for tests. */
507
573
  type PackageManagerProbe = (manager: PackageManager) => boolean;
508
- /**
509
- * The package managers actually installed on this machine, in preference order
510
- * ({@link INSTALL_PREFERENCE} — pnpm > bun > yarn > npm). The first entry is the
511
- * recommended default for the install prompt; the whole list is what the user
512
- * picks from. Empty when none are found.
513
- */
514
574
  /** A registry item a feature can install. */
515
575
  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. */
517
576
  /** A single file the item scaffolds into the project. */
518
577
  interface RegistryFile {
519
578
  /** Source path inside the item dir (e.g. `schema.ts`). */
@@ -529,10 +588,10 @@ interface RegistryBinding {
529
588
  value: unknown;
530
589
  }
531
590
  /**
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
- */
591
+ * An environment variable an item needs. Scaffolded into `.dev.vars` (Workers'
592
+ * local-secrets file) on add — non-secrets get their `value`; secrets get an
593
+ * empty placeholder and a reminder to run `wrangler secret put` for production.
594
+ */
536
595
  interface RegistryEnvVariable {
537
596
  /** Human note on what the variable is for. */
538
597
  description?: string;
@@ -543,6 +602,13 @@ interface RegistryEnvVariable {
543
602
  /** A default/example value for non-secret vars. */
544
603
  value?: string;
545
604
  }
605
+ /** A re-export the item needs injected into the worker entry point (class-B/C only). */
606
+ interface EntrypointReexport {
607
+ /** Optional JS comment placed above the re-export line. */
608
+ comment?: string;
609
+ /** Module specifier (e.g. `"_generated/workflows"` → `export * from "./lunora/_generated/workflows"`). */
610
+ module: string;
611
+ }
546
612
  /** The `registry.json` manifest shape. */
547
613
  interface RegistryManifest {
548
614
  /** wrangler.jsonc additions (best-effort structural edits). */
@@ -554,6 +620,8 @@ interface RegistryManifest {
554
620
  devDependencies?: Readonly<Record<string, string>>;
555
621
  /** Post-install guidance printed after the item is added (per-item next steps). */
556
622
  docs?: string;
623
+ /** Worker-entry re-exports the item needs (class-B/C only). */
624
+ entrypointReexports?: ReadonlyArray<EntrypointReexport>;
557
625
  /** Environment variables the item needs; scaffolded into `.dev.vars`. */
558
626
  envVars?: ReadonlyArray<RegistryEnvVariable>;
559
627
  files: ReadonlyArray<RegistryFile>;
@@ -593,11 +661,11 @@ interface AddCommandOptions {
593
661
  /** Override the remote registry source base (default gh:anolilab/lunora/registry). */
594
662
  source?: string;
595
663
  /**
596
- * Customize each resolved manifest after it is loaded but before the plan is
597
- * printed / reconciled — used to inject user-chosen values into otherwise
598
- * static manifests (e.g. the R2 `bucket_name` the init storage prompt asks
599
- * for). Applied to every item; return the manifest unchanged to leave it as-is.
600
- */
664
+ * Customize each resolved manifest after it is loaded but before the plan is
665
+ * printed / reconciled — used to inject user-chosen values into otherwise
666
+ * static manifests (e.g. the R2 `bucket_name` the init storage prompt asks
667
+ * for). Applied to every item; return the manifest unchanged to leave it as-is.
668
+ */
601
669
  transformManifest?: (manifest: RegistryManifest) => RegistryManifest;
602
670
  /** Skip the package.json mutation confirmation prompt. */
603
671
  yes?: boolean;
@@ -613,21 +681,20 @@ interface AddCommandResult {
613
681
  /** Files written (absolute paths). */
614
682
  written: ReadonlyArray<string>;
615
683
  }
616
- /** One resolved item: its parsed manifest plus the (possibly staged) directory it lives in. */
617
684
  /**
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" | "ratelimit" | "storage";
685
+ * A feature offered in the post-scaffold multi-select. `auth`/`email` carry a
686
+ * sub-prompt or alias; every other value IS the registry item name applied
687
+ * directly (`storage` → the `storage` registry item, etc.).
688
+ */
689
+ type StackFeature = "ai" | "auth" | "backup" | "browser" | "cloudflare-access" | "crons" | "email" | "flags" | "hyperdrive" | "payment" | "presence" | "queue" | "storage" | "workflow";
623
690
  /** Customize a resolved manifest before it is written (e.g. inject the chosen R2 bucket name). */
624
691
  type OfferTransformManifest = (manifest: RegistryManifest) => RegistryManifest;
625
692
  /**
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
- */
693
+ * One feature ready to apply: the registry item name(s), an optional manifest
694
+ * transform, and a short `label` (the feature value) shown on the combined
695
+ * progress line. Built up-front by the collectors so every prompt is answered
696
+ * before any apply runs.
697
+ */
631
698
  interface FeatureApply {
632
699
  label: string;
633
700
  names: ReadonlyArray<string>;
@@ -635,11 +702,11 @@ interface FeatureApply {
635
702
  }
636
703
  interface OfferDeps {
637
704
  /**
638
- * Apply the collected features into the new project in one batch — resolves
639
- * `true` when every item succeeds. The CLI renders this as a single progress
640
- * line whose label changes per feature; each plan's `transformManifest`
641
- * customizes that item's manifest before it is written.
642
- */
705
+ * Apply the collected features into the new project in one batch — resolves
706
+ * `true` when every item succeeds. The CLI renders this as a single progress
707
+ * line whose label changes per feature; each plan's `transformManifest`
708
+ * customizes that item's manifest before it is written.
709
+ */
643
710
  applyAll: (plans: ReadonlyArray<FeatureApply>) => Promise<boolean>;
644
711
  /** When `false`, skip all prompts and print the later-setup hint. */
645
712
  interactive: boolean;
@@ -653,10 +720,10 @@ interface OfferDeps {
653
720
  defaults?: ReadonlyArray<StackFeature>;
654
721
  }) => Promise<StackFeature[]>;
655
722
  /**
656
- * Features chosen non-interactively (the `--add` flag). When set, the
657
- * multi-select and every sub-prompt are skipped — each feature is applied with
658
- * its shipped defaults (base registry item, placeholder bindings).
659
- */
723
+ * Features chosen non-interactively (the `--add` flag). When set, the
724
+ * multi-select and every sub-prompt are skipped — each feature is applied with
725
+ * its shipped defaults (base registry item, placeholder bindings).
726
+ */
660
727
  preselected?: ReadonlyArray<StackFeature>;
661
728
  /** The new project's name — seeds smart defaults like the `project-uploads` bucket name. */
662
729
  projectName: string;
@@ -674,114 +741,103 @@ interface OfferDeps {
674
741
  placeholder?: string;
675
742
  }) => Promise<string>;
676
743
  }
677
- /**
678
- * Offer the stack features (auth, email, storage, rate limiting, crons,
679
- * presence, backups) in ONE multi-select after a successful scaffold. Auth,
680
- * email, and storage run a follow-up prompt (provider / destination / bucket
681
- * name); every other feature value is applied as its registry item directly.
682
- *
683
- * Every question is asked FIRST (in selection order), then the picked features
684
- * are applied together via {@link OfferDeps.applyAll} — the CLI renders that as a
685
- * single progress line whose label changes per feature, instead of one spinner
686
- * per item. Non-interactive: prints how to add them later and changes nothing.
687
- */
688
- type Template = "analog" | "astro" | "next" | "nuxt" | "react-router" | "standalone" | "sveltekit" | "tanstack-start-react" | "tanstack-start-solid";
744
+ type Template = "analog" | "astro" | "expo" | "next" | "nuxt" | "react-router" | "standalone" | "sveltekit" | "tanstack-start-react" | "tanstack-start-solid";
689
745
  interface InitCommandOptions {
690
746
  /**
691
- * Add features non-interactively after scaffolding (the `--add` flag): a
692
- * comma-separated list of `auth | email | storage | ratelimit | crons |
693
- * presence | backup`. Bypasses the interactive multi-select and sub-prompts —
694
- * each named feature is applied with its shipped defaults.
695
- */
747
+ * Add features non-interactively after scaffolding (the `--add` flag): a
748
+ * comma-separated list of `ai | auth | backup | browser | cloudflare-access | crons | email | flags | hyperdrive | payment | presence | queue | storage | workflow`.
749
+ * Bypasses the interactive multi-select and sub-prompts —
750
+ * each named feature is applied with its shipped defaults.
751
+ */
696
752
  add?: string;
697
753
  /**
698
- * When true, accept `--source` values that don't start with `gh:` /
699
- * `github:` / `https://` or that contain `..`. Defaults to false; the CLI
700
- * gate exists to stop arbitrary filesystem / scheme sources from being
701
- * pulled without the caller opting in.
702
- */
754
+ * When true, accept `--source` values that don't start with `gh:` /
755
+ * `github:` / `https://` or that contain `..`. Defaults to false; the CLI
756
+ * gate exists to stop arbitrary filesystem / scheme sources from being
757
+ * pulled without the caller opting in.
758
+ */
703
759
  allowUnsafeSource?: boolean;
704
760
  /** When set, also scaffold a CI deploy pipeline for the given provider. */
705
761
  ci?: CiProvider;
706
762
  cwd?: string;
707
763
  /**
708
- * Walk the whole flow — prompts, task list, next-steps, mascot — but make no
709
- * changes: skip the template fetch/copy, the feature applies, the dependency
710
- * install, and `git init`. Each skipped action logs a `would …` line instead.
711
- */
764
+ * Walk the whole flow — prompts, task list, next-steps, mascot — but make no
765
+ * changes: skip the template fetch/copy, the feature applies, the dependency
766
+ * install, and `git init`. Each skipped action logs a `would …` line instead.
767
+ */
712
768
  dryRun?: boolean;
713
769
  /**
714
- * Local directory containing the template subdirs (e.g. `vite/`,
715
- * `standalone/`). When provided, skips the network fetch entirely.
716
- * Useful for offline runs, the clean-machine smoke test, and unit tests.
717
- */
770
+ * Local directory containing the template subdirs (e.g. `vite/`,
771
+ * `standalone/`). When provided, skips the network fetch entirely.
772
+ * Useful for offline runs, the clean-machine smoke test, and unit tests.
773
+ */
718
774
  from?: string;
719
775
  /**
720
- * When true, configure Lunora into the CURRENT project (`cwd`) instead of
721
- * scaffolding a new directory. Finds an existing `vite.config.*` and
722
- * patches it via `patchViteConfig`, or creates a minimal one when absent.
723
- * All other scaffold options (`name`, `templateType`, `source`, `from`)
724
- * are ignored in this mode.
725
- */
776
+ * When true, configure Lunora into the CURRENT project (`cwd`) instead of
777
+ * scaffolding a new directory. Finds an existing `vite.config.*` and
778
+ * patches it via `patchViteConfig`, or creates a minimal one when absent.
779
+ * All other scaffold options (`name`, `templateType`, `source`, `from`)
780
+ * are ignored in this mode.
781
+ */
726
782
  inPlace?: boolean;
727
783
  /**
728
- * Inject the post-scaffold install offer's prompts (tests). When set, the
729
- * offer runs regardless of TTY: `confirmInstall` drives the yes/no, and
730
- * `selectManager` picks among the detected managers.
731
- */
784
+ * Inject the post-scaffold install offer's prompts (tests). When set, the
785
+ * offer runs regardless of TTY: `confirmInstall` drives the yes/no, and
786
+ * `selectManager` picks among the detected managers.
787
+ */
732
788
  installPrompt?: {
733
789
  confirmInstall: () => Promise<boolean>;
734
790
  selectManager: (managers: ReadonlyArray<PackageManager>) => Promise<PackageManager>;
735
791
  };
736
792
  /**
737
- * Force the post-scaffold "add auth / email?" offer on (the `--interactive`
738
- * flag). When omitted, the offer runs only when stdin is a TTY. `--yes`
739
- * suppresses it regardless. Has no effect once {@link prompt} is injected.
740
- */
793
+ * Force the post-scaffold "add auth / email?" offer on (the `--interactive`
794
+ * flag). When omitted, the offer runs only when stdin is a TTY. `--yes`
795
+ * suppresses it regardless. Has no effect once {@link prompt} is injected.
796
+ */
741
797
  interactive?: boolean;
742
798
  logger: Logger;
743
799
  name?: string;
744
800
  /**
745
- * Local directory holding create-vite bases (one `template-&lt;id>/` subdir per
746
- * framework). When set with `vite`, the overlay copies the base from disk
747
- * instead of fetching `create-vite` over the network — offline mode + tests.
748
- */
801
+ * Local directory holding create-vite bases (one `template-&lt;id>/` subdir per
802
+ * framework). When set with `vite`, the overlay copies the base from disk
803
+ * instead of fetching `create-vite` over the network — offline mode + tests.
804
+ */
749
805
  overlayBaseFrom?: string;
750
806
  /** Probe for which package managers are installed (tests). Defaults to a real `&lt;pm> --version` check. */
751
807
  packageManagerProbe?: PackageManagerProbe;
752
808
  /**
753
- * Inject the offer's prompts (tests). When set, the offer is treated as
754
- * interactive regardless of TTY, and these drive the feature multi-select,
755
- * the auth-provider sub-select, and the storage bucket-name text input.
756
- */
809
+ * Inject the offer's prompts (tests). When set, the offer is treated as
810
+ * interactive regardless of TTY, and these drive the feature multi-select,
811
+ * the auth-provider sub-select, and the storage bucket-name text input.
812
+ */
757
813
  prompt?: Pick<OfferDeps, "multiSelect" | "select" | "text">;
758
814
  /**
759
- * Override the git ref (branch, tag, or commit) the default template source
760
- * is fetched from. Takes precedence over the version-derived ref. Ignored
761
- * when `source` or `from` is set.
762
- */
815
+ * Override the git ref (branch, tag, or commit) the default template source
816
+ * is fetched from. Takes precedence over the version-derived ref. Ignored
817
+ * when `source` or `from` is set.
818
+ */
763
819
  ref?: string;
764
820
  /** Local registry root for the offer's `runAddCommand` (offline / tests). Mirrors `from` but for registry items. */
765
821
  registryFrom?: string;
766
822
  /** Override the remote registry source base for the offer (default `gh:anolilab/lunora/registry`). */
767
823
  registrySource?: string;
768
824
  /**
769
- * Override the remote source giget downloads from. Default:
770
- * `gh:anolilab/lunora/templates/&lt;templateType>#&lt;ref>`, where `&lt;ref>` is
771
- * the `ref` option when set, else derived from the CLI version (pre-release
772
- * channels → their branch, stable → `main`). Tests typically use `from`
773
- * instead to skip the network.
774
- */
825
+ * Override the remote source giget downloads from. Default:
826
+ * `gh:anolilab/lunora/templates/&lt;templateType>#&lt;ref>`, where `&lt;ref>` is
827
+ * the `ref` option when set, else derived from the CLI version (pre-release
828
+ * channels → their branch, stable → `main`). Tests typically use `from`
829
+ * instead to skip the network.
830
+ */
775
831
  source?: string;
776
832
  /** Spawner for the post-scaffold dependency install (tests inject a recording stub). Defaults to a real subprocess. */
777
833
  spawner?: Spawner;
778
834
  templateType?: Template;
779
835
  /**
780
- * Scaffold via the **create-vite overlay** for this framework (`react`,
781
- * `vue`, `solid`, `svelte`, `vanilla`) instead of a bespoke template: fetch
782
- * the official create-vite base and apply the Lunora layer on top. Takes
783
- * precedence over `templateType`.
784
- */
836
+ * Scaffold via the **create-vite overlay** for this framework (`react`,
837
+ * `vue`, `solid`, `svelte`, `vanilla`) instead of a bespoke template: fetch
838
+ * the official create-vite base and apply the Lunora layer on top. Takes
839
+ * precedence over `templateType`.
840
+ */
785
841
  vite?: string;
786
842
  /** Suppress the offer entirely (the `--yes` flag): scaffold only, print the later-setup hint. */
787
843
  yes?: boolean;
@@ -792,7 +848,6 @@ interface InitCommandResult {
792
848
  target: string;
793
849
  }
794
850
  declare const runInitCommand: (options: InitCommandOptions) => Promise<InitCommandResult>;
795
- /** Narrow a raw `--template` value to a known {@link Template}. */
796
851
  interface MigrateGenerateCommandOptions {
797
852
  cwd?: string;
798
853
  logger: Logger;
@@ -818,29 +873,27 @@ interface CatalogItem {
818
873
  interface IndexItem extends CatalogItem {
819
874
  title?: string;
820
875
  }
821
- /** Names of the subdirectories under `root` that ship a `registry.json`. */
822
-
823
876
  /**
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
- */
877
+ * Build the catalog (`index.json` contents) from a local registry root by
878
+ * reading every item's `registry.json`. Used by both `lunora registry build`
879
+ * and the registry tests so the committed index can't drift from the item dirs.
880
+ */
828
881
  declare const buildRegistryIndex: (root: string) => {
829
882
  items: IndexItem[];
830
883
  };
831
884
  /** `lunora registry add` (one or more item names): scaffold items into the project. */
832
885
  declare const runAddCommand: (options: AddCommandOptions) => Promise<AddCommandResult>;
833
886
  /**
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
- */
887
+ * `lunora registry view` — inspect a registry item without installing it:
888
+ * print its plan (files / deps / env vars) followed by the full contents of each
889
+ * file it would scaffold. Resolves only the named item — no `requires` expansion.
890
+ */
838
891
  declare const runRegistryViewCommand: (options: AddCommandOptions) => Promise<AddCommandResult>;
839
892
  /**
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
- */
893
+ * `lunora registry build` — regenerate `index.json` from the item directories
894
+ * (the catalog `list` reads). With `--check`, verify the committed index matches
895
+ * instead of rewriting it (exits non-zero on drift) — a CI guard.
896
+ */
844
897
  declare const runBuildIndexCommand: (options: AddCommandOptions) => Promise<AddCommandResult>;
845
898
  /** Validate + narrow a parsed JSON value into a {@link RegistryManifest}. */
846
899
  declare const parseManifest: (raw: unknown, itemName: string) => RegistryManifest;
@@ -858,23 +911,6 @@ interface ResetCommandResult {
858
911
  removed: ReadonlyArray<string>;
859
912
  }
860
913
  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
914
  type InsertSchemaExtensionResult = {
879
915
  ok: true;
880
916
  text: string;
@@ -883,12 +919,12 @@ type InsertSchemaExtensionResult = {
883
919
  reason: "already-applied" | "invalid-identifier" | "no-define-schema" | "non-object-argument";
884
920
  };
885
921
  /**
886
- * Append `.extend(&lt;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
- */
922
+ * Append `.extend(&lt;key>.extension)` and a managed import to an existing
923
+ * `lunora/schema.ts`. Idempotent: a second call for the same `key` returns
924
+ * `already-applied` and leaves the text unchanged.
925
+ * @param source the current `lunora/schema.ts` contents
926
+ * @param key the registry item key (e.g. `"ratelimit"`)
927
+ */
892
928
  declare const insertSchemaExtension: (source: string, key: string) => InsertSchemaExtensionResult;
893
929
  /** Compact snapshot of a single global table — what we persist + diff. */
894
930
  interface TableSnapshot {
@@ -931,10 +967,10 @@ interface SchemaDiff {
931
967
  unsupported: ReadonlyArray<UnsupportedEntry>;
932
968
  }
933
969
  /**
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
- */
970
+ * Map a Lunora validator kind to a SQLite type affinity — the canonical
971
+ * `@lunora/d1/dialect` mapping. Re-exported under this name because
972
+ * `schema-snapshot.ts` builds the persisted snapshot from it.
973
+ */
938
974
  declare const validatorKindToSqlType: (kind: string) => ColumnSnapshot["sqlType"];
939
975
  /** Emit `CREATE TABLE` SQL for a new global table. */
940
976
  declare const renderCreateTable: (table: TableSnapshot) => string;
@@ -943,14 +979,14 @@ declare const renderAddColumn: (tableName: string, columnName: string, column: C
943
979
  declare const renderCreateIndex: (tableName: string, index: IndexSnapshot) => string;
944
980
  declare const renderDropIndex: (tableName: string, indexName: string) => string;
945
981
  /**
946
- * Compute a {@link SchemaDiff} from two snapshots. Pure function — no I/O.
947
- */
982
+ * Compute a {@link SchemaDiff} from two snapshots. Pure function — no I/O.
983
+ */
948
984
  declare const diffSnapshots: (previous: SchemaSnapshot | undefined, next: SchemaSnapshot) => SchemaDiff;
949
985
  /**
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
- */
986
+ * Render a complete migration file body from a diff. Includes a header,
987
+ * each SQL statement, and (if any) a trailing comment block describing the
988
+ * manual SQL the user needs to fill in for unsupported deltas.
989
+ */
954
990
  declare const renderMigrationFile: (name: string, diff: SchemaDiff, generatedAt: string) => string;
955
991
  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, parseArgs, parseManifest, planDevCommand, renderAddColumn, renderCreateIndex, renderCreateTable, renderDropIndex, renderDropTable, renderMigrationFile, runAddCommand, runBuildIndexCommand, runCli, runCodegenCommand, runDeployCommand, runDevCommand, runExportCommand, runImportCommand, runInitCommand, runMigrateGenerateCommand, runRegistryViewCommand, runResetCommand, runRpcCommand, schemaIrToSnapshot, validatorKindToSqlType };
992
+ 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 };