@rawsql-ts/ztd-cli 0.20.0 → 0.20.3
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 +105 -0
- package/dist/commands/init.js +1508 -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 +128 -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 +45 -0
- package/dist/utils/optionalDependencies.js +153 -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
- package/templates/src/catalog/runtime/_smoke.runtime.ts +2 -2
- package/templates/src/db/sql-client-adapters.ts +1 -1
- package/templates/src/infrastructure/db/sql-client-adapters.ts +1 -1
- package/templates/src/infrastructure/telemetry/consoleRepositoryTelemetry.ts +1 -1
- package/templates/src/infrastructure/telemetry/repositoryTelemetry.ts +4 -4
- package/templates/tests/smoke.test.ts +2 -2
- package/templates/tests/smoke.validation.test.ts +1 -1
- package/templates/tests/support/testkit-client.ts +1 -1
- package/templates/tests/support/testkit-client.webapi.ts +1 -1
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QUERY_USES_COMMAND_SPANS = void 0;
|
|
4
|
+
exports.registerQueryCommands = registerQueryCommands;
|
|
5
|
+
const format_1 = require("../query/format");
|
|
6
|
+
const patch_1 = require("../query/patch");
|
|
7
|
+
const lint_1 = require("../query/lint");
|
|
8
|
+
const planner_1 = require("../query/planner");
|
|
9
|
+
const report_1 = require("../query/report");
|
|
10
|
+
const slice_1 = require("../query/slice");
|
|
11
|
+
const structure_1 = require("../query/structure");
|
|
12
|
+
const agentCli_1 = require("../utils/agentCli");
|
|
13
|
+
const telemetry_1 = require("../utils/telemetry");
|
|
14
|
+
exports.QUERY_USES_COMMAND_SPANS = {
|
|
15
|
+
resolveOptions: 'resolve-query-options',
|
|
16
|
+
renderOutput: 'render-query-usage-output',
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Register strict-first impact investigation commands on the CLI root.
|
|
20
|
+
*/
|
|
21
|
+
function registerQueryCommands(program) {
|
|
22
|
+
const query = program.command('query').description('Impact investigation for SQL catalog assets');
|
|
23
|
+
query.addHelpText('after', `
|
|
24
|
+
Examples:
|
|
25
|
+
$ ztd query uses table public.users
|
|
26
|
+
$ ztd query uses column public.users.email
|
|
27
|
+
$ ztd query uses column public.users.email --view detail
|
|
28
|
+
$ ztd query uses column users.email --any-schema --format json
|
|
29
|
+
$ ztd query uses column email --any-schema --any-table --format json
|
|
30
|
+
$ ztd query outline large_query.sql
|
|
31
|
+
$ ztd query graph large_query.sql --format dot
|
|
32
|
+
$ ztd query slice large_query.sql --cte purchase_summary
|
|
33
|
+
$ ztd query plan large_query.sql --material base_cte --scalar-filter-column sale_date --format json
|
|
34
|
+
$ ztd query patch apply large_query.sql --cte purchase_summary --from edited_slice.sql --preview
|
|
35
|
+
$ ztd query lint large_query.sql --format json
|
|
36
|
+
|
|
37
|
+
Notes:
|
|
38
|
+
- Strict mode is the default. Relaxed modes are explicit opt-in only.
|
|
39
|
+
- Impact is the default view. Use --view detail for edit-ready locations/snippets.
|
|
40
|
+
- Impact representatives may omit select snippets; use --view detail for edit-ready SELECT occurrences.
|
|
41
|
+
- Use --exclude-generated to skip specs under src/catalog/specs/generated when those files are review-only noise.
|
|
42
|
+
- Static column analysis is inherently uncertain and labels ambiguity via confidence/notes.
|
|
43
|
+
- exprHints: best-effort only. Absence of exprHints does not imply the feature is not present.
|
|
44
|
+
- statement_fingerprint is stable across formatting/comment changes under the current normalization contract.
|
|
45
|
+
`);
|
|
46
|
+
// Keep outline/graph/slice/plan aligned with the existing query surface from main.
|
|
47
|
+
// Issue #518 intentionally limits telemetry instrumentation in this file to query uses
|
|
48
|
+
// so conflict resolution does not narrow the established query command surface.
|
|
49
|
+
const uses = query.command('uses').description('Find where catalog SQL uses a table or column target');
|
|
50
|
+
uses
|
|
51
|
+
.command('table [target]')
|
|
52
|
+
.description('Find statements that use a table target')
|
|
53
|
+
.option('--format <format>', 'Output format (text|json)', 'text')
|
|
54
|
+
.option('--view <view>', 'Investigation view (impact|detail)', 'impact')
|
|
55
|
+
.option('--specs-dir <path>', 'Override SQL catalog specs directory (default: src/catalog/specs)')
|
|
56
|
+
.option('--sql-root <path>', 'Resolve sqlFile paths relative to the project SQL root first (default: src/sql)')
|
|
57
|
+
.option('--exclude-generated', 'Exclude specs under src/catalog/specs/generated from scan targets')
|
|
58
|
+
.option('--out <path>', 'Write output to file')
|
|
59
|
+
.option('--summary-only', 'Emit summary counts without per-match details')
|
|
60
|
+
.option('--limit <count>', 'Limit returned matches and warnings in the output')
|
|
61
|
+
.option('--json <payload>', 'Pass command options as a JSON object')
|
|
62
|
+
.option('--any-schema', 'Allow <table> lookup across schemas')
|
|
63
|
+
.option('--any-table', 'Unsupported for table usage')
|
|
64
|
+
.action((target, options) => {
|
|
65
|
+
runQueryUsesCommand('table', target, options);
|
|
66
|
+
});
|
|
67
|
+
uses
|
|
68
|
+
.command('column [target]')
|
|
69
|
+
.description('Find statements that use a column target')
|
|
70
|
+
.option('--format <format>', 'Output format (text|json)', 'text')
|
|
71
|
+
.option('--view <view>', 'Investigation view (impact|detail)', 'impact')
|
|
72
|
+
.option('--specs-dir <path>', 'Override SQL catalog specs directory (default: src/catalog/specs)')
|
|
73
|
+
.option('--sql-root <path>', 'Resolve sqlFile paths relative to the project SQL root first (default: src/sql)')
|
|
74
|
+
.option('--exclude-generated', 'Exclude specs under src/catalog/specs/generated from scan targets')
|
|
75
|
+
.option('--out <path>', 'Write output to file')
|
|
76
|
+
.option('--summary-only', 'Emit summary counts without per-match details')
|
|
77
|
+
.option('--limit <count>', 'Limit returned matches and warnings in the output')
|
|
78
|
+
.option('--json <payload>', 'Pass command options as a JSON object')
|
|
79
|
+
.option('--any-schema', 'Allow <table.column> or <column> lookup across schemas')
|
|
80
|
+
.option('--any-table', 'Allow <column> lookup across tables (requires --any-schema)')
|
|
81
|
+
.addHelpText('after', `
|
|
82
|
+
Notes:
|
|
83
|
+
- Impact is the default view. Use --view detail if you need edit-ready locations/snippets.
|
|
84
|
+
- Impact representatives may omit select snippets; use --view detail for edit-ready SELECT occurrences.
|
|
85
|
+
- exprHints: best-effort only. Absence of exprHints does not imply the feature is not present.
|
|
86
|
+
`)
|
|
87
|
+
.action((target, options) => {
|
|
88
|
+
runQueryUsesCommand('column', target, options);
|
|
89
|
+
});
|
|
90
|
+
query
|
|
91
|
+
.command('outline <sqlFile>')
|
|
92
|
+
.description('Summarize query structure, CTE dependencies, and base table usage')
|
|
93
|
+
.option('--format <format>', 'Output format (text|json)', 'text')
|
|
94
|
+
.option('--out <path>', 'Write output to file')
|
|
95
|
+
.action((sqlFile, options) => {
|
|
96
|
+
runQueryStructureCommand(sqlFile, options, false, 'ztd query outline');
|
|
97
|
+
});
|
|
98
|
+
query
|
|
99
|
+
.command('graph <sqlFile>')
|
|
100
|
+
.description('Emit the query dependency graph in text, JSON, or DOT form')
|
|
101
|
+
.option('--format <format>', 'Output format (text|json|dot)', 'text')
|
|
102
|
+
.option('--out <path>', 'Write output to file')
|
|
103
|
+
.action((sqlFile, options) => {
|
|
104
|
+
runQueryStructureCommand(sqlFile, options, true, 'ztd query graph');
|
|
105
|
+
});
|
|
106
|
+
query
|
|
107
|
+
.command('slice <sqlFile>')
|
|
108
|
+
.description('Generate a minimal executable SQL slice for a target CTE or the final query')
|
|
109
|
+
.option('--cte <name>', 'Slice a specific CTE into a standalone debug query')
|
|
110
|
+
.option('--final', 'Slice the final query while removing unused CTEs')
|
|
111
|
+
.option('--limit <count>', 'Add LIMIT to the emitted debug query when supported')
|
|
112
|
+
.option('--out <path>', 'Write output to file')
|
|
113
|
+
.action((sqlFile, options) => {
|
|
114
|
+
runQuerySliceCommand(sqlFile, options);
|
|
115
|
+
});
|
|
116
|
+
query
|
|
117
|
+
.command('plan <sqlFile>')
|
|
118
|
+
.description('Emit deterministic execution steps from CTE metadata')
|
|
119
|
+
.option('--format <format>', 'Output format (text|json)', 'text')
|
|
120
|
+
.option('--material <names>', 'Comma-separated CTE names to materialize')
|
|
121
|
+
.option('--scalar-filter-column <names>', 'Comma-separated column names to bind from WHERE scalar filters')
|
|
122
|
+
.option('--json <payload>', 'Pass command options as a JSON object')
|
|
123
|
+
.option('--out <path>', 'Write output to file')
|
|
124
|
+
.action((sqlFile, options) => {
|
|
125
|
+
runQueryPlanCommand(sqlFile, options);
|
|
126
|
+
});
|
|
127
|
+
query
|
|
128
|
+
.command('lint <sqlFile>')
|
|
129
|
+
.description('Report structural maintainability and analysis-safety issues in a SQL query')
|
|
130
|
+
.option('--format <format>', 'Output format (text|json)', 'text')
|
|
131
|
+
.option('--out <path>', 'Write output to file')
|
|
132
|
+
.action((sqlFile, options) => {
|
|
133
|
+
runQueryLintCommand(sqlFile, options);
|
|
134
|
+
});
|
|
135
|
+
query
|
|
136
|
+
.command('patch')
|
|
137
|
+
.description('Apply AI-edited SQL fragments back onto the original query safely')
|
|
138
|
+
.command('apply <sqlFile>')
|
|
139
|
+
.description('Replace one CTE in the original SQL with the matching definition from an edited SQL file')
|
|
140
|
+
.option('--cte <name>', 'Target CTE name to replace in the original query')
|
|
141
|
+
.option('--from <path>', 'Edited SQL file that contains the replacement CTE definition')
|
|
142
|
+
.option('--preview', 'Emit a unified diff without writing files')
|
|
143
|
+
.option('--out <path>', 'Write the patched SQL to a new file instead of overwriting the original')
|
|
144
|
+
.action((sqlFile, options) => {
|
|
145
|
+
runQueryPatchApplyCommand(sqlFile, options);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
function runQueryUsesCommand(kind, target, options) {
|
|
149
|
+
const resolved = (0, telemetry_1.withSpanSync)(exports.QUERY_USES_COMMAND_SPANS.resolveOptions, () => {
|
|
150
|
+
var _a, _b, _c;
|
|
151
|
+
const merged = options.json ? { ...options, ...(0, agentCli_1.parseJsonPayload)(options.json, '--json') } : options;
|
|
152
|
+
const format = normalizeFormat((_a = normalizeStringOption(merged.format)) !== null && _a !== void 0 ? _a : (0, agentCli_1.getAgentOutputFormat)());
|
|
153
|
+
const view = normalizeView((_b = normalizeStringOption(merged.view)) !== null && _b !== void 0 ? _b : 'impact');
|
|
154
|
+
const resolvedTarget = (_c = normalizeStringOption(merged.target)) !== null && _c !== void 0 ? _c : target;
|
|
155
|
+
if (!resolvedTarget) {
|
|
156
|
+
throw new Error('A target must be provided either as a positional argument or via --json {"target": "..."}');
|
|
157
|
+
}
|
|
158
|
+
return {
|
|
159
|
+
merged,
|
|
160
|
+
format,
|
|
161
|
+
view,
|
|
162
|
+
resolvedTarget,
|
|
163
|
+
};
|
|
164
|
+
}, {
|
|
165
|
+
kind,
|
|
166
|
+
targetProvided: Boolean(target),
|
|
167
|
+
jsonPayload: Boolean(options.json),
|
|
168
|
+
});
|
|
169
|
+
const report = (0, report_1.buildQueryUsageReport)({
|
|
170
|
+
kind,
|
|
171
|
+
rawTarget: resolved.resolvedTarget,
|
|
172
|
+
rootDir: process.env.ZTD_PROJECT_ROOT,
|
|
173
|
+
specsDir: normalizeStringOption(resolved.merged.specsDir),
|
|
174
|
+
sqlRoot: normalizeStringOption(resolved.merged.sqlRoot),
|
|
175
|
+
excludeGenerated: normalizeBooleanOption(resolved.merged.excludeGenerated),
|
|
176
|
+
view: resolved.view,
|
|
177
|
+
anySchema: normalizeBooleanOption(resolved.merged.anySchema),
|
|
178
|
+
anyTable: normalizeBooleanOption(resolved.merged.anyTable)
|
|
179
|
+
});
|
|
180
|
+
(0, telemetry_1.withSpanSync)(exports.QUERY_USES_COMMAND_SPANS.renderOutput, () => {
|
|
181
|
+
const limitedReport = (0, format_1.applyQueryOutputControls)(report, {
|
|
182
|
+
summaryOnly: normalizeBooleanOption(resolved.merged.summaryOnly),
|
|
183
|
+
limit: normalizeLimit(resolved.merged.limit)
|
|
184
|
+
});
|
|
185
|
+
const contents = (0, format_1.formatQueryUsageReport)(limitedReport, resolved.format);
|
|
186
|
+
const outPath = normalizeStringOption(resolved.merged.out);
|
|
187
|
+
if (outPath) {
|
|
188
|
+
(0, report_1.writeQueryUsageOutput)(outPath, contents);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
console.log(contents.trimEnd());
|
|
192
|
+
}, {
|
|
193
|
+
format: resolved.format,
|
|
194
|
+
writesFile: Boolean(resolved.merged.out),
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
function runQueryStructureCommand(sqlFile, options, allowDot, commandName) {
|
|
198
|
+
var _a;
|
|
199
|
+
const format = normalizeStructureFormat((_a = options.format) !== null && _a !== void 0 ? _a : 'text', allowDot);
|
|
200
|
+
const report = (0, structure_1.buildQueryStructureReport)(sqlFile, commandName);
|
|
201
|
+
const contents = (0, structure_1.formatQueryStructureReport)(report, format);
|
|
202
|
+
if (options.out) {
|
|
203
|
+
(0, report_1.writeQueryUsageOutput)(options.out, contents);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
console.log(contents.trimEnd());
|
|
207
|
+
}
|
|
208
|
+
function runQuerySliceCommand(sqlFile, options) {
|
|
209
|
+
const report = (0, slice_1.buildQuerySliceReport)(sqlFile, {
|
|
210
|
+
cte: normalizeStringOption(options.cte),
|
|
211
|
+
final: normalizeBooleanOption(options.final),
|
|
212
|
+
limit: normalizeLimit(options.limit)
|
|
213
|
+
});
|
|
214
|
+
if (options.out) {
|
|
215
|
+
(0, report_1.writeQueryUsageOutput)(options.out, report.sql);
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
console.log(report.sql.trimEnd());
|
|
219
|
+
}
|
|
220
|
+
function runQueryPlanCommand(sqlFile, options) {
|
|
221
|
+
var _a, _b;
|
|
222
|
+
const merged = options.json ? { ...options, ...(0, agentCli_1.parseJsonPayload)(options.json, '--json') } : options;
|
|
223
|
+
const scalarFilterOption = (_a = merged.scalarFilterColumns) !== null && _a !== void 0 ? _a : merged.scalarFilterColumn;
|
|
224
|
+
if (scalarFilterOption === undefined && merged.scalarMaterial !== undefined) {
|
|
225
|
+
throw new Error('Use scalarFilterColumns / --scalar-filter-column instead of scalarMaterial / --scalar-material.');
|
|
226
|
+
}
|
|
227
|
+
const format = normalizePlanFormat((_b = normalizeStringOption(merged.format)) !== null && _b !== void 0 ? _b : (0, agentCli_1.getAgentOutputFormat)());
|
|
228
|
+
const plan = (0, planner_1.buildQueryPipelinePlan)(sqlFile, {
|
|
229
|
+
material: normalizeListOption(merged.material, '--material'),
|
|
230
|
+
scalarFilterColumns: normalizeListOption(scalarFilterOption, '--scalar-filter-column')
|
|
231
|
+
});
|
|
232
|
+
const contents = (0, planner_1.formatQueryPipelinePlan)(plan, format);
|
|
233
|
+
const outPath = normalizeStringOption(merged.out);
|
|
234
|
+
if (outPath) {
|
|
235
|
+
(0, report_1.writeQueryUsageOutput)(outPath, contents);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
console.log(contents.trimEnd());
|
|
239
|
+
}
|
|
240
|
+
function runQueryLintCommand(sqlFile, options) {
|
|
241
|
+
var _a;
|
|
242
|
+
const format = normalizeLintFormat((_a = normalizeStringOption(options.format)) !== null && _a !== void 0 ? _a : (0, agentCli_1.getAgentOutputFormat)());
|
|
243
|
+
const report = (0, lint_1.buildQueryLintReport)(sqlFile);
|
|
244
|
+
const contents = (0, lint_1.formatQueryLintReport)(report, format);
|
|
245
|
+
if (options.out) {
|
|
246
|
+
(0, report_1.writeQueryUsageOutput)(options.out, contents);
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
console.log(contents.trimEnd());
|
|
250
|
+
}
|
|
251
|
+
function runQueryPatchApplyCommand(sqlFile, options) {
|
|
252
|
+
const cte = normalizeRequiredStringOption(options.cte, '--cte');
|
|
253
|
+
const from = normalizeRequiredStringOption(options.from, '--from');
|
|
254
|
+
const report = (0, patch_1.applyQueryPatch)(sqlFile, {
|
|
255
|
+
cte,
|
|
256
|
+
from,
|
|
257
|
+
out: normalizeStringOption(options.out),
|
|
258
|
+
preview: normalizeBooleanOption(options.preview)
|
|
259
|
+
});
|
|
260
|
+
if ((0, agentCli_1.isJsonOutput)()) {
|
|
261
|
+
(0, agentCli_1.writeCommandEnvelope)('query patch apply', {
|
|
262
|
+
file: report.file,
|
|
263
|
+
edited_file: report.edited_file,
|
|
264
|
+
target_cte: report.target_cte,
|
|
265
|
+
preview: report.preview,
|
|
266
|
+
changed: report.changed,
|
|
267
|
+
written: report.written,
|
|
268
|
+
output_file: report.output_file,
|
|
269
|
+
diff: report.diff,
|
|
270
|
+
updated_sql: report.updated_sql
|
|
271
|
+
});
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
if (report.preview) {
|
|
275
|
+
process.stdout.write(report.diff);
|
|
276
|
+
if (!report.diff.endsWith('\n')) {
|
|
277
|
+
process.stdout.write('\n');
|
|
278
|
+
}
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
process.stdout.write([
|
|
282
|
+
`Patched CTE: ${report.target_cte}`,
|
|
283
|
+
`Edited SQL: ${report.edited_file}`,
|
|
284
|
+
`Output file: ${report.output_file}`,
|
|
285
|
+
`Changed: ${report.changed ? 'yes' : 'no'}`
|
|
286
|
+
].join('\n'));
|
|
287
|
+
process.stdout.write('\n');
|
|
288
|
+
}
|
|
289
|
+
function normalizeLimit(value) {
|
|
290
|
+
if (value === undefined) {
|
|
291
|
+
return undefined;
|
|
292
|
+
}
|
|
293
|
+
if (typeof value !== 'string' && typeof value !== 'number') {
|
|
294
|
+
throw new Error(`Unsupported limit type: ${typeof value}. Use a positive integer.`);
|
|
295
|
+
}
|
|
296
|
+
const parsed = Number(value);
|
|
297
|
+
if (!Number.isInteger(parsed) || parsed <= 0) {
|
|
298
|
+
throw new Error(`Unsupported limit: ${value}. Use a positive integer.`);
|
|
299
|
+
}
|
|
300
|
+
return parsed;
|
|
301
|
+
}
|
|
302
|
+
function normalizeStringOption(value) {
|
|
303
|
+
if (value === undefined || value === null || value === '') {
|
|
304
|
+
return undefined;
|
|
305
|
+
}
|
|
306
|
+
if (typeof value !== 'string') {
|
|
307
|
+
throw new Error(`Expected a string option but received ${typeof value}.`);
|
|
308
|
+
}
|
|
309
|
+
return value;
|
|
310
|
+
}
|
|
311
|
+
function normalizeRequiredStringOption(value, label) {
|
|
312
|
+
const normalized = normalizeStringOption(value);
|
|
313
|
+
if (!normalized) {
|
|
314
|
+
throw new Error(`${label} is required.`);
|
|
315
|
+
}
|
|
316
|
+
return normalized;
|
|
317
|
+
}
|
|
318
|
+
function normalizeBooleanOption(value) {
|
|
319
|
+
if (value === undefined) {
|
|
320
|
+
return false;
|
|
321
|
+
}
|
|
322
|
+
if (typeof value !== 'boolean') {
|
|
323
|
+
throw new Error(`Expected a boolean option but received ${typeof value}.`);
|
|
324
|
+
}
|
|
325
|
+
return value;
|
|
326
|
+
}
|
|
327
|
+
function normalizeListOption(value, label) {
|
|
328
|
+
if (value === undefined || value === null || value === '') {
|
|
329
|
+
return undefined;
|
|
330
|
+
}
|
|
331
|
+
const rawValues = Array.isArray(value) ? value : [value];
|
|
332
|
+
const normalized = [];
|
|
333
|
+
for (const rawValue of rawValues) {
|
|
334
|
+
if (typeof rawValue !== 'string') {
|
|
335
|
+
throw new Error(`Expected ${label} to be a string or string[] but received ${typeof rawValue}.`);
|
|
336
|
+
}
|
|
337
|
+
// Accept comma-separated CLI input and JSON arrays with one item per entry.
|
|
338
|
+
for (const item of rawValue.split(',')) {
|
|
339
|
+
const trimmed = item.trim();
|
|
340
|
+
if (trimmed.length > 0) {
|
|
341
|
+
normalized.push(trimmed);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return normalized.length > 0 ? normalized : undefined;
|
|
346
|
+
}
|
|
347
|
+
function normalizeFormat(format) {
|
|
348
|
+
const normalized = format.trim().toLowerCase();
|
|
349
|
+
if (normalized === 'text' || normalized === 'json') {
|
|
350
|
+
return normalized;
|
|
351
|
+
}
|
|
352
|
+
throw new Error(`Unsupported format: ${format}`);
|
|
353
|
+
}
|
|
354
|
+
function normalizePlanFormat(format) {
|
|
355
|
+
return normalizeFormat(format);
|
|
356
|
+
}
|
|
357
|
+
function normalizeLintFormat(format) {
|
|
358
|
+
return normalizeFormat(format);
|
|
359
|
+
}
|
|
360
|
+
function normalizeStructureFormat(format, allowDot) {
|
|
361
|
+
const normalized = format.trim().toLowerCase();
|
|
362
|
+
if (normalized === 'text' || normalized === 'json') {
|
|
363
|
+
return normalized;
|
|
364
|
+
}
|
|
365
|
+
if (allowDot && normalized === 'dot') {
|
|
366
|
+
return normalized;
|
|
367
|
+
}
|
|
368
|
+
throw new Error(`Unsupported format: ${format}`);
|
|
369
|
+
}
|
|
370
|
+
function normalizeView(view) {
|
|
371
|
+
const normalized = view.trim().toLowerCase();
|
|
372
|
+
if (normalized === 'impact' || normalized === 'detail') {
|
|
373
|
+
return normalized;
|
|
374
|
+
}
|
|
375
|
+
throw new Error(`Unsupported view: ${view}`);
|
|
376
|
+
}
|
|
377
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/commands/query.ts"],"names":[],"mappings":";;;AA0EA,sDA6IC;AAtND,4CAAmF;AACnF,0CAAiD;AACjD,wCAAkG;AAClG,8CAI0B;AAC1B,4CAA+E;AAC/E,0CAAuD;AACvD,kDAI4B;AAC5B,gDAA+G;AAC/G,kDAAkD;AAiDrC,QAAA,wBAAwB,GAAG;IACtC,cAAc,EAAE,uBAAuB;IACvC,YAAY,EAAE,2BAA2B;CACjC,CAAC;AAEX;;GAEG;AACH,SAAgB,qBAAqB,CAAC,OAAgB;IACpD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,6CAA6C,CAAC,CAAC;IAClG,KAAK,CAAC,WAAW,CACf,OAAO,EACP;;;;;;;;;;;;;;;;;;;;;;CAsBH,CACE,CAAC;IAEF,mFAAmF;IACnF,uFAAuF;IACvF,gFAAgF;IAChF,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,sDAAsD,CAAC,CAAC;IAEvG,IAAI;SACD,OAAO,CAAC,gBAAgB,CAAC;SACzB,WAAW,CAAC,yCAAyC,CAAC;SACt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,QAAQ,IAAI,UAAU,KAAK,QAAQ,EAAE,CAAC;QACvD,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { type DiffCase as CorePrDiffCase, type DiffCatalog as CorePrDiffCatalog, type DiffJson as CoreTestSpecificationPrDiff } from '@rawsql-ts/test-evidence-core';
|
|
3
|
+
import { type RemovedDetailLevel } from '@rawsql-ts/test-evidence-renderer-md';
|
|
4
|
+
/**
|
|
5
|
+
* Supported evidence generation modes for `ztd evidence`.
|
|
6
|
+
*/
|
|
7
|
+
export type TestEvidenceMode = 'specification';
|
|
8
|
+
/**
|
|
9
|
+
* Output formats accepted by `ztd evidence`.
|
|
10
|
+
*/
|
|
11
|
+
export type TestEvidenceFormat = 'json' | 'markdown' | 'both';
|
|
12
|
+
type TestEvidenceErrorCode = 'NO_SPECS_FOUND';
|
|
13
|
+
/**
|
|
14
|
+
* Evidence row summarizing one SQL catalog spec file.
|
|
15
|
+
*/
|
|
16
|
+
export interface SqlCatalogSpecEvidence {
|
|
17
|
+
kind: 'sql-catalog';
|
|
18
|
+
id: string;
|
|
19
|
+
specFile: string;
|
|
20
|
+
sqlFile: string | null;
|
|
21
|
+
sqlFileResolved: boolean;
|
|
22
|
+
paramsShape: 'named' | 'positional' | 'unknown';
|
|
23
|
+
hasOutputMapping: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Flattened executable test-case evidence row.
|
|
27
|
+
*/
|
|
28
|
+
export interface TestCaseEvidence {
|
|
29
|
+
kind: 'test-case';
|
|
30
|
+
id: string;
|
|
31
|
+
catalogId: string;
|
|
32
|
+
caseId: string;
|
|
33
|
+
filePath: string;
|
|
34
|
+
title: string;
|
|
35
|
+
description?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Top-level deterministic evidence document for specification mode.
|
|
39
|
+
*/
|
|
40
|
+
export interface TestSpecificationEvidence {
|
|
41
|
+
schemaVersion: 1;
|
|
42
|
+
mode: TestEvidenceMode;
|
|
43
|
+
summary: {
|
|
44
|
+
sqlCatalogCount: number;
|
|
45
|
+
sqlCaseCatalogCount: number;
|
|
46
|
+
testCaseCount: number;
|
|
47
|
+
specFilesScanned: number;
|
|
48
|
+
testFilesScanned: number;
|
|
49
|
+
};
|
|
50
|
+
sqlCatalogs: SqlCatalogSpecEvidence[];
|
|
51
|
+
sqlCaseCatalogs: SqlCaseCatalogEvidence[];
|
|
52
|
+
testCaseCatalogs: TestCaseCatalogEvidence[];
|
|
53
|
+
testCases: TestCaseEvidence[];
|
|
54
|
+
display?: {
|
|
55
|
+
summaryOnly: boolean;
|
|
56
|
+
limit?: number;
|
|
57
|
+
truncated: boolean;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Normalized case payload used for deterministic PR diff calculation.
|
|
62
|
+
*/
|
|
63
|
+
export type PrDiffCase = CorePrDiffCase;
|
|
64
|
+
/**
|
|
65
|
+
* Normalized catalog payload used for deterministic PR diff calculation.
|
|
66
|
+
*/
|
|
67
|
+
export type PrDiffCatalog = CorePrDiffCatalog;
|
|
68
|
+
/**
|
|
69
|
+
* Deterministic diff document for PR-focused test evidence output.
|
|
70
|
+
*/
|
|
71
|
+
export type TestSpecificationPrDiff = CoreTestSpecificationPrDiff;
|
|
72
|
+
/**
|
|
73
|
+
* Deterministic evidence representation of an executable function test catalog.
|
|
74
|
+
*/
|
|
75
|
+
export interface TestCaseCatalogEvidence {
|
|
76
|
+
id: string;
|
|
77
|
+
title: string;
|
|
78
|
+
description?: string;
|
|
79
|
+
definitionPath?: string;
|
|
80
|
+
refs?: Array<{
|
|
81
|
+
label: string;
|
|
82
|
+
url: string;
|
|
83
|
+
}>;
|
|
84
|
+
cases: Array<{
|
|
85
|
+
id: string;
|
|
86
|
+
title: string;
|
|
87
|
+
description?: string;
|
|
88
|
+
input: unknown;
|
|
89
|
+
expected: 'success' | 'throws' | 'errorResult';
|
|
90
|
+
output?: unknown;
|
|
91
|
+
error?: {
|
|
92
|
+
name: string;
|
|
93
|
+
message: string;
|
|
94
|
+
match: 'equals' | 'contains';
|
|
95
|
+
};
|
|
96
|
+
tags?: string[];
|
|
97
|
+
focus?: string;
|
|
98
|
+
refs?: Array<{
|
|
99
|
+
label: string;
|
|
100
|
+
url: string;
|
|
101
|
+
}>;
|
|
102
|
+
}>;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Deterministic evidence representation of an executable SQL case catalog.
|
|
106
|
+
*/
|
|
107
|
+
export interface SqlCaseCatalogEvidence {
|
|
108
|
+
id: string;
|
|
109
|
+
title: string;
|
|
110
|
+
description?: string;
|
|
111
|
+
definitionPath?: string;
|
|
112
|
+
params: {
|
|
113
|
+
shape: 'named';
|
|
114
|
+
example: Record<string, unknown>;
|
|
115
|
+
};
|
|
116
|
+
output: {
|
|
117
|
+
mapping: {
|
|
118
|
+
columnMap: Record<string, string>;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
sql: string;
|
|
122
|
+
fixtures: Array<{
|
|
123
|
+
tableName: string;
|
|
124
|
+
schema?: {
|
|
125
|
+
columns: Record<string, string>;
|
|
126
|
+
};
|
|
127
|
+
rowsCount: number;
|
|
128
|
+
}>;
|
|
129
|
+
cases: Array<{
|
|
130
|
+
id: string;
|
|
131
|
+
title: string;
|
|
132
|
+
params: Record<string, unknown>;
|
|
133
|
+
expected: unknown[];
|
|
134
|
+
}>;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Runtime/configuration error for test evidence command (maps to exit code 2).
|
|
138
|
+
*/
|
|
139
|
+
export declare class TestEvidenceRuntimeError extends Error {
|
|
140
|
+
readonly exitCode = 2;
|
|
141
|
+
readonly code?: TestEvidenceErrorCode;
|
|
142
|
+
constructor(message: string, options?: {
|
|
143
|
+
code?: TestEvidenceErrorCode;
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Resolve command exit code for test evidence generation.
|
|
148
|
+
* @param args.result Completed generation result when execution succeeded.
|
|
149
|
+
* @param args.error Error thrown while generating evidence.
|
|
150
|
+
* @returns 0 when generation succeeded, 2 for runtime/configuration errors, 1 for other failures.
|
|
151
|
+
*/
|
|
152
|
+
export declare function resolveTestEvidenceExitCode(args: {
|
|
153
|
+
result?: TestSpecificationEvidence;
|
|
154
|
+
error?: unknown;
|
|
155
|
+
}): 0 | 1 | 2;
|
|
156
|
+
/**
|
|
157
|
+
* Register `ztd evidence` command on the CLI root program.
|
|
158
|
+
*/
|
|
159
|
+
export declare function registerTestEvidenceCommand(program: Command): void;
|
|
160
|
+
/**
|
|
161
|
+
* Build deterministic specification evidence from SQL catalog specs and test-case catalog exports.
|
|
162
|
+
*/
|
|
163
|
+
export declare function runTestEvidenceSpecification(options: {
|
|
164
|
+
mode: TestEvidenceMode;
|
|
165
|
+
rootDir?: string;
|
|
166
|
+
specsDir?: string;
|
|
167
|
+
testsDir?: string;
|
|
168
|
+
specModule?: string;
|
|
169
|
+
}): TestSpecificationEvidence;
|
|
170
|
+
/**
|
|
171
|
+
* Render deterministic JSON or Markdown output text.
|
|
172
|
+
*/
|
|
173
|
+
export declare function formatTestEvidenceOutput(report: TestSpecificationEvidence, format: Exclude<TestEvidenceFormat, 'both'>, context?: {
|
|
174
|
+
markdownPath?: string;
|
|
175
|
+
sourceRootDir?: string;
|
|
176
|
+
}): string;
|
|
177
|
+
/**
|
|
178
|
+
* Stable stringify that sorts object keys recursively for deterministic fingerprinting.
|
|
179
|
+
*/
|
|
180
|
+
export declare function stableStringify(value: unknown): string;
|
|
181
|
+
/**
|
|
182
|
+
* Build deterministic PR diff JSON from base/head specification reports.
|
|
183
|
+
*/
|
|
184
|
+
export declare function buildTestEvidencePrDiff(args: {
|
|
185
|
+
base: {
|
|
186
|
+
ref: string;
|
|
187
|
+
sha: string;
|
|
188
|
+
report: TestSpecificationEvidence;
|
|
189
|
+
};
|
|
190
|
+
head: {
|
|
191
|
+
ref: string;
|
|
192
|
+
sha: string;
|
|
193
|
+
report: TestSpecificationEvidence;
|
|
194
|
+
};
|
|
195
|
+
baseMode: 'merge-base' | 'ref';
|
|
196
|
+
}): TestSpecificationPrDiff;
|
|
197
|
+
/**
|
|
198
|
+
* Render PR-focused markdown from diff JSON.
|
|
199
|
+
*/
|
|
200
|
+
export declare function formatTestEvidencePrMarkdown(diff: TestSpecificationPrDiff, options?: {
|
|
201
|
+
removedDetail?: RemovedDetailLevel;
|
|
202
|
+
markdownPath?: string;
|
|
203
|
+
sourceRootDir?: string;
|
|
204
|
+
}): string;
|
|
205
|
+
/**
|
|
206
|
+
* Generate base/head reports, compute PR diff JSON, and write PR artifacts.
|
|
207
|
+
*/
|
|
208
|
+
export declare function runTestEvidencePr(options: {
|
|
209
|
+
baseRef: string;
|
|
210
|
+
headRef: string;
|
|
211
|
+
baseMode: 'merge-base' | 'ref';
|
|
212
|
+
allowEmptyBase?: boolean;
|
|
213
|
+
removedDetail?: RemovedDetailLevel;
|
|
214
|
+
outDir: string;
|
|
215
|
+
rootDir?: string;
|
|
216
|
+
specsDir?: string;
|
|
217
|
+
testsDir?: string;
|
|
218
|
+
specModule?: string;
|
|
219
|
+
summaryOnly?: boolean;
|
|
220
|
+
limit?: number;
|
|
221
|
+
}): {
|
|
222
|
+
baseReport: TestSpecificationEvidence;
|
|
223
|
+
headReport: TestSpecificationEvidence;
|
|
224
|
+
diff: TestSpecificationPrDiff;
|
|
225
|
+
};
|
|
226
|
+
export declare function applyEvidenceOutputControls(report: TestSpecificationEvidence, options: {
|
|
227
|
+
summaryOnly?: boolean;
|
|
228
|
+
limit?: number;
|
|
229
|
+
}): TestSpecificationEvidence;
|
|
230
|
+
/**
|
|
231
|
+
* Render deterministic Markdown focused on human-readable test intent.
|
|
232
|
+
*/
|
|
233
|
+
export declare function formatTestDocumentationOutput(report: TestSpecificationEvidence, context?: {
|
|
234
|
+
markdownPath?: string;
|
|
235
|
+
sourceRootDir?: string;
|
|
236
|
+
}): string;
|
|
237
|
+
export {};
|