@lunora/cli 1.0.0-alpha.22 → 1.0.0-alpha.24

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 (41) hide show
  1. package/dist/bin.mjs +1 -1
  2. package/dist/index.d.mts +33 -0
  3. package/dist/index.d.ts +33 -0
  4. package/dist/index.mjs +2 -2
  5. package/dist/packem_chunks/handler.mjs +15 -5
  6. package/dist/packem_chunks/handler10.mjs +8 -14
  7. package/dist/packem_chunks/handler11.mjs +19 -189
  8. package/dist/packem_chunks/handler12.mjs +176 -115
  9. package/dist/packem_chunks/handler13.mjs +118 -52
  10. package/dist/packem_chunks/handler14.mjs +50 -43
  11. package/dist/packem_chunks/handler15.mjs +46 -67
  12. package/dist/packem_chunks/handler16.mjs +73 -37
  13. package/dist/packem_chunks/handler17.mjs +38 -100
  14. package/dist/packem_chunks/handler18.mjs +87 -152
  15. package/dist/packem_chunks/handler19.mjs +148 -67
  16. package/dist/packem_chunks/handler2.mjs +1 -1
  17. package/dist/packem_chunks/handler20.mjs +71 -76
  18. package/dist/packem_chunks/handler21.mjs +71 -288
  19. package/dist/packem_chunks/handler3.mjs +1 -1
  20. package/dist/packem_chunks/handler4.mjs +1 -1
  21. package/dist/packem_chunks/handler5.mjs +1 -1
  22. package/dist/packem_chunks/handler6.mjs +1 -1
  23. package/dist/packem_chunks/handler7.mjs +1 -1
  24. package/dist/packem_chunks/handler8.mjs +1 -1
  25. package/dist/packem_chunks/handler9.mjs +311 -12
  26. package/dist/packem_chunks/planDevCommand.mjs +2 -2
  27. package/dist/packem_chunks/runCodegenCommand.mjs +1 -1
  28. package/dist/packem_chunks/runDeployCommand.mjs +103 -13
  29. package/dist/packem_chunks/runInitCommand.mjs +44 -6
  30. package/dist/packem_chunks/runMigrateGenerateCommand.mjs +1 -1
  31. package/dist/packem_chunks/runResetCommand.mjs +2 -2
  32. package/dist/packem_chunks/runRpcCommand.mjs +1 -1
  33. package/dist/packem_shared/{COMMANDS-D3h9Iwvl.mjs → COMMANDS-B0ftFD_3.mjs} +20 -16
  34. package/dist/packem_shared/{command-BC30oSBW.mjs → command-D3lB_4Az.mjs} +5 -0
  35. package/dist/packem_shared/{commands-hl0mRqqg.mjs → commands-B-gR09Z_.mjs} +1 -1
  36. package/dist/packem_shared/prompt-cancelled-APzX1Im-.mjs +9 -0
  37. package/dist/packem_shared/{runAddCommand-vJdgiR5t.mjs → runAddCommand-bnY6-HKb.mjs} +1 -1
  38. package/dist/packem_shared/{storage-B7hHSTZP.mjs → storage-BIsph-Vk.mjs} +1 -1
  39. package/dist/packem_shared/{tui-prompts-M6OWsuyw.mjs → tui-prompts-BjEN8XgP.mjs} +2 -7
  40. package/dist/packem_shared/wrangler-secrets-P2_ZUR-k.mjs +47 -0
  41. package/package.json +3 -3
@@ -37,7 +37,8 @@ const addCommand = {
37
37
  name: "ref",
38
38
  type: String
39
39
  },
40
- { description: "Permit --source values outside gh:/github:/https://", name: "allow-unsafe-source", type: Boolean }
40
+ { description: "Permit --source values outside gh:/github:/https://", name: "allow-unsafe-source", type: Boolean },
41
+ { description: "Output format: pretty (default) or json", name: "format", type: String }
41
42
  ]
42
43
  };
43
44
 
@@ -260,21 +261,24 @@ const doctorCommand = {
260
261
  };
261
262
 
262
263
  const envCommand = {
263
- argument: { description: "list | get <KEY> | set <KEY> <VALUE> | unset <KEY> | push | diff | doctor", name: "subcommand", type: String },
264
- description: "Manage .dev.vars and sync secrets via wrangler (list | get | set | unset | push | diff | doctor)",
264
+ argument: { description: "list | get <KEY> | set <KEY> <VALUE> | unset <KEY> | generate [KEY] | push | diff | doctor", name: "subcommand", type: String },
265
+ description: "Manage .dev.vars and sync secrets via wrangler (list | get | set | unset | generate | push | diff | doctor)",
265
266
  examples: [
266
267
  ["lunora env list", "List .dev.vars keys"],
267
268
  ["lunora env set API_KEY secret", "Set a local variable"],
269
+ ["lunora env generate", "Generate strong values for the project's secrets (print KEY=value)"],
270
+ ["lunora env generate AUTH_SECRET --set", "Generate one secret and write it to .dev.vars"],
268
271
  ["lunora env push --yes", "Upload secrets to Cloudflare"],
269
272
  ["lunora env diff", "Compare local .dev.vars keys against Cloudflare"]
270
273
  ],
271
274
  group: "Data",
272
- loader: () => import('../packem_chunks/handler21.mjs').then((m) => {
275
+ loader: () => import('../packem_chunks/handler9.mjs').then((m) => {
273
276
  return { default: m.execute };
274
277
  }),
275
278
  name: "env",
276
279
  options: [
277
280
  { description: "Target production for `push` (passes --env production to wrangler)", name: "prod", type: Boolean },
281
+ { description: "For `generate` — write the generated secrets into .dev.vars instead of printing them", name: "set", type: Boolean },
278
282
  {
279
283
  description: "Push secrets to a temporary-account deployment when unauthenticated (wrangler secret put --temporary). Errors if you're already authenticated.",
280
284
  name: "temporary",
@@ -292,7 +296,7 @@ const exportCommand = {
292
296
  ["lunora export --tables messages,users", "Export only specific tables"]
293
297
  ],
294
298
  group: "Data",
295
- loader: () => import('../packem_chunks/handler9.mjs').then((m) => {
299
+ loader: () => import('../packem_chunks/handler10.mjs').then((m) => {
296
300
  return { default: m.execute };
297
301
  }),
298
302
  name: "export",
@@ -314,7 +318,7 @@ const importCommand = {
314
318
  description: "Bulk-insert rows from an NDJSON file via the worker's admin endpoint",
315
319
  examples: [["lunora import backup.ndjson", "Bulk-insert rows from an NDJSON file"]],
316
320
  group: "Data",
317
- loader: () => import('../packem_chunks/handler10.mjs').then((m) => {
321
+ loader: () => import('../packem_chunks/handler11.mjs').then((m) => {
318
322
  return { default: m.execute };
319
323
  }),
320
324
  name: "import",
@@ -338,7 +342,7 @@ const infoCommand = {
338
342
  ["lunora info --json", "Emit a JSON snapshot"]
339
343
  ],
340
344
  group: "Project",
341
- loader: () => import('../packem_chunks/handler11.mjs').then((m) => {
345
+ loader: () => import('../packem_chunks/handler12.mjs').then((m) => {
342
346
  return { default: m.execute };
343
347
  }),
344
348
  name: "info",
@@ -442,7 +446,7 @@ const insightsCommand = {
442
446
  ["lunora insights --prod --url https://app.example.com --token $LUNORA_ADMIN_TOKEN", "Report against production"]
443
447
  ],
444
448
  group: "Develop",
445
- loader: () => import('../packem_chunks/handler12.mjs').then((m) => {
449
+ loader: () => import('../packem_chunks/handler13.mjs').then((m) => {
446
450
  return { default: m.execute };
447
451
  }),
448
452
  name: "insights",
@@ -464,7 +468,7 @@ const linkCommand = {
464
468
  ["lunora link --remove", "Remove the link"]
465
469
  ],
466
470
  group: "Deploy",
467
- loader: () => import('../packem_chunks/handler13.mjs').then((m) => {
471
+ loader: () => import('../packem_chunks/handler14.mjs').then((m) => {
468
472
  return { default: m.execute };
469
473
  }),
470
474
  name: "link",
@@ -480,7 +484,7 @@ const logsCommand = {
480
484
  argument: { description: "Worker name (defaults to the name in wrangler config)", name: "worker", type: String },
481
485
  description: "Stream live logs from a deployed Lunora Worker",
482
486
  group: "Deploy",
483
- loader: () => import('../packem_chunks/handler14.mjs').then((m) => {
487
+ loader: () => import('../packem_chunks/handler15.mjs').then((m) => {
484
488
  return { default: m.execute };
485
489
  }),
486
490
  name: "logs",
@@ -540,7 +544,7 @@ const prepareCommand = {
540
544
  description: "Run codegen + binding reconcile + wrangler validation (no Vite) — for CI",
541
545
  examples: [["lunora prepare", "Codegen + binding reconcile + validate (CI, before deploy)"]],
542
546
  group: "Deploy",
543
- loader: () => import('../packem_chunks/handler15.mjs').then((m) => {
547
+ loader: () => import('../packem_chunks/handler16.mjs').then((m) => {
544
548
  return { default: m.execute };
545
549
  }),
546
550
  name: "prepare",
@@ -564,7 +568,7 @@ const registryCommand = {
564
568
  ["lunora registry build --check", "Verify the committed catalog is current"]
565
569
  ],
566
570
  group: "Project",
567
- loader: () => import('../packem_chunks/handler16.mjs').then((m) => {
571
+ loader: () => import('../packem_chunks/handler17.mjs').then((m) => {
568
572
  return { default: m.execute };
569
573
  }),
570
574
  name: "registry",
@@ -614,7 +618,7 @@ const rulesCommand = {
614
618
  ["lunora rules check --strict", "Exit non-zero when rules are missing (CI gate)"]
615
619
  ],
616
620
  group: "Project",
617
- loader: () => import('../packem_chunks/handler17.mjs').then((m) => {
621
+ loader: () => import('../packem_chunks/handler18.mjs').then((m) => {
618
622
  return { default: m.execute };
619
623
  }),
620
624
  name: "rules",
@@ -652,7 +656,7 @@ const seedCommand = {
652
656
  ["lunora seed --seed 7 --dry-run", "Print the NDJSON for seed 7 without inserting"]
653
657
  ],
654
658
  group: "Data",
655
- loader: () => import('../packem_chunks/handler18.mjs').then((m) => {
659
+ loader: () => import('../packem_chunks/handler19.mjs').then((m) => {
656
660
  return { default: m.execute };
657
661
  }),
658
662
  name: "seed",
@@ -681,7 +685,7 @@ const verifyCommand = {
681
685
  ["lunora verify --no-typecheck", "Skip the TypeScript type-check"]
682
686
  ],
683
687
  group: "Deploy",
684
- loader: () => import('../packem_chunks/handler19.mjs').then((m) => {
688
+ loader: () => import('../packem_chunks/handler20.mjs').then((m) => {
685
689
  return { default: m.execute };
686
690
  }),
687
691
  name: "verify",
@@ -700,7 +704,7 @@ const viewCommand = {
700
704
  ["lunora view --remote", "Open the deployed studio"]
701
705
  ],
702
706
  group: "Project",
703
- loader: () => import('../packem_chunks/handler20.mjs').then((m) => {
707
+ loader: () => import('../packem_chunks/handler21.mjs').then((m) => {
704
708
  return { default: m.execute };
705
709
  }),
706
710
  name: "view",
@@ -1,4 +1,5 @@
1
1
  import { createLogger } from './createLogger-B40gPzQo.mjs';
2
+ import { P as PromptCancelledError, a as PROMPT_CANCEL_EXIT_CODE } from './prompt-cancelled-APzX1Im-.mjs';
2
3
 
3
4
  const defineHandler = (body) => async (toolbox) => {
4
5
  const logger = createLogger();
@@ -6,6 +7,10 @@ const defineHandler = (body) => async (toolbox) => {
6
7
  const { code } = await body({ argument: toolbox.argument, cwd: toolbox.process.cwd, logger, options: toolbox.options });
7
8
  toolbox.process.exit(code);
8
9
  } catch (error) {
10
+ if (error instanceof PromptCancelledError) {
11
+ toolbox.process.exit(PROMPT_CANCEL_EXIT_CODE);
12
+ return;
13
+ }
9
14
  logger.error(error instanceof Error ? error.message : String(error));
10
15
  toolbox.process.exit(1);
11
16
  }
@@ -3,7 +3,7 @@ import { dirname, join } from '@visulima/path';
3
3
  import { DEV_VARS_FILE, parseDevVariableEntries } from '@lunora/config';
4
4
  import { modify, applyEdits, parse } from 'jsonc-parser';
5
5
  import { fileURLToPath } from 'node:url';
6
- import { b as tuiConfirm } from './tui-prompts-M6OWsuyw.mjs';
6
+ import { b as tuiConfirm } from './tui-prompts-BjEN8XgP.mjs';
7
7
  import { collectCatalog, buildRegistryIndex } from './buildRegistryIndex-BcYe607_.mjs';
8
8
  import { insertSchemaExtension } from './insertSchemaExtension-DAqbfr9Z.mjs';
9
9
  import { createHash } from 'node:crypto';
@@ -0,0 +1,9 @@
1
+ class PromptCancelledError extends Error {
2
+ constructor() {
3
+ super("cancelled");
4
+ this.name = "PromptCancelledError";
5
+ }
6
+ }
7
+ const PROMPT_CANCEL_EXIT_CODE = 130;
8
+
9
+ export { PromptCancelledError as P, PROMPT_CANCEL_EXIT_CODE as a };
@@ -1,4 +1,4 @@
1
1
  import 'node:fs';
2
2
  import '@visulima/path';
3
- export { r as runAddCommand, a as runBuildIndexCommand, f as runListCommand, b as runRegistryViewCommand } from './commands-hl0mRqqg.mjs';
3
+ export { r as runAddCommand, a as runBuildIndexCommand, f as runListCommand, b as runRegistryViewCommand } from './commands-B-gR09Z_.mjs';
4
4
  import './buildRegistryIndex-BcYe607_.mjs';
@@ -1,4 +1,4 @@
1
- import { s as setBindingField } from './commands-hl0mRqqg.mjs';
1
+ import { s as setBindingField } from './commands-B-gR09Z_.mjs';
2
2
 
3
3
  const INVALID_SLUG_CHARS = /[^a-z0-9]+/u;
4
4
  const toKebabSlug = (input, min, max) => {
@@ -13,6 +13,7 @@ import { useApp } from '@visulima/tui/hooks/use-app';
13
13
  import { useInput } from '@visulima/tui/hooks/use-input';
14
14
  import { useInterval } from '@visulima/tui/hooks/use-interval';
15
15
  import { useEffect, useState } from 'react';
16
+ import { P as PromptCancelledError } from './prompt-cancelled-APzX1Im-.mjs';
16
17
 
17
18
  let listenerCapRaised = false;
18
19
  const raiseListenerCap = () => {
@@ -24,12 +25,6 @@ const raiseListenerCap = () => {
24
25
  process.setMaxListeners(64);
25
26
  }
26
27
  };
27
- class PromptCancelledError extends Error {
28
- constructor() {
29
- super("cancelled");
30
- this.name = "PromptCancelledError";
31
- }
32
- }
33
28
  const CtrlCGuard = ({ children, onCancel }) => {
34
29
  const { exit } = useApp();
35
30
  useInput((input, key) => {
@@ -660,4 +655,4 @@ const withTuiBadgeProgress = async (badge, steps, done) => {
660
655
  return outcome.values;
661
656
  };
662
657
 
663
- export { PromptCancelledError as P, tuiSelect as a, tuiConfirm as b, createTuiConfirm as c, tuiMascot as d, tuiStep as e, tuiMoonrise as f, tuiHeadline as g, tuiInfo as h, tuiNextSteps as i, tuiTasks as j, tuiMultiSelect as k, withTuiBadgeProgress as l, tuiText as t, withTuiSpinner as w };
658
+ export { tuiSelect as a, tuiConfirm as b, createTuiConfirm as c, tuiMascot as d, tuiStep as e, tuiMoonrise as f, tuiHeadline as g, tuiInfo as h, tuiNextSteps as i, tuiTasks as j, tuiMultiSelect as k, withTuiBadgeProgress as l, tuiText as t, withTuiSpinner as w };
@@ -0,0 +1,47 @@
1
+ import { execFile } from 'node:child_process';
2
+
3
+ const execCode = (error) => {
4
+ if (!error) {
5
+ return 0;
6
+ }
7
+ return typeof error.code === "number" ? error.code : 1;
8
+ };
9
+ const defaultRunner = (command, args, cwd) => new Promise((resolve) => {
10
+ execFile(command, [...args], { cwd }, (error, stdout, stderr) => {
11
+ resolve({ code: execCode(error), stderr, stdout });
12
+ });
13
+ });
14
+ const parseSecretNames = (stdout) => {
15
+ let parsed;
16
+ try {
17
+ parsed = JSON.parse(stdout);
18
+ } catch {
19
+ return void 0;
20
+ }
21
+ if (!Array.isArray(parsed)) {
22
+ return void 0;
23
+ }
24
+ const names = parsed.map((entry) => entry !== null && typeof entry === "object" ? entry.name : void 0).filter((name) => typeof name === "string" && name.length > 0);
25
+ return [...names].toSorted((a, b) => a.localeCompare(b));
26
+ };
27
+ const listRemoteSecrets = async (inputs) => {
28
+ const args = ["exec", "wrangler", "secret", "list", "--format", "json"];
29
+ if (inputs.env !== void 0) {
30
+ args.push("--env", inputs.env);
31
+ }
32
+ if (inputs.temporary) {
33
+ args.push("--temporary");
34
+ }
35
+ const runner = inputs.runner ?? defaultRunner;
36
+ const result = await runner("pnpm", args, inputs.cwd);
37
+ if (result.code !== 0) {
38
+ return { error: result.stderr.trim() || `wrangler secret list exited ${String(result.code)}`, names: [], ok: false };
39
+ }
40
+ const names = parseSecretNames(result.stdout);
41
+ if (names === void 0) {
42
+ return { error: "could not parse `wrangler secret list --format json` output", names: [], ok: false };
43
+ }
44
+ return { names, ok: true };
45
+ };
46
+
47
+ export { listRemoteSecrets as l };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/cli",
3
- "version": "1.0.0-alpha.22",
3
+ "version": "1.0.0-alpha.24",
4
4
  "description": "The Lunora CLI: init, dev, deploy, codegen, run, reset, and migrate commands",
5
5
  "keywords": [
6
6
  "agent-skills",
@@ -52,8 +52,8 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "@bomb.sh/tab": "0.0.16",
55
- "@lunora/codegen": "1.0.0-alpha.7",
56
- "@lunora/config": "1.0.0-alpha.12",
55
+ "@lunora/codegen": "1.0.0-alpha.8",
56
+ "@lunora/config": "1.0.0-alpha.14",
57
57
  "@lunora/container": "1.0.0-alpha.1",
58
58
  "@lunora/d1": "1.0.0-alpha.4",
59
59
  "@lunora/seed": "1.0.0-alpha.2",