@lunora/cli 1.0.0-alpha.21 → 1.0.0-alpha.211
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 +33 -0
- package/README.md +1 -1
- package/__assets__/package-og.svg +1 -1
- package/dist/bin.mjs +2 -10
- package/dist/index.d.mts +745 -341
- package/dist/index.d.ts +745 -341
- package/dist/index.mjs +1 -19
- package/dist/packem_chunks/handler.mjs +1 -150
- package/dist/packem_chunks/handler10.mjs +4 -22
- package/dist/packem_chunks/handler11.mjs +2 -192
- package/dist/packem_chunks/handler12.mjs +1 -131
- package/dist/packem_chunks/handler13.mjs +1 -65
- package/dist/packem_chunks/handler14.mjs +1 -58
- package/dist/packem_chunks/handler15.mjs +1 -79
- package/dist/packem_chunks/handler16.mjs +3 -43
- package/dist/packem_chunks/handler17.mjs +1 -105
- package/dist/packem_chunks/handler18.mjs +1 -170
- package/dist/packem_chunks/handler19.mjs +7 -89
- package/dist/packem_chunks/handler2.mjs +2 -114
- package/dist/packem_chunks/handler20.mjs +1 -94
- package/dist/packem_chunks/handler21.mjs +2 -311
- package/dist/packem_chunks/handler22.mjs +3 -0
- package/dist/packem_chunks/handler23.mjs +3 -0
- package/dist/packem_chunks/handler24.mjs +1 -0
- package/dist/packem_chunks/handler25.mjs +99 -0
- package/dist/packem_chunks/handler26.mjs +10 -0
- package/dist/packem_chunks/handler3.mjs +1 -204
- package/dist/packem_chunks/handler4.mjs +1 -33
- package/dist/packem_chunks/handler5.mjs +1 -49
- package/dist/packem_chunks/handler6.mjs +1 -91
- package/dist/packem_chunks/handler7.mjs +3 -42
- package/dist/packem_chunks/handler8.mjs +1 -174
- package/dist/packem_chunks/handler9.mjs +1 -16
- package/dist/packem_chunks/planDevCommand.mjs +7 -500
- package/dist/packem_chunks/runCodegenCommand.mjs +4 -52
- package/dist/packem_chunks/runDeployCommand.mjs +1 -504
- package/dist/packem_chunks/runInitCommand.mjs +118 -1383
- package/dist/packem_chunks/runMigrateGenerateCommand.mjs +9 -395
- package/dist/packem_chunks/runResetCommand.mjs +1 -41
- package/dist/packem_chunks/runRpcCommand.mjs +1 -68
- package/dist/packem_shared/COMMANDS-BXbrW8dd.mjs +1 -0
- package/dist/packem_shared/DEFAULT_IMPORT_BATCH_SIZE-Cf8ZymM1.mjs +1 -0
- package/dist/packem_shared/admin-token-rxXZbVMZ.mjs +1 -0
- package/dist/packem_shared/admin-url-Cil3Or6N.mjs +1 -0
- package/dist/packem_shared/advisory-gate-Cl8IEFIj.mjs +1 -0
- package/dist/packem_shared/api-spec-lYyq4vL6.mjs +1 -0
- package/dist/packem_shared/binding-manifest-file-CQ1eQYy1.mjs +2 -0
- package/dist/packem_shared/buildRegistryIndex-Zi3bBqpc.mjs +1 -0
- package/dist/packem_shared/cli-C37AI4tr.mjs +3 -0
- package/dist/packem_shared/codegen-error-AmH54ofi.mjs +3 -0
- package/dist/packem_shared/command-DwC11Cwe.mjs +1 -0
- package/dist/packem_shared/commands-BNKj7r1R.mjs +19 -0
- package/dist/packem_shared/createLogger-hGafwf-3.mjs +2 -0
- package/dist/packem_shared/createRecordingSpawner-DJlNacZ6.mjs +1 -0
- package/dist/packem_shared/deploy-target-D9GPy_tq.mjs +1 -0
- package/dist/packem_shared/diffSnapshots-CIOFQN_a.mjs +5 -0
- package/dist/packem_shared/docker-DpVxvYpL.mjs +1 -0
- package/dist/packem_shared/import-CdHdZRjj.mjs +12 -0
- package/dist/packem_shared/insertSchemaExtension-DY4pA8wE.mjs +8 -0
- package/dist/packem_shared/lint-ignore-report-DKZagpqk.mjs +2 -0
- package/dist/packem_shared/open-url-EnKy--w-.mjs +1 -0
- package/dist/packem_shared/output-format-DfogXx0p.mjs +2 -0
- package/dist/packem_shared/parseManifest-CwPTKdtS.mjs +1 -0
- package/dist/packem_shared/path-containment-CgxYZggb.mjs +1 -0
- package/dist/packem_shared/platform-diagnostics-uOXqysk3.mjs +4 -0
- package/dist/packem_shared/prompt-cancelled-C8Sj7OqI.mjs +1 -0
- package/dist/packem_shared/resolve-DZAGzg67.mjs +1 -0
- package/dist/packem_shared/resolve-target-BRvw8Pf7.mjs +1 -0
- package/dist/packem_shared/runAddCommand-D1Dj8-pK.mjs +1 -0
- package/dist/packem_shared/runExportCommand-DmXKEWSq.mjs +5 -0
- package/dist/packem_shared/schema-drift-gate-DARCKocg.mjs +1 -0
- package/dist/packem_shared/schemaIrToSnapshot-qpRoV7HY.mjs +1 -0
- package/dist/packem_shared/shared-D-zCOmgY.mjs +1 -0
- package/dist/packem_shared/storage-wIUel5Az.mjs +1 -0
- package/dist/packem_shared/tui-prompts-Dd0pDuNr.mjs +4 -0
- package/dist/packem_shared/vectorize-metadata-DbziRKpX.mjs +1 -0
- package/dist/packem_shared/wrangler-name-Dsk5K1f-.mjs +1 -0
- package/dist/packem_shared/wrangler-secrets-CCdt0mUl.mjs +1 -0
- package/package.json +39 -17
- package/skills/README.md +35 -17
- package/skills/lunora/SKILL.md +65 -9
- package/skills/lunora-functions/SKILL.md +38 -3
- package/skills/lunora-migration-helper/SKILL.md +70 -17
- package/skills/lunora-performance-audit/SKILL.md +36 -6
- package/skills/lunora-quickstart/SKILL.md +90 -24
- package/skills/lunora-realtime/SKILL.md +58 -30
- package/dist/packem_shared/COMMANDS-D3h9Iwvl.mjs +0 -944
- package/dist/packem_shared/DEFAULT_IMPORT_BATCH_SIZE-Ck-2bU08.mjs +0 -244
- package/dist/packem_shared/admin-url-4UzT-CI4.mjs +0 -19
- package/dist/packem_shared/api-spec-CtA6ilu4.mjs +0 -13
- package/dist/packem_shared/buildRegistryIndex-BcYe607_.mjs +0 -38
- package/dist/packem_shared/command-BC30oSBW.mjs +0 -14
- package/dist/packem_shared/commands-hl0mRqqg.mjs +0 -845
- package/dist/packem_shared/createLogger-B40gPzQo.mjs +0 -78
- package/dist/packem_shared/createRecordingSpawner-DxI3mebw.mjs +0 -43
- package/dist/packem_shared/detect-package-manager-DYp7n3mJ.mjs +0 -61
- package/dist/packem_shared/diffSnapshots-BeDvvNiF.mjs +0 -161
- package/dist/packem_shared/docker-hMQ97KSQ.mjs +0 -21
- package/dist/packem_shared/insertSchemaExtension-DAqbfr9Z.mjs +0 -64
- package/dist/packem_shared/open-url-Dfq6fAyT.mjs +0 -41
- package/dist/packem_shared/output-format-wUvAN6AL.mjs +0 -17
- package/dist/packem_shared/parseArgs-YXFuKdEk.mjs +0 -56
- package/dist/packem_shared/parseManifest--vZf2FY1.mjs +0 -94
- package/dist/packem_shared/resolve-target-qbsJ_5sF.mjs +0 -16
- package/dist/packem_shared/runAddCommand-vJdgiR5t.mjs +0 -4
- package/dist/packem_shared/schema-drift-gate-BtBt0as0.mjs +0 -79
- package/dist/packem_shared/schemaIrToSnapshot-DdsljJT-.mjs +0 -43
- package/dist/packem_shared/storage-B7hHSTZP.mjs +0 -84
- package/dist/packem_shared/tui-prompts-M6OWsuyw.mjs +0 -663
- package/dist/packem_shared/wrangler-name-cy4yhm9j.mjs +0 -12
|
@@ -1,42 +1,3 @@
|
|
|
1
|
-
import { d as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const DEFAULT_DOCS_URL = "https://lunora.anolilab.dev/docs";
|
|
5
|
-
const trimSlashes = (value) => {
|
|
6
|
-
let start = 0;
|
|
7
|
-
let end = value.length;
|
|
8
|
-
while (start < end && value[start] === "/") {
|
|
9
|
-
start += 1;
|
|
10
|
-
}
|
|
11
|
-
while (end > start && value[end - 1] === "/") {
|
|
12
|
-
end -= 1;
|
|
13
|
-
}
|
|
14
|
-
return value.slice(start, end);
|
|
15
|
-
};
|
|
16
|
-
const buildUrl = (section) => {
|
|
17
|
-
if (!section || section.length === 0) {
|
|
18
|
-
return DEFAULT_DOCS_URL;
|
|
19
|
-
}
|
|
20
|
-
const trimmed = trimSlashes(section);
|
|
21
|
-
if (trimmed.length === 0) {
|
|
22
|
-
return DEFAULT_DOCS_URL;
|
|
23
|
-
}
|
|
24
|
-
return `${DEFAULT_DOCS_URL}/${trimmed}`;
|
|
25
|
-
};
|
|
26
|
-
const runDocsCommand = async (options) => {
|
|
27
|
-
const url = buildUrl(options.section);
|
|
28
|
-
options.logger.info(`opening ${url}`);
|
|
29
|
-
try {
|
|
30
|
-
await openUrl(url, { opener: options.opener });
|
|
31
|
-
} catch (error) {
|
|
32
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
33
|
-
options.logger.error(`docs: failed to open URL: ${message}`);
|
|
34
|
-
return { code: 1, url };
|
|
35
|
-
}
|
|
36
|
-
return { code: 0, url };
|
|
37
|
-
};
|
|
38
|
-
const execute = defineHandler(
|
|
39
|
-
({ argument, logger }) => runDocsCommand({ logger, section: argument[0] })
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
export { execute, runDocsCommand };
|
|
1
|
+
import{existsSync as h,readFileSync as S}from"node:fs";import{join as V}from"node:path";import{DEV_VARS_FILE as d,DEV_VARS_KEY_PATTERN as k,writeDevVariablesFileAtomically as $,removeDevVariableLine as R,upsertDevVariableLine as P,isPlaceholderValue as A,detectPackageManager as N,resolveDeployDriver as U,resolveProjectTarget as z,execArgsFor as M,generateSecretValue as Y,DEV_VARS_EXAMPLE_FILE as p,parseDevVariableEntries as _,packageNamesFromBindings as j,inferLunoraBindings as x,requiredSecrets as C,isMintableSecretKey as b}from"@lunora/config";import{d as q}from"../packem_shared/command-DwC11Cwe.mjs";import{defaultSpawner as F}from"../packem_shared/createRecordingSpawner-DJlNacZ6.mjs";import{l as T}from"../packem_shared/wrangler-secrets-CCdt0mUl.mjs";const Z=/[\r\n]/u,B=/["\\]/u,D=r=>new Map(_(r).map(s=>[s.key,s])),y=r=>h(r)?S(r,"utf8"):"",L=r=>r.length<=4?"****":`${r.slice(0,4)}${"*".repeat(Math.min(8,r.length-4))}`,f=r=>D(y(r)),K=r=>r.env??(r.prod===!0?"production":void 0),I=r=>{const s=f(r.devVariablesPath);if(s.size===0)return r.logger.info(`${d}: (empty)`),{code:0,descriptors:[]};for(const t of s.values())r.logger.info(`${t.key}=${L(t.value)}`);return{code:0,descriptors:[]}},O=r=>{const{devVariablesPath:s,logger:t,options:e}=r;if(!e.key)return t.error("env get requires a key. Usage: lunora env get <KEY>"),{code:1,descriptors:[]};const o=f(s).get(e.key);return o?(process.stdout.write(`${o.value}
|
|
2
|
+
`),{code:0,descriptors:[]}):(t.error(`env: ${e.key} is not set in ${d}`),{code:1,descriptors:[]})},G=r=>{const{devVariablesPath:s,logger:t,options:e}=r;if(!e.key)return t.error("env set requires a key. Usage: lunora env set <KEY> <VALUE>"),{code:1,descriptors:[]};if(!k.test(e.key))return t.error(`env: invalid key "${e.key}" — must match [A-Za-z_][A-Za-z0-9_]*`),{code:1,descriptors:[]};if(e.value===void 0)return t.error("env set requires a value. Usage: lunora env set <KEY> <VALUE>"),{code:1,descriptors:[]};if(Z.test(e.value))return t.error(`env: value for "${e.key}" contains a newline, which .dev.vars cannot represent`),{code:1,descriptors:[]};if(B.test(e.value))return t.error(`env: value for "${e.key}" contains a double-quote or backslash, which .dev.vars cannot round-trip`),{code:1,descriptors:[]};const o=y(s);return $(s,P(o,e.key,e.value)),t.success(`env: set ${e.key} (${L(e.value)}) in ${d}`),{code:0,descriptors:[]}},H=r=>{const{devVariablesPath:s,logger:t,options:e}=r;if(!e.key)return t.error("env unset requires a key. Usage: lunora env unset <KEY>"),{code:1,descriptors:[]};if(!k.test(e.key))return t.error(`env: invalid key "${e.key}" — must match [A-Za-z_][A-Za-z0-9_]*`),{code:1,descriptors:[]};const o=y(s);return D(o).has(e.key)?($(s,R(o,e.key)),t.success(`env: unset ${e.key} in ${d}`),{code:0,descriptors:[]}):(t.warn(`env: ${e.key} was not set in ${d}`),{code:0,descriptors:[]})},W=async r=>{const{devVariablesPath:s,logger:t,options:e}=r;if(!e.yes)return t.error("env push uploads secrets to Cloudflare. Re-run with --yes to confirm."),{code:1,descriptors:[]};const o=f(s);if(o.size===0)return t.warn(`${d}: nothing to push (empty)`),{code:0,descriptors:[]};const i=[...o.values()].filter(n=>A(n.value)).map(n=>n.key);if(i.length>0)return t.error(`env push: refusing to upload placeholder value(s) for ${i.join(", ")} — run \`lunora env doctor\` to review, and \`lunora env generate --set\` (or \`lunora env set <KEY> <VALUE>\`) to fill them, then re-run.`),{code:1,descriptors:[]};const c=e.spawner??F,l=e.cwd??process.cwd(),v=N(l),a=[],u=K(e);for(const n of o.values()){const m=U(z(l)).toolchain?.secretPut({environment:u,key:n.key,temporary:e.temporary});if(m===void 0)return t.error("deploy target has no command-line toolchain; cannot push secrets"),{code:1,descriptors:[]};const E=M(v,m.tool,m.args),w={args:E.args,command:E.command,cwd:l,input:n.value};a.push(w),t.info(`pushing ${n.key} -> wrangler secret${u===void 0?"":` (${u})`}`);const g=await c(w);if(g.code!==0)return t.error(`env push: failed at ${n.key} (exit ${String(g.code)})`),{code:g.code,descriptors:a}}return t.success(`env: pushed ${String(o.size)} secret(s)`),{code:0,descriptors:a}},X=r=>(r.options.secretLister??T)({cwd:r.cwd,env:K(r.options),temporary:r.options.temporary}),J=async r=>{const{devVariablesPath:s,logger:t}=r,e=await X(r);if(!e.ok)return t.error(`env diff: ${e.error??"failed to list remote secrets"}`),{code:1,descriptors:[]};const o=new Set(f(s).keys()),i=new Set(e.names),c=[...o].filter(a=>!i.has(a)).toSorted((a,u)=>a.localeCompare(u)),l=e.names.filter(a=>!o.has(a)),v=[...o].filter(a=>i.has(a)).toSorted((a,u)=>a.localeCompare(u));for(const a of c)t.info(`local only (run \`lunora env push\`): ${a}`);for(const a of l)t.info(`remote only (in Cloudflare, not ${d}): ${a}`);return t.info(`in both: ${String(v.length)} secret(s)`),c.length===0&&l.length===0&&t.success("env diff: local and remote secret names match"),{code:0,descriptors:[]}},Q=r=>{const{cwd:s,devVariablesPath:t,logger:e}=r,o=V(s,p);if(!h(o))return e.info(`env doctor: no ${p} to check against — nothing to validate.`),{code:0,descriptors:[]};const i=_(S(o,"utf8")).map(n=>n.key),c=f(t);if(!h(t))return e.error(`env doctor: ${d} is missing. Run \`lunora dev\` to scaffold it, or \`lunora env set <KEY> <VALUE>\`.`),e.info(`expected (from ${p}): ${i.join(", ")}`),{code:1,descriptors:[]};const l=i.filter(n=>!c.has(n)),v=[...c.values()].filter(n=>A(n.value)).map(n=>n.key),a=new Set(i),u=[...c.keys()].filter(n=>!a.has(n));for(const n of l)e.error(`missing: ${n} is in ${p} but not ${d}`);for(const n of v)e.error(`unset: ${n} still has a placeholder value`);for(const n of u)e.info(`extra: ${n} is set locally but not listed in ${p}`);return l.length===0&&v.length===0?(e.success(`env doctor: ${d} looks good (${String(c.size)} var(s)).`),{code:0,descriptors:[]}):{code:1,descriptors:[]}},ee=async r=>{let s=[];try{s=j(await x({projectRoot:r.cwd}))}catch{}const t=C(s).map(o=>o.key).filter(o=>b(o)),e=[...f(r.devVariablesPath).keys()].filter(o=>b(o));return[...new Set([...t,...e])]},re=async r=>{const{devVariablesPath:s,logger:t,options:e}=r;let o;if(e.key===void 0){if(o=await ee(r),o.length===0)return t.info("env generate: no locally-generatable secrets for this project. Name one explicitly: lunora env generate <KEY>"),{code:0,descriptors:[]}}else{if(!k.test(e.key))return t.error(`env: invalid key "${e.key}" — must match [A-Za-z_][A-Za-z0-9_]*`),{code:1,descriptors:[]};o=[e.key]}const i=o.map(c=>({key:c,value:Y()}));if(e.set===!0){let c=y(s);for(const l of i)c=P(c,l.key,l.value);return $(s,c),t.success(`env: generated ${String(i.length)} secret(s) into ${d}: ${i.map(l=>l.key).join(", ")}`),{code:0,descriptors:[]}}for(const c of i)process.stdout.write(`${c.key}=${c.value}
|
|
3
|
+
`);return{code:0,descriptors:[]}},te=async r=>{const s=r.cwd??process.cwd(),t={cwd:s,devVariablesPath:V(s,d),logger:r.logger,options:r};switch(r.subcommand){case"diff":return J(t);case"doctor":return Q(t);case"generate":return re(t);case"get":return O(t);case"list":return I(t);case"push":return W(t);case"set":return G(t);case"unset":return H(t);default:return r.logger.error(`env: unknown subcommand "${r.subcommand}"`),{code:1,descriptors:[]}}},oe=new Set(["diff","doctor","generate","get","list","push","set","unset"]),se=r=>typeof r=="string"&&oe.has(r),ue=q(({argument:r,cwd:s,logger:t,options:e})=>{const o=r[0];return se(o)?te({cwd:s,env:e.env,key:r[1],logger:t,prod:e.prod===!0,set:e.set===!0,subcommand:o,temporary:e.temporary===!0,value:r[2],yes:e.yes===!0}):(t.error(`env: unknown subcommand "${o??""}" — expected list | get | set | unset | push | diff | doctor | generate`),{code:1})});export{ue as execute,te as runEnvCommand};
|
|
@@ -1,174 +1 @@
|
|
|
1
|
-
import {
|
|
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-BC30oSBW.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{r as d}from"../packem_shared/resolve-target-BRvw8Pf7.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 {
|
|
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{r as f}from"../packem_shared/resolve-target-BRvw8Pf7.mjs";import{I as u,r as d}from"../packem_shared/import-CdHdZRjj.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};
|