@paretools/go 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/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/go-runner.d.ts +3 -0
- package/dist/lib/go-runner.d.ts.map +1 -0
- package/dist/lib/go-runner.js +5 -0
- package/dist/lib/go-runner.js.map +1 -0
- package/dist/lib/parsers.d.ts +10 -0
- package/dist/lib/parsers.d.ts.map +1 -0
- package/dist/lib/parsers.js +83 -0
- package/dist/lib/parsers.js.map +1 -0
- package/dist/schemas/index.d.ts +181 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +41 -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 +27 -0
- package/dist/tools/build.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 +31 -0
- package/dist/tools/test.js.map +1 -0
- package/dist/tools/vet.d.ts +3 -0
- package/dist/tools/vet.d.ts.map +1 -0
- package/dist/tools/vet.js +27 -0
- package/dist/tools/vet.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/go",
|
|
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,eAAe;IACrB,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,5 @@
|
|
|
1
|
+
import type { GoBuildResult, GoTestResult, GoVetResult } from "../schemas/index.js";
|
|
2
|
+
export declare function formatGoBuild(data: GoBuildResult): string;
|
|
3
|
+
export declare function formatGoTest(data: GoTestResult): string;
|
|
4
|
+
export declare function formatGoVet(data: GoVetResult): 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,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEpF,wBAAgB,aAAa,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CASzD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAUvD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CASrD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export function formatGoBuild(data) {
|
|
2
|
+
if (data.success)
|
|
3
|
+
return "go build: success.";
|
|
4
|
+
const lines = [`go build: ${data.total} errors`];
|
|
5
|
+
for (const e of data.errors) {
|
|
6
|
+
const col = e.column ? `:${e.column}` : "";
|
|
7
|
+
lines.push(` ${e.file}:${e.line}${col}: ${e.message}`);
|
|
8
|
+
}
|
|
9
|
+
return lines.join("\n");
|
|
10
|
+
}
|
|
11
|
+
export function formatGoTest(data) {
|
|
12
|
+
const status = data.success ? "ok" : "FAIL";
|
|
13
|
+
const lines = [
|
|
14
|
+
`${status}: ${data.passed} passed, ${data.failed} failed, ${data.skipped} skipped`,
|
|
15
|
+
];
|
|
16
|
+
for (const t of data.tests) {
|
|
17
|
+
const elapsed = t.elapsed !== undefined ? ` (${t.elapsed}s)` : "";
|
|
18
|
+
lines.push(` ${t.status.padEnd(4)} ${t.package}/${t.name}${elapsed}`);
|
|
19
|
+
}
|
|
20
|
+
return lines.join("\n");
|
|
21
|
+
}
|
|
22
|
+
export function formatGoVet(data) {
|
|
23
|
+
if (data.total === 0)
|
|
24
|
+
return "go vet: no issues found.";
|
|
25
|
+
const lines = [`go vet: ${data.total} issues`];
|
|
26
|
+
for (const d of data.diagnostics) {
|
|
27
|
+
const col = d.column ? `:${d.column}` : "";
|
|
28
|
+
lines.push(` ${d.file}:${d.line}${col}: ${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,aAAa,CAAC,IAAmB;IAC/C,IAAI,IAAI,CAAC,OAAO;QAAE,OAAO,oBAAoB,CAAC;IAE9C,MAAM,KAAK,GAAG,CAAC,aAAa,IAAI,CAAC,KAAK,SAAS,CAAC,CAAC;IACjD,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QAC5B,MAAM,GAAG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CAAC,WAAW,EAAE,CAAC;QACjC,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3C,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,GAAG,GAAG,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"go-runner.d.ts","sourceRoot":"","sources":["../../src/lib/go-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":"go-runner.js","sourceRoot":"","sources":["../../src/lib/go-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,IAAI,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { GoBuildResult, GoTestResult, GoVetResult } from "../schemas/index.js";
|
|
2
|
+
export declare function parseGoBuildOutput(stdout: string, stderr: string, exitCode: number): GoBuildResult;
|
|
3
|
+
/**
|
|
4
|
+
* Parses `go test -json` output.
|
|
5
|
+
* Each line is a JSON object: { Time, Action, Package, Test, Elapsed, Output }
|
|
6
|
+
* Actions: "run", "pause", "cont", "pass", "fail", "skip", "output"
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseGoTestJson(stdout: string, exitCode: number): GoTestResult;
|
|
9
|
+
export declare function parseGoVetOutput(stdout: string, stderr: string): GoVetResult;
|
|
10
|
+
//# 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,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAKpF,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,aAAa,CAsBf;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,YAAY,CAgD9E;AAYD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,CAkB5E"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// go build errors: file.go:line:col: message
|
|
2
|
+
const GO_ERROR_RE = /^(.+?\.go):(\d+)(?::(\d+))?: (.+)$/;
|
|
3
|
+
export function parseGoBuildOutput(stdout, stderr, exitCode) {
|
|
4
|
+
const output = stdout + "\n" + stderr;
|
|
5
|
+
const lines = output.split("\n");
|
|
6
|
+
const errors = [];
|
|
7
|
+
for (const line of lines) {
|
|
8
|
+
const match = line.match(GO_ERROR_RE);
|
|
9
|
+
if (match) {
|
|
10
|
+
errors.push({
|
|
11
|
+
file: match[1],
|
|
12
|
+
line: parseInt(match[2], 10),
|
|
13
|
+
column: match[3] ? parseInt(match[3], 10) : undefined,
|
|
14
|
+
message: match[4],
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
success: exitCode === 0,
|
|
20
|
+
errors,
|
|
21
|
+
total: errors.length,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Parses `go test -json` output.
|
|
26
|
+
* Each line is a JSON object: { Time, Action, Package, Test, Elapsed, Output }
|
|
27
|
+
* Actions: "run", "pause", "cont", "pass", "fail", "skip", "output"
|
|
28
|
+
*/
|
|
29
|
+
export function parseGoTestJson(stdout, exitCode) {
|
|
30
|
+
const lines = stdout.trim().split("\n").filter(Boolean);
|
|
31
|
+
const testMap = new Map();
|
|
32
|
+
for (const line of lines) {
|
|
33
|
+
let event;
|
|
34
|
+
try {
|
|
35
|
+
event = JSON.parse(line);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
if (!event.Test)
|
|
41
|
+
continue;
|
|
42
|
+
const key = `${event.Package}/${event.Test}`;
|
|
43
|
+
if (event.Action === "pass" || event.Action === "fail" || event.Action === "skip") {
|
|
44
|
+
testMap.set(key, {
|
|
45
|
+
package: event.Package,
|
|
46
|
+
name: event.Test,
|
|
47
|
+
status: event.Action,
|
|
48
|
+
elapsed: event.Elapsed,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const tests = Array.from(testMap.values());
|
|
53
|
+
const passed = tests.filter((t) => t.status === "pass").length;
|
|
54
|
+
const failed = tests.filter((t) => t.status === "fail").length;
|
|
55
|
+
const skipped = tests.filter((t) => t.status === "skip").length;
|
|
56
|
+
return {
|
|
57
|
+
success: exitCode === 0,
|
|
58
|
+
tests,
|
|
59
|
+
total: tests.length,
|
|
60
|
+
passed,
|
|
61
|
+
failed,
|
|
62
|
+
skipped,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
// go vet output: file.go:line:col: message
|
|
66
|
+
export function parseGoVetOutput(stdout, stderr) {
|
|
67
|
+
const output = stdout + "\n" + stderr;
|
|
68
|
+
const lines = output.split("\n");
|
|
69
|
+
const diagnostics = [];
|
|
70
|
+
for (const line of lines) {
|
|
71
|
+
const match = line.match(GO_ERROR_RE);
|
|
72
|
+
if (match) {
|
|
73
|
+
diagnostics.push({
|
|
74
|
+
file: match[1],
|
|
75
|
+
line: parseInt(match[2], 10),
|
|
76
|
+
column: match[3] ? parseInt(match[3], 10) : undefined,
|
|
77
|
+
message: match[4],
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return { diagnostics, total: diagnostics.length };
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=parsers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parsers.js","sourceRoot":"","sources":["../../src/lib/parsers.ts"],"names":[],"mappings":"AAEA,6CAA6C;AAC7C,MAAM,WAAW,GAAG,oCAAoC,CAAC;AAEzD,MAAM,UAAU,kBAAkB,CAChC,MAAc,EACd,MAAc,EACd,QAAgB;IAEhB,MAAM,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC;IACtC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,MAAM,GAAuE,EAAE,CAAC;IAEtF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACtC,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;gBACd,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;gBAC5B,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;gBACrD,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;aAClB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;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AW,CAAC,MAAM,EAAE,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const GoBuildErrorSchema: z.ZodObject<{
|
|
3
|
+
file: z.ZodString;
|
|
4
|
+
line: z.ZodNumber;
|
|
5
|
+
column: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
message: z.ZodString;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
file: string;
|
|
9
|
+
line: number;
|
|
10
|
+
message: string;
|
|
11
|
+
column?: number | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
file: string;
|
|
14
|
+
line: number;
|
|
15
|
+
message: string;
|
|
16
|
+
column?: number | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const GoBuildResultSchema: z.ZodObject<{
|
|
19
|
+
success: z.ZodBoolean;
|
|
20
|
+
errors: z.ZodArray<z.ZodObject<{
|
|
21
|
+
file: z.ZodString;
|
|
22
|
+
line: z.ZodNumber;
|
|
23
|
+
column: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
message: z.ZodString;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
file: string;
|
|
27
|
+
line: number;
|
|
28
|
+
message: string;
|
|
29
|
+
column?: number | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
file: string;
|
|
32
|
+
line: number;
|
|
33
|
+
message: string;
|
|
34
|
+
column?: number | undefined;
|
|
35
|
+
}>, "many">;
|
|
36
|
+
total: z.ZodNumber;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
success: boolean;
|
|
39
|
+
errors: {
|
|
40
|
+
file: string;
|
|
41
|
+
line: number;
|
|
42
|
+
message: string;
|
|
43
|
+
column?: number | undefined;
|
|
44
|
+
}[];
|
|
45
|
+
total: number;
|
|
46
|
+
}, {
|
|
47
|
+
success: boolean;
|
|
48
|
+
errors: {
|
|
49
|
+
file: string;
|
|
50
|
+
line: number;
|
|
51
|
+
message: string;
|
|
52
|
+
column?: number | undefined;
|
|
53
|
+
}[];
|
|
54
|
+
total: number;
|
|
55
|
+
}>;
|
|
56
|
+
export type GoBuildResult = z.infer<typeof GoBuildResultSchema>;
|
|
57
|
+
export declare const GoTestCaseSchema: z.ZodObject<{
|
|
58
|
+
package: z.ZodString;
|
|
59
|
+
name: z.ZodString;
|
|
60
|
+
status: z.ZodEnum<["pass", "fail", "skip"]>;
|
|
61
|
+
elapsed: z.ZodOptional<z.ZodNumber>;
|
|
62
|
+
output: z.ZodOptional<z.ZodString>;
|
|
63
|
+
}, "strip", z.ZodTypeAny, {
|
|
64
|
+
status: "pass" | "fail" | "skip";
|
|
65
|
+
package: string;
|
|
66
|
+
name: string;
|
|
67
|
+
elapsed?: number | undefined;
|
|
68
|
+
output?: string | undefined;
|
|
69
|
+
}, {
|
|
70
|
+
status: "pass" | "fail" | "skip";
|
|
71
|
+
package: string;
|
|
72
|
+
name: string;
|
|
73
|
+
elapsed?: number | undefined;
|
|
74
|
+
output?: string | undefined;
|
|
75
|
+
}>;
|
|
76
|
+
export declare const GoTestResultSchema: z.ZodObject<{
|
|
77
|
+
success: z.ZodBoolean;
|
|
78
|
+
tests: z.ZodArray<z.ZodObject<{
|
|
79
|
+
package: z.ZodString;
|
|
80
|
+
name: z.ZodString;
|
|
81
|
+
status: z.ZodEnum<["pass", "fail", "skip"]>;
|
|
82
|
+
elapsed: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
output: z.ZodOptional<z.ZodString>;
|
|
84
|
+
}, "strip", z.ZodTypeAny, {
|
|
85
|
+
status: "pass" | "fail" | "skip";
|
|
86
|
+
package: string;
|
|
87
|
+
name: string;
|
|
88
|
+
elapsed?: number | undefined;
|
|
89
|
+
output?: string | undefined;
|
|
90
|
+
}, {
|
|
91
|
+
status: "pass" | "fail" | "skip";
|
|
92
|
+
package: string;
|
|
93
|
+
name: string;
|
|
94
|
+
elapsed?: number | undefined;
|
|
95
|
+
output?: string | undefined;
|
|
96
|
+
}>, "many">;
|
|
97
|
+
total: z.ZodNumber;
|
|
98
|
+
passed: z.ZodNumber;
|
|
99
|
+
failed: z.ZodNumber;
|
|
100
|
+
skipped: z.ZodNumber;
|
|
101
|
+
}, "strip", z.ZodTypeAny, {
|
|
102
|
+
success: boolean;
|
|
103
|
+
total: number;
|
|
104
|
+
tests: {
|
|
105
|
+
status: "pass" | "fail" | "skip";
|
|
106
|
+
package: string;
|
|
107
|
+
name: string;
|
|
108
|
+
elapsed?: number | undefined;
|
|
109
|
+
output?: string | undefined;
|
|
110
|
+
}[];
|
|
111
|
+
passed: number;
|
|
112
|
+
failed: number;
|
|
113
|
+
skipped: number;
|
|
114
|
+
}, {
|
|
115
|
+
success: boolean;
|
|
116
|
+
total: number;
|
|
117
|
+
tests: {
|
|
118
|
+
status: "pass" | "fail" | "skip";
|
|
119
|
+
package: string;
|
|
120
|
+
name: string;
|
|
121
|
+
elapsed?: number | undefined;
|
|
122
|
+
output?: string | undefined;
|
|
123
|
+
}[];
|
|
124
|
+
passed: number;
|
|
125
|
+
failed: number;
|
|
126
|
+
skipped: number;
|
|
127
|
+
}>;
|
|
128
|
+
export type GoTestResult = z.infer<typeof GoTestResultSchema>;
|
|
129
|
+
export declare const GoVetDiagnosticSchema: z.ZodObject<{
|
|
130
|
+
file: z.ZodString;
|
|
131
|
+
line: z.ZodNumber;
|
|
132
|
+
column: z.ZodOptional<z.ZodNumber>;
|
|
133
|
+
message: z.ZodString;
|
|
134
|
+
}, "strip", z.ZodTypeAny, {
|
|
135
|
+
file: string;
|
|
136
|
+
line: number;
|
|
137
|
+
message: string;
|
|
138
|
+
column?: number | undefined;
|
|
139
|
+
}, {
|
|
140
|
+
file: string;
|
|
141
|
+
line: number;
|
|
142
|
+
message: string;
|
|
143
|
+
column?: number | undefined;
|
|
144
|
+
}>;
|
|
145
|
+
export declare const GoVetResultSchema: z.ZodObject<{
|
|
146
|
+
diagnostics: z.ZodArray<z.ZodObject<{
|
|
147
|
+
file: z.ZodString;
|
|
148
|
+
line: z.ZodNumber;
|
|
149
|
+
column: z.ZodOptional<z.ZodNumber>;
|
|
150
|
+
message: z.ZodString;
|
|
151
|
+
}, "strip", z.ZodTypeAny, {
|
|
152
|
+
file: string;
|
|
153
|
+
line: number;
|
|
154
|
+
message: string;
|
|
155
|
+
column?: number | undefined;
|
|
156
|
+
}, {
|
|
157
|
+
file: string;
|
|
158
|
+
line: number;
|
|
159
|
+
message: string;
|
|
160
|
+
column?: number | undefined;
|
|
161
|
+
}>, "many">;
|
|
162
|
+
total: z.ZodNumber;
|
|
163
|
+
}, "strip", z.ZodTypeAny, {
|
|
164
|
+
total: number;
|
|
165
|
+
diagnostics: {
|
|
166
|
+
file: string;
|
|
167
|
+
line: number;
|
|
168
|
+
message: string;
|
|
169
|
+
column?: number | undefined;
|
|
170
|
+
}[];
|
|
171
|
+
}, {
|
|
172
|
+
total: number;
|
|
173
|
+
diagnostics: {
|
|
174
|
+
file: string;
|
|
175
|
+
line: number;
|
|
176
|
+
message: string;
|
|
177
|
+
column?: number | undefined;
|
|
178
|
+
}[];
|
|
179
|
+
}>;
|
|
180
|
+
export type GoVetResult = z.infer<typeof GoVetResultSchema>;
|
|
181
|
+
//# 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,kBAAkB;;;;;;;;;;;;;;;EAK7B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAGhE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;EAM3B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAG9D,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;EAKhC,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// go build
|
|
3
|
+
export const GoBuildErrorSchema = z.object({
|
|
4
|
+
file: z.string(),
|
|
5
|
+
line: z.number(),
|
|
6
|
+
column: z.number().optional(),
|
|
7
|
+
message: z.string(),
|
|
8
|
+
});
|
|
9
|
+
export const GoBuildResultSchema = z.object({
|
|
10
|
+
success: z.boolean(),
|
|
11
|
+
errors: z.array(GoBuildErrorSchema),
|
|
12
|
+
total: z.number(),
|
|
13
|
+
});
|
|
14
|
+
// go test -json
|
|
15
|
+
export const GoTestCaseSchema = z.object({
|
|
16
|
+
package: z.string(),
|
|
17
|
+
name: z.string(),
|
|
18
|
+
status: z.enum(["pass", "fail", "skip"]),
|
|
19
|
+
elapsed: z.number().optional(),
|
|
20
|
+
output: z.string().optional(),
|
|
21
|
+
});
|
|
22
|
+
export const GoTestResultSchema = z.object({
|
|
23
|
+
success: z.boolean(),
|
|
24
|
+
tests: z.array(GoTestCaseSchema),
|
|
25
|
+
total: z.number(),
|
|
26
|
+
passed: z.number(),
|
|
27
|
+
failed: z.number(),
|
|
28
|
+
skipped: z.number(),
|
|
29
|
+
});
|
|
30
|
+
// go vet
|
|
31
|
+
export const GoVetDiagnosticSchema = z.object({
|
|
32
|
+
file: z.string(),
|
|
33
|
+
line: z.number(),
|
|
34
|
+
column: z.number().optional(),
|
|
35
|
+
message: z.string(),
|
|
36
|
+
});
|
|
37
|
+
export const GoVetResultSchema = z.object({
|
|
38
|
+
diagnostics: z.array(GoVetDiagnosticSchema),
|
|
39
|
+
total: z.number(),
|
|
40
|
+
});
|
|
41
|
+
//# 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,WAAW;AACX,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC;IACnC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;CAClB,CAAC,CAAC;AAIH,gBAAgB;AAChB,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC9B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC;IAChC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC,CAAC;AAIH,SAAS;AACT,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,CAAC,QAAQ,EAAE;IAC7B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC;IAC3C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;CAClB,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,27 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dualOutput } from "@paretools/shared";
|
|
3
|
+
import { goCmd } from "../lib/go-runner.js";
|
|
4
|
+
import { parseGoBuildOutput } from "../lib/parsers.js";
|
|
5
|
+
import { formatGoBuild } from "../lib/formatters.js";
|
|
6
|
+
import { GoBuildResultSchema } from "../schemas/index.js";
|
|
7
|
+
export function registerBuildTool(server) {
|
|
8
|
+
server.registerTool("build", {
|
|
9
|
+
title: "Go Build",
|
|
10
|
+
description: "Runs go build and returns structured error list (file, line, column, message)",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
path: z.string().optional().describe("Project root path (default: cwd)"),
|
|
13
|
+
packages: z
|
|
14
|
+
.array(z.string())
|
|
15
|
+
.optional()
|
|
16
|
+
.default(["./..."])
|
|
17
|
+
.describe("Packages to build (default: ./...)"),
|
|
18
|
+
},
|
|
19
|
+
outputSchema: GoBuildResultSchema,
|
|
20
|
+
}, async ({ path, packages }) => {
|
|
21
|
+
const cwd = path || process.cwd();
|
|
22
|
+
const result = await goCmd(["build", ...(packages || ["./..."])], cwd);
|
|
23
|
+
const data = parseGoBuildOutput(result.stdout, result.stderr, result.exitCode);
|
|
24
|
+
return dualOutput(data, formatGoBuild);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//# 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,qBAAqB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,MAAM,UAAU,iBAAiB,CAAC,MAAiB;IACjD,MAAM,CAAC,YAAY,CACjB,OAAO,EACP;QACE,KAAK,EAAE,UAAU;QACjB,WAAW,EAAE,+EAA+E;QAC5F,WAAW,EAAE;YACX,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;YACxE,QAAQ,EAAE,CAAC;iBACR,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;iBACjB,QAAQ,EAAE;iBACV,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC;iBAClB,QAAQ,CAAC,oCAAoC,CAAC;SAClD;QACD,YAAY,EAAE,mBAAmB;KAClC,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC3B,MAAM,GAAG,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAClC,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,QAAQ,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACvE,MAAM,IAAI,GAAG,kBAAkB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC/E,OAAO,UAAU,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IACzC,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 { registerVetTool } from "./vet.js";
|
|
4
|
+
export function registerAllTools(server) {
|
|
5
|
+
registerBuildTool(server);
|
|
6
|
+
registerTestTool(server);
|
|
7
|
+
registerVetTool(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,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,UAAU,gBAAgB,CAAC,MAAiB;IAChD,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC1B,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACzB,eAAe,CAAC,MAAM,CAAC,CAAC;AAC1B,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,QA4BjD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dualOutput } from "@paretools/shared";
|
|
3
|
+
import { goCmd } from "../lib/go-runner.js";
|
|
4
|
+
import { parseGoTestJson } from "../lib/parsers.js";
|
|
5
|
+
import { formatGoTest } from "../lib/formatters.js";
|
|
6
|
+
import { GoTestResultSchema } from "../schemas/index.js";
|
|
7
|
+
export function registerTestTool(server) {
|
|
8
|
+
server.registerTool("test", {
|
|
9
|
+
title: "Go Test",
|
|
10
|
+
description: "Runs go test and returns structured test results (name, status, package, elapsed)",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
path: z.string().optional().describe("Project root path (default: cwd)"),
|
|
13
|
+
packages: z
|
|
14
|
+
.array(z.string())
|
|
15
|
+
.optional()
|
|
16
|
+
.default(["./..."])
|
|
17
|
+
.describe("Packages to test (default: ./...)"),
|
|
18
|
+
run: z.string().optional().describe("Test name filter regex"),
|
|
19
|
+
},
|
|
20
|
+
outputSchema: GoTestResultSchema,
|
|
21
|
+
}, async ({ path, packages, run: runFilter }) => {
|
|
22
|
+
const cwd = path || process.cwd();
|
|
23
|
+
const args = ["test", "-json", ...(packages || ["./..."])];
|
|
24
|
+
if (runFilter)
|
|
25
|
+
args.push("-run", runFilter);
|
|
26
|
+
const result = await goCmd(args, cwd);
|
|
27
|
+
const data = parseGoTestJson(result.stdout, result.exitCode);
|
|
28
|
+
return dualOutput(data, formatGoTest);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# 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,qBAAqB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,UAAU,gBAAgB,CAAC,MAAiB;IAChD,MAAM,CAAC,YAAY,CACjB,MAAM,EACN;QACE,KAAK,EAAE,SAAS;QAChB,WAAW,EACT,mFAAmF;QACrF,WAAW,EAAE;YACX,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;YACxE,QAAQ,EAAE,CAAC;iBACR,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;iBACjB,QAAQ,EAAE;iBACV,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC;iBAClB,QAAQ,CAAC,mCAAmC,CAAC;YAChD,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;SAC9D;QACD,YAAY,EAAE,kBAAkB;KACjC,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE;QAC3C,MAAM,GAAG,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAClC,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,QAAQ,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC3D,IAAI,SAAS;YAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAE5C,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACtC,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC7D,OAAO,UAAU,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IACxC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vet.d.ts","sourceRoot":"","sources":["../../src/tools/vet.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,QAuBhD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dualOutput } from "@paretools/shared";
|
|
3
|
+
import { goCmd } from "../lib/go-runner.js";
|
|
4
|
+
import { parseGoVetOutput } from "../lib/parsers.js";
|
|
5
|
+
import { formatGoVet } from "../lib/formatters.js";
|
|
6
|
+
import { GoVetResultSchema } from "../schemas/index.js";
|
|
7
|
+
export function registerVetTool(server) {
|
|
8
|
+
server.registerTool("vet", {
|
|
9
|
+
title: "Go Vet",
|
|
10
|
+
description: "Runs go vet and returns structured static analysis diagnostics",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
path: z.string().optional().describe("Project root path (default: cwd)"),
|
|
13
|
+
packages: z
|
|
14
|
+
.array(z.string())
|
|
15
|
+
.optional()
|
|
16
|
+
.default(["./..."])
|
|
17
|
+
.describe("Packages to vet (default: ./...)"),
|
|
18
|
+
},
|
|
19
|
+
outputSchema: GoVetResultSchema,
|
|
20
|
+
}, async ({ path, packages }) => {
|
|
21
|
+
const cwd = path || process.cwd();
|
|
22
|
+
const result = await goCmd(["vet", ...(packages || ["./..."])], cwd);
|
|
23
|
+
const data = parseGoVetOutput(result.stdout, result.stderr);
|
|
24
|
+
return dualOutput(data, formatGoVet);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=vet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vet.js","sourceRoot":"","sources":["../../src/tools/vet.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,qBAAqB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC/C,MAAM,CAAC,YAAY,CACjB,KAAK,EACL;QACE,KAAK,EAAE,QAAQ;QACf,WAAW,EAAE,gEAAgE;QAC7E,WAAW,EAAE;YACX,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;YACxE,QAAQ,EAAE,CAAC;iBACR,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;iBACjB,QAAQ,EAAE;iBACV,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC;iBAClB,QAAQ,CAAC,kCAAkC,CAAC;SAChD;QACD,YAAY,EAAE,iBAAiB;KAChC,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC3B,MAAM,GAAG,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAClC,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,QAAQ,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACrE,MAAM,IAAI,GAAG,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QAC5D,OAAO,UAAU,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IACvC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@paretools/go",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "MCP server for Go tools (build, test, vet) with structured, token-efficient output",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"pare-go": "./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-go"
|
|
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
|
+
}
|