@paretools/build 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/build-runner.d.ts +4 -0
- package/dist/lib/build-runner.d.ts.map +1 -0
- package/dist/lib/build-runner.js +8 -0
- package/dist/lib/build-runner.js.map +1 -0
- package/dist/lib/formatters.d.ts +4 -0
- package/dist/lib/formatters.d.ts.map +1 -0
- package/dist/lib/formatters.js +23 -0
- package/dist/lib/formatters.js.map +1 -0
- package/dist/lib/parsers.d.ts +4 -0
- package/dist/lib/parsers.d.ts.map +1 -0
- package/dist/lib/parsers.js +51 -0
- package/dist/lib/parsers.js.map +1 -0
- package/dist/schemas/index.d.ts +97 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +23 -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 +29 -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 +7 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/tsc.d.ts +3 -0
- package/dist/tools/tsc.d.ts.map +1 -0
- package/dist/tools/tsc.js +33 -0
- package/dist/tools/tsc.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/build",
|
|
7
|
+
version: "0.1.0",
|
|
8
|
+
});
|
|
9
|
+
registerAllTools(server);
|
|
10
|
+
const transport = new StdioServerTransport();
|
|
11
|
+
await server.connect(transport);
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;IAC3B,IAAI,EAAE,kBAAkB;IACxB,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC;AAEH,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAEzB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type RunResult } from "@paretools/shared";
|
|
2
|
+
export declare function tsc(args: string[], cwd?: string): Promise<RunResult>;
|
|
3
|
+
export declare function runBuildCommand(cmd: string, args: string[], cwd?: string): Promise<RunResult>;
|
|
4
|
+
//# sourceMappingURL=build-runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-runner.d.ts","sourceRoot":"","sources":["../../src/lib/build-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAExD,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAE1E;AAED,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,SAAS,CAAC,CAEpB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { run } from "@paretools/shared";
|
|
2
|
+
export async function tsc(args, cwd) {
|
|
3
|
+
return run("npx", ["tsc", ...args], { cwd });
|
|
4
|
+
}
|
|
5
|
+
export async function runBuildCommand(cmd, args, cwd) {
|
|
6
|
+
return run(cmd, args, { cwd });
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=build-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-runner.js","sourceRoot":"","sources":["../../src/lib/build-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAkB,MAAM,mBAAmB,CAAC;AAExD,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,IAAc,EAAE,GAAY;IACpD,OAAO,GAAG,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,GAAW,EACX,IAAc,EACd,GAAY;IAEZ,OAAO,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../src/lib/formatters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElE,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAQjD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAY5D"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export function formatTsc(data) {
|
|
2
|
+
if (data.success && data.total === 0)
|
|
3
|
+
return "TypeScript: no errors found.";
|
|
4
|
+
const lines = [`TypeScript: ${data.errors} errors, ${data.warnings} warnings`];
|
|
5
|
+
for (const d of data.diagnostics) {
|
|
6
|
+
lines.push(` ${d.file}:${d.line}:${d.column} ${d.severity} TS${d.code}: ${d.message}`);
|
|
7
|
+
}
|
|
8
|
+
return lines.join("\n");
|
|
9
|
+
}
|
|
10
|
+
export function formatBuildCommand(data) {
|
|
11
|
+
if (data.success) {
|
|
12
|
+
const parts = [`Build succeeded in ${data.duration}s`];
|
|
13
|
+
if (data.warnings.length)
|
|
14
|
+
parts.push(`${data.warnings.length} warnings`);
|
|
15
|
+
return parts.join(", ");
|
|
16
|
+
}
|
|
17
|
+
const lines = [`Build failed (${data.duration}s)`];
|
|
18
|
+
for (const err of data.errors) {
|
|
19
|
+
lines.push(` ${err}`);
|
|
20
|
+
}
|
|
21
|
+
return lines.join("\n");
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=formatters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/lib/formatters.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,SAAS,CAAC,IAAe;IACvC,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,KAAK,CAAC;QAAE,OAAO,8BAA8B,CAAC;IAE5E,MAAM,KAAK,GAAG,CAAC,eAAe,IAAI,CAAC,MAAM,YAAY,IAAI,CAAC,QAAQ,WAAW,CAAC,CAAC;IAC/E,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;QACjC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,QAAQ,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IAC1F,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,IAAiB;IAClD,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,MAAM,KAAK,GAAG,CAAC,sBAAsB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QACvD,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM;YAAE,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,WAAW,CAAC,CAAC;QACzE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,MAAM,KAAK,GAAG,CAAC,iBAAiB,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC;IACnD,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QAC9B,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TscResult, BuildResult } from "../schemas/index.js";
|
|
2
|
+
export declare function parseTscOutput(stdout: string, stderr: string, exitCode: number): TscResult;
|
|
3
|
+
export declare function parseBuildCommandOutput(stdout: string, stderr: string, exitCode: number, duration: number): BuildResult;
|
|
4
|
+
//# 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,SAAS,EAAiB,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAKjF,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,CA6B1F;AAED,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,WAAW,CAsBb"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// tsc output format: file(line,col): error TSxxxx: message
|
|
2
|
+
const TSC_DIAGNOSTIC_RE = /^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS(\d+):\s+(.+)$/;
|
|
3
|
+
export function parseTscOutput(stdout, stderr, exitCode) {
|
|
4
|
+
const output = stdout + "\n" + stderr;
|
|
5
|
+
const lines = output.split("\n");
|
|
6
|
+
const diagnostics = [];
|
|
7
|
+
for (const line of lines) {
|
|
8
|
+
const match = line.match(TSC_DIAGNOSTIC_RE);
|
|
9
|
+
if (match) {
|
|
10
|
+
diagnostics.push({
|
|
11
|
+
file: match[1],
|
|
12
|
+
line: parseInt(match[2], 10),
|
|
13
|
+
column: parseInt(match[3], 10),
|
|
14
|
+
code: parseInt(match[5], 10),
|
|
15
|
+
severity: match[4],
|
|
16
|
+
message: match[6],
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const errors = diagnostics.filter((d) => d.severity === "error").length;
|
|
21
|
+
const warnings = diagnostics.filter((d) => d.severity === "warning").length;
|
|
22
|
+
return {
|
|
23
|
+
success: exitCode === 0,
|
|
24
|
+
diagnostics,
|
|
25
|
+
total: diagnostics.length,
|
|
26
|
+
errors,
|
|
27
|
+
warnings,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export function parseBuildCommandOutput(stdout, stderr, exitCode, duration) {
|
|
31
|
+
const output = stdout + "\n" + stderr;
|
|
32
|
+
const lines = output.split("\n").filter(Boolean);
|
|
33
|
+
const errors = [];
|
|
34
|
+
const warnings = [];
|
|
35
|
+
for (const line of lines) {
|
|
36
|
+
const lower = line.toLowerCase();
|
|
37
|
+
if (lower.includes("error") && !lower.includes("0 error")) {
|
|
38
|
+
errors.push(line.trim());
|
|
39
|
+
}
|
|
40
|
+
else if (lower.includes("warn") && !lower.includes("0 warn")) {
|
|
41
|
+
warnings.push(line.trim());
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
success: exitCode === 0,
|
|
46
|
+
duration,
|
|
47
|
+
errors,
|
|
48
|
+
warnings,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=par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
|
6
|
+
code: z.ZodNumber;
|
|
7
|
+
severity: z.ZodEnum<["error", "warning"]>;
|
|
8
|
+
message: z.ZodString;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
file: string;
|
|
11
|
+
line: number;
|
|
12
|
+
column: number;
|
|
13
|
+
code: number;
|
|
14
|
+
severity: "error" | "warning";
|
|
15
|
+
message: string;
|
|
16
|
+
}, {
|
|
17
|
+
file: string;
|
|
18
|
+
line: number;
|
|
19
|
+
column: number;
|
|
20
|
+
code: number;
|
|
21
|
+
severity: "error" | "warning";
|
|
22
|
+
message: string;
|
|
23
|
+
}>;
|
|
24
|
+
export declare const TscResultSchema: z.ZodObject<{
|
|
25
|
+
success: z.ZodBoolean;
|
|
26
|
+
diagnostics: z.ZodArray<z.ZodObject<{
|
|
27
|
+
file: z.ZodString;
|
|
28
|
+
line: z.ZodNumber;
|
|
29
|
+
column: z.ZodNumber;
|
|
30
|
+
code: z.ZodNumber;
|
|
31
|
+
severity: z.ZodEnum<["error", "warning"]>;
|
|
32
|
+
message: z.ZodString;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
file: string;
|
|
35
|
+
line: number;
|
|
36
|
+
column: number;
|
|
37
|
+
code: number;
|
|
38
|
+
severity: "error" | "warning";
|
|
39
|
+
message: string;
|
|
40
|
+
}, {
|
|
41
|
+
file: string;
|
|
42
|
+
line: number;
|
|
43
|
+
column: number;
|
|
44
|
+
code: number;
|
|
45
|
+
severity: "error" | "warning";
|
|
46
|
+
message: string;
|
|
47
|
+
}>, "many">;
|
|
48
|
+
total: z.ZodNumber;
|
|
49
|
+
errors: z.ZodNumber;
|
|
50
|
+
warnings: z.ZodNumber;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
success: boolean;
|
|
53
|
+
diagnostics: {
|
|
54
|
+
file: string;
|
|
55
|
+
line: number;
|
|
56
|
+
column: number;
|
|
57
|
+
code: number;
|
|
58
|
+
severity: "error" | "warning";
|
|
59
|
+
message: string;
|
|
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
|
+
code: number;
|
|
71
|
+
severity: "error" | "warning";
|
|
72
|
+
message: string;
|
|
73
|
+
}[];
|
|
74
|
+
total: number;
|
|
75
|
+
errors: number;
|
|
76
|
+
warnings: number;
|
|
77
|
+
}>;
|
|
78
|
+
export type TscResult = z.infer<typeof TscResultSchema>;
|
|
79
|
+
export type TscDiagnostic = z.infer<typeof TscDiagnosticSchema>;
|
|
80
|
+
export declare const BuildResultSchema: z.ZodObject<{
|
|
81
|
+
success: z.ZodBoolean;
|
|
82
|
+
duration: z.ZodNumber;
|
|
83
|
+
errors: z.ZodArray<z.ZodString, "many">;
|
|
84
|
+
warnings: z.ZodArray<z.ZodString, "many">;
|
|
85
|
+
}, "strip", z.ZodTypeAny, {
|
|
86
|
+
success: boolean;
|
|
87
|
+
errors: string[];
|
|
88
|
+
warnings: string[];
|
|
89
|
+
duration: number;
|
|
90
|
+
}, {
|
|
91
|
+
success: boolean;
|
|
92
|
+
errors: string[];
|
|
93
|
+
warnings: string[];
|
|
94
|
+
duration: number;
|
|
95
|
+
}>;
|
|
96
|
+
export type BuildResult = z.infer<typeof BuildResultSchema>;
|
|
97
|
+
//# 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;AAExB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;EAO9B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AACxD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;EAK5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const TscDiagnosticSchema = z.object({
|
|
3
|
+
file: z.string(),
|
|
4
|
+
line: z.number(),
|
|
5
|
+
column: z.number(),
|
|
6
|
+
code: z.number(),
|
|
7
|
+
severity: z.enum(["error", "warning"]),
|
|
8
|
+
message: z.string(),
|
|
9
|
+
});
|
|
10
|
+
export const TscResultSchema = z.object({
|
|
11
|
+
success: z.boolean(),
|
|
12
|
+
diagnostics: z.array(TscDiagnosticSchema),
|
|
13
|
+
total: z.number(),
|
|
14
|
+
errors: z.number(),
|
|
15
|
+
warnings: z.number(),
|
|
16
|
+
});
|
|
17
|
+
export const BuildResultSchema = z.object({
|
|
18
|
+
success: z.boolean(),
|
|
19
|
+
duration: z.number(),
|
|
20
|
+
errors: z.array(z.string()),
|
|
21
|
+
warnings: z.array(z.string()),
|
|
22
|
+
});
|
|
23
|
+
//# 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,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IACtC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC;IACzC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;CACrB,CAAC,CAAC;AAKH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC3B,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC9B,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,QA2BlD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dualOutput } from "@paretools/shared";
|
|
3
|
+
import { runBuildCommand } from "../lib/build-runner.js";
|
|
4
|
+
import { parseBuildCommandOutput } from "../lib/parsers.js";
|
|
5
|
+
import { formatBuildCommand } from "../lib/formatters.js";
|
|
6
|
+
import { BuildResultSchema } from "../schemas/index.js";
|
|
7
|
+
export function registerBuildTool(server) {
|
|
8
|
+
server.registerTool("build", {
|
|
9
|
+
title: "Run Build",
|
|
10
|
+
description: "Runs a build command and returns structured success/failure with errors and warnings",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
command: z.string().describe("Build command to run (e.g., 'npm', 'npx', 'pnpm')"),
|
|
13
|
+
args: z
|
|
14
|
+
.array(z.string())
|
|
15
|
+
.default([])
|
|
16
|
+
.describe("Arguments for the build command (e.g., ['run', 'build'])"),
|
|
17
|
+
path: z.string().optional().describe("Working directory (default: cwd)"),
|
|
18
|
+
},
|
|
19
|
+
outputSchema: BuildResultSchema,
|
|
20
|
+
}, async ({ command, args, path }) => {
|
|
21
|
+
const cwd = path || process.cwd();
|
|
22
|
+
const start = Date.now();
|
|
23
|
+
const result = await runBuildCommand(command, args || [], cwd);
|
|
24
|
+
const duration = Math.round((Date.now() - start) / 100) / 10;
|
|
25
|
+
const data = parseBuildCommandOutput(result.stdout, result.stderr, result.exitCode, duration);
|
|
26
|
+
return dualOutput(data, formatBuildCommand);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//# 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,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,UAAU,iBAAiB,CAAC,MAAiB;IACj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AAE,MAAM,yCAAyC,CAAC;AAIzE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,QAGjD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,UAAU,gBAAgB,CAAC,MAAiB;IAChD,eAAe,CAAC,MAAM,CAAC,CAAC;IACxB,iBAAiB,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsc.d.ts","sourceRoot":"","sources":["../../src/tools/tsc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,QA6BhD"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dualOutput } from "@paretools/shared";
|
|
3
|
+
import { tsc } from "../lib/build-runner.js";
|
|
4
|
+
import { parseTscOutput } from "../lib/parsers.js";
|
|
5
|
+
import { formatTsc } from "../lib/formatters.js";
|
|
6
|
+
import { TscResultSchema } from "../schemas/index.js";
|
|
7
|
+
export function registerTscTool(server) {
|
|
8
|
+
server.registerTool("tsc", {
|
|
9
|
+
title: "TypeScript Check",
|
|
10
|
+
description: "Runs the TypeScript compiler and returns structured diagnostics (file, line, column, code, message)",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
path: z.string().optional().describe("Project root path (default: cwd)"),
|
|
13
|
+
noEmit: z
|
|
14
|
+
.boolean()
|
|
15
|
+
.optional()
|
|
16
|
+
.default(true)
|
|
17
|
+
.describe("Skip emitting output files (default: true)"),
|
|
18
|
+
project: z.string().optional().describe("Path to tsconfig.json"),
|
|
19
|
+
},
|
|
20
|
+
outputSchema: TscResultSchema,
|
|
21
|
+
}, async ({ path, noEmit, project }) => {
|
|
22
|
+
const cwd = path || process.cwd();
|
|
23
|
+
const args = [];
|
|
24
|
+
if (noEmit !== false)
|
|
25
|
+
args.push("--noEmit");
|
|
26
|
+
if (project)
|
|
27
|
+
args.push("--project", project);
|
|
28
|
+
const result = await tsc(args, cwd);
|
|
29
|
+
const data = parseTscOutput(result.stdout, result.stderr, result.exitCode);
|
|
30
|
+
return dualOutput(data, formatTsc);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=tsc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsc.js","sourceRoot":"","sources":["../../src/tools/tsc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC/C,MAAM,CAAC,YAAY,CACjB,KAAK,EACL;QACE,KAAK,EAAE,kBAAkB;QACzB,WAAW,EACT,qGAAqG;QACvG,WAAW,EAAE;YACX,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;YACxE,MAAM,EAAE,CAAC;iBACN,OAAO,EAAE;iBACT,QAAQ,EAAE;iBACV,OAAO,CAAC,IAAI,CAAC;iBACb,QAAQ,CAAC,4CAA4C,CAAC;YACzD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;SACjE;QACD,YAAY,EAAE,eAAe;KAC9B,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;QAClC,MAAM,GAAG,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAClC,MAAM,IAAI,GAAa,EAAE,CAAC;QAC1B,IAAI,MAAM,KAAK,KAAK;YAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5C,IAAI,OAAO;YAAE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QAE7C,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACpC,MAAM,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC3E,OAAO,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACrC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@paretools/build",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "MCP server for build tools (tsc, esbuild, etc.) with structured, token-efficient output",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"pare-build": "./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-build"
|
|
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
|
+
}
|