@supacloud/cli 0.115.0 → 0.115.2
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/dist/index.js
CHANGED
|
@@ -9374,7 +9374,7 @@ var ACTION_POLICY = {
|
|
|
9374
9374
|
},
|
|
9375
9375
|
db: {
|
|
9376
9376
|
local: ["context", "lint", "explain", "diff", "role_sql"],
|
|
9377
|
-
read: ["module_check", "reverse", "plan", "role_check"],
|
|
9377
|
+
read: ["check", "module_check", "reverse", "plan", "role_check"],
|
|
9378
9378
|
write: ["apply"]
|
|
9379
9379
|
},
|
|
9380
9380
|
dev: { read: ["status"], write: ["sync", "watch", "migrate"] }
|
|
@@ -14036,7 +14036,11 @@ function generateTypeScriptTypes(data, schemas) {
|
|
|
14036
14036
|
nullable: column["is_nullable"] === "YES"
|
|
14037
14037
|
};
|
|
14038
14038
|
}
|
|
14039
|
-
let out = `// Types from ${schemas.join(", ")}
|
|
14039
|
+
let out = `// Types from ${schemas.join(", ")} (information_schema)
|
|
14040
|
+
`;
|
|
14041
|
+
out += `// Compatibility snapshot, not a canonical database contract.
|
|
14042
|
+
`;
|
|
14043
|
+
out += `// Use supacloud-db generate/check for source contracts and runtime decoders for trust boundaries.
|
|
14040
14044
|
|
|
14041
14045
|
`;
|
|
14042
14046
|
for (const [key, cols] of Object.entries(tables)) {
|
|
@@ -14060,19 +14064,28 @@ function generateTypeScriptTypes(data, schemas) {
|
|
|
14060
14064
|
}
|
|
14061
14065
|
function pgToTs(t) {
|
|
14062
14066
|
const m = {
|
|
14063
|
-
integer: "number",
|
|
14064
|
-
bigint: "number",
|
|
14065
14067
|
smallint: "number",
|
|
14066
|
-
|
|
14068
|
+
integer: "number",
|
|
14067
14069
|
real: "number",
|
|
14068
14070
|
"double precision": "number",
|
|
14071
|
+
bigint: "bigint | string",
|
|
14072
|
+
numeric: "string",
|
|
14073
|
+
money: "string",
|
|
14069
14074
|
boolean: "boolean",
|
|
14070
14075
|
text: "string",
|
|
14071
14076
|
"character varying": "string",
|
|
14077
|
+
character: "string",
|
|
14078
|
+
"character varying[]": "string[]",
|
|
14072
14079
|
uuid: "string",
|
|
14080
|
+
name: "string",
|
|
14081
|
+
citext: "string",
|
|
14073
14082
|
date: "string",
|
|
14083
|
+
time: "string",
|
|
14084
|
+
"time with time zone": "string",
|
|
14085
|
+
timestamp: "string",
|
|
14074
14086
|
"timestamp with time zone": "string",
|
|
14075
14087
|
timestamptz: "string",
|
|
14088
|
+
bytea: "Uint8Array",
|
|
14076
14089
|
json: "unknown",
|
|
14077
14090
|
jsonb: "unknown"
|
|
14078
14091
|
};
|
|
@@ -22185,7 +22198,7 @@ var starter_metadata_default = {
|
|
|
22185
22198
|
generatedBy: "supacloud/starter-metadata-v1",
|
|
22186
22199
|
packages: {
|
|
22187
22200
|
compiler: {
|
|
22188
|
-
version: "0.
|
|
22201
|
+
version: "0.55.0"
|
|
22189
22202
|
},
|
|
22190
22203
|
app: {
|
|
22191
22204
|
version: "0.36.0",
|
|
@@ -22194,7 +22207,7 @@ var starter_metadata_default = {
|
|
|
22194
22207
|
}
|
|
22195
22208
|
},
|
|
22196
22209
|
elysia: {
|
|
22197
|
-
version: "0.38.
|
|
22210
|
+
version: "0.38.1"
|
|
22198
22211
|
},
|
|
22199
22212
|
commands: {
|
|
22200
22213
|
version: "0.11.2"
|
|
@@ -22203,7 +22216,7 @@ var starter_metadata_default = {
|
|
|
22203
22216
|
version: "0.15.2"
|
|
22204
22217
|
},
|
|
22205
22218
|
db: {
|
|
22206
|
-
version: "0.20.
|
|
22219
|
+
version: "0.20.5",
|
|
22207
22220
|
peerDependencies: {
|
|
22208
22221
|
"drizzle-orm": "1.0.0-rc.5-5935859"
|
|
22209
22222
|
},
|
|
@@ -22212,7 +22225,7 @@ var starter_metadata_default = {
|
|
|
22212
22225
|
}
|
|
22213
22226
|
},
|
|
22214
22227
|
sdk: {
|
|
22215
|
-
version: "0.
|
|
22228
|
+
version: "0.46.0",
|
|
22216
22229
|
peerDependencies: {
|
|
22217
22230
|
"@supabase/supabase-js": "^2.118.0"
|
|
22218
22231
|
}
|
|
@@ -29749,6 +29762,7 @@ import {
|
|
|
29749
29762
|
readCatalog,
|
|
29750
29763
|
reconcileModule
|
|
29751
29764
|
} from "@supacloud/db";
|
|
29765
|
+
import { databaseSources } from "@supacloud/db/source-contracts";
|
|
29752
29766
|
|
|
29753
29767
|
// src/shared/tools/db-workflow.ts
|
|
29754
29768
|
import { createHash as createHash9 } from "node:crypto";
|
|
@@ -30545,7 +30559,7 @@ function parseSchemas(schema) {
|
|
|
30545
30559
|
const schemas = schema?.split(",").map((entry) => entry.trim()).filter(Boolean);
|
|
30546
30560
|
return schemas && schemas.length > 0 ? schemas : ["public"];
|
|
30547
30561
|
}
|
|
30548
|
-
async function
|
|
30562
|
+
async function collectLintIssues(args, root) {
|
|
30549
30563
|
const modules = await loadDatabaseModules(root, args.module_file);
|
|
30550
30564
|
const selected = args.module ? modules.filter((module) => module.name === args.module) : modules;
|
|
30551
30565
|
if (args.module && selected.length === 0) {
|
|
@@ -30564,6 +30578,10 @@ async function runLint(args, root) {
|
|
|
30564
30578
|
};
|
|
30565
30579
|
issues.push(...await lintModule(module, readSqlFile));
|
|
30566
30580
|
}
|
|
30581
|
+
return { selected, issues };
|
|
30582
|
+
}
|
|
30583
|
+
async function runLint(args, root) {
|
|
30584
|
+
const { selected, issues } = await collectLintIssues(args, root);
|
|
30567
30585
|
const hasError = issues.some((issue) => issue.severity === "error");
|
|
30568
30586
|
const header = `linted ${selected.length} module(s): ${selected.map((module) => module.name).join(", ")}`;
|
|
30569
30587
|
const body = issues.length > 0 ? issues.map(formatLintIssue).join(`
|
|
@@ -30571,6 +30589,69 @@ async function runLint(args, root) {
|
|
|
30571
30589
|
return textResult2(`${header}
|
|
30572
30590
|
${body}`, hasError);
|
|
30573
30591
|
}
|
|
30592
|
+
async function runCheck2(args, root, environment, spawn, liteBinary, options) {
|
|
30593
|
+
const checks = [];
|
|
30594
|
+
let ok = true;
|
|
30595
|
+
if (existsSync13(join16(root, "database.sources.json"))) {
|
|
30596
|
+
try {
|
|
30597
|
+
const source = await databaseSources(root, "check");
|
|
30598
|
+
checks.push({ name: "source-contract", ok: source.ok, findings: source.findings });
|
|
30599
|
+
if (!source.ok)
|
|
30600
|
+
ok = false;
|
|
30601
|
+
} catch (error) {
|
|
30602
|
+
checks.push({ name: "source-contract", ok: false, error: error instanceof Error ? error.message : String(error) });
|
|
30603
|
+
ok = false;
|
|
30604
|
+
}
|
|
30605
|
+
} else {
|
|
30606
|
+
checks.push({ name: "source-contract", skipped: true, reason: "database.sources.json not found" });
|
|
30607
|
+
}
|
|
30608
|
+
const modulePath = args.module_file ? resolve21(root, args.module_file) : join16(root, "db/modules.ts");
|
|
30609
|
+
if (existsSync13(modulePath)) {
|
|
30610
|
+
try {
|
|
30611
|
+
const { selected, issues } = await collectLintIssues(args, root);
|
|
30612
|
+
const lintOk = !issues.some((issue) => issue.severity === "error");
|
|
30613
|
+
checks.push({
|
|
30614
|
+
name: "module-lint",
|
|
30615
|
+
ok: lintOk,
|
|
30616
|
+
modules: selected.map((module) => module.name),
|
|
30617
|
+
...issues.length === 0 ? {} : { issues: issues.map(formatLintIssue) }
|
|
30618
|
+
});
|
|
30619
|
+
if (!lintOk)
|
|
30620
|
+
ok = false;
|
|
30621
|
+
} catch (error) {
|
|
30622
|
+
checks.push({ name: "module-lint", ok: false, error: error instanceof Error ? error.message : String(error) });
|
|
30623
|
+
ok = false;
|
|
30624
|
+
}
|
|
30625
|
+
} else {
|
|
30626
|
+
checks.push({ name: "module-lint", skipped: true, reason: "db/modules.ts not found" });
|
|
30627
|
+
}
|
|
30628
|
+
const selectedDatabase = args.database_url?.trim() || environment.DATABASE_URL?.trim();
|
|
30629
|
+
if (selectedDatabase || args.lite || args.remote) {
|
|
30630
|
+
try {
|
|
30631
|
+
const catalog = await runModuleCheckAction(args, root, environment, spawn, liteBinary, options);
|
|
30632
|
+
checks.push({
|
|
30633
|
+
name: "catalog",
|
|
30634
|
+
ok: !catalog.isError,
|
|
30635
|
+
output: catalog.content.map((entry) => entry.text).join(`
|
|
30636
|
+
`)
|
|
30637
|
+
});
|
|
30638
|
+
if (catalog.isError)
|
|
30639
|
+
ok = false;
|
|
30640
|
+
} catch (error) {
|
|
30641
|
+
checks.push({ name: "catalog", ok: false, error: error instanceof Error ? error.message : String(error) });
|
|
30642
|
+
ok = false;
|
|
30643
|
+
}
|
|
30644
|
+
} else {
|
|
30645
|
+
checks.push({ name: "catalog", skipped: true, reason: "no --database_url, DATABASE_URL, --lite or --remote" });
|
|
30646
|
+
}
|
|
30647
|
+
return textResult2(JSON.stringify({
|
|
30648
|
+
version: 1,
|
|
30649
|
+
scope: "database-check",
|
|
30650
|
+
root,
|
|
30651
|
+
ok,
|
|
30652
|
+
checks
|
|
30653
|
+
}, null, 2), !ok);
|
|
30654
|
+
}
|
|
30574
30655
|
async function runExplain2(args, root) {
|
|
30575
30656
|
const target = args.target?.trim();
|
|
30576
30657
|
if (!target)
|
|
@@ -30701,7 +30782,7 @@ function registerDbGovernanceTools(server, options = {}) {
|
|
|
30701
30782
|
const fallbackRoot = options.currentWorkingDirectory || process.cwd();
|
|
30702
30783
|
const liteSpawn = options.liteSpawn || defaultLiteSpawn;
|
|
30703
30784
|
registerTool(server, "db", "Database governance (@supacloud/db): inspect, reverse-adopt, diff, plan and apply through explicit source and migration boundaries. Actions: context, lint, explain, module_check, reverse, diff, plan, apply, role_check, role_sql", {
|
|
30704
|
-
action: withDescription(stringEnum2(["context", "lint", "explain", "module_check", "reverse", "diff", "plan", "apply", "role_check", "role_sql"]), "Database governance action"),
|
|
30785
|
+
action: withDescription(stringEnum2(["context", "lint", "check", "explain", "module_check", "reverse", "diff", "plan", "apply", "role_check", "role_sql"]), "Database governance action"),
|
|
30705
30786
|
module: optional(String2(), "[context/lint] Only select this manifest module (default: all)"),
|
|
30706
30787
|
root: optional(String2(), "[*] Project root (default: current directory)"),
|
|
30707
30788
|
module_file: optional(String2(), "[*] File exporting defineDatabaseModule(...) (default: <root>/db/modules.ts)"),
|
|
@@ -30727,6 +30808,8 @@ function registerDbGovernanceTools(server, options = {}) {
|
|
|
30727
30808
|
return runContext2(request, root);
|
|
30728
30809
|
case "lint":
|
|
30729
30810
|
return runLint(request, root);
|
|
30811
|
+
case "check":
|
|
30812
|
+
return runCheck2(request, root, environment, liteSpawn, options.liteBinary, options);
|
|
30730
30813
|
case "explain":
|
|
30731
30814
|
return runExplain2(request, root);
|
|
30732
30815
|
case "module_check":
|
|
@@ -33757,7 +33840,7 @@ async function runProjectDeployment(http, args) {
|
|
|
33757
33840
|
// package.json
|
|
33758
33841
|
var package_default = {
|
|
33759
33842
|
name: "@supacloud/cli",
|
|
33760
|
-
version: "0.115.
|
|
33843
|
+
version: "0.115.2",
|
|
33761
33844
|
description: "Project-scoped CLI for SupaCloud users",
|
|
33762
33845
|
type: "module",
|
|
33763
33846
|
main: "./dist/index.js",
|
|
@@ -33809,9 +33892,9 @@ var package_default = {
|
|
|
33809
33892
|
directory: "packages/cli"
|
|
33810
33893
|
},
|
|
33811
33894
|
dependencies: {
|
|
33812
|
-
"@supacloud/compiler": "^0.
|
|
33895
|
+
"@supacloud/compiler": "^0.55.0",
|
|
33813
33896
|
"@supacloud/delivery": "0.24.0",
|
|
33814
|
-
"@supacloud/db": "0.20.
|
|
33897
|
+
"@supacloud/db": "0.20.5",
|
|
33815
33898
|
typebox: "1.4.3"
|
|
33816
33899
|
},
|
|
33817
33900
|
overrides: {
|
|
@@ -33821,7 +33904,7 @@ var package_default = {
|
|
|
33821
33904
|
},
|
|
33822
33905
|
devDependencies: {
|
|
33823
33906
|
"@supabase/supabase-js": "2.118.0",
|
|
33824
|
-
"@supacloud/elysia": "0.38.
|
|
33907
|
+
"@supacloud/elysia": "0.38.1",
|
|
33825
33908
|
"@types/bun": "^1.4.4",
|
|
33826
33909
|
effect: "4.0.5",
|
|
33827
33910
|
elysia: "2.0.0-rc.1",
|
|
@@ -2,7 +2,7 @@ import { type DatabaseModule, type QueryExecutor, type ReconcileReport } from "@
|
|
|
2
2
|
import { type DbWorkflowAction } from "./db-workflow";
|
|
3
3
|
import { type ToolServer, type ToolResult } from "../tool-server";
|
|
4
4
|
export interface DbToolArguments {
|
|
5
|
-
action: "context" | "lint" | "explain" | "module_check" | DbWorkflowAction;
|
|
5
|
+
action: "context" | "lint" | "check" | "explain" | "module_check" | DbWorkflowAction;
|
|
6
6
|
module?: string;
|
|
7
7
|
root?: string;
|
|
8
8
|
module_file?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supacloud/cli",
|
|
3
|
-
"version": "0.115.
|
|
3
|
+
"version": "0.115.2",
|
|
4
4
|
"description": "Project-scoped CLI for SupaCloud users",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"directory": "packages/cli"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@supacloud/compiler": "^0.
|
|
55
|
+
"@supacloud/compiler": "^0.55.0",
|
|
56
56
|
"@supacloud/delivery": "0.24.0",
|
|
57
|
-
"@supacloud/db": "0.20.
|
|
57
|
+
"@supacloud/db": "0.20.5",
|
|
58
58
|
"typebox": "1.4.3"
|
|
59
59
|
},
|
|
60
60
|
"overrides": {
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@supabase/supabase-js": "2.118.0",
|
|
67
|
-
"@supacloud/elysia": "0.38.
|
|
67
|
+
"@supacloud/elysia": "0.38.1",
|
|
68
68
|
"@types/bun": "^1.4.4",
|
|
69
69
|
"effect": "4.0.5",
|
|
70
70
|
"elysia": "2.0.0-rc.1",
|