@lunora/cli 1.0.0-alpha.7 → 1.0.0-alpha.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +6 -0
- package/__assets__/package-og.svg +1 -1
- package/dist/bin.mjs +1 -1
- package/dist/index.d.mts +277 -115
- package/dist/index.d.ts +277 -115
- package/dist/index.mjs +8 -8
- package/dist/packem_chunks/handler.mjs +87 -6
- package/dist/packem_chunks/handler10.mjs +8 -14
- package/dist/packem_chunks/handler11.mjs +19 -189
- package/dist/packem_chunks/handler12.mjs +176 -115
- package/dist/packem_chunks/handler13.mjs +118 -52
- package/dist/packem_chunks/handler14.mjs +50 -43
- package/dist/packem_chunks/handler15.mjs +48 -67
- package/dist/packem_chunks/handler16.mjs +74 -37
- package/dist/packem_chunks/handler17.mjs +39 -100
- package/dist/packem_chunks/handler18.mjs +87 -152
- package/dist/packem_chunks/handler19.mjs +148 -67
- package/dist/packem_chunks/handler2.mjs +6 -4
- package/dist/packem_chunks/handler20.mjs +77 -75
- package/dist/packem_chunks/handler21.mjs +71 -288
- package/dist/packem_chunks/handler3.mjs +6 -3
- package/dist/packem_chunks/handler4.mjs +2 -2
- package/dist/packem_chunks/handler5.mjs +7 -4
- package/dist/packem_chunks/handler6.mjs +10 -7
- package/dist/packem_chunks/handler7.mjs +2 -2
- package/dist/packem_chunks/handler8.mjs +1 -1
- package/dist/packem_chunks/handler9.mjs +315 -12
- package/dist/packem_chunks/planDevCommand.mjs +758 -81
- package/dist/packem_chunks/runCodegenCommand.mjs +5 -4
- package/dist/packem_chunks/runDeployCommand.mjs +115 -20
- package/dist/packem_chunks/runInitCommand.mjs +1605 -172
- package/dist/packem_chunks/runMigrateGenerateCommand.mjs +5 -4
- package/dist/packem_chunks/runResetCommand.mjs +2 -2
- package/dist/packem_chunks/runRpcCommand.mjs +3 -2
- package/dist/packem_shared/{COMMANDS-Bn8luojF.mjs → COMMANDS-0BD3K1pb.mjs} +79 -21
- package/dist/packem_shared/{DEFAULT_IMPORT_BATCH_SIZE-Ck-2bU08.mjs → DEFAULT_IMPORT_BATCH_SIZE-CRQmmBZM.mjs} +3 -2
- package/dist/packem_shared/{api-spec-CtA6ilu4.mjs → api-spec-Bx0iKbxA.mjs} +3 -1
- package/dist/packem_shared/{buildRegistryIndex-BcYe607_.mjs → buildRegistryIndex-CqM5FwGI.mjs} +1 -1
- package/dist/packem_shared/codegen-error-DJG-ghs_.mjs +31 -0
- package/dist/packem_shared/{command-BDXcJCCJ.mjs → command-lYnl4QyF.mjs} +6 -1
- package/dist/packem_shared/{commands-DqsEzojt.mjs → commands-vnRRkhNE.mjs} +123 -15
- package/dist/packem_shared/{createLogger-CHPNjFw2.mjs → createLogger-CIWSHrTL.mjs} +40 -8
- package/dist/packem_shared/{createRecordingSpawner-DxI3mebw.mjs → createRecordingSpawner-Cw5Iu73G.mjs} +12 -2
- package/dist/packem_shared/{detect-package-manager-DYp7n3mJ.mjs → detect-package-manager-DvEthdCw.mjs} +26 -30
- package/dist/packem_shared/{insertSchemaExtension-BuzF6-t2.mjs → insertSchemaExtension-DAqbfr9Z.mjs} +15 -10
- package/dist/packem_shared/{open-url-Dfq6fAyT.mjs → open-url-4PBLY9X0.mjs} +3 -2
- package/dist/packem_shared/{output-format-7gyGR3h8.mjs → output-format-B4642rjE.mjs} +1 -1
- package/dist/packem_shared/{parseManifest--vZf2FY1.mjs → parseManifest-BBrXCg9V.mjs} +16 -9
- package/dist/packem_shared/prompt-cancelled-APzX1Im-.mjs +9 -0
- package/dist/packem_shared/runAddCommand-BCcJzs_k.mjs +4 -0
- package/dist/packem_shared/storage-bGfgwOgF.mjs +84 -0
- package/dist/packem_shared/tui-prompts-BjEN8XgP.mjs +658 -0
- package/dist/packem_shared/wrangler-secrets-Dq_Fkbm-.mjs +49 -0
- package/package.json +10 -7
- package/skills/lunora-quickstart/SKILL.md +25 -5
- package/skills/lunora-setup-storage/SKILL.md +7 -3
- package/dist/packem_shared/features-ocSSpZtS.mjs +0 -24
- package/dist/packem_shared/runAddCommand-G544_v6e.mjs +0 -4
- package/dist/packem_shared/tui-prompts-XHFxlOg5.mjs +0 -269
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CodegenOptions, SchemaIR } from '@lunora/codegen';
|
|
2
2
|
import '@visulima/cerebro';
|
|
3
|
-
import { ensureDevVariables, ensureDevVarsExample, materializeRemoteWranglerConfig } from '@lunora/config';
|
|
3
|
+
import { ensureDevVariables, ensureDevVarsExample, fillDevSecrets, materializeRemoteWranglerConfig } from '@lunora/config';
|
|
4
4
|
export { REQUIRED_COMPATIBILITY_DATE, REQUIRED_FLAG, type WranglerProjectValidationOptions as WranglerValidationOptions, type WranglerValidationReport, type WranglerProjectValidationResult as WranglerValidationResult, validateWranglerProject as validateWrangler, validateWranglerConfig } from '@lunora/config';
|
|
5
5
|
/** Every command name the CLI registers (drives the `CommandName` type + tests). */
|
|
6
6
|
declare const COMMANDS: readonly ["init", "add", "dev", "codegen", "build", "deploy", "containers", "prepare", "link", "deployments", "logs", "run", "insights", "reset", "migrate", "export", "import", "seed", "backup", "verify", "info", "doctor", "env", "analyze", "view", "docs", "registry", "rules"];
|
|
@@ -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,34 @@ 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 (wrangler
|
|
456
|
+
* worker + embedded studio + codegen watch) for a standalone class-C project.
|
|
457
|
+
* `vite` is a project on `@lunora/vite`: the plugin already runs the worker,
|
|
458
|
+
* studio, and codegen inside the Vite dev server, so `lunora dev` runs the
|
|
459
|
+
* project's own dev script and gets out of the way — this also covers class-B
|
|
460
|
+
* frameworks whose own dev server runs the worker in `workerd` (Astro 6 +
|
|
461
|
+
* `@astrojs/cloudflare`, which embeds `@cloudflare/vite-plugin` in `astro dev`:
|
|
462
|
+
* SSR + `/_lunora/*` + `ShardDO` in one process, HMR intact). `framework-worker`
|
|
463
|
+
* is a class-B framework whose dev server CANNOT host the `ShardDO` Durable
|
|
464
|
+
* Object (SvelteKit / Nuxt: their adapters use wrangler's `getPlatformProxy()`,
|
|
465
|
+
* which runs an empty-script Miniflare and does not emulate internal DOs); there
|
|
466
|
+
* `lunora dev` runs the framework's own dev server (front door, HMR, and — via
|
|
467
|
+
* its `@lunora/vite` plugin — studio + codegen) AND a second `wrangler dev`
|
|
468
|
+
* sidecar that owns the real `ShardDO` in `workerd`, wired via the committed
|
|
469
|
+
* `wrangler.dev.jsonc`.
|
|
470
|
+
*/
|
|
471
|
+
type DevFlavor = "framework-worker" | "vite" | "wrangler";
|
|
472
|
+
/**
|
|
473
|
+
* Detect the dev flavor.
|
|
474
|
+
*
|
|
475
|
+
* A SvelteKit / Nuxt project needs the two-process `framework-worker` stack even
|
|
476
|
+
* though it also declares `@lunora/vite` (which its framework dev server uses for
|
|
477
|
+
* codegen/studio) — so the framework check comes FIRST. Everything else on
|
|
478
|
+
* `@lunora/vite` (class-A frameworks + Astro + standalone Vite) delegates to the
|
|
479
|
+
* project's own dev server (`vite`); a project without `@lunora/vite` is the
|
|
480
|
+
* classic standalone `wrangler` stack.
|
|
481
|
+
*/
|
|
406
482
|
/** A running worker child the orchestrator controls: send signals, await its exit. */
|
|
407
483
|
interface WorkerProcess {
|
|
408
484
|
/** Resolves with the worker's exit code (1 if it failed to start). */
|
|
@@ -423,6 +499,14 @@ interface DevCommandOptions {
|
|
|
423
499
|
ensureEnv?: typeof ensureDevVariables;
|
|
424
500
|
/** Injection seam for tests — defaults to the real `.dev.vars.example` package-aware scaffolder. */
|
|
425
501
|
ensureExample?: typeof ensureDevVarsExample;
|
|
502
|
+
/** Injection seam for tests — defaults to the real empty-secret/admin-token filler. */
|
|
503
|
+
fillSecrets?: typeof fillDevSecrets;
|
|
504
|
+
/** Injection seam for tests — defaults to the real free-port probe ({@link findAvailablePort}). */
|
|
505
|
+
findFreePort?: (preferred: number) => Promise<number>;
|
|
506
|
+
/** Dev flavor override (tests / callers that already detected it) — defaults to {@link detectDevFlavor}. */
|
|
507
|
+
flavor?: DevFlavor;
|
|
508
|
+
/** Injection seam for tests — defaults to the real IPv6-loopback probe ({@link hasIpv6Loopback}). */
|
|
509
|
+
hasIpv6Loopback?: () => boolean;
|
|
426
510
|
logger: Logger;
|
|
427
511
|
/** Injection seam for tests — defaults to the real remote-config materializer. */
|
|
428
512
|
materializeRemote?: typeof materializeRemoteWranglerConfig;
|
|
@@ -457,13 +541,42 @@ interface DevRemotePlan {
|
|
|
457
541
|
}
|
|
458
542
|
interface DevCommandPlan {
|
|
459
543
|
codegenEnabled: boolean;
|
|
544
|
+
/** Which stack the child runs — see {@link DevFlavor}. */
|
|
545
|
+
flavor: DevFlavor;
|
|
546
|
+
/**
|
|
547
|
+
* One-line redirect hint printed when a meta-framework is detected on the
|
|
548
|
+
* wrangler flavor: without `@lunora/vite` in the dependencies the worker
|
|
549
|
+
* still runs *inside* the framework's dev server, so the user should run
|
|
550
|
+
* their framework dev script for the full app. `undefined` for the vite
|
|
551
|
+
* flavor (`lunora dev` already runs the project's dev script there) and
|
|
552
|
+
* for a standalone project. Purely informational: the wrangler spawn runs
|
|
553
|
+
* regardless.
|
|
554
|
+
*/
|
|
555
|
+
frameworkHint?: string;
|
|
556
|
+
/**
|
|
557
|
+
* True when `wrangler dev` was given `--ip 127.0.0.1` because the host has no
|
|
558
|
+
* IPv6 loopback (`::1`) — surfaced so the dev loop can note the rebind.
|
|
559
|
+
* Always `false` for the vite flavor (the plugin owns its own bind).
|
|
560
|
+
*/
|
|
561
|
+
ipv4LoopbackForced: boolean;
|
|
460
562
|
/** The remote-binding decision: which D1/KV/R2 bindings hit the deployed worker. */
|
|
461
563
|
remote: DevRemotePlan;
|
|
564
|
+
/**
|
|
565
|
+
* The `wrangler dev` sidecar for the `framework-worker` flavor (SvelteKit /
|
|
566
|
+
* Nuxt): a second child that owns the real `ShardDO` in `workerd`, wired via
|
|
567
|
+
* the committed `wrangler.dev.jsonc`. `undefined` for every other flavor —
|
|
568
|
+
* only the two-process class-B stack has a sidecar. When present, `wrangler`
|
|
569
|
+
* (above) is the framework's own dev server (the front door / HMR) and this
|
|
570
|
+
* is the Lunora realtime plane.
|
|
571
|
+
*/
|
|
572
|
+
sidecar?: SpawnDescriptor & {
|
|
573
|
+
tag: string;
|
|
574
|
+
};
|
|
462
575
|
studioEnabled: boolean;
|
|
463
576
|
studioPort: number;
|
|
464
577
|
workerOrigin: string;
|
|
465
578
|
workerPort: number;
|
|
466
|
-
/** The
|
|
579
|
+
/** The primary child `lunora dev` spawns: `wrangler dev` (wrangler flavor) or the framework/`vite dev` server (vite / framework-worker). */
|
|
467
580
|
wrangler: SpawnDescriptor & {
|
|
468
581
|
tag: string;
|
|
469
582
|
};
|
|
@@ -477,10 +590,11 @@ interface DevCommandPlan {
|
|
|
477
590
|
* to remote, the args stay empty and dev runs fully local.
|
|
478
591
|
*/
|
|
479
592
|
/**
|
|
480
|
-
* Plan `lunora dev
|
|
481
|
-
* child process. Vite
|
|
482
|
-
*
|
|
483
|
-
*
|
|
593
|
+
* Plan `lunora dev`. Wrangler flavor: the worker runs via `wrangler dev` and
|
|
594
|
+
* nothing else as a child process. Vite flavor (`@lunora/vite` declared): the
|
|
595
|
+
* plugin already runs the worker inside the Vite dev server, so the one child
|
|
596
|
+
* is the project's own dev script (`vite dev`, `astro dev`, …) and every CLI
|
|
597
|
+
* sibling is disabled. Pure + synchronous so it's unit-testable.
|
|
484
598
|
*/
|
|
485
599
|
declare const planDevCommand: (options: DevCommandOptions) => DevCommandPlan;
|
|
486
600
|
/**
|
|
@@ -508,16 +622,133 @@ type PackageManagerProbe = (manager: PackageManager) => boolean;
|
|
|
508
622
|
/** A registry item a feature can install. */
|
|
509
623
|
type FeatureItem = "auth" | "auth-auth0" | "auth-clerk" | "mail";
|
|
510
624
|
/** The auth-provider choices offered for `add auth` / the init auth prompt. Each value is a registry item name. */
|
|
511
|
-
|
|
625
|
+
/** A single file the item scaffolds into the project. */
|
|
626
|
+
interface RegistryFile {
|
|
627
|
+
/** Source path inside the item dir (e.g. `schema.ts`). */
|
|
628
|
+
from: string;
|
|
629
|
+
/** Merge strategy. `create-or-skip` writes whole files; `schema-extension` AST-merges schema.ts. */
|
|
630
|
+
merge: "create-or-skip" | "schema-extension";
|
|
631
|
+
/** Destination relative to the project root (e.g. `lunora/ratelimit/index.ts`). */
|
|
632
|
+
to: string;
|
|
633
|
+
}
|
|
634
|
+
/** A wrangler.jsonc binding addition. `path` is the jsonc key path; `value` the value to set. */
|
|
635
|
+
interface RegistryBinding {
|
|
636
|
+
path: ReadonlyArray<string>;
|
|
637
|
+
value: unknown;
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* An environment variable an item needs. Scaffolded into `.dev.vars` (Workers'
|
|
641
|
+
* local-secrets file) on add — non-secrets get their `value`; secrets get an
|
|
642
|
+
* empty placeholder and a reminder to run `wrangler secret put` for production.
|
|
643
|
+
*/
|
|
644
|
+
interface RegistryEnvVariable {
|
|
645
|
+
/** Human note on what the variable is for. */
|
|
646
|
+
description?: string;
|
|
647
|
+
/** The variable name (e.g. `RESEND_API_KEY`). */
|
|
648
|
+
name: string;
|
|
649
|
+
/** Mark as a secret: never write a value, only a placeholder, and remind about prod. Defaults to `true` when no `value` is given. */
|
|
650
|
+
secret?: boolean;
|
|
651
|
+
/** A default/example value for non-secret vars. */
|
|
652
|
+
value?: string;
|
|
653
|
+
}
|
|
654
|
+
/** The `registry.json` manifest shape. */
|
|
655
|
+
interface RegistryManifest {
|
|
656
|
+
/** wrangler.jsonc additions (best-effort structural edits). */
|
|
657
|
+
bindings?: ReadonlyArray<RegistryBinding>;
|
|
658
|
+
/** npm deps to add to the project package.json (name → version range). */
|
|
659
|
+
deps?: Readonly<Record<string, string>>;
|
|
660
|
+
description?: string;
|
|
661
|
+
/** npm devDependencies to add to the project package.json. */
|
|
662
|
+
devDependencies?: Readonly<Record<string, string>>;
|
|
663
|
+
/** Post-install guidance printed after the item is added (per-item next steps). */
|
|
664
|
+
docs?: string;
|
|
665
|
+
/** Environment variables the item needs; scaffolded into `.dev.vars`. */
|
|
666
|
+
envVars?: ReadonlyArray<RegistryEnvVariable>;
|
|
667
|
+
files: ReadonlyArray<RegistryFile>;
|
|
668
|
+
name: string;
|
|
669
|
+
/** Other registry items this one depends on (resolved transitively, deps first). */
|
|
670
|
+
requires?: ReadonlyArray<string>;
|
|
671
|
+
/** Short human-readable label (distinct from the longer `description`). */
|
|
672
|
+
title?: string;
|
|
673
|
+
}
|
|
674
|
+
interface AddCommandOptions {
|
|
675
|
+
/** Bypass the `--source` safety gate (matches init). */
|
|
676
|
+
allowUnsafeSource?: boolean;
|
|
677
|
+
/** `registry build --check`: verify the index is current instead of rewriting it. */
|
|
678
|
+
check?: boolean;
|
|
679
|
+
/** Inject a confirmer for non-interactive callers / tests. */
|
|
680
|
+
confirm?: (prompt: string) => Promise<boolean>;
|
|
681
|
+
cwd?: string;
|
|
682
|
+
/** Preview the file-level changes (a content diff) and write nothing. */
|
|
683
|
+
diff?: boolean;
|
|
684
|
+
/** Print the plan and stop without writing anything. */
|
|
685
|
+
dryRun?: boolean;
|
|
686
|
+
/** Local registry root (offline / tests). Expects per-item subdirs, each with a `registry.json`. */
|
|
687
|
+
from?: string;
|
|
688
|
+
/** Emit a JSON snapshot of the plan/result. */
|
|
689
|
+
json?: boolean;
|
|
690
|
+
/** `--list`: enumerate available items instead of adding. */
|
|
691
|
+
list?: boolean;
|
|
692
|
+
logger: Logger;
|
|
693
|
+
/** Item names to add (positional args). */
|
|
694
|
+
names: ReadonlyArray<string>;
|
|
695
|
+
/** `registry build` output path for the generated catalog (defaults to the root's `index.json`). */
|
|
696
|
+
out?: string;
|
|
697
|
+
/** Force-overwrite existing files (take the incoming copy) instead of skipping/conflicting. */
|
|
698
|
+
overwrite?: boolean;
|
|
699
|
+
/** 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. */
|
|
700
|
+
ref?: string;
|
|
701
|
+
/** Override the remote registry source base (default gh:anolilab/lunora/registry). */
|
|
702
|
+
source?: string;
|
|
703
|
+
/**
|
|
704
|
+
* Customize each resolved manifest after it is loaded but before the plan is
|
|
705
|
+
* printed / reconciled — used to inject user-chosen values into otherwise
|
|
706
|
+
* static manifests (e.g. the R2 `bucket_name` the init storage prompt asks
|
|
707
|
+
* for). Applied to every item; return the manifest unchanged to leave it as-is.
|
|
708
|
+
*/
|
|
709
|
+
transformManifest?: (manifest: RegistryManifest) => RegistryManifest;
|
|
710
|
+
/** Skip the package.json mutation confirmation prompt. */
|
|
711
|
+
yes?: boolean;
|
|
712
|
+
}
|
|
713
|
+
interface AddCommandResult {
|
|
714
|
+
/** Bindings written to wrangler.jsonc. */
|
|
715
|
+
bindings: ReadonlyArray<string>;
|
|
716
|
+
code: number;
|
|
717
|
+
/** Deps added to package.json. */
|
|
718
|
+
deps: ReadonlyArray<string>;
|
|
719
|
+
/** Files skipped because they already existed. */
|
|
720
|
+
skipped: ReadonlyArray<string>;
|
|
721
|
+
/** Files written (absolute paths). */
|
|
722
|
+
written: ReadonlyArray<string>;
|
|
723
|
+
}
|
|
724
|
+
/** One resolved item: its parsed manifest plus the (possibly staged) directory it lives in. */
|
|
512
725
|
/**
|
|
513
726
|
* A feature offered in the post-scaffold multi-select. `auth`/`email` carry a
|
|
514
727
|
* sub-prompt or alias; every other value IS the registry item name applied
|
|
515
728
|
* directly (`storage` → the `storage` registry item, etc.).
|
|
516
729
|
*/
|
|
517
730
|
type StackFeature = "auth" | "backup" | "crons" | "email" | "presence" | "ratelimit" | "storage";
|
|
731
|
+
/** Customize a resolved manifest before it is written (e.g. inject the chosen R2 bucket name). */
|
|
732
|
+
type OfferTransformManifest = (manifest: RegistryManifest) => RegistryManifest;
|
|
733
|
+
/**
|
|
734
|
+
* One feature ready to apply: the registry item name(s), an optional manifest
|
|
735
|
+
* transform, and a short `label` (the feature value) shown on the combined
|
|
736
|
+
* progress line. Built up-front by the collectors so every prompt is answered
|
|
737
|
+
* before any apply runs.
|
|
738
|
+
*/
|
|
739
|
+
interface FeatureApply {
|
|
740
|
+
label: string;
|
|
741
|
+
names: ReadonlyArray<string>;
|
|
742
|
+
transformManifest?: OfferTransformManifest;
|
|
743
|
+
}
|
|
518
744
|
interface OfferDeps {
|
|
519
|
-
/**
|
|
520
|
-
|
|
745
|
+
/**
|
|
746
|
+
* Apply the collected features into the new project in one batch — resolves
|
|
747
|
+
* `true` when every item succeeds. The CLI renders this as a single progress
|
|
748
|
+
* line whose label changes per feature; each plan's `transformManifest`
|
|
749
|
+
* customizes that item's manifest before it is written.
|
|
750
|
+
*/
|
|
751
|
+
applyAll: (plans: ReadonlyArray<FeatureApply>) => Promise<boolean>;
|
|
521
752
|
/** When `false`, skip all prompts and print the later-setup hint. */
|
|
522
753
|
interactive: boolean;
|
|
523
754
|
logger: Logger;
|
|
@@ -529,6 +760,14 @@ interface OfferDeps {
|
|
|
529
760
|
}>, settings?: {
|
|
530
761
|
defaults?: ReadonlyArray<StackFeature>;
|
|
531
762
|
}) => Promise<StackFeature[]>;
|
|
763
|
+
/**
|
|
764
|
+
* Features chosen non-interactively (the `--add` flag). When set, the
|
|
765
|
+
* multi-select and every sub-prompt are skipped — each feature is applied with
|
|
766
|
+
* its shipped defaults (base registry item, placeholder bindings).
|
|
767
|
+
*/
|
|
768
|
+
preselected?: ReadonlyArray<StackFeature>;
|
|
769
|
+
/** The new project's name — seeds smart defaults like the `project-uploads` bucket name. */
|
|
770
|
+
projectName: string;
|
|
532
771
|
/** Single-select among the auth providers (TTY-backed in production). */
|
|
533
772
|
select: (message: string, options: ReadonlyArray<{
|
|
534
773
|
description?: string;
|
|
@@ -537,17 +776,32 @@ interface OfferDeps {
|
|
|
537
776
|
}>, settings?: {
|
|
538
777
|
default?: FeatureItem;
|
|
539
778
|
}) => Promise<FeatureItem | undefined>;
|
|
779
|
+
/** Single-line text input (TTY-backed in production) — used for the storage bucket-name prompt. */
|
|
780
|
+
text: (message: string, settings?: {
|
|
781
|
+
default?: string;
|
|
782
|
+
placeholder?: string;
|
|
783
|
+
}) => Promise<string>;
|
|
540
784
|
}
|
|
541
785
|
/**
|
|
542
786
|
* Offer the stack features (auth, email, storage, rate limiting, crons,
|
|
543
|
-
* presence, backups) in ONE multi-select after a successful scaffold.
|
|
544
|
-
*
|
|
545
|
-
*
|
|
546
|
-
*
|
|
547
|
-
*
|
|
787
|
+
* presence, backups) in ONE multi-select after a successful scaffold. Auth,
|
|
788
|
+
* email, and storage run a follow-up prompt (provider / destination / bucket
|
|
789
|
+
* name); every other feature value is applied as its registry item directly.
|
|
790
|
+
*
|
|
791
|
+
* Every question is asked FIRST (in selection order), then the picked features
|
|
792
|
+
* are applied together via {@link OfferDeps.applyAll} — the CLI renders that as a
|
|
793
|
+
* single progress line whose label changes per feature, instead of one spinner
|
|
794
|
+
* per item. Non-interactive: prints how to add them later and changes nothing.
|
|
548
795
|
*/
|
|
549
796
|
type Template = "analog" | "astro" | "next" | "nuxt" | "react-router" | "standalone" | "sveltekit" | "tanstack-start-react" | "tanstack-start-solid";
|
|
550
797
|
interface InitCommandOptions {
|
|
798
|
+
/**
|
|
799
|
+
* Add features non-interactively after scaffolding (the `--add` flag): a
|
|
800
|
+
* comma-separated list of `auth | email | storage | ratelimit | crons |
|
|
801
|
+
* presence | backup`. Bypasses the interactive multi-select and sub-prompts —
|
|
802
|
+
* each named feature is applied with its shipped defaults.
|
|
803
|
+
*/
|
|
804
|
+
add?: string;
|
|
551
805
|
/**
|
|
552
806
|
* When true, accept `--source` values that don't start with `gh:` /
|
|
553
807
|
* `github:` / `https://` or that contain `..`. Defaults to false; the CLI
|
|
@@ -559,6 +813,12 @@ interface InitCommandOptions {
|
|
|
559
813
|
ci?: CiProvider;
|
|
560
814
|
cwd?: string;
|
|
561
815
|
/**
|
|
816
|
+
* Walk the whole flow — prompts, task list, next-steps, mascot — but make no
|
|
817
|
+
* changes: skip the template fetch/copy, the feature applies, the dependency
|
|
818
|
+
* install, and `git init`. Each skipped action logs a `would …` line instead.
|
|
819
|
+
*/
|
|
820
|
+
dryRun?: boolean;
|
|
821
|
+
/**
|
|
562
822
|
* Local directory containing the template subdirs (e.g. `vite/`,
|
|
563
823
|
* `standalone/`). When provided, skips the network fetch entirely.
|
|
564
824
|
* Useful for offline runs, the clean-machine smoke test, and unit tests.
|
|
@@ -599,10 +859,10 @@ interface InitCommandOptions {
|
|
|
599
859
|
packageManagerProbe?: PackageManagerProbe;
|
|
600
860
|
/**
|
|
601
861
|
* 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
|
-
*
|
|
862
|
+
* interactive regardless of TTY, and these drive the feature multi-select,
|
|
863
|
+
* the auth-provider sub-select, and the storage bucket-name text input.
|
|
604
864
|
*/
|
|
605
|
-
prompt?: Pick<OfferDeps, "multiSelect" | "select">;
|
|
865
|
+
prompt?: Pick<OfferDeps, "multiSelect" | "select" | "text">;
|
|
606
866
|
/**
|
|
607
867
|
* Override the git ref (branch, tag, or commit) the default template source
|
|
608
868
|
* is fetched from. Takes precedence over the version-derived ref. Ignored
|
|
@@ -639,11 +899,6 @@ interface InitCommandResult {
|
|
|
639
899
|
files: ReadonlyArray<string>;
|
|
640
900
|
target: string;
|
|
641
901
|
}
|
|
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
902
|
declare const runInitCommand: (options: InitCommandOptions) => Promise<InitCommandResult>;
|
|
648
903
|
/** Narrow a raw `--template` value to a known {@link Template}. */
|
|
649
904
|
interface MigrateGenerateCommandOptions {
|
|
@@ -681,99 +936,6 @@ interface IndexItem extends CatalogItem {
|
|
|
681
936
|
declare const buildRegistryIndex: (root: string) => {
|
|
682
937
|
items: IndexItem[];
|
|
683
938
|
};
|
|
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
939
|
/** `lunora registry add` (one or more item names): scaffold items into the project. */
|
|
778
940
|
declare const runAddCommand: (options: AddCommandOptions) => Promise<AddCommandResult>;
|
|
779
941
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { COMMANDS, VERSION, runCli } from './packem_shared/COMMANDS-
|
|
1
|
+
export { COMMANDS, VERSION, runCli } from './packem_shared/COMMANDS-0BD3K1pb.mjs';
|
|
2
2
|
export { runCodegenCommand } from './packem_chunks/runCodegenCommand.mjs';
|
|
3
|
-
export { DEFAULT_IMPORT_BATCH_SIZE, runExportCommand, runImportCommand } from './packem_shared/DEFAULT_IMPORT_BATCH_SIZE-
|
|
3
|
+
export { DEFAULT_IMPORT_BATCH_SIZE, runExportCommand, runImportCommand } from './packem_shared/DEFAULT_IMPORT_BATCH_SIZE-CRQmmBZM.mjs';
|
|
4
4
|
export { runDeployCommand } from './packem_chunks/runDeployCommand.mjs';
|
|
5
5
|
export { planDevCommand, runDevCommand } from './packem_chunks/planDevCommand.mjs';
|
|
6
6
|
export { runInitCommand } from './packem_chunks/runInitCommand.mjs';
|
|
@@ -8,12 +8,12 @@ export { runMigrateGenerateCommand } from './packem_chunks/runMigrateGenerateCom
|
|
|
8
8
|
export { runResetCommand } from './packem_chunks/runResetCommand.mjs';
|
|
9
9
|
export { runRpcCommand } from './packem_chunks/runRpcCommand.mjs';
|
|
10
10
|
export { default as parseArgs } from './packem_shared/parseArgs-YXFuKdEk.mjs';
|
|
11
|
-
export { insertSchemaExtension } from './packem_shared/insertSchemaExtension-
|
|
12
|
-
export { createLogger, pail } from './packem_shared/createLogger-
|
|
11
|
+
export { insertSchemaExtension } from './packem_shared/insertSchemaExtension-DAqbfr9Z.mjs';
|
|
12
|
+
export { createLogger, pail } from './packem_shared/createLogger-CIWSHrTL.mjs';
|
|
13
13
|
export { diffSnapshots, renderAddColumn, renderCreateIndex, renderCreateTable, renderDropIndex, renderDropTable, renderMigrationFile, validatorKindToSqlType } from './packem_shared/diffSnapshots-BeDvvNiF.mjs';
|
|
14
14
|
export { default as schemaIrToSnapshot } from './packem_shared/schemaIrToSnapshot-DdsljJT-.mjs';
|
|
15
|
-
export { createRecordingSpawner, defaultSpawner } from './packem_shared/createRecordingSpawner-
|
|
16
|
-
export { default as parseManifest } from './packem_shared/parseManifest
|
|
15
|
+
export { createRecordingSpawner, defaultSpawner } from './packem_shared/createRecordingSpawner-Cw5Iu73G.mjs';
|
|
16
|
+
export { default as parseManifest } from './packem_shared/parseManifest-BBrXCg9V.mjs';
|
|
17
17
|
export { REQUIRED_COMPATIBILITY_DATE, REQUIRED_FLAG, validateWranglerProject as validateWrangler, validateWranglerConfig } from '@lunora/config';
|
|
18
|
-
export { buildRegistryIndex } from './packem_shared/buildRegistryIndex-
|
|
19
|
-
export { r as runAddCommand, a as runBuildIndexCommand, b as runRegistryViewCommand } from './packem_shared/commands-
|
|
18
|
+
export { buildRegistryIndex } from './packem_shared/buildRegistryIndex-CqM5FwGI.mjs';
|
|
19
|
+
export { r as runAddCommand, a as runBuildIndexCommand, b as runRegistryViewCommand } from './packem_shared/commands-vnRRkhNE.mjs';
|