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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Chris Chinchilla and Fabrizio Ferri-Benedetti
|
|
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.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ValeServerConfig } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Loads configuration from environment variables
|
|
4
|
+
*/
|
|
5
|
+
export declare function loadConfig(): ValeServerConfig;
|
|
6
|
+
/**
|
|
7
|
+
* Checks if a .vale.ini file exists in the current working directory (async)
|
|
8
|
+
*/
|
|
9
|
+
export declare function findValeIniInWorkingDir(): Promise<string | null>;
|
|
10
|
+
/**
|
|
11
|
+
* Verifies that a Vale config file exists and is readable (async)
|
|
12
|
+
*/
|
|
13
|
+
export declare function verifyConfigFile(configPath: string): Promise<boolean>;
|
|
14
|
+
/**
|
|
15
|
+
* Gets the absolute path for a config file
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveConfigPath(configPath: string): string;
|
|
18
|
+
export declare class PathNotAllowedError extends Error {
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* When VALE_ALLOWED_ROOTS is set (path-delimiter separated), rejects paths
|
|
22
|
+
* outside those directories. Symlinks are resolved first so they can't be
|
|
23
|
+
* used to escape. Unset means no restriction.
|
|
24
|
+
*/
|
|
25
|
+
export declare function assertPathAllowed(target: string): Promise<void>;
|
|
26
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C;;GAEG;AACH,wBAAgB,UAAU,IAAI,gBAAgB,CAS7C;AAED;;GAEG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAUtE;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAO3E;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAK5D;AAGD,qBAAa,mBAAoB,SAAQ,KAAK;CAAG;AAEjD;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgCrE"}
|
package/build/config.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import * as fs from "fs/promises";
|
|
2
|
+
import * as fsSync from "fs";
|
|
3
|
+
import * as path from "path";
|
|
4
|
+
/**
|
|
5
|
+
* Loads configuration from environment variables
|
|
6
|
+
*/
|
|
7
|
+
export function loadConfig() {
|
|
8
|
+
const config = {};
|
|
9
|
+
// Load config path if specified
|
|
10
|
+
if (process.env.VALE_CONFIG_PATH) {
|
|
11
|
+
config.configPath = process.env.VALE_CONFIG_PATH;
|
|
12
|
+
}
|
|
13
|
+
return config;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Checks if a .vale.ini file exists in the current working directory (async)
|
|
17
|
+
*/
|
|
18
|
+
export async function findValeIniInWorkingDir() {
|
|
19
|
+
const cwd = process.cwd();
|
|
20
|
+
const valeIniPath = path.join(cwd, ".vale.ini");
|
|
21
|
+
try {
|
|
22
|
+
await fs.access(valeIniPath, fsSync.constants.R_OK);
|
|
23
|
+
return valeIniPath;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Verifies that a Vale config file exists and is readable (async)
|
|
31
|
+
*/
|
|
32
|
+
export async function verifyConfigFile(configPath) {
|
|
33
|
+
try {
|
|
34
|
+
await fs.access(configPath, fsSync.constants.R_OK);
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Gets the absolute path for a config file
|
|
43
|
+
*/
|
|
44
|
+
export function resolveConfigPath(configPath) {
|
|
45
|
+
if (path.isAbsolute(configPath)) {
|
|
46
|
+
return configPath;
|
|
47
|
+
}
|
|
48
|
+
return path.resolve(process.cwd(), configPath);
|
|
49
|
+
}
|
|
50
|
+
export class PathNotAllowedError extends Error {
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* When VALE_ALLOWED_ROOTS is set (path-delimiter separated), rejects paths
|
|
54
|
+
* outside those directories. Symlinks are resolved first so they can't be
|
|
55
|
+
* used to escape. Unset means no restriction.
|
|
56
|
+
*/
|
|
57
|
+
export async function assertPathAllowed(target) {
|
|
58
|
+
const roots = process.env.VALE_ALLOWED_ROOTS?.split(path.delimiter).filter(Boolean);
|
|
59
|
+
if (!roots?.length)
|
|
60
|
+
return;
|
|
61
|
+
// Resolve the nearest existing ancestor so not-yet-existing paths still get checked
|
|
62
|
+
let real = path.resolve(target);
|
|
63
|
+
const tail = [];
|
|
64
|
+
for (;;) {
|
|
65
|
+
try {
|
|
66
|
+
real = path.join(await fs.realpath(real), ...tail);
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
const parent = path.dirname(real);
|
|
71
|
+
if (parent === real)
|
|
72
|
+
break;
|
|
73
|
+
tail.unshift(path.basename(real));
|
|
74
|
+
real = parent;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
for (const root of roots) {
|
|
78
|
+
let realRoot;
|
|
79
|
+
try {
|
|
80
|
+
realRoot = await fs.realpath(path.resolve(root));
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
const rel = path.relative(realRoot, real);
|
|
86
|
+
if (rel === "" || (!rel.startsWith("..") && !path.isAbsolute(rel)))
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
throw new PathNotAllowedError(`Access denied: ${target} is outside the directories allowed by VALE_ALLOWED_ROOTS`);
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,MAAM,MAAM,IAAI,CAAC;AAC7B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B;;GAEG;AACH,MAAM,UAAU,UAAU;IACxB,MAAM,MAAM,GAAqB,EAAE,CAAC;IAEpC,gCAAgC;IAChC,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;QACjC,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;IACnD,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB;IAC3C,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1B,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;IAEhD,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACpD,OAAO,WAAW,CAAC;IACrB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,UAAkB;IACvD,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC;IACd,C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