@paretools/cargo 0.3.0 → 0.5.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/README.md +44 -9
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/formatters.d.ts +14 -1
- package/dist/lib/formatters.d.ts.map +1 -1
- package/dist/lib/formatters.js +55 -0
- package/dist/lib/formatters.js.map +1 -1
- package/dist/lib/parsers.d.ts +29 -1
- package/dist/lib/parsers.d.ts.map +1 -1
- package/dist/lib/parsers.js +112 -0
- package/dist/lib/parsers.js.map +1 -1
- package/dist/schemas/index.d.ts +84 -143
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +40 -3
- package/dist/schemas/index.js.map +1 -1
- package/dist/tools/add.d.ts +3 -0
- package/dist/tools/add.d.ts.map +1 -0
- package/dist/tools/add.js +37 -0
- package/dist/tools/add.js.map +1 -0
- package/dist/tools/check.d.ts +3 -0
- package/dist/tools/check.d.ts.map +1 -0
- package/dist/tools/check.js +26 -0
- package/dist/tools/check.js.map +1 -0
- package/dist/tools/doc.d.ts +3 -0
- package/dist/tools/doc.d.ts.map +1 -0
- package/dist/tools/doc.js +37 -0
- package/dist/tools/doc.js.map +1 -0
- package/dist/tools/fmt.d.ts +3 -0
- package/dist/tools/fmt.d.ts.map +1 -0
- package/dist/tools/fmt.js +30 -0
- package/dist/tools/fmt.js.map +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +12 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/remove.d.ts +3 -0
- package/dist/tools/remove.d.ts.map +1 -0
- package/dist/tools/remove.js +30 -0
- package/dist/tools/remove.js.map +1 -0
- package/dist/tools/run.d.ts +3 -0
- package/dist/tools/run.d.ts.map +1 -0
- package/dist/tools/run.js +34 -0
- package/dist/tools/run.js.map +1 -0
- package/package.json +18 -8
package/README.md
CHANGED
|
@@ -1,23 +1,40 @@
|
|
|
1
1
|
# @paretools/cargo
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@paretools/cargo)
|
|
4
|
+
[](https://github.com/Dave-London/pare/blob/main/LICENSE)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
**Structured, token-efficient Rust/Cargo output for AI agents.** Up to 68% fewer tokens than raw `cargo` CLI output.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
| -------- | ------------------------------------------------------- |
|
|
9
|
-
| `build` | Build diagnostics (file, line, code, severity, message) |
|
|
10
|
-
| `test` | Test results (name, status, pass/fail counts) |
|
|
11
|
-
| `clippy` | Lint diagnostics from clippy |
|
|
8
|
+
Part of the [Pare](https://github.com/Dave-London/pare) suite of MCP servers.
|
|
12
9
|
|
|
13
|
-
##
|
|
10
|
+
## Tools (9)
|
|
11
|
+
|
|
12
|
+
| Tool | Description |
|
|
13
|
+
| -------- | --------------------------------------------------------------------- |
|
|
14
|
+
| `build` | Build diagnostics (file, line, code, severity, message) |
|
|
15
|
+
| `test` | Test results (name, status, pass/fail counts) |
|
|
16
|
+
| `clippy` | Lint diagnostics from clippy |
|
|
17
|
+
| `run` | Run a cargo binary with structured output (exit code, stdout, stderr) |
|
|
18
|
+
| `add` | Add dependencies to a Rust project |
|
|
19
|
+
| `remove` | Remove dependencies from a Rust project |
|
|
20
|
+
| `fmt` | Check or fix Rust formatting |
|
|
21
|
+
| `doc` | Generate documentation with warning count |
|
|
22
|
+
| `check` | Type check without full build (faster than build) |
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx -y @paretools/cargo
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Add to your MCP client config:
|
|
14
31
|
|
|
15
32
|
```json
|
|
16
33
|
{
|
|
17
34
|
"mcpServers": {
|
|
18
35
|
"pare-cargo": {
|
|
19
36
|
"command": "npx",
|
|
20
|
-
"args": ["@paretools/cargo"]
|
|
37
|
+
"args": ["-y", "@paretools/cargo"]
|
|
21
38
|
}
|
|
22
39
|
}
|
|
23
40
|
}
|
|
@@ -40,6 +57,24 @@ Pare MCP server for **Rust/Cargo**. Returns structured output from cargo build,
|
|
|
40
57
|
}
|
|
41
58
|
```
|
|
42
59
|
|
|
60
|
+
## All Pare Servers (62 tools)
|
|
61
|
+
|
|
62
|
+
| Package | Tools | Wraps |
|
|
63
|
+
| -------------------------------------------------------------------- | --------------------------------------------------------------------------- | ---------------------------------- |
|
|
64
|
+
| [@paretools/git](https://www.npmjs.com/package/@paretools/git) | status, log, diff, branch, show, add, commit, push, pull, checkout | git |
|
|
65
|
+
| [@paretools/test](https://www.npmjs.com/package/@paretools/test) | run, coverage | pytest, jest, vitest, mocha |
|
|
66
|
+
| [@paretools/npm](https://www.npmjs.com/package/@paretools/npm) | install, audit, outdated, list, run, test, init | npm |
|
|
67
|
+
| [@paretools/build](https://www.npmjs.com/package/@paretools/build) | tsc, build, esbuild, vite-build, webpack | tsc, esbuild, vite, webpack |
|
|
68
|
+
| [@paretools/lint](https://www.npmjs.com/package/@paretools/lint) | lint, format-check, prettier-format, biome-check, biome-format | eslint, prettier, biome |
|
|
69
|
+
| [@paretools/python](https://www.npmjs.com/package/@paretools/python) | pip-install, mypy, ruff-check, pip-audit, pytest, uv-install, uv-run, black | pip, mypy, ruff, pytest, uv, black |
|
|
70
|
+
| [@paretools/docker](https://www.npmjs.com/package/@paretools/docker) | ps, build, logs, images, run, exec, compose-up, compose-down, pull | docker, docker compose |
|
|
71
|
+
| **@paretools/cargo** | build, test, clippy, run, add, remove, fmt, doc, check | cargo |
|
|
72
|
+
| [@paretools/go](https://www.npmjs.com/package/@paretools/go) | build, test, vet, run, mod-tidy, fmt, generate | go, gofmt |
|
|
73
|
+
|
|
74
|
+
## Compatible Clients
|
|
75
|
+
|
|
76
|
+
Works with any MCP-compatible client: [Claude Code](https://docs.anthropic.com/en/docs/claude-code), [Claude Desktop](https://claude.ai/download), [Cursor](https://cursor.com), [Windsurf](https://codeium.com/windsurf), [VS Code / GitHub Copilot](https://code.visualstudio.com), [Cline](https://github.com/cline/cline), [Roo Code](https://roocode.com), [Zed](https://zed.dev), [Continue.dev](https://continue.dev), [Gemini CLI](https://github.com/google-gemini/gemini-cli), [OpenAI Codex](https://openai.com/index/codex/)
|
|
77
|
+
|
|
43
78
|
## Links
|
|
44
79
|
|
|
45
80
|
- [Pare monorepo](https://github.com/Dave-London/pare)
|
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.2.0" }, {
|
|
6
|
-
instructions: "Structured Rust/Cargo operations (build, test, clippy). Use instead of running cargo commands via bash. Returns typed JSON with structured compiler errors, test results, and
|
|
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.",
|
|
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
|
|
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"}
|
package/dist/lib/formatters.d.ts
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
import type { CargoBuildResult, CargoTestResult, CargoClippyResult } from "../schemas/index.js";
|
|
1
|
+
import type { CargoBuildResult, CargoTestResult, CargoClippyResult, CargoRunResult, CargoAddResult, CargoRemoveResult, CargoFmtResult, CargoDocResult } from "../schemas/index.js";
|
|
2
|
+
/** Formats structured cargo build results into a human-readable diagnostic summary. */
|
|
2
3
|
export declare function formatCargoBuild(data: CargoBuildResult): string;
|
|
4
|
+
/** Formats structured cargo test results into a human-readable test summary with pass/fail status. */
|
|
3
5
|
export declare function formatCargoTest(data: CargoTestResult): string;
|
|
6
|
+
/** Formats structured cargo clippy results into a human-readable lint warning summary. */
|
|
4
7
|
export declare function formatCargoClippy(data: CargoClippyResult): string;
|
|
8
|
+
/** Formats structured cargo run output into a human-readable summary. */
|
|
9
|
+
export declare function formatCargoRun(data: CargoRunResult): string;
|
|
10
|
+
/** Formats structured cargo add output into a human-readable summary. */
|
|
11
|
+
export declare function formatCargoAdd(data: CargoAddResult): string;
|
|
12
|
+
/** Formats structured cargo remove output into a human-readable summary. */
|
|
13
|
+
export declare function formatCargoRemove(data: CargoRemoveResult): string;
|
|
14
|
+
/** Formats structured cargo fmt output into a human-readable summary. */
|
|
15
|
+
export declare function formatCargoFmt(data: CargoFmtResult): string;
|
|
16
|
+
/** Formats structured cargo doc output into a human-readable summary. */
|
|
17
|
+
export declare function formatCargoDoc(data: CargoDocResult): string;
|
|
5
18
|
//# sourceMappingURL=formatters.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../src/lib/formatters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
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,EACf,MAAM,qBAAqB,CAAC;AAE7B,uFAAuF;AACvF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAU/D;AAED,sGAAsG;AACtG,wBAAgB,eAAe,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAS7D;AAED,0FAA0F;AAC1F,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CASjE;AAED,yEAAyE;AACzE,wBAAgB,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAM3D;AAED,yEAAyE;AACzE,wBAAgB,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAU3D;AAED,4EAA4E;AAC5E,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAUjE;AAED,yEAAyE;AACzE,wBAAgB,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAS3D;AAED,yEAAyE;AACzE,wBAAgB,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAI3D"}
|
package/dist/lib/formatters.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** Formats structured cargo build results into a human-readable diagnostic summary. */
|
|
1
2
|
export function formatCargoBuild(data) {
|
|
2
3
|
if (data.success && data.total === 0)
|
|
3
4
|
return "cargo build: success, no diagnostics.";
|
|
@@ -9,6 +10,7 @@ export function formatCargoBuild(data) {
|
|
|
9
10
|
}
|
|
10
11
|
return lines.join("\n");
|
|
11
12
|
}
|
|
13
|
+
/** Formats structured cargo test results into a human-readable test summary with pass/fail status. */
|
|
12
14
|
export function formatCargoTest(data) {
|
|
13
15
|
const status = data.success ? "ok" : "FAILED";
|
|
14
16
|
const lines = [
|
|
@@ -19,6 +21,7 @@ export function formatCargoTest(data) {
|
|
|
19
21
|
}
|
|
20
22
|
return lines.join("\n");
|
|
21
23
|
}
|
|
24
|
+
/** Formats structured cargo clippy results into a human-readable lint warning summary. */
|
|
22
25
|
export function formatCargoClippy(data) {
|
|
23
26
|
if (data.total === 0)
|
|
24
27
|
return "clippy: no warnings.";
|
|
@@ -29,4 +32,56 @@ export function formatCargoClippy(data) {
|
|
|
29
32
|
}
|
|
30
33
|
return lines.join("\n");
|
|
31
34
|
}
|
|
35
|
+
/** Formats structured cargo run output into a human-readable summary. */
|
|
36
|
+
export function formatCargoRun(data) {
|
|
37
|
+
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}`);
|
|
43
|
+
return lines.join("\n");
|
|
44
|
+
}
|
|
45
|
+
/** Formats structured cargo add output into a human-readable summary. */
|
|
46
|
+
export function formatCargoAdd(data) {
|
|
47
|
+
if (!data.success)
|
|
48
|
+
return "cargo add: failed";
|
|
49
|
+
if (data.total === 0)
|
|
50
|
+
return "cargo add: success, no packages added.";
|
|
51
|
+
const lines = [`cargo add: ${data.total} package(s) added`];
|
|
52
|
+
for (const pkg of data.added) {
|
|
53
|
+
lines.push(` ${pkg.name} v${pkg.version}`);
|
|
54
|
+
}
|
|
55
|
+
return lines.join("\n");
|
|
56
|
+
}
|
|
57
|
+
/** Formats structured cargo remove output into a human-readable summary. */
|
|
58
|
+
export function formatCargoRemove(data) {
|
|
59
|
+
if (!data.success)
|
|
60
|
+
return "cargo remove: failed";
|
|
61
|
+
if (data.total === 0)
|
|
62
|
+
return "cargo remove: success, no packages removed.";
|
|
63
|
+
const lines = [`cargo remove: ${data.total} package(s) removed`];
|
|
64
|
+
for (const name of data.removed) {
|
|
65
|
+
lines.push(` ${name}`);
|
|
66
|
+
}
|
|
67
|
+
return lines.join("\n");
|
|
68
|
+
}
|
|
69
|
+
/** Formats structured cargo fmt output into a human-readable summary. */
|
|
70
|
+
export function formatCargoFmt(data) {
|
|
71
|
+
if (data.success && data.filesChanged === 0)
|
|
72
|
+
return "cargo fmt: all files formatted.";
|
|
73
|
+
const status = data.success ? "success" : "needs formatting";
|
|
74
|
+
const lines = [`cargo fmt: ${status} (${data.filesChanged} file(s))`];
|
|
75
|
+
for (const f of data.files) {
|
|
76
|
+
lines.push(` ${f}`);
|
|
77
|
+
}
|
|
78
|
+
return lines.join("\n");
|
|
79
|
+
}
|
|
80
|
+
/** Formats structured cargo doc output into a human-readable summary. */
|
|
81
|
+
export function formatCargoDoc(data) {
|
|
82
|
+
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))`;
|
|
86
|
+
}
|
|
32
87
|
//# sourceMappingURL=formatters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/lib/formatters.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/lib/formatters.ts"],"names":[],"mappings":"AAWA,uFAAuF;AACvF,MAAM,UAAU,gBAAg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KAAK,GAAG,CAAC,cAAc,MAAM,KAAK,IAAI,CAAC,YAAY,WAAW,CAAC,CAAC;IACtE,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,cAAc,CAAC,IAAoB;IACjD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;IACnD,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC;QAAE,OAAO,cAAc,MAAM,GAAG,CAAC;IACxD,OAAO,cAAc,MAAM,KAAK,IAAI,CAAC,QAAQ,cAAc,CAAC;AAC9D,CAAC"}
|
package/dist/lib/parsers.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CargoBuildResult, CargoTestResult, CargoClippyResult } from "../schemas/index.js";
|
|
1
|
+
import type { CargoBuildResult, CargoTestResult, CargoClippyResult, CargoRunResult, CargoAddResult, CargoRemoveResult, CargoFmtResult, CargoDocResult } from "../schemas/index.js";
|
|
2
2
|
/**
|
|
3
3
|
* Parses `cargo build --message-format=json` output.
|
|
4
4
|
* Each line is a JSON object with a "reason" field.
|
|
@@ -16,4 +16,32 @@ export declare function parseCargoTestOutput(stdout: string, exitCode: number):
|
|
|
16
16
|
* Same JSON format as cargo build.
|
|
17
17
|
*/
|
|
18
18
|
export declare function parseCargoClippyJson(stdout: string): CargoClippyResult;
|
|
19
|
+
/**
|
|
20
|
+
* Parses `cargo run` output.
|
|
21
|
+
* Returns exit code, stdout, stderr, and success flag.
|
|
22
|
+
*/
|
|
23
|
+
export declare function parseCargoRunOutput(stdout: string, stderr: string, exitCode: number): CargoRunResult;
|
|
24
|
+
/**
|
|
25
|
+
* Parses `cargo add` output.
|
|
26
|
+
* Lines like: " Adding serde v1.0.217 to dependencies"
|
|
27
|
+
* Also handles: " Adding serde v1.0.217 to dev-dependencies"
|
|
28
|
+
*/
|
|
29
|
+
export declare function parseCargoAddOutput(stdout: string, stderr: string, exitCode: number): CargoAddResult;
|
|
30
|
+
/**
|
|
31
|
+
* Parses `cargo remove` output.
|
|
32
|
+
* Lines like: " Removing serde from dependencies"
|
|
33
|
+
*/
|
|
34
|
+
export declare function parseCargoRemoveOutput(stdout: string, stderr: string, exitCode: number): CargoRemoveResult;
|
|
35
|
+
/**
|
|
36
|
+
* Parses `cargo fmt --check` output.
|
|
37
|
+
* In check mode, lists files with formatting differences (one path per line).
|
|
38
|
+
* In fix mode, returns empty list (files are reformatted in place).
|
|
39
|
+
*/
|
|
40
|
+
export declare function parseCargoFmtOutput(stdout: string, stderr: string, exitCode: number, checkMode: boolean): CargoFmtResult;
|
|
41
|
+
/**
|
|
42
|
+
* Parses `cargo doc` output.
|
|
43
|
+
* Counts "warning:" or "warning[" lines from stderr,
|
|
44
|
+
* excluding the summary line "warning: N warnings emitted".
|
|
45
|
+
*/
|
|
46
|
+
export declare function parseCargoDocOutput(stderr: string, exitCode: number): CargoDocResult;
|
|
19
47
|
//# 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,
|
|
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,EACf,MAAM,qBAAqB,CAAC;AAY7B;;;;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;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,cAAc,CAOhB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,cAAc,CAiBhB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,iBAAiB,CAiBnB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,OAAO,GACjB,cAAc,CAyChB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,cAAc,CAcpF"}
|
package/dist/lib/parsers.js
CHANGED
|
@@ -59,6 +59,118 @@ export function parseCargoClippyJson(stdout) {
|
|
|
59
59
|
warnings,
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Parses `cargo run` output.
|
|
64
|
+
* Returns exit code, stdout, stderr, and success flag.
|
|
65
|
+
*/
|
|
66
|
+
export function parseCargoRunOutput(stdout, stderr, exitCode) {
|
|
67
|
+
return {
|
|
68
|
+
exitCode,
|
|
69
|
+
stdout,
|
|
70
|
+
stderr,
|
|
71
|
+
success: exitCode === 0,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Parses `cargo add` output.
|
|
76
|
+
* Lines like: " Adding serde v1.0.217 to dependencies"
|
|
77
|
+
* Also handles: " Adding serde v1.0.217 to dev-dependencies"
|
|
78
|
+
*/
|
|
79
|
+
export function parseCargoAddOutput(stdout, stderr, exitCode) {
|
|
80
|
+
const combined = stdout + "\n" + stderr;
|
|
81
|
+
const lines = combined.split("\n");
|
|
82
|
+
const added = [];
|
|
83
|
+
for (const line of lines) {
|
|
84
|
+
const match = line.match(/Adding\s+(\S+)\s+v(\S+)\s+to\s+/);
|
|
85
|
+
if (match) {
|
|
86
|
+
added.push({ name: match[1], version: match[2] });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
success: exitCode === 0,
|
|
91
|
+
added,
|
|
92
|
+
total: added.length,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Parses `cargo remove` output.
|
|
97
|
+
* Lines like: " Removing serde from dependencies"
|
|
98
|
+
*/
|
|
99
|
+
export function parseCargoRemoveOutput(stdout, stderr, exitCode) {
|
|
100
|
+
const combined = stdout + "\n" + stderr;
|
|
101
|
+
const lines = combined.split("\n");
|
|
102
|
+
const removed = [];
|
|
103
|
+
for (const line of lines) {
|
|
104
|
+
const match = line.match(/Removing\s+(\S+)\s+from\s+/);
|
|
105
|
+
if (match) {
|
|
106
|
+
removed.push(match[1]);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
success: exitCode === 0,
|
|
111
|
+
removed,
|
|
112
|
+
total: removed.length,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Parses `cargo fmt --check` output.
|
|
117
|
+
* In check mode, lists files with formatting differences (one path per line).
|
|
118
|
+
* In fix mode, returns empty list (files are reformatted in place).
|
|
119
|
+
*/
|
|
120
|
+
export function parseCargoFmtOutput(stdout, stderr, exitCode, checkMode) {
|
|
121
|
+
const files = [];
|
|
122
|
+
if (checkMode) {
|
|
123
|
+
// In check mode, cargo fmt --check outputs "Diff in <file>:" lines to stdout
|
|
124
|
+
// or just lists file paths. It may also output raw diff lines.
|
|
125
|
+
const combined = stdout + "\n" + stderr;
|
|
126
|
+
const lines = combined.split("\n");
|
|
127
|
+
for (const line of lines) {
|
|
128
|
+
// Match "Diff in <path> at line N:" format
|
|
129
|
+
const diffMatch = line.match(/^Diff in (.+?) at line/);
|
|
130
|
+
if (diffMatch) {
|
|
131
|
+
const file = diffMatch[1];
|
|
132
|
+
if (!files.includes(file)) {
|
|
133
|
+
files.push(file);
|
|
134
|
+
}
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
// Some versions just list the file path directly
|
|
138
|
+
const trimmed = line.trim();
|
|
139
|
+
if (trimmed &&
|
|
140
|
+
!trimmed.startsWith("+") &&
|
|
141
|
+
!trimmed.startsWith("-") &&
|
|
142
|
+
!trimmed.startsWith("@") &&
|
|
143
|
+
trimmed.endsWith(".rs")) {
|
|
144
|
+
if (!files.includes(trimmed)) {
|
|
145
|
+
files.push(trimmed);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
success: exitCode === 0,
|
|
152
|
+
filesChanged: files.length,
|
|
153
|
+
files,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Parses `cargo doc` output.
|
|
158
|
+
* Counts "warning:" or "warning[" lines from stderr,
|
|
159
|
+
* excluding the summary line "warning: N warnings emitted".
|
|
160
|
+
*/
|
|
161
|
+
export function parseCargoDocOutput(stderr, exitCode) {
|
|
162
|
+
const lines = stderr.split("\n");
|
|
163
|
+
let warnings = 0;
|
|
164
|
+
for (const line of lines) {
|
|
165
|
+
if (line.match(/\bwarning\b(\[|:)/) && !line.match(/\d+ warnings? emitted/)) {
|
|
166
|
+
warnings++;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
success: exitCode === 0,
|
|
171
|
+
warnings,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
62
174
|
function parseCompilerMessages(stdout) {
|
|
63
175
|
const lines = stdout.trim().split("\n").filter(Boolean);
|
|
64
176
|
const diagnostics = [];
|
package/dist/lib/parsers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parsers.js","sourceRoot":"","sources":["../../src/lib/parsers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parsers.js","sourceRoot":"","sources":["../../src/lib/parsers.ts"],"names":[],"mappings":"AAqBA;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAc,EAAE,QAAgB;IAClE,MAAM,WAAW,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,MAAM,CAAC;IACxE,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,MAAM,CAAC;IAE5E,OAAO;QACL,OAAO,EAAE,QAAQ,KAAK,CAAC;QACvB,WAAW;QACX,KAAK,EAAE,WAAW,CAAC,MAAM;QACzB,MAAM;QACN,QAAQ;KACT,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc,EAAE,QAAgB;IACnE,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,KAAK,GAA+E,EAAE,CAAC;IAE7F,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC;QACpE,IAAI,KAAK,EAAE,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,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"}
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -1,187 +1,128 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
/** Zod schema for a single Rust compiler diagnostic with file location, severity, and optional lint code. */
|
|
2
3
|
export declare const CargoDiagnosticSchema: z.ZodObject<{
|
|
3
4
|
file: z.ZodString;
|
|
4
5
|
line: z.ZodNumber;
|
|
5
6
|
column: z.ZodNumber;
|
|
6
|
-
severity: z.ZodEnum<
|
|
7
|
+
severity: z.ZodEnum<{
|
|
8
|
+
error: "error";
|
|
9
|
+
warning: "warning";
|
|
10
|
+
note: "note";
|
|
11
|
+
help: "help";
|
|
12
|
+
}>;
|
|
7
13
|
code: z.ZodOptional<z.ZodString>;
|
|
8
14
|
message: z.ZodString;
|
|
9
|
-
},
|
|
10
|
-
|
|
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
|
-
}>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
/** Zod schema for structured cargo build output including success status, diagnostics, and error/warning counts. */
|
|
24
17
|
export declare const CargoBuildResultSchema: z.ZodObject<{
|
|
25
18
|
success: z.ZodBoolean;
|
|
26
19
|
diagnostics: z.ZodArray<z.ZodObject<{
|
|
27
20
|
file: z.ZodString;
|
|
28
21
|
line: z.ZodNumber;
|
|
29
22
|
column: z.ZodNumber;
|
|
30
|
-
severity: z.ZodEnum<
|
|
23
|
+
severity: z.ZodEnum<{
|
|
24
|
+
error: "error";
|
|
25
|
+
warning: "warning";
|
|
26
|
+
note: "note";
|
|
27
|
+
help: "help";
|
|
28
|
+
}>;
|
|
31
29
|
code: z.ZodOptional<z.ZodString>;
|
|
32
30
|
message: z.ZodString;
|
|
33
|
-
},
|
|
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">;
|
|
31
|
+
}, z.core.$strip>>;
|
|
48
32
|
total: z.ZodNumber;
|
|
49
33
|
errors: z.ZodNumber;
|
|
50
34
|
warnings: z.ZodNumber;
|
|
51
|
-
},
|
|
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
|
-
}>;
|
|
35
|
+
}, z.core.$strip>;
|
|
78
36
|
export type CargoBuildResult = z.infer<typeof CargoBuildResultSchema>;
|
|
37
|
+
/** Zod schema for a single cargo test case with name, status (ok/FAILED/ignored), and optional duration. */
|
|
79
38
|
export declare const CargoTestCaseSchema: z.ZodObject<{
|
|
80
39
|
name: z.ZodString;
|
|
81
|
-
status: z.ZodEnum<
|
|
40
|
+
status: z.ZodEnum<{
|
|
41
|
+
ok: "ok";
|
|
42
|
+
FAILED: "FAILED";
|
|
43
|
+
ignored: "ignored";
|
|
44
|
+
}>;
|
|
82
45
|
duration: z.ZodOptional<z.ZodString>;
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
name: string;
|
|
86
|
-
duration?: string | undefined;
|
|
87
|
-
}, {
|
|
88
|
-
status: "ok" | "FAILED" | "ignored";
|
|
89
|
-
name: string;
|
|
90
|
-
duration?: string | undefined;
|
|
91
|
-
}>;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
/** Zod schema for structured cargo test output with test list, pass/fail/ignored counts. */
|
|
92
48
|
export declare const CargoTestResultSchema: z.ZodObject<{
|
|
93
49
|
success: z.ZodBoolean;
|
|
94
50
|
tests: z.ZodArray<z.ZodObject<{
|
|
95
51
|
name: z.ZodString;
|
|
96
|
-
status: z.ZodEnum<
|
|
52
|
+
status: z.ZodEnum<{
|
|
53
|
+
ok: "ok";
|
|
54
|
+
FAILED: "FAILED";
|
|
55
|
+
ignored: "ignored";
|
|
56
|
+
}>;
|
|
97
57
|
duration: z.ZodOptional<z.ZodString>;
|
|
98
|
-
},
|
|
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">;
|
|
58
|
+
}, z.core.$strip>>;
|
|
107
59
|
total: z.ZodNumber;
|
|
108
60
|
passed: z.ZodNumber;
|
|
109
61
|
failed: z.ZodNumber;
|
|
110
62
|
ignored: z.ZodNumber;
|
|
111
|
-
},
|
|
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
|
-
}>;
|
|
63
|
+
}, z.core.$strip>;
|
|
134
64
|
export type CargoTestResult = z.infer<typeof CargoTestResultSchema>;
|
|
65
|
+
/** Zod schema for structured cargo clippy output with diagnostics and error/warning counts. */
|
|
135
66
|
export declare const CargoClippyResultSchema: z.ZodObject<{
|
|
136
67
|
diagnostics: z.ZodArray<z.ZodObject<{
|
|
137
68
|
file: z.ZodString;
|
|
138
69
|
line: z.ZodNumber;
|
|
139
70
|
column: z.ZodNumber;
|
|
140
|
-
severity: z.ZodEnum<
|
|
71
|
+
severity: z.ZodEnum<{
|
|
72
|
+
error: "error";
|
|
73
|
+
warning: "warning";
|
|
74
|
+
note: "note";
|
|
75
|
+
help: "help";
|
|
76
|
+
}>;
|
|
141
77
|
code: z.ZodOptional<z.ZodString>;
|
|
142
78
|
message: z.ZodString;
|
|
143
|
-
},
|
|
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">;
|
|
79
|
+
}, z.core.$strip>>;
|
|
158
80
|
total: z.ZodNumber;
|
|
159
81
|
errors: z.ZodNumber;
|
|
160
82
|
warnings: z.ZodNumber;
|
|
161
|
-
},
|
|
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
|
-
}>;
|
|
83
|
+
}, z.core.$strip>;
|
|
186
84
|
export type CargoClippyResult = z.infer<typeof CargoClippyResultSchema>;
|
|
85
|
+
/** Zod schema for structured cargo run output with exit code, stdout, stderr, and success flag. */
|
|
86
|
+
export declare const CargoRunResultSchema: z.ZodObject<{
|
|
87
|
+
exitCode: z.ZodNumber;
|
|
88
|
+
stdout: z.ZodString;
|
|
89
|
+
stderr: z.ZodString;
|
|
90
|
+
success: z.ZodBoolean;
|
|
91
|
+
}, z.core.$strip>;
|
|
92
|
+
export type CargoRunResult = z.infer<typeof CargoRunResultSchema>;
|
|
93
|
+
/** Zod schema for a single added dependency entry. */
|
|
94
|
+
export declare const CargoAddedPackageSchema: z.ZodObject<{
|
|
95
|
+
name: z.ZodString;
|
|
96
|
+
version: z.ZodString;
|
|
97
|
+
}, z.core.$strip>;
|
|
98
|
+
/** Zod schema for structured cargo add output with added packages list. */
|
|
99
|
+
export declare const CargoAddResultSchema: z.ZodObject<{
|
|
100
|
+
success: z.ZodBoolean;
|
|
101
|
+
added: z.ZodArray<z.ZodObject<{
|
|
102
|
+
name: z.ZodString;
|
|
103
|
+
version: z.ZodString;
|
|
104
|
+
}, z.core.$strip>>;
|
|
105
|
+
total: z.ZodNumber;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
export type CargoAddResult = z.infer<typeof CargoAddResultSchema>;
|
|
108
|
+
/** Zod schema for structured cargo remove output with removed package names. */
|
|
109
|
+
export declare const CargoRemoveResultSchema: z.ZodObject<{
|
|
110
|
+
success: z.ZodBoolean;
|
|
111
|
+
removed: z.ZodArray<z.ZodString>;
|
|
112
|
+
total: z.ZodNumber;
|
|
113
|
+
}, z.core.$strip>;
|
|
114
|
+
export type CargoRemoveResult = z.infer<typeof CargoRemoveResultSchema>;
|
|
115
|
+
/** Zod schema for structured cargo fmt output with changed files list. */
|
|
116
|
+
export declare const CargoFmtResultSchema: z.ZodObject<{
|
|
117
|
+
success: z.ZodBoolean;
|
|
118
|
+
filesChanged: z.ZodNumber;
|
|
119
|
+
files: z.ZodArray<z.ZodString>;
|
|
120
|
+
}, z.core.$strip>;
|
|
121
|
+
export type CargoFmtResult = z.infer<typeof CargoFmtResultSchema>;
|
|
122
|
+
/** Zod schema for structured cargo doc output with success flag and warning count. */
|
|
123
|
+
export declare const CargoDocResultSchema: z.ZodObject<{
|
|
124
|
+
success: z.ZodBoolean;
|
|
125
|
+
warnings: z.ZodNumber;
|
|
126
|
+
}, z.core.$strip>;
|
|
127
|
+
export type CargoDocResult = z.infer<typeof CargoDocResultSchema>;
|
|
187
128
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,6GAA6G;AAC7G,eAAO,MAAM,qBAAqB;;;;;;;;;;;;iBAOhC,CAAC;AAEH,oHAAoH;AACpH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;iBAMjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,4GAA4G;AAC5G,eAAO,MAAM,mBAAmB;;;;;;;;iBAI9B,CAAC;AAEH,4FAA4F;AAC5F,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;iBAOhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,+FAA+F;AAC/F,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;iBAKlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,mGAAmG;AACnG,eAAO,MAAM,oBAAoB;;;;;iBAK/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,sDAAsD;AACtD,eAAO,MAAM,uBAAuB;;;iBAGlC,CAAC;AAEH,2EAA2E;AAC3E,eAAO,MAAM,oBAAoB;;;;;;;iBAI/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,gFAAgF;AAChF,eAAO,MAAM,uBAAuB;;;;iBAIlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,0EAA0E;AAC1E,eAAO,MAAM,oBAAoB;;;;iBAI/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,sFAAsF;AACtF,eAAO,MAAM,oBAAoB;;;iBAG/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
package/dist/schemas/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
2
|
+
/** Zod schema for a single Rust compiler diagnostic with file location, severity, and optional lint code. */
|
|
3
3
|
export const CargoDiagnosticSchema = z.object({
|
|
4
4
|
file: z.string(),
|
|
5
5
|
line: z.number(),
|
|
@@ -8,6 +8,7 @@ export const CargoDiagnosticSchema = z.object({
|
|
|
8
8
|
code: z.string().optional(),
|
|
9
9
|
message: z.string(),
|
|
10
10
|
});
|
|
11
|
+
/** Zod schema for structured cargo build output including success status, diagnostics, and error/warning counts. */
|
|
11
12
|
export const CargoBuildResultSchema = z.object({
|
|
12
13
|
success: z.boolean(),
|
|
13
14
|
diagnostics: z.array(CargoDiagnosticSchema),
|
|
@@ -15,12 +16,13 @@ export const CargoBuildResultSchema = z.object({
|
|
|
15
16
|
errors: z.number(),
|
|
16
17
|
warnings: z.number(),
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
+
/** Zod schema for a single cargo test case with name, status (ok/FAILED/ignored), and optional duration. */
|
|
19
20
|
export const CargoTestCaseSchema = z.object({
|
|
20
21
|
name: z.string(),
|
|
21
22
|
status: z.enum(["ok", "FAILED", "ignored"]),
|
|
22
23
|
duration: z.string().optional(),
|
|
23
24
|
});
|
|
25
|
+
/** Zod schema for structured cargo test output with test list, pass/fail/ignored counts. */
|
|
24
26
|
export const CargoTestResultSchema = z.object({
|
|
25
27
|
success: z.boolean(),
|
|
26
28
|
tests: z.array(CargoTestCaseSchema),
|
|
@@ -29,11 +31,46 @@ export const CargoTestResultSchema = z.object({
|
|
|
29
31
|
failed: z.number(),
|
|
30
32
|
ignored: z.number(),
|
|
31
33
|
});
|
|
32
|
-
|
|
34
|
+
/** Zod schema for structured cargo clippy output with diagnostics and error/warning counts. */
|
|
33
35
|
export const CargoClippyResultSchema = z.object({
|
|
34
36
|
diagnostics: z.array(CargoDiagnosticSchema),
|
|
35
37
|
total: z.number(),
|
|
36
38
|
errors: z.number(),
|
|
37
39
|
warnings: z.number(),
|
|
38
40
|
});
|
|
41
|
+
/** Zod schema for structured cargo run output with exit code, stdout, stderr, and success flag. */
|
|
42
|
+
export const CargoRunResultSchema = z.object({
|
|
43
|
+
exitCode: z.number(),
|
|
44
|
+
stdout: z.string(),
|
|
45
|
+
stderr: z.string(),
|
|
46
|
+
success: z.boolean(),
|
|
47
|
+
});
|
|
48
|
+
/** Zod schema for a single added dependency entry. */
|
|
49
|
+
export const CargoAddedPackageSchema = z.object({
|
|
50
|
+
name: z.string(),
|
|
51
|
+
version: z.string(),
|
|
52
|
+
});
|
|
53
|
+
/** Zod schema for structured cargo add output with added packages list. */
|
|
54
|
+
export const CargoAddResultSchema = z.object({
|
|
55
|
+
success: z.boolean(),
|
|
56
|
+
added: z.array(CargoAddedPackageSchema),
|
|
57
|
+
total: z.number(),
|
|
58
|
+
});
|
|
59
|
+
/** Zod schema for structured cargo remove output with removed package names. */
|
|
60
|
+
export const CargoRemoveResultSchema = z.object({
|
|
61
|
+
success: z.boolean(),
|
|
62
|
+
removed: z.array(z.string()),
|
|
63
|
+
total: z.number(),
|
|
64
|
+
});
|
|
65
|
+
/** Zod schema for structured cargo fmt output with changed files list. */
|
|
66
|
+
export const CargoFmtResultSchema = z.object({
|
|
67
|
+
success: z.boolean(),
|
|
68
|
+
filesChanged: z.number(),
|
|
69
|
+
files: z.array(z.string()),
|
|
70
|
+
});
|
|
71
|
+
/** Zod schema for structured cargo doc output with success flag and warning count. */
|
|
72
|
+
export const CargoDocResultSchema = z.object({
|
|
73
|
+
success: z.boolean(),
|
|
74
|
+
warnings: z.number(),
|
|
75
|
+
});
|
|
39
76
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,6GAA6G;AAC7G,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACtD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC,CAAC;AAEH,oHAAoH;AACpH,MAAM,CAAC,MAAM,sBAA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AAG,CAAC,CAAC,MAAM,CAAC;IAC3C,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;CACrB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/tools/add.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,QAoChD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dualOutput, assertNoFlagInjection } from "@paretools/shared";
|
|
3
|
+
import { cargo } from "../lib/cargo-runner.js";
|
|
4
|
+
import { parseCargoAddOutput } from "../lib/parsers.js";
|
|
5
|
+
import { formatCargoAdd } from "../lib/formatters.js";
|
|
6
|
+
import { CargoAddResultSchema } from "../schemas/index.js";
|
|
7
|
+
export function registerAddTool(server) {
|
|
8
|
+
server.registerTool("add", {
|
|
9
|
+
title: "Cargo Add",
|
|
10
|
+
description: "Adds dependencies to a Rust project and returns structured output. Use instead of running `cargo add` in the terminal.",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
path: z.string().optional().describe("Project root path (default: cwd)"),
|
|
13
|
+
packages: z.array(z.string()).describe('Packages to add (e.g. ["serde", "tokio@1.0"])'),
|
|
14
|
+
dev: z.boolean().optional().default(false).describe("Add as dev dependency (--dev)"),
|
|
15
|
+
features: z
|
|
16
|
+
.array(z.string())
|
|
17
|
+
.optional()
|
|
18
|
+
.describe('Features to enable (e.g. ["derive", "full"])'),
|
|
19
|
+
},
|
|
20
|
+
outputSchema: CargoAddResultSchema,
|
|
21
|
+
}, async ({ path, packages, dev, features }) => {
|
|
22
|
+
const cwd = path || process.cwd();
|
|
23
|
+
for (const pkg of packages) {
|
|
24
|
+
assertNoFlagInjection(pkg, "packages");
|
|
25
|
+
}
|
|
26
|
+
const args = ["add", ...packages];
|
|
27
|
+
if (dev)
|
|
28
|
+
args.push("--dev");
|
|
29
|
+
if (features && features.length > 0) {
|
|
30
|
+
args.push("--features", features.join(","));
|
|
31
|
+
}
|
|
32
|
+
const result = await cargo(args, cwd);
|
|
33
|
+
const data = parseCargoAddOutput(result.stdout, result.stderr, result.exitCode);
|
|
34
|
+
return dualOutput(data, formatCargoAdd);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../src/tools/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC/C,MAAM,CAAC,YAAY,CACjB,KAAK,EACL;QACE,KAAK,EAAE,WAAW;QAClB,WAAW,EACT,wHAAwH;QAC1H,WAAW,EAAE;YACX,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;YACxE,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,+CAA+C,CAAC;YACvF,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,+BAA+B,CAAC;YACpF,QAAQ,EAAE,CAAC;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@
|
|
|
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 registerCheckTool(server) {
|
|
8
|
+
server.registerTool("check", {
|
|
9
|
+
title: "Cargo Check",
|
|
10
|
+
description: "Runs cargo check (type check without full build) and returns structured diagnostics. Faster than build for error checking. Use instead of running `cargo check` in the terminal.",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
path: z.string().optional().describe("Project root path (default: cwd)"),
|
|
13
|
+
package: z.string().optional().describe("Package to check in a workspace"),
|
|
14
|
+
},
|
|
15
|
+
outputSchema: CargoBuildResultSchema,
|
|
16
|
+
}, async ({ path, package: pkg }) => {
|
|
17
|
+
const cwd = path || process.cwd();
|
|
18
|
+
const args = ["check", "--message-format=json"];
|
|
19
|
+
if (pkg)
|
|
20
|
+
args.push("-p", pkg);
|
|
21
|
+
const result = await cargo(args, cwd);
|
|
22
|
+
const data = parseCargoBuildJson(result.stdout, result.exitCode);
|
|
23
|
+
return dualOutput(data, formatCargoBuild);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/tools/check.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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dualOutput } from "@paretools/shared";
|
|
3
|
+
import { cargo } from "../lib/cargo-runner.js";
|
|
4
|
+
import { parseCargoDocOutput } from "../lib/parsers.js";
|
|
5
|
+
import { formatCargoDoc } from "../lib/formatters.js";
|
|
6
|
+
import { CargoDocResultSchema } from "../schemas/index.js";
|
|
7
|
+
export function registerDocTool(server) {
|
|
8
|
+
server.registerTool("doc", {
|
|
9
|
+
title: "Cargo Doc",
|
|
10
|
+
description: "Generates Rust documentation and returns structured output with warning count. Use instead of running `cargo doc` in the terminal.",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
path: z.string().optional().describe("Project root path (default: cwd)"),
|
|
13
|
+
open: z
|
|
14
|
+
.boolean()
|
|
15
|
+
.optional()
|
|
16
|
+
.default(false)
|
|
17
|
+
.describe("Open docs in browser after generating"),
|
|
18
|
+
noDeps: z
|
|
19
|
+
.boolean()
|
|
20
|
+
.optional()
|
|
21
|
+
.default(false)
|
|
22
|
+
.describe("Skip building documentation for dependencies (--no-deps)"),
|
|
23
|
+
},
|
|
24
|
+
outputSchema: CargoDocResultSchema,
|
|
25
|
+
}, async ({ path, open, noDeps }) => {
|
|
26
|
+
const cwd = path || process.cwd();
|
|
27
|
+
const args = ["doc"];
|
|
28
|
+
if (noDeps)
|
|
29
|
+
args.push("--no-deps");
|
|
30
|
+
if (open)
|
|
31
|
+
args.push("--open");
|
|
32
|
+
const result = await cargo(args, cwd);
|
|
33
|
+
const data = parseCargoDocOutput(result.stderr, result.exitCode);
|
|
34
|
+
return dualOutput(data, formatCargoDoc);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=doc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doc.js","sourceRoot":"","sources":["../../src/tools/doc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EA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C,IAAI,EAAE,cAAc,CAAC,CAAC;IAC1C,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fmt.d.ts","sourceRoot":"","sources":["../../src/tools/fmt.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,QA2BhD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dualOutput } from "@paretools/shared";
|
|
3
|
+
import { cargo } from "../lib/cargo-runner.js";
|
|
4
|
+
import { parseCargoFmtOutput } from "../lib/parsers.js";
|
|
5
|
+
import { formatCargoFmt } from "../lib/formatters.js";
|
|
6
|
+
import { CargoFmtResultSchema } from "../schemas/index.js";
|
|
7
|
+
export function registerFmtTool(server) {
|
|
8
|
+
server.registerTool("fmt", {
|
|
9
|
+
title: "Cargo Fmt",
|
|
10
|
+
description: "Checks or fixes Rust formatting and returns structured output. Use instead of running `cargo fmt` in the terminal.",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
path: z.string().optional().describe("Project root path (default: cwd)"),
|
|
13
|
+
check: z
|
|
14
|
+
.boolean()
|
|
15
|
+
.optional()
|
|
16
|
+
.default(false)
|
|
17
|
+
.describe("Check only without modifying files (--check)"),
|
|
18
|
+
},
|
|
19
|
+
outputSchema: CargoFmtResultSchema,
|
|
20
|
+
}, async ({ path, check }) => {
|
|
21
|
+
const cwd = path || process.cwd();
|
|
22
|
+
const args = ["fmt"];
|
|
23
|
+
if (check)
|
|
24
|
+
args.push("--check");
|
|
25
|
+
const result = await cargo(args, cwd);
|
|
26
|
+
const data = parseCargoFmtOutput(result.stdout, result.stderr, result.exitCode, !!check);
|
|
27
|
+
return dualOutput(data, formatCargoFmt);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=fmt.js.map
|
|
@@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CAAC,CAAC,KAAK,CAAC,CAAC;QACzF,OAAO,UAAU,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAC1C,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAWzE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,QAUjD"}
|
package/dist/tools/index.js
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import { registerBuildTool } from "./build.js";
|
|
2
2
|
import { registerTestTool } from "./test.js";
|
|
3
3
|
import { registerClippyTool } from "./clippy.js";
|
|
4
|
+
import { registerRunTool } from "./run.js";
|
|
5
|
+
import { registerAddTool } from "./add.js";
|
|
6
|
+
import { registerRemoveTool } from "./remove.js";
|
|
7
|
+
import { registerFmtTool } from "./fmt.js";
|
|
8
|
+
import { registerDocTool } from "./doc.js";
|
|
9
|
+
import { registerCheckTool } from "./check.js";
|
|
4
10
|
export function registerAllTools(server) {
|
|
5
11
|
registerBuildTool(server);
|
|
6
12
|
registerTestTool(server);
|
|
7
13
|
registerClippyTool(server);
|
|
14
|
+
registerRunTool(server);
|
|
15
|
+
registerAddTool(server);
|
|
16
|
+
registerRemoveTool(server);
|
|
17
|
+
registerFmtTool(server);
|
|
18
|
+
registerDocTool(server);
|
|
19
|
+
registerCheckTool(server);
|
|
8
20
|
}
|
|
9
21
|
//# sourceMappingURL=index.js.map
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +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;
|
|
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;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,UAAU,gBAAgB,CAAC,MAAiB;IAChD,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC1B,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACzB,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC3B,eAAe,CAAC,MAAM,CAAC,CAAC;IACxB,eAAe,CAAC,MAAM,CAAC,CAAC;IACxB,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC3B,eAAe,CAAC,MAAM,CAAC,CAAC;IACxB,eAAe,CAAC,MAAM,CAAC,CAAC;IACxB,iBAAiB,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../src/tools/remove.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,QA6BnD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dualOutput, assertNoFlagInjection } from "@paretools/shared";
|
|
3
|
+
import { cargo } from "../lib/cargo-runner.js";
|
|
4
|
+
import { parseCargoRemoveOutput } from "../lib/parsers.js";
|
|
5
|
+
import { formatCargoRemove } from "../lib/formatters.js";
|
|
6
|
+
import { CargoRemoveResultSchema } from "../schemas/index.js";
|
|
7
|
+
export function registerRemoveTool(server) {
|
|
8
|
+
server.registerTool("remove", {
|
|
9
|
+
title: "Cargo Remove",
|
|
10
|
+
description: "Removes dependencies from a Rust project and returns structured output. Use instead of running `cargo remove` in the terminal.",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
path: z.string().optional().describe("Project root path (default: cwd)"),
|
|
13
|
+
packages: z.array(z.string()).describe("Package names to remove"),
|
|
14
|
+
dev: z.boolean().optional().default(false).describe("Remove from dev dependencies (--dev)"),
|
|
15
|
+
},
|
|
16
|
+
outputSchema: CargoRemoveResultSchema,
|
|
17
|
+
}, async ({ path, packages, dev }) => {
|
|
18
|
+
const cwd = path || process.cwd();
|
|
19
|
+
for (const pkg of packages) {
|
|
20
|
+
assertNoFlagInjection(pkg, "packages");
|
|
21
|
+
}
|
|
22
|
+
const args = ["remove", ...packages];
|
|
23
|
+
if (dev)
|
|
24
|
+
args.push("--dev");
|
|
25
|
+
const result = await cargo(args, cwd);
|
|
26
|
+
const data = parseCargoRemoveOutput(result.stdout, result.stderr, result.exitCode);
|
|
27
|
+
return dualOutput(data, formatCargoRemove);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=remove.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.js","sourceRoot":"","sources":["../../src/tools/remove.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,K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AI,EAAE,GAAG,CAAC,CAAC;QACtC,MAAM,IAAI,GAAG,sBAAsB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QACnF,OAAO,UAAU,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;IAC7C,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/tools/run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,QA8BhD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dualOutput } from "@paretools/shared";
|
|
3
|
+
import { cargo } from "../lib/cargo-runner.js";
|
|
4
|
+
import { parseCargoRunOutput } from "../lib/parsers.js";
|
|
5
|
+
import { formatCargoRun } from "../lib/formatters.js";
|
|
6
|
+
import { CargoRunResultSchema } from "../schemas/index.js";
|
|
7
|
+
export function registerRunTool(server) {
|
|
8
|
+
server.registerTool("run", {
|
|
9
|
+
title: "Cargo Run",
|
|
10
|
+
description: "Runs a cargo binary and returns structured output (exit code, stdout, stderr). Use instead of running `cargo run` in the terminal.",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
path: z.string().optional().describe("Project root path (default: cwd)"),
|
|
13
|
+
args: z.array(z.string()).optional().describe("Arguments to pass to the binary (after --)"),
|
|
14
|
+
release: z.boolean().optional().default(false).describe("Run in release mode"),
|
|
15
|
+
package: z.string().optional().describe("Package to run in a workspace"),
|
|
16
|
+
},
|
|
17
|
+
outputSchema: CargoRunResultSchema,
|
|
18
|
+
}, async ({ path, args, release, package: pkg }) => {
|
|
19
|
+
const cwd = path || process.cwd();
|
|
20
|
+
const cargoArgs = ["run"];
|
|
21
|
+
if (release)
|
|
22
|
+
cargoArgs.push("--release");
|
|
23
|
+
if (pkg)
|
|
24
|
+
cargoArgs.push("-p", pkg);
|
|
25
|
+
if (args && args.length > 0) {
|
|
26
|
+
cargoArgs.push("--");
|
|
27
|
+
cargoArgs.push(...args);
|
|
28
|
+
}
|
|
29
|
+
const result = await cargo(cargoArgs, cwd);
|
|
30
|
+
const data = parseCargoRunOutput(result.stdout, result.stderr, result.exitCode);
|
|
31
|
+
return dualOutput(data, formatCargoRun);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/tools/run.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,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC/C,MAAM,CAAC,YAAY,CACjB,KAAK,EACL;QACE,KAAK,EAAE,WAAW;QAClB,WAAW,EACT,oIAAoI;QACtI,WAAW,EAAE;YACX,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;YACxE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4CAA4C,CAAC;YAC3F,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,qBAAqB,CAAC;YAC9E,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;SACzE;QACD,YAAY,EAAE,oBAAoB;KACnC,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE;QAC9C,MAAM,GAAG,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAClC,MAAM,SAAS,GAAG,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,OAAO;YAAE,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACzC,IAAI,GAAG;YAAE,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACnC,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5B,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACrB,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QAC1B,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QAC3C,MAAM,IAAI,GAAG,mBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAChF,OAAO,UAAU,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAC1C,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paretools/cargo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"mcpName": "io.github.Dave-London/cargo",
|
|
5
|
-
"description": "MCP server for Rust cargo (build, test, clippy) with structured, token-efficient output",
|
|
5
|
+
"description": "MCP server for Rust cargo (build, test, clippy, run, add, remove, fmt, doc, check) with structured, token-efficient output",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"mcp",
|
|
9
9
|
"mcp-server",
|
|
10
10
|
"model-context-protocol",
|
|
11
11
|
"structured-output",
|
|
12
|
+
"ai",
|
|
13
|
+
"ai-agent",
|
|
14
|
+
"claude",
|
|
15
|
+
"cursor",
|
|
16
|
+
"copilot",
|
|
17
|
+
"token-efficient",
|
|
18
|
+
"devtools",
|
|
19
|
+
"cli",
|
|
12
20
|
"rust",
|
|
13
21
|
"cargo",
|
|
14
|
-
"clippy"
|
|
22
|
+
"clippy",
|
|
23
|
+
"rustfmt",
|
|
24
|
+
"crate"
|
|
15
25
|
],
|
|
16
26
|
"homepage": "https://github.com/Dave-London/pare/tree/main/packages/server-cargo",
|
|
17
27
|
"engines": {
|
|
18
|
-
"node": ">=
|
|
28
|
+
"node": ">=20"
|
|
19
29
|
},
|
|
20
30
|
"type": "module",
|
|
21
31
|
"bin": {
|
|
@@ -40,13 +50,13 @@
|
|
|
40
50
|
],
|
|
41
51
|
"dependencies": {
|
|
42
52
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
43
|
-
"zod": "^3.
|
|
44
|
-
"@paretools/shared": "0.
|
|
53
|
+
"zod": "^4.3.6",
|
|
54
|
+
"@paretools/shared": "0.5.0"
|
|
45
55
|
},
|
|
46
56
|
"devDependencies": {
|
|
47
|
-
"@types/node": "^
|
|
57
|
+
"@types/node": "^25.2.3",
|
|
48
58
|
"typescript": "^5.7.0",
|
|
49
|
-
"vitest": "^
|
|
59
|
+
"vitest": "^4.0.18",
|
|
50
60
|
"@paretools/tsconfig": "0.0.0"
|
|
51
61
|
},
|
|
52
62
|
"scripts": {
|