typegraph-mcp 0.9.15 → 0.9.17

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