@lunora/cli 1.0.0-alpha.2 → 1.0.0-alpha.200

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 (109) hide show
  1. package/LICENSE.md +33 -0
  2. package/README.md +1 -1
  3. package/__assets__/package-og.svg +1 -1
  4. package/dist/bin.mjs +2 -10
  5. package/dist/index.d.mts +797 -358
  6. package/dist/index.d.ts +797 -358
  7. package/dist/index.mjs +1 -19
  8. package/dist/packem_chunks/handler.mjs +1 -76
  9. package/dist/packem_chunks/handler10.mjs +2 -22
  10. package/dist/packem_chunks/handler11.mjs +2 -192
  11. package/dist/packem_chunks/handler12.mjs +1 -131
  12. package/dist/packem_chunks/handler13.mjs +1 -65
  13. package/dist/packem_chunks/handler14.mjs +1 -58
  14. package/dist/packem_chunks/handler15.mjs +1 -79
  15. package/dist/packem_chunks/handler16.mjs +3 -41
  16. package/dist/packem_chunks/handler17.mjs +1 -105
  17. package/dist/packem_chunks/handler18.mjs +1 -172
  18. package/dist/packem_chunks/handler19.mjs +7 -89
  19. package/dist/packem_chunks/handler2.mjs +2 -114
  20. package/dist/packem_chunks/handler20.mjs +2 -94
  21. package/dist/packem_chunks/handler21.mjs +2 -311
  22. package/dist/packem_chunks/handler22.mjs +3 -0
  23. package/dist/packem_chunks/handler23.mjs +3 -0
  24. package/dist/packem_chunks/handler24.mjs +1 -0
  25. package/dist/packem_chunks/handler25.mjs +99 -0
  26. package/dist/packem_chunks/handler26.mjs +10 -0
  27. package/dist/packem_chunks/handler3.mjs +1 -204
  28. package/dist/packem_chunks/handler4.mjs +1 -33
  29. package/dist/packem_chunks/handler5.mjs +1 -49
  30. package/dist/packem_chunks/handler6.mjs +1 -91
  31. package/dist/packem_chunks/handler7.mjs +3 -42
  32. package/dist/packem_chunks/handler8.mjs +1 -174
  33. package/dist/packem_chunks/handler9.mjs +1 -16
  34. package/dist/packem_chunks/planDevCommand.mjs +7 -543
  35. package/dist/packem_chunks/runCodegenCommand.mjs +4 -52
  36. package/dist/packem_chunks/runDeployCommand.mjs +1 -504
  37. package/dist/packem_chunks/runInitCommand.mjs +1141 -565
  38. package/dist/packem_chunks/runMigrateGenerateCommand.mjs +9 -395
  39. package/dist/packem_chunks/runResetCommand.mjs +1 -41
  40. package/dist/packem_chunks/runRpcCommand.mjs +1 -68
  41. package/dist/packem_shared/COMMANDS-su5nmqYP.mjs +1 -0
  42. package/dist/packem_shared/DEFAULT_IMPORT_BATCH_SIZE-Nf7GsE6v.mjs +1 -0
  43. package/dist/packem_shared/admin-token-rxXZbVMZ.mjs +1 -0
  44. package/dist/packem_shared/admin-url-Cil3Or6N.mjs +1 -0
  45. package/dist/packem_shared/advisory-gate-Cl8IEFIj.mjs +1 -0
  46. package/dist/packem_shared/api-spec-lYyq4vL6.mjs +1 -0
  47. package/dist/packem_shared/buildRegistryIndex-Zi3bBqpc.mjs +1 -0
  48. package/dist/packem_shared/cli-RB-BoDnW.mjs +3 -0
  49. package/dist/packem_shared/codegen-error-C04fGQjf.mjs +3 -0
  50. package/dist/packem_shared/command-DwC11Cwe.mjs +1 -0
  51. package/dist/packem_shared/commands-BOgN2nF7.mjs +19 -0
  52. package/dist/packem_shared/createLogger-hGafwf-3.mjs +2 -0
  53. package/dist/packem_shared/createRecordingSpawner-DJlNacZ6.mjs +1 -0
  54. package/dist/packem_shared/deploy-target-D9GPy_tq.mjs +1 -0
  55. package/dist/packem_shared/detect-package-manager-DSaAqRof.mjs +1 -0
  56. package/dist/packem_shared/diffSnapshots-CIOFQN_a.mjs +5 -0
  57. package/dist/packem_shared/docker-DpVxvYpL.mjs +1 -0
  58. package/dist/packem_shared/health-probe-QEPfFdgJ.mjs +1 -0
  59. package/dist/packem_shared/import-CrVGrOt3.mjs +12 -0
  60. package/dist/packem_shared/insertSchemaExtension-DY4pA8wE.mjs +8 -0
  61. package/dist/packem_shared/lint-ignore-report-CDbcbtv7.mjs +2 -0
  62. package/dist/packem_shared/open-url-EnKy--w-.mjs +1 -0
  63. package/dist/packem_shared/output-format-DfogXx0p.mjs +2 -0
  64. package/dist/packem_shared/parseManifest-CwPTKdtS.mjs +1 -0
  65. package/dist/packem_shared/path-containment-CgxYZggb.mjs +1 -0
  66. package/dist/packem_shared/platform-diagnostics-uOXqysk3.mjs +4 -0
  67. package/dist/packem_shared/post-codegen-hook-DRdEoTsQ.mjs +1 -0
  68. package/dist/packem_shared/prompt-cancelled-C8Sj7OqI.mjs +1 -0
  69. package/dist/packem_shared/resolve-DZAGzg67.mjs +1 -0
  70. package/dist/packem_shared/resolve-target-C_ZloTvd.mjs +1 -0
  71. package/dist/packem_shared/runAddCommand-BXz-PXbb.mjs +1 -0
  72. package/dist/packem_shared/runExportCommand-DmXKEWSq.mjs +5 -0
  73. package/dist/packem_shared/schema-drift-gate-AscQpYH5.mjs +1 -0
  74. package/dist/packem_shared/schemaIrToSnapshot-qpRoV7HY.mjs +1 -0
  75. package/dist/packem_shared/shared-D-zCOmgY.mjs +1 -0
  76. package/dist/packem_shared/tui-prompts-Dd0pDuNr.mjs +4 -0
  77. package/dist/packem_shared/vectorize-metadata-DbziRKpX.mjs +1 -0
  78. package/dist/packem_shared/wrangler-name-Dsk5K1f-.mjs +1 -0
  79. package/dist/packem_shared/wrangler-secrets-CE7jcf8E.mjs +1 -0
  80. package/package.json +43 -19
  81. package/skills/README.md +35 -17
  82. package/skills/lunora/SKILL.md +65 -9
  83. package/skills/lunora-functions/SKILL.md +38 -3
  84. package/skills/lunora-migration-helper/SKILL.md +70 -17
  85. package/skills/lunora-performance-audit/SKILL.md +36 -6
  86. package/skills/lunora-quickstart/SKILL.md +90 -24
  87. package/skills/lunora-realtime/SKILL.md +58 -30
  88. package/skills/lunora-setup-storage/SKILL.md +7 -3
  89. package/dist/packem_shared/COMMANDS-1V_KEx35.mjs +0 -905
  90. package/dist/packem_shared/DEFAULT_IMPORT_BATCH_SIZE-Ck-2bU08.mjs +0 -244
  91. package/dist/packem_shared/admin-url-4UzT-CI4.mjs +0 -19
  92. package/dist/packem_shared/api-spec-CtA6ilu4.mjs +0 -13
  93. package/dist/packem_shared/buildRegistryIndex-BcYe607_.mjs +0 -38
  94. package/dist/packem_shared/command-BDXcJCCJ.mjs +0 -14
  95. package/dist/packem_shared/createLogger-CHPNjFw2.mjs +0 -73
  96. package/dist/packem_shared/defaultSpawner-DxI3mebw.mjs +0 -43
  97. package/dist/packem_shared/diffSnapshots-RR2ZE8Ya.mjs +0 -161
  98. package/dist/packem_shared/docker-hMQ97KSQ.mjs +0 -21
  99. package/dist/packem_shared/features-ocSSpZtS.mjs +0 -24
  100. package/dist/packem_shared/insertSchemaExtension-BuzF6-t2.mjs +0 -59
  101. package/dist/packem_shared/open-url-Dfq6fAyT.mjs +0 -41
  102. package/dist/packem_shared/output-format-7gyGR3h8.mjs +0 -17
  103. package/dist/packem_shared/parseArgs-YXFuKdEk.mjs +0 -56
  104. package/dist/packem_shared/parseManifest--vZf2FY1.mjs +0 -94
  105. package/dist/packem_shared/resolve-target-qbsJ_5sF.mjs +0 -16
  106. package/dist/packem_shared/runAddCommand-BZGkRnBs.mjs +0 -693
  107. package/dist/packem_shared/schema-drift-gate-BtBt0as0.mjs +0 -79
  108. package/dist/packem_shared/schemaIrToSnapshot-aBTo7TM5.mjs +0 -43
  109. package/dist/packem_shared/wrangler-name-cy4yhm9j.mjs +0 -12
