@paretools/cargo 0.8.4 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/cargo-runner.d.ts +1 -1
- package/dist/lib/cargo-runner.d.ts.map +1 -1
- package/dist/lib/cargo-runner.js +2 -2
- package/dist/lib/cargo-runner.js.map +1 -1
- package/dist/lib/formatters.d.ts +29 -8
- package/dist/lib/formatters.d.ts.map +1 -1
- package/dist/lib/formatters.js +166 -45
- package/dist/lib/formatters.js.map +1 -1
- package/dist/lib/parsers.d.ts +78 -18
- package/dist/lib/parsers.d.ts.map +1 -1
- package/dist/lib/parsers.js +613 -60
- package/dist/lib/parsers.js.map +1 -1
- package/dist/schemas/index.d.ts +94 -9
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +88 -11
- package/dist/schemas/index.js.map +1 -1
- package/dist/tools/add.d.ts.map +1 -1
- package/dist/tools/add.js +71 -4
- package/dist/tools/add.js.map +1 -1
- package/dist/tools/audit.d.ts.map +1 -1
- package/dist/tools/audit.js +80 -4
- package/dist/tools/audit.js.map +1 -1
- package/dist/tools/build.d.ts.map +1 -1
- package/dist/tools/build.js +91 -2
- package/dist/tools/build.js.map +1 -1
- package/dist/tools/check.d.ts.map +1 -1
- package/dist/tools/check.js +84 -1
- package/dist/tools/check.js.map +1 -1
- package/dist/tools/clippy.d.ts.map +1 -1
- package/dist/tools/clippy.js +139 -3
- package/dist/tools/clippy.js.map +1 -1
- package/dist/tools/doc.d.ts.map +1 -1
- package/dist/tools/doc.js +81 -3
- package/dist/tools/doc.js.map +1 -1
- package/dist/tools/fmt.d.ts.map +1 -1
- package/dist/tools/fmt.js +66 -2
- package/dist/tools/fmt.js.map +1 -1
- package/dist/tools/remove.d.ts.map +1 -1
- package/dist/tools/remove.js +59 -4
- package/dist/tools/remove.js.map +1 -1
- package/dist/tools/run.d.ts.map +1 -1
- package/dist/tools/run.js +103 -3
- package/dist/tools/run.js.map +1 -1
- package/dist/tools/test.d.ts.map +1 -1
- package/dist/tools/test.js +108 -3
- package/dist/tools/test.js.map +1 -1
- package/dist/tools/tree.d.ts.map +1 -1
- package/dist/tools/tree.js +119 -9
- package/dist/tools/tree.js.map +1 -1
- package/dist/tools/update.d.ts.map +1 -1
- package/dist/tools/update.js +64 -5
- package/dist/tools/update.js.map +1 -1
- package/package.json +2 -2
package/dist/lib/parsers.d.ts
CHANGED
|
@@ -2,61 +2,121 @@ import type { CargoBuildResult, CargoTestResult, CargoClippyResult, CargoRunResu
|
|
|
2
2
|
/**
|
|
3
3
|
* Parses `cargo build --message-format=json` output.
|
|
4
4
|
* Each line is a JSON object with a "reason" field.
|
|
5
|
-
* We care about reason="compiler-message" entries.
|
|
5
|
+
* We care about reason="compiler-message" entries and the "build-finished" event.
|
|
6
|
+
* Gap #89: Uses build-finished event's success field as authoritative success indicator.
|
|
6
7
|
*/
|
|
7
8
|
export declare function parseCargoBuildJson(stdout: string, exitCode: number): CargoBuildResult;
|
|
8
9
|
/**
|
|
9
10
|
* Parses `cargo test` output.
|
|
10
11
|
* Format: "test name ... ok/FAILED/ignored"
|
|
11
12
|
* Summary: "test result: ok/FAILED. X passed; Y failed; Z ignored"
|
|
13
|
+
*
|
|
14
|
+
* For failed tests, captures stdout/stderr output between the "failures:" section
|
|
15
|
+
* and the "failures:" name list or "test result:" line.
|
|
16
|
+
*
|
|
17
|
+
* Gap #95: Also parses JSON message format output for compilation diagnostics.
|
|
12
18
|
*/
|
|
13
|
-
export declare function parseCargoTestOutput(stdout: string, exitCode: number): CargoTestResult;
|
|
19
|
+
export declare function parseCargoTestOutput(stdout: string, exitCode: number, jsonOutput?: string): CargoTestResult;
|
|
14
20
|
/**
|
|
15
21
|
* Parses `cargo clippy --message-format=json` output.
|
|
16
|
-
* Same JSON format as cargo build.
|
|
22
|
+
* Same JSON format as cargo build. Now includes success field.
|
|
23
|
+
* Gap #90: Captures suggestion text from JSON children.
|
|
17
24
|
*/
|
|
18
|
-
export declare function parseCargoClippyJson(stdout: string): CargoClippyResult;
|
|
25
|
+
export declare function parseCargoClippyJson(stdout: string, exitCode: number): CargoClippyResult;
|
|
19
26
|
/**
|
|
20
27
|
* Parses `cargo run` output.
|
|
21
28
|
* Returns exit code, stdout, stderr, and success flag.
|
|
29
|
+
* Optionally truncates stdout/stderr to maxOutputSize bytes.
|
|
30
|
+
* Gap #94: Distinguishes compilation vs runtime vs timeout failure.
|
|
22
31
|
*/
|
|
23
|
-
export declare function parseCargoRunOutput(stdout: string, stderr: string, exitCode: number): CargoRunResult;
|
|
32
|
+
export declare function parseCargoRunOutput(stdout: string, stderr: string, exitCode: number, maxOutputSize?: number, timedOut?: boolean): CargoRunResult;
|
|
24
33
|
/**
|
|
25
|
-
*
|
|
34
|
+
* Detects whether a cargo run failure is a compilation error, runtime error, or timeout.
|
|
35
|
+
* Gap #94: Compilation errors have specific patterns from rustc.
|
|
36
|
+
*/
|
|
37
|
+
export declare function detectRunFailureType(stderr: string, exitCode: number, timedOut?: boolean): "compilation" | "runtime" | "timeout";
|
|
38
|
+
/**
|
|
39
|
+
* Parses `cargo add` output (including `--dry-run` mode).
|
|
26
40
|
* Lines like: " Adding serde v1.0.217 to dependencies"
|
|
27
41
|
* Also handles: " Adding serde v1.0.217 to dev-dependencies"
|
|
42
|
+
* Dry-run mode outputs the same Adding lines followed by:
|
|
43
|
+
* "warning: aborting add due to dry run"
|
|
44
|
+
* On failure, captures the error message.
|
|
45
|
+
*
|
|
46
|
+
* Gap #86: Accepts dependency type flags to include in output.
|
|
28
47
|
*/
|
|
29
|
-
export declare function parseCargoAddOutput(stdout: string, stderr: string, exitCode: number): CargoAddResult;
|
|
48
|
+
export declare function parseCargoAddOutput(stdout: string, stderr: string, exitCode: number, depType?: "normal" | "dev" | "build"): CargoAddResult;
|
|
30
49
|
/**
|
|
31
50
|
* Parses `cargo remove` output.
|
|
32
51
|
* Lines like: " Removing serde from dependencies"
|
|
52
|
+
* On failure, captures the error message.
|
|
53
|
+
*
|
|
54
|
+
* Gap #93: Accepts dependency type flags to include in output.
|
|
33
55
|
*/
|
|
34
|
-
export declare function parseCargoRemoveOutput(stdout: string, stderr: string, exitCode: number): CargoRemoveResult;
|
|
56
|
+
export declare function parseCargoRemoveOutput(stdout: string, stderr: string, exitCode: number, depType?: "normal" | "dev" | "build"): CargoRemoveResult;
|
|
35
57
|
/**
|
|
36
|
-
* Parses `cargo fmt
|
|
37
|
-
*
|
|
38
|
-
*
|
|
58
|
+
* Parses `cargo fmt` output in both check and fix (non-check) modes.
|
|
59
|
+
*
|
|
60
|
+
* Check mode: Gap #92 - uses --files-with-diff for more reliable file detection.
|
|
61
|
+
* Fix mode: parses file paths from `-- -l` (--files-with-diff) output, which lists
|
|
62
|
+
* files that were actually reformatted, one path per line on stdout.
|
|
39
63
|
*/
|
|
40
64
|
export declare function parseCargoFmtOutput(stdout: string, stderr: string, exitCode: number, checkMode: boolean): CargoFmtResult;
|
|
41
65
|
/**
|
|
42
66
|
* Parses `cargo doc` output.
|
|
43
67
|
* Counts "warning:" or "warning[" lines from stderr,
|
|
44
68
|
* excluding the summary line "warning: N warnings emitted".
|
|
69
|
+
* Parses structured warning details with file location and message.
|
|
70
|
+
* Optionally extracts the output directory path.
|
|
45
71
|
*/
|
|
46
|
-
export declare function parseCargoDocOutput(stderr: string, exitCode: number): CargoDocResult;
|
|
72
|
+
export declare function parseCargoDocOutput(stderr: string, exitCode: number, cwd?: string): CargoDocResult;
|
|
47
73
|
/**
|
|
48
74
|
* Parses `cargo update` output.
|
|
49
|
-
* Returns success flag and combined output text.
|
|
75
|
+
* Returns success flag, parsed updated packages, and combined output text.
|
|
76
|
+
*
|
|
77
|
+
* Cargo update outputs lines like:
|
|
78
|
+
* " Updating serde v1.0.200 -> v1.0.217"
|
|
79
|
+
* " Updating crates.io index"
|
|
80
|
+
* " Adding new-crate v1.0.0"
|
|
81
|
+
* " Removing old-crate v0.5.0"
|
|
82
|
+
* " Downgrading foo v2.0.0 -> v1.5.0"
|
|
83
|
+
* " Locking serde v1.0.200 -> v1.0.217" (newer cargo versions)
|
|
84
|
+
*
|
|
85
|
+
* Gap #96: Compact mode now includes updateCount instead of dropping all data.
|
|
50
86
|
*/
|
|
51
87
|
export declare function parseCargoUpdateOutput(stdout: string, stderr: string, exitCode: number): CargoUpdateResult;
|
|
52
88
|
/**
|
|
53
|
-
* Parses `cargo tree` output.
|
|
54
|
-
* Returns the full tree text
|
|
89
|
+
* Parses `cargo tree` output into structured dependency data.
|
|
90
|
+
* Returns the full tree text, a flat list of dependencies with depth,
|
|
91
|
+
* counts unique package names, and success flag.
|
|
92
|
+
*
|
|
93
|
+
* Tree lines use ASCII art prefixes to indicate depth:
|
|
94
|
+
* "my-app v0.1.0 (/path/to/project)" -> depth 0
|
|
95
|
+
* "├── serde v1.0.217" -> depth 1
|
|
96
|
+
* "│ └── serde_derive v1.0.217" -> depth 2
|
|
97
|
+
* "└── anyhow v1.0.89" -> depth 1
|
|
98
|
+
*/
|
|
99
|
+
export declare function parseCargoTreeOutput(stdout: string, stderr: string, exitCode: number): CargoTreeResult;
|
|
100
|
+
/**
|
|
101
|
+
* Converts a CVSS score (numeric string or v2/v3/v4 vector string) to a severity label.
|
|
102
|
+
* See https://www.first.org/cvss/specification-document#Qualitative-Severity-Rating-Scale
|
|
103
|
+
*
|
|
104
|
+
* Supports:
|
|
105
|
+
* - Plain numeric scores: "9.8", "5.5", "0.0"
|
|
106
|
+
* - CVSS v3.x vector strings: "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
|
|
107
|
+
* - CVSS v2 vector strings: "(AV:N/AC:L/Au:N/C:C/I:C/A:C)"
|
|
108
|
+
*/
|
|
109
|
+
export declare function cvssToSeverity(cvss: string | null | undefined): "critical" | "high" | "medium" | "low" | "informational" | "unknown";
|
|
110
|
+
/**
|
|
111
|
+
* Extracts a numeric CVSS score from a CVSS string.
|
|
112
|
+
* Gap #88: Used to populate cvssScore field in audit output.
|
|
55
113
|
*/
|
|
56
|
-
export declare function
|
|
114
|
+
export declare function extractCvssScore(cvss: string | null | undefined): number | undefined;
|
|
57
115
|
/**
|
|
58
116
|
* Parses `cargo audit --json` output.
|
|
59
|
-
* Returns structured vulnerability data with severity summary.
|
|
117
|
+
* Returns structured vulnerability data with severity summary and success flag.
|
|
118
|
+
* Gap #87: Supports cargo audit fix with fixesApplied count.
|
|
119
|
+
* Gap #88: Includes raw CVSS score and vector string.
|
|
60
120
|
*/
|
|
61
|
-
export declare function parseCargoAuditJson(jsonStr: string): CargoAuditResult;
|
|
121
|
+
export declare function parseCargoAuditJson(jsonStr: string, exitCode: number, fixMode?: boolean): CargoAuditResult;
|
|
62
122
|
//# sourceMappingURL=parsers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parsers.d.ts","sourceRoot":"","sources":["../../src/lib/parsers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EACjB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"parsers.d.ts","sourceRoot":"","sources":["../../src/lib/parsers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EACjB,MAAM,qBAAqB,CAAC;AAc7B;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CAgBtF;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE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