@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.
- 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 +797 -358
- package/dist/index.d.ts +797 -358
- package/dist/index.mjs +1 -19
- package/dist/packem_chunks/handler.mjs +1 -76
- package/dist/packem_chunks/handler10.mjs +2 -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 -41
- package/dist/packem_chunks/handler17.mjs +1 -105
- package/dist/packem_chunks/handler18.mjs +1 -172
- package/dist/packem_chunks/handler19.mjs +7 -89
- package/dist/packem_chunks/handler2.mjs +2 -114
- package/dist/packem_chunks/handler20.mjs +2 -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 -543
- package/dist/packem_chunks/runCodegenCommand.mjs +4 -52
- package/dist/packem_chunks/runDeployCommand.mjs +1 -504
- package/dist/packem_chunks/runInitCommand.mjs +1141 -565
- 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-su5nmqYP.mjs +1 -0
- package/dist/packem_shared/DEFAULT_IMPORT_BATCH_SIZE-Nf7GsE6v.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/buildRegistryIndex-Zi3bBqpc.mjs +1 -0
- package/dist/packem_shared/cli-RB-BoDnW.mjs +3 -0
- package/dist/packem_shared/codegen-error-C04fGQjf.mjs +3 -0
- package/dist/packem_shared/command-DwC11Cwe.mjs +1 -0
- package/dist/packem_shared/commands-BOgN2nF7.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/detect-package-manager-DSaAqRof.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/health-probe-QEPfFdgJ.mjs +1 -0
- package/dist/packem_shared/import-CrVGrOt3.mjs +12 -0
- package/dist/packem_shared/insertSchemaExtension-DY4pA8wE.mjs +8 -0
- package/dist/packem_shared/lint-ignore-report-CDbcbtv7.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/post-codegen-hook-DRdEoTsQ.mjs +1 -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-C_ZloTvd.mjs +1 -0
- package/dist/packem_shared/runAddCommand-BXz-PXbb.mjs +1 -0
- package/dist/packem_shared/runExportCommand-DmXKEWSq.mjs +5 -0
- package/dist/packem_shared/schema-drift-gate-AscQpYH5.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/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-CE7jcf8E.mjs +1 -0
- package/package.json +43 -19
- 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/skills/lunora-setup-storage/SKILL.md +7 -3
- package/dist/packem_shared/COMMANDS-1V_KEx35.mjs +0 -905
- 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-BDXcJCCJ.mjs +0 -14
- package/dist/packem_shared/createLogger-CHPNjFw2.mjs +0 -73
- package/dist/packem_shared/defaultSpawner-DxI3mebw.mjs +0 -43
- package/dist/packem_shared/diffSnapshots-RR2ZE8Ya.mjs +0 -161
- package/dist/packem_shared/docker-hMQ97KSQ.mjs +0 -21
- package/dist/packem_shared/features-ocSSpZtS.mjs +0 -24
- package/dist/packem_shared/insertSchemaExtension-BuzF6-t2.mjs +0 -59
- package/dist/packem_shared/open-url-Dfq6fAyT.mjs +0 -41
- package/dist/packem_shared/output-format-7gyGR3h8.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-BZGkRnBs.mjs +0 -693
- package/dist/packem_shared/schema-drift-gate-BtBt0as0.mjs +0 -79
- package/dist/packem_shared/schemaIrToSnapshot-aBTo7TM5.mjs +0 -43
- package/dist/packem_shared/wrangler-name-cy4yhm9j.mjs +0 -12
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { evaluateSchemaDrift, parseSchemaSnapshot, SchemaSnapshotParseError, serializeSchemaSnapshot } from '@lunora/codegen';
|
|
3
|
-
|
|
4
|
-
const readBaseline = (snapshotPath) => {
|
|
5
|
-
if (!existsSync(snapshotPath)) {
|
|
6
|
-
return { status: "absent" };
|
|
7
|
-
}
|
|
8
|
-
let content;
|
|
9
|
-
try {
|
|
10
|
-
content = readFileSync(snapshotPath, "utf8");
|
|
11
|
-
} catch {
|
|
12
|
-
return { status: "corrupt" };
|
|
13
|
-
}
|
|
14
|
-
try {
|
|
15
|
-
const snapshot = parseSchemaSnapshot(content);
|
|
16
|
-
return snapshot === void 0 ? { status: "corrupt" } : { snapshot, status: "ok" };
|
|
17
|
-
} catch (error) {
|
|
18
|
-
if (error instanceof SchemaSnapshotParseError) {
|
|
19
|
-
return { status: "corrupt" };
|
|
20
|
-
}
|
|
21
|
-
throw error;
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
const writeBaseline = (snapshotPath, snapshot) => {
|
|
25
|
-
writeFileSync(snapshotPath, serializeSchemaSnapshot(snapshot), "utf8");
|
|
26
|
-
};
|
|
27
|
-
const corruptBaselineResult = (context) => {
|
|
28
|
-
const reason = `schema-drift gate: the committed baseline ${context.snapshotPath} is unreadable or malformed, so schema drift cannot be checked. Fix it (e.g. resolve a merge conflict in lunora/.lunora-schema.json), or pass --update-schema-baseline to regenerate it from the current schema.`;
|
|
29
|
-
if (context.updateBaseline && !context.readOnly) {
|
|
30
|
-
context.logger.warn(
|
|
31
|
-
`schema baseline was unreadable; regenerating from the current schema on success (--update-schema-baseline): ${context.snapshotPath}`
|
|
32
|
-
);
|
|
33
|
-
return { blocked: false, changes: [], reason, rebless: context.rebless };
|
|
34
|
-
}
|
|
35
|
-
if (!context.readOnly) {
|
|
36
|
-
context.logger.error(reason);
|
|
37
|
-
}
|
|
38
|
-
return { blocked: true, changes: [], reason };
|
|
39
|
-
};
|
|
40
|
-
const blockedDecisionResult = (decision, context) => {
|
|
41
|
-
if (!context.readOnly) {
|
|
42
|
-
context.logger.error(decision.reason);
|
|
43
|
-
}
|
|
44
|
-
if (context.updateBaseline && !context.readOnly) {
|
|
45
|
-
context.logger.warn(`schema baseline will be re-blessed despite breaking drift on success (--update-schema-baseline): ${context.snapshotPath}`);
|
|
46
|
-
return { blocked: false, changes: decision.changes, reason: decision.reason, rebless: context.rebless };
|
|
47
|
-
}
|
|
48
|
-
return { blocked: true, changes: decision.changes, reason: decision.reason };
|
|
49
|
-
};
|
|
50
|
-
const runSchemaDriftGate = (options) => {
|
|
51
|
-
const { allowDrift, codegen, logger, readOnly = false, updateBaseline = false } = options;
|
|
52
|
-
const snapshotPath = codegen.schemaSnapshotPath;
|
|
53
|
-
const baseline = readBaseline(snapshotPath);
|
|
54
|
-
const context = {
|
|
55
|
-
logger,
|
|
56
|
-
readOnly,
|
|
57
|
-
rebless: () => {
|
|
58
|
-
writeBaseline(snapshotPath, codegen.schemaSnapshot);
|
|
59
|
-
},
|
|
60
|
-
snapshotPath,
|
|
61
|
-
updateBaseline
|
|
62
|
-
};
|
|
63
|
-
if (baseline.status === "corrupt") {
|
|
64
|
-
return corruptBaselineResult(context);
|
|
65
|
-
}
|
|
66
|
-
const decision = evaluateSchemaDrift({ allowDrift, baseline: baseline.status === "ok" ? baseline.snapshot : void 0, current: codegen.schemaSnapshot });
|
|
67
|
-
if (decision.blocked) {
|
|
68
|
-
return blockedDecisionResult(decision, context);
|
|
69
|
-
}
|
|
70
|
-
if (decision.changes.length > 0) {
|
|
71
|
-
if (!readOnly) {
|
|
72
|
-
logger.info(decision.reason);
|
|
73
|
-
}
|
|
74
|
-
return { blocked: false, changes: decision.changes, reason: decision.reason, rebless: readOnly ? void 0 : context.rebless };
|
|
75
|
-
}
|
|
76
|
-
return { blocked: false, changes: decision.changes, reason: decision.reason };
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export { runSchemaDriftGate as r };
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { validatorKindToSqlType } from './diffSnapshots-RR2ZE8Ya.mjs';
|
|
2
|
-
|
|
3
|
-
const validatorToColumn = (validator) => {
|
|
4
|
-
if (validator.kind === "optional" && validator.inner) {
|
|
5
|
-
return {
|
|
6
|
-
nullable: true,
|
|
7
|
-
sqlType: validatorKindToSqlType(validator.inner.kind)
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
return {
|
|
11
|
-
nullable: false,
|
|
12
|
-
sqlType: validatorKindToSqlType(validator.kind)
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
const isGlobal = (mode) => mode === "global";
|
|
16
|
-
const schemaIrToSnapshot = (ir) => {
|
|
17
|
-
const tables = {};
|
|
18
|
-
for (const table of ir.tables) {
|
|
19
|
-
if (!isGlobal(table.shardMode)) {
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
const columns = {};
|
|
23
|
-
for (const [columnName, validator] of Object.entries(table.shape)) {
|
|
24
|
-
columns[columnName] = validatorToColumn(validator);
|
|
25
|
-
}
|
|
26
|
-
const indexes = {};
|
|
27
|
-
for (const index of table.indexes) {
|
|
28
|
-
indexes[index.name] = {
|
|
29
|
-
fields: [...index.fields],
|
|
30
|
-
name: index.name,
|
|
31
|
-
unique: index.unique ?? false
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
tables[table.name] = {
|
|
35
|
-
columns,
|
|
36
|
-
indexes,
|
|
37
|
-
name: table.name
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
return { tables, version: 1 };
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export { schemaIrToSnapshot as default };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { findWranglerFile, readWranglerJsonc } from '@lunora/config';
|
|
2
|
-
|
|
3
|
-
const readWranglerName = (cwd) => {
|
|
4
|
-
const wranglerPath = findWranglerFile(cwd);
|
|
5
|
-
if (!wranglerPath) {
|
|
6
|
-
return void 0;
|
|
7
|
-
}
|
|
8
|
-
const { parsed } = readWranglerJsonc(wranglerPath);
|
|
9
|
-
return typeof parsed?.name === "string" && parsed.name.length > 0 ? parsed.name : void 0;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export { readWranglerName as r };
|