typegraph-mcp 0.9.14 → 0.9.16
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/cli.ts +59 -1
- package/dist/cli.js +45 -0
- package/package.json +1 -1
package/cli.ts
CHANGED
|
@@ -313,6 +313,61 @@ function deregisterCodexMcp(projectRoot: string): void {
|
|
|
313
313
|
p.log.info(`${configPath}: removed typegraph MCP server`);
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
+
// ─── TSConfig Exclude ─────────────────────────────────────────────────────────
|
|
317
|
+
|
|
318
|
+
function ensureTsconfigExclude(projectRoot: string): void {
|
|
319
|
+
const tsconfigPath = path.resolve(projectRoot, "tsconfig.json");
|
|
320
|
+
if (!fs.existsSync(tsconfigPath)) return;
|
|
321
|
+
|
|
322
|
+
try {
|
|
323
|
+
const raw = fs.readFileSync(tsconfigPath, "utf-8");
|
|
324
|
+
// Strip single-line comments (// ...) and trailing commas for JSON.parse
|
|
325
|
+
const stripped = raw
|
|
326
|
+
.replace(/\/\/.*$/gm, "")
|
|
327
|
+
.replace(/,(\s*[}\]])/g, "$1");
|
|
328
|
+
const tsconfig = JSON.parse(stripped);
|
|
329
|
+
|
|
330
|
+
const exclude: string[] = tsconfig.exclude || [];
|
|
331
|
+
if (exclude.some((e: string) => e === "plugins" || e === "plugins/**" || e === "plugins/*")) {
|
|
332
|
+
return; // Already excluded
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// Insert "plugins/**" into the exclude array in the original file
|
|
336
|
+
if (raw.includes('"exclude"')) {
|
|
337
|
+
// Existing exclude array — append to it
|
|
338
|
+
const updated = raw.replace(
|
|
339
|
+
/("exclude"\s*:\s*\[)([\s\S]*?)(\])/,
|
|
340
|
+
(_match, open, items, close) => {
|
|
341
|
+
const trimmed = items.trimEnd();
|
|
342
|
+
const needsComma = trimmed.length > 0 && !trimmed.endsWith(",");
|
|
343
|
+
return `${open}${items.trimEnd()}${needsComma ? "," : ""}\n "plugins/**"${close}`;
|
|
344
|
+
}
|
|
345
|
+
);
|
|
346
|
+
fs.writeFileSync(tsconfigPath, updated);
|
|
347
|
+
} else {
|
|
348
|
+
// No exclude field — add one before the closing brace
|
|
349
|
+
const updated = raw.replace(/(\n)(\s*\})(\s*)$/, '$1 "exclude": ["plugins/**"]\n$2$3');
|
|
350
|
+
// If that didn't match (unusual formatting), try simpler approach
|
|
351
|
+
if (updated === raw) {
|
|
352
|
+
const lastBrace = raw.lastIndexOf("}");
|
|
353
|
+
if (lastBrace !== -1) {
|
|
354
|
+
const before = raw.slice(0, lastBrace).trimEnd();
|
|
355
|
+
const needsComma = !before.endsWith(",") && !before.endsWith("{");
|
|
356
|
+
const patched = `${before}${needsComma ? "," : ""}\n "exclude": ["plugins/**"]\n}\n`;
|
|
357
|
+
fs.writeFileSync(tsconfigPath, patched);
|
|
358
|
+
}
|
|
359
|
+
} else {
|
|
360
|
+
fs.writeFileSync(tsconfigPath, updated);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
p.log.success('Added "plugins/**" to tsconfig.json exclude (prevents build errors)');
|
|
365
|
+
} catch {
|
|
366
|
+
// Don't fail setup over tsconfig parsing issues
|
|
367
|
+
p.log.warn('Could not update tsconfig.json — manually add "plugins/**" to the exclude array to prevent build errors');
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
316
371
|
// ─── Agent Selection ─────────────────────────────────────────────────────────
|
|
317
372
|
|
|
318
373
|
function detectAgents(projectRoot: string): AgentId[] {
|
|
@@ -512,7 +567,10 @@ async function setup(yes: boolean): Promise<void> {
|
|
|
512
567
|
// 7. Register MCP server in agent-specific configs
|
|
513
568
|
registerMcpServers(projectRoot, selectedAgents);
|
|
514
569
|
|
|
515
|
-
// 8.
|
|
570
|
+
// 8. Ensure plugins/ is excluded from tsconfig
|
|
571
|
+
ensureTsconfigExclude(projectRoot);
|
|
572
|
+
|
|
573
|
+
// 9. Verification
|
|
516
574
|
await runVerification(targetDir, selectedAgents);
|
|
517
575
|
}
|
|
518
576
|
|
package/dist/cli.js
CHANGED
|
@@ -2497,6 +2497,50 @@ function deregisterCodexMcp(projectRoot2) {
|
|
|
2497
2497
|
}
|
|
2498
2498
|
p.log.info(`${configPath}: removed typegraph MCP server`);
|
|
2499
2499
|
}
|
|
2500
|
+
function ensureTsconfigExclude(projectRoot2) {
|
|
2501
|
+
const tsconfigPath2 = path8.resolve(projectRoot2, "tsconfig.json");
|
|
2502
|
+
if (!fs7.existsSync(tsconfigPath2)) return;
|
|
2503
|
+
try {
|
|
2504
|
+
const raw = fs7.readFileSync(tsconfigPath2, "utf-8");
|
|
2505
|
+
const stripped = raw.replace(/\/\/.*$/gm, "").replace(/,(\s*[}\]])/g, "$1");
|
|
2506
|
+
const tsconfig = JSON.parse(stripped);
|
|
2507
|
+
const exclude = tsconfig.exclude || [];
|
|
2508
|
+
if (exclude.some((e) => e === "plugins" || e === "plugins/**" || e === "plugins/*")) {
|
|
2509
|
+
return;
|
|
2510
|
+
}
|
|
2511
|
+
if (raw.includes('"exclude"')) {
|
|
2512
|
+
const updated = raw.replace(
|
|
2513
|
+
/("exclude"\s*:\s*\[)([\s\S]*?)(\])/,
|
|
2514
|
+
(_match, open, items, close) => {
|
|
2515
|
+
const trimmed = items.trimEnd();
|
|
2516
|
+
const needsComma = trimmed.length > 0 && !trimmed.endsWith(",");
|
|
2517
|
+
return `${open}${items.trimEnd()}${needsComma ? "," : ""}
|
|
2518
|
+
"plugins/**"${close}`;
|
|
2519
|
+
}
|
|
2520
|
+
);
|
|
2521
|
+
fs7.writeFileSync(tsconfigPath2, updated);
|
|
2522
|
+
} else {
|
|
2523
|
+
const updated = raw.replace(/(\n)(\s*\})(\s*)$/, '$1 "exclude": ["plugins/**"]\n$2$3');
|
|
2524
|
+
if (updated === raw) {
|
|
2525
|
+
const lastBrace = raw.lastIndexOf("}");
|
|
2526
|
+
if (lastBrace !== -1) {
|
|
2527
|
+
const before = raw.slice(0, lastBrace).trimEnd();
|
|
2528
|
+
const needsComma = !before.endsWith(",") && !before.endsWith("{");
|
|
2529
|
+
const patched = `${before}${needsComma ? "," : ""}
|
|
2530
|
+
"exclude": ["plugins/**"]
|
|
2531
|
+
}
|
|
2532
|
+
`;
|
|
2533
|
+
fs7.writeFileSync(tsconfigPath2, patched);
|
|
2534
|
+
}
|
|
2535
|
+
} else {
|
|
2536
|
+
fs7.writeFileSync(tsconfigPath2, updated);
|
|
2537
|
+
}
|
|
2538
|
+
}
|
|
2539
|
+
p.log.success('Added "plugins/**" to tsconfig.json exclude (prevents build errors)');
|
|
2540
|
+
} catch {
|
|
2541
|
+
p.log.warn('Could not update tsconfig.json \u2014 manually add "plugins/**" to the exclude array to prevent build errors');
|
|
2542
|
+
}
|
|
2543
|
+
}
|
|
2500
2544
|
function detectAgents(projectRoot2) {
|
|
2501
2545
|
return AGENT_IDS.filter((id) => AGENTS[id].detect(projectRoot2));
|
|
2502
2546
|
}
|
|
@@ -2640,6 +2684,7 @@ async function setup(yes2) {
|
|
|
2640
2684
|
}
|
|
2641
2685
|
await setupAgentInstructions(projectRoot2, selectedAgents);
|
|
2642
2686
|
registerMcpServers(projectRoot2, selectedAgents);
|
|
2687
|
+
ensureTsconfigExclude(projectRoot2);
|
|
2643
2688
|
await runVerification(targetDir, selectedAgents);
|
|
2644
2689
|
}
|
|
2645
2690
|
async function removePlugin(projectRoot2, pluginDir) {
|