@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.
- 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 +1087 -368
- package/dist/index.d.ts +1087 -368
- package/dist/index.mjs +1 -19
- package/dist/packem_chunks/dispatch.mjs +1 -0
- package/dist/packem_chunks/handler.mjs +1 -78
- package/dist/packem_chunks/handler10.mjs +1 -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 -172
- package/dist/packem_chunks/handler19.mjs +7 -89
- package/dist/packem_chunks/handler2.mjs +1 -114
- package/dist/packem_chunks/handler20.mjs +1 -94
- package/dist/packem_chunks/handler21.mjs +3 -311
- package/dist/packem_chunks/handler22.mjs +3 -0
- package/dist/packem_chunks/handler23.mjs +1 -0
- package/dist/packem_chunks/handler24.mjs +2 -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 +7 -504
- package/dist/packem_chunks/runInitCommand.mjs +1179 -544
- package/dist/packem_chunks/runResetCommand.mjs +1 -41
- package/dist/packem_chunks/runRpcCommand.mjs +1 -68
- package/dist/packem_shared/COMMANDS-DdaAWPtr.mjs +1 -0
- package/dist/packem_shared/DEFAULT_IMPORT_BATCH_SIZE-BgMPHEoe.mjs +1 -0
- package/dist/packem_shared/EXIT_CODE-08cwt3MK.mjs +1 -0
- package/dist/packem_shared/admin-token-VdUnvnKW.mjs +1 -0
- package/dist/packem_shared/admin-url-BhF5ufg1.mjs +1 -0
- package/dist/packem_shared/binding-manifest-file-CQ1eQYy1.mjs +2 -0
- package/dist/packem_shared/buildRegistryIndex-DVmy8fHE.mjs +1 -0
- package/dist/packem_shared/catalog-Cbzph90w.mjs +1 -0
- package/dist/packem_shared/cli-DOpChqUe.mjs +2 -0
- package/dist/packem_shared/codegen-error-AmH54ofi.mjs +3 -0
- package/dist/packem_shared/command-Mmxzxyr5.mjs +1 -0
- package/dist/packem_shared/commands-CdVObzRk.mjs +13 -0
- package/dist/packem_shared/createLogger-Cl18I8AX.mjs +2 -0
- package/dist/packem_shared/createRecordingSpawner-sS7LEN7x.mjs +1 -0
- package/dist/packem_shared/deploy-target-DCWwiuAe.mjs +1 -0
- package/dist/packem_shared/diffSnapshots-DtC5Cs4Z.mjs +5 -0
- package/dist/packem_shared/docker-DpVxvYpL.mjs +1 -0
- package/dist/packem_shared/import-D7qdpSmJ.mjs +12 -0
- package/dist/packem_shared/insertSchemaExtension-DuiV6cba.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/parseManifest-CwPTKdtS.mjs +1 -0
- package/dist/packem_shared/path-containment-CgxYZggb.mjs +1 -0
- package/dist/packem_shared/platform-diagnostics-Cn2g6Jh-.mjs +4 -0
- package/dist/packem_shared/prompt-cancelled-BvsNxg_Q.mjs +1 -0
- package/dist/packem_shared/render-lunora-error--4tmM6mt.mjs +3 -0
- package/dist/packem_shared/resolve-DUCSc7jQ.mjs +5 -0
- package/dist/packem_shared/resolve-target-C_ZloTvd.mjs +1 -0
- package/dist/packem_shared/runAddCommand-1tGOc-uo.mjs +1 -0
- package/dist/packem_shared/runExportCommand-DxsJHYZt.mjs +5 -0
- package/dist/packem_shared/runMigrateGenerateCommand-BfBHaTLi.mjs +11 -0
- package/dist/packem_shared/schema-drift-gate-BDCkQ1S6.mjs +1 -0
- package/dist/packem_shared/schemaIrToSnapshot-irmd5g0Y.mjs +1 -0
- package/dist/packem_shared/shared-D-zCOmgY.mjs +1 -0
- package/dist/packem_shared/storage-2MQBGhKZ.mjs +1 -0
- package/dist/packem_shared/tui-prompts-B3YwUhGw.mjs +4 -0
- package/dist/packem_shared/vectorize-metadata-dXpl2_Ar.mjs +1 -0
- package/dist/packem_shared/wrangler-name-Dsk5K1f-.mjs +1 -0
- package/dist/packem_shared/wrangler-secrets-C9lJnd5N.mjs +1 -0
- package/package.json +42 -19
- package/skills/README.md +35 -17
- package/skills/lunora/SKILL.md +123 -9
- package/skills/lunora-create-package/SKILL.md +4 -3
- package/skills/lunora-deploy/SKILL.md +42 -11
- package/skills/lunora-functions/SKILL.md +120 -15
- package/skills/lunora-migration-helper/SKILL.md +74 -21
- package/skills/lunora-performance-audit/SKILL.md +78 -9
- package/skills/lunora-quickstart/SKILL.md +93 -27
- package/skills/lunora-realtime/SKILL.md +73 -39
- package/skills/lunora-setup-auth/SKILL.md +33 -6
- package/skills/lunora-setup-hyperdrive/SKILL.md +33 -13
- package/skills/lunora-setup-hyperdrive-global/SKILL.md +5 -0
- package/skills/lunora-setup-mail/SKILL.md +34 -28
- package/skills/lunora-setup-scheduler/SKILL.md +18 -14
- package/skills/lunora-setup-storage/SKILL.md +189 -28
- package/dist/packem_chunks/runMigrateGenerateCommand.mjs +0 -397
- package/dist/packem_shared/COMMANDS-CHw4zOZ9.mjs +0 -922
- 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/commands-DIQ3nf0C.mjs +0 -743
- 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-3I3JFZUG.mjs +0 -4
- 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 };
|