@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.
- package/__assets__/package-og.svg +1 -1
- package/dist/bin.mjs +1 -1
- package/dist/index.d.mts +238 -115
- package/dist/index.d.ts +238 -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 +561 -32
- package/dist/packem_chunks/runCodegenCommand.mjs +5 -4
- package/dist/packem_chunks/runDeployCommand.mjs +115 -20
- package/dist/packem_chunks/runInitCommand.mjs +1601 -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-Cxo6Tpyx.mjs} +10 -1
- 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-P2_ZUR-k.mjs +47 -0
- package/package.json +8 -6
- 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,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
|
|
481
|
-
* child process. Vite
|
|
482
|
-
*
|
|
483
|
-
*
|
|
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
|
-
/**
|
|
520
|
-
|
|
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.
|
|
544
|
-
*
|
|
545
|
-
*
|
|
546
|
-
*
|
|
547
|
-
*
|
|
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
|
-
*
|
|
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
|
/**
|
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';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import { findWranglerFile } from '@lunora/config';
|
|
3
|
-
import { join } from '@visulima/path';
|
|
4
|
-
import { d as defineHandler } from '../packem_shared/command-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { r as
|
|
3
|
+
import { join, basename } from '@visulima/path';
|
|
4
|
+
import { d as defineHandler } from '../packem_shared/command-lYnl4QyF.mjs';
|
|
5
|
+
import { v as validateOutputFormat, i as isJsonFormat, p as printJson, l as loggerForFormat } from '../packem_shared/output-format-B4642rjE.mjs';
|
|
6
|
+
import { t as tuiText, a as tuiSelect } from '../packem_shared/tui-prompts-BjEN8XgP.mjs';
|
|
7
|
+
import { n as normalizeFeature, E as EMAIL_ITEM, s as sanitizeBucketName, d as deriveBucketName, p as promptBucketName, r as resolveTypedDestination, M as MAIL_DESTINATION_PROMPT, a as sanitizeDatabaseName, b as deriveDatabaseName, c as promptDatabaseName, D as DEFAULT_AUTH_ITEM, e as promptAuthProvider, A as AUTH_PROVIDER_OPTIONS, w as withStorageBucketName, f as withMailDestination, g as withAuthDatabaseName } from '../packem_shared/storage-bGfgwOgF.mjs';
|
|
8
|
+
import { r as runAddCommand } from '../packem_shared/commands-vnRRkhNE.mjs';
|
|
8
9
|
|
|
9
10
|
const providerToItem = (provider) => {
|
|
10
11
|
const value = provider.trim().toLowerCase();
|
|
@@ -28,6 +29,51 @@ const resolveAuthItem = async (options) => {
|
|
|
28
29
|
const select = options.promptSelect ?? ((message, choices, settings) => tuiSelect(message, choices, settings));
|
|
29
30
|
return promptAuthProvider(select);
|
|
30
31
|
};
|
|
32
|
+
const textPrompt = (options) => options.promptText ?? ((message, settings) => tuiText(message, settings));
|
|
33
|
+
const resolveStorageBucketName = async (options) => {
|
|
34
|
+
const projectName = basename(options.cwd ?? process.cwd());
|
|
35
|
+
if (options.bucket !== void 0 && options.bucket !== "") {
|
|
36
|
+
const sanitized = sanitizeBucketName(options.bucket);
|
|
37
|
+
if (sanitized !== void 0) {
|
|
38
|
+
return sanitized;
|
|
39
|
+
}
|
|
40
|
+
const fallback = deriveBucketName(projectName);
|
|
41
|
+
options.logger.warn(`add: "${options.bucket}" isn't a valid R2 bucket name (lowercase alphanumeric + hyphens, 3–63 chars) — using "${fallback}".`);
|
|
42
|
+
return fallback;
|
|
43
|
+
}
|
|
44
|
+
if (options.yes === true) {
|
|
45
|
+
return deriveBucketName(projectName);
|
|
46
|
+
}
|
|
47
|
+
return promptBucketName(textPrompt(options), projectName);
|
|
48
|
+
};
|
|
49
|
+
const resolveMailDestination = async (options) => {
|
|
50
|
+
const warn = (message) => {
|
|
51
|
+
options.logger.warn(`add: ${message}`);
|
|
52
|
+
};
|
|
53
|
+
if (options.mailTo !== void 0 && options.mailTo !== "") {
|
|
54
|
+
return resolveTypedDestination(options.mailTo, warn);
|
|
55
|
+
}
|
|
56
|
+
if (options.yes === true) {
|
|
57
|
+
return void 0;
|
|
58
|
+
}
|
|
59
|
+
return resolveTypedDestination(await textPrompt(options)(MAIL_DESTINATION_PROMPT, { placeholder: "you@yourdomain.com" }), warn);
|
|
60
|
+
};
|
|
61
|
+
const resolveAuthDatabaseName = async (options) => {
|
|
62
|
+
const projectName = basename(options.cwd ?? process.cwd());
|
|
63
|
+
if (options.db !== void 0 && options.db !== "") {
|
|
64
|
+
const sanitized = sanitizeDatabaseName(options.db);
|
|
65
|
+
if (sanitized !== void 0) {
|
|
66
|
+
return sanitized;
|
|
67
|
+
}
|
|
68
|
+
const fallback = deriveDatabaseName(projectName);
|
|
69
|
+
options.logger.warn(`add: "${options.db}" isn't a usable D1 database name — using "${fallback}".`);
|
|
70
|
+
return fallback;
|
|
71
|
+
}
|
|
72
|
+
if (options.yes === true) {
|
|
73
|
+
return deriveDatabaseName(projectName);
|
|
74
|
+
}
|
|
75
|
+
return promptDatabaseName(textPrompt(options), projectName);
|
|
76
|
+
};
|
|
31
77
|
const resolveFeatureItems = async (feature, options) => {
|
|
32
78
|
if (feature.kind === "auth") {
|
|
33
79
|
return [await resolveAuthItem(options)];
|
|
@@ -49,6 +95,28 @@ const runAddFeature = async (options) => {
|
|
|
49
95
|
return { code: 1, items: [] };
|
|
50
96
|
}
|
|
51
97
|
const items = await resolveFeatureItems(feature, options);
|
|
98
|
+
const transforms = [];
|
|
99
|
+
if (items.includes("storage")) {
|
|
100
|
+
const bucketName = await resolveStorageBucketName(options);
|
|
101
|
+
transforms.push((manifest) => withStorageBucketName(manifest, bucketName));
|
|
102
|
+
}
|
|
103
|
+
if (items.includes("mail")) {
|
|
104
|
+
const destination = await resolveMailDestination(options);
|
|
105
|
+
if (destination !== void 0) {
|
|
106
|
+
transforms.push((manifest) => withMailDestination(manifest, destination));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (items.some((name) => name === "auth" || name.startsWith("auth-"))) {
|
|
110
|
+
const databaseName = await resolveAuthDatabaseName(options);
|
|
111
|
+
transforms.push((manifest) => withAuthDatabaseName(manifest, databaseName));
|
|
112
|
+
}
|
|
113
|
+
const transformManifest = transforms.length > 0 ? (manifest) => {
|
|
114
|
+
let result2 = manifest;
|
|
115
|
+
for (const transform of transforms) {
|
|
116
|
+
result2 = transform(result2);
|
|
117
|
+
}
|
|
118
|
+
return result2;
|
|
119
|
+
} : void 0;
|
|
52
120
|
const result = await runAddCommand({
|
|
53
121
|
allowUnsafeSource: options.allowUnsafeSource,
|
|
54
122
|
cwd,
|
|
@@ -57,22 +125,35 @@ const runAddFeature = async (options) => {
|
|
|
57
125
|
names: [...items],
|
|
58
126
|
ref: options.ref,
|
|
59
127
|
source: options.source,
|
|
128
|
+
transformManifest,
|
|
60
129
|
yes: true
|
|
61
130
|
});
|
|
62
131
|
return { code: result.code, items };
|
|
63
132
|
};
|
|
64
133
|
const execute = defineHandler(async ({ argument, cwd, logger, options }) => {
|
|
134
|
+
const formatError = validateOutputFormat("add", options.format);
|
|
135
|
+
if (formatError !== void 0) {
|
|
136
|
+
logger.error(formatError);
|
|
137
|
+
return { code: 1 };
|
|
138
|
+
}
|
|
139
|
+
const effectiveLogger = loggerForFormat(options.format, logger);
|
|
65
140
|
const result = await runAddFeature({
|
|
66
141
|
allowUnsafeSource: options.allowUnsafeSource === true,
|
|
142
|
+
bucket: options.bucket,
|
|
67
143
|
cwd,
|
|
144
|
+
db: options.db,
|
|
68
145
|
feature: argument[0],
|
|
69
146
|
from: options.from,
|
|
70
|
-
logger,
|
|
147
|
+
logger: effectiveLogger,
|
|
148
|
+
mailTo: options.mailTo,
|
|
71
149
|
provider: options.provider,
|
|
72
150
|
ref: options.ref,
|
|
73
151
|
source: options.source,
|
|
74
152
|
yes: options.yes === true
|
|
75
153
|
});
|
|
154
|
+
if (isJsonFormat(options.format)) {
|
|
155
|
+
printJson({ code: result.code, items: result.items });
|
|
156
|
+
}
|
|
76
157
|
return { code: result.code };
|
|
77
158
|
});
|
|
78
159
|
|