@lunora/cli 1.0.0-alpha.10 → 1.0.0-alpha.100

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 (58) 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 +345 -320
  5. package/dist/index.d.ts +345 -320
  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 +27 -6
  14. package/dist/packem_chunks/handler16.mjs +3 -2
  15. package/dist/packem_chunks/handler17.mjs +1 -1
  16. package/dist/packem_chunks/handler18.mjs +3 -3
  17. package/dist/packem_chunks/handler19.mjs +44 -5
  18. package/dist/packem_chunks/handler2.mjs +6 -4
  19. package/dist/packem_chunks/handler20.mjs +2 -2
  20. package/dist/packem_chunks/handler21.mjs +158 -267
  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 +1193 -98
  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-D3h9Iwvl.mjs → COMMANDS-BOJIDoVY.mjs} +112 -25
  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-BC30oSBW.mjs → command-lYnl4QyF.mjs} +6 -1
  41. package/dist/packem_shared/{commands-DPKWlqqX.mjs → commands-D5Yxt9VY.mjs} +199 -20
  42. package/dist/packem_shared/{createLogger-B40gPzQo.mjs → createLogger-CIWSHrTL.mjs} +33 -6
  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-wUvAN6AL.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-2RJBhUC4.mjs → storage-BXU4ax4O.mjs} +1 -1
  52. package/dist/packem_shared/{tui-prompts-DEiPCKV-.mjs → tui-prompts-BjEN8XgP.mjs} +9 -12
  53. package/dist/packem_shared/wrangler-secrets-Coni-mER.mjs +49 -0
  54. package/package.json +19 -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-CTRA_JlL.mjs +0 -4
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,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,46 +150,40 @@ 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 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
+ */
189
171
  captureStdout?: boolean;
190
172
  command: string;
191
173
  cwd?: string;
192
174
  env?: Readonly<Record<string, string>>;
193
175
  /**
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
- */
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
+ */
198
180
  input?: string;
199
181
  /**
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
- */
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
+ */
205
187
  stdoutToStderr?: boolean;
206
188
  }
207
189
  interface SpawnResult {
@@ -210,22 +192,46 @@ interface SpawnResult {
210
192
  stdout?: string;
211
193
  }
212
194
  /**
213
- * Injectable spawner. Tests pass a stub that just records the descriptor
214
- * instead of executing a real subprocess.
215
- */
195
+ * Injectable spawner. Tests pass a stub that just records the descriptor
196
+ * instead of executing a real subprocess.
197
+ */
216
198
  type Spawner = (descriptor: SpawnDescriptor) => Promise<SpawnResult>;
217
199
  declare const defaultSpawner: Spawner;
218
200
  interface RecordedSpawn {
219
201
  descriptor: SpawnDescriptor;
220
202
  }
221
203
  /**
222
- * Test helper: returns a spawner that records every invocation and resolves
223
- * with the configured exit code.
224
- */
204
+ * Test helper: returns a spawner that records every invocation and resolves
205
+ * with the configured exit code.
206
+ */
225
207
  declare const createRecordingSpawner: (exitCode?: number) => {
226
208
  calls: RecordedSpawn[];
227
209
  spawner: Spawner;
228
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
+ }
229
235
  type FetchLike = (input: string, init?: {
230
236
  body?: string;
231
237
  headers?: Record<string, string>;
@@ -251,7 +257,6 @@ interface RunCommandResult {
251
257
  requestUrl: string;
252
258
  }
253
259
  declare const runRpcCommand: (options: RunCommandOptions) => Promise<RunCommandResult>;
254
- /** `lunora run &lt;functionPath>` handler (lazy-loaded via the command's `loader`). */
255
260
  interface DeployCommandOptions {
256
261
  /** Override the schema-drift gate — deploy even with breaking drift and no new migration. */
257
262
  allowSchemaDrift?: boolean;
@@ -261,10 +266,10 @@ interface DeployCommandOptions {
261
266
  /** Docker-availability probe injected in tests. Defaults to a real `docker info` check. */
262
267
  dockerAvailable?: DockerProbe;
263
268
  /**
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
- */
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
+ */
268
273
  dryRun?: boolean;
269
274
  env?: string;
270
275
  /** Fetch implementation injected in tests for `--migrate` RPC calls. */
@@ -275,59 +280,63 @@ interface DeployCommandOptions {
275
280
  interactive?: boolean;
276
281
  logger: Logger;
277
282
  /**
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
- */
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
+ */
290
295
  migrate?: boolean;
291
296
  /** Admin bearer token for `--migrate` (falls back to `LUNORA_ADMIN_TOKEN`). */
292
297
  migrateToken?: string;
293
298
  /**
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
- */
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
+ */
299
304
  migrateUrl?: string;
300
305
  /**
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
- */
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
+ */
305
310
  migrateYes?: boolean;
306
311
  /**
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
- */
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
+ */
311
316
  outDir?: string;
312
317
  /**
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
- */
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
+ */
318
323
  preview?: boolean;
319
324
  /** Railpack-availability probe injected in tests. Defaults to a real `railpack --version` + `BUILDKIT_HOST` check. */
320
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>;
321
330
  skipCodegen?: boolean;
322
331
  spawner?: Spawner;
323
332
  /**
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
- */
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
+ */
331
340
  temporary?: boolean;
332
341
  /** Re-bless the committed schema baseline with the current shape (accepts breaking drift). */
333
342
  updateSchemaBaseline?: boolean;
@@ -348,18 +357,17 @@ interface DeployCommandResult {
348
357
  };
349
358
  }
350
359
  /**
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
- */
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
+ */
355
364
  declare const runDeployCommand: (options: DeployCommandOptions) => Promise<DeployCommandResult>;
356
- /** `lunora deploy` handler (lazy-loaded via the command's `loader`). */
357
365
  /**
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
- */
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
+ */
363
371
  declare const startCodegenWatch: (options: CodegenWatcherOptions) => CodegenWatcherHandle;
364
372
  interface CodegenWatcherOptions {
365
373
  /** Which API spec(s) to emit. Defaults to codegen's `"openapi"` when omitted. */
@@ -376,18 +384,18 @@ interface CodegenWatcherHandle {
376
384
  /** Stop watching and cancel any pending regeneration. */
377
385
  close: () => void;
378
386
  /**
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
- */
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
+ */
384
392
  watchAvailable: boolean;
385
393
  }
386
394
  /**
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
- */
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
+ */
391
399
  declare const startStudioServer: (options: StudioServerOptions) => Promise<StudioServerHandle>;
392
400
  interface StudioServerOptions {
393
401
  /** Project root — `.dev.vars` is read from here for the admin token. */
@@ -409,6 +417,24 @@ interface StudioServerHandle {
409
417
  /** The URL to open in a browser. */
410
418
  url: string;
411
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";
412
438
  /** A running worker child the orchestrator controls: send signals, await its exit. */
413
439
  interface WorkerProcess {
414
440
  /** Resolves with the worker's exit code (1 if it failed to start). */
@@ -429,6 +455,14 @@ interface DevCommandOptions {
429
455
  ensureEnv?: typeof ensureDevVariables;
430
456
  /** Injection seam for tests — defaults to the real `.dev.vars.example` package-aware scaffolder. */
431
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;
432
466
  logger: Logger;
433
467
  /** Injection seam for tests — defaults to the real remote-config materializer. */
434
468
  materializeRemote?: typeof materializeRemoteWranglerConfig;
@@ -451,10 +485,10 @@ interface DevRemotePlan {
451
485
  /** Short binding labels remoted (e.g. `"DB (D1)"`), for the banner. */
452
486
  bindings: string[];
453
487
  /**
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
- */
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
+ */
458
492
  cleanup: () => void;
459
493
  /** Whether remote mode was requested. */
460
494
  enabled: boolean;
@@ -463,57 +497,71 @@ interface DevRemotePlan {
463
497
  }
464
498
  interface DevCommandPlan {
465
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;
466
518
  /** The remote-binding decision: which D1/KV/R2 bindings hit the deployed worker. */
467
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
+ };
468
531
  studioEnabled: boolean;
469
532
  studioPort: number;
470
533
  workerOrigin: string;
471
534
  workerPort: number;
472
- /** 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). */
473
536
  wrangler: SpawnDescriptor & {
474
537
  tag: string;
475
538
  };
476
539
  }
477
540
  /**
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
- */
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
+ */
491
547
  declare const planDevCommand: (options: DevCommandOptions) => DevCommandPlan;
492
548
  /**
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
- */
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
+ */
498
554
  declare const runDevCommand: (options: DevCommandOptions) => Promise<{
499
555
  code: number;
500
556
  plan: DevCommandPlan;
501
557
  }>;
502
- /** `lunora dev` handler (lazy-loaded via the command's `loader`). */
503
558
  /** Supported CI providers. */
504
559
  type CiProvider = "github" | "gitlab";
505
560
  type PackageManager = "pnpm" | "npm" | "yarn" | "bun";
506
561
  /** True when `manager` is on PATH — probed by running `&lt;manager> --version`. Injectable for tests. */
507
562
  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
563
  /** A registry item a feature can install. */
515
564
  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
565
  /** A single file the item scaffolds into the project. */
518
566
  interface RegistryFile {
519
567
  /** Source path inside the item dir (e.g. `schema.ts`). */
@@ -529,10 +577,10 @@ interface RegistryBinding {
529
577
  value: unknown;
530
578
  }
531
579
  /**
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
- */
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
+ */
536
584
  interface RegistryEnvVariable {
537
585
  /** Human note on what the variable is for. */
538
586
  description?: string;
@@ -543,6 +591,13 @@ interface RegistryEnvVariable {
543
591
  /** A default/example value for non-secret vars. */
544
592
  value?: string;
545
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
+ }
546
601
  /** The `registry.json` manifest shape. */
547
602
  interface RegistryManifest {
548
603
  /** wrangler.jsonc additions (best-effort structural edits). */
@@ -554,6 +609,8 @@ interface RegistryManifest {
554
609
  devDependencies?: Readonly<Record<string, string>>;
555
610
  /** Post-install guidance printed after the item is added (per-item next steps). */
556
611
  docs?: string;
612
+ /** Worker-entry re-exports the item needs (class-B/C only). */
613
+ entrypointReexports?: ReadonlyArray<EntrypointReexport>;
557
614
  /** Environment variables the item needs; scaffolded into `.dev.vars`. */
558
615
  envVars?: ReadonlyArray<RegistryEnvVariable>;
559
616
  files: ReadonlyArray<RegistryFile>;
@@ -593,11 +650,11 @@ interface AddCommandOptions {
593
650
  /** Override the remote registry source base (default gh:anolilab/lunora/registry). */
594
651
  source?: string;
595
652
  /**
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
- */
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
+ */
601
658
  transformManifest?: (manifest: RegistryManifest) => RegistryManifest;
602
659
  /** Skip the package.json mutation confirmation prompt. */
603
660
  yes?: boolean;
@@ -613,21 +670,20 @@ interface AddCommandResult {
613
670
  /** Files written (absolute paths). */
614
671
  written: ReadonlyArray<string>;
615
672
  }
616
- /** One resolved item: its parsed manifest plus the (possibly staged) directory it lives in. */
617
673
  /**
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";
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";
623
679
  /** Customize a resolved manifest before it is written (e.g. inject the chosen R2 bucket name). */
624
680
  type OfferTransformManifest = (manifest: RegistryManifest) => RegistryManifest;
625
681
  /**
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
- */
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
+ */
631
687
  interface FeatureApply {
632
688
  label: string;
633
689
  names: ReadonlyArray<string>;
@@ -635,11 +691,11 @@ interface FeatureApply {
635
691
  }
636
692
  interface OfferDeps {
637
693
  /**
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
- */
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
+ */
643
699
  applyAll: (plans: ReadonlyArray<FeatureApply>) => Promise<boolean>;
644
700
  /** When `false`, skip all prompts and print the later-setup hint. */
645
701
  interactive: boolean;
@@ -653,10 +709,10 @@ interface OfferDeps {
653
709
  defaults?: ReadonlyArray<StackFeature>;
654
710
  }) => Promise<StackFeature[]>;
655
711
  /**
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
- */
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
+ */
660
716
  preselected?: ReadonlyArray<StackFeature>;
661
717
  /** The new project's name — seeds smart defaults like the `project-uploads` bucket name. */
662
718
  projectName: string;
@@ -674,114 +730,103 @@ interface OfferDeps {
674
730
  placeholder?: string;
675
731
  }) => Promise<string>;
676
732
  }
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";
733
+ type Template = "analog" | "astro" | "expo" | "next" | "nuxt" | "react-router" | "standalone" | "sveltekit" | "tanstack-start-react" | "tanstack-start-solid";
689
734
  interface InitCommandOptions {
690
735
  /**
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
- */
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
+ */
696
741
  add?: string;
697
742
  /**
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
- */
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
+ */
703
748
  allowUnsafeSource?: boolean;
704
749
  /** When set, also scaffold a CI deploy pipeline for the given provider. */
705
750
  ci?: CiProvider;
706
751
  cwd?: string;
707
752
  /**
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
- */
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
+ */
712
757
  dryRun?: boolean;
713
758
  /**
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
- */
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
+ */
718
763
  from?: string;
719
764
  /**
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
- */
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
+ */
726
771
  inPlace?: boolean;
727
772
  /**
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
- */
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
+ */
732
777
  installPrompt?: {
733
778
  confirmInstall: () => Promise<boolean>;
734
779
  selectManager: (managers: ReadonlyArray<PackageManager>) => Promise<PackageManager>;
735
780
  };
736
781
  /**
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
- */
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
+ */
741
786
  interactive?: boolean;
742
787
  logger: Logger;
743
788
  name?: string;
744
789
  /**
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
- */
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
+ */
749
794
  overlayBaseFrom?: string;
750
795
  /** Probe for which package managers are installed (tests). Defaults to a real `&lt;pm> --version` check. */
751
796
  packageManagerProbe?: PackageManagerProbe;
752
797
  /**
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
- */
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
+ */
757
802
  prompt?: Pick<OfferDeps, "multiSelect" | "select" | "text">;
758
803
  /**
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
- */
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
+ */
763
808
  ref?: string;
764
809
  /** Local registry root for the offer's `runAddCommand` (offline / tests). Mirrors `from` but for registry items. */
765
810
  registryFrom?: string;
766
811
  /** Override the remote registry source base for the offer (default `gh:anolilab/lunora/registry`). */
767
812
  registrySource?: string;
768
813
  /**
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
- */
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
+ */
775
820
  source?: string;
776
821
  /** Spawner for the post-scaffold dependency install (tests inject a recording stub). Defaults to a real subprocess. */
777
822
  spawner?: Spawner;
778
823
  templateType?: Template;
779
824
  /**
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
- */
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
+ */
785
830
  vite?: string;
786
831
  /** Suppress the offer entirely (the `--yes` flag): scaffold only, print the later-setup hint. */
787
832
  yes?: boolean;
@@ -792,7 +837,6 @@ interface InitCommandResult {
792
837
  target: string;
793
838
  }
794
839
  declare const runInitCommand: (options: InitCommandOptions) => Promise<InitCommandResult>;
795
- /** Narrow a raw `--template` value to a known {@link Template}. */
796
840
  interface MigrateGenerateCommandOptions {
797
841
  cwd?: string;
798
842
  logger: Logger;
@@ -818,29 +862,27 @@ interface CatalogItem {
818
862
  interface IndexItem extends CatalogItem {
819
863
  title?: string;
820
864
  }
821
- /** Names of the subdirectories under `root` that ship a `registry.json`. */
822
-
823
865
  /**
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
- */
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
+ */
828
870
  declare const buildRegistryIndex: (root: string) => {
829
871
  items: IndexItem[];
830
872
  };
831
873
  /** `lunora registry add` (one or more item names): scaffold items into the project. */
832
874
  declare const runAddCommand: (options: AddCommandOptions) => Promise<AddCommandResult>;
833
875
  /**
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
- */
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
+ */
838
880
  declare const runRegistryViewCommand: (options: AddCommandOptions) => Promise<AddCommandResult>;
839
881
  /**
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
- */
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
+ */
844
886
  declare const runBuildIndexCommand: (options: AddCommandOptions) => Promise<AddCommandResult>;
845
887
  /** Validate + narrow a parsed JSON value into a {@link RegistryManifest}. */
846
888
  declare const parseManifest: (raw: unknown, itemName: string) => RegistryManifest;
@@ -858,23 +900,6 @@ interface ResetCommandResult {
858
900
  removed: ReadonlyArray<string>;
859
901
  }
860
902
  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
903
  type InsertSchemaExtensionResult = {
879
904
  ok: true;
880
905
  text: string;
@@ -883,12 +908,12 @@ type InsertSchemaExtensionResult = {
883
908
  reason: "already-applied" | "invalid-identifier" | "no-define-schema" | "non-object-argument";
884
909
  };
885
910
  /**
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
- */
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
+ */
892
917
  declare const insertSchemaExtension: (source: string, key: string) => InsertSchemaExtensionResult;
893
918
  /** Compact snapshot of a single global table — what we persist + diff. */
894
919
  interface TableSnapshot {
@@ -931,10 +956,10 @@ interface SchemaDiff {
931
956
  unsupported: ReadonlyArray<UnsupportedEntry>;
932
957
  }
933
958
  /**
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
- */
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
+ */
938
963
  declare const validatorKindToSqlType: (kind: string) => ColumnSnapshot["sqlType"];
939
964
  /** Emit `CREATE TABLE` SQL for a new global table. */
940
965
  declare const renderCreateTable: (table: TableSnapshot) => string;
@@ -943,14 +968,14 @@ declare const renderAddColumn: (tableName: string, columnName: string, column: C
943
968
  declare const renderCreateIndex: (tableName: string, index: IndexSnapshot) => string;
944
969
  declare const renderDropIndex: (tableName: string, indexName: string) => string;
945
970
  /**
946
- * Compute a {@link SchemaDiff} from two snapshots. Pure function — no I/O.
947
- */
971
+ * Compute a {@link SchemaDiff} from two snapshots. Pure function — no I/O.
972
+ */
948
973
  declare const diffSnapshots: (previous: SchemaSnapshot | undefined, next: SchemaSnapshot) => SchemaDiff;
949
974
  /**
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
- */
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
+ */
954
979
  declare const renderMigrationFile: (name: string, diff: SchemaDiff, generatedAt: string) => string;
955
980
  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 };
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 };