@lunora/cli 1.0.0-alpha.3 → 1.0.0-alpha.300

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 (118) 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 +1087 -368
  6. package/dist/index.d.ts +1087 -368
  7. package/dist/index.mjs +1 -19
  8. package/dist/packem_chunks/dispatch.mjs +1 -0
  9. package/dist/packem_chunks/handler.mjs +1 -78
  10. package/dist/packem_chunks/handler10.mjs +1 -22
  11. package/dist/packem_chunks/handler11.mjs +2 -192
  12. package/dist/packem_chunks/handler12.mjs +1 -131
  13. package/dist/packem_chunks/handler13.mjs +1 -65
  14. package/dist/packem_chunks/handler14.mjs +1 -58
  15. package/dist/packem_chunks/handler15.mjs +1 -79
  16. package/dist/packem_chunks/handler16.mjs +3 -43
  17. package/dist/packem_chunks/handler17.mjs +1 -105
  18. package/dist/packem_chunks/handler18.mjs +1 -172
  19. package/dist/packem_chunks/handler19.mjs +7 -89
  20. package/dist/packem_chunks/handler2.mjs +1 -114
  21. package/dist/packem_chunks/handler20.mjs +1 -94
  22. package/dist/packem_chunks/handler21.mjs +3 -311
  23. package/dist/packem_chunks/handler22.mjs +3 -0
  24. package/dist/packem_chunks/handler23.mjs +1 -0
  25. package/dist/packem_chunks/handler24.mjs +2 -0
  26. package/dist/packem_chunks/handler25.mjs +99 -0
  27. package/dist/packem_chunks/handler26.mjs +10 -0
  28. package/dist/packem_chunks/handler3.mjs +1 -204
  29. package/dist/packem_chunks/handler4.mjs +1 -33
  30. package/dist/packem_chunks/handler5.mjs +1 -49
  31. package/dist/packem_chunks/handler6.mjs +1 -91
  32. package/dist/packem_chunks/handler7.mjs +3 -42
  33. package/dist/packem_chunks/handler8.mjs +1 -174
  34. package/dist/packem_chunks/handler9.mjs +1 -16
  35. package/dist/packem_chunks/planDevCommand.mjs +7 -543
  36. package/dist/packem_chunks/runCodegenCommand.mjs +4 -52
  37. package/dist/packem_chunks/runDeployCommand.mjs +7 -504
  38. package/dist/packem_chunks/runInitCommand.mjs +1179 -544
  39. package/dist/packem_chunks/runResetCommand.mjs +1 -41
  40. package/dist/packem_chunks/runRpcCommand.mjs +1 -68
  41. package/dist/packem_shared/COMMANDS-DdaAWPtr.mjs +1 -0
  42. package/dist/packem_shared/DEFAULT_IMPORT_BATCH_SIZE-BgMPHEoe.mjs +1 -0
  43. package/dist/packem_shared/EXIT_CODE-08cwt3MK.mjs +1 -0
  44. package/dist/packem_shared/admin-token-VdUnvnKW.mjs +1 -0
  45. package/dist/packem_shared/admin-url-BhF5ufg1.mjs +1 -0
  46. package/dist/packem_shared/binding-manifest-file-CQ1eQYy1.mjs +2 -0
  47. package/dist/packem_shared/buildRegistryIndex-DVmy8fHE.mjs +1 -0
  48. package/dist/packem_shared/catalog-Cbzph90w.mjs +1 -0
  49. package/dist/packem_shared/cli-DOpChqUe.mjs +2 -0
  50. package/dist/packem_shared/codegen-error-AmH54ofi.mjs +3 -0
  51. package/dist/packem_shared/command-Mmxzxyr5.mjs +1 -0
  52. package/dist/packem_shared/commands-CdVObzRk.mjs +13 -0
  53. package/dist/packem_shared/createLogger-Cl18I8AX.mjs +2 -0
  54. package/dist/packem_shared/createRecordingSpawner-sS7LEN7x.mjs +1 -0
  55. package/dist/packem_shared/deploy-target-DCWwiuAe.mjs +1 -0
  56. package/dist/packem_shared/diffSnapshots-DtC5Cs4Z.mjs +5 -0
  57. package/dist/packem_shared/docker-DpVxvYpL.mjs +1 -0
  58. package/dist/packem_shared/import-D7qdpSmJ.mjs +12 -0
  59. package/dist/packem_shared/insertSchemaExtension-DuiV6cba.mjs +8 -0
  60. package/dist/packem_shared/lint-ignore-report-DKZagpqk.mjs +2 -0
  61. package/dist/packem_shared/open-url-EnKy--w-.mjs +1 -0
  62. package/dist/packem_shared/parseManifest-CwPTKdtS.mjs +1 -0
  63. package/dist/packem_shared/path-containment-CgxYZggb.mjs +1 -0
  64. package/dist/packem_shared/platform-diagnostics-Cn2g6Jh-.mjs +4 -0
  65. package/dist/packem_shared/prompt-cancelled-BvsNxg_Q.mjs +1 -0
  66. package/dist/packem_shared/render-lunora-error--4tmM6mt.mjs +3 -0
  67. package/dist/packem_shared/resolve-DUCSc7jQ.mjs +5 -0
  68. package/dist/packem_shared/resolve-target-C_ZloTvd.mjs +1 -0
  69. package/dist/packem_shared/runAddCommand-1tGOc-uo.mjs +1 -0
  70. package/dist/packem_shared/runExportCommand-DxsJHYZt.mjs +5 -0
  71. package/dist/packem_shared/runMigrateGenerateCommand-BfBHaTLi.mjs +11 -0
  72. package/dist/packem_shared/schema-drift-gate-BDCkQ1S6.mjs +1 -0
  73. package/dist/packem_shared/schemaIrToSnapshot-irmd5g0Y.mjs +1 -0
  74. package/dist/packem_shared/shared-D-zCOmgY.mjs +1 -0
  75. package/dist/packem_shared/storage-2MQBGhKZ.mjs +1 -0
  76. package/dist/packem_shared/tui-prompts-B3YwUhGw.mjs +4 -0
  77. package/dist/packem_shared/vectorize-metadata-dXpl2_Ar.mjs +1 -0
  78. package/dist/packem_shared/wrangler-name-Dsk5K1f-.mjs +1 -0
  79. package/dist/packem_shared/wrangler-secrets-C9lJnd5N.mjs +1 -0
  80. package/package.json +42 -19
  81. package/skills/README.md +35 -17
  82. package/skills/lunora/SKILL.md +123 -9
  83. package/skills/lunora-create-package/SKILL.md +4 -3
  84. package/skills/lunora-deploy/SKILL.md +42 -11
  85. package/skills/lunora-functions/SKILL.md +120 -15
  86. package/skills/lunora-migration-helper/SKILL.md +74 -21
  87. package/skills/lunora-performance-audit/SKILL.md +78 -9
  88. package/skills/lunora-quickstart/SKILL.md +93 -27
  89. package/skills/lunora-realtime/SKILL.md +73 -39
  90. package/skills/lunora-setup-auth/SKILL.md +33 -6
  91. package/skills/lunora-setup-hyperdrive/SKILL.md +33 -13
  92. package/skills/lunora-setup-hyperdrive-global/SKILL.md +5 -0
  93. package/skills/lunora-setup-mail/SKILL.md +34 -28
  94. package/skills/lunora-setup-scheduler/SKILL.md +18 -14
  95. package/skills/lunora-setup-storage/SKILL.md +189 -28
  96. package/dist/packem_chunks/runMigrateGenerateCommand.mjs +0 -397
  97. package/dist/packem_shared/COMMANDS-CHw4zOZ9.mjs +0 -922
  98. package/dist/packem_shared/DEFAULT_IMPORT_BATCH_SIZE-Ck-2bU08.mjs +0 -244
  99. package/dist/packem_shared/admin-url-4UzT-CI4.mjs +0 -19
  100. package/dist/packem_shared/api-spec-CtA6ilu4.mjs +0 -13
  101. package/dist/packem_shared/buildRegistryIndex-BcYe607_.mjs +0 -38
  102. package/dist/packem_shared/command-BDXcJCCJ.mjs +0 -14
  103. package/dist/packem_shared/commands-DIQ3nf0C.mjs +0 -743
  104. package/dist/packem_shared/createLogger-CHPNjFw2.mjs +0 -73
  105. package/dist/packem_shared/defaultSpawner-DxI3mebw.mjs +0 -43
  106. package/dist/packem_shared/diffSnapshots-RR2ZE8Ya.mjs +0 -161
  107. package/dist/packem_shared/docker-hMQ97KSQ.mjs +0 -21
  108. package/dist/packem_shared/features-ocSSpZtS.mjs +0 -24
  109. package/dist/packem_shared/insertSchemaExtension-BuzF6-t2.mjs +0 -59
  110. package/dist/packem_shared/open-url-Dfq6fAyT.mjs +0 -41
  111. package/dist/packem_shared/output-format-7gyGR3h8.mjs +0 -17
  112. package/dist/packem_shared/parseArgs-YXFuKdEk.mjs +0 -56
  113. package/dist/packem_shared/parseManifest--vZf2FY1.mjs +0 -94
  114. package/dist/packem_shared/resolve-target-qbsJ_5sF.mjs +0 -16
  115. package/dist/packem_shared/runAddCommand-3I3JFZUG.mjs +0 -4
  116. package/dist/packem_shared/schema-drift-gate-BtBt0as0.mjs +0 -79
  117. package/dist/packem_shared/schemaIrToSnapshot-aBTo7TM5.mjs +0 -43
  118. 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}from"../packem_shared/command-Mmxzxyr5.mjs";import{a as l}from"../packem_shared/resolve-target-C_ZloTvd.mjs";import{runExportCommand as m}from"../packem_shared/runExportCommand-DxsJHYZt.mjs";const k=d(({argument:o,cwd:e,format:t,logger:u,options:r})=>m({cwd:e,format:t,logger:u,out:o[0]??r.out,prod:r.prod===!0,tables:r.tables,token:r.token,url:l({cwd:e,prod:r.prod===!0,url:r.url})}));export{k 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}from"../packem_shared/command-Mmxzxyr5.mjs";import{EXIT_CODE as m}from"../packem_shared/EXIT_CODE-08cwt3MK.mjs";import{a as n}from"../packem_shared/resolve-target-C_ZloTvd.mjs";import{I as u,r as i}from"../packem_shared/import-D7qdpSmJ.mjs";const b=d(({argument:f,cwd:a,format:c,logger:t,options:r})=>{const o=f[0];if(!o){const e="import requires a path. Usage: lunora import <file.ndjson | convex-export-dir> [--table <name>]";return t.error(e),{code:m.USAGE,error:e}}if(r.from!==void 0&&!u.includes(r.from)){const e=`--from ${r.from} is not a known source. Expected one of: ${u.join(", ")}.`;return t.error(e),{code:m.USAGE,error:e}}return i({batchSize:r.batchSize,cwd:a,file:o,format:c,from:r.from,logger:t,prod:r.prod===!0,scan:r.scan===!0,storageDir:r.storageDir,table:r.table,token:r.token,url:n({cwd:a,prod:r.prod===!0,url:r.url}),verify:r.verify===!0,withStorage:r.withStorage===!0,yes:r.yes===!0})});export{b as execute};