@paretools/lint 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 +4 -0
- package/dist/lib/formatters.d.ts.map +1 -0
- package/dist/lib/formatters.js +21 -0
- package/dist/lib/formatters.js.map +1 -0
- package/dist/lib/lint-runner.d.ts +4 -0
- package/dist/lib/lint-runner.d.ts.map +1 -0
- package/dist/lib/lint-runner.js +8 -0
- package/dist/lib/lint-runner.js.map +1 -0
- package/dist/lib/parsers.d.ts +16 -0
- package/dist/lib/parsers.d.ts.map +1 -0
- package/dist/lib/parsers.js +65 -0
- package/dist/lib/parsers.js.map +1 -0
- package/dist/schemas/index.d.ts +121 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +26 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/tools/format-check.d.ts +3 -0
- package/dist/tools/format-check.d.ts.map +1 -0
- package/dist/tools/format-check.js +28 -0
- package/dist/tools/format-check.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/lint.d.ts +3 -0
- package/dist/tools/lint.d.ts.map +1 -0
- package/dist/tools/lint.js +31 -0
- package/dist/tools/lint.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/lint",
|
|
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,iBAAiB;IACvB,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 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../src/lib/formatters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEzE,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAUnD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAQjE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function formatLint(data) {
|
|
2
|
+
if (data.total === 0)
|
|
3
|
+
return `Lint: no issues found (${data.filesChecked} files checked).`;
|
|
4
|
+
const lines = [
|
|
5
|
+
`Lint: ${data.errors} errors, ${data.warnings} warnings (${data.fixable} fixable)`,
|
|
6
|
+
];
|
|
7
|
+
for (const d of data.diagnostics) {
|
|
8
|
+
lines.push(` ${d.file}:${d.line}:${d.column} ${d.severity} ${d.rule}: ${d.message}`);
|
|
9
|
+
}
|
|
10
|
+
return lines.join("\n");
|
|
11
|
+
}
|
|
12
|
+
export function formatFormatCheck(data) {
|
|
13
|
+
if (data.formatted)
|
|
14
|
+
return "All files are formatted.";
|
|
15
|
+
const lines = [`${data.total} files need formatting:`];
|
|
16
|
+
for (const f of data.files) {
|
|
17
|
+
lines.push(` ${f}`);
|
|
18
|
+
}
|
|
19
|
+
return lines.join("\n");
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=formatters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/lib/formatters.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,UAAU,CAAC,IAAgB;IACzC,IAAI,IAAI,CAAC,KAAK,KAAK,CAAC;QAAE,OAAO,0BAA0B,IAAI,CAAC,YAAY,kBAAkB,CAAC;IAE3F,MAAM,KAAK,GAAG;QACZ,SAAS,IAAI,CAAC,MAAM,YAAY,IAAI,CAAC,QAAQ,cAAc,IAAI,CAAC,OAAO,WAAW;KACnF,CAAC;IACF,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,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IACxF,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAuB;IACvD,IAAI,IAAI,CAAC,SAAS;QAAE,OAAO,0BAA0B,CAAC;IAEtD,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,yBAAyB,CAAC,CAAC;IACvD,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint-runner.d.ts","sourceRoot":"","sources":["../../src/lib/lint-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAExD,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAE7E;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAE/E"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { run } from "@paretools/shared";
|
|
2
|
+
export async function eslint(args, cwd) {
|
|
3
|
+
return run("npx", ["eslint", ...args], { cwd });
|
|
4
|
+
}
|
|
5
|
+
export async function prettier(args, cwd) {
|
|
6
|
+
return run("npx", ["prettier", ...args], { cwd });
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=lint-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint-runner.js","sourceRoot":"","sources":["../../src/lib/lint-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAkB,MAAM,mBAAmB,CAAC;AAExD,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,IAAc,EAAE,GAAY;IACvD,OAAO,GAAG,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,IAAc,EAAE,GAAY;IACzD,OAAO,GAAG,CAAC,KAAK,EAAE,CAAC,UAAU,EAAE,GAAG,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { LintResult, FormatCheckResult } from "../schemas/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Parses ESLint JSON output (from `eslint --format json`).
|
|
4
|
+
*
|
|
5
|
+
* ESLint JSON format is an array of objects:
|
|
6
|
+
* [{ filePath, messages: [{ ruleId, severity, message, line, column, endLine, endColumn, fix }], errorCount, warningCount }]
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseEslintJson(stdout: string): LintResult;
|
|
9
|
+
/**
|
|
10
|
+
* Parses Prettier `--check` output.
|
|
11
|
+
*
|
|
12
|
+
* Prettier --check outputs lines like:
|
|
13
|
+
* "Checking formatting...\n[warn] src/index.ts\n[warn] Code style issues found..."
|
|
14
|
+
*/
|
|
15
|
+
export declare function parsePrettierCheck(stdout: string, stderr: string, exitCode: number): FormatCheckResult;
|
|
16
|
+
//# 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,UAAU,EAAkB,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEzF;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAsC1D;AAkBD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,iBAAiB,CAiBnB"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses ESLint JSON output (from `eslint --format json`).
|
|
3
|
+
*
|
|
4
|
+
* ESLint JSON format is an array of objects:
|
|
5
|
+
* [{ filePath, messages: [{ ruleId, severity, message, line, column, endLine, endColumn, fix }], errorCount, warningCount }]
|
|
6
|
+
*/
|
|
7
|
+
export function parseEslintJson(stdout) {
|
|
8
|
+
let files;
|
|
9
|
+
try {
|
|
10
|
+
files = JSON.parse(stdout);
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return { diagnostics: [], total: 0, errors: 0, warnings: 0, fixable: 0, filesChecked: 0 };
|
|
14
|
+
}
|
|
15
|
+
const diagnostics = [];
|
|
16
|
+
for (const file of files) {
|
|
17
|
+
for (const msg of file.messages) {
|
|
18
|
+
diagnostics.push({
|
|
19
|
+
file: file.filePath,
|
|
20
|
+
line: msg.line ?? 0,
|
|
21
|
+
column: msg.column ?? 0,
|
|
22
|
+
endLine: msg.endLine,
|
|
23
|
+
endColumn: msg.endColumn,
|
|
24
|
+
severity: msg.severity === 2 ? "error" : msg.severity === 1 ? "warning" : "info",
|
|
25
|
+
rule: msg.ruleId ?? "unknown",
|
|
26
|
+
message: msg.message,
|
|
27
|
+
fixable: !!msg.fix,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const errors = diagnostics.filter((d) => d.severity === "error").length;
|
|
32
|
+
const warnings = diagnostics.filter((d) => d.severity === "warning").length;
|
|
33
|
+
const fixable = diagnostics.filter((d) => d.fixable).length;
|
|
34
|
+
return {
|
|
35
|
+
diagnostics,
|
|
36
|
+
total: diagnostics.length,
|
|
37
|
+
errors,
|
|
38
|
+
warnings,
|
|
39
|
+
fixable,
|
|
40
|
+
filesChecked: files.length,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Parses Prettier `--check` output.
|
|
45
|
+
*
|
|
46
|
+
* Prettier --check outputs lines like:
|
|
47
|
+
* "Checking formatting...\n[warn] src/index.ts\n[warn] Code style issues found..."
|
|
48
|
+
*/
|
|
49
|
+
export function parsePrettierCheck(stdout, stderr, exitCode) {
|
|
50
|
+
const output = stdout + "\n" + stderr;
|
|
51
|
+
const lines = output.split("\n").filter(Boolean);
|
|
52
|
+
const files = [];
|
|
53
|
+
for (const line of lines) {
|
|
54
|
+
const match = line.match(/^\[warn\]\s+(.+\.\w+)$/);
|
|
55
|
+
if (match) {
|
|
56
|
+
files.push(match[1]);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
formatted: exitCode === 0,
|
|
61
|
+
files,
|
|
62
|
+
total: files.length,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=parsers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parsers.js","sourceRoot":"","sources":["../../src/lib/parsers.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,IAAI,KAAwB,CAAC;IAC7B,IAAI,CAAC;QACH,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC;IAC5F,CAAC;IAED,MAAM,WAAW,GAAqB,EAAE,CAAC;IAEzC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChC,WAAW,CAAC,IAAI,CAAC;gBACf,IAAI,EAAE,IAAI,CAAC,QAAQ;gBACnB,IAAI,EAAE,GAAG,CAAC,IAAI,IAAI,CAAC;gBACnB,MAAM,EAAE,GAAG,CAAC,MAAM,IAAI,CAAC;gBACvB,OAAO,EAAE,GAAG,CAAC,OAAO;gBACpB,SAAS,EAAE,GAAG,CAAC,SAAS;gBACxB,QAAQ,EAAE,GAAG,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM;gBAChF,IAAI,EAAE,GAAG,CAAC,MAAM,IAAI,SAAS;gBAC7B,OAAO,EAAE,GAAG,CAAC,OAAO;gBACpB,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG;aACnB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,MAAM,CAAC;IACxE,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,MAAM,CAAC;IAC5E,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;IAE5D,OAAO;QACL,WAAW;QACX,KAAK,EAAE,WAAW,CAAC,MAAM;QACzB,MAAM;QACN,QAAQ;QACR,OAAO;QACP,YAAY,EAAE,KAAK,CAAC,MAAM;KAC3B,CAAC;AACJ,CAAC;AAkBD;;;;;GAKG;AACH,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,MAAM,CAAC,OAAO,CAAC,CAAC;IAEjD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;QACnD,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO;QACL,SAAS,EAAE,QAAQ,KAAK,CAAC;QACzB,KAAK;QACL,KAAK,EAAE,KAAK,CAAC,MAAM;KACpB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const LintDiagnosticSchema: z.ZodObject<{
|
|
3
|
+
file: z.ZodString;
|
|
4
|
+
line: z.ZodNumber;
|
|
5
|
+
column: z.ZodNumber;
|
|
6
|
+
endLine: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
endColumn: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
severity: z.ZodEnum<["error", "warning", "info"]>;
|
|
9
|
+
rule: z.ZodString;
|
|
10
|
+
message: z.ZodString;
|
|
11
|
+
fixable: z.ZodBoolean;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
file: string;
|
|
14
|
+
line: number;
|
|
15
|
+
column: number;
|
|
16
|
+
severity: "error" | "warning" | "info";
|
|
17
|
+
message: string;
|
|
18
|
+
rule: string;
|
|
19
|
+
fixable: boolean;
|
|
20
|
+
endLine?: number | undefined;
|
|
21
|
+
endColumn?: number | undefined;
|
|
22
|
+
}, {
|
|
23
|
+
file: string;
|
|
24
|
+
line: number;
|
|
25
|
+
column: number;
|
|
26
|
+
severity: "error" | "warning" | "info";
|
|
27
|
+
message: string;
|
|
28
|
+
rule: string;
|
|
29
|
+
fixable: boolean;
|
|
30
|
+
endLine?: number | undefined;
|
|
31
|
+
endColumn?: number | undefined;
|
|
32
|
+
}>;
|
|
33
|
+
export declare const LintResultSchema: z.ZodObject<{
|
|
34
|
+
diagnostics: z.ZodArray<z.ZodObject<{
|
|
35
|
+
file: z.ZodString;
|
|
36
|
+
line: z.ZodNumber;
|
|
37
|
+
column: z.ZodNumber;
|
|
38
|
+
endLine: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
endColumn: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
severity: z.ZodEnum<["error", "warning", "info"]>;
|
|
41
|
+
rule: z.ZodString;
|
|
42
|
+
message: z.ZodString;
|
|
43
|
+
fixable: z.ZodBoolean;
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
file: string;
|
|
46
|
+
line: number;
|
|
47
|
+
column: number;
|
|
48
|
+
severity: "error" | "warning" | "info";
|
|
49
|
+
message: string;
|
|
50
|
+
rule: string;
|
|
51
|
+
fixable: boolean;
|
|
52
|
+
endLine?: number | undefined;
|
|
53
|
+
endColumn?: number | undefined;
|
|
54
|
+
}, {
|
|
55
|
+
file: string;
|
|
56
|
+
line: number;
|
|
57
|
+
column: number;
|
|
58
|
+
severity: "error" | "warning" | "info";
|
|
59
|
+
message: string;
|
|
60
|
+
rule: string;
|
|
61
|
+
fixable: boolean;
|
|
62
|
+
endLine?: number | undefined;
|
|
63
|
+
endColumn?: number | undefined;
|
|
64
|
+
}>, "many">;
|
|
65
|
+
total: z.ZodNumber;
|
|
66
|
+
errors: z.ZodNumber;
|
|
67
|
+
warnings: z.ZodNumber;
|
|
68
|
+
fixable: z.ZodNumber;
|
|
69
|
+
filesChecked: z.ZodNumber;
|
|
70
|
+
}, "strip", z.ZodTypeAny, {
|
|
71
|
+
fixable: number;
|
|
72
|
+
diagnostics: {
|
|
73
|
+
file: string;
|
|
74
|
+
line: number;
|
|
75
|
+
column: number;
|
|
76
|
+
severity: "error" | "warning" | "info";
|
|
77
|
+
message: string;
|
|
78
|
+
rule: string;
|
|
79
|
+
fixable: boolean;
|
|
80
|
+
endLine?: number | undefined;
|
|
81
|
+
endColumn?: number | undefined;
|
|
82
|
+
}[];
|
|
83
|
+
total: number;
|
|
84
|
+
errors: number;
|
|
85
|
+
warnings: number;
|
|
86
|
+
filesChecked: number;
|
|
87
|
+
}, {
|
|
88
|
+
fixable: number;
|
|
89
|
+
diagnostics: {
|
|
90
|
+
file: string;
|
|
91
|
+
line: number;
|
|
92
|
+
column: number;
|
|
93
|
+
severity: "error" | "warning" | "info";
|
|
94
|
+
message: string;
|
|
95
|
+
rule: string;
|
|
96
|
+
fixable: boolean;
|
|
97
|
+
endLine?: number | undefined;
|
|
98
|
+
endColumn?: number | undefined;
|
|
99
|
+
}[];
|
|
100
|
+
total: number;
|
|
101
|
+
errors: number;
|
|
102
|
+
warnings: number;
|
|
103
|
+
filesChecked: number;
|
|
104
|
+
}>;
|
|
105
|
+
export type LintResult = z.infer<typeof LintResultSchema>;
|
|
106
|
+
export type LintDiagnostic = z.infer<typeof LintDiagnosticSchema>;
|
|
107
|
+
export declare const FormatCheckResultSchema: z.ZodObject<{
|
|
108
|
+
formatted: z.ZodBoolean;
|
|
109
|
+
files: z.ZodArray<z.ZodString, "many">;
|
|
110
|
+
total: z.ZodNumber;
|
|
111
|
+
}, "strip", z.ZodTypeAny, {
|
|
112
|
+
total: number;
|
|
113
|
+
formatted: boolean;
|
|
114
|
+
files: string[];
|
|
115
|
+
}, {
|
|
116
|
+
total: number;
|
|
117
|
+
formatted: boolean;
|
|
118
|
+
files: string[];
|
|
119
|
+
}>;
|
|
120
|
+
export type FormatCheckResult = z.infer<typeof FormatCheckResultSchema>;
|
|
121
|
+
//# 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,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU/B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;EAIlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const LintDiagnosticSchema = z.object({
|
|
3
|
+
file: z.string(),
|
|
4
|
+
line: z.number(),
|
|
5
|
+
column: z.number(),
|
|
6
|
+
endLine: z.number().optional(),
|
|
7
|
+
endColumn: z.number().optional(),
|
|
8
|
+
severity: z.enum(["error", "warning", "info"]),
|
|
9
|
+
rule: z.string(),
|
|
10
|
+
message: z.string(),
|
|
11
|
+
fixable: z.boolean(),
|
|
12
|
+
});
|
|
13
|
+
export const LintResultSchema = z.object({
|
|
14
|
+
diagnostics: z.array(LintDiagnosticSchema),
|
|
15
|
+
total: z.number(),
|
|
16
|
+
errors: z.number(),
|
|
17
|
+
warnings: z.number(),
|
|
18
|
+
fixable: z.number(),
|
|
19
|
+
filesChecked: z.number(),
|
|
20
|
+
});
|
|
21
|
+
export const FormatCheckResultSchema = z.object({
|
|
22
|
+
formatted: z.boolean(),
|
|
23
|
+
files: z.array(z.string()),
|
|
24
|
+
total: z.number(),
|
|
25
|
+
});
|
|
26
|
+
//# 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,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAC9C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC;IAC1C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;CACzB,CAAC,CAAC;AAKH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;IACtB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC1B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;CAClB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-check.d.ts","sourceRoot":"","sources":["../../src/tools/format-check.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,QA0BxD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dualOutput } from "@paretools/shared";
|
|
3
|
+
import { prettier } from "../lib/lint-runner.js";
|
|
4
|
+
import { parsePrettierCheck } from "../lib/parsers.js";
|
|
5
|
+
import { formatFormatCheck } from "../lib/formatters.js";
|
|
6
|
+
import { FormatCheckResultSchema } from "../schemas/index.js";
|
|
7
|
+
export function registerFormatCheckTool(server) {
|
|
8
|
+
server.registerTool("format-check", {
|
|
9
|
+
title: "Prettier Check",
|
|
10
|
+
description: "Checks if files are formatted and returns a structured list of files needing formatting",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
path: z.string().optional().describe("Project root path (default: cwd)"),
|
|
13
|
+
patterns: z
|
|
14
|
+
.array(z.string())
|
|
15
|
+
.optional()
|
|
16
|
+
.default(["."])
|
|
17
|
+
.describe("File patterns to check (default: ['.'])"),
|
|
18
|
+
},
|
|
19
|
+
outputSchema: FormatCheckResultSchema,
|
|
20
|
+
}, async ({ path, patterns }) => {
|
|
21
|
+
const cwd = path || process.cwd();
|
|
22
|
+
const args = ["--check", ...(patterns || ["."])];
|
|
23
|
+
const result = await prettier(args, cwd);
|
|
24
|
+
const data = parsePrettierCheck(result.stdout, result.stderr, result.exitCode);
|
|
25
|
+
return dualOutput(data, formatFormatCheck);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=format-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-check.js","sourceRoot":"","sources":["../../src/tools/format-check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,MAAM,UAAU,uBAAuB,CAAC,MAAiB;IACvD,MAAM,CAAC,YAAY,CACjB,cAAc,EACd;QACE,KAAK,EAAE,gBAAgB;QACvB,WAAW,EACT,yFAAyF;QAC3F,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,GAAG,CAAC,CAAC;iBACd,QAAQ,CAAC,yCAAyC,CAAC;SACvD;QACD,YAAY,EAAE,uBAAuB;KACtC,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC3B,MAAM,GAAG,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAClC,MAAM,IAAI,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,QAAQ,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAEjD,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACzC,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,iBAAiB,CAAC,CAAC;IAC7C,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;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,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,MAAM,UAAU,gBAAgB,CAAC,MAAiB;IAChD,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACzB,uBAAuB,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../../src/tools/lint.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 { eslint } from "../lib/lint-runner.js";
|
|
4
|
+
import { parseEslintJson } from "../lib/parsers.js";
|
|
5
|
+
import { formatLint } from "../lib/formatters.js";
|
|
6
|
+
import { LintResultSchema } from "../schemas/index.js";
|
|
7
|
+
export function registerLintTool(server) {
|
|
8
|
+
server.registerTool("lint", {
|
|
9
|
+
title: "ESLint Check",
|
|
10
|
+
description: "Runs ESLint and returns structured diagnostics (file, line, rule, severity, message)",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
path: z.string().optional().describe("Project root path (default: cwd)"),
|
|
13
|
+
patterns: z
|
|
14
|
+
.array(z.string())
|
|
15
|
+
.optional()
|
|
16
|
+
.default(["."])
|
|
17
|
+
.describe("File patterns to lint (default: ['.'])"),
|
|
18
|
+
fix: z.boolean().optional().default(false).describe("Auto-fix problems"),
|
|
19
|
+
},
|
|
20
|
+
outputSchema: LintResultSchema,
|
|
21
|
+
}, async ({ path, patterns, fix }) => {
|
|
22
|
+
const cwd = path || process.cwd();
|
|
23
|
+
const args = ["--format", "json", ...(patterns || ["."])];
|
|
24
|
+
if (fix)
|
|
25
|
+
args.push("--fix");
|
|
26
|
+
const result = await eslint(args, cwd);
|
|
27
|
+
const data = parseEslintJson(result.stdout);
|
|
28
|
+
return dualOutput(data, formatLint);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=lint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint.js","sourceRoot":"","sources":["../../src/tools/lint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,UAAU,gBAAgB,CAAC,MAAiB;IAChD,MAAM,CAAC,YAAY,CACjB,MAAM,EACN;QACE,KAAK,EAAE,cAAc;QACrB,WAAW,EACT,sFAAsF;QACxF,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,GAAG,CAAC,CAAC;iBACd,QAAQ,CAAC,wCAAwC,CAAC;YACrD,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC;SACzE;QACD,YAAY,EAAE,gBAAgB;KAC/B,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,EAAE,EAAE;QAChC,MAAM,GAAG,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAClC,MAAM,IAAI,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,CAAC,QAAQ,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC1D,IAAI,GAAG;YAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAE5B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACvC,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC5C,OAAO,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACtC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@paretools/lint",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "MCP server for linters (ESLint, Prettier) with structured, token-efficient output",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"pare-lint": "./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-lint"
|
|
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
|
+
}
|