@lunora/cli 1.0.0-alpha.6 → 1.0.0-alpha.60

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/__assets__/package-og.svg +1 -1
  2. package/dist/bin.mjs +1 -1
  3. package/dist/index.d.mts +238 -115
  4. package/dist/index.d.ts +238 -115
  5. package/dist/index.mjs +8 -8
  6. package/dist/packem_chunks/handler.mjs +87 -6
  7. package/dist/packem_chunks/handler10.mjs +8 -14
  8. package/dist/packem_chunks/handler11.mjs +19 -189
  9. package/dist/packem_chunks/handler12.mjs +176 -115
  10. package/dist/packem_chunks/handler13.mjs +118 -52
  11. package/dist/packem_chunks/handler14.mjs +50 -43
  12. package/dist/packem_chunks/handler15.mjs +48 -67
  13. package/dist/packem_chunks/handler16.mjs +74 -37
  14. package/dist/packem_chunks/handler17.mjs +39 -100
  15. package/dist/packem_chunks/handler18.mjs +87 -152
  16. package/dist/packem_chunks/handler19.mjs +148 -67
  17. package/dist/packem_chunks/handler2.mjs +6 -4
  18. package/dist/packem_chunks/handler20.mjs +77 -75
  19. package/dist/packem_chunks/handler21.mjs +71 -288
  20. package/dist/packem_chunks/handler3.mjs +6 -3
  21. package/dist/packem_chunks/handler4.mjs +2 -2
  22. package/dist/packem_chunks/handler5.mjs +7 -4
  23. package/dist/packem_chunks/handler6.mjs +10 -7
  24. package/dist/packem_chunks/handler7.mjs +2 -2
  25. package/dist/packem_chunks/handler8.mjs +1 -1
  26. package/dist/packem_chunks/handler9.mjs +315 -12
  27. package/dist/packem_chunks/planDevCommand.mjs +561 -32
  28. package/dist/packem_chunks/runCodegenCommand.mjs +5 -4
  29. package/dist/packem_chunks/runDeployCommand.mjs +115 -20
  30. package/dist/packem_chunks/runInitCommand.mjs +1601 -172
  31. package/dist/packem_chunks/runMigrateGenerateCommand.mjs +5 -4
  32. package/dist/packem_chunks/runResetCommand.mjs +2 -2
  33. package/dist/packem_chunks/runRpcCommand.mjs +3 -2
  34. package/dist/packem_shared/{COMMANDS-Bn8luojF.mjs → COMMANDS-0BD3K1pb.mjs} +79 -21
  35. package/dist/packem_shared/{DEFAULT_IMPORT_BATCH_SIZE-Ck-2bU08.mjs → DEFAULT_IMPORT_BATCH_SIZE-CRQmmBZM.mjs} +3 -2
  36. package/dist/packem_shared/{api-spec-CtA6ilu4.mjs → api-spec-Bx0iKbxA.mjs} +3 -1
  37. package/dist/packem_shared/{buildRegistryIndex-BcYe607_.mjs → buildRegistryIndex-CqM5FwGI.mjs} +1 -1
  38. package/dist/packem_shared/codegen-error-DJG-ghs_.mjs +31 -0
  39. package/dist/packem_shared/{command-BDXcJCCJ.mjs → command-lYnl4QyF.mjs} +6 -1
  40. package/dist/packem_shared/{commands-DqsEzojt.mjs → commands-vnRRkhNE.mjs} +123 -15
  41. package/dist/packem_shared/{createLogger-CHPNjFw2.mjs → createLogger-CIWSHrTL.mjs} +40 -8
  42. package/dist/packem_shared/{createRecordingSpawner-DxI3mebw.mjs → createRecordingSpawner-Cw5Iu73G.mjs} +12 -2
  43. package/dist/packem_shared/{detect-package-manager-DYp7n3mJ.mjs → detect-package-manager-Cxo6Tpyx.mjs} +10 -1
  44. package/dist/packem_shared/{insertSchemaExtension-BuzF6-t2.mjs → insertSchemaExtension-DAqbfr9Z.mjs} +15 -10
  45. package/dist/packem_shared/{open-url-Dfq6fAyT.mjs → open-url-4PBLY9X0.mjs} +3 -2
  46. package/dist/packem_shared/{output-format-7gyGR3h8.mjs → output-format-B4642rjE.mjs} +1 -1
  47. package/dist/packem_shared/{parseManifest--vZf2FY1.mjs → parseManifest-BBrXCg9V.mjs} +16 -9
  48. package/dist/packem_shared/prompt-cancelled-APzX1Im-.mjs +9 -0
  49. package/dist/packem_shared/runAddCommand-BCcJzs_k.mjs +4 -0
  50. package/dist/packem_shared/storage-bGfgwOgF.mjs +84 -0
  51. package/dist/packem_shared/tui-prompts-BjEN8XgP.mjs +658 -0
  52. package/dist/packem_shared/wrangler-secrets-P2_ZUR-k.mjs +47 -0
  53. package/package.json +8 -6
  54. package/skills/lunora-quickstart/SKILL.md +25 -5
  55. package/skills/lunora-setup-storage/SKILL.md +7 -3
  56. package/dist/packem_shared/features-ocSSpZtS.mjs +0 -24
  57. package/dist/packem_shared/runAddCommand-G544_v6e.mjs +0 -4
  58. package/dist/packem_shared/tui-prompts-XHFxlOg5.mjs +0 -269
