@vertaaux/cli 0.5.0 → 0.5.1
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/CHANGELOG.md +19 -0
- package/README.md +28 -1
- package/dist/app/interactive-app.d.ts +2 -0
- package/dist/app/interactive-app.d.ts.map +1 -1
- package/dist/app/interactive-app.js +26 -7
- package/dist/app/menu/categories.d.ts +2 -2
- package/dist/app/menu/categories.d.ts.map +1 -1
- package/dist/app/menu/categories.js +3 -18
- package/dist/app/views/command-runner.d.ts.map +1 -1
- package/dist/app/views/command-runner.js +52 -9
- package/dist/app/views/help-overlay.d.ts +1 -1
- package/dist/app/views/help-overlay.d.ts.map +1 -1
- package/dist/app/views/help-overlay.js +5 -4
- package/dist/commands/a11y.d.ts +4 -2
- package/dist/commands/a11y.d.ts.map +1 -1
- package/dist/commands/a11y.js +82 -9
- package/dist/commands/audit/index.d.ts.map +1 -1
- package/dist/commands/audit/index.js +33 -8
- package/dist/commands/audit/output.d.ts.map +1 -1
- package/dist/commands/audit/output.js +3 -4
- package/dist/commands/audit/policy.d.ts +10 -2
- package/dist/commands/audit/policy.d.ts.map +1 -1
- package/dist/commands/audit/policy.js +47 -2
- package/dist/commands/audit/types.d.ts +1 -0
- package/dist/commands/audit/types.d.ts.map +1 -1
- package/dist/commands/baseline.d.ts +1 -0
- package/dist/commands/baseline.d.ts.map +1 -1
- package/dist/commands/baseline.js +26 -12
- package/dist/commands/comment.d.ts.map +1 -1
- package/dist/commands/comment.js +8 -7
- package/dist/commands/compare.js +3 -3
- package/dist/commands/diff.d.ts +2 -0
- package/dist/commands/diff.d.ts.map +1 -1
- package/dist/commands/diff.js +23 -12
- package/dist/commands/doc.js +2 -2
- package/dist/commands/doctor.js +2 -2
- package/dist/commands/explain.js +3 -3
- package/dist/commands/fix-all.js +2 -2
- package/dist/commands/fix-plan.d.ts.map +1 -1
- package/dist/commands/fix-plan.js +4 -3
- package/dist/commands/fix.js +5 -5
- package/dist/commands/patch-review.js +2 -2
- package/dist/commands/policy.js +2 -2
- package/dist/commands/release-notes.js +3 -3
- package/dist/commands/suggest.d.ts.map +1 -1
- package/dist/commands/suggest.js +28 -2
- package/dist/commands/triage.js +3 -3
- package/dist/commands/verify.js +3 -3
- package/dist/config/schema.d.ts +4 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/output/envelope.d.ts +8 -1
- package/dist/output/envelope.d.ts.map +1 -1
- package/dist/output/envelope.js +24 -6
- package/dist/policy/schema.d.ts +137 -0
- package/dist/policy/schema.d.ts.map +1 -1
- package/dist/policy/schema.js +107 -0
- package/dist/prompts/command-catalog.js +9 -9
- package/dist/utils/client.d.ts.map +1 -1
- package/dist/utils/client.js +30 -28
- package/dist/utils/root-args.d.ts +12 -0
- package/dist/utils/root-args.d.ts.map +1 -0
- package/dist/utils/root-args.js +44 -0
- package/dist/utils/stdin.d.ts +7 -0
- package/dist/utils/stdin.d.ts.map +1 -1
- package/dist/utils/stdin.js +32 -2
- package/node_modules/@vertaaux/tui/dist/index.cjs +505 -9
- package/node_modules/@vertaaux/tui/dist/index.cjs.map +1 -1
- package/node_modules/@vertaaux/tui/dist/index.js +502 -8
- package/node_modules/@vertaaux/tui/dist/index.js.map +1 -1
- package/node_modules/@vertaaux/tui/package.json +2 -3
- package/node_modules/chalk/license +9 -0
- package/node_modules/chalk/package.json +83 -0
- package/node_modules/chalk/readme.md +297 -0
- package/node_modules/chalk/source/index.d.ts +325 -0
- package/node_modules/chalk/source/index.js +225 -0
- package/node_modules/chalk/source/utilities.js +33 -0
- package/node_modules/chalk/source/vendor/ansi-styles/index.d.ts +236 -0
- package/node_modules/chalk/source/vendor/ansi-styles/index.js +223 -0
- package/node_modules/chalk/source/vendor/supports-color/browser.d.ts +1 -0
- package/node_modules/chalk/source/vendor/supports-color/browser.js +34 -0
- package/node_modules/chalk/source/vendor/supports-color/index.d.ts +55 -0
- package/node_modules/chalk/source/vendor/supports-color/index.js +190 -0
- package/package.json +9 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../src/commands/audit/output.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAsB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../src/commands/audit/output.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAsB,MAAM,yBAAyB,CAAC;AAE3E,OAAO,EACL,mBAAmB,EACpB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGjE;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,WAAW,CAAC,EAAE,MAAM,GACnB,MAAM,GAAG,SAAS,CAgBpB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS,CAO7E;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,EAC1C,OAAO,EAAE,mBAAmB,EAC5B,KAAK,EAAE,OAAO,GACb,IAAI,CAqBN;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,GACjD,IAAI,CAyBN;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,cAAc,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,GAAG;IAAE,MAAM,EAAE,SAAS,EAAE,CAAA;CAAE,EACvE,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,EAC1C,OAAO,EAAE,UAAU,GAAG,UAAU,GAAG,OAAO,EAC1C,OAAO,EAAE,mBAAmB,EAC5B,KAAK,EAAE,OAAO,GACb,IAAI,CA6BN"}
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
import fs from "fs";
|
|
5
5
|
import path from "path";
|
|
6
6
|
import { colorize, dim, brand, severity as severityPalette } from "@vertaaux/tui";
|
|
7
|
-
import { createEnvelope, writeJsonOutput, writeOutput } from "../../output/envelope.js";
|
|
8
|
-
const writeStdout = writeOutput;
|
|
7
|
+
import { createEnvelope, writeDataOutput, writeJsonOutput, writeOutput } from "../../output/envelope.js";
|
|
9
8
|
/**
|
|
10
9
|
* Write output to file. Returns the resolved path if written to file, undefined otherwise.
|
|
11
10
|
*/
|
|
@@ -61,7 +60,7 @@ export function outputFireAndForget(created, format, formatter, options, quiet)
|
|
|
61
60
|
writeOutput(`Report written to: ${filePath}\n`);
|
|
62
61
|
}
|
|
63
62
|
else if (!filePath) {
|
|
64
|
-
|
|
63
|
+
writeDataOutput(output);
|
|
65
64
|
}
|
|
66
65
|
}
|
|
67
66
|
}
|
|
@@ -124,7 +123,7 @@ export function outputFormattedResults(filteredResult, format, formatter, groupB
|
|
|
124
123
|
writeOutput(`Report written to: ${filePath}\n`);
|
|
125
124
|
}
|
|
126
125
|
else if (!filePath) {
|
|
127
|
-
|
|
126
|
+
writeDataOutput(output);
|
|
128
127
|
}
|
|
129
128
|
}
|
|
130
129
|
}
|
|
@@ -3,12 +3,20 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { VertaauxConfig } from "../../config/schema.js";
|
|
5
5
|
import { type PolicyFile } from "../../policy/index.js";
|
|
6
|
+
import { type AuditProfile } from "../../policy/schema.js";
|
|
6
7
|
import { type QualityGateConfig } from "../../quality-gate/index.js";
|
|
7
8
|
import type { AuditCommandOptions } from "./types.js";
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
+
* Resolve an audit profile by name from built-in profiles or config-defined profiles.
|
|
11
|
+
* Returns null if no profile is requested.
|
|
10
12
|
*/
|
|
11
|
-
export declare function
|
|
13
|
+
export declare function resolveAuditProfile(profileName: string | undefined, configProfiles?: Record<string, AuditProfile>): AuditProfile | null;
|
|
14
|
+
/**
|
|
15
|
+
* Build quality gate configuration from options, profile, and config.
|
|
16
|
+
*
|
|
17
|
+
* Precedence: CLI flags > config file > profile > defaults
|
|
18
|
+
*/
|
|
19
|
+
export declare function buildQualityGateConfig(config: VertaauxConfig, options: AuditCommandOptions, profile?: AuditProfile | null): QualityGateConfig;
|
|
12
20
|
/**
|
|
13
21
|
* Load and resolve a policy file with branch-specific overrides.
|
|
14
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../../src/commands/audit/policy.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,KAAK,iBAAiB,EAEvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAKtD
|
|
1
|
+
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../../src/commands/audit/policy.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,KAAK,YAAY,EAElB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,KAAK,iBAAiB,EAEvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAKtD;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAC5C,YAAY,GAAG,IAAI,CAoBrB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,mBAAmB,EAC5B,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,GAC5B,iBAAiB,CAmEnB;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,mBAAmB,EAC5B,KAAK,EAAE,OAAO,GACb,OAAO,CAAC;IAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CAwD7D"}
|
|
@@ -7,16 +7,61 @@ import { writeOutput } from "../../output/envelope.js";
|
|
|
7
7
|
import semver from "semver";
|
|
8
8
|
import { ExitCode } from "../../utils/exit-codes.js";
|
|
9
9
|
import { loadPolicy, resolveBranchPolicy, } from "../../policy/index.js";
|
|
10
|
+
import { AUDIT_PROFILES, } from "../../policy/schema.js";
|
|
10
11
|
import { DEFAULT_QUALITY_GATE_CONFIG, } from "../../quality-gate/index.js";
|
|
11
12
|
import { CLI_VERSION } from "./types.js";
|
|
12
13
|
import { detectCurrentBranch } from "./ci-detection.js";
|
|
13
14
|
import { strings } from "../../ui/strings.js";
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
+
* Resolve an audit profile by name from built-in profiles or config-defined profiles.
|
|
17
|
+
* Returns null if no profile is requested.
|
|
16
18
|
*/
|
|
17
|
-
export function
|
|
19
|
+
export function resolveAuditProfile(profileName, configProfiles) {
|
|
20
|
+
if (!profileName)
|
|
21
|
+
return null;
|
|
22
|
+
// Check config-defined profiles first (user overrides)
|
|
23
|
+
if (configProfiles?.[profileName]) {
|
|
24
|
+
return configProfiles[profileName];
|
|
25
|
+
}
|
|
26
|
+
// Check built-in profiles
|
|
27
|
+
if (profileName in AUDIT_PROFILES) {
|
|
28
|
+
return AUDIT_PROFILES[profileName];
|
|
29
|
+
}
|
|
30
|
+
const validNames = [
|
|
31
|
+
...Object.keys(AUDIT_PROFILES),
|
|
32
|
+
...Object.keys(configProfiles || {}),
|
|
33
|
+
].join(", ");
|
|
34
|
+
throw new Error(`Unknown audit profile "${profileName}". Valid profiles: ${validNames}`);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Build quality gate configuration from options, profile, and config.
|
|
38
|
+
*
|
|
39
|
+
* Precedence: CLI flags > config file > profile > defaults
|
|
40
|
+
*/
|
|
41
|
+
export function buildQualityGateConfig(config, options, profile) {
|
|
18
42
|
// Start with defaults
|
|
19
43
|
const gateConfig = { ...DEFAULT_QUALITY_GATE_CONFIG };
|
|
44
|
+
// Apply profile assertions (lowest override precedence)
|
|
45
|
+
if (profile?.assertions) {
|
|
46
|
+
if (profile.assertions.fail_on)
|
|
47
|
+
gateConfig.failOn = profile.assertions.fail_on;
|
|
48
|
+
if (profile.assertions.overall_score !== undefined) {
|
|
49
|
+
gateConfig.thresholds = { ...gateConfig.thresholds, overall: profile.assertions.overall_score };
|
|
50
|
+
}
|
|
51
|
+
if (profile.assertions.accessibility_score !== undefined) {
|
|
52
|
+
gateConfig.thresholds = { ...gateConfig.thresholds, accessibility: profile.assertions.accessibility_score };
|
|
53
|
+
}
|
|
54
|
+
if (profile.assertions.max_new_errors !== undefined) {
|
|
55
|
+
gateConfig.maxNew = { ...gateConfig.maxNew, error: profile.assertions.max_new_errors };
|
|
56
|
+
}
|
|
57
|
+
if (profile.assertions.max_new_warnings !== undefined) {
|
|
58
|
+
gateConfig.maxNew = { ...gateConfig.maxNew, warning: profile.assertions.max_new_warnings };
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// Apply profile thresholds
|
|
62
|
+
if (profile?.thresholds) {
|
|
63
|
+
gateConfig.thresholds = { ...gateConfig.thresholds, ...profile.thresholds };
|
|
64
|
+
}
|
|
20
65
|
// Apply config file settings
|
|
21
66
|
const configGate = config.qualityGate;
|
|
22
67
|
if (configGate) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/commands/audit/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAElC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;IACrC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC;IAG5C,QAA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,CAAC,EAAE,MAAM,CAAC;IAGjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IAGvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAGnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAGlB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,OAAO,CAAC;IAG1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE;QACX,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,yBAAyB;AACzB,eAAO,MAAM,aAAa,wBAAwB,CAAC;AAEnD,2EAA2E;AAC3E,eAAO,MAAM,WAAW,QAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseline.d.ts","sourceRoot":"","sources":["../../src/commands/baseline.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"baseline.d.ts","sourceRoot":"","sources":["../../src/commands/baseline.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA2FzC,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,UAAU,EAAE,sBAAsB,GACjC,OAAO,CAAC,IAAI,CAAC,CAwOf;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAmC9D"}
|
|
@@ -11,15 +11,17 @@ import { existsSync } from "fs";
|
|
|
11
11
|
import { renderError, renderWarning, runSteps, createRenderer } from "@vertaaux/tui";
|
|
12
12
|
import { ExitCode } from "../utils/exit-codes.js";
|
|
13
13
|
import { createClient } from "../utils/client.js";
|
|
14
|
+
import { resolveConfig } from "../config/loader.js";
|
|
14
15
|
import { loadBaseline, saveBaseline, createBaseline, addToBaseline, DEFAULT_BASELINE_PATH, } from "../baseline/manager.js";
|
|
15
16
|
import { generateFingerprint } from "../baseline/hash.js";
|
|
16
|
-
import {
|
|
17
|
+
import { writeDataOutput } from "../output/envelope.js";
|
|
17
18
|
import { strings } from "../ui/strings.js";
|
|
19
|
+
import { unwrapJsonEnvelope } from "../utils/stdin.js";
|
|
18
20
|
/**
|
|
19
21
|
* Fetch audit results via SDK client.
|
|
20
22
|
*/
|
|
21
|
-
async function fetchAudit(jobId) {
|
|
22
|
-
return createClient().audits.retrieve(jobId);
|
|
23
|
+
async function fetchAudit(jobId, options) {
|
|
24
|
+
return createClient(options).audits.retrieve(jobId);
|
|
23
25
|
}
|
|
24
26
|
/**
|
|
25
27
|
* Normalize issues from various API response formats.
|
|
@@ -106,7 +108,7 @@ export async function handleBaseline(jobIdArg, cmdOptions) {
|
|
|
106
108
|
}) + "\n");
|
|
107
109
|
return;
|
|
108
110
|
}
|
|
109
|
-
|
|
111
|
+
writeDataOutput(formatBaselineSummary(baseline));
|
|
110
112
|
},
|
|
111
113
|
},
|
|
112
114
|
];
|
|
@@ -143,7 +145,10 @@ export async function handleBaseline(jobIdArg, cmdOptions) {
|
|
|
143
145
|
// Need to find the issue to add it properly
|
|
144
146
|
let issue;
|
|
145
147
|
if (jobIdArg) {
|
|
146
|
-
const audit = await fetchAudit(jobIdArg
|
|
148
|
+
const audit = await fetchAudit(jobIdArg, {
|
|
149
|
+
base: cmdOptions.base,
|
|
150
|
+
apiKey: cmdOptions.apiKey,
|
|
151
|
+
});
|
|
147
152
|
const issues = normalizeIssues(audit.issues);
|
|
148
153
|
const found = findIssueById(issues, issueId);
|
|
149
154
|
if (!found) {
|
|
@@ -175,7 +180,7 @@ export async function handleBaseline(jobIdArg, cmdOptions) {
|
|
|
175
180
|
}) + "\n");
|
|
176
181
|
process.exitCode = ExitCode.ERROR;
|
|
177
182
|
}
|
|
178
|
-
|
|
183
|
+
writeDataOutput(`Added issue ${issueId} to baseline${cmdOptions.reason ? `\nReason: ${cmdOptions.reason}` : ""}`);
|
|
179
184
|
return;
|
|
180
185
|
}
|
|
181
186
|
// Handle --from-file: create baseline from JSON file
|
|
@@ -196,12 +201,12 @@ export async function handleBaseline(jobIdArg, cmdOptions) {
|
|
|
196
201
|
summaryText: "Baseline saved",
|
|
197
202
|
run: async () => {
|
|
198
203
|
const content = await readFile(filePath, "utf-8");
|
|
199
|
-
const data = JSON.parse(content);
|
|
204
|
+
const data = unwrapJsonEnvelope(JSON.parse(content));
|
|
200
205
|
const issues = normalizeIssues(data.issues);
|
|
201
206
|
const url = data.url || "unknown";
|
|
202
207
|
const baseline = createBaseline(issues, url);
|
|
203
208
|
await saveBaseline(baseline, baselinePath);
|
|
204
|
-
|
|
209
|
+
writeDataOutput(`Baseline created with ${issues.length} issues\nSaved to: ${baselinePath}`);
|
|
205
210
|
},
|
|
206
211
|
},
|
|
207
212
|
];
|
|
@@ -238,7 +243,10 @@ export async function handleBaseline(jobIdArg, cmdOptions) {
|
|
|
238
243
|
actionText: "Fetching audit results...",
|
|
239
244
|
summaryText: "Audit results loaded",
|
|
240
245
|
run: async () => {
|
|
241
|
-
const audit = await fetchAudit(jobIdArg
|
|
246
|
+
const audit = await fetchAudit(jobIdArg, {
|
|
247
|
+
base: cmdOptions.base,
|
|
248
|
+
apiKey: cmdOptions.apiKey,
|
|
249
|
+
});
|
|
242
250
|
if (audit.status !== "completed") {
|
|
243
251
|
throw new Error(strings.fixAll.auditIncomplete(jobIdArg, audit.status || "unknown"));
|
|
244
252
|
}
|
|
@@ -246,7 +254,7 @@ export async function handleBaseline(jobIdArg, cmdOptions) {
|
|
|
246
254
|
const url = audit.url || "unknown";
|
|
247
255
|
const baseline = createBaseline(issues, url);
|
|
248
256
|
await saveBaseline(baseline, baselinePath);
|
|
249
|
-
|
|
257
|
+
writeDataOutput(`Baseline created with ${issues.length} issues\nSaved to: ${baselinePath}`);
|
|
250
258
|
},
|
|
251
259
|
},
|
|
252
260
|
];
|
|
@@ -278,9 +286,15 @@ export function registerBaselineCommand(program) {
|
|
|
278
286
|
.option("--ignore <id>", "Add single issue to existing baseline by ID")
|
|
279
287
|
.option("--reason <text>", "Reason for baseline/ignore (optional)")
|
|
280
288
|
.option("--list", "Show baselined issues count and last update")
|
|
281
|
-
.action(async (jobIdArg, cmdOptions) => {
|
|
289
|
+
.action(async (jobIdArg, cmdOptions, command) => {
|
|
282
290
|
try {
|
|
283
|
-
|
|
291
|
+
const globalOpts = command.optsWithGlobals?.() || {};
|
|
292
|
+
const config = await resolveConfig(globalOpts.config);
|
|
293
|
+
await handleBaseline(jobIdArg, {
|
|
294
|
+
...cmdOptions,
|
|
295
|
+
base: globalOpts.base,
|
|
296
|
+
apiKey: config.apiKey,
|
|
297
|
+
});
|
|
284
298
|
}
|
|
285
299
|
catch (error) {
|
|
286
300
|
process.stderr.write(renderError({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comment.d.ts","sourceRoot":"","sources":["../../src/commands/comment.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,OAAO,EAGL,KAAK,eAAe,EAErB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"comment.d.ts","sourceRoot":"","sources":["../../src/commands/comment.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,OAAO,EAGL,KAAK,eAAe,EAErB,MAAM,uBAAuB,CAAC;AA2B/B;;GAEG;AACH,UAAU,cAAc;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IAErC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAqJD;;GAEG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAyQ1E;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgG7D;AAGD,OAAO,EAAE,qBAAqB,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/commands/comment.js
CHANGED
|
@@ -11,11 +11,12 @@ import { renderError, runSteps, createRenderer } from "@vertaaux/tui";
|
|
|
11
11
|
import { loadBaseline } from "../baseline/manager.js";
|
|
12
12
|
import { ExitCode } from "../utils/exit-codes.js";
|
|
13
13
|
import { formatMarkdownComment, categorizeIssuesForComment, } from "../output/markdown.js";
|
|
14
|
-
import { createEnvelope, writeJsonOutput, writeOutput } from "../output/envelope.js";
|
|
14
|
+
import { createEnvelope, writeDataOutput, writeJsonOutput, writeOutput } from "../output/envelope.js";
|
|
15
15
|
import { resolveCommandFormat } from "../output/formats.js";
|
|
16
16
|
import { postOrUpdateGitHubComment, parseRepository, extractPRNumber, } from "../ci/github-api.js";
|
|
17
17
|
import { postOrUpdateGitLabNote, getGitLabConfig, extractMRIid, } from "../ci/gitlab-api.js";
|
|
18
18
|
import { strings } from "../ui/strings.js";
|
|
19
|
+
import { unwrapJsonEnvelope } from "../utils/stdin.js";
|
|
19
20
|
/**
|
|
20
21
|
* Default path for latest audit results.
|
|
21
22
|
*/
|
|
@@ -158,7 +159,7 @@ export async function handleComment(options) {
|
|
|
158
159
|
process.exit(ExitCode.ERROR);
|
|
159
160
|
}
|
|
160
161
|
const content = fs.readFileSync(inputPath, "utf-8");
|
|
161
|
-
auditResult = JSON.parse(content);
|
|
162
|
+
auditResult = unwrapJsonEnvelope(JSON.parse(content));
|
|
162
163
|
}
|
|
163
164
|
else if (!process.stdin.isTTY) {
|
|
164
165
|
// From stdin
|
|
@@ -167,14 +168,14 @@ export async function handleComment(options) {
|
|
|
167
168
|
chunks.push(chunk);
|
|
168
169
|
}
|
|
169
170
|
const content = Buffer.concat(chunks).toString("utf-8");
|
|
170
|
-
auditResult = JSON.parse(content);
|
|
171
|
+
auditResult = unwrapJsonEnvelope(JSON.parse(content));
|
|
171
172
|
}
|
|
172
173
|
else {
|
|
173
174
|
// Try latest audit file
|
|
174
175
|
const latestPath = path.resolve(process.cwd(), LATEST_AUDIT_PATH);
|
|
175
176
|
if (fs.existsSync(latestPath)) {
|
|
176
177
|
const content = fs.readFileSync(latestPath, "utf-8");
|
|
177
|
-
auditResult = JSON.parse(content);
|
|
178
|
+
auditResult = unwrapJsonEnvelope(JSON.parse(content));
|
|
178
179
|
}
|
|
179
180
|
else {
|
|
180
181
|
process.stderr.write(renderError({
|
|
@@ -327,7 +328,7 @@ export async function handleComment(options) {
|
|
|
327
328
|
writeJsonOutput(jsonData, "comment");
|
|
328
329
|
}
|
|
329
330
|
else {
|
|
330
|
-
|
|
331
|
+
writeDataOutput(outputContent);
|
|
331
332
|
}
|
|
332
333
|
process.exit(ExitCode.ERROR);
|
|
333
334
|
}
|
|
@@ -347,7 +348,7 @@ export async function handleComment(options) {
|
|
|
347
348
|
writeJsonOutput(jsonData, "comment");
|
|
348
349
|
}
|
|
349
350
|
else {
|
|
350
|
-
|
|
351
|
+
writeDataOutput(outputContent);
|
|
351
352
|
}
|
|
352
353
|
process.exit(ExitCode.ERROR);
|
|
353
354
|
}
|
|
@@ -367,7 +368,7 @@ export async function handleComment(options) {
|
|
|
367
368
|
writeJsonOutput(jsonData, "comment");
|
|
368
369
|
}
|
|
369
370
|
else {
|
|
370
|
-
|
|
371
|
+
writeDataOutput(outputContent);
|
|
371
372
|
}
|
|
372
373
|
}
|
|
373
374
|
}
|
package/dist/commands/compare.js
CHANGED
|
@@ -19,7 +19,7 @@ import { bold, dim, colorize, boldColor, scoreColor, brand, severity as severity
|
|
|
19
19
|
import { ExitCode } from "../utils/exit-codes.js";
|
|
20
20
|
import { resolveApiBase, getApiKey, apiRequest, waitForAudit, createClient, } from "../utils/client.js";
|
|
21
21
|
import { resolveConfig } from "../config/loader.js";
|
|
22
|
-
import {
|
|
22
|
+
import { writeDataOutput, writeJsonOutput } from "../output/envelope.js";
|
|
23
23
|
import { resolveCommandFormat } from "../output/formats.js";
|
|
24
24
|
import { readJsonInput } from "../utils/stdin.js";
|
|
25
25
|
import { AI_TIMEOUT_MS } from "../utils/ai-error.js";
|
|
@@ -244,7 +244,7 @@ export async function handleCompare(opts) {
|
|
|
244
244
|
writeJsonOutput(responseData, "compare");
|
|
245
245
|
}
|
|
246
246
|
else {
|
|
247
|
-
|
|
247
|
+
writeDataOutput(formatLlmCompareHuman(responseData, verbose));
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
}
|
|
@@ -378,7 +378,7 @@ export async function handleCompare(opts) {
|
|
|
378
378
|
writeJsonOutput(compareJsonPayload, "compare");
|
|
379
379
|
}
|
|
380
380
|
else if (compareOutput !== null) {
|
|
381
|
-
|
|
381
|
+
writeDataOutput(compareOutput);
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
384
|
}
|
package/dist/commands/diff.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/commands/diff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/commands/diff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuCzC,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAMD,wBAAsB,UAAU,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwKxE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAkC1D"}
|
package/dist/commands/diff.js
CHANGED
|
@@ -13,17 +13,19 @@ import { readFile } from "fs/promises";
|
|
|
13
13
|
import { existsSync } from "fs";
|
|
14
14
|
import { ExitCode } from "../utils/exit-codes.js";
|
|
15
15
|
import { createClient } from "../utils/client.js";
|
|
16
|
+
import { resolveConfig } from "../config/loader.js";
|
|
16
17
|
import { loadBaseline, DEFAULT_BASELINE_PATH } from "../baseline/manager.js";
|
|
17
18
|
import { computeDiff, formatDiffHuman, formatDiffJson } from "../baseline/diff.js";
|
|
18
|
-
import { writeJsonOutput, writeOutput } from "../output/envelope.js";
|
|
19
|
+
import { writeDataOutput, writeJsonOutput, writeOutput } from "../output/envelope.js";
|
|
19
20
|
import { resolveCommandFormat } from "../output/formats.js";
|
|
20
21
|
import { strings } from "../ui/strings.js";
|
|
21
22
|
import { runSteps, createRenderer, renderWarning, renderError, isCI, isTTY } from "@vertaaux/tui";
|
|
23
|
+
import { unwrapJsonEnvelope } from "../utils/stdin.js";
|
|
22
24
|
/**
|
|
23
25
|
* Fetch audit results via SDK client.
|
|
24
26
|
*/
|
|
25
|
-
async function fetchAudit(jobId) {
|
|
26
|
-
return createClient().audits.retrieve(jobId);
|
|
27
|
+
async function fetchAudit(jobId, options) {
|
|
28
|
+
return createClient(options).audits.retrieve(jobId);
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
31
|
* Normalize issues from various API response formats.
|
|
@@ -90,12 +92,15 @@ export async function handleDiff(opts) {
|
|
|
90
92
|
throw new Error(`File not found: ${filePath}`);
|
|
91
93
|
}
|
|
92
94
|
const content = await readFile(filePath, "utf-8");
|
|
93
|
-
const data = JSON.parse(content);
|
|
95
|
+
const data = unwrapJsonEnvelope(JSON.parse(content));
|
|
94
96
|
currentIssues = normalizeIssues(data.issues);
|
|
95
97
|
currentUrl = data.url || "unknown";
|
|
96
98
|
}
|
|
97
99
|
else if (jobIdArg) {
|
|
98
|
-
const audit = await fetchAudit(jobIdArg
|
|
100
|
+
const audit = await fetchAudit(jobIdArg, {
|
|
101
|
+
base: opts.base,
|
|
102
|
+
apiKey: opts.apiKey,
|
|
103
|
+
});
|
|
99
104
|
if (audit.status !== "completed") {
|
|
100
105
|
throw new Error(strings.fixAll.auditIncomplete(jobIdArg || "unknown", audit.status || "unknown"));
|
|
101
106
|
}
|
|
@@ -107,7 +112,10 @@ export async function handleDiff(opts) {
|
|
|
107
112
|
}
|
|
108
113
|
// Handle --compare: compare two audits
|
|
109
114
|
if (opts.compare) {
|
|
110
|
-
const compareAudit = await fetchAudit(opts.compare
|
|
115
|
+
const compareAudit = await fetchAudit(opts.compare, {
|
|
116
|
+
base: opts.base,
|
|
117
|
+
apiKey: opts.apiKey,
|
|
118
|
+
});
|
|
111
119
|
if (compareAudit.status !== "completed") {
|
|
112
120
|
throw new Error(strings.fixAll.auditIncomplete(opts.compare || "unknown", compareAudit.status || "unknown"));
|
|
113
121
|
}
|
|
@@ -135,8 +143,8 @@ export async function handleDiff(opts) {
|
|
|
135
143
|
const diffData = format === "json" ? JSON.parse(formatDiffJson(diff)) : null;
|
|
136
144
|
ctx.diffOutput = { diffData, newCount: diff.summary.newCount, currentUrl };
|
|
137
145
|
if (format !== "json") {
|
|
138
|
-
|
|
139
|
-
|
|
146
|
+
writeDataOutput(`Comparing ${currentUrl} (current) vs ${tempBaseline.url} (previous)\n`);
|
|
147
|
+
writeDataOutput(formatDiffHuman(diff, verbose));
|
|
140
148
|
}
|
|
141
149
|
return;
|
|
142
150
|
}
|
|
@@ -149,8 +157,8 @@ export async function handleDiff(opts) {
|
|
|
149
157
|
const diffData = format === "json" ? JSON.parse(formatDiffJson(diff)) : null;
|
|
150
158
|
ctx.diffOutput = { diffData, newCount: diff.summary.newCount, currentUrl };
|
|
151
159
|
if (format !== "json") {
|
|
152
|
-
|
|
153
|
-
|
|
160
|
+
writeDataOutput(`Comparing ${currentUrl} against baseline\n`);
|
|
161
|
+
writeDataOutput(formatDiffHuman(diff, verbose));
|
|
154
162
|
}
|
|
155
163
|
},
|
|
156
164
|
},
|
|
@@ -173,8 +181,7 @@ export async function handleDiff(opts) {
|
|
|
173
181
|
if (!success) {
|
|
174
182
|
const failedStep = states.find((s) => s.status === "failed");
|
|
175
183
|
process.stderr.write(renderError({
|
|
176
|
-
message: strings.diff.errors.noBaseline,
|
|
177
|
-
context: failedStep?.failReason,
|
|
184
|
+
message: failedStep?.failReason || strings.diff.errors.noBaseline,
|
|
178
185
|
suggestion: "vertaa audit <url>",
|
|
179
186
|
}) + "\n");
|
|
180
187
|
process.exit(ExitCode.ERROR);
|
|
@@ -205,10 +212,14 @@ export function registerDiffCommand(program) {
|
|
|
205
212
|
.action(async (jobIdArg, cmdOptions, cmd) => {
|
|
206
213
|
try {
|
|
207
214
|
const machineMode = cmd.optsWithGlobals?.().machine || false;
|
|
215
|
+
const globalOpts = cmd.optsWithGlobals?.() || {};
|
|
216
|
+
const config = await resolveConfig(globalOpts.config);
|
|
208
217
|
await handleDiff({
|
|
209
218
|
...cmdOptions,
|
|
210
219
|
machine: machineMode,
|
|
211
220
|
jobIdArg,
|
|
221
|
+
base: globalOpts.base,
|
|
222
|
+
apiKey: config.apiKey,
|
|
212
223
|
});
|
|
213
224
|
}
|
|
214
225
|
catch (error) {
|
package/dist/commands/doc.js
CHANGED
|
@@ -17,7 +17,7 @@ import { bold, dim, renderError, createRenderer, runSteps } from "@vertaaux/tui"
|
|
|
17
17
|
import { ExitCode } from "../utils/exit-codes.js";
|
|
18
18
|
import { resolveApiBase, getApiKey, apiRequest, createClient } from "../utils/client.js";
|
|
19
19
|
import { resolveConfig } from "../config/loader.js";
|
|
20
|
-
import {
|
|
20
|
+
import { writeDataOutput, writeJsonOutput } from "../output/envelope.js";
|
|
21
21
|
import { resolveCommandFormat } from "../output/formats.js";
|
|
22
22
|
import { readJsonInput } from "../utils/stdin.js";
|
|
23
23
|
import { AI_TIMEOUT_MS } from "../utils/ai-error.js";
|
|
@@ -171,7 +171,7 @@ export async function handleDoc(opts) {
|
|
|
171
171
|
writeJsonOutput(data, "doc");
|
|
172
172
|
}
|
|
173
173
|
else {
|
|
174
|
-
|
|
174
|
+
writeDataOutput(format === "markdown" ? data.content : formatDocHuman(data));
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
}
|
package/dist/commands/doctor.js
CHANGED
|
@@ -13,7 +13,7 @@ import { loadToken, isTokenExpired, getCredentialsPath } from "../auth/token-sto
|
|
|
13
13
|
import { getCIToken, validateCIToken } from "../auth/ci-token.js";
|
|
14
14
|
import { resolveApiBase } from "../utils/client.js";
|
|
15
15
|
import { ExitCode } from "../utils/exit-codes.js";
|
|
16
|
-
import { writeJsonOutput, writeOutput } from "../output/envelope.js";
|
|
16
|
+
import { writeDataOutput, writeJsonOutput, writeOutput } from "../output/envelope.js";
|
|
17
17
|
import { COMMAND_FORMATS } from "../output/formats.js";
|
|
18
18
|
import { getVersion } from "../ui/banner.js";
|
|
19
19
|
import { strings } from "../ui/strings.js";
|
|
@@ -449,7 +449,7 @@ export async function handleDoctor(options) {
|
|
|
449
449
|
writeJsonOutput(result, "doctor");
|
|
450
450
|
}
|
|
451
451
|
else {
|
|
452
|
-
|
|
452
|
+
writeDataOutput(formatDoctorHuman(result));
|
|
453
453
|
}
|
|
454
454
|
// Exit code: 0 on all-pass/warn, 1 on any fail
|
|
455
455
|
if (summary.fail > 0) {
|
package/dist/commands/explain.js
CHANGED
|
@@ -21,7 +21,7 @@ import { bold, dim, colorize, boldColor, brand, severity as severityPalette, ren
|
|
|
21
21
|
import { ExitCode } from "../utils/exit-codes.js";
|
|
22
22
|
import { resolveApiBase, getApiKey, apiRequest, createClient } from "../utils/client.js";
|
|
23
23
|
import { resolveConfig } from "../config/loader.js";
|
|
24
|
-
import {
|
|
24
|
+
import { writeDataOutput, writeJsonOutput } from "../output/envelope.js";
|
|
25
25
|
import { resolveCommandFormat } from "../output/formats.js";
|
|
26
26
|
import { readJsonInput } from "../utils/stdin.js";
|
|
27
27
|
import { AI_TIMEOUT_MS } from "../utils/ai-error.js";
|
|
@@ -321,7 +321,7 @@ export async function handleExplain(opts) {
|
|
|
321
321
|
}, "explain");
|
|
322
322
|
}
|
|
323
323
|
else {
|
|
324
|
-
|
|
324
|
+
writeDataOutput(formatEvidenceBundle(issue));
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
327
|
}
|
|
@@ -430,7 +430,7 @@ export async function handleExplain(opts) {
|
|
|
430
430
|
writeJsonOutput(responseData, "explain");
|
|
431
431
|
}
|
|
432
432
|
else {
|
|
433
|
-
|
|
433
|
+
writeDataOutput(formatAiExplainHuman(responseData, verbose, rawIssues));
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
436
|
}
|
package/dist/commands/fix-all.js
CHANGED
|
@@ -6,7 +6,7 @@ import { renderError, createRenderer, runSteps } from "@vertaaux/tui";
|
|
|
6
6
|
import { ExitCode } from "../utils/exit-codes.js";
|
|
7
7
|
import { resolveApiBase, resolveFormat, getString, getBool, createClient, } from "../utils/api-client.js";
|
|
8
8
|
import { normalizeIssues, isAutoFixable, formatBatchMarkdown, } from "../utils/formatters.js";
|
|
9
|
-
import { writeJsonOutput, writeOutput } from "../output/envelope.js";
|
|
9
|
+
import { writeDataOutput, writeJsonOutput, writeOutput } from "../output/envelope.js";
|
|
10
10
|
import { strings } from "../ui/strings.js";
|
|
11
11
|
const BATCH_LIMIT = 10;
|
|
12
12
|
export async function handleFixAll(opts) {
|
|
@@ -158,7 +158,7 @@ export async function handleFixAll(opts) {
|
|
|
158
158
|
writeJsonOutput(finalResults, "fix-all");
|
|
159
159
|
}
|
|
160
160
|
else {
|
|
161
|
-
|
|
161
|
+
writeDataOutput(formatBatchMarkdown(finalResults));
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fix-plan.d.ts","sourceRoot":"","sources":["../../src/commands/fix-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8IpC,MAAM,WAAW,qBAAqB;IACpC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiI9E;AAMD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"fix-plan.d.ts","sourceRoot":"","sources":["../../src/commands/fix-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8IpC,MAAM,WAAW,qBAAqB;IACpC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiI9E;AAMD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA2C7D"}
|
|
@@ -14,7 +14,7 @@ import { bold, dim, colorize, boldColor, brand, severity as severityPalette, ren
|
|
|
14
14
|
import { ExitCode } from "../utils/exit-codes.js";
|
|
15
15
|
import { resolveApiBase, getApiKey, apiRequest, createClient } from "../utils/client.js";
|
|
16
16
|
import { resolveConfig } from "../config/loader.js";
|
|
17
|
-
import {
|
|
17
|
+
import { writeDataOutput, writeJsonOutput } from "../output/envelope.js";
|
|
18
18
|
import { resolveCommandFormat } from "../output/formats.js";
|
|
19
19
|
import { readJsonInput } from "../utils/stdin.js";
|
|
20
20
|
import { AI_TIMEOUT_MS } from "../utils/ai-error.js";
|
|
@@ -198,7 +198,7 @@ export async function handleFixPlan(opts) {
|
|
|
198
198
|
writeJsonOutput(responseData, "fix-plan");
|
|
199
199
|
}
|
|
200
200
|
else {
|
|
201
|
-
|
|
201
|
+
writeDataOutput(formatFixPlanHuman(responseData));
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
}
|
|
@@ -212,6 +212,7 @@ export function registerFixPlanCommand(program) {
|
|
|
212
212
|
.option("--job <job-id>", "Fetch audit data from a job ID")
|
|
213
213
|
.option("--file <path>", "Load audit JSON from file")
|
|
214
214
|
.option("-f, --format <format>", "Output format: json | human")
|
|
215
|
+
.option("--json", "Alias for --format json")
|
|
215
216
|
.addHelpText("after", `
|
|
216
217
|
Examples:
|
|
217
218
|
vertaa audit https://example.com --json | vertaa fix-plan
|
|
@@ -227,7 +228,7 @@ Examples:
|
|
|
227
228
|
await handleFixPlan({
|
|
228
229
|
job: options.job,
|
|
229
230
|
file: options.file,
|
|
230
|
-
format: options.format,
|
|
231
|
+
format: options.json ? "json" : options.format,
|
|
231
232
|
base: globalOpts.base,
|
|
232
233
|
machine: machineMode,
|
|
233
234
|
apiKey: config.apiKey,
|