@paretools/cargo 0.8.5 → 0.10.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.
Files changed (56) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/lib/cargo-runner.d.ts +1 -1
  5. package/dist/lib/cargo-runner.d.ts.map +1 -1
  6. package/dist/lib/cargo-runner.js +2 -2
  7. package/dist/lib/cargo-runner.js.map +1 -1
  8. package/dist/lib/formatters.d.ts +32 -7
  9. package/dist/lib/formatters.d.ts.map +1 -1
  10. package/dist/lib/formatters.js +192 -45
  11. package/dist/lib/formatters.js.map +1 -1
  12. package/dist/lib/parsers.d.ts +84 -20
  13. package/dist/lib/parsers.d.ts.map +1 -1
  14. package/dist/lib/parsers.js +758 -70
  15. package/dist/lib/parsers.js.map +1 -1
  16. package/dist/schemas/index.d.ts +147 -9
  17. package/dist/schemas/index.d.ts.map +1 -1
  18. package/dist/schemas/index.js +123 -11
  19. package/dist/schemas/index.js.map +1 -1
  20. package/dist/tools/add.d.ts.map +1 -1
  21. package/dist/tools/add.js +123 -16
  22. package/dist/tools/add.js.map +1 -1
  23. package/dist/tools/audit.d.ts.map +1 -1
  24. package/dist/tools/audit.js +102 -10
  25. package/dist/tools/audit.js.map +1 -1
  26. package/dist/tools/build.d.ts.map +1 -1
  27. package/dist/tools/build.js +101 -12
  28. package/dist/tools/build.js.map +1 -1
  29. package/dist/tools/check.d.ts.map +1 -1
  30. package/dist/tools/check.js +90 -15
  31. package/dist/tools/check.js.map +1 -1
  32. package/dist/tools/clippy.d.ts.map +1 -1
  33. package/dist/tools/clippy.js +138 -10
  34. package/dist/tools/clippy.js.map +1 -1
  35. package/dist/tools/doc.d.ts.map +1 -1
  36. package/dist/tools/doc.js +84 -14
  37. package/dist/tools/doc.js.map +1 -1
  38. package/dist/tools/fmt.d.ts.map +1 -1
  39. package/dist/tools/fmt.js +74 -11
  40. package/dist/tools/fmt.js.map +1 -1
  41. package/dist/tools/remove.d.ts.map +1 -1
  42. package/dist/tools/remove.js +60 -13
  43. package/dist/tools/remove.js.map +1 -1
  44. package/dist/tools/run.d.ts.map +1 -1
  45. package/dist/tools/run.js +104 -16
  46. package/dist/tools/run.js.map +1 -1
  47. package/dist/tools/test.d.ts.map +1 -1
  48. package/dist/tools/test.js +109 -12
  49. package/dist/tools/test.js.map +1 -1
  50. package/dist/tools/tree.d.ts.map +1 -1
  51. package/dist/tools/tree.js +120 -19
  52. package/dist/tools/tree.js.map +1 -1
  53. package/dist/tools/update.d.ts.map +1 -1
  54. package/dist/tools/update.js +65 -15
  55. package/dist/tools/update.js.map +1 -1
  56. package/package.json +2 -2
package/README.md CHANGED
@@ -57,7 +57,7 @@ Add to your MCP client config:
57
57
  }
58
58
  ```
59
59
 
60
- ## All Pare Servers (147 tools)
60
+ ## All Pare Servers (149 tools)
61
61
 
62
62
  | Package | Tools | Wraps |
63
63
  | -------------------------------------------------------------------- | --------------------------------------------------------------------------- | ---------------------------------- |
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
4
  import { registerAllTools } from "./tools/index.js";
5
5
  const server = new McpServer({ name: "@paretools/cargo", version: "0.8.1" }, {
6
- instructions: "Structured Rust/Cargo operations (build, test, clippy, run, add, remove, fmt, doc, check). Use instead of running cargo commands via bash. Returns typed JSON with structured compiler errors, test results, lint warnings, and dependency management output.",
6
+ instructions: "Structured Rust/Cargo operations (build, test, clippy, run, add, remove, fmt, doc, check). Returns typed JSON with structured compiler errors, test results, lint warnings, and dependency management output.",
7
7
  });
8
8
  registerAllTools(server);
9
9
  const transport = new StdioServerTransport();
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,MAAM,GAAG,IAAI,SAAS,CAC1B,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,OAAO,EAAE,EAC9C;IACE,YAAY,EACV,+PAA+P;CAClQ,CACF,CAAC;AAEF,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAEzB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,MAAM,GAAG,IAAI,SAAS,CAC1B,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,OAAO,EAAE,EAC9C;IACE,YAAY,EACV,+MAA+M;CAClN,CACF,CAAC;AAEF,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAEzB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import { type RunResult } from "@paretools/shared";
2
- export declare function cargo(args: string[], cwd?: string): Promise<RunResult>;
2
+ export declare function cargo(args: string[], cwd?: string, timeout?: number): Promise<RunResult>;
3
3
  //# sourceMappingURL=cargo-runner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cargo-runner.d.ts","sourceRoot":"","sources":["../../src/lib/cargo-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAExD,wBAAsB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAG5E"}
1
+ {"version":3,"file":"cargo-runner.d.ts","sourceRoot":"","sources":["../../src/lib/cargo-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAExD,wBAAsB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAG9F"}
@@ -1,6 +1,6 @@
1
1
  import { run } from "@paretools/shared";
2
- export async function cargo(args, cwd) {
2
+ export async function cargo(args, cwd, timeout) {
3
3
  // cargo build/test can take minutes for large projects
4
- return run("cargo", args, { cwd, timeout: 300_000 });
4
+ return run("cargo", args, { cwd, timeout: timeout ?? 300_000 });
5
5
  }
6
6
  //# sourceMappingURL=cargo-runner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cargo-runner.js","sourceRoot":"","sources":["../../src/lib/cargo-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAkB,MAAM,mBAAmB,CAAC;AAExD,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,IAAc,EAAE,GAAY;IACtD,uDAAuD;IACvD,OAAO,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;AACvD,CAAC"}
1
+ {"version":3,"file":"cargo-runner.js","sourceRoot":"","sources":["../../src/lib/cargo-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAkB,MAAM,mBAAmB,CAAC;AAExD,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,IAAc,EAAE,GAAY,EAAE,OAAgB;IACxE,uDAAuD;IACvD,OAAO,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,CAAC,CAAC;AAClE,CAAC"}
@@ -3,23 +3,29 @@ import type { CargoBuildResult, CargoTestResult, CargoClippyResult, CargoRunResu
3
3
  export interface CargoBuildCompact {
4
4
  [key: string]: unknown;
5
5
  success: boolean;
6
+ mode?: string;
6
7
  diagnostics?: CargoBuildResult["diagnostics"];
7
8
  errors: number;
8
9
  warnings: number;
9
10
  total: number;
11
+ timings?: CargoBuildResult["timings"];
10
12
  }
11
- /** Compact test: summary counts only, no individual test entries. */
13
+ /** Compact test: summary counts with failed test entries preserved for diagnostics. */
12
14
  export interface CargoTestCompact {
13
15
  [key: string]: unknown;
14
16
  success: boolean;
17
+ tests: CargoTestResult["tests"];
15
18
  total: number;
16
19
  passed: number;
17
20
  failed: number;
18
21
  ignored: number;
22
+ duration?: string;
23
+ compilationDiagnostics?: CargoTestResult["compilationDiagnostics"];
19
24
  }
20
- /** Compact clippy: counts per severity, with diagnostics preserved when non-empty. */
25
+ /** Compact clippy: success + counts per severity, with diagnostics preserved when non-empty. */
21
26
  export interface CargoClippyCompact {
22
27
  [key: string]: unknown;
28
+ success: boolean;
23
29
  diagnostics?: CargoClippyResult["diagnostics"];
24
30
  errors: number;
25
31
  warnings: number;
@@ -30,6 +36,8 @@ export interface CargoRunCompact {
30
36
  [key: string]: unknown;
31
37
  exitCode: number;
32
38
  success: boolean;
39
+ signal?: string;
40
+ failureType?: "compilation" | "runtime" | "timeout";
33
41
  }
34
42
  /** Compact add: success + package names only, no version details. */
35
43
  export interface CargoAddCompact {
@@ -37,6 +45,9 @@ export interface CargoAddCompact {
37
45
  success: boolean;
38
46
  packages: string[];
39
47
  total: number;
48
+ dependencyType?: "normal" | "dev" | "build";
49
+ dryRun?: boolean;
50
+ error?: string;
40
51
  }
41
52
  /** Compact remove: success + package names. */
42
53
  export interface CargoRemoveCompact {
@@ -44,18 +55,24 @@ export interface CargoRemoveCompact {
44
55
  success: boolean;
45
56
  removed: string[];
46
57
  total: number;
58
+ partialSuccess?: boolean;
59
+ failedPackages?: string[];
60
+ dependencyType?: "normal" | "dev" | "build";
61
+ error?: string;
47
62
  }
48
- /** Compact fmt: success + file count only. */
63
+ /** Compact fmt: success + needsFormatting + file count only. */
49
64
  export interface CargoFmtCompact {
50
65
  [key: string]: unknown;
51
66
  success: boolean;
67
+ needsFormatting: boolean;
52
68
  filesChanged: number;
53
69
  }
54
- /** Compact doc: success + warning count. */
70
+ /** Compact doc: success + warning count + optional warning details. */
55
71
  export interface CargoDocCompact {
56
72
  [key: string]: unknown;
57
73
  success: boolean;
58
74
  warnings: number;
75
+ warningDetails?: CargoDocResult["warningDetails"];
59
76
  }
60
77
  /** Formats structured cargo build results into a human-readable diagnostic summary. */
61
78
  export declare function formatCargoBuild(data: CargoBuildResult): string;
@@ -91,32 +108,40 @@ export declare function formatFmtCompact(data: CargoFmtCompact): string;
91
108
  export declare function formatDocCompact(data: CargoDocCompact): string;
92
109
  /** Formats structured cargo update output into a human-readable summary. */
93
110
  export declare function formatCargoUpdate(data: CargoUpdateResult): string;
94
- /** Compact update: success flag only, no output text. */
111
+ /** Compact update: success flag + updated packages, no raw output text. Gap #96: always includes updateCount. */
95
112
  export interface CargoUpdateCompact {
96
113
  [key: string]: unknown;
97
114
  success: boolean;
115
+ updated: CargoUpdateResult["updated"];
116
+ totalUpdated: number;
98
117
  }
99
118
  export declare function compactUpdateMap(data: CargoUpdateResult): CargoUpdateCompact;
100
119
  export declare function formatUpdateCompact(data: CargoUpdateCompact): string;
101
120
  /** Formats structured cargo tree output into a human-readable summary. */
102
121
  export declare function formatCargoTree(data: CargoTreeResult): string;
103
- /** Compact tree: package count only, no full tree text. */
122
+ /** Compact tree: success + dependencies + package count, no full tree text. */
104
123
  export interface CargoTreeCompact {
105
124
  [key: string]: unknown;
125
+ success: boolean;
126
+ dependencies: CargoTreeResult["dependencies"];
106
127
  packages: number;
107
128
  }
108
129
  export declare function compactTreeMap(data: CargoTreeResult): CargoTreeCompact;
109
130
  export declare function formatTreeCompact(data: CargoTreeCompact): string;
110
131
  /** Formats structured cargo audit output into a human-readable vulnerability report. */
111
132
  export declare function formatCargoAudit(data: CargoAuditResult): string;
112
- /** Compact audit: summary counts only, no individual vulnerabilities. */
133
+ /** Compact audit: success + summary counts only, no individual vulnerabilities. */
113
134
  export interface CargoAuditCompact {
114
135
  [key: string]: unknown;
136
+ success: boolean;
115
137
  total: number;
116
138
  critical: number;
117
139
  high: number;
118
140
  medium: number;
119
141
  low: number;
142
+ informational: number;
143
+ unknown: number;
144
+ fixesApplied?: number;
120
145
  }
121
146
  export declare function compactAuditMap(data: CargoAuditResult): CargoAuditCompact;
122
147
  export declare function formatAuditCompact(data: CargoAuditCompact): string;
@@ -1 +1 @@
1
- {"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../src/lib/formatters.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;AAI7B,wFAAwF;AACxF,MAAM,WAAW,iBAAiB;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,qEAAqE;AACrE,MAAM,WAAW,gBAAgB;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MA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kBAAkB,CAM5E;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,CAKpE;AAID,0EAA0E;AAC1E,wBAAgB,eAAe,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAO7D;AAED,+EAA+E;AAC/E,MAAM,WAAW,gBAAgB;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,eAAe,CAAC,cAAc,CAAC,CAAC;IAC9C,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,eAAe,GAAG,gBAAgB,CAMtE;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAGhE;AAID,wFAAwF;AACxF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAyB/D;AAED,mFAAmF;AACnF,MAAM,WAAW,iBAAiB;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,gBAAgB,GAAG,iBAAiB,CAyBzE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAKlE"}
@@ -7,17 +7,44 @@ export function formatCargoBuild(data) {
7
7
  for (const d of data.diagnostics ?? []) {
8
8
  const code = d.code ? ` [${d.code}]` : "";
9
9
  lines.push(` ${d.file}:${d.line}:${d.column} ${d.severity}${code}: ${d.message}`);
10
+ if (d.suggestion) {
11
+ lines.push(` suggestion: ${d.suggestion}`);
12
+ }
13
+ }
14
+ if (data.timings?.generated) {
15
+ const timingParts = ["timings generated"];
16
+ if (data.timings.format)
17
+ timingParts.push(`format=${data.timings.format}`);
18
+ if (data.timings.reportPath)
19
+ timingParts.push(`report=${data.timings.reportPath}`);
20
+ lines.push(` ${timingParts.join(", ")}`);
10
21
  }
11
22
  return lines.join("\n");
12
23
  }
13
24
  /** Formats structured cargo test results into a human-readable test summary with pass/fail status. */
14
25
  export function formatCargoTest(data) {
15
26
  const status = data.success ? "ok" : "FAILED";
27
+ const durationSuffix = data.duration ? `; finished in ${data.duration}` : "";
16
28
  const lines = [
17
- `test result: ${status}. ${data.passed} passed; ${data.failed} failed; ${data.ignored} ignored`,
29
+ `test result: ${status}. ${data.passed} passed; ${data.failed} failed; ${data.ignored} ignored${durationSuffix}`,
18
30
  ];
19
31
  for (const t of data.tests ?? []) {
20
- lines.push(` ${t.status.padEnd(7)} ${t.name}`);
32
+ const perTestDuration = t.duration ? ` (${t.duration})` : "";
33
+ lines.push(` ${t.status.padEnd(7)} ${t.name}${perTestDuration}`);
34
+ if (t.output) {
35
+ // Indent failure output under the test entry
36
+ for (const outputLine of t.output.split("\n")) {
37
+ lines.push(` ${outputLine}`);
38
+ }
39
+ }
40
+ }
41
+ // Gap #95: Show compilation diagnostics when available
42
+ if (data.compilationDiagnostics && data.compilationDiagnostics.length > 0) {
43
+ lines.push(`\nCompilation diagnostics (${data.compilationDiagnostics.length}):`);
44
+ for (const d of data.compilationDiagnostics) {
45
+ const code = d.code ? ` [${d.code}]` : "";
46
+ lines.push(` ${d.file}:${d.line}:${d.column} ${d.severity}${code}: ${d.message}`);
47
+ }
21
48
  }
22
49
  return lines.join("\n");
23
50
  }
@@ -29,26 +56,39 @@ export function formatCargoClippy(data) {
29
56
  for (const d of data.diagnostics ?? []) {
30
57
  const code = d.code ? ` [${d.code}]` : "";
31
58
  lines.push(` ${d.file}:${d.line}:${d.column} ${d.severity}${code}: ${d.message}`);
59
+ if (d.suggestion) {
60
+ lines.push(` suggestion: ${d.suggestion}`);
61
+ }
32
62
  }
33
63
  return lines.join("\n");
34
64
  }
35
65
  /** Formats structured cargo run output into a human-readable summary. */
36
66
  export function formatCargoRun(data) {
37
67
  const status = data.success ? "success" : "failed";
38
- const lines = [`cargo run: ${status} (exit code ${data.exitCode})`];
39
- if (data.stdout)
40
- lines.push(`stdout:\n${data.stdout}`);
41
- if (data.stderr)
42
- lines.push(`stderr:\n${data.stderr}`);
68
+ const failType = data.failureType ? ` [${data.failureType}]` : "";
69
+ const signalSuffix = data.signal ? ` signal=${data.signal}` : "";
70
+ const lines = [`cargo run: ${status}${failType} (exit code ${data.exitCode}${signalSuffix})`];
71
+ if (data.stdout) {
72
+ const truncNote = data.stdoutTruncated ? " [truncated]" : "";
73
+ lines.push(`stdout${truncNote}:\n${data.stdout}`);
74
+ }
75
+ if (data.stderr) {
76
+ const truncNote = data.stderrTruncated ? " [truncated]" : "";
77
+ lines.push(`stderr${truncNote}:\n${data.stderr}`);
78
+ }
43
79
  return lines.join("\n");
44
80
  }
45
81
  /** Formats structured cargo add output into a human-readable summary. */
46
82
  export function formatCargoAdd(data) {
47
- if (!data.success)
48
- return "cargo add: failed";
83
+ if (!data.success) {
84
+ const err = data.error ? `: ${data.error}` : "";
85
+ return `cargo add: failed${err}`;
86
+ }
87
+ const dryRunSuffix = data.dryRun ? " (dry-run)" : "";
88
+ const depTypeSuffix = data.dependencyType && data.dependencyType !== "normal" ? ` [${data.dependencyType}]` : "";
49
89
  if (data.total === 0)
50
- return "cargo add: success, no packages added.";
51
- const lines = [`cargo add: ${data.total} package(s) added`];
90
+ return `cargo add: success, no packages added.${dryRunSuffix ? ` ${dryRunSuffix.trim()}` : ""}`;
91
+ const lines = [`cargo add: ${data.total} package(s) added${depTypeSuffix}${dryRunSuffix}`];
52
92
  for (const pkg of data.added ?? []) {
53
93
  lines.push(` ${pkg.name} v${pkg.version}`);
54
94
  }
@@ -56,11 +96,18 @@ export function formatCargoAdd(data) {
56
96
  }
57
97
  /** Formats structured cargo remove output into a human-readable summary. */
58
98
  export function formatCargoRemove(data) {
59
- if (!data.success)
60
- return "cargo remove: failed";
99
+ if (!data.success) {
100
+ const err = data.error ? `: ${data.error}` : "";
101
+ const partial = data.partialSuccess ? " (partial)" : "";
102
+ const failedPkgs = data.failedPackages && data.failedPackages.length > 0
103
+ ? `; failed packages: ${data.failedPackages.join(", ")}`
104
+ : "";
105
+ return `cargo remove: failed${partial}${err}${failedPkgs}`;
106
+ }
107
+ const depTypeSuffix = data.dependencyType && data.dependencyType !== "normal" ? ` [${data.dependencyType}]` : "";
61
108
  if (data.total === 0)
62
109
  return "cargo remove: success, no packages removed.";
63
- const lines = [`cargo remove: ${data.total} package(s) removed`];
110
+ const lines = [`cargo remove: ${data.total} package(s) removed${depTypeSuffix}`];
64
111
  for (const name of data.removed) {
65
112
  lines.push(` ${name}`);
66
113
  }
@@ -70,7 +117,7 @@ export function formatCargoRemove(data) {
70
117
  export function formatCargoFmt(data) {
71
118
  if (data.success && data.filesChanged === 0)
72
119
  return "cargo fmt: all files formatted.";
73
- const status = data.success ? "success" : "needs formatting";
120
+ const status = data.needsFormatting ? "needs formatting" : data.success ? "success" : "failed";
74
121
  const lines = [`cargo fmt: ${status} (${data.filesChanged} file(s))`];
75
122
  for (const f of data.files ?? []) {
76
123
  lines.push(` ${f}`);
@@ -80,9 +127,19 @@ export function formatCargoFmt(data) {
80
127
  /** Formats structured cargo doc output into a human-readable summary. */
81
128
  export function formatCargoDoc(data) {
82
129
  const status = data.success ? "success" : "failed";
83
- if (data.warnings === 0)
84
- return `cargo doc: ${status}.`;
85
- return `cargo doc: ${status} (${data.warnings} warning(s))`;
130
+ const parts = [`cargo doc: ${status}`];
131
+ if (data.warnings > 0)
132
+ parts.push(`(${data.warnings} warning(s))`);
133
+ if (data.outputDir)
134
+ parts.push(`-> ${data.outputDir}`);
135
+ if (data.warnings === 0 && !data.outputDir)
136
+ return `${parts[0]}.`;
137
+ const lines = [parts.join(" ")];
138
+ for (const w of data.warningDetails ?? []) {
139
+ const loc = w.file ? `${w.file}:${w.line}` : "";
140
+ lines.push(` ${loc ? `${loc} ` : ""}warning: ${w.message}`);
141
+ }
142
+ return lines.join("\n");
86
143
  }
87
144
  // ── Compact mappers ──────────────────────────────────────────────────
88
145
  export function compactBuildMap(data) {
@@ -92,22 +149,36 @@ export function compactBuildMap(data) {
92
149
  warnings: data.warnings,
93
150
  total: data.total,
94
151
  };
152
+ if ("mode" in data && data.mode)
153
+ compact.mode = data.mode;
95
154
  if (data.diagnostics?.length)
96
155
  compact.diagnostics = data.diagnostics;
156
+ if (data.timings)
157
+ compact.timings = data.timings;
97
158
  return compact;
98
159
  }
99
160
  export function compactTestMap(data) {
100
- return {
161
+ // In compact mode, only keep failed tests (with their output) for diagnostics
162
+ const failedTests = (data.tests ?? []).filter((t) => t.status === "FAILED");
163
+ const compact = {
101
164
  success: data.success,
102
- tests: [],
165
+ tests: failedTests.length > 0 ? failedTests : [],
103
166
  total: data.total,
104
167
  passed: data.passed,
105
168
  failed: data.failed,
106
169
  ignored: data.ignored,
107
170
  };
171
+ if (data.duration)
172
+ compact.duration = data.duration;
173
+ // Gap #95: Preserve compilation diagnostics in compact mode
174
+ if (data.compilationDiagnostics?.length) {
175
+ compact.compilationDiagnostics = data.compilationDiagnostics;
176
+ }
177
+ return compact;
108
178
  }
109
179
  export function compactClippyMap(data) {
110
180
  const compact = {
181
+ success: data.success,
111
182
  errors: data.errors,
112
183
  warnings: data.warnings,
113
184
  total: data.total,
@@ -117,45 +188,72 @@ export function compactClippyMap(data) {
117
188
  return compact;
118
189
  }
119
190
  export function compactRunMap(data) {
120
- return {
191
+ const compact = {
121
192
  exitCode: data.exitCode,
122
193
  success: data.success,
123
194
  };
195
+ if (data.failureType)
196
+ compact.failureType = data.failureType;
197
+ if (data.signal)
198
+ compact.signal = data.signal;
199
+ return compact;
124
200
  }
125
201
  export function compactAddMap(data) {
126
- return {
202
+ const compact = {
127
203
  success: data.success,
128
204
  packages: (data.added ?? []).map((p) => p.name),
129
205
  total: data.total,
130
206
  };
207
+ if (data.dependencyType)
208
+ compact.dependencyType = data.dependencyType;
209
+ if (data.dryRun)
210
+ compact.dryRun = true;
211
+ if (data.error)
212
+ compact.error = data.error;
213
+ return compact;
131
214
  }
132
215
  export function compactRemoveMap(data) {
133
- return {
216
+ const compact = {
134
217
  success: data.success,
135
218
  removed: data.removed,
136
219
  total: data.total,
137
220
  };
221
+ if (data.partialSuccess)
222
+ compact.partialSuccess = true;
223
+ if (data.failedPackages?.length)
224
+ compact.failedPackages = data.failedPackages;
225
+ if (data.dependencyType)
226
+ compact.dependencyType = data.dependencyType;
227
+ if (data.error)
228
+ compact.error = data.error;
229
+ return compact;
138
230
  }
139
231
  export function compactFmtMap(data) {
140
232
  return {
141
233
  success: data.success,
234
+ needsFormatting: data.needsFormatting,
142
235
  filesChanged: data.filesChanged,
143
236
  };
144
237
  }
145
238
  export function compactDocMap(data) {
146
- return {
239
+ const compact = {
147
240
  success: data.success,
148
241
  warnings: data.warnings,
149
242
  };
243
+ if (data.warningDetails?.length)
244
+ compact.warningDetails = data.warningDetails;
245
+ return compact;
150
246
  }
151
247
  // ── Compact formatters ───────────────────────────────────────────────
152
248
  export function formatBuildCompact(data) {
153
249
  const status = data.success ? "success" : "failed";
154
- return `cargo build: ${status} (${data.errors} errors, ${data.warnings} warnings)`;
250
+ const timingSuffix = data.timings?.generated ? " [timings]" : "";
251
+ return `cargo build: ${status} (${data.errors} errors, ${data.warnings} warnings)${timingSuffix}`;
155
252
  }
156
253
  export function formatTestCompact(data) {
157
254
  const status = data.success ? "ok" : "FAILED";
158
- return `test result: ${status}. ${data.passed} passed; ${data.failed} failed; ${data.ignored} ignored`;
255
+ const durationSuffix = data.duration ? `; finished in ${data.duration}` : "";
256
+ return `test result: ${status}. ${data.passed} passed; ${data.failed} failed; ${data.ignored} ignored${durationSuffix}`;
159
257
  }
160
258
  export function formatClippyCompact(data) {
161
259
  if (data.total === 0)
@@ -164,18 +262,25 @@ export function formatClippyCompact(data) {
164
262
  }
165
263
  export function formatRunCompact(data) {
166
264
  const status = data.success ? "success" : "failed";
167
- return `cargo run: ${status} (exit code ${data.exitCode})`;
265
+ const failType = data.failureType ? ` [${data.failureType}]` : "";
266
+ const signalSuffix = data.signal ? ` signal=${data.signal}` : "";
267
+ return `cargo run: ${status}${failType} (exit code ${data.exitCode}${signalSuffix})`;
168
268
  }
169
269
  export function formatAddCompact(data) {
170
- if (!data.success)
171
- return "cargo add: failed";
270
+ if (!data.success) {
271
+ const err = data.error ? `: ${data.error}` : "";
272
+ return `cargo add: failed${err}`;
273
+ }
274
+ const dryRunSuffix = data.dryRun ? " (dry-run)" : "";
172
275
  if (data.total === 0)
173
- return "cargo add: success, no packages added.";
174
- return `cargo add: ${data.total} package(s) added: ${data.packages.join(", ")}`;
276
+ return `cargo add: success, no packages added.${dryRunSuffix ? ` ${dryRunSuffix.trim()}` : ""}`;
277
+ return `cargo add: ${data.total} package(s) added${dryRunSuffix}: ${data.packages.join(", ")}`;
175
278
  }
176
279
  export function formatRemoveCompact(data) {
177
- if (!data.success)
178
- return "cargo remove: failed";
280
+ if (!data.success) {
281
+ const err = data.error ? `: ${data.error}` : "";
282
+ return `cargo remove: failed${err}`;
283
+ }
179
284
  if (data.total === 0)
180
285
  return "cargo remove: success, no packages removed.";
181
286
  return `cargo remove: ${data.total} package(s) removed: ${data.removed.join(", ")}`;
@@ -183,7 +288,7 @@ export function formatRemoveCompact(data) {
183
288
  export function formatFmtCompact(data) {
184
289
  if (data.success && data.filesChanged === 0)
185
290
  return "cargo fmt: all files formatted.";
186
- const status = data.success ? "success" : "needs formatting";
291
+ const status = data.needsFormatting ? "needs formatting" : data.success ? "success" : "failed";
187
292
  return `cargo fmt: ${status} (${data.filesChanged} file(s))`;
188
293
  }
189
294
  export function formatDocCompact(data) {
@@ -196,22 +301,34 @@ export function formatDocCompact(data) {
196
301
  /** Formats structured cargo update output into a human-readable summary. */
197
302
  export function formatCargoUpdate(data) {
198
303
  const status = data.success ? "success" : "failed";
199
- if (!data.output)
304
+ if (data.totalUpdated === 0 && !data.output)
200
305
  return `cargo update: ${status}.`;
201
- return `cargo update: ${status}\n${data.output}`;
306
+ const lines = [`cargo update: ${status} (${data.totalUpdated} package(s) updated)`];
307
+ for (const u of data.updated ?? []) {
308
+ lines.push(` ${u.name} v${u.from} -> v${u.to}`);
309
+ }
310
+ return lines.join("\n");
202
311
  }
203
312
  export function compactUpdateMap(data) {
204
313
  return {
205
314
  success: data.success,
315
+ updated: data.updated,
316
+ totalUpdated: data.totalUpdated,
206
317
  };
207
318
  }
208
319
  export function formatUpdateCompact(data) {
209
320
  const status = data.success ? "success" : "failed";
210
- return `cargo update: ${status}`;
321
+ if (data.totalUpdated === 0)
322
+ return `cargo update: ${status}`;
323
+ const names = (data.updated ?? []).map((u) => u.name).join(", ");
324
+ return `cargo update: ${status} (${data.totalUpdated} updated: ${names})`;
211
325
  }
212
326
  // ── Tree formatters ──────────────────────────────────────────────────
213
327
  /** Formats structured cargo tree output into a human-readable summary. */
214
328
  export function formatCargoTree(data) {
329
+ if (!data.success) {
330
+ return `cargo tree: failed${data.tree ? `\n${data.tree}` : ""}`;
331
+ }
215
332
  const lines = [`cargo tree: ${data.packages} unique packages`];
216
333
  if (data.tree)
217
334
  lines.push(data.tree);
@@ -219,41 +336,71 @@ export function formatCargoTree(data) {
219
336
  }
220
337
  export function compactTreeMap(data) {
221
338
  return {
339
+ success: data.success,
340
+ dependencies: data.dependencies,
222
341
  packages: data.packages,
223
342
  };
224
343
  }
225
344
  export function formatTreeCompact(data) {
345
+ if (!data.success)
346
+ return "cargo tree: failed";
226
347
  return `cargo tree: ${data.packages} unique packages`;
227
348
  }
228
349
  // ── Audit formatters ─────────────────────────────────────────────────
229
350
  /** Formats structured cargo audit output into a human-readable vulnerability report. */
230
351
  export function formatCargoAudit(data) {
231
- const summary = data.summary ?? { total: 0, critical: 0, high: 0, medium: 0, low: 0 };
352
+ const summary = data.summary ?? {
353
+ total: 0,
354
+ critical: 0,
355
+ high: 0,
356
+ medium: 0,
357
+ low: 0,
358
+ informational: 0,
359
+ unknown: 0,
360
+ };
361
+ const fixesSuffix = data.fixesApplied !== undefined ? ` (${data.fixesApplied} fix(es) applied)` : "";
232
362
  if (summary.total === 0)
233
- return "cargo audit: no vulnerabilities found.";
363
+ return `cargo audit: no vulnerabilities found.${fixesSuffix}`;
234
364
  const lines = [
235
- `cargo audit: ${summary.total} vulnerabilities (${summary.critical} critical, ${summary.high} high, ${summary.medium} medium, ${summary.low} low)`,
365
+ `cargo audit: ${summary.total} vulnerabilities (${summary.critical} critical, ${summary.high} high, ${summary.medium} medium, ${summary.low} low)${fixesSuffix}`,
236
366
  ];
237
367
  for (const v of data.vulnerabilities ?? []) {
238
368
  const patched = v.patched.length > 0 ? ` (patched: ${v.patched.join(", ")})` : "";
239
- lines.push(` [${v.severity}] ${v.id} ${v.package}@${v.version}: ${v.title}${patched}`);
369
+ const score = v.cvssScore !== undefined ? ` [CVSS: ${v.cvssScore}]` : "";
370
+ lines.push(` [${v.severity}] ${v.id} ${v.package}@${v.version}: ${v.title}${score}${patched}`);
240
371
  }
241
372
  return lines.join("\n");
242
373
  }
243
374
  export function compactAuditMap(data) {
244
- const summary = data.summary ?? { total: 0, critical: 0, high: 0, medium: 0, low: 0 };
245
- return {
375
+ const summary = data.summary ?? {
376
+ total: 0,
377
+ critical: 0,
378
+ high: 0,
379
+ medium: 0,
380
+ low: 0,
381
+ informational: 0,
382
+ unknown: 0,
383
+ };
384
+ const compact = {
385
+ success: data.success,
246
386
  vulnerabilities: [],
247
387
  total: summary.total,
248
388
  critical: summary.critical,
249
389
  high: summary.high,
250
390
  medium: summary.medium,
251
391
  low: summary.low,
392
+ informational: summary.informational,
393
+ unknown: summary.unknown,
252
394
  };
395
+ if (data.fixesApplied !== undefined) {
396
+ compact.fixesApplied = data.fixesApplied;
397
+ }
398
+ return compact;
253
399
  }
254
400
  export function formatAuditCompact(data) {
401
+ const fixesSuffix = data.fixesApplied !== undefined ? ` (${data.fixesApplied} fix(es) applied)` : "";
255
402
  if (data.total === 0)
256
- return "cargo audit: no vulnerabilities found.";
257
- return `cargo audit: ${data.total} vulnerabilities (${data.critical} critical, ${data.high} high, ${data.medium} medium, ${data.low} low)`;
403
+ return `cargo audit: no vulnerabilities found.${fixesSuffix}`;
404
+ return `cargo audit: ${data.total} vulnerabilities (${data.critical} critical, ${data.high} high, ${data.medium} medium, ${data.low} low)${fixesSuffix}`;
258
405
  }
259
406
  //# sourceMappingURL=formatters.js.map