package/dist/bin.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { runCli } from './packem_shared/COMMANDS-Bn8luojF.mjs';
2
+ import { runCli } from './packem_shared/COMMANDS-0BD3K1pb.mjs';
3
3
 
4
4
  try {
5
5
  const code = await runCli();
package/dist/index.d.mts 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"];
@@ -49,6 +49,15 @@ interface PailLogger {
49
49
  success: (message: string) => void;
50
50
  warn: (message: string) => void;
51
51
  }
52
+ /**
53
+ * Minimal reporter shape consumed by `createPail`. We re-declare it locally
54
+ * because `@visulima/pail`'s `reporter/*` entrypoints ship a packaging bug:
55
+ * their `index.d.ts` re-exports `./json-reporter.d.ts` / `./pretty-reporter.d.ts`,
56
+ * but the real declaration files are suffixed (`*.server.d.ts`). `tsc` tolerates
57
+ * the dangling re-export, but the type-aware linter resolves `JsonReporter` /
58
+ * `PrettyReporter` to an unresolved type. Constructing them through this typed
59
+ * factory keeps every call site safe.
60
+ */
52
61
  declare const createLogger: () => Logger;
53
62
  /**
54
63
  * Logger whose every channel writes to `process.stderr`. Used by commands in
@@ -64,6 +73,12 @@ declare const createLogger: () => Logger;
64
73
  * the package barrel) stays side-effect-free.
65
74
  */
66
75
  declare const pail: PailLogger;
76
+ /**
77
+ * Emit a badged step line through the shared pail (the `init` flow's off-TTY
78
+ * fallback for the create-astro-style transcript). The `message` may contain
79
+ * newlines — `LunoraReporter` indents continuation lines under the badge so a
80
+ * dimmed answer sits below its question.
81
+ */
67
82
  interface CodegenCommandOptions {
68
83
  /** Which API spec(s) to emit. Defaults to codegen's `"openapi"` when omitted. */
69
84
  apiSpec?: ApiSpec;
@@ -220,6 +235,35 @@ declare const createRecordingSpawner: (exitCode?: number) => {
220
235
  calls: RecordedSpawn[];
221
236
  spawner: Spawner;
222
237
  };
238
+ interface SecretListRunnerResult {
239
+ code: number;
240
+ stderr: string;
241
+ stdout: string;
242
+ }
243
+ /** Runs an argv and resolves its captured output. Injected in tests. */
244
+ type SecretListRunner = (command: string, args: ReadonlyArray<string>, cwd: string) => Promise<SecretListRunnerResult>;
245
+ interface ListRemoteSecretsInputs {
246
+ cwd: string;
247
+ /** Cloudflare environment name (`--env`). */
248
+ env?: string;
249
+ /** Injected command runner; defaults to a real `wrangler secret list`. */
250
+ runner?: SecretListRunner;
251
+ /** Target a temporary-account deployment (`--temporary`). */
252
+ temporary?: boolean;
253
+ }
254
+ interface ListRemoteSecretsResult {
255
+ /** Diagnostic message when `ok` is false. */
256
+ error?: string;
257
+ /** Remote secret names (sorted), empty when none or on failure. */
258
+ names: ReadonlyArray<string>;
259
+ /** False when wrangler failed or its output could not be parsed. */
260
+ ok: boolean;
261
+ }
262
+ /**
263
+ * Parse `wrangler secret list --format json` output into a sorted name list.
264
+ * The payload is an array of `{ name, type }`; anything else yields `undefined`
265
+ * so the caller can report a parse failure rather than silently returning [].
266
+ */
223
267
  type FetchLike = (input: string, init?: {
224
268
  body?: string;
225
269
  headers?: Record<string, string>;
@@ -312,6 +356,10 @@ interface DeployCommandOptions {
312
356
  preview?: boolean;
313
357
  /** Railpack-availability probe injected in tests. Defaults to a real `railpack --version` + `BUILDKIT_HOST` check. */
314
358
  railpackAvailable?: DockerProbe;
359
+ /** Confirm prompt for the missing-secret offer; injected in tests. Defaults to the TTY prompt. */
360
+ secretConfirm?: (message: string) => Promise<boolean>;
361
+ /** Remote-secret lister for the missing-secret offer; injected in tests. Defaults to `wrangler secret list`. */
362
+ secretLister?: (inputs: ListRemoteSecretsInputs) => Promise<ListRemoteSecretsResult>;
315
363
  skipCodegen?: boolean;
316
364
  spawner?: Spawner;
317
365
  /**
@@ -403,6 +451,16 @@ interface StudioServerHandle {
403
451
  /** The URL to open in a browser. */
404
452
  url: string;
405
453
  }
454
+ /**
455
+ * How the dev child runs. `wrangler` is the classic `lunora dev` stack
456
+ * (wrangler worker + embedded studio + codegen watch). `vite` is a project on
457
+ * `@lunora/vite`: the Vite plugin already runs the worker, studio, and codegen
458
+ * inside the Vite dev server, so `lunora dev` runs the project's own dev
459
+ * script and gets out of the way — that's what makes `--background` / `stop` /
460
+ * `status` / `logs` work uniformly for Vite projects too.
461
+ */
462
+ type DevFlavor = "vite" | "wrangler";
463
+ /** Detect the dev flavor: a declared `@lunora/vite` dependency means Vite owns the dev server. */
406
464
  /** A running worker child the orchestrator controls: send signals, await its exit. */
407
465
  interface WorkerProcess {
408
466
  /** Resolves with the worker's exit code (1 if it failed to start). */
@@ -423,6 +481,10 @@ interface DevCommandOptions {
423
481
  ensureEnv?: typeof ensureDevVariables;
424
482
  /** Injection seam for tests — defaults to the real `.dev.vars.example` package-aware scaffolder. */
425
483
  ensureExample?: typeof ensureDevVarsExample;
484
+ /** Injection seam for tests — defaults to the real empty-secret/admin-token filler. */
485
+ fillSecrets?: typeof fillDevSecrets;
486
+ /** Dev flavor override (tests / callers that already detected it) — defaults to {@link detectDevFlavor}. */
487
+ flavor?: DevFlavor;
426
488
  logger: Logger;
427
489
  /** Injection seam for tests — defaults to the real remote-config materializer. */
428
490
  materializeRemote?: typeof materializeRemoteWranglerConfig;
@@ -457,13 +519,25 @@ interface DevRemotePlan {
457
519
  }
458
520
  interface DevCommandPlan {
459
521
  codegenEnabled: boolean;
522
+ /** Which stack the child runs — see {@link DevFlavor}. */
523
+ flavor: DevFlavor;
524
+ /**
525
+ * One-line redirect hint printed when a meta-framework is detected on the
526
+ * wrangler flavor: without `@lunora/vite` in the dependencies the worker
527
+ * still runs *inside* the framework's dev server, so the user should run
528
+ * their framework dev script for the full app. `undefined` for the vite
529
+ * flavor (`lunora dev` already runs the project's dev script there) and
530
+ * for a standalone project. Purely informational: the wrangler spawn runs
531
+ * regardless.
532
+ */
533
+ frameworkHint?: string;
460
534
  /** The remote-binding decision: which D1/KV/R2 bindings hit the deployed worker. */
461
535
  remote: DevRemotePlan;
462
536
  studioEnabled: boolean;
463
537
  studioPort: number;
464
538
  workerOrigin: string;
465
539
  workerPort: number;
466
- /** The single child process `lunora dev` spawns: `wrangler dev`. */
540
+ /** The single child process `lunora dev` spawns: `wrangler dev` (or `vite dev` for the vite flavor). */
467
541
  wrangler: SpawnDescriptor & {
468
542
  tag: string;
469
543
  };
@@ -477,10 +551,11 @@ interface DevCommandPlan {
477
551
  * to remote, the args stay empty and dev runs fully local.
478
552
  */
479
553
  /**
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.
554
+ * Plan `lunora dev`. Wrangler flavor: the worker runs via `wrangler dev` and
555
+ * nothing else as a child process. Vite flavor (`@lunora/vite` declared): the
556
+ * plugin already runs the worker inside the Vite dev server, so the one child
557
+ * is the project's own dev script (`vite dev`, `astro dev`, …) and every CLI
558
+ * sibling is disabled. Pure + synchronous so it's unit-testable.
484
559
  */
485
560
  declare const planDevCommand: (options: DevCommandOptions) => DevCommandPlan;
486
561
  /**
@@ -508,16 +583,133 @@ type PackageManagerProbe = (manager: PackageManager) => boolean;
508
583
  /** A registry item a feature can install. */
509
584
  type FeatureItem = "auth" | "auth-auth0" | "auth-clerk" | "mail";
510
585
  /** The auth-provider choices offered for `add auth` / the init auth prompt. Each value is a registry item name. */
511
-
586
+ /** A single file the item scaffolds into the project. */
587
+ interface RegistryFile {
588
+ /** Source path inside the item dir (e.g. `schema.ts`). */
589
+ from: string;
590
+ /** Merge strategy. `create-or-skip` writes whole files; `schema-extension` AST-merges schema.ts. */
591
+ merge: "create-or-skip" | "schema-extension";
592
+ /** Destination relative to the project root (e.g. `lunora/ratelimit/index.ts`). */
593
+ to: string;
594
+ }
595
+ /** A wrangler.jsonc binding addition. `path` is the jsonc key path; `value` the value to set. */
596
+ interface RegistryBinding {
597
+ path: ReadonlyArray<string>;
598
+ value: unknown;
599
+ }
600
+ /**
601
+ * An environment variable an item needs. Scaffolded into `.dev.vars` (Workers'
602
+ * local-secrets file) on add — non-secrets get their `value`; secrets get an
603
+ * empty placeholder and a reminder to run `wrangler secret put` for production.
604
+ */
605
+ interface RegistryEnvVariable {
606
+ /** Human note on what the variable is for. */
607
+ description?: string;
608
+ /** The variable name (e.g. `RESEND_API_KEY`). */
609
+ name: string;
610
+ /** Mark as a secret: never write a value, only a placeholder, and remind about prod. Defaults to `true` when no `value` is given. */
611
+ secret?: boolean;
612
+ /** A default/example value for non-secret vars. */
613
+ value?: string;
614
+ }
615
+ /** The `registry.json` manifest shape. */
616
+ interface RegistryManifest {
617
+ /** wrangler.jsonc additions (best-effort structural edits). */
618
+ bindings?: ReadonlyArray<RegistryBinding>;
619
+ /** npm deps to add to the project package.json (name → version range). */
620
+ deps?: Readonly<Record<string, string>>;
621
+ description?: string;
622
+ /** npm devDependencies to add to the project package.json. */
623
+ devDependencies?: Readonly<Record<string, string>>;
624
+ /** Post-install guidance printed after the item is added (per-item next steps). */
625
+ docs?: string;
626
+ /** Environment variables the item needs; scaffolded into `.dev.vars`. */
627
+ envVars?: ReadonlyArray<RegistryEnvVariable>;
628
+ files: ReadonlyArray<RegistryFile>;
629
+ name: string;
630
+ /** Other registry items this one depends on (resolved transitively, deps first). */
631
+ requires?: ReadonlyArray<string>;
632
+ /** Short human-readable label (distinct from the longer `description`). */
633
+ title?: string;
634
+ }
635
+ interface AddCommandOptions {
636
+ /** Bypass the `--source` safety gate (matches init). */
637
+ allowUnsafeSource?: boolean;
638
+ /** `registry build --check`: verify the index is current instead of rewriting it. */
639
+ check?: boolean;
640
+ /** Inject a confirmer for non-interactive callers / tests. */
641
+ confirm?: (prompt: string) => Promise<boolean>;
642
+ cwd?: string;
643
+ /** Preview the file-level changes (a content diff) and write nothing. */
644
+ diff?: boolean;
645
+ /** Print the plan and stop without writing anything. */
646
+ dryRun?: boolean;
647
+ /** Local registry root (offline / tests). Expects per-item subdirs, each with a `registry.json`. */
648
+ from?: string;
649
+ /** Emit a JSON snapshot of the plan/result. */
650
+ json?: boolean;
651
+ /** `--list`: enumerate available items instead of adding. */
652
+ list?: boolean;
653
+ logger: Logger;
654
+ /** Item names to add (positional args). */
655
+ names: ReadonlyArray<string>;
656
+ /** `registry build` output path for the generated catalog (defaults to the root's `index.json`). */
657
+ out?: string;
658
+ /** Force-overwrite existing files (take the incoming copy) instead of skipping/conflicting. */
659
+ overwrite?: boolean;
660
+ /** Override the git ref (branch, tag, or commit) items are fetched from (default: version-derived); appended to the `source` base when that is set. Ignored when `from` is set. */
661
+ ref?: string;
662
+ /** Override the remote registry source base (default gh:anolilab/lunora/registry). */
663
+ source?: string;
664
+ /**
665
+ * Customize each resolved manifest after it is loaded but before the plan is
666
+ * printed / reconciled — used to inject user-chosen values into otherwise
667
+ * static manifests (e.g. the R2 `bucket_name` the init storage prompt asks
668
+ * for). Applied to every item; return the manifest unchanged to leave it as-is.
669
+ */
670
+ transformManifest?: (manifest: RegistryManifest) => RegistryManifest;
671
+ /** Skip the package.json mutation confirmation prompt. */
672
+ yes?: boolean;
673
+ }
674
+ interface AddCommandResult {
675
+ /** Bindings written to wrangler.jsonc. */
676
+ bindings: ReadonlyArray<string>;
677
+ code: number;
678
+ /** Deps added to package.json. */
679
+ deps: ReadonlyArray<string>;
680
+ /** Files skipped because they already existed. */
681
+ skipped: ReadonlyArray<string>;
682
+ /** Files written (absolute paths). */
683
+ written: ReadonlyArray<string>;
684
+ }
685
+ /** One resolved item: its parsed manifest plus the (possibly staged) directory it lives in. */
512
686
  /**
513
687
  * A feature offered in the post-scaffold multi-select. `auth`/`email` carry a
514
688
  * sub-prompt or alias; every other value IS the registry item name applied
515
689
  * directly (`storage` → the `storage` registry item, etc.).
516
690
  */
517
691
  type StackFeature = "auth" | "backup" | "crons" | "email" | "presence" | "ratelimit" | "storage";
692
+ /** Customize a resolved manifest before it is written (e.g. inject the chosen R2 bucket name). */
693
+ type OfferTransformManifest = (manifest: RegistryManifest) => RegistryManifest;
694
+ /**
695
+ * One feature ready to apply: the registry item name(s), an optional manifest
696
+ * transform, and a short `label` (the feature value) shown on the combined
697
+ * progress line. Built up-front by the collectors so every prompt is answered
698
+ * before any apply runs.
699
+ */
700
+ interface FeatureApply {
701
+ label: string;
702
+ names: ReadonlyArray<string>;
703
+ transformManifest?: OfferTransformManifest;
704
+ }
518
705
  interface OfferDeps {
519
- /** Apply one or more registry items into the new project; resolves `true` on success. */
520
- apply: (names: ReadonlyArray<string>) => Promise<boolean>;
706
+ /**
707
+ * Apply the collected features into the new project in one batch — resolves
708
+ * `true` when every item succeeds. The CLI renders this as a single progress
709
+ * line whose label changes per feature; each plan's `transformManifest`
710
+ * customizes that item's manifest before it is written.
711
+ */
712
+ applyAll: (plans: ReadonlyArray<FeatureApply>) => Promise<boolean>;
521
713
  /** When `false`, skip all prompts and print the later-setup hint. */
522
714
  interactive: boolean;
523
715
  logger: Logger;
@@ -529,6 +721,14 @@ interface OfferDeps {
529
721
  }>, settings?: {
530
722
  defaults?: ReadonlyArray<StackFeature>;
531
723
  }) => Promise<StackFeature[]>;
724
+ /**
725
+ * Features chosen non-interactively (the `--add` flag). When set, the
726
+ * multi-select and every sub-prompt are skipped — each feature is applied with
727
+ * its shipped defaults (base registry item, placeholder bindings).
728
+ */
729
+ preselected?: ReadonlyArray<StackFeature>;
730
+ /** The new project's name — seeds smart defaults like the `project-uploads` bucket name. */
731
+ projectName: string;
532
732
  /** Single-select among the auth providers (TTY-backed in production). */
533
733
  select: (message: string, options: ReadonlyArray<{
534
734
  description?: string;
@@ -537,17 +737,32 @@ interface OfferDeps {
537
737
  }>, settings?: {
538
738
  default?: FeatureItem;
539
739
  }) => Promise<FeatureItem | undefined>;
740
+ /** Single-line text input (TTY-backed in production) — used for the storage bucket-name prompt. */
741
+ text: (message: string, settings?: {
742
+ default?: string;
743
+ placeholder?: string;
744
+ }) => Promise<string>;
540
745
  }
541
746
  /**
542
747
  * Offer the stack features (auth, email, storage, rate limiting, crons,
543
- * presence, backups) in ONE multi-select after a successful scaffold. When auth
544
- * is picked, a follow-up single-select chooses the provider (email+password /
545
- * Clerk / Auth0); email maps to the `mail` item; every other feature value is
546
- * applied as its registry item directly. Picked items are applied in selection
547
- * order. Non-interactive: prints how to add them later and changes nothing.
748
+ * presence, backups) in ONE multi-select after a successful scaffold. Auth,
749
+ * email, and storage run a follow-up prompt (provider / destination / bucket
750
+ * name); every other feature value is applied as its registry item directly.
751
+ *
752
+ * Every question is asked FIRST (in selection order), then the picked features
753
+ * are applied together via {@link OfferDeps.applyAll} — the CLI renders that as a
754
+ * single progress line whose label changes per feature, instead of one spinner
755
+ * per item. Non-interactive: prints how to add them later and changes nothing.
548
756
  */
549
757
  type Template = "analog" | "astro" | "next" | "nuxt" | "react-router" | "standalone" | "sveltekit" | "tanstack-start-react" | "tanstack-start-solid";
550
758
  interface InitCommandOptions {
759
+ /**
760
+ * Add features non-interactively after scaffolding (the `--add` flag): a
761
+ * comma-separated list of `auth | email | storage | ratelimit | crons |
762
+ * presence | backup`. Bypasses the interactive multi-select and sub-prompts —
763
+ * each named feature is applied with its shipped defaults.
764
+ */
765
+ add?: string;
551
766
  /**
552
767
  * When true, accept `--source` values that don't start with `gh:` /
553
768
  * `github:` / `https://` or that contain `..`. Defaults to false; the CLI
@@ -559,6 +774,12 @@ interface InitCommandOptions {
559
774
  ci?: CiProvider;
560
775
  cwd?: string;
561
776
  /**
777
+ * Walk the whole flow — prompts, task list, next-steps, mascot — but make no
778
+ * changes: skip the template fetch/copy, the feature applies, the dependency
779
+ * install, and `git init`. Each skipped action logs a `would …` line instead.
780
+ */
781
+ dryRun?: boolean;
782
+ /**
562
783
  * Local directory containing the template subdirs (e.g. `vite/`,
563
784
  * `standalone/`). When provided, skips the network fetch entirely.
564
785
  * Useful for offline runs, the clean-machine smoke test, and unit tests.
@@ -599,10 +820,10 @@ interface InitCommandOptions {
599
820
  packageManagerProbe?: PackageManagerProbe;
600
821
  /**
601
822
  * Inject the offer's prompts (tests). When set, the offer is treated as
602
- * interactive regardless of TTY, and these drive the feature multi-select
603
- * and the auth-provider sub-select.
823
+ * interactive regardless of TTY, and these drive the feature multi-select,
824
+ * the auth-provider sub-select, and the storage bucket-name text input.
604
825
  */
605
- prompt?: Pick<OfferDeps, "multiSelect" | "select">;
826
+ prompt?: Pick<OfferDeps, "multiSelect" | "select" | "text">;
606
827
  /**
607
828
  * Override the git ref (branch, tag, or commit) the default template source
608
829
  * is fetched from. Takes precedence over the version-derived ref. Ignored
@@ -639,11 +860,6 @@ interface InitCommandResult {
639
860
  files: ReadonlyArray<string>;
640
861
  target: string;
641
862
  }
642
- /**
643
- * `lunora init` entry: scaffold (in-place or a new directory), then — on success
644
- * — offer to add auth + email via the registry. The offer never affects the
645
- * scaffold's exit code.
646
- */
647
863
  declare const runInitCommand: (options: InitCommandOptions) => Promise<InitCommandResult>;
648
864
  /** Narrow a raw `--template` value to a known {@link Template}. */
649
865
  interface MigrateGenerateCommandOptions {
@@ -681,99 +897,6 @@ interface IndexItem extends CatalogItem {
681
897
  declare const buildRegistryIndex: (root: string) => {
682
898
  items: IndexItem[];
683
899
  };
684
- /** A single file the item scaffolds into the project. */
685
- interface RegistryFile {
686
- /** Source path inside the item dir (e.g. `schema.ts`). */
687
- from: string;
688
- /** Merge strategy. `create-or-skip` writes whole files; `schema-extension` AST-merges schema.ts. */
689
- merge: "create-or-skip" | "schema-extension";
690
- /** Destination relative to the project root (e.g. `lunora/ratelimit/index.ts`). */
691
- to: string;
692
- }
693
- /** A wrangler.jsonc binding addition. `path` is the jsonc key path; `value` the value to set. */
694
- interface RegistryBinding {
695
- path: ReadonlyArray<string>;
696
- value: unknown;
697
- }
698
- /**
699
- * An environment variable an item needs. Scaffolded into `.dev.vars` (Workers'
700
- * local-secrets file) on add — non-secrets get their `value`; secrets get an
701
- * empty placeholder and a reminder to run `wrangler secret put` for production.
702
- */
703
- interface RegistryEnvVariable {
704
- /** Human note on what the variable is for. */
705
- description?: string;
706
- /** The variable name (e.g. `RESEND_API_KEY`). */
707
- name: string;
708
- /** Mark as a secret: never write a value, only a placeholder, and remind about prod. Defaults to `true` when no `value` is given. */
709
- secret?: boolean;
710
- /** A default/example value for non-secret vars. */
711
- value?: string;
712
- }
713
- /** The `registry.json` manifest shape. */
714
- interface RegistryManifest {
715
- /** wrangler.jsonc additions (best-effort structural edits). */
716
- bindings?: ReadonlyArray<RegistryBinding>;
717
- /** npm deps to add to the project package.json (name → version range). */
718
- deps?: Readonly<Record<string, string>>;
719
- description?: string;
720
- /** npm devDependencies to add to the project package.json. */
721
- devDependencies?: Readonly<Record<string, string>>;
722
- /** Post-install guidance printed after the item is added (per-item next steps). */
723
- docs?: string;
724
- /** Environment variables the item needs; scaffolded into `.dev.vars`. */
725
- envVars?: ReadonlyArray<RegistryEnvVariable>;
726
- files: ReadonlyArray<RegistryFile>;
727
- name: string;
728
- /** Other registry items this one depends on (resolved transitively, deps first). */
729
- requires?: ReadonlyArray<string>;
730
- /** Short human-readable label (distinct from the longer `description`). */
731
- title?: string;
732
- }
733
- interface AddCommandOptions {
734
- /** Bypass the `--source` safety gate (matches init). */
735
- allowUnsafeSource?: boolean;
736
- /** `registry build --check`: verify the index is current instead of rewriting it. */
737
- check?: boolean;
738
- /** Inject a confirmer for non-interactive callers / tests. */
739
- confirm?: (prompt: string) => Promise<boolean>;
740
- cwd?: string;
741
- /** Preview the file-level changes (a content diff) and write nothing. */
742
- diff?: boolean;
743
- /** Print the plan and stop without writing anything. */
744
- dryRun?: boolean;
745
- /** Local registry root (offline / tests). Expects per-item subdirs, each with a `registry.json`. */
746
- from?: string;
747
- /** Emit a JSON snapshot of the plan/result. */
748
- json?: boolean;
749
- /** `--list`: enumerate available items instead of adding. */
750
- list?: boolean;
751
- logger: Logger;
752
- /** Item names to add (positional args). */
753
- names: ReadonlyArray<string>;
754
- /** `registry build` output path for the generated catalog (defaults to the root's `index.json`). */
755
- out?: string;
756
- /** Force-overwrite existing files (take the incoming copy) instead of skipping/conflicting. */
757
- overwrite?: boolean;
758
- /** Override the git ref (branch, tag, or commit) items are fetched from (default: version-derived); appended to the `source` base when that is set. Ignored when `from` is set. */
759
- ref?: string;
760
- /** Override the remote registry source base (default gh:anolilab/lunora/registry). */
761
- source?: string;
762
- /** Skip the package.json mutation confirmation prompt. */
763
- yes?: boolean;
764
- }
765
- interface AddCommandResult {
766
- /** Bindings written to wrangler.jsonc. */
767
- bindings: ReadonlyArray<string>;
768
- code: number;
769
- /** Deps added to package.json. */
770
- deps: ReadonlyArray<string>;
771
- /** Files skipped because they already existed. */
772
- skipped: ReadonlyArray<string>;
773
- /** Files written (absolute paths). */
774
- written: ReadonlyArray<string>;
775
- }
776
- /** One resolved item: its parsed manifest plus the (possibly staged) directory it lives in. */
777
900
  /** `lunora registry add` (one or more item names): scaffold items into the project. */
778
901
  declare const runAddCommand: (options: AddCommandOptions) => Promise<AddCommandResult>;
779
902
  /**