@rawsql-ts/ztd-cli 0.20.0 → 0.20.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/LICENSE +21 -0
- package/dist/commands/agents.d.ts +2 -0
- package/dist/commands/agents.js +68 -0
- package/dist/commands/agents.js.map +1 -0
- package/dist/commands/checkContract.d.ts +46 -0
- package/dist/commands/checkContract.js +359 -0
- package/dist/commands/checkContract.js.map +1 -0
- package/dist/commands/connectionOptions.d.ts +12 -0
- package/dist/commands/connectionOptions.js +22 -0
- package/dist/commands/connectionOptions.js.map +1 -0
- package/dist/commands/ddl.d.ts +7 -0
- package/dist/commands/ddl.js +145 -0
- package/dist/commands/ddl.js.map +1 -0
- package/dist/commands/describe.d.ts +23 -0
- package/dist/commands/describe.js +399 -0
- package/dist/commands/describe.js.map +1 -0
- package/dist/commands/diff.d.ts +24 -0
- package/dist/commands/diff.js +73 -0
- package/dist/commands/diff.js.map +1 -0
- package/dist/commands/genEntities.d.ts +14 -0
- package/dist/commands/genEntities.js +58 -0
- package/dist/commands/genEntities.js.map +1 -0
- package/dist/commands/init.d.ts +104 -0
- package/dist/commands/init.js +1480 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/lint.d.ts +89 -0
- package/dist/commands/lint.js +501 -0
- package/dist/commands/lint.js.map +1 -0
- package/dist/commands/modelGen.d.ts +60 -0
- package/dist/commands/modelGen.js +572 -0
- package/dist/commands/modelGen.js.map +1 -0
- package/dist/commands/options.d.ts +9 -0
- package/dist/commands/options.js +48 -0
- package/dist/commands/options.js.map +1 -0
- package/dist/commands/perf.d.ts +9 -0
- package/dist/commands/perf.js +374 -0
- package/dist/commands/perf.js.map +1 -0
- package/dist/commands/pull.d.ts +21 -0
- package/dist/commands/pull.js +115 -0
- package/dist/commands/pull.js.map +1 -0
- package/dist/commands/query.d.ts +9 -0
- package/dist/commands/query.js +377 -0
- package/dist/commands/query.js.map +1 -0
- package/dist/commands/testEvidence.d.ts +237 -0
- package/dist/commands/testEvidence.js +1220 -0
- package/dist/commands/testEvidence.js.map +1 -0
- package/dist/commands/ztdConfig.d.ts +30 -0
- package/dist/commands/ztdConfig.js +224 -0
- package/dist/commands/ztdConfig.js.map +1 -0
- package/dist/commands/ztdConfigCommand.d.ts +18 -0
- package/dist/commands/ztdConfigCommand.js +268 -0
- package/dist/commands/ztdConfigCommand.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +127 -0
- package/dist/index.js.map +1 -0
- package/dist/perf/benchmark.d.ts +277 -0
- package/dist/perf/benchmark.js +2186 -0
- package/dist/perf/benchmark.js.map +1 -0
- package/dist/perf/sandbox.d.ts +73 -0
- package/dist/perf/sandbox.js +492 -0
- package/dist/perf/sandbox.js.map +1 -0
- package/dist/query/analysis.d.ts +20 -0
- package/dist/query/analysis.js +192 -0
- package/dist/query/analysis.js.map +1 -0
- package/dist/query/analyzeColumnUsage.d.ts +10 -0
- package/dist/query/analyzeColumnUsage.js +451 -0
- package/dist/query/analyzeColumnUsage.js.map +1 -0
- package/dist/query/analyzeTableUsage.d.ts +10 -0
- package/dist/query/analyzeTableUsage.js +318 -0
- package/dist/query/analyzeTableUsage.js.map +1 -0
- package/dist/query/execute.d.ts +40 -0
- package/dist/query/execute.js +784 -0
- package/dist/query/execute.js.map +1 -0
- package/dist/query/format.d.ts +1 -0
- package/dist/query/format.js +9 -0
- package/dist/query/format.js.map +1 -0
- package/dist/query/lint.d.ts +29 -0
- package/dist/query/lint.js +340 -0
- package/dist/query/lint.js.map +1 -0
- package/dist/query/location.d.ts +18 -0
- package/dist/query/location.js +204 -0
- package/dist/query/location.js.map +1 -0
- package/dist/query/patch.d.ts +21 -0
- package/dist/query/patch.js +151 -0
- package/dist/query/patch.js.map +1 -0
- package/dist/query/planner.d.ts +31 -0
- package/dist/query/planner.js +134 -0
- package/dist/query/planner.js.map +1 -0
- package/dist/query/report.d.ts +7 -0
- package/dist/query/report.js +19 -0
- package/dist/query/report.js.map +1 -0
- package/dist/query/scalarFilterAnalysis.d.ts +6 -0
- package/dist/query/scalarFilterAnalysis.js +212 -0
- package/dist/query/scalarFilterAnalysis.js.map +1 -0
- package/dist/query/slice.d.ts +17 -0
- package/dist/query/slice.js +204 -0
- package/dist/query/slice.js.map +1 -0
- package/dist/query/structure.d.ts +24 -0
- package/dist/query/structure.js +135 -0
- package/dist/query/structure.js.map +1 -0
- package/dist/query/targets.d.ts +2 -0
- package/dist/query/targets.js +6 -0
- package/dist/query/targets.js.map +1 -0
- package/dist/query/types.d.ts +97 -0
- package/dist/query/types.js +3 -0
- package/dist/query/types.js.map +1 -0
- package/dist/specs/sql/activeOrders.catalog.d.ts +12 -0
- package/dist/specs/sql/activeOrders.catalog.js +36 -0
- package/dist/specs/sql/activeOrders.catalog.js.map +1 -0
- package/dist/specs/sql/usersList.catalog.d.ts +8 -0
- package/dist/specs/sql/usersList.catalog.js +14 -0
- package/dist/specs/sql/usersList.catalog.js.map +1 -0
- package/dist/specs/sqlCatalogDefinition.d.ts +20 -0
- package/dist/specs/sqlCatalogDefinition.js +10 -0
- package/dist/specs/sqlCatalogDefinition.js.map +1 -0
- package/dist/utils/agentCli.d.ts +23 -0
- package/dist/utils/agentCli.js +84 -0
- package/dist/utils/agentCli.js.map +1 -0
- package/dist/utils/agentSafety.d.ts +4 -0
- package/dist/utils/agentSafety.js +50 -0
- package/dist/utils/agentSafety.js.map +1 -0
- package/dist/utils/agents.d.ts +31 -0
- package/dist/utils/agents.js +362 -0
- package/dist/utils/agents.js.map +1 -0
- package/dist/utils/collectSqlFiles.d.ts +9 -0
- package/dist/utils/collectSqlFiles.js +58 -0
- package/dist/utils/collectSqlFiles.js.map +1 -0
- package/dist/utils/connectionSummary.d.ts +3 -0
- package/dist/utils/connectionSummary.js +29 -0
- package/dist/utils/connectionSummary.js.map +1 -0
- package/dist/utils/dbConnection.d.ts +31 -0
- package/dist/utils/dbConnection.js +151 -0
- package/dist/utils/dbConnection.js.map +1 -0
- package/dist/utils/fs.d.ts +1 -0
- package/dist/utils/fs.js +12 -0
- package/dist/utils/fs.js.map +1 -0
- package/dist/utils/modelGenBinder.d.ts +8 -0
- package/dist/utils/modelGenBinder.js +31 -0
- package/dist/utils/modelGenBinder.js.map +1 -0
- package/dist/utils/modelGenRender.d.ts +29 -0
- package/dist/utils/modelGenRender.js +158 -0
- package/dist/utils/modelGenRender.js.map +1 -0
- package/dist/utils/modelGenScanner.d.ts +24 -0
- package/dist/utils/modelGenScanner.js +196 -0
- package/dist/utils/modelGenScanner.js.map +1 -0
- package/dist/utils/modelProbe.d.ts +14 -0
- package/dist/utils/modelProbe.js +121 -0
- package/dist/utils/modelProbe.js.map +1 -0
- package/dist/utils/normalizePulledSchema.d.ts +12 -0
- package/dist/utils/normalizePulledSchema.js +213 -0
- package/dist/utils/normalizePulledSchema.js.map +1 -0
- package/dist/utils/optionalDependencies.d.ts +43 -0
- package/dist/utils/optionalDependencies.js +134 -0
- package/dist/utils/optionalDependencies.js.map +1 -0
- package/dist/utils/pgDump.d.ts +12 -0
- package/dist/utils/pgDump.js +58 -0
- package/dist/utils/pgDump.js.map +1 -0
- package/dist/utils/queryFingerprint.d.ts +14 -0
- package/dist/utils/queryFingerprint.js +34 -0
- package/dist/utils/queryFingerprint.js.map +1 -0
- package/dist/utils/sqlCatalogDiscovery.d.ts +44 -0
- package/dist/utils/sqlCatalogDiscovery.js +166 -0
- package/dist/utils/sqlCatalogDiscovery.js.map +1 -0
- package/dist/utils/sqlCatalogStatements.d.ts +20 -0
- package/dist/utils/sqlCatalogStatements.js +23 -0
- package/dist/utils/sqlCatalogStatements.js.map +1 -0
- package/dist/utils/sqlLintHelpers.d.ts +18 -0
- package/dist/utils/sqlLintHelpers.js +270 -0
- package/dist/utils/sqlLintHelpers.js.map +1 -0
- package/dist/utils/telemetry.d.ts +71 -0
- package/dist/utils/telemetry.js +597 -0
- package/dist/utils/telemetry.js.map +1 -0
- package/dist/utils/typeMapper.d.ts +4 -0
- package/dist/utils/typeMapper.js +79 -0
- package/dist/utils/typeMapper.js.map +1 -0
- package/dist/utils/ztdProjectConfig.d.ts +41 -0
- package/dist/utils/ztdProjectConfig.js +182 -0
- package/dist/utils/ztdProjectConfig.js.map +1 -0
- package/package.json +19 -20
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DEFAULT_DDL_DIRECTORY = exports.DEFAULT_EXTENSIONS = exports.parseExtensions = exports.collectDirectories = void 0;
|
|
7
|
+
exports.registerDdlCommands = registerDdlCommands;
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const diff_1 = require("./diff");
|
|
10
|
+
const genEntities_1 = require("./genEntities");
|
|
11
|
+
const pull_1 = require("./pull");
|
|
12
|
+
const connectionOptions_1 = require("./connectionOptions");
|
|
13
|
+
const options_1 = require("./options");
|
|
14
|
+
const agentCli_1 = require("../utils/agentCli");
|
|
15
|
+
const agentSafety_1 = require("../utils/agentSafety");
|
|
16
|
+
/**
|
|
17
|
+
* Registers all DDL-related commands (`pull`, `gen-entities`, `diff`) on the top-level CLI program.
|
|
18
|
+
* @param program - The Commander program instance to extend.
|
|
19
|
+
*/
|
|
20
|
+
function registerDdlCommands(program) {
|
|
21
|
+
const ddl = program.command('ddl').description('DDL-focused workflows');
|
|
22
|
+
ddl
|
|
23
|
+
.command('pull')
|
|
24
|
+
.description('Inspect schema state from an explicit target database and normalize the pulled DDL')
|
|
25
|
+
.option('--url <databaseUrl>', 'Explicit target database URL for inspection workflows (preferred over --db-*)')
|
|
26
|
+
.option('--out <directory>', 'Destination directory for the pulled DDL', options_1.DEFAULT_DDL_DIRECTORY)
|
|
27
|
+
.option('--db-host <host>', 'Explicit target database host when --url is not used')
|
|
28
|
+
.option('--db-port <port>', 'Explicit target database port (defaults to 5432)')
|
|
29
|
+
.option('--db-user <user>', 'Explicit target database user')
|
|
30
|
+
.option('--db-password <password>', 'Explicit target database password')
|
|
31
|
+
.option('--db-name <name>', 'Explicit target database name')
|
|
32
|
+
.option('--pg-dump-path <path>', 'Custom pg_dump executable path')
|
|
33
|
+
.option('--pg-dump-shell', 'Run the pg_dump path through a shell so wrapper commands like "docker exec <container> pg_dump" can be used')
|
|
34
|
+
.option('--schema <schema>', 'Schema name to include (repeatable)', options_1.collectValues, [])
|
|
35
|
+
.option('--table <table>', 'Table spec (schema.table) to include (repeatable)', options_1.collectValues, [])
|
|
36
|
+
.option('--dry-run', 'Validate pull inputs and normalize the dump without writing files')
|
|
37
|
+
.option('--json <payload>', 'Pass pull options as a JSON object')
|
|
38
|
+
.action(async (options) => {
|
|
39
|
+
var _a, _b, _c;
|
|
40
|
+
const merged = options.json ? { ...options, ...(0, agentCli_1.parseJsonPayload)(options.json, '--json') } : options;
|
|
41
|
+
const connection = (0, connectionOptions_1.resolveExplicitCliConnection)(merged);
|
|
42
|
+
const result = await (0, pull_1.runPullSchema)({
|
|
43
|
+
url: connection.url,
|
|
44
|
+
out: (0, agentSafety_1.validateProjectPath)(String((_a = merged.out) !== null && _a !== void 0 ? _a : options_1.DEFAULT_DDL_DIRECTORY), '--out'),
|
|
45
|
+
pgDumpPath: merged.pgDumpPath,
|
|
46
|
+
pgDumpShell: Boolean(merged.pgDumpShell),
|
|
47
|
+
schemas: ((_b = merged.schema) !== null && _b !== void 0 ? _b : []).map((value) => (0, agentSafety_1.validateResourceIdentifier)(String(value), '--schema')),
|
|
48
|
+
tables: ((_c = merged.table) !== null && _c !== void 0 ? _c : []).map((value) => (0, agentSafety_1.validateResourceIdentifier)(String(value), '--table')),
|
|
49
|
+
connectionContext: connection.context,
|
|
50
|
+
dryRun: Boolean(merged.dryRun)
|
|
51
|
+
});
|
|
52
|
+
if ((0, agentCli_1.isJsonOutput)()) {
|
|
53
|
+
(0, agentCli_1.writeCommandEnvelope)('ddl pull', {
|
|
54
|
+
schemaVersion: 1,
|
|
55
|
+
dryRun: result.dryRun,
|
|
56
|
+
outDir: result.outDir,
|
|
57
|
+
files: result.files.map((file) => ({ schema: file.schema, path: file.filePath, bytes: file.contents.length }))
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
ddl
|
|
62
|
+
.command('gen-entities')
|
|
63
|
+
.description('Generate optional entities.ts helpers from the DDL snapshot')
|
|
64
|
+
.option('--ddl-dir <directory>', 'DDL directory to scan (repeatable)', options_1.collectDirectories, [])
|
|
65
|
+
.option('--extensions <list>', 'Comma-separated extensions to include', options_1.parseExtensions, options_1.DEFAULT_EXTENSIONS)
|
|
66
|
+
.option('--out <file>', 'Destination TypeScript file', node_path_1.default.join('src', 'entities.ts'))
|
|
67
|
+
.option('--dry-run', 'Render entities without writing the destination file')
|
|
68
|
+
.option('--json <payload>', 'Pass generation options as a JSON object')
|
|
69
|
+
.action(async (options) => {
|
|
70
|
+
var _a;
|
|
71
|
+
const merged = options.json ? { ...options, ...(0, agentCli_1.parseJsonPayload)(options.json, '--json') } : options;
|
|
72
|
+
const directories = (0, options_1.normalizeDirectoryList)(merged.ddlDir, options_1.DEFAULT_DDL_DIRECTORY);
|
|
73
|
+
const extensions = (0, options_1.resolveExtensions)(merged.extensions, options_1.DEFAULT_EXTENSIONS);
|
|
74
|
+
const result = await (0, genEntities_1.runGenerateEntities)({
|
|
75
|
+
directories,
|
|
76
|
+
extensions,
|
|
77
|
+
out: (0, agentSafety_1.validateProjectPath)(String((_a = merged.out) !== null && _a !== void 0 ? _a : node_path_1.default.join('src', 'entities.ts')), '--out'),
|
|
78
|
+
dryRun: Boolean(merged.dryRun)
|
|
79
|
+
});
|
|
80
|
+
if ((0, agentCli_1.isJsonOutput)()) {
|
|
81
|
+
(0, agentCli_1.writeCommandEnvelope)('ddl gen-entities', {
|
|
82
|
+
schemaVersion: 1,
|
|
83
|
+
dryRun: result.dryRun,
|
|
84
|
+
outFile: result.outFile,
|
|
85
|
+
tables: result.tables.map((table) => table.name),
|
|
86
|
+
bytes: result.rendered.length
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
ddl
|
|
91
|
+
.command('diff')
|
|
92
|
+
.description('Compare local DDL against an explicit target database for inspection purposes')
|
|
93
|
+
.option('--ddl-dir <directory>', 'DDL directory to scan (repeatable)', options_1.collectDirectories, [])
|
|
94
|
+
.option('--extensions <list>', 'Comma-separated extensions to include', options_1.parseExtensions, options_1.DEFAULT_EXTENSIONS)
|
|
95
|
+
.option('--url <databaseUrl>', 'Explicit target database URL for inspection workflows (preferred over --db-*)')
|
|
96
|
+
.option('--out <file>', 'Output path for the generated plan file')
|
|
97
|
+
.option('--db-host <host>', 'Explicit target database host when --url is not used')
|
|
98
|
+
.option('--db-port <port>', 'Explicit target database port (defaults to 5432)')
|
|
99
|
+
.option('--db-user <user>', 'Explicit target database user')
|
|
100
|
+
.option('--db-password <password>', 'Explicit target database password')
|
|
101
|
+
.option('--db-name <name>', 'Explicit target database name')
|
|
102
|
+
.option('--pg-dump-path <path>', 'Custom pg_dump executable path')
|
|
103
|
+
.option('--pg-dump-shell', 'Run the pg_dump path through a shell so wrapper commands like "docker exec <container> pg_dump" can be used')
|
|
104
|
+
.option('--dry-run', 'Compute the diff plan without writing the patch file')
|
|
105
|
+
.option('--json <payload>', 'Pass diff options as a JSON object')
|
|
106
|
+
.action(async (options) => {
|
|
107
|
+
var _a;
|
|
108
|
+
const merged = options.json ? { ...options, ...(0, agentCli_1.parseJsonPayload)(options.json, '--json') } : options;
|
|
109
|
+
const outPath = resolveRequiredProjectPath(merged.out, '--out');
|
|
110
|
+
const directories = (0, options_1.normalizeDirectoryList)((_a = merged.ddlDir) !== null && _a !== void 0 ? _a : [], options_1.DEFAULT_DDL_DIRECTORY);
|
|
111
|
+
const extensions = (0, options_1.resolveExtensions)(merged.extensions, options_1.DEFAULT_EXTENSIONS);
|
|
112
|
+
const connection = (0, connectionOptions_1.resolveExplicitCliConnection)(merged);
|
|
113
|
+
const result = await (0, diff_1.runDiffSchema)({
|
|
114
|
+
directories,
|
|
115
|
+
extensions,
|
|
116
|
+
url: connection.url,
|
|
117
|
+
out: outPath,
|
|
118
|
+
pgDumpPath: merged.pgDumpPath,
|
|
119
|
+
pgDumpShell: Boolean(merged.pgDumpShell),
|
|
120
|
+
connectionContext: connection.context,
|
|
121
|
+
dryRun: Boolean(merged.dryRun)
|
|
122
|
+
});
|
|
123
|
+
if ((0, agentCli_1.isJsonOutput)()) {
|
|
124
|
+
(0, agentCli_1.writeCommandEnvelope)('ddl diff', {
|
|
125
|
+
schemaVersion: 1,
|
|
126
|
+
dryRun: result.dryRun,
|
|
127
|
+
outFile: result.outFile,
|
|
128
|
+
hasChanges: result.hasChanges,
|
|
129
|
+
patchBytes: result.patch.length
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
var options_2 = require("./options");
|
|
135
|
+
Object.defineProperty(exports, "collectDirectories", { enumerable: true, get: function () { return options_2.collectDirectories; } });
|
|
136
|
+
Object.defineProperty(exports, "parseExtensions", { enumerable: true, get: function () { return options_2.parseExtensions; } });
|
|
137
|
+
Object.defineProperty(exports, "DEFAULT_EXTENSIONS", { enumerable: true, get: function () { return options_2.DEFAULT_EXTENSIONS; } });
|
|
138
|
+
Object.defineProperty(exports, "DEFAULT_DDL_DIRECTORY", { enumerable: true, get: function () { return options_2.DEFAULT_DDL_DIRECTORY; } });
|
|
139
|
+
function resolveRequiredProjectPath(value, label) {
|
|
140
|
+
if (typeof value !== 'string' || value.trim().length === 0) {
|
|
141
|
+
throw new Error(`${label} is required (either via ${label} or --json {"${label.slice(2)}":"..."}).`);
|
|
142
|
+
}
|
|
143
|
+
return (0, agentSafety_1.validateProjectPath)(value, label);
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=ddl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
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T,CAAC;AAED,qCAA2G;AAAlG,6GAAA,kBAAkB,OAAA;AAAE,0GAAA,eAAe,OAAA;AAAE,6GAAA,kBAAkB,OAAA;AAAE,gHAAA,qBAAqB,OAAA;AAEvF,SAAS,0BAA0B,CAAC,KAAc,EAAE,KAAa;IAC/D,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3D,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,4BAA4B,KAAK,gBAAgB,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;IACvG,CAAC;IAED,OAAO,IAAA,iCAAmB,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
interface CommandFlagDescriptor {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
defaultValue?: string | boolean;
|
|
6
|
+
}
|
|
7
|
+
interface CommandDescriptor {
|
|
8
|
+
name: string;
|
|
9
|
+
summary: string;
|
|
10
|
+
writesFiles: boolean;
|
|
11
|
+
supportsDryRun: boolean;
|
|
12
|
+
supportsJsonPayload: boolean;
|
|
13
|
+
supportsDescribeOutput?: boolean;
|
|
14
|
+
output?: {
|
|
15
|
+
stdout?: string;
|
|
16
|
+
files?: string[];
|
|
17
|
+
};
|
|
18
|
+
exitCodes: Record<string, string>;
|
|
19
|
+
flags: CommandFlagDescriptor[];
|
|
20
|
+
}
|
|
21
|
+
export declare function getDescribeCommandDescriptors(): readonly CommandDescriptor[];
|
|
22
|
+
export declare function registerDescribeCommand(program: Command): void;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDescribeCommandDescriptors = getDescribeCommandDescriptors;
|
|
4
|
+
exports.registerDescribeCommand = registerDescribeCommand;
|
|
5
|
+
const agentCli_1 = require("../utils/agentCli");
|
|
6
|
+
const COMMANDS = [
|
|
7
|
+
{
|
|
8
|
+
name: 'init',
|
|
9
|
+
summary: 'Scaffold a ZTD project with templates, config, and optional demo assets.',
|
|
10
|
+
writesFiles: true,
|
|
11
|
+
supportsDryRun: true,
|
|
12
|
+
supportsJsonPayload: true,
|
|
13
|
+
output: {
|
|
14
|
+
stdout: 'Human summary in text mode, JSON envelope in global json mode.',
|
|
15
|
+
files: ['ztd.config.json', 'ztd/ddl/*.sql', 'tests/generated/*', '.ztd/agents/*', 'CONTEXT.md']
|
|
16
|
+
},
|
|
17
|
+
exitCodes: {
|
|
18
|
+
'0': 'Scaffold completed or dry-run plan emitted.',
|
|
19
|
+
'1': 'Validation or filesystem error.'
|
|
20
|
+
},
|
|
21
|
+
flags: [
|
|
22
|
+
{ name: '--dry-run', description: 'Validate inputs and emit the planned scaffold without writing files.' },
|
|
23
|
+
{ name: '--json', description: 'Pass init options as a JSON object.' },
|
|
24
|
+
{ name: '--yes', description: 'Accept defaults and overwrite existing files.' }
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'agents install',
|
|
29
|
+
summary: 'Install visible AGENTS.md files from the managed templates.',
|
|
30
|
+
writesFiles: true,
|
|
31
|
+
supportsDryRun: false,
|
|
32
|
+
supportsJsonPayload: false,
|
|
33
|
+
output: {
|
|
34
|
+
stdout: 'Human install summary in text mode, JSON envelope in global json mode.',
|
|
35
|
+
files: ['AGENTS.md or AGENTS_ztd.md', 'ztd/AGENTS.md', 'src/**/AGENTS.md', 'tests/**/AGENTS.md']
|
|
36
|
+
},
|
|
37
|
+
exitCodes: {
|
|
38
|
+
'0': 'Visible AGENTS installation completed or was already up to date.',
|
|
39
|
+
'1': 'Filesystem or validation error.'
|
|
40
|
+
},
|
|
41
|
+
flags: []
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'agents status',
|
|
45
|
+
summary: 'Report managed AGENTS guidance state and drift signals.',
|
|
46
|
+
writesFiles: false,
|
|
47
|
+
supportsDryRun: false,
|
|
48
|
+
supportsJsonPayload: false,
|
|
49
|
+
output: {
|
|
50
|
+
stdout: 'Human status report in text mode, JSON envelope in global json mode.'
|
|
51
|
+
},
|
|
52
|
+
exitCodes: {
|
|
53
|
+
'0': 'Status emitted.',
|
|
54
|
+
'1': 'Filesystem or parsing error.'
|
|
55
|
+
},
|
|
56
|
+
flags: []
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'ztd-config',
|
|
60
|
+
summary: 'Generate TestRowMap and layout metadata from local DDL.',
|
|
61
|
+
writesFiles: true,
|
|
62
|
+
supportsDryRun: true,
|
|
63
|
+
supportsJsonPayload: true,
|
|
64
|
+
output: {
|
|
65
|
+
stdout: 'Status or JSON envelope.',
|
|
66
|
+
files: ['tests/generated/ztd-row-map.generated.ts', 'tests/generated/ztd-layout.generated.ts']
|
|
67
|
+
},
|
|
68
|
+
exitCodes: {
|
|
69
|
+
'0': 'Generation completed or dry-run plan emitted.',
|
|
70
|
+
'1': 'Generation failed.'
|
|
71
|
+
},
|
|
72
|
+
flags: [
|
|
73
|
+
{ name: '--dry-run', description: 'Render and validate generation without writing files.' },
|
|
74
|
+
{ name: '--json', description: 'Pass ztd-config options as a JSON object.' },
|
|
75
|
+
{ name: '--watch', description: 'Watch DDL files and regenerate on change.', defaultValue: false }
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'model-gen',
|
|
80
|
+
summary: 'Probe SQL metadata and generate QuerySpec scaffolding.',
|
|
81
|
+
writesFiles: true,
|
|
82
|
+
supportsDryRun: true,
|
|
83
|
+
supportsJsonPayload: true,
|
|
84
|
+
supportsDescribeOutput: true,
|
|
85
|
+
output: {
|
|
86
|
+
stdout: 'Generated TypeScript when --out is omitted; JSON envelope in global json mode.',
|
|
87
|
+
files: ['Specified --out file when present']
|
|
88
|
+
},
|
|
89
|
+
exitCodes: {
|
|
90
|
+
'0': 'Generation completed, dry-run plan emitted, or output contract described.',
|
|
91
|
+
'1': 'Validation or probing failed.'
|
|
92
|
+
},
|
|
93
|
+
flags: [
|
|
94
|
+
{ name: '--dry-run', description: 'Validate probing and show the planned output file without writing it.' },
|
|
95
|
+
{ name: '--json', description: 'Pass model-gen options as a JSON object.' },
|
|
96
|
+
{ name: '--describe-output', description: 'Print the generated artifact contract instead of probing.' }
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: 'ddl pull',
|
|
101
|
+
summary: 'Pull PostgreSQL schema DDL via pg_dump and normalize it into per-schema files.',
|
|
102
|
+
writesFiles: true,
|
|
103
|
+
supportsDryRun: true,
|
|
104
|
+
supportsJsonPayload: true,
|
|
105
|
+
output: {
|
|
106
|
+
stdout: 'Status or JSON envelope.',
|
|
107
|
+
files: ['<out>/<schema>.sql']
|
|
108
|
+
},
|
|
109
|
+
exitCodes: {
|
|
110
|
+
'0': 'Pull completed or dry-run plan emitted.',
|
|
111
|
+
'1': 'pg_dump or normalization failed.'
|
|
112
|
+
},
|
|
113
|
+
flags: [
|
|
114
|
+
{ name: '--dry-run', description: 'Run pg_dump and normalization without writing schema files.' },
|
|
115
|
+
{ name: '--json', description: 'Pass pull options as a JSON object.' }
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: 'ddl diff',
|
|
120
|
+
summary: 'Compare local DDL with a live database and emit a diff plan.',
|
|
121
|
+
writesFiles: true,
|
|
122
|
+
supportsDryRun: true,
|
|
123
|
+
supportsJsonPayload: true,
|
|
124
|
+
output: {
|
|
125
|
+
stdout: 'Status or JSON envelope.',
|
|
126
|
+
files: ['Specified --out patch file']
|
|
127
|
+
},
|
|
128
|
+
exitCodes: {
|
|
129
|
+
'0': 'Diff completed or dry-run plan emitted.',
|
|
130
|
+
'1': 'Local discovery or pg_dump failed.'
|
|
131
|
+
},
|
|
132
|
+
flags: [
|
|
133
|
+
{ name: '--dry-run', description: 'Compute the patch without writing the plan file.' },
|
|
134
|
+
{ name: '--json', description: 'Pass diff options as a JSON object.' }
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: 'ddl gen-entities',
|
|
139
|
+
summary: 'Generate helper interfaces from DDL metadata.',
|
|
140
|
+
writesFiles: true,
|
|
141
|
+
supportsDryRun: true,
|
|
142
|
+
supportsJsonPayload: true,
|
|
143
|
+
output: {
|
|
144
|
+
stdout: 'Status or JSON envelope.',
|
|
145
|
+
files: ['Specified --out entities file']
|
|
146
|
+
},
|
|
147
|
+
exitCodes: {
|
|
148
|
+
'0': 'Generation completed or dry-run plan emitted.',
|
|
149
|
+
'1': 'DDL parsing failed.'
|
|
150
|
+
},
|
|
151
|
+
flags: [
|
|
152
|
+
{ name: '--dry-run', description: 'Render entities without writing the output file.' },
|
|
153
|
+
{ name: '--json', description: 'Pass generation options as a JSON object.' }
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
name: 'check contract',
|
|
158
|
+
summary: 'Validate SQL contract specs and emit deterministic findings.',
|
|
159
|
+
writesFiles: true,
|
|
160
|
+
supportsDryRun: false,
|
|
161
|
+
supportsJsonPayload: true,
|
|
162
|
+
output: {
|
|
163
|
+
stdout: 'Human report or deterministic JSON report.'
|
|
164
|
+
},
|
|
165
|
+
exitCodes: {
|
|
166
|
+
'0': 'No violations.',
|
|
167
|
+
'1': 'Violations detected.',
|
|
168
|
+
'2': 'Runtime or config error.'
|
|
169
|
+
},
|
|
170
|
+
flags: [
|
|
171
|
+
{ name: '--format json', description: 'Emit the report as deterministic JSON.' },
|
|
172
|
+
{ name: '--json', description: 'Pass check options as a JSON object.' }
|
|
173
|
+
]
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: 'perf init',
|
|
177
|
+
summary: 'Scaffold the opt-in perf sandbox configuration and Docker assets.',
|
|
178
|
+
writesFiles: true,
|
|
179
|
+
supportsDryRun: true,
|
|
180
|
+
supportsJsonPayload: true,
|
|
181
|
+
output: {
|
|
182
|
+
stdout: 'Human scaffold summary or JSON envelope.',
|
|
183
|
+
files: ['perf/sandbox.json', 'perf/seed.yml', 'perf/params.yml', 'perf/docker-compose.yml', 'perf/README.md', 'perf/.gitignore']
|
|
184
|
+
},
|
|
185
|
+
exitCodes: {
|
|
186
|
+
'0': 'Scaffold completed or dry-run plan emitted.',
|
|
187
|
+
'1': 'Validation or filesystem error.'
|
|
188
|
+
},
|
|
189
|
+
flags: [
|
|
190
|
+
{ name: '--dry-run', description: 'Emit the planned perf sandbox scaffold without writing files.' },
|
|
191
|
+
{ name: '--json', description: 'Pass perf init options as a JSON object.' }
|
|
192
|
+
]
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: 'perf db reset',
|
|
196
|
+
summary: 'Recreate the perf sandbox schema from local DDL.',
|
|
197
|
+
writesFiles: false,
|
|
198
|
+
supportsDryRun: true,
|
|
199
|
+
supportsJsonPayload: true,
|
|
200
|
+
output: {
|
|
201
|
+
stdout: 'Human reset summary or JSON envelope.'
|
|
202
|
+
},
|
|
203
|
+
exitCodes: {
|
|
204
|
+
'0': 'Reset completed or dry-run plan emitted.',
|
|
205
|
+
'1': 'Docker, connection, or DDL replay failed.'
|
|
206
|
+
},
|
|
207
|
+
flags: [
|
|
208
|
+
{ name: '--dry-run', description: 'Emit the DDL replay plan without touching Docker or PostgreSQL.' },
|
|
209
|
+
{ name: '--json', description: 'Pass perf db reset options as a JSON object.' }
|
|
210
|
+
]
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
name: 'perf seed',
|
|
214
|
+
summary: 'Generate deterministic synthetic data from perf/seed.yml.',
|
|
215
|
+
writesFiles: false,
|
|
216
|
+
supportsDryRun: true,
|
|
217
|
+
supportsJsonPayload: true,
|
|
218
|
+
output: {
|
|
219
|
+
stdout: 'Human seed summary or JSON envelope.'
|
|
220
|
+
},
|
|
221
|
+
exitCodes: {
|
|
222
|
+
'0': 'Seed completed or dry-run plan emitted.',
|
|
223
|
+
'1': 'Connection, DDL parsing, or insert generation failed.'
|
|
224
|
+
},
|
|
225
|
+
flags: [
|
|
226
|
+
{ name: '--dry-run', description: 'Emit the seed plan without touching PostgreSQL.' },
|
|
227
|
+
{ name: '--json', description: 'Pass perf seed options as a JSON object.' }
|
|
228
|
+
]
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: 'perf run',
|
|
232
|
+
summary: 'Benchmark a SQL query and emit evidence for AI-driven tuning loops.',
|
|
233
|
+
writesFiles: true,
|
|
234
|
+
supportsDryRun: true,
|
|
235
|
+
supportsJsonPayload: true,
|
|
236
|
+
output: {
|
|
237
|
+
stdout: 'Human benchmark summary or JSON envelope.',
|
|
238
|
+
files: ['perf/evidence/run_xxx/* when --save is enabled']
|
|
239
|
+
},
|
|
240
|
+
exitCodes: {
|
|
241
|
+
'0': 'Benchmark completed or dry-run plan emitted.',
|
|
242
|
+
'1': 'Validation, connection, or execution failed.'
|
|
243
|
+
},
|
|
244
|
+
flags: [
|
|
245
|
+
{ name: '--query', description: 'SQL file to benchmark inside the perf sandbox.' },
|
|
246
|
+
{ name: '--params', description: 'JSON or YAML file with named or positional parameters.' },
|
|
247
|
+
{ name: '--strategy', description: 'Execution strategy (direct|decomposed).', defaultValue: 'direct' },
|
|
248
|
+
{ name: '--material', description: 'Comma-separated CTEs to materialize when using decomposed execution.' },
|
|
249
|
+
{ name: '--mode', description: 'Benchmark mode (auto|latency|completion).', defaultValue: 'auto' },
|
|
250
|
+
{ name: '--repeat', description: 'Measured repetitions for latency mode.', defaultValue: '10' },
|
|
251
|
+
{ name: '--warmup', description: 'Warmup repetitions for latency mode.', defaultValue: '3' },
|
|
252
|
+
{ name: '--classify-threshold-seconds', description: 'Threshold for auto mode classification.', defaultValue: '60' },
|
|
253
|
+
{ name: '--timeout-minutes', description: 'Timeout for measured runs.', defaultValue: '5' },
|
|
254
|
+
{ name: '--save', description: 'Persist benchmark evidence under perf/evidence/run_xxx.' },
|
|
255
|
+
{ name: '--dry-run', description: 'Resolve benchmark mode and evidence shape without touching PostgreSQL.' },
|
|
256
|
+
{ name: '--label', description: 'Attach a short label to the saved run directory.' },
|
|
257
|
+
{ name: '--json', description: 'Pass perf run options as a JSON object.' }
|
|
258
|
+
]
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
name: 'perf report diff',
|
|
262
|
+
summary: 'Compare two saved perf benchmark runs and report the primary delta.',
|
|
263
|
+
writesFiles: false,
|
|
264
|
+
supportsDryRun: false,
|
|
265
|
+
supportsJsonPayload: true,
|
|
266
|
+
output: {
|
|
267
|
+
stdout: 'Human diff summary or JSON envelope.'
|
|
268
|
+
},
|
|
269
|
+
exitCodes: {
|
|
270
|
+
'0': 'Diff report emitted.',
|
|
271
|
+
'1': 'Evidence loading or validation failed.'
|
|
272
|
+
},
|
|
273
|
+
flags: [
|
|
274
|
+
{ name: '--format', description: 'Output format (text|json).', defaultValue: 'text' },
|
|
275
|
+
{ name: '--json', description: 'Pass perf report diff options as a JSON object.' }
|
|
276
|
+
]
|
|
277
|
+
}, {
|
|
278
|
+
name: 'query uses',
|
|
279
|
+
summary: 'Inspect catalog SQL usage of tables or columns.',
|
|
280
|
+
writesFiles: true,
|
|
281
|
+
supportsDryRun: false,
|
|
282
|
+
supportsJsonPayload: true,
|
|
283
|
+
output: {
|
|
284
|
+
stdout: 'Text report or versioned JSON report with optional display metadata.'
|
|
285
|
+
},
|
|
286
|
+
exitCodes: {
|
|
287
|
+
'0': 'Report emitted.',
|
|
288
|
+
'1': 'Validation failed.'
|
|
289
|
+
},
|
|
290
|
+
flags: [
|
|
291
|
+
{ name: '--format json', description: 'Emit a versioned JSON usage report.' },
|
|
292
|
+
{ name: '--json', description: 'Pass target and options as a JSON object.' },
|
|
293
|
+
{ name: '--summary-only', description: 'Emit only summary counts with display metadata.' },
|
|
294
|
+
{ name: '--limit', description: 'Truncate matches and warnings while preserving summary totals.' }
|
|
295
|
+
]
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
name: 'lint',
|
|
299
|
+
summary: 'Lint SQL files with fixture-backed validation.',
|
|
300
|
+
writesFiles: false,
|
|
301
|
+
supportsDryRun: false,
|
|
302
|
+
supportsJsonPayload: true,
|
|
303
|
+
output: {
|
|
304
|
+
stdout: 'Silent on success in text mode, JSON envelope in global json mode.'
|
|
305
|
+
},
|
|
306
|
+
exitCodes: {
|
|
307
|
+
'0': 'Lint completed without failures.',
|
|
308
|
+
'1': 'Lint failures or runtime error.'
|
|
309
|
+
},
|
|
310
|
+
flags: [
|
|
311
|
+
{ name: '--json', description: 'Pass lint options as a JSON object.' }
|
|
312
|
+
]
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
name: 'evidence',
|
|
316
|
+
summary: 'Generate deterministic specification evidence artifacts.',
|
|
317
|
+
writesFiles: true,
|
|
318
|
+
supportsDryRun: false,
|
|
319
|
+
supportsJsonPayload: true,
|
|
320
|
+
output: {
|
|
321
|
+
files: ['<out-dir>/test-specification.json', '<out-dir>/test-specification.md']
|
|
322
|
+
},
|
|
323
|
+
exitCodes: {
|
|
324
|
+
'0': 'Evidence generated.',
|
|
325
|
+
'1': 'Generation failed.',
|
|
326
|
+
'2': 'Runtime or config error.'
|
|
327
|
+
},
|
|
328
|
+
flags: [
|
|
329
|
+
{ name: '--json', description: 'Pass evidence options as a JSON object.' }
|
|
330
|
+
]
|
|
331
|
+
}
|
|
332
|
+
];
|
|
333
|
+
function getDescribeCommandDescriptors() {
|
|
334
|
+
return COMMANDS;
|
|
335
|
+
}
|
|
336
|
+
function registerDescribeCommand(program) {
|
|
337
|
+
const describe = program.command('describe').description('Describe ztd-cli commands and output contracts');
|
|
338
|
+
describe.action(() => {
|
|
339
|
+
const payload = {
|
|
340
|
+
schemaVersion: 1,
|
|
341
|
+
commands: COMMANDS.map((command) => {
|
|
342
|
+
var _a;
|
|
343
|
+
return ({
|
|
344
|
+
name: command.name,
|
|
345
|
+
summary: command.summary,
|
|
346
|
+
writesFiles: command.writesFiles,
|
|
347
|
+
supportsDryRun: command.supportsDryRun,
|
|
348
|
+
supportsJsonPayload: command.supportsJsonPayload,
|
|
349
|
+
supportsDescribeOutput: (_a = command.supportsDescribeOutput) !== null && _a !== void 0 ? _a : false
|
|
350
|
+
});
|
|
351
|
+
})
|
|
352
|
+
};
|
|
353
|
+
if ((0, agentCli_1.isJsonOutput)()) {
|
|
354
|
+
(0, agentCli_1.writeCommandEnvelope)('describe', payload);
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
const lines = ['Available command descriptions:'];
|
|
358
|
+
for (const command of COMMANDS) {
|
|
359
|
+
lines.push(`- ${command.name}: ${command.summary}`);
|
|
360
|
+
}
|
|
361
|
+
process.stdout.write(`${lines.join('\n')}\n`);
|
|
362
|
+
});
|
|
363
|
+
describe
|
|
364
|
+
.command('command <name>')
|
|
365
|
+
.description('Describe one command in detail')
|
|
366
|
+
.action((name) => {
|
|
367
|
+
const descriptor = COMMANDS.find((command) => command.name === name.trim());
|
|
368
|
+
if (!descriptor) {
|
|
369
|
+
throw new Error(`Unknown command description: ${name}`);
|
|
370
|
+
}
|
|
371
|
+
if ((0, agentCli_1.isJsonOutput)()) {
|
|
372
|
+
(0, agentCli_1.writeCommandEnvelope)('describe command', {
|
|
373
|
+
schemaVersion: 1,
|
|
374
|
+
command: descriptor
|
|
375
|
+
});
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
const lines = [
|
|
379
|
+
`${descriptor.name}`,
|
|
380
|
+
descriptor.summary,
|
|
381
|
+
`writesFiles: ${descriptor.writesFiles}`,
|
|
382
|
+
`supportsDryRun: ${descriptor.supportsDryRun}`,
|
|
383
|
+
`supportsJsonPayload: ${descriptor.supportsJsonPayload}`
|
|
384
|
+
];
|
|
385
|
+
if (descriptor.supportsDescribeOutput) {
|
|
386
|
+
lines.push('supportsDescribeOutput: true');
|
|
387
|
+
}
|
|
388
|
+
lines.push('flags:');
|
|
389
|
+
for (const flag of descriptor.flags) {
|
|
390
|
+
lines.push(`- ${flag.name}: ${flag.description}`);
|
|
391
|
+
}
|
|
392
|
+
lines.push('exitCodes:');
|
|
393
|
+
for (const [code, message] of Object.entries(descriptor.exitCodes)) {
|
|
394
|
+
lines.push(`- ${code}: ${message}`);
|
|
395
|
+
}
|
|
396
|
+
process.stdout.write(`${lines.join('\n')}\n`);
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
//# sourceMappingURL=describe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../../src/commands/describe.ts"],"names":[],"mappings":";;AAgWA,sEAEC;AAED,0DAiEC;AApaD,gDAAuE;AAuBvE,MAAM,QAAQ,GAAwB;IACpC;QACE,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,0EAA0E;QACnF,WAAW,EAAE,IAAI;QACjB,cAAc,EAAE,IAAI;QACpB,mBAAmB,EAAE,IAAI;QACzB,MAAM,EAAE;YACN,MAAM,EAAE,gEAAgE;YACxE,KAAK,EAAE,CAAC,iBAAiB,EAAE,eAAe,EAAE,mBAAmB,EAAE,eAAe,EAAE,YAAY,CAAC;SAChG;QACD,SAAS,EAAE;YACT,GAAG,EAAE,6CAA6C;YAClD,GAAG,EAAE,iCAAiC;SACvC;QACD,KAAK,EAAE;YACL,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,sEAAsE,EAAE;YAC1G,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,qCAAqC,EAAE;YACtE,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,+CAA+C,EAAE;SAChF;KACF;IACD;QACE,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE,6DAA6D;QACtE,WAAW,EAAE,IAAI;QACjB,cAAc,EAAE,KAAK;QACrB,mBAAmB,EAAE,KAAK;QAC1B,MAAM,EAAE;YACN,MAAM,EAAE,wE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,IAAI,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QACpD,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACzB,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YACnE,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;QACtC,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { DbConnectionContext } from '../utils/dbConnection';
|
|
2
|
+
export interface DiffSchemaOptions {
|
|
3
|
+
directories: string[];
|
|
4
|
+
extensions: string[];
|
|
5
|
+
url: string;
|
|
6
|
+
out: string;
|
|
7
|
+
pgDumpPath?: string;
|
|
8
|
+
pgDumpShell?: boolean;
|
|
9
|
+
connectionContext?: DbConnectionContext;
|
|
10
|
+
dryRun?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface DiffSchemaResult {
|
|
13
|
+
outFile: string;
|
|
14
|
+
patch: string;
|
|
15
|
+
dryRun: boolean;
|
|
16
|
+
hasChanges: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare const DDL_DIFF_SPAN_NAMES: {
|
|
19
|
+
readonly collectLocalDdl: "collect-local-ddl";
|
|
20
|
+
readonly pullRemoteDdl: "pull-remote-ddl";
|
|
21
|
+
readonly computeDiffPlan: "compute-diff-plan";
|
|
22
|
+
readonly emitDiffPlan: "emit-diff-plan";
|
|
23
|
+
};
|
|
24
|
+
export declare function runDiffSchema(options: DiffSchemaOptions): DiffSchemaResult;
|