vale-mcp 0.0.0-stage → 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/build/config.d.ts +26 -0
- package/build/config.d.ts.map +1 -0
- package/build/config.js +91 -0
- package/build/config.js.map +1 -0
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +539 -0
- package/build/index.js.map +1 -0
- package/build/types.d.ts +88 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +2 -0
- package/build/types.js.map +1 -0
- package/build/vale-runner.d.ts +41 -0
- package/build/vale-runner.d.ts.map +1 -0
- package/build/vale-runner.js +422 -0
- package/build/vale-runner.js.map +1 -0
- package/package.json +48 -4
- package/readme.md +540 -0
- package/README.md +0 -3
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { CheckFileResult, CheckOptions } from "./types.js";
|
|
2
|
+
export declare const MAX_TEXT_BYTES: number;
|
|
3
|
+
/**
|
|
4
|
+
* Checks if Vale is installed and accessible (with caching)
|
|
5
|
+
*/
|
|
6
|
+
export declare function checkValeInstalled(): Promise<{
|
|
7
|
+
installed: boolean;
|
|
8
|
+
version?: string;
|
|
9
|
+
error?: string;
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* Clear the Vale installation cache (useful for testing or if Vale is installed after server start)
|
|
13
|
+
*/
|
|
14
|
+
export declare function clearValeInstallCache(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Runs vale sync to download styles and packages
|
|
17
|
+
*/
|
|
18
|
+
export declare function syncValeStyles(configPath?: string): Promise<{
|
|
19
|
+
success: boolean;
|
|
20
|
+
message: string;
|
|
21
|
+
output?: string;
|
|
22
|
+
error?: string;
|
|
23
|
+
}>;
|
|
24
|
+
/**
|
|
25
|
+
* Vale 3+ is required; versionOutput is e.g. "vale version 3.27.0".
|
|
26
|
+
* Unparseable output is given the benefit of the doubt.
|
|
27
|
+
*/
|
|
28
|
+
export declare function isSupportedValeVersion(versionOutput?: string): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Runs Vale on a file at a specific path
|
|
31
|
+
*/
|
|
32
|
+
export declare function checkFile(filePath: string, configPath?: string, options?: CheckOptions): Promise<CheckFileResult>;
|
|
33
|
+
/**
|
|
34
|
+
* Runs Vale on every supported file in a directory (recursively)
|
|
35
|
+
*/
|
|
36
|
+
export declare function checkDirectory(dirPath: string, configPath?: string, options?: CheckOptions): Promise<CheckFileResult>;
|
|
37
|
+
/**
|
|
38
|
+
* Runs Vale on text passed directly (via stdin)
|
|
39
|
+
*/
|
|
40
|
+
export declare function checkText(text: string, textFileExt?: string, configPath?: string, options?: CheckOptions): Promise<CheckFileResult>;
|
|
41
|
+
//# sourceMappingURL=vale-runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vale-runner.d.ts","sourceRoot":"","sources":["../src/vale-runner.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,eAAe,EACf,YAAY,EAEb,MAAM,YAAY,CAAC;AAOpB,eAAO,MAAM,cAAc,QAAc,CAAC;AAiE1C;;GAEG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC;IAClD,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CAkCD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAK5C;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACjE,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CA2CD;AAYD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAGtE;AA6LD;;GAEG;AACH,wBAAsB,SAAS,CAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,eAAe,CAAC,CA+B1B;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,eAAe,CAAC,CAiB1B;AAED;;GAEG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,MAAM,EACZ,WAAW,CAAC,EAAE,MAAM,EACpB,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,eAAe,CAAC,CAyC1B"}
|
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
import { execFile } from "child_process";
|
|
2
|
+
import * as fs from "fs/promises";
|
|
3
|
+
import * as fsSync from "fs";
|
|
4
|
+
import * as path from "path";
|
|
5
|
+
import { assertPathAllowed, PathNotAllowedError } from "./config.js";
|
|
6
|
+
// Limits so a huge input or a hung Vale process can't wedge the server
|
|
7
|
+
const VALE_TIMEOUT_MS = 60_000;
|
|
8
|
+
const VALE_SYNC_TIMEOUT_MS = 300_000; // sync downloads packages
|
|
9
|
+
const VALE_MAX_BUFFER = 10 * 1024 * 1024;
|
|
10
|
+
export const MAX_TEXT_BYTES = 1024 * 1024;
|
|
11
|
+
/**
|
|
12
|
+
* Vale writes config/runtime errors to stderr as a JSON object; turn it into
|
|
13
|
+
* "Code: Text". Anything else is returned unchanged.
|
|
14
|
+
*/
|
|
15
|
+
function describeStderr(stderr) {
|
|
16
|
+
try {
|
|
17
|
+
parseValeOutput(stderr);
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
if (error instanceof ValeReportedError)
|
|
21
|
+
return error.message;
|
|
22
|
+
}
|
|
23
|
+
return stderr;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Runs Vale without a shell (arguments are never interpreted by a shell, so
|
|
27
|
+
* user-supplied paths can't inject commands). Vale exits non-zero when it
|
|
28
|
+
* finds issues but still prints JSON, so output is returned whenever there
|
|
29
|
+
* is any, unless the process was killed (timeout / buffer overflow).
|
|
30
|
+
*/
|
|
31
|
+
function runVale(args, options = {}) {
|
|
32
|
+
return new Promise((resolve, reject) => {
|
|
33
|
+
const child = execFile("vale", args, {
|
|
34
|
+
cwd: options.cwd,
|
|
35
|
+
encoding: "utf-8",
|
|
36
|
+
timeout: options.timeout ?? VALE_TIMEOUT_MS,
|
|
37
|
+
maxBuffer: VALE_MAX_BUFFER,
|
|
38
|
+
}, (error, stdout, stderr) => {
|
|
39
|
+
if (error && (error.killed || (options.requireStdout !== false && !stdout))) {
|
|
40
|
+
const detail = error.killed
|
|
41
|
+
? "Vale timed out or produced too much output"
|
|
42
|
+
: describeStderr(stderr) || error.message;
|
|
43
|
+
reject(new Error(`Vale execution failed: ${detail}`));
|
|
44
|
+
}
|
|
45
|
+
else if (error && options.requireStdout === false) {
|
|
46
|
+
reject(new Error(stderr || error.message));
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
resolve({ stdout, stderr });
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
if (options.input !== undefined) {
|
|
53
|
+
child.stdin?.end(options.input);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
// Cache for Vale installation check
|
|
58
|
+
let valeInstallCache = {
|
|
59
|
+
checked: false,
|
|
60
|
+
installed: false,
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Checks if Vale is installed and accessible (with caching)
|
|
64
|
+
*/
|
|
65
|
+
export async function checkValeInstalled() {
|
|
66
|
+
// Return cached result if already checked
|
|
67
|
+
if (valeInstallCache.checked) {
|
|
68
|
+
return {
|
|
69
|
+
installed: valeInstallCache.installed,
|
|
70
|
+
version: valeInstallCache.version,
|
|
71
|
+
error: valeInstallCache.error,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
// Perform the check
|
|
75
|
+
try {
|
|
76
|
+
const { stdout } = await runVale(["--version"]);
|
|
77
|
+
valeInstallCache = {
|
|
78
|
+
checked: true,
|
|
79
|
+
installed: true,
|
|
80
|
+
version: stdout.trim(),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
valeInstallCache = {
|
|
85
|
+
checked: true,
|
|
86
|
+
installed: false,
|
|
87
|
+
error: error instanceof Error
|
|
88
|
+
? error.message
|
|
89
|
+
: "Vale not found in PATH. To install Vale, go to https://vale.sh/docs/vale-cli/installation/",
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
installed: valeInstallCache.installed,
|
|
94
|
+
version: valeInstallCache.version,
|
|
95
|
+
error: valeInstallCache.error,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Clear the Vale installation cache (useful for testing or if Vale is installed after server start)
|
|
100
|
+
*/
|
|
101
|
+
export function clearValeInstallCache() {
|
|
102
|
+
valeInstallCache = {
|
|
103
|
+
checked: false,
|
|
104
|
+
installed: false,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Runs vale sync to download styles and packages
|
|
109
|
+
*/
|
|
110
|
+
export async function syncValeStyles(configPath) {
|
|
111
|
+
try {
|
|
112
|
+
const args = ["sync"];
|
|
113
|
+
let workingDir = process.cwd();
|
|
114
|
+
// If config path provided, use its directory as working dir
|
|
115
|
+
if (configPath) {
|
|
116
|
+
try {
|
|
117
|
+
await assertPathAllowed(configPath);
|
|
118
|
+
await fs.access(configPath, fsSync.constants.R_OK);
|
|
119
|
+
workingDir = path.dirname(path.resolve(configPath));
|
|
120
|
+
args.push(`--config=${configPath}`);
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
if (error instanceof PathNotAllowedError)
|
|
124
|
+
throw error;
|
|
125
|
+
// Config path doesn't exist or isn't readable, use default
|
|
126
|
+
console.error(`Warning: Config path ${configPath} is not accessible`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
console.error(`Running: vale ${args.join(" ")}`);
|
|
130
|
+
console.error(`Working directory: ${workingDir}`);
|
|
131
|
+
const { stdout, stderr } = await runVale(args, {
|
|
132
|
+
cwd: workingDir,
|
|
133
|
+
timeout: VALE_SYNC_TIMEOUT_MS,
|
|
134
|
+
requireStdout: false,
|
|
135
|
+
});
|
|
136
|
+
const output = stdout + (stderr ? `\n${stderr}` : "");
|
|
137
|
+
return {
|
|
138
|
+
success: true,
|
|
139
|
+
message: "Vale styles synchronized successfully",
|
|
140
|
+
output: output.trim(),
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
const errorMsg = error instanceof Error ? error.message : "Unknown error";
|
|
145
|
+
return {
|
|
146
|
+
success: false,
|
|
147
|
+
message: "Failed to sync Vale styles",
|
|
148
|
+
error: errorMsg,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Strips markdown code fence formatting from Vale's JSON output
|
|
154
|
+
*/
|
|
155
|
+
function stripCodeFence(output) {
|
|
156
|
+
// Remove ```json and ``` if present
|
|
157
|
+
return output.replace(/^```json\s*\n?/, "").replace(/\n?```\s*$/, "").trim();
|
|
158
|
+
}
|
|
159
|
+
class ValeReportedError extends Error {
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Vale 3+ is required; versionOutput is e.g. "vale version 3.27.0".
|
|
163
|
+
* Unparseable output is given the benefit of the doubt.
|
|
164
|
+
*/
|
|
165
|
+
export function isSupportedValeVersion(versionOutput) {
|
|
166
|
+
const major = versionOutput?.match(/(\d+)\.\d+/)?.[1];
|
|
167
|
+
return major === undefined || Number(major) >= 3;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Parses Vale's JSON output and handles errors
|
|
171
|
+
*/
|
|
172
|
+
function parseValeOutput(output) {
|
|
173
|
+
try {
|
|
174
|
+
const cleanedOutput = stripCodeFence(output);
|
|
175
|
+
if (!cleanedOutput) {
|
|
176
|
+
return {};
|
|
177
|
+
}
|
|
178
|
+
const parsed = JSON.parse(cleanedOutput);
|
|
179
|
+
// Vale reports runtime/config problems as a single JSON error object on
|
|
180
|
+
// stdout (exit 2) rather than the usual {file: [issues]} map
|
|
181
|
+
if (typeof parsed?.Code === "string" && typeof parsed?.Text === "string") {
|
|
182
|
+
throw new ValeReportedError(`${parsed.Code}: ${parsed.Text}`);
|
|
183
|
+
}
|
|
184
|
+
return parsed;
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
if (error instanceof ValeReportedError)
|
|
188
|
+
throw error;
|
|
189
|
+
throw new Error(`Failed to parse Vale JSON output: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Normalizes Vale issues to a more user-friendly format
|
|
194
|
+
*/
|
|
195
|
+
function normalizeIssues(issues, includeFile = false) {
|
|
196
|
+
const normalized = [];
|
|
197
|
+
for (const filePath in issues) {
|
|
198
|
+
const fileIssues = issues[filePath];
|
|
199
|
+
for (const issue of fileIssues) {
|
|
200
|
+
normalized.push({
|
|
201
|
+
line: issue.Line,
|
|
202
|
+
span: issue.Span,
|
|
203
|
+
check: issue.Check,
|
|
204
|
+
message: issue.Message,
|
|
205
|
+
severity: issue.Severity,
|
|
206
|
+
link: issue.Link,
|
|
207
|
+
match: issue.Match,
|
|
208
|
+
// Vale emits an empty Action object for rules without a fix
|
|
209
|
+
action: issue.Action?.Name
|
|
210
|
+
? { name: issue.Action.Name, params: issue.Action.Params ?? [] }
|
|
211
|
+
: undefined,
|
|
212
|
+
file: includeFile ? filePath : undefined,
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return normalized;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Summary statistics for Vale results
|
|
220
|
+
*/
|
|
221
|
+
function generateSummary(issues) {
|
|
222
|
+
const summary = {
|
|
223
|
+
total: issues.length,
|
|
224
|
+
errors: 0,
|
|
225
|
+
warnings: 0,
|
|
226
|
+
suggestions: 0,
|
|
227
|
+
};
|
|
228
|
+
for (const issue of issues) {
|
|
229
|
+
switch (issue.severity) {
|
|
230
|
+
case "error":
|
|
231
|
+
summary.errors++;
|
|
232
|
+
break;
|
|
233
|
+
case "warning":
|
|
234
|
+
summary.warnings++;
|
|
235
|
+
break;
|
|
236
|
+
case "suggestion":
|
|
237
|
+
summary.suggestions++;
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return summary;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Formats Vale results as human-readable markdown with structured data
|
|
245
|
+
*/
|
|
246
|
+
function formatValeResults(issues, summary, context, truncated = false) {
|
|
247
|
+
if (issues.length === 0) {
|
|
248
|
+
return `✅ **No style issues found!**\n\nThe text looks good according to Vale style rules.`;
|
|
249
|
+
}
|
|
250
|
+
const severityEmoji = {
|
|
251
|
+
error: "🔴",
|
|
252
|
+
warning: "🟡",
|
|
253
|
+
suggestion: "💡"
|
|
254
|
+
};
|
|
255
|
+
let output = `## Vale linting results\n\n`;
|
|
256
|
+
if (context) {
|
|
257
|
+
output += `**Context:** ${context}\n\n`;
|
|
258
|
+
}
|
|
259
|
+
output += `**Summary:** ${summary.total} issue${summary.total !== 1 ? 's' : ''} found`;
|
|
260
|
+
const parts = [];
|
|
261
|
+
if (summary.errors > 0)
|
|
262
|
+
parts.push(`${summary.errors} error${summary.errors !== 1 ? 's' : ''}`);
|
|
263
|
+
if (summary.warnings > 0)
|
|
264
|
+
parts.push(`${summary.warnings} warning${summary.warnings !== 1 ? 's' : ''}`);
|
|
265
|
+
if (summary.suggestions > 0)
|
|
266
|
+
parts.push(`${summary.suggestions} suggestion${summary.suggestions !== 1 ? 's' : ''}`);
|
|
267
|
+
if (parts.length > 0) {
|
|
268
|
+
output += ` (${parts.join(', ')})`;
|
|
269
|
+
}
|
|
270
|
+
output += '\n\n';
|
|
271
|
+
output += `### Issues\n\n`;
|
|
272
|
+
// Group by severity
|
|
273
|
+
const grouped = {
|
|
274
|
+
error: issues.filter(i => i.severity === 'error'),
|
|
275
|
+
warning: issues.filter(i => i.severity === 'warning'),
|
|
276
|
+
suggestion: issues.filter(i => i.severity === 'suggestion')
|
|
277
|
+
};
|
|
278
|
+
for (const [severity, severityIssues] of Object.entries(grouped)) {
|
|
279
|
+
if (severityIssues.length === 0)
|
|
280
|
+
continue;
|
|
281
|
+
for (const issue of severityIssues) {
|
|
282
|
+
const emoji = severityEmoji[severity];
|
|
283
|
+
const where = issue.file ? `${issue.file}:${issue.line}` : `Line ${issue.line}`;
|
|
284
|
+
output += `${emoji} **${where}** (${severity.toUpperCase()}): ${issue.message}\n`;
|
|
285
|
+
if (issue.match) {
|
|
286
|
+
output += ` ↳ Found: "${issue.match}"\n`;
|
|
287
|
+
}
|
|
288
|
+
output += ` ↳ Rule: \`${issue.check}\`\n`;
|
|
289
|
+
if (issue.action) {
|
|
290
|
+
output += ` ↳ Suggested fix: ${issue.action.name}${issue.action.params.length ? ` (${issue.action.params.map((p) => `"${p}"`).join(", ")})` : ""}\n`;
|
|
291
|
+
}
|
|
292
|
+
if (issue.link) {
|
|
293
|
+
output += ` ↳ [More info](${issue.link})\n`;
|
|
294
|
+
}
|
|
295
|
+
output += '\n';
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
if (truncated) {
|
|
299
|
+
output += `_Showing the first ${issues.length} of ${summary.total} issues._\n`;
|
|
300
|
+
}
|
|
301
|
+
return output;
|
|
302
|
+
}
|
|
303
|
+
const SEVERITY_RANK = { suggestion: 0, warning: 1, error: 2 };
|
|
304
|
+
/**
|
|
305
|
+
* Normalizes, filters and formats Vale's parsed output into a result
|
|
306
|
+
*/
|
|
307
|
+
function buildResult(rawOutput, file, context, options = {}, includeFile = false) {
|
|
308
|
+
let issues = normalizeIssues(rawOutput, includeFile);
|
|
309
|
+
if (options.minSeverity) {
|
|
310
|
+
const min = SEVERITY_RANK[options.minSeverity];
|
|
311
|
+
issues = issues.filter((i) => SEVERITY_RANK[i.severity] >= min);
|
|
312
|
+
}
|
|
313
|
+
const summary = generateSummary(issues);
|
|
314
|
+
const truncated = options.maxIssues !== undefined && issues.length > options.maxIssues;
|
|
315
|
+
if (truncated)
|
|
316
|
+
issues = issues.slice(0, options.maxIssues);
|
|
317
|
+
return {
|
|
318
|
+
formatted: formatValeResults(issues, summary, context, truncated),
|
|
319
|
+
file,
|
|
320
|
+
issues,
|
|
321
|
+
summary,
|
|
322
|
+
truncated,
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Runs Vale on a file at a specific path
|
|
327
|
+
*/
|
|
328
|
+
export async function checkFile(filePath, configPath, options = {}) {
|
|
329
|
+
// Resolve to absolute path (also stops a leading "-" being read as a flag)
|
|
330
|
+
const absolutePath = path.resolve(process.cwd(), filePath);
|
|
331
|
+
await assertPathAllowed(absolutePath);
|
|
332
|
+
if (configPath)
|
|
333
|
+
await assertPathAllowed(configPath);
|
|
334
|
+
// Verify file exists and is readable
|
|
335
|
+
try {
|
|
336
|
+
await fs.access(absolutePath, fsSync.constants.R_OK);
|
|
337
|
+
}
|
|
338
|
+
catch {
|
|
339
|
+
throw new Error(`File not found or not readable: ${filePath}`);
|
|
340
|
+
}
|
|
341
|
+
const args = ["--output=JSON"];
|
|
342
|
+
// Only use --config if explicitly provided (e.g., from VALE_CONFIG_PATH env var)
|
|
343
|
+
// Otherwise let Vale do its natural upward search from the file's location
|
|
344
|
+
if (configPath) {
|
|
345
|
+
args.push(`--config=${configPath}`);
|
|
346
|
+
console.error(`Using explicit config: ${configPath}`);
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
console.error(`Letting Vale search for config from: ${path.dirname(absolutePath)}`);
|
|
350
|
+
}
|
|
351
|
+
args.push(absolutePath);
|
|
352
|
+
// Run Vale from the file's directory so it searches upward from there
|
|
353
|
+
const { stdout } = await runVale(args, { cwd: path.dirname(absolutePath) });
|
|
354
|
+
// Parse output
|
|
355
|
+
return buildResult(parseValeOutput(stdout), absolutePath, absolutePath, options);
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Runs Vale on every supported file in a directory (recursively)
|
|
359
|
+
*/
|
|
360
|
+
export async function checkDirectory(dirPath, configPath, options = {}) {
|
|
361
|
+
const absolutePath = path.resolve(process.cwd(), dirPath);
|
|
362
|
+
await assertPathAllowed(absolutePath);
|
|
363
|
+
if (configPath)
|
|
364
|
+
await assertPathAllowed(configPath);
|
|
365
|
+
try {
|
|
366
|
+
if (!(await fs.stat(absolutePath)).isDirectory())
|
|
367
|
+
throw new Error();
|
|
368
|
+
}
|
|
369
|
+
catch {
|
|
370
|
+
throw new Error(`Directory not found: ${dirPath}`);
|
|
371
|
+
}
|
|
372
|
+
const args = ["--output=JSON"];
|
|
373
|
+
if (configPath)
|
|
374
|
+
args.push(`--config=${configPath}`);
|
|
375
|
+
args.push(absolutePath);
|
|
376
|
+
const { stdout } = await runVale(args, { cwd: absolutePath });
|
|
377
|
+
return buildResult(parseValeOutput(stdout), absolutePath, absolutePath, options, true);
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Runs Vale on text passed directly (via stdin)
|
|
381
|
+
*/
|
|
382
|
+
export async function checkText(text, textFileExt, configPath, options = {}) {
|
|
383
|
+
// Check to see of any text was sent
|
|
384
|
+
if (!text || text.trim() === "") {
|
|
385
|
+
throw new Error(`No text found to check. Make sure the text has content that is not only whitespace.`);
|
|
386
|
+
}
|
|
387
|
+
if (Buffer.byteLength(text, "utf-8") > MAX_TEXT_BYTES) {
|
|
388
|
+
throw new Error(`Text is too large to check (limit is ${MAX_TEXT_BYTES} bytes).`);
|
|
389
|
+
}
|
|
390
|
+
const args = [];
|
|
391
|
+
if (textFileExt) {
|
|
392
|
+
// Clean the provided file extension and
|
|
393
|
+
// confirm it's in a valid format,
|
|
394
|
+
// such as: "md", ".md", "txt", ".txt", or "docx"
|
|
395
|
+
const trimmedExt = textFileExt.trim();
|
|
396
|
+
const extPattern = /^\.?[a-zA-Z0-9]+$/;
|
|
397
|
+
if (extPattern.test(trimmedExt)) {
|
|
398
|
+
// If a file extension is provided, we can use Vale's --ext flag to help it apply the correct rules
|
|
399
|
+
const normalizedExt = trimmedExt.startsWith(".") ? trimmedExt : `.${trimmedExt}`;
|
|
400
|
+
args.push(`--ext=${normalizedExt}`);
|
|
401
|
+
console.error(`Using file extension for Vale: ${normalizedExt}`);
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
// If the provided extension is not valid, throw an exception
|
|
405
|
+
throw new Error(`Vale doesn't allow a text file extension of: "${textFileExt}". Allowed format is an optional leading dot followed by letters and digits.`);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
if (configPath) {
|
|
409
|
+
await assertPathAllowed(configPath);
|
|
410
|
+
args.push(`--config=${configPath}`);
|
|
411
|
+
console.error(`Using explicit config: ${configPath}`);
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
console.error(`Using Vale defaults or searching for config from current directory`);
|
|
415
|
+
}
|
|
416
|
+
args.push("--output=JSON");
|
|
417
|
+
// Vale has no stdin flag; with no file argument it reads stdin
|
|
418
|
+
const { stdout } = await runVale(args, { cwd: process.cwd(), input: text });
|
|
419
|
+
// Parse output
|
|
420
|
+
return buildResult(parseValeOutput(stdout), `stdin`, `text input`, options);
|
|
421
|
+
}
|
|
422
|
+
//# sourceMappingURL=vale-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vale-runner.js","sourceRoot":"","sources":["../src/vale-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,a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,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,oEAAoE,CAAC,CAAC;IACtF,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAE3B,+DAA+D;IAC/D,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAE5E,eAAe;IACf,OAAO,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;AAC9E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vale-mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "MCP server for Vale linting integration",
|
|
5
|
+
"main": "build/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"vale-cli": "build/index.js",
|
|
9
|
+
"vale-mcp": "build/index.js"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc && chmod 755 build/index.js",
|
|
13
|
+
"watch": "tsc --watch",
|
|
14
|
+
"start": "node build/index.js",
|
|
15
|
+
"install:global": "npm link",
|
|
16
|
+
"uninstall:global": "npm unlink -g vale-mcp",
|
|
17
|
+
"prepublishOnly": "npm run build",
|
|
18
|
+
"test": "npm run build && node --test \"test/*.test.mjs\""
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"build",
|
|
22
|
+
"readme.md"
|
|
23
|
+
],
|
|
24
|
+
"keywords": [
|
|
25
|
+
"mcp",
|
|
26
|
+
"vale",
|
|
27
|
+
"linting",
|
|
28
|
+
"documentation",
|
|
29
|
+
"style-guide",
|
|
30
|
+
"prose",
|
|
31
|
+
"writing"
|
|
32
|
+
],
|
|
33
|
+
"author": "Chris Chinchilla",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=22.0.0"
|
|
37
|
+
},
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "https://github.com/chrischinchilla/vale-mcp.git"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
44
|
+
"zod": "^4.6.7"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/node": "^24.19.2",
|
|
48
|
+
"typescript": "^5.9.3"
|
|
49
|
+
}
|
|
50
|
+
}
|