@paretools/cargo 0.2.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/LICENSE +21 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/cargo-runner.d.ts +3 -0
- package/dist/lib/cargo-runner.d.ts.map +1 -0
- package/dist/lib/cargo-runner.js +5 -0
- package/dist/lib/cargo-runner.js.map +1 -0
- package/dist/lib/formatters.d.ts +5 -0
- package/dist/lib/formatters.d.ts.map +1 -0
- package/dist/lib/formatters.js +32 -0
- package/dist/lib/formatters.js.map +1 -0
- package/dist/lib/parsers.d.ts +19 -0
- package/dist/lib/parsers.d.ts.map +1 -0
- package/dist/lib/parsers.js +92 -0
- package/dist/lib/parsers.js.map +1 -0
- package/dist/schemas/index.d.ts +187 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +39 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/tools/build.d.ts +3 -0
- package/dist/tools/build.d.ts.map +1 -0
- package/dist/tools/build.js +26 -0
- package/dist/tools/build.js.map +1 -0
- package/dist/tools/clippy.d.ts +3 -0
- package/dist/tools/clippy.d.ts.map +1 -0
- package/dist/tools/clippy.js +23 -0
- package/dist/tools/clippy.js.map +1 -0
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +9 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/test.d.ts +3 -0
- package/dist/tools/test.d.ts.map +1 -0
- package/dist/tools/test.js +26 -0
- package/dist/tools/test.js.map +1 -0
- package/package.json +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dave London
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { registerAllTools } from "./tools/index.js";
|
|
5
|
+
const server = new McpServer({
|
|
6
|
+
name: "@paretools/cargo",
|
|
7
|
+
version: "0.1.0",
|
|
8
|
+
});
|
|
9
|
+
registerAllTools(server);
|
|
10
|
+
const transport = new StdioServerTransport();
|
|
11
|
+
await server.connect(transport);
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,CAAC;IAC3B,IAAI,EAAE,kBAAkB;IACxB,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC;AAEH,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAEzB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +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,CAE5E"}
|
|
@@ -0,0 +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,OAAO,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CargoBuildResult, CargoTestResult, CargoClippyResult } from "../schemas/index.js";
|
|
2
|
+
export declare function formatCargoBuild(data: CargoBuildResult): string;
|
|
3
|
+
export declare function formatCargoTest(data: CargoTestResult): string;
|
|
4
|
+
export declare function formatCargoClippy(data: CargoClippyResult): string;
|
|
5
|
+
//# sourceMappingURL=formatters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../src/lib/formatters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEhG,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAU/D;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAS7D;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CASjE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export function formatCargoBuild(data) {
|
|
2
|
+
if (data.success && data.total === 0)
|
|
3
|
+
return "cargo build: success, no diagnostics.";
|
|
4
|
+
const status = data.success ? "success" : "failed";
|
|
5
|
+
const lines = [`cargo build: ${status} (${data.errors} errors, ${data.warnings} warnings)`];
|
|
6
|
+
for (const d of data.diagnostics) {
|
|
7
|
+
const code = d.code ? ` [${d.code}]` : "";
|
|
8
|
+
lines.push(` ${d.file}:${d.line}:${d.column} ${d.severity}${code}: ${d.message}`);
|
|
9
|
+
}
|
|
10
|
+
return lines.join("\n");
|
|
11
|
+
}
|
|
12
|
+
export function formatCargoTest(data) {
|
|
13
|
+
const status = data.success ? "ok" : "FAILED";
|
|
14
|
+
const lines = [
|
|
15
|
+
`test result: ${status}. ${data.passed} passed; ${data.failed} failed; ${data.ignored} ignored`,
|
|
16
|
+
];
|
|
17
|
+
for (const t of data.tests) {
|
|
18
|
+
lines.push(` ${t.status.padEnd(7)} ${t.name}`);
|
|
19
|
+
}
|
|
20
|
+
return lines.join("\n");
|
|
21
|
+
}
|
|
22
|
+
export function formatCargoClippy(data) {
|
|
23
|
+
if (data.total === 0)
|
|
24
|
+
return "clippy: no warnings.";
|
|
25
|
+
const lines = [`clippy: ${data.errors} errors, ${data.warnings} warnings`];
|
|
26
|
+
for (const d of data.diagnostics) {
|
|
27
|
+
const code = d.code ? ` [${d.code}]` : "";
|
|
28
|
+
lines.push(` ${d.file}:${d.line}:${d.column} ${d.severity}${code}: ${d.message}`);
|
|
29
|
+
}
|
|
30
|
+
return lines.join("\n");
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=formatters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/lib/formatters.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,gBAAgB,CAAC,IAAsB;IACrD,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,KAAK,CAAC;QAAE,OAAO,uCAAuC,CAAC;IAErF,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;IACnD,MAAM,KAAK,GAAG,CAAC,gBAAgB,MAAM,KAAK,IAAI,CAAC,MAAM,YAAY,IAAI,CAAC,QAAQ,YAAY,CAAC,CAAC;IAC5F,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1C,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,QAAQ,GAAG,IAAI,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IACrF,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,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1,19 @@
|
|
|
1
|
+
import type { CargoBuildResult, CargoTestResult, CargoClippyResult } from "../schemas/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Parses `cargo build --message-format=json` output.
|
|
4
|
+
* Each line is a JSON object with a "reason" field.
|
|
5
|
+
* We care about reason="compiler-message" entries.
|
|
6
|
+
*/
|
|
7
|
+
export declare function parseCargoBuildJson(stdout: string, exitCode: number): CargoBuildResult;
|
|
8
|
+
/**
|
|
9
|
+
* Parses `cargo test` output.
|
|
10
|
+
* Format: "test name ... ok/FAILED/ignored"
|
|
11
|
+
* Summary: "test result: ok/FAILED. X passed; Y failed; Z ignored"
|
|
12
|
+
*/
|
|
13
|
+
export declare function parseCargoTestOutput(stdout: string, exitCode: number): CargoTestResult;
|
|
14
|
+
/**
|
|
15
|
+
* Parses `cargo clippy --message-format=json` output.
|
|
16
|
+
* Same JSON format as cargo build.
|
|
17
|
+
*/
|
|
18
|
+
export declare function parseCargoClippyJson(stdout: string): CargoClippyResult;
|
|
19
|
+
//# sourceMappingURL=parsers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parsers.d.ts","sourceRoot":"","sources":["../../src/lib/parsers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAYhG;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CAYtF;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,eAAe,CA0BtF;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAWtE"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses `cargo build --message-format=json` output.
|
|
3
|
+
* Each line is a JSON object with a "reason" field.
|
|
4
|
+
* We care about reason="compiler-message" entries.
|
|
5
|
+
*/
|
|
6
|
+
export function parseCargoBuildJson(stdout, exitCode) {
|
|
7
|
+
const diagnostics = parseCompilerMessages(stdout);
|
|
8
|
+
const errors = diagnostics.filter((d) => d.severity === "error").length;
|
|
9
|
+
const warnings = diagnostics.filter((d) => d.severity === "warning").length;
|
|
10
|
+
return {
|
|
11
|
+
success: exitCode === 0,
|
|
12
|
+
diagnostics,
|
|
13
|
+
total: diagnostics.length,
|
|
14
|
+
errors,
|
|
15
|
+
warnings,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Parses `cargo test` output.
|
|
20
|
+
* Format: "test name ... ok/FAILED/ignored"
|
|
21
|
+
* Summary: "test result: ok/FAILED. X passed; Y failed; Z ignored"
|
|
22
|
+
*/
|
|
23
|
+
export function parseCargoTestOutput(stdout, exitCode) {
|
|
24
|
+
const lines = stdout.split("\n");
|
|
25
|
+
const tests = [];
|
|
26
|
+
for (const line of lines) {
|
|
27
|
+
const match = line.match(/^test (.+?) \.\.\. (ok|FAILED|ignored)$/);
|
|
28
|
+
if (match) {
|
|
29
|
+
tests.push({
|
|
30
|
+
name: match[1],
|
|
31
|
+
status: match[2],
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const passed = tests.filter((t) => t.status === "ok").length;
|
|
36
|
+
const failed = tests.filter((t) => t.status === "FAILED").length;
|
|
37
|
+
const ignored = tests.filter((t) => t.status === "ignored").length;
|
|
38
|
+
return {
|
|
39
|
+
success: exitCode === 0,
|
|
40
|
+
tests,
|
|
41
|
+
total: tests.length,
|
|
42
|
+
passed,
|
|
43
|
+
failed,
|
|
44
|
+
ignored,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Parses `cargo clippy --message-format=json` output.
|
|
49
|
+
* Same JSON format as cargo build.
|
|
50
|
+
*/
|
|
51
|
+
export function parseCargoClippyJson(stdout) {
|
|
52
|
+
const diagnostics = parseCompilerMessages(stdout);
|
|
53
|
+
const errors = diagnostics.filter((d) => d.severity === "error").length;
|
|
54
|
+
const warnings = diagnostics.filter((d) => d.severity === "warning").length;
|
|
55
|
+
return {
|
|
56
|
+
diagnostics,
|
|
57
|
+
total: diagnostics.length,
|
|
58
|
+
errors,
|
|
59
|
+
warnings,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function parseCompilerMessages(stdout) {
|
|
63
|
+
const lines = stdout.trim().split("\n").filter(Boolean);
|
|
64
|
+
const diagnostics = [];
|
|
65
|
+
for (const line of lines) {
|
|
66
|
+
let msg;
|
|
67
|
+
try {
|
|
68
|
+
msg = JSON.parse(line);
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (msg.reason !== "compiler-message" || !msg.message)
|
|
74
|
+
continue;
|
|
75
|
+
const span = msg.message.spans[0];
|
|
76
|
+
if (!span)
|
|
77
|
+
continue;
|
|
78
|
+
const severity = (["error", "warning", "note", "help"].includes(msg.message.level)
|
|
79
|
+
? msg.message.level
|
|
80
|
+
: "warning");
|
|
81
|
+
diagnostics.push({
|
|
82
|
+
file: span.file_name,
|
|
83
|
+
line: span.line_start,
|
|
84
|
+
column: span.column_start,
|
|
85
|
+
severity,
|
|
86
|
+
code: msg.message.code?.code || undefined,
|
|
87
|
+
message: msg.message.message,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return diagnostics;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=parsers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parsers.js","sourceRoot":"","sources":["../../src/lib/parsers.ts"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAc,EAAE,QAAgB;IAClE,MAAM,WAAW,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACl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,IAAI,CAAC,IAAI;YAAE,SAAS;QAEpB,MAAM,QAAQ,GAAG,CACf,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC;YAC9D,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK;YACnB,CAAC,CAAC,SAAS,CAC2B,CAAC;QAE3C,WAAW,CAAC,IAAI,CAAC;YACf,IAAI,EAAE,IAAI,CAAC,SAAS;YACpB,IAAI,EAAE,IAAI,CAAC,UAAU;YACrB,MAAM,EAAE,IAAI,CAAC,YAAY;YACzB,QAAQ;YACR,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,IAAI,SAAS;YACzC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,OAAO;SAC7B,CAAC,CAAC;IACL,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const CargoDiagnosticSchema: z.ZodObject<{
|
|
3
|
+
file: z.ZodString;
|
|
4
|
+
line: z.ZodNumber;
|
|
5
|
+
column: z.ZodNumber;
|
|
6
|
+
severity: z.ZodEnum<["error", "warning", "note", "help"]>;
|
|
7
|
+
code: z.ZodOptional<z.ZodString>;
|
|
8
|
+
message: z.ZodString;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
file: string;
|
|
11
|
+
line: number;
|
|
12
|
+
column: number;
|
|
13
|
+
severity: "error" | "warning" | "note" | "help";
|
|
14
|
+
message: string;
|
|
15
|
+
code?: string | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
file: string;
|
|
18
|
+
line: number;
|
|
19
|
+
column: number;
|
|
20
|
+
severity: "error" | "warning" | "note" | "help";
|
|
21
|
+
message: string;
|
|
22
|
+
code?: string | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
export declare const CargoBuildResultSchema: z.ZodObject<{
|
|
25
|
+
success: z.ZodBoolean;
|
|
26
|
+
diagnostics: z.ZodArray<z.ZodObject<{
|
|
27
|
+
file: z.ZodString;
|
|
28
|
+
line: z.ZodNumber;
|
|
29
|
+
column: z.ZodNumber;
|
|
30
|
+
severity: z.ZodEnum<["error", "warning", "note", "help"]>;
|
|
31
|
+
code: z.ZodOptional<z.ZodString>;
|
|
32
|
+
message: z.ZodString;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
file: string;
|
|
35
|
+
line: number;
|
|
36
|
+
column: number;
|
|
37
|
+
severity: "error" | "warning" | "note" | "help";
|
|
38
|
+
message: string;
|
|
39
|
+
code?: string | undefined;
|
|
40
|
+
}, {
|
|
41
|
+
file: string;
|
|
42
|
+
line: number;
|
|
43
|
+
column: number;
|
|
44
|
+
severity: "error" | "warning" | "note" | "help";
|
|
45
|
+
message: string;
|
|
46
|
+
code?: string | undefined;
|
|
47
|
+
}>, "many">;
|
|
48
|
+
total: z.ZodNumber;
|
|
49
|
+
errors: z.ZodNumber;
|
|
50
|
+
warnings: z.ZodNumber;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
success: boolean;
|
|
53
|
+
diagnostics: {
|
|
54
|
+
file: string;
|
|
55
|
+
line: number;
|
|
56
|
+
column: number;
|
|
57
|
+
severity: "error" | "warning" | "note" | "help";
|
|
58
|
+
message: string;
|
|
59
|
+
code?: string | undefined;
|
|
60
|
+
}[];
|
|
61
|
+
total: number;
|
|
62
|
+
errors: number;
|
|
63
|
+
warnings: number;
|
|
64
|
+
}, {
|
|
65
|
+
success: boolean;
|
|
66
|
+
diagnostics: {
|
|
67
|
+
file: string;
|
|
68
|
+
line: number;
|
|
69
|
+
column: number;
|
|
70
|
+
severity: "error" | "warning" | "note" | "help";
|
|
71
|
+
message: string;
|
|
72
|
+
code?: string | undefined;
|
|
73
|
+
}[];
|
|
74
|
+
total: number;
|
|
75
|
+
errors: number;
|
|
76
|
+
warnings: number;
|
|
77
|
+
}>;
|
|
78
|
+
export type CargoBuildResult = z.infer<typeof CargoBuildResultSchema>;
|
|
79
|
+
export declare const CargoTestCaseSchema: z.ZodObject<{
|
|
80
|
+
name: z.ZodString;
|
|
81
|
+
status: z.ZodEnum<["ok", "FAILED", "ignored"]>;
|
|
82
|
+
duration: z.ZodOptional<z.ZodString>;
|
|
83
|
+
}, "strip", z.ZodTypeAny, {
|
|
84
|
+
status: "ok" | "FAILED" | "ignored";
|
|
85
|
+
name: string;
|
|
86
|
+
duration?: string | undefined;
|
|
87
|
+
}, {
|
|
88
|
+
status: "ok" | "FAILED" | "ignored";
|
|
89
|
+
name: string;
|
|
90
|
+
duration?: string | undefined;
|
|
91
|
+
}>;
|
|
92
|
+
export declare const CargoTestResultSchema: z.ZodObject<{
|
|
93
|
+
success: z.ZodBoolean;
|
|
94
|
+
tests: z.ZodArray<z.ZodObject<{
|
|
95
|
+
name: z.ZodString;
|
|
96
|
+
status: z.ZodEnum<["ok", "FAILED", "ignored"]>;
|
|
97
|
+
duration: z.ZodOptional<z.ZodString>;
|
|
98
|
+
}, "strip", z.ZodTypeAny, {
|
|
99
|
+
status: "ok" | "FAILED" | "ignored";
|
|
100
|
+
name: string;
|
|
101
|
+
duration?: string | undefined;
|
|
102
|
+
}, {
|
|
103
|
+
status: "ok" | "FAILED" | "ignored";
|
|
104
|
+
name: string;
|
|
105
|
+
duration?: string | undefined;
|
|
106
|
+
}>, "many">;
|
|
107
|
+
total: z.ZodNumber;
|
|
108
|
+
passed: z.ZodNumber;
|
|
109
|
+
failed: z.ZodNumber;
|
|
110
|
+
ignored: z.ZodNumber;
|
|
111
|
+
}, "strip", z.ZodTypeAny, {
|
|
112
|
+
success: boolean;
|
|
113
|
+
total: number;
|
|
114
|
+
ignored: number;
|
|
115
|
+
tests: {
|
|
116
|
+
status: "ok" | "FAILED" | "ignored";
|
|
117
|
+
name: string;
|
|
118
|
+
duration?: string | undefined;
|
|
119
|
+
}[];
|
|
120
|
+
passed: number;
|
|
121
|
+
failed: number;
|
|
122
|
+
}, {
|
|
123
|
+
success: boolean;
|
|
124
|
+
total: number;
|
|
125
|
+
ignored: number;
|
|
126
|
+
tests: {
|
|
127
|
+
status: "ok" | "FAILED" | "ignored";
|
|
128
|
+
name: string;
|
|
129
|
+
duration?: string | undefined;
|
|
130
|
+
}[];
|
|
131
|
+
passed: number;
|
|
132
|
+
failed: number;
|
|
133
|
+
}>;
|
|
134
|
+
export type CargoTestResult = z.infer<typeof CargoTestResultSchema>;
|
|
135
|
+
export declare const CargoClippyResultSchema: z.ZodObject<{
|
|
136
|
+
diagnostics: z.ZodArray<z.ZodObject<{
|
|
137
|
+
file: z.ZodString;
|
|
138
|
+
line: z.ZodNumber;
|
|
139
|
+
column: z.ZodNumber;
|
|
140
|
+
severity: z.ZodEnum<["error", "warning", "note", "help"]>;
|
|
141
|
+
code: z.ZodOptional<z.ZodString>;
|
|
142
|
+
message: z.ZodString;
|
|
143
|
+
}, "strip", z.ZodTypeAny, {
|
|
144
|
+
file: string;
|
|
145
|
+
line: number;
|
|
146
|
+
column: number;
|
|
147
|
+
severity: "error" | "warning" | "note" | "help";
|
|
148
|
+
message: string;
|
|
149
|
+
code?: string | undefined;
|
|
150
|
+
}, {
|
|
151
|
+
file: string;
|
|
152
|
+
line: number;
|
|
153
|
+
column: number;
|
|
154
|
+
severity: "error" | "warning" | "note" | "help";
|
|
155
|
+
message: string;
|
|
156
|
+
code?: string | undefined;
|
|
157
|
+
}>, "many">;
|
|
158
|
+
total: z.ZodNumber;
|
|
159
|
+
errors: z.ZodNumber;
|
|
160
|
+
warnings: z.ZodNumber;
|
|
161
|
+
}, "strip", z.ZodTypeAny, {
|
|
162
|
+
diagnostics: {
|
|
163
|
+
file: string;
|
|
164
|
+
line: number;
|
|
165
|
+
column: number;
|
|
166
|
+
severity: "error" | "warning" | "note" | "help";
|
|
167
|
+
message: string;
|
|
168
|
+
code?: string | undefined;
|
|
169
|
+
}[];
|
|
170
|
+
total: number;
|
|
171
|
+
errors: number;
|
|
172
|
+
warnings: number;
|
|
173
|
+
}, {
|
|
174
|
+
diagnostics: {
|
|
175
|
+
file: string;
|
|
176
|
+
line: number;
|
|
177
|
+
column: number;
|
|
178
|
+
severity: "error" | "warning" | "note" | "help";
|
|
179
|
+
message: string;
|
|
180
|
+
code?: string | undefined;
|
|
181
|
+
}[];
|
|
182
|
+
total: number;
|
|
183
|
+
errors: number;
|
|
184
|
+
warnings: number;
|
|
185
|
+
}>;
|
|
186
|
+
export type CargoClippyResult = z.infer<typeof CargoClippyResultSchema>;
|
|
187
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;EAOhC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAGtE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;EAI9B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAGpE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// cargo build --message-format=json
|
|
3
|
+
export const CargoDiagnosticSchema = z.object({
|
|
4
|
+
file: z.string(),
|
|
5
|
+
line: z.number(),
|
|
6
|
+
column: z.number(),
|
|
7
|
+
severity: z.enum(["error", "warning", "note", "help"]),
|
|
8
|
+
code: z.string().optional(),
|
|
9
|
+
message: z.string(),
|
|
10
|
+
});
|
|
11
|
+
export const CargoBuildResultSchema = z.object({
|
|
12
|
+
success: z.boolean(),
|
|
13
|
+
diagnostics: z.array(CargoDiagnosticSchema),
|
|
14
|
+
total: z.number(),
|
|
15
|
+
errors: z.number(),
|
|
16
|
+
warnings: z.number(),
|
|
17
|
+
});
|
|
18
|
+
// cargo test -- output
|
|
19
|
+
export const CargoTestCaseSchema = z.object({
|
|
20
|
+
name: z.string(),
|
|
21
|
+
status: z.enum(["ok", "FAILED", "ignored"]),
|
|
22
|
+
duration: z.string().optional(),
|
|
23
|
+
});
|
|
24
|
+
export const CargoTestResultSchema = z.object({
|
|
25
|
+
success: z.boolean(),
|
|
26
|
+
tests: z.array(CargoTestCaseSchema),
|
|
27
|
+
total: z.number(),
|
|
28
|
+
passed: z.number(),
|
|
29
|
+
failed: z.number(),
|
|
30
|
+
ignored: z.number(),
|
|
31
|
+
});
|
|
32
|
+
// cargo clippy --message-format=json (same shape as build diagnostics)
|
|
33
|
+
export const CargoClippyResultSchema = z.object({
|
|
34
|
+
diagnostics: z.array(CargoDiagnosticSchema),
|
|
35
|
+
total: z.number(),
|
|
36
|
+
errors: z.number(),
|
|
37
|
+
warnings: z.number(),
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,oCAAoC;AACpC,MAAM,CAAC,MAAM,qBAAqB,G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IAClB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC,CAAC;AAIH,uEAAuE;AACvE,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC;IAC3C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;CACrB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/tools/build.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,QAuBlD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dualOutput } from "@paretools/shared";
|
|
3
|
+
import { cargo } from "../lib/cargo-runner.js";
|
|
4
|
+
import { parseCargoBuildJson } from "../lib/parsers.js";
|
|
5
|
+
import { formatCargoBuild } from "../lib/formatters.js";
|
|
6
|
+
import { CargoBuildResultSchema } from "../schemas/index.js";
|
|
7
|
+
export function registerBuildTool(server) {
|
|
8
|
+
server.registerTool("build", {
|
|
9
|
+
title: "Cargo Build",
|
|
10
|
+
description: "Runs cargo build and returns structured diagnostics (file, line, code, severity, message)",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
path: z.string().optional().describe("Project root path (default: cwd)"),
|
|
13
|
+
release: z.boolean().optional().default(false).describe("Build in release mode"),
|
|
14
|
+
},
|
|
15
|
+
outputSchema: CargoBuildResultSchema,
|
|
16
|
+
}, async ({ path, release }) => {
|
|
17
|
+
const cwd = path || process.cwd();
|
|
18
|
+
const args = ["build", "--message-format=json"];
|
|
19
|
+
if (release)
|
|
20
|
+
args.push("--release");
|
|
21
|
+
const result = await cargo(args, cwd);
|
|
22
|
+
const data = parseCargoBuildJson(result.stdout, result.exitCode);
|
|
23
|
+
return dualOutput(data, formatCargoBuild);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/tools/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,UAAU,iBAAiB,CAAC,MAAiB;IACjD,MAAM,CAAC,YAAY,CACjB,OAAO,EACP;QACE,KAAK,EAAE,aAAa;QACpB,WAAW,EACT,2FAA2F;QAC7F,WAAW,EAAE;YACX,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;YACxE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,uBAAuB,CAAC;SACjF;QACD,YAAY,EAAE,sBAAsB;KACrC,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;QAC1B,MAAM,GAAG,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAClC,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,uBAAuB,CAAC,CAAC;QAChD,IAAI,OAAO;YAAE,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAEpC,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACtC,MAAM,IAAI,GAAG,mBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QACjE,OAAO,UAAU,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IAC5C,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clippy.d.ts","sourceRoot":"","sources":["../../src/tools/clippy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,QAoBnD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dualOutput } from "@paretools/shared";
|
|
3
|
+
import { cargo } from "../lib/cargo-runner.js";
|
|
4
|
+
import { parseCargoClippyJson } from "../lib/parsers.js";
|
|
5
|
+
import { formatCargoClippy } from "../lib/formatters.js";
|
|
6
|
+
import { CargoClippyResultSchema } from "../schemas/index.js";
|
|
7
|
+
export function registerClippyTool(server) {
|
|
8
|
+
server.registerTool("clippy", {
|
|
9
|
+
title: "Cargo Clippy",
|
|
10
|
+
description: "Runs cargo clippy and returns structured lint diagnostics",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
path: z.string().optional().describe("Project root path (default: cwd)"),
|
|
13
|
+
},
|
|
14
|
+
outputSchema: CargoClippyResultSchema,
|
|
15
|
+
}, async ({ path }) => {
|
|
16
|
+
const cwd = path || process.cwd();
|
|
17
|
+
const args = ["clippy", "--message-format=json"];
|
|
18
|
+
const result = await cargo(args, cwd);
|
|
19
|
+
const data = parseCargoClippyJson(result.stdout);
|
|
20
|
+
return dualOutput(data, formatCargoClippy);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=clippy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clippy.js","sourceRoot":"","sources":["../../src/tools/clippy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,MAAM,UAAU,kBAAkB,CAAC,MAAiB;IAClD,MAAM,CAAC,YAAY,CACjB,QAAQ,EACR;QACE,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,2DAA2D;QACxE,WAAW,EAAE;YACX,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;SACzE;QACD,YAAY,EAAE,uBAAuB;KACtC,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QACjB,MAAM,GAAG,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAClC,MAAM,IAAI,GAAG,CAAC,QAAQ,EAAE,uBAAuB,CAAC,CAAC;QAEjD,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACtC,MAAM,IAAI,GAAG,oBAAoB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACjD,OAAO,UAAU,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;IAC7C,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAKzE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,QAIjD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { registerBuildTool } from "./build.js";
|
|
2
|
+
import { registerTestTool } from "./test.js";
|
|
3
|
+
import { registerClippyTool } from "./clippy.js";
|
|
4
|
+
export function registerAllTools(server) {
|
|
5
|
+
registerBuildTool(server);
|
|
6
|
+
registerTestTool(server);
|
|
7
|
+
registerClippyTool(server);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,UAAU,gBAAgB,CAAC,MAAiB;IAChD,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC1B,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACzB,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../src/tools/test.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,QAuBjD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dualOutput } from "@paretools/shared";
|
|
3
|
+
import { cargo } from "../lib/cargo-runner.js";
|
|
4
|
+
import { parseCargoTestOutput } from "../lib/parsers.js";
|
|
5
|
+
import { formatCargoTest } from "../lib/formatters.js";
|
|
6
|
+
import { CargoTestResultSchema } from "../schemas/index.js";
|
|
7
|
+
export function registerTestTool(server) {
|
|
8
|
+
server.registerTool("test", {
|
|
9
|
+
title: "Cargo Test",
|
|
10
|
+
description: "Runs cargo test and returns structured test results (name, status, pass/fail counts)",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
path: z.string().optional().describe("Project root path (default: cwd)"),
|
|
13
|
+
filter: z.string().optional().describe("Test name filter pattern"),
|
|
14
|
+
},
|
|
15
|
+
outputSchema: CargoTestResultSchema,
|
|
16
|
+
}, async ({ path, filter }) => {
|
|
17
|
+
const cwd = path || process.cwd();
|
|
18
|
+
const args = ["test"];
|
|
19
|
+
if (filter)
|
|
20
|
+
args.push(filter);
|
|
21
|
+
const result = await cargo(args, cwd);
|
|
22
|
+
const data = parseCargoTestOutput(result.stdout, result.exitCode);
|
|
23
|
+
return dualOutput(data, formatCargoTest);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../src/tools/test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,MAAM,UAAU,gBAAgB,CAAC,MAAiB;IAChD,MAAM,CAAC,YAAY,CACjB,MAAM,EACN;QACE,KAAK,EAAE,YAAY;QACnB,WAAW,EACT,sFAAsF;QACxF,WAAW,EAAE;YACX,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;YACxE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;SACnE;QACD,YAAY,EAAE,qBAAqB;KACpC,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE;QACzB,MAAM,GAAG,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAClC,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;QACtB,IAAI,MAAM;YAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE9B,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACtC,MAAM,IAAI,GAAG,oBAAoB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAClE,OAAO,UAAU,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IAC3C,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@paretools/cargo",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "MCP server for Rust cargo (build, test, clippy) with structured, token-efficient output",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"pare-cargo": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/Dave-London/pare.git",
|
|
22
|
+
"directory": "packages/server-cargo"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
29
|
+
"zod": "^3.25.0",
|
|
30
|
+
"@paretools/shared": "0.2.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/node": "^22.0.0",
|
|
34
|
+
"typescript": "^5.7.0",
|
|
35
|
+
"vitest": "^3.0.0",
|
|
36
|
+
"@paretools/tsconfig": "0.0.0"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsc",
|
|
40
|
+
"test": "vitest run",
|
|
41
|
+
"test:watch": "vitest",
|
|
42
|
+
"lint": "eslint src/"
|
|
43
|
+
}
|
|
44
|
+
}
|