@@ -1,174 +1 @@
1
- import { existsSync, readFileSync } from 'node:fs';
2
- import { join } from 'node:path';
3
- import { findWranglerFile, readWranglerJsonc, validateWranglerConfig, isPlaceholderValue, DEV_VARS_FILE, parseDevVariableEntries, inferLunoraBindings } from '@lunora/config';
4
- import { d as defineHandler } from '../packem_shared/command-BDXcJCCJ.mjs';
5
-
6
- const SECRET_KEY_PATTERN = /(?:KEY|PASSWORD|SECRET|TOKEN)$/u;
7
- const isD1PlaceholderId = (databaseId) => {
8
- const value = databaseId.trim();
9
- if (value === "") {
10
- return true;
11
- }
12
- const lower = value.toLowerCase();
13
- return lower.includes("replace") || lower.startsWith("<") && lower.endsWith(">");
14
- };
15
- const readWrangler = (cwd) => {
16
- const path = findWranglerFile(cwd);
17
- if (path === void 0) {
18
- return { parsed: void 0, path: void 0 };
19
- }
20
- const { parsed } = readWranglerJsonc(path);
21
- return { parsed, path };
22
- };
23
- const checkWrangler = (parsed, path, findings) => {
24
- if (path === void 0) {
25
- findings.push({
26
- fix: "Run `lunora init` (or `lunora dev`) to scaffold and reconcile wrangler.jsonc.",
27
- level: "fail",
28
- message: "wrangler.jsonc not found."
29
- });
30
- return;
31
- }
32
- if (parsed === void 0) {
33
- findings.push({ fix: `Check ${path} is valid JSONC.`, level: "fail", message: `Could not parse ${path}.` });
34
- return;
35
- }
36
- const report = validateWranglerConfig(parsed);
37
- const shardError = report.errors.find((error) => error.includes("SHARD"));
38
- if (shardError === void 0) {
39
- findings.push({ level: "pass", message: "wrangler.jsonc present with a SHARD durable-object binding." });
40
- } else {
41
- findings.push({ fix: "Run `lunora dev` to auto-reconcile, or add the binding manually.", level: "fail", message: shardError });
42
- }
43
- };
44
- const checkD1Placeholders = (parsed, findings) => {
45
- if (parsed === void 0) {
46
- return;
47
- }
48
- const databases = (parsed.d1_databases ?? []).filter(Boolean);
49
- for (const database of databases) {
50
- const databaseId = typeof database.database_id === "string" ? database.database_id : "";
51
- if (isD1PlaceholderId(databaseId)) {
52
- const label = typeof database.binding === "string" && database.binding.length > 0 ? database.binding : "<unnamed>";
53
- findings.push({
54
- fix: "Run `wrangler d1 create <name>` and paste the returned database_id into wrangler.jsonc.",
55
- level: "fail",
56
- message: `D1 binding "${label}" has a placeholder database_id ("${databaseId || "<empty>"}").`
57
- });
58
- }
59
- }
60
- };
61
- const checkEmailDestination = (parsed, findings) => {
62
- if (parsed === void 0) {
63
- return;
64
- }
65
- const bindings = (parsed.send_email ?? []).filter(Boolean);
66
- for (const binding of bindings) {
67
- const destination = typeof binding.destination_address === "string" ? binding.destination_address : "";
68
- if (destination !== "" && isPlaceholderValue(destination)) {
69
- const label = typeof binding.name === "string" && binding.name.length > 0 ? binding.name : "send_email";
70
- findings.push({
71
- fix: "Set destination_address to a verified Cloudflare Email Routing address.",
72
- level: "warn",
73
- message: `send_email binding "${label}" has a placeholder destination_address ("${destination}").`
74
- });
75
- }
76
- }
77
- };
78
- const checkDevVariables = (cwd, findings) => {
79
- const devVariablesPath = join(cwd, DEV_VARS_FILE);
80
- if (!existsSync(devVariablesPath)) {
81
- return;
82
- }
83
- let content;
84
- try {
85
- content = readFileSync(devVariablesPath, "utf8");
86
- } catch {
87
- return;
88
- }
89
- const unfilled = parseDevVariableEntries(content).filter((entry) => SECRET_KEY_PATTERN.test(entry.key) && isPlaceholderValue(entry.value)).map((entry) => entry.key);
90
- if (unfilled.length > 0) {
91
- findings.push({
92
- fix: "Run `lunora dev` to auto-generate secrets, or fill them in by hand.",
93
- level: "warn",
94
- message: `${DEV_VARS_FILE} has unfilled secret value(s): ${unfilled.join(", ")}.`
95
- });
96
- }
97
- };
98
- const checkAdminToken = (findings) => {
99
- const token = process.env.LUNORA_ADMIN_TOKEN;
100
- if (token === void 0 || token.trim() === "") {
101
- findings.push({
102
- fix: "Set LUNORA_ADMIN_TOKEN (env or `.dev.vars`) to enable admin RPCs / studio.",
103
- level: "info",
104
- message: "LUNORA_ADMIN_TOKEN is not set."
105
- });
106
- } else {
107
- findings.push({ level: "pass", message: "LUNORA_ADMIN_TOKEN is set." });
108
- }
109
- };
110
- const checkContainers = async (cwd, findings) => {
111
- let containers;
112
- try {
113
- ({ containers } = await inferLunoraBindings({ projectRoot: cwd }));
114
- } catch {
115
- return;
116
- }
117
- for (const container of containers) {
118
- if (container.exported) {
119
- findings.push({ level: "pass", message: `container "${container.exportName}" is exported by the worker entry.` });
120
- } else {
121
- findings.push({
122
- fix: 'Add `export * from "./lunora/_generated/containers"` to your worker entry (or re-run `vis generate lunora-container`).',
123
- level: "fail",
124
- message: `container "${container.exportName}" is declared but ${container.className} is not exported by the worker entry.`
125
- });
126
- }
127
- }
128
- };
129
- const runDoctor = async (options) => {
130
- const cwd = options.cwd ?? process.cwd();
131
- const findings = [];
132
- const { parsed, path } = readWrangler(cwd);
133
- checkWrangler(parsed, path, findings);
134
- checkD1Placeholders(parsed, findings);
135
- checkEmailDestination(parsed, findings);
136
- checkDevVariables(cwd, findings);
137
- checkAdminToken(findings);
138
- await checkContainers(cwd, findings);
139
- const code = findings.some((finding) => finding.level === "fail") ? 1 : 0;
140
- return { code, findings };
141
- };
142
- const LEVEL_LABEL = { fail: "FAIL", info: "INFO", pass: "PASS", warn: "WARN" };
143
- const renderReport = (result, logger) => {
144
- logger.info("lunora doctor — project preflight");
145
- for (const finding of result.findings) {
146
- const line = `[${LEVEL_LABEL[finding.level]}] ${finding.message}`;
147
- if (finding.level === "fail") {
148
- logger.error(line);
149
- } else if (finding.level === "warn") {
150
- logger.warn(line);
151
- } else {
152
- logger.info(line);
153
- }
154
- if (finding.fix !== void 0 && finding.level !== "pass") {
155
- logger.info(` fix: ${finding.fix}`);
156
- }
157
- }
158
- const fails = result.findings.filter((finding) => finding.level === "fail").length;
159
- const warns = result.findings.filter((finding) => finding.level === "warn").length;
160
- if (fails > 0) {
161
- logger.error(`${String(fails)} failure(s), ${String(warns)} warning(s).`);
162
- } else if (warns > 0) {
163
- logger.warn(`0 failures, ${String(warns)} warning(s).`);
164
- } else {
165
- logger.success("all checks passed.");
166
- }
167
- };
168
- const execute = defineHandler(async ({ cwd, logger }) => {
169
- const result = await runDoctor({ cwd});
170
- renderReport(result, logger);
171
- return { code: result.code };
172
- });
173
-
174
- export { execute, runDoctor };
1
+ import{d as u}from"../packem_shared/command-DwC11Cwe.mjs";import{a as d}from"../packem_shared/resolve-target-C_ZloTvd.mjs";import{runExportCommand as l}from"../packem_shared/runExportCommand-DmXKEWSq.mjs";const p=u(({argument:o,cwd:e,logger:t,options:r})=>l({cwd:e,logger:t,out:o[0]??r.out,prod:r.prod===!0,tables:r.tables,token:r.token,url:d({cwd:e,prod:r.prod===!0,url:r.url})}));export{p as execute};
@@ -1,16 +1 @@
1
- import { d as defineHandler } from '../packem_shared/command-BDXcJCCJ.mjs';
2
- import { a as resolveProductionWorkerUrl } from '../packem_shared/resolve-target-qbsJ_5sF.mjs';
3
- import { runExportCommand } from '../packem_shared/DEFAULT_IMPORT_BATCH_SIZE-Ck-2bU08.mjs';
4
-
5
- const execute = defineHandler(
6
- ({ argument, cwd, logger, options }) => runExportCommand({
7
- logger,
8
- out: argument[0] ?? options.out,
9
- prod: options.prod === true,
10
- tables: options.tables,
11
- token: options.token,
12
- url: resolveProductionWorkerUrl({ cwd, prod: options.prod === true, url: options.url })
13
- })
14
- );
15
-
16
- export { execute };
1
+ import{d as o}from"../packem_shared/command-DwC11Cwe.mjs";import{a as f}from"../packem_shared/resolve-target-C_ZloTvd.mjs";import{I as u,r as d}from"../packem_shared/import-CrVGrOt3.mjs";const n=o(({argument:m,cwd:a,logger:e,options:r})=>{const t=m[0];return t?r.from!==void 0&&!u.includes(r.from)?(e.error(`--from ${r.from} is not a known source. Expected one of: ${u.join(", ")}.`),{code:1}):d({batchSize:r.batchSize,cwd:a,file:t,from:r.from,logger:e,prod:r.prod===!0,scan:r.scan===!0,storageDir:r.storageDir,table:r.table,token:r.token,url:f({cwd:a,prod:r.prod===!0,url:r.url}),verify:r.verify===!0,withStorage:r.withStorage===!0,yes:r.yes===!0}):(e.error("import requires a path. Usage: lunora import <file.ndjson | convex-export-dir> [--table <name>]"),{code:1})});export{n as execute};