@paretools/go 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 +44 -11
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/formatters.d.ts +68 -1
- package/dist/lib/formatters.d.ts.map +1 -1
- package/dist/lib/formatters.js +120 -3
- package/dist/lib/formatters.js.map +1 -1
- package/dist/lib/go-runner.d.ts +1 -0
- package/dist/lib/go-runner.d.ts.map +1 -1
- package/dist/lib/go-runner.js +3 -0
- package/dist/lib/go-runner.js.map +1 -1
- package/dist/lib/parsers.d.ts +11 -1
- package/dist/lib/parsers.d.ts.map +1 -1
- package/dist/lib/parsers.js +51 -2
- package/dist/lib/parsers.js.map +1 -1
- package/dist/schemas/index.d.ts +55 -138
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +32 -6
- package/dist/schemas/index.js.map +1 -1
- package/dist/tools/build.d.ts.map +1 -1
- package/dist/tools/build.js +20 -6
- package/dist/tools/build.js.map +1 -1
- package/dist/tools/fmt.d.ts +3 -0
- package/dist/tools/fmt.d.ts.map +1 -0
- package/dist/tools/fmt.js +48 -0
- package/dist/tools/fmt.js.map +1 -0
- package/dist/tools/generate.d.ts +3 -0
- package/dist/tools/generate.d.ts.map +1 -0
- package/dist/tools/generate.js +44 -0
- package/dist/tools/generate.js.map +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +8 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/mod-tidy.d.ts +3 -0
- package/dist/tools/mod-tidy.d.ts.map +1 -0
- package/dist/tools/mod-tidy.js +32 -0
- package/dist/tools/mod-tidy.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 +60 -0
- package/dist/tools/run.js.map +1 -0
- package/dist/tools/test.d.ts.map +1 -1
- package/dist/tools/test.js +26 -7
- package/dist/tools/test.js.map +1 -1
- package/dist/tools/vet.d.ts.map +1 -1
- package/dist/tools/vet.js +20 -6
- package/dist/tools/vet.js.map +1 -1
- package/package.json +20 -10
package/README.md
CHANGED
|
@@ -1,23 +1,38 @@
|
|
|
1
1
|
# @paretools/go
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@paretools/go)
|
|
4
|
+
[](https://github.com/Dave-London/Pare/blob/main/LICENSE)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
**Structured, token-efficient Go tool output for AI agents.** Typed diagnostics from go build, test, vet, and more.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
| ------- | --------------------------------------------- |
|
|
9
|
-
| `build` | Build errors (file, line, column, message) |
|
|
10
|
-
| `test` | Test results (name, status, package, elapsed) |
|
|
11
|
-
| `vet` | Static analysis diagnostics |
|
|
8
|
+
Part of the [Pare](https://github.com/Dave-London/Pare) suite of MCP servers.
|
|
12
9
|
|
|
13
|
-
##
|
|
10
|
+
## Tools (7)
|
|
11
|
+
|
|
12
|
+
| Tool | Description |
|
|
13
|
+
| ---------- | ------------------------------------------------- |
|
|
14
|
+
| `build` | Build errors (file, line, column, message) |
|
|
15
|
+
| `test` | Test results (name, status, package, elapsed) |
|
|
16
|
+
| `vet` | Static analysis diagnostics |
|
|
17
|
+
| `run` | Run a Go program with structured output |
|
|
18
|
+
| `mod-tidy` | Add missing and remove unused module dependencies |
|
|
19
|
+
| `fmt` | Check or fix Go source formatting via gofmt |
|
|
20
|
+
| `generate` | Run go generate directives in source files |
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx -y @paretools/go
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Add to your MCP client config:
|
|
14
29
|
|
|
15
30
|
```json
|
|
16
31
|
{
|
|
17
32
|
"mcpServers": {
|
|
18
33
|
"pare-go": {
|
|
19
34
|
"command": "npx",
|
|
20
|
-
"args": ["@paretools/go"]
|
|
35
|
+
"args": ["-y", "@paretools/go"]
|
|
21
36
|
}
|
|
22
37
|
}
|
|
23
38
|
}
|
|
@@ -44,11 +59,29 @@ Pare MCP server for **Go**. Returns structured output from go build, test, and v
|
|
|
44
59
|
}
|
|
45
60
|
```
|
|
46
61
|
|
|
62
|
+
## All Pare Servers (62 tools)
|
|
63
|
+
|
|
64
|
+
| Package | Tools | Wraps |
|
|
65
|
+
| -------------------------------------------------------------------- | --------------------------------------------------------------------------- | ---------------------------------- |
|
|
66
|
+
| [@paretools/git](https://www.npmjs.com/package/@paretools/git) | status, log, diff, branch, show, add, commit, push, pull, checkout | git |
|
|
67
|
+
| [@paretools/test](https://www.npmjs.com/package/@paretools/test) | run, coverage | pytest, jest, vitest, mocha |
|
|
68
|
+
| [@paretools/npm](https://www.npmjs.com/package/@paretools/npm) | install, audit, outdated, list, run, test, init | npm |
|
|
69
|
+
| [@paretools/build](https://www.npmjs.com/package/@paretools/build) | tsc, build, esbuild, vite-build, webpack | tsc, esbuild, vite, webpack |
|
|
70
|
+
| [@paretools/lint](https://www.npmjs.com/package/@paretools/lint) | lint, format-check, prettier-format, biome-check, biome-format | eslint, prettier, biome |
|
|
71
|
+
| [@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 |
|
|
72
|
+
| [@paretools/docker](https://www.npmjs.com/package/@paretools/docker) | ps, build, logs, images, run, exec, compose-up, compose-down, pull | docker, docker compose |
|
|
73
|
+
| [@paretools/cargo](https://www.npmjs.com/package/@paretools/cargo) | build, test, clippy, run, add, remove, fmt, doc, check | cargo |
|
|
74
|
+
| **@paretools/go** | build, test, vet, run, mod-tidy, fmt, generate | go, gofmt |
|
|
75
|
+
|
|
76
|
+
## Compatible Clients
|
|
77
|
+
|
|
78
|
+
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/)
|
|
79
|
+
|
|
47
80
|
## Links
|
|
48
81
|
|
|
49
|
-
- [Pare monorepo](https://github.com/Dave-London/
|
|
82
|
+
- [Pare monorepo](https://github.com/Dave-London/Pare)
|
|
50
83
|
- [MCP protocol](https://modelcontextprotocol.io)
|
|
51
84
|
|
|
52
85
|
## License
|
|
53
86
|
|
|
54
|
-
[MIT](https://github.com/Dave-London/
|
|
87
|
+
[MIT](https://github.com/Dave-London/Pare/blob/main/LICENSE)
|
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/go", version: "0.2.0" }, {
|
|
6
|
-
instructions: "Structured Go toolchain operations (build, test, vet). Use instead of running go commands via bash. Returns typed JSON with structured compiler errors, test results,
|
|
6
|
+
instructions: "Structured Go toolchain operations (build, test, vet, run, mod-tidy, fmt, generate). Use instead of running go commands via bash. Returns typed JSON with structured compiler errors, test results, vet warnings, run output, and more.",
|
|
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,eAAe,EAAE,OAAO,EAAE,OAAO,EAAE,EAC3C;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,eAAe,EAAE,OAAO,EAAE,OAAO,EAAE,EAC3C;IACE,YAAY,EACV,yOAAyO;CAC5O,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,72 @@
|
|
|
1
|
-
import type { GoBuildResult, GoTestResult, GoVetResult } from "../schemas/index.js";
|
|
1
|
+
import type { GoBuildResult, GoTestResult, GoVetResult, GoRunResult, GoModTidyResult, GoFmtResult, GoGenerateResult } from "../schemas/index.js";
|
|
2
|
+
/** Formats structured go build results into a human-readable error summary. */
|
|
2
3
|
export declare function formatGoBuild(data: GoBuildResult): string;
|
|
4
|
+
/** Formats structured go test results into a human-readable test summary with pass/fail counts. */
|
|
3
5
|
export declare function formatGoTest(data: GoTestResult): string;
|
|
6
|
+
/** Formats structured go vet results into a human-readable diagnostic listing. */
|
|
4
7
|
export declare function formatGoVet(data: GoVetResult): string;
|
|
8
|
+
/** Formats structured go run results into a human-readable output summary. */
|
|
9
|
+
export declare function formatGoRun(data: GoRunResult): string;
|
|
10
|
+
/** Formats structured go mod tidy results into a human-readable summary. */
|
|
11
|
+
export declare function formatGoModTidy(data: GoModTidyResult): string;
|
|
12
|
+
/** Formats structured gofmt results into a human-readable file listing. */
|
|
13
|
+
export declare function formatGoFmt(data: GoFmtResult): string;
|
|
14
|
+
/** Formats structured go generate results into a human-readable summary. */
|
|
15
|
+
export declare function formatGoGenerate(data: GoGenerateResult): string;
|
|
16
|
+
/** Compact build: success, error/warning count. Drop full error details. */
|
|
17
|
+
export interface GoBuildCompact {
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
success: boolean;
|
|
20
|
+
total: number;
|
|
21
|
+
}
|
|
22
|
+
export declare function compactBuildMap(data: GoBuildResult): GoBuildCompact;
|
|
23
|
+
export declare function formatBuildCompact(data: GoBuildCompact): string;
|
|
24
|
+
/** Compact test: total, passed, failed, skipped. Drop individual test details. */
|
|
25
|
+
export interface GoTestCompact {
|
|
26
|
+
[key: string]: unknown;
|
|
27
|
+
success: boolean;
|
|
28
|
+
total: number;
|
|
29
|
+
passed: number;
|
|
30
|
+
failed: number;
|
|
31
|
+
skipped: number;
|
|
32
|
+
}
|
|
33
|
+
export declare function compactTestMap(data: GoTestResult): GoTestCompact;
|
|
34
|
+
export declare function formatTestCompact(data: GoTestCompact): string;
|
|
35
|
+
/** Compact vet: diagnostic count only. Drop individual file/line/message entries. */
|
|
36
|
+
export interface GoVetCompact {
|
|
37
|
+
[key: string]: unknown;
|
|
38
|
+
total: number;
|
|
39
|
+
}
|
|
40
|
+
export declare function compactVetMap(data: GoVetResult): GoVetCompact;
|
|
41
|
+
export declare function formatVetCompact(data: GoVetCompact): string;
|
|
42
|
+
/** Compact fmt: success, file count. Drop individual file list. */
|
|
43
|
+
export interface GoFmtCompact {
|
|
44
|
+
[key: string]: unknown;
|
|
45
|
+
success: boolean;
|
|
46
|
+
filesChanged: number;
|
|
47
|
+
}
|
|
48
|
+
export declare function compactFmtMap(data: GoFmtResult): GoFmtCompact;
|
|
49
|
+
export declare function formatFmtCompact(data: GoFmtCompact): string;
|
|
50
|
+
/** Compact run: exitCode, success. Drop stdout/stderr. */
|
|
51
|
+
export interface GoRunCompact {
|
|
52
|
+
[key: string]: unknown;
|
|
53
|
+
exitCode: number;
|
|
54
|
+
success: boolean;
|
|
55
|
+
}
|
|
56
|
+
export declare function compactRunMap(data: GoRunResult): GoRunCompact;
|
|
57
|
+
export declare function formatRunCompact(data: GoRunCompact): string;
|
|
58
|
+
/** Compact generate: success only. Drop full output. */
|
|
59
|
+
export interface GoGenerateCompact {
|
|
60
|
+
[key: string]: unknown;
|
|
61
|
+
success: boolean;
|
|
62
|
+
}
|
|
63
|
+
export declare function compactGenerateMap(data: GoGenerateResult): GoGenerateCompact;
|
|
64
|
+
export declare function formatGenerateCompact(data: GoGenerateCompact): string;
|
|
65
|
+
/** Compact mod-tidy: success only. Drop summary text. */
|
|
66
|
+
export interface GoModTidyCompact {
|
|
67
|
+
[key: string]: unknown;
|
|
68
|
+
success: boolean;
|
|
69
|
+
}
|
|
70
|
+
export declare function compactModTidyMap(data: GoModTidyResult): GoModTidyCompact;
|
|
71
|
+
export declare function formatModTidyCompact(data: GoModTidyCompact): string;
|
|
5
72
|
//# 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,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../src/lib/formatters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,WAAW,EACX,WAAW,EACX,eAAe,EACf,WAAW,EACX,gBAAgB,EACjB,MAAM,qBAAqB,CAAC;AAE7B,+EAA+E;AAC/E,wBAAgB,aAAa,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CASzD;AAED,mGAAmG;AACnG,wBAAgB,YAAY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 @@
|
|
|
1
|
+
/** Formats structured go build results into a human-readable error summary. */
|
|
1
2
|
export function formatGoBuild(data) {
|
|
2
3
|
if (data.success)
|
|
3
4
|
return "go build: success.";
|
|
4
5
|
const lines = [`go build: ${data.total} errors`];
|
|
5
|
-
for (const e of data.errors) {
|
|
6
|
+
for (const e of data.errors ?? []) {
|
|
6
7
|
const col = e.column ? `:${e.column}` : "";
|
|
7
8
|
lines.push(` ${e.file}:${e.line}${col}: ${e.message}`);
|
|
8
9
|
}
|
|
9
10
|
return lines.join("\n");
|
|
10
11
|
}
|
|
12
|
+
/** Formats structured go test results into a human-readable test summary with pass/fail counts. */
|
|
11
13
|
export function formatGoTest(data) {
|
|
12
14
|
const status = data.success ? "ok" : "FAIL";
|
|
13
15
|
const lines = [
|
|
14
16
|
`${status}: ${data.passed} passed, ${data.failed} failed, ${data.skipped} skipped`,
|
|
15
17
|
];
|
|
16
|
-
for (const t of data.tests) {
|
|
18
|
+
for (const t of data.tests ?? []) {
|
|
17
19
|
const elapsed = t.elapsed !== undefined ? ` (${t.elapsed}s)` : "";
|
|
18
20
|
lines.push(` ${t.status.padEnd(4)} ${t.package}/${t.name}${elapsed}`);
|
|
19
21
|
}
|
|
20
22
|
return lines.join("\n");
|
|
21
23
|
}
|
|
24
|
+
/** Formats structured go vet results into a human-readable diagnostic listing. */
|
|
22
25
|
export function formatGoVet(data) {
|
|
23
26
|
if (data.total === 0)
|
|
24
27
|
return "go vet: no issues found.";
|
|
25
28
|
const lines = [`go vet: ${data.total} issues`];
|
|
26
|
-
for (const d of data.diagnostics) {
|
|
29
|
+
for (const d of data.diagnostics ?? []) {
|
|
27
30
|
const col = d.column ? `:${d.column}` : "";
|
|
28
31
|
lines.push(` ${d.file}:${d.line}${col}: ${d.message}`);
|
|
29
32
|
}
|
|
30
33
|
return lines.join("\n");
|
|
31
34
|
}
|
|
35
|
+
/** Formats structured go run results into a human-readable output summary. */
|
|
36
|
+
export function formatGoRun(data) {
|
|
37
|
+
const lines = [];
|
|
38
|
+
if (data.success) {
|
|
39
|
+
lines.push("go run: success.");
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
lines.push(`go run: exit code ${data.exitCode}.`);
|
|
43
|
+
}
|
|
44
|
+
if (data.stdout)
|
|
45
|
+
lines.push(data.stdout);
|
|
46
|
+
if (data.stderr)
|
|
47
|
+
lines.push(data.stderr);
|
|
48
|
+
return lines.join("\n");
|
|
49
|
+
}
|
|
50
|
+
/** Formats structured go mod tidy results into a human-readable summary. */
|
|
51
|
+
export function formatGoModTidy(data) {
|
|
52
|
+
if (data.success)
|
|
53
|
+
return `go mod tidy: ${data.summary}`;
|
|
54
|
+
return `go mod tidy: FAIL\n ${data.summary}`;
|
|
55
|
+
}
|
|
56
|
+
/** Formats structured gofmt results into a human-readable file listing. */
|
|
57
|
+
export function formatGoFmt(data) {
|
|
58
|
+
if (data.success && data.filesChanged === 0)
|
|
59
|
+
return "gofmt: all files formatted.";
|
|
60
|
+
const lines = [`gofmt: ${data.filesChanged} files`];
|
|
61
|
+
for (const f of data.files ?? []) {
|
|
62
|
+
lines.push(` ${f}`);
|
|
63
|
+
}
|
|
64
|
+
return lines.join("\n");
|
|
65
|
+
}
|
|
66
|
+
/** Formats structured go generate results into a human-readable summary. */
|
|
67
|
+
export function formatGoGenerate(data) {
|
|
68
|
+
if (data.success) {
|
|
69
|
+
return data.output ? `go generate: success.\n${data.output}` : "go generate: success.";
|
|
70
|
+
}
|
|
71
|
+
return `go generate: FAIL\n${data.output}`;
|
|
72
|
+
}
|
|
73
|
+
export function compactBuildMap(data) {
|
|
74
|
+
return {
|
|
75
|
+
success: data.success,
|
|
76
|
+
total: data.total,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export function formatBuildCompact(data) {
|
|
80
|
+
if (data.success)
|
|
81
|
+
return "go build: success.";
|
|
82
|
+
return `go build: ${data.total} errors`;
|
|
83
|
+
}
|
|
84
|
+
export function compactTestMap(data) {
|
|
85
|
+
return {
|
|
86
|
+
success: data.success,
|
|
87
|
+
total: data.total,
|
|
88
|
+
passed: data.passed,
|
|
89
|
+
failed: data.failed,
|
|
90
|
+
skipped: data.skipped,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export function formatTestCompact(data) {
|
|
94
|
+
const status = data.success ? "ok" : "FAIL";
|
|
95
|
+
return `${status}: ${data.passed} passed, ${data.failed} failed, ${data.skipped} skipped`;
|
|
96
|
+
}
|
|
97
|
+
export function compactVetMap(data) {
|
|
98
|
+
return {
|
|
99
|
+
total: data.total,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export function formatVetCompact(data) {
|
|
103
|
+
if (data.total === 0)
|
|
104
|
+
return "go vet: no issues found.";
|
|
105
|
+
return `go vet: ${data.total} issues`;
|
|
106
|
+
}
|
|
107
|
+
export function compactFmtMap(data) {
|
|
108
|
+
return {
|
|
109
|
+
success: data.success,
|
|
110
|
+
filesChanged: data.filesChanged,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
export function formatFmtCompact(data) {
|
|
114
|
+
if (data.success && data.filesChanged === 0)
|
|
115
|
+
return "gofmt: all files formatted.";
|
|
116
|
+
return `gofmt: ${data.filesChanged} files`;
|
|
117
|
+
}
|
|
118
|
+
export function compactRunMap(data) {
|
|
119
|
+
return {
|
|
120
|
+
exitCode: data.exitCode,
|
|
121
|
+
success: data.success,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
export function formatRunCompact(data) {
|
|
125
|
+
if (data.success)
|
|
126
|
+
return "go run: success.";
|
|
127
|
+
return `go run: exit code ${data.exitCode}.`;
|
|
128
|
+
}
|
|
129
|
+
export function compactGenerateMap(data) {
|
|
130
|
+
return {
|
|
131
|
+
success: data.success,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
export function formatGenerateCompact(data) {
|
|
135
|
+
if (data.success)
|
|
136
|
+
return "go generate: success.";
|
|
137
|
+
return "go generate: FAIL";
|
|
138
|
+
}
|
|
139
|
+
export function compactModTidyMap(data) {
|
|
140
|
+
return {
|
|
141
|
+
success: data.success,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
export function formatModTidyCompact(data) {
|
|
145
|
+
if (data.success)
|
|
146
|
+
return "go mod tidy: success.";
|
|
147
|
+
return "go mod tidy: FAIL";
|
|
148
|
+
}
|
|
32
149
|
//# 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":"AAUA,+EAA+E;AAC/E,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,IAAI,EAAE,EAAE,CAAC;QAClC,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;AAED,mGAAmG;AACnG,MAAM,UAAU,YAAY,CAAC,IAAkB;IAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;IAC5C,MAAM,KAAK,GAAG;QACZ,GAAG,MAAM,KAAK,IAAI,CAAC,MAAM,YAAY,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,EAAO,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAExD,wBAAsB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAG5E"}
|
|
1
|
+
{"version":3,"file":"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,CAG5E;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAE/E"}
|
package/dist/lib/go-runner.js
CHANGED
|
@@ -3,4 +3,7 @@ export async function goCmd(args, cwd) {
|
|
|
3
3
|
// go build/test can take minutes for large projects
|
|
4
4
|
return run("go", args, { cwd, timeout: 300_000 });
|
|
5
5
|
}
|
|
6
|
+
export async function gofmtCmd(args, cwd) {
|
|
7
|
+
return run("gofmt", args, { cwd, timeout: 120_000 });
|
|
8
|
+
}
|
|
6
9
|
//# sourceMappingURL=go-runner.js.map
|
|
@@ -1 +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,oDAAoD;IACpD,OAAO,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;AACpD,CAAC"}
|
|
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,oDAAoD;IACpD,OAAO,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,IAAc,EAAE,GAAY;IACzD,OAAO,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;AACvD,CAAC"}
|
package/dist/lib/parsers.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { GoBuildResult, GoTestResult, GoVetResult } from "../schemas/index.js";
|
|
1
|
+
import type { GoBuildResult, GoTestResult, GoVetResult, GoRunResult, GoModTidyResult, GoFmtResult, GoGenerateResult } from "../schemas/index.js";
|
|
2
|
+
/** Parses `go build` stderr output into structured error data with file locations. */
|
|
2
3
|
export declare function parseGoBuildOutput(stdout: string, stderr: string, exitCode: number): GoBuildResult;
|
|
3
4
|
/**
|
|
4
5
|
* Parses `go test -json` output.
|
|
@@ -6,5 +7,14 @@ export declare function parseGoBuildOutput(stdout: string, stderr: string, exitC
|
|
|
6
7
|
* Actions: "run", "pause", "cont", "pass", "fail", "skip", "output"
|
|
7
8
|
*/
|
|
8
9
|
export declare function parseGoTestJson(stdout: string, exitCode: number): GoTestResult;
|
|
10
|
+
/** Parses `go vet` output into structured diagnostics with file locations and messages. */
|
|
9
11
|
export declare function parseGoVetOutput(stdout: string, stderr: string): GoVetResult;
|
|
12
|
+
/** Parses `go run` output into structured result with stdout, stderr, and exit code. */
|
|
13
|
+
export declare function parseGoRunOutput(stdout: string, stderr: string, exitCode: number): GoRunResult;
|
|
14
|
+
/** Parses `go mod tidy` output into structured result with success status and summary. */
|
|
15
|
+
export declare function parseGoModTidyOutput(stdout: string, stderr: string, exitCode: number): GoModTidyResult;
|
|
16
|
+
/** Parses `gofmt -l` or `gofmt -w` output into structured result with file list. */
|
|
17
|
+
export declare function parseGoFmtOutput(stdout: string, stderr: string, exitCode: number, checkMode: boolean): GoFmtResult;
|
|
18
|
+
/** Parses `go generate` output into structured result with success status and output text. */
|
|
19
|
+
export declare function parseGoGenerateOutput(stdout: string, stderr: string, exitCode: number): GoGenerateResult;
|
|
10
20
|
//# 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,aAAa,EACb,YAAY,EACZ,WAAW,EACX,WAAW,EACX,eAAe,EACf,WAAW,EACX,gBAAgB,EACjB,MAAM,qBAAqB,CAAC;AAI7B,sFAAsF;AACtF,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;AAWD,2FAA2F;AAC3F,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,CAkB5E;AAED,wFAAwF;AACxF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,WAAW,CAO9F;AAED,0FAA0F;AAC1F,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,eAAe,CAcjB;AAED,oFAAoF;AACpF,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,OAAO,GACjB,WAAW,CAiBb;AAED,8FAA8F;AAC9F,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,gBAAgB,CAMlB"}
|
package/dist/lib/parsers.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// go build errors: file.go:line:col: message
|
|
2
1
|
const GO_ERROR_RE = /^(.+?\.go):(\d+)(?::(\d+))?: (.+)$/;
|
|
2
|
+
/** Parses `go build` stderr output into structured error data with file locations. */
|
|
3
3
|
export function parseGoBuildOutput(stdout, stderr, exitCode) {
|
|
4
4
|
const output = stdout + "\n" + stderr;
|
|
5
5
|
const lines = output.split("\n");
|
|
@@ -62,7 +62,7 @@ export function parseGoTestJson(stdout, exitCode) {
|
|
|
62
62
|
skipped,
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
/** Parses `go vet` output into structured diagnostics with file locations and messages. */
|
|
66
66
|
export function parseGoVetOutput(stdout, stderr) {
|
|
67
67
|
const output = stdout + "\n" + stderr;
|
|
68
68
|
const lines = output.split("\n");
|
|
@@ -80,4 +80,53 @@ export function parseGoVetOutput(stdout, stderr) {
|
|
|
80
80
|
}
|
|
81
81
|
return { diagnostics, total: diagnostics.length };
|
|
82
82
|
}
|
|
83
|
+
/** Parses `go run` output into structured result with stdout, stderr, and exit code. */
|
|
84
|
+
export function parseGoRunOutput(stdout, stderr, exitCode) {
|
|
85
|
+
return {
|
|
86
|
+
exitCode,
|
|
87
|
+
stdout: stdout.trimEnd(),
|
|
88
|
+
stderr: stderr.trimEnd(),
|
|
89
|
+
success: exitCode === 0,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/** Parses `go mod tidy` output into structured result with success status and summary. */
|
|
93
|
+
export function parseGoModTidyOutput(stdout, stderr, exitCode) {
|
|
94
|
+
if (exitCode === 0) {
|
|
95
|
+
const combined = (stdout + "\n" + stderr).trim();
|
|
96
|
+
return {
|
|
97
|
+
success: true,
|
|
98
|
+
summary: combined || "go.mod and go.sum are already tidy.",
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
const combined = (stderr + "\n" + stdout).trim();
|
|
102
|
+
return {
|
|
103
|
+
success: false,
|
|
104
|
+
summary: combined || "go mod tidy failed.",
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/** Parses `gofmt -l` or `gofmt -w` output into structured result with file list. */
|
|
108
|
+
export function parseGoFmtOutput(stdout, stderr, exitCode, checkMode) {
|
|
109
|
+
// In check mode (-l), stdout lists files that need formatting (one per line).
|
|
110
|
+
// In fix mode (-w), stdout is typically empty (files are rewritten in place).
|
|
111
|
+
// stderr may contain error messages.
|
|
112
|
+
const output = checkMode ? stdout : stdout;
|
|
113
|
+
const files = output
|
|
114
|
+
.split("\n")
|
|
115
|
+
.map((f) => f.trim())
|
|
116
|
+
.filter(Boolean);
|
|
117
|
+
const hasErrors = exitCode !== 0 || (checkMode && files.length > 0);
|
|
118
|
+
return {
|
|
119
|
+
success: !hasErrors,
|
|
120
|
+
filesChanged: files.length,
|
|
121
|
+
files,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
/** Parses `go generate` output into structured result with success status and output text. */
|
|
125
|
+
export function parseGoGenerateOutput(stdout, stderr, exitCode) {
|
|
126
|
+
const combined = (stdout + "\n" + stderr).trim();
|
|
127
|
+
return {
|
|
128
|
+
success: exitCode === 0,
|
|
129
|
+
output: combined,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
83
132
|
//# sourceMappingURL=parsers.js.map
|
package/dist/lib/parsers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parsers.js","sourceRoot":"","sources":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