@paretools/cargo 0.3.0 → 0.6.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 +46 -11
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/formatters.d.ts +86 -1
- package/dist/lib/formatters.d.ts.map +1 -1
- package/dist/lib/formatters.js +159 -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 +63 -0
- package/dist/tools/add.js.map +1 -0
- package/dist/tools/build.d.ts.map +1 -1
- package/dist/tools/build.js +14 -5
- package/dist/tools/build.js.map +1 -1
- package/dist/tools/check.d.ts +3 -0
- package/dist/tools/check.d.ts.map +1 -0
- package/dist/tools/check.js +41 -0
- package/dist/tools/check.js.map +1 -0
- package/dist/tools/clippy.d.ts.map +1 -1
- package/dist/tools/clippy.js +14 -5
- package/dist/tools/clippy.js.map +1 -1
- package/dist/tools/doc.d.ts +3 -0
- package/dist/tools/doc.d.ts.map +1 -0
- package/dist/tools/doc.js +46 -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 +39 -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 +42 -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 +57 -0
- package/dist/tools/run.js.map +1 -0
- package/dist/tools/test.d.ts.map +1 -1
- package/dist/tools/test.js +21 -6
- package/dist/tools/test.js.map +1 -1
- package/package.json +20 -10
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
|
+
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AO,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,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,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;AAIH,4GAA4G;AAC5G,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC,MAAM,E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";
|
|
2
|
+
import { compactDualOutput, assertNoFlagInjection, INPUT_LIMITS } from "@paretools/shared";
|
|
3
|
+
import { cargo } from "../lib/cargo-runner.js";
|
|
4
|
+
import { parseCargoAddOutput } from "../lib/parsers.js";
|
|
5
|
+
import { formatCargoAdd, compactAddMap, formatAddCompact } 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. " +
|
|
11
|
+
"Use instead of running `cargo add` in the terminal. " +
|
|
12
|
+
"WARNING: Adding crates downloads and compiles third-party code which may include build scripts (build.rs). " +
|
|
13
|
+
"Only add trusted crates. Use dryRun to preview changes before committing.",
|
|
14
|
+
inputSchema: {
|
|
15
|
+
path: z
|
|
16
|
+
.string()
|
|
17
|
+
.max(INPUT_LIMITS.PATH_MAX)
|
|
18
|
+
.optional()
|
|
19
|
+
.describe("Project root path (default: cwd)"),
|
|
20
|
+
packages: z
|
|
21
|
+
.array(z.string().max(INPUT_LIMITS.SHORT_STRING_MAX))
|
|
22
|
+
.max(INPUT_LIMITS.ARRAY_MAX)
|
|
23
|
+
.describe('Packages to add (e.g. ["serde", "tokio@1.0"])'),
|
|
24
|
+
dev: z.boolean().optional().default(false).describe("Add as dev dependency (--dev)"),
|
|
25
|
+
features: z
|
|
26
|
+
.array(z.string().max(INPUT_LIMITS.SHORT_STRING_MAX))
|
|
27
|
+
.max(INPUT_LIMITS.ARRAY_MAX)
|
|
28
|
+
.optional()
|
|
29
|
+
.describe('Features to enable (e.g. ["derive", "full"])'),
|
|
30
|
+
dryRun: z
|
|
31
|
+
.boolean()
|
|
32
|
+
.optional()
|
|
33
|
+
.default(false)
|
|
34
|
+
.describe("Preview what would be added without modifying Cargo.toml (--dry-run)"),
|
|
35
|
+
compact: z
|
|
36
|
+
.boolean()
|
|
37
|
+
.optional()
|
|
38
|
+
.default(true)
|
|
39
|
+
.describe("Auto-compact when structured output exceeds raw CLI tokens. Set false to always get full schema."),
|
|
40
|
+
},
|
|
41
|
+
outputSchema: CargoAddResultSchema,
|
|
42
|
+
}, async ({ path, packages, dev, features, dryRun, compact }) => {
|
|
43
|
+
const cwd = path || process.cwd();
|
|
44
|
+
for (const pkg of packages) {
|
|
45
|
+
assertNoFlagInjection(pkg, "packages");
|
|
46
|
+
}
|
|
47
|
+
for (const f of features ?? []) {
|
|
48
|
+
assertNoFlagInjection(f, "features");
|
|
49
|
+
}
|
|
50
|
+
const args = ["add", ...packages];
|
|
51
|
+
if (dev)
|
|
52
|
+
args.push("--dev");
|
|
53
|
+
if (features && features.length > 0) {
|
|
54
|
+
args.push("--features", features.join(","));
|
|
55
|
+
}
|
|
56
|
+
if (dryRun)
|
|
57
|
+
args.push("--dry-run");
|
|
58
|
+
const result = await cargo(args, cwd);
|
|
59
|
+
const data = parseCargoAddOutput(result.stdout, result.stderr, result.exitCode);
|
|
60
|
+
return compactDualOutput(data, result.stdout + result.stderr, formatCargoAdd, compactAddMap, formatAddCompact, compact === false);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
//# 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,iBAAiB,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC3F,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,MAA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yC,CAAC;AAOzE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,
|
|
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,QAyClD"}
|
package/dist/tools/build.js
CHANGED
|
@@ -1,26 +1,35 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { compactDualOutput, INPUT_LIMITS } from "@paretools/shared";
|
|
3
3
|
import { cargo } from "../lib/cargo-runner.js";
|
|
4
4
|
import { parseCargoBuildJson } from "../lib/parsers.js";
|
|
5
|
-
import { formatCargoBuild } from "../lib/formatters.js";
|
|
5
|
+
import { formatCargoBuild, compactBuildMap, formatBuildCompact } from "../lib/formatters.js";
|
|
6
6
|
import { CargoBuildResultSchema } from "../schemas/index.js";
|
|
7
7
|
export function registerBuildTool(server) {
|
|
8
8
|
server.registerTool("build", {
|
|
9
9
|
title: "Cargo Build",
|
|
10
10
|
description: "Runs cargo build and returns structured diagnostics (file, line, code, severity, message). Use instead of running `cargo build` in the terminal.",
|
|
11
11
|
inputSchema: {
|
|
12
|
-
path: z
|
|
12
|
+
path: z
|
|
13
|
+
.string()
|
|
14
|
+
.max(INPUT_LIMITS.PATH_MAX)
|
|
15
|
+
.optional()
|
|
16
|
+
.describe("Project root path (default: cwd)"),
|
|
13
17
|
release: z.boolean().optional().default(false).describe("Build in release mode"),
|
|
18
|
+
compact: z
|
|
19
|
+
.boolean()
|
|
20
|
+
.optional()
|
|
21
|
+
.default(true)
|
|
22
|
+
.describe("Auto-compact when structured output exceeds raw CLI tokens. Set false to always get full schema."),
|
|
14
23
|
},
|
|
15
24
|
outputSchema: CargoBuildResultSchema,
|
|
16
|
-
}, async ({ path, release }) => {
|
|
25
|
+
}, async ({ path, release, compact }) => {
|
|
17
26
|
const cwd = path || process.cwd();
|
|
18
27
|
const args = ["build", "--message-format=json"];
|
|
19
28
|
if (release)
|
|
20
29
|
args.push("--release");
|
|
21
30
|
const result = await cargo(args, cwd);
|
|
22
31
|
const data = parseCargoBuildJson(result.stdout, result.exitCode);
|
|
23
|
-
return
|
|
32
|
+
return compactDualOutput(data, result.stdout, formatCargoBuild, compactBuildMap, formatBuildCompact, compact === false);
|
|
24
33
|
});
|
|
25
34
|
}
|
|
26
35
|
//# sourceMappingURL=build.js.map
|
package/dist/tools/build.js.map
CHANGED
|
@@ -1 +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,
|
|
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,iBAAiB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC7F,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,kJAAkJ;QACpJ,WAAW,EAAE;YACX,IAAI,EAAE,CAAC;iBACJ,MAAM,EAAE;iBACR,GAAG,CAAC,YAAY,CAAC,QAAQ,CAAC;iBAC1B,QAAQ,EAAE;iBACV,QAAQ,CAAC,kCAAkC,CAAC;YAC/C,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,uBAAuB,CAAC;YAChF,OAAO,EAAE,CAAC;iBACP,OAAO,EAAE;iBACT,QAAQ,EAAE;iBACV,OAAO,CAAC,IAAI,CAAC;iBACb,QAAQ,CACP,kGAAkG,CACnG;SACJ;QACD,YAAY,EAAE,sBAAsB;KACrC,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;QACnC,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,iBAAiB,CACtB,IAAI,EACJ,MAAM,CAAC,MAAM,EACb,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,OAAO,KAAK,KAAK,CAClB,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/tools/check.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,QA+ClD"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { compactDualOutput, assertNoFlagInjection, INPUT_LIMITS } from "@paretools/shared";
|
|
3
|
+
import { cargo } from "../lib/cargo-runner.js";
|
|
4
|
+
import { parseCargoBuildJson } from "../lib/parsers.js";
|
|
5
|
+
import { formatCargoBuild, compactBuildMap, formatBuildCompact } 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
|
|
13
|
+
.string()
|
|
14
|
+
.max(INPUT_LIMITS.PATH_MAX)
|
|
15
|
+
.optional()
|
|
16
|
+
.describe("Project root path (default: cwd)"),
|
|
17
|
+
package: z
|
|
18
|
+
.string()
|
|
19
|
+
.max(INPUT_LIMITS.SHORT_STRING_MAX)
|
|
20
|
+
.optional()
|
|
21
|
+
.describe("Package to check in a workspace"),
|
|
22
|
+
compact: z
|
|
23
|
+
.boolean()
|
|
24
|
+
.optional()
|
|
25
|
+
.default(true)
|
|
26
|
+
.describe("Auto-compact when structured output exceeds raw CLI tokens. Set false to always get full schema."),
|
|
27
|
+
},
|
|
28
|
+
outputSchema: CargoBuildResultSchema,
|
|
29
|
+
}, async ({ path, package: pkg, compact }) => {
|
|
30
|
+
const cwd = path || process.cwd();
|
|
31
|
+
if (pkg)
|
|
32
|
+
assertNoFlagInjection(pkg, "package");
|
|
33
|
+
const args = ["check", "--message-format=json"];
|
|
34
|
+
if (pkg)
|
|
35
|
+
args.push("-p", pkg);
|
|
36
|
+
const result = await cargo(args, cwd);
|
|
37
|
+
const data = parseCargoBuildJson(result.stdout, result.exitCode);
|
|
38
|
+
return compactDualOutput(data, result.stdout, formatCargoBuild, compactBuildMap, formatBuildCompact, compact === false);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":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/C,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,uBAAuB,CAAC,CAAC;QAChD,IAAI,GAAG;YAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAE9B,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,iBAAiB,CACtB,IAAI,EACJ,MAAM,CAAC,MAAM,EACb,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,OAAO,KAAK,KAAK,CAClB,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +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,
|
|
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,QAuCnD"}
|
package/dist/tools/clippy.js
CHANGED
|
@@ -1,23 +1,32 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { compactDualOutput, INPUT_LIMITS } from "@paretools/shared";
|
|
3
3
|
import { cargo } from "../lib/cargo-runner.js";
|
|
4
4
|
import { parseCargoClippyJson } from "../lib/parsers.js";
|
|
5
|
-
import { formatCargoClippy } from "../lib/formatters.js";
|
|
5
|
+
import { formatCargoClippy, compactClippyMap, formatClippyCompact } from "../lib/formatters.js";
|
|
6
6
|
import { CargoClippyResultSchema } from "../schemas/index.js";
|
|
7
7
|
export function registerClippyTool(server) {
|
|
8
8
|
server.registerTool("clippy", {
|
|
9
9
|
title: "Cargo Clippy",
|
|
10
10
|
description: "Runs cargo clippy and returns structured lint diagnostics. Use instead of running `cargo clippy` in the terminal.",
|
|
11
11
|
inputSchema: {
|
|
12
|
-
path: z
|
|
12
|
+
path: z
|
|
13
|
+
.string()
|
|
14
|
+
.max(INPUT_LIMITS.PATH_MAX)
|
|
15
|
+
.optional()
|
|
16
|
+
.describe("Project root path (default: cwd)"),
|
|
17
|
+
compact: z
|
|
18
|
+
.boolean()
|
|
19
|
+
.optional()
|
|
20
|
+
.default(true)
|
|
21
|
+
.describe("Auto-compact when structured output exceeds raw CLI tokens. Set false to always get full schema."),
|
|
13
22
|
},
|
|
14
23
|
outputSchema: CargoClippyResultSchema,
|
|
15
|
-
}, async ({ path }) => {
|
|
24
|
+
}, async ({ path, compact }) => {
|
|
16
25
|
const cwd = path || process.cwd();
|
|
17
26
|
const args = ["clippy", "--message-format=json"];
|
|
18
27
|
const result = await cargo(args, cwd);
|
|
19
28
|
const data = parseCargoClippyJson(result.stdout);
|
|
20
|
-
return
|
|
29
|
+
return compactDualOutput(data, result.stdout, formatCargoClippy, compactClippyMap, formatClippyCompact, compact === false);
|
|
21
30
|
});
|
|
22
31
|
}
|
|
23
32
|
//# sourceMappingURL=clippy.js.map
|
package/dist/tools/clippy.js.map
CHANGED
|
@@ -1 +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,
|
|
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,iBAAiB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CA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