@yawlabs/ctxlint 0.4.0 → 0.5.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 +84 -2
- package/dist/{chunk-WEYNMCAH.js → chunk-FHTSMC5D.js} +1033 -45
- package/dist/{cli-VYWAONGX.js → cli-7IBRPDA6.js} +118 -24
- package/dist/index.js +2 -2
- package/dist/mcp/server.js +1083 -52
- package/dist/{server-7C2IQ7VV.js → server-IFZ3VEK3.js} +47 -2
- package/package.json +16 -10
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ALL_CHECKS,
|
|
4
|
+
ALL_MCP_CHECKS,
|
|
4
5
|
VERSION,
|
|
5
6
|
applyFixes,
|
|
6
7
|
fileExists,
|
|
@@ -11,7 +12,7 @@ import {
|
|
|
11
12
|
resetGit,
|
|
12
13
|
runAudit,
|
|
13
14
|
scanForContextFiles
|
|
14
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-FHTSMC5D.js";
|
|
15
16
|
|
|
16
17
|
// src/mcp/server.ts
|
|
17
18
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -25,7 +26,15 @@ var checkEnum = z.enum([
|
|
|
25
26
|
"tokens",
|
|
26
27
|
"redundancy",
|
|
27
28
|
"contradictions",
|
|
28
|
-
"frontmatter"
|
|
29
|
+
"frontmatter",
|
|
30
|
+
"mcp-schema",
|
|
31
|
+
"mcp-security",
|
|
32
|
+
"mcp-commands",
|
|
33
|
+
"mcp-deprecated",
|
|
34
|
+
"mcp-env",
|
|
35
|
+
"mcp-urls",
|
|
36
|
+
"mcp-consistency",
|
|
37
|
+
"mcp-redundancy"
|
|
29
38
|
]);
|
|
30
39
|
var server = new McpServer({
|
|
31
40
|
name: "ctxlint",
|
|
@@ -198,5 +207,41 @@ server.tool(
|
|
|
198
207
|
}
|
|
199
208
|
}
|
|
200
209
|
);
|
|
210
|
+
server.tool(
|
|
211
|
+
"ctxlint_mcp_audit",
|
|
212
|
+
"Lint MCP server configuration files in a project. Checks for schema errors, hardcoded secrets, deprecated transports, wrong env var syntax, URL issues, and cross-client inconsistencies.",
|
|
213
|
+
{
|
|
214
|
+
projectPath: z.string().optional().describe("Path to the project root. Defaults to current working directory."),
|
|
215
|
+
checks: z.array(checkEnum).optional().describe("Specific MCP checks to run (default: all mcp-* checks)."),
|
|
216
|
+
includeGlobal: z.boolean().optional().describe("Also scan global/user-level MCP configs.")
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
readOnlyHint: true,
|
|
220
|
+
destructiveHint: false,
|
|
221
|
+
idempotentHint: true,
|
|
222
|
+
openWorldHint: false
|
|
223
|
+
},
|
|
224
|
+
async ({ projectPath, checks, includeGlobal }) => {
|
|
225
|
+
const root = path.resolve(projectPath || process.cwd());
|
|
226
|
+
const activeChecks = checks || ALL_MCP_CHECKS;
|
|
227
|
+
try {
|
|
228
|
+
const result = await runAudit(root, activeChecks, {
|
|
229
|
+
mcp: true,
|
|
230
|
+
mcpOnly: true,
|
|
231
|
+
mcpGlobal: includeGlobal || false
|
|
232
|
+
});
|
|
233
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
234
|
+
} catch (err) {
|
|
235
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
236
|
+
return {
|
|
237
|
+
content: [{ type: "text", text: JSON.stringify({ error: msg }) }],
|
|
238
|
+
isError: true
|
|
239
|
+
};
|
|
240
|
+
} finally {
|
|
241
|
+
freeEncoder();
|
|
242
|
+
resetGit();
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
);
|
|
201
246
|
var transport = new StdioServerTransport();
|
|
202
247
|
await server.connect(transport);
|
package/package.json
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yawlabs/ctxlint",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Lint your AI agent context files (CLAUDE.md, AGENTS.md, etc.) against your actual codebase",
|
|
5
5
|
"bin": {
|
|
6
6
|
"ctxlint": "dist/index.js"
|
|
7
7
|
},
|
|
8
8
|
"type": "module",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsup",
|
|
11
|
+
"dev": "tsup --watch",
|
|
12
|
+
"test": "vitest",
|
|
13
|
+
"test:run": "vitest run",
|
|
14
|
+
"lint": "eslint src/",
|
|
15
|
+
"format": "prettier --write src/",
|
|
16
|
+
"mcp": "node dist/mcp/server.js"
|
|
17
|
+
},
|
|
9
18
|
"keywords": [
|
|
10
19
|
"claude",
|
|
11
20
|
"agents",
|
|
@@ -40,6 +49,7 @@
|
|
|
40
49
|
"engines": {
|
|
41
50
|
"node": ">=18"
|
|
42
51
|
},
|
|
52
|
+
"packageManager": "pnpm@10.33.0",
|
|
43
53
|
"dependencies": {
|
|
44
54
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
45
55
|
"chalk": "^5.6.2",
|
|
@@ -62,13 +72,9 @@
|
|
|
62
72
|
"typescript-eslint": "^8.58.0",
|
|
63
73
|
"vitest": "^4.1.2"
|
|
64
74
|
},
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"test:run": "vitest run",
|
|
70
|
-
"lint": "eslint src/",
|
|
71
|
-
"format": "prettier --write src/",
|
|
72
|
-
"mcp": "node dist/mcp/server.js"
|
|
75
|
+
"pnpm": {
|
|
76
|
+
"onlyBuiltDependencies": [
|
|
77
|
+
"esbuild"
|
|
78
|
+
]
|
|
73
79
|
}
|
|
74
|
-
}
|
|
80
|
+
}
|