@lunora/cli 1.0.0-alpha.9 → 1.0.0-alpha.91
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 +6 -0
- package/__assets__/package-og.svg +1 -1
- package/dist/bin.mjs +1 -1
- package/dist/index.d.mts +358 -300
- package/dist/index.d.ts +358 -300
- package/dist/index.mjs +8 -9
- package/dist/packem_chunks/handler.mjs +15 -5
- package/dist/packem_chunks/handler10.mjs +8 -14
- package/dist/packem_chunks/handler11.mjs +20 -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 +94 -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 +8 -4
- 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 +330 -12
- package/dist/packem_chunks/planDevCommand.mjs +762 -81
- package/dist/packem_chunks/runCodegenCommand.mjs +5 -4
- package/dist/packem_chunks/runDeployCommand.mjs +137 -22
- package/dist/packem_chunks/runInitCommand.mjs +1648 -188
- package/dist/packem_chunks/runMigrateGenerateCommand.mjs +94 -47
- package/dist/packem_chunks/runResetCommand.mjs +2 -2
- package/dist/packem_chunks/runRpcCommand.mjs +3 -2
- package/dist/packem_shared/{COMMANDS-Dh0bSERi.mjs → COMMANDS-DZ0NnuqI.mjs} +103 -27
- package/dist/packem_shared/{DEFAULT_IMPORT_BATCH_SIZE-Ck-2bU08.mjs → DEFAULT_IMPORT_BATCH_SIZE-D0VOTerB.mjs} +7 -2
- package/dist/packem_shared/{api-spec-CtA6ilu4.mjs → api-spec-Bx0iKbxA.mjs} +3 -1
- package/dist/packem_shared/{buildRegistryIndex-BcYe607_.mjs → buildRegistryIndex-BS5ig822.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-CkkATMMx.mjs → commands-D5Yxt9VY.mjs} +199 -20
- package/dist/packem_shared/{createLogger-CHPNjFw2.mjs → createLogger-CIWSHrTL.mjs} +40 -8
- package/dist/packem_shared/{createRecordingSpawner-DxI3mebw.mjs → createRecordingSpawner-WuSn20kb.mjs} +23 -2
- package/dist/packem_shared/detect-package-manager-v4hHpQd0.mjs +62 -0
- 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-Dbp-Q2q3.mjs} +36 -9
- package/dist/packem_shared/prompt-cancelled-APzX1Im-.mjs +9 -0
- package/dist/packem_shared/runAddCommand-D1hgfqFQ.mjs +4 -0
- package/dist/packem_shared/{storage-Bjo35hPa.mjs → storage-BXU4ax4O.mjs} +1 -1
- package/dist/packem_shared/tui-prompts-BjEN8XgP.mjs +658 -0
- package/dist/packem_shared/wrangler-secrets-Coni-mER.mjs +49 -0
- package/package.json +17 -14
- package/skills/lunora-quickstart/SKILL.md +26 -5
- package/dist/packem_shared/detect-package-manager-DYp7n3mJ.mjs +0 -61
- package/dist/packem_shared/parseArgs-YXFuKdEk.mjs +0 -56
- package/dist/packem_shared/runAddCommand-DepS9W9W.mjs +0 -4
- package/dist/packem_shared/tui-prompts-CA9lngSS.mjs +0 -269
|
@@ -1,17 +1,21 @@
|
|
|
1
|
+
import { LunoraError } from '@lunora/errors';
|
|
2
|
+
|
|
1
3
|
const NEWLINE_PRESENT = /[\r\n]/u;
|
|
2
4
|
const VALID_ENV_NAME = /^[A-Za-z_]\w*$/u;
|
|
3
5
|
const VALID_ITEM_NAME = /^[A-Za-z0-9][\w-]*$/u;
|
|
6
|
+
const VALID_MODULE_PATH = /^[\w.-]+(?:\/[\w.-]+)*$/u;
|
|
4
7
|
const parseManifest = (raw, itemName) => {
|
|
5
8
|
if (typeof raw !== "object" || raw === null) {
|
|
6
|
-
throw new
|
|
9
|
+
throw new LunoraError("INTERNAL", `registry.json for "${itemName}" is not an object`);
|
|
7
10
|
}
|
|
8
11
|
const record = raw;
|
|
9
12
|
const { name } = record;
|
|
10
13
|
if (typeof name !== "string" || name.length === 0) {
|
|
11
|
-
throw new
|
|
14
|
+
throw new LunoraError("INTERNAL", `registry.json for "${itemName}" is missing a string "name"`);
|
|
12
15
|
}
|
|
13
16
|
if (!VALID_ITEM_NAME.test(name)) {
|
|
14
|
-
throw new
|
|
17
|
+
throw new LunoraError(
|
|
18
|
+
"INTERNAL",
|
|
15
19
|
`registry.json for "${itemName}": name "${name}" must match ${VALID_ITEM_NAME.source} (letters, digits, "-", "_"; no path separators, "..", or code)`
|
|
16
20
|
);
|
|
17
21
|
}
|
|
@@ -21,7 +25,7 @@ const parseManifest = (raw, itemName) => {
|
|
|
21
25
|
}
|
|
22
26
|
const files = filesRaw.map((entry, index) => {
|
|
23
27
|
if (typeof entry !== "object" || entry === null) {
|
|
24
|
-
throw new
|
|
28
|
+
throw new LunoraError("INTERNAL", `registry.json "${itemName}": files[${String(index)}] is not an object`);
|
|
25
29
|
}
|
|
26
30
|
const fileRecord = entry;
|
|
27
31
|
const { from } = fileRecord;
|
|
@@ -31,14 +35,17 @@ const parseManifest = (raw, itemName) => {
|
|
|
31
35
|
throw new TypeError(`registry.json "${itemName}": files[${String(index)}] needs string "from" and "to"`);
|
|
32
36
|
}
|
|
33
37
|
if (merge !== "create-or-skip" && merge !== "schema-extension") {
|
|
34
|
-
throw new
|
|
38
|
+
throw new LunoraError("INTERNAL", `registry.json "${itemName}": files[${String(index)}].merge must be "create-or-skip" or "schema-extension"`);
|
|
35
39
|
}
|
|
36
40
|
for (const [field, value] of [
|
|
37
41
|
["from", from],
|
|
38
42
|
["to", to]
|
|
39
43
|
]) {
|
|
40
44
|
if (value.includes("..") || value.startsWith("/")) {
|
|
41
|
-
throw new
|
|
45
|
+
throw new LunoraError(
|
|
46
|
+
"INTERNAL",
|
|
47
|
+
`registry.json "${itemName}": files[${String(index)}].${field} "${value}" must be a relative path without ".."`
|
|
48
|
+
);
|
|
42
49
|
}
|
|
43
50
|
}
|
|
44
51
|
return { from, merge, to };
|
|
@@ -54,20 +61,39 @@ const parseManifest = (raw, itemName) => {
|
|
|
54
61
|
const bindingRecord = value;
|
|
55
62
|
return Array.isArray(bindingRecord.path) && bindingRecord.path.every((segment) => typeof segment === "string");
|
|
56
63
|
}) : void 0;
|
|
64
|
+
const entrypointReexports = Array.isArray(record.entrypointReexports) ? record.entrypointReexports.filter(
|
|
65
|
+
(value) => typeof value === "object" && value !== null && typeof value.module === "string"
|
|
66
|
+
).map((entry) => {
|
|
67
|
+
if (entry.module.includes("..") || entry.module.startsWith("/") || !VALID_MODULE_PATH.test(entry.module)) {
|
|
68
|
+
throw new LunoraError(
|
|
69
|
+
"INTERNAL",
|
|
70
|
+
`registry.json "${itemName}": entrypointReexports[].module "${entry.module}" must be a safe relative module path without path traversal or unsafe characters`
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
const reexport = { module: entry.module };
|
|
74
|
+
if (typeof entry.comment === "string") {
|
|
75
|
+
if (NEWLINE_PRESENT.test(entry.comment)) {
|
|
76
|
+
throw new LunoraError("INTERNAL", `registry.json "${itemName}": entrypointReexports[].comment must not contain a newline`);
|
|
77
|
+
}
|
|
78
|
+
reexport.comment = entry.comment;
|
|
79
|
+
}
|
|
80
|
+
return reexport;
|
|
81
|
+
}) : void 0;
|
|
57
82
|
const envVariables = Array.isArray(record.envVars) ? record.envVars.filter(
|
|
58
83
|
(value) => typeof value === "object" && value !== null && typeof value.name === "string"
|
|
59
84
|
).map((entry) => {
|
|
60
85
|
const hasValue = typeof entry.value === "string";
|
|
61
86
|
if (!VALID_ENV_NAME.test(entry.name)) {
|
|
62
|
-
throw new
|
|
87
|
+
throw new LunoraError(
|
|
88
|
+
"INTERNAL",
|
|
63
89
|
`registry.json "${itemName}": envVars["${entry.name}"].name must match ${VALID_ENV_NAME.source} (letters, digits, underscore; no "=" or newline)`
|
|
64
90
|
);
|
|
65
91
|
}
|
|
66
92
|
if (hasValue && NEWLINE_PRESENT.test(entry.value)) {
|
|
67
|
-
throw new
|
|
93
|
+
throw new LunoraError("INTERNAL", `registry.json "${itemName}": envVars["${entry.name}"].value must not contain a newline`);
|
|
68
94
|
}
|
|
69
95
|
if (typeof entry.description === "string" && NEWLINE_PRESENT.test(entry.description)) {
|
|
70
|
-
throw new
|
|
96
|
+
throw new LunoraError("INTERNAL", `registry.json "${itemName}": envVars["${entry.name}"].description must not contain a newline`);
|
|
71
97
|
}
|
|
72
98
|
return {
|
|
73
99
|
...typeof entry.description === "string" ? { description: entry.description } : {},
|
|
@@ -83,6 +109,7 @@ const parseManifest = (raw, itemName) => {
|
|
|
83
109
|
description: typeof record.description === "string" ? record.description : void 0,
|
|
84
110
|
devDependencies,
|
|
85
111
|
docs: typeof record.docs === "string" ? record.docs : void 0,
|
|
112
|
+
entrypointReexports,
|
|
86
113
|
envVars: envVariables,
|
|
87
114
|
files,
|
|
88
115
|
name,
|