@lunora/cli 1.0.0-alpha.9 → 1.0.0-alpha.91

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