typegraph-mcp 0.9.35 → 0.9.37

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 CHANGED
@@ -41,6 +41,12 @@ interface LegacyGlobalCodexCleanup {
41
41
  nextContent: string;
42
42
  }
43
43
 
44
+ interface RemovePluginOptions {
45
+ removeGlobalCodex: boolean;
46
+ legacyGlobalCodexCleanup: LegacyGlobalCodexCleanup | null;
47
+ warnAboutGlobalCodex: boolean;
48
+ }
49
+
44
50
  // ─── Constants ───────────────────────────────────────────────────────────────
45
51
 
46
52
  const AGENT_SNIPPET = `
@@ -68,6 +74,7 @@ Practical rule:
68
74
  `.trimStart();
69
75
 
70
76
  const SNIPPET_MARKER = "## TypeScript Navigation (typegraph-mcp)";
77
+ const CLAUDE_NODE_PLACEHOLDER = "__TYPEGRAPH_NODE__";
71
78
 
72
79
  const PLUGIN_DIR_NAME = "plugins/typegraph-mcp";
73
80
 
@@ -145,6 +152,14 @@ const SKILL_FILES = [
145
152
  "skills/deep-survey/SKILL.md",
146
153
  ];
147
154
 
155
+ const CLAUDE_TEMPLATE_FILES = new Set([
156
+ "commands/check.md",
157
+ "commands/test.md",
158
+ "commands/bench.md",
159
+ "commands/deep-survey.md",
160
+ "skills/deep-survey/SKILL.md",
161
+ ]);
162
+
148
163
 
149
164
  const SKILL_NAMES = [
150
165
  "tool-selection",
@@ -413,6 +428,41 @@ function removeLegacyGlobalCodexMcp(cleanup: LegacyGlobalCodexCleanup): void {
413
428
  p.log.info("~/.codex/config.toml: removed stale global typegraph MCP server entry for this project");
414
429
  }
415
430
 
431
+ async function resolveRemovePluginOptions(
432
+ projectRoot: string,
433
+ yes: boolean,
434
+ cleanGlobalCodex: boolean
435
+ ): Promise<RemovePluginOptions> {
436
+ const legacyGlobalCodexCleanup = findLegacyGlobalCodexCleanup(projectRoot);
437
+ let removeGlobalCodex = cleanGlobalCodex;
438
+
439
+ if (legacyGlobalCodexCleanup && !cleanGlobalCodex && !yes) {
440
+ const shouldRemoveGlobal = await p.confirm({
441
+ message: "Also remove the stale global Codex MCP entry for this project from ~/.codex/config.toml?",
442
+ initialValue: false,
443
+ });
444
+ if (p.isCancel(shouldRemoveGlobal)) {
445
+ p.cancel("Removal cancelled.");
446
+ process.exit(0);
447
+ }
448
+ removeGlobalCodex = shouldRemoveGlobal;
449
+ }
450
+
451
+ return {
452
+ removeGlobalCodex,
453
+ legacyGlobalCodexCleanup,
454
+ warnAboutGlobalCodex: legacyGlobalCodexCleanup !== null && !removeGlobalCodex,
455
+ };
456
+ }
457
+
458
+ function warnAboutStaleGlobalCodex(): void {
459
+ p.log.warn(
460
+ "Left a stale global Codex MCP entry for this project in ~/.codex/config.toml. " +
461
+ "Codex may show MCP startup warnings or errors until you remove it. " +
462
+ "Re-run `typegraph-mcp remove --clean-global-codex` or remove the `typegraph` block manually."
463
+ );
464
+ }
465
+
416
466
  /** Register the typegraph MCP server in agent-specific config files */
417
467
  function registerMcpServers(projectRoot: string, selectedAgents: AgentId[]): void {
418
468
  if (selectedAgents.includes("cursor")) {
@@ -724,7 +774,11 @@ async function setup(yes: boolean): Promise<void> {
724
774
  }
725
775
 
726
776
  if (action === "remove") {
727
- await removePlugin(projectRoot, targetDir);
777
+ const removeOptions = await resolveRemovePluginOptions(projectRoot, false, false);
778
+ await removePlugin(projectRoot, targetDir, removeOptions);
779
+ if (removeOptions.warnAboutGlobalCodex) {
780
+ warnAboutStaleGlobalCodex();
781
+ }
728
782
  return;
729
783
  }
730
784
 
@@ -765,7 +819,14 @@ async function setup(yes: boolean): Promise<void> {
765
819
  const src = path.join(sourceDir, file);
766
820
  const dest = path.join(targetDir, file);
767
821
  if (fs.existsSync(src)) {
768
- copyFile(src, dest);
822
+ if (selectedAgents.includes("claude-code") && CLAUDE_TEMPLATE_FILES.has(file)) {
823
+ const content = fs.readFileSync(src, "utf-8")
824
+ .replaceAll(CLAUDE_NODE_PLACEHOLDER, process.execPath);
825
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
826
+ fs.writeFileSync(dest, content);
827
+ } else {
828
+ copyFile(src, dest);
829
+ }
769
830
  copied++;
770
831
  } else {
771
832
  p.log.warn(`Source file not found: ${file}`);
@@ -777,8 +838,8 @@ async function setup(yes: boolean): Promise<void> {
777
838
  const mcpConfig = {
778
839
  mcpServers: {
779
840
  typegraph: {
780
- command: "npx",
781
- args: ["tsx", "${CLAUDE_PLUGIN_ROOT}/server.ts"],
841
+ command: process.execPath,
842
+ args: ["${CLAUDE_PLUGIN_ROOT}/node_modules/tsx/dist/cli.mjs", "${CLAUDE_PLUGIN_ROOT}/server.ts"],
782
843
  env: {
783
844
  TYPEGRAPH_PROJECT_ROOT: ".",
784
845
  TYPEGRAPH_TSCONFIG: "./tsconfig.json",
@@ -869,7 +930,7 @@ async function setup(yes: boolean): Promise<void> {
869
930
  async function removePlugin(
870
931
  projectRoot: string,
871
932
  pluginDir: string,
872
- options: { removeGlobalCodex: boolean; legacyGlobalCodexCleanup: LegacyGlobalCodexCleanup | null }
933
+ options: RemovePluginOptions
873
934
  ): Promise<void> {
874
935
  const s = p.spinner();
875
936
  s.start("Removing typegraph-mcp...");
@@ -1056,32 +1117,11 @@ async function remove(yes: boolean): Promise<void> {
1056
1117
  }
1057
1118
  }
1058
1119
 
1059
- const legacyGlobalCodexCleanup = findLegacyGlobalCodexCleanup(projectRoot);
1060
- let removeGlobalCodex = cleanGlobalCodex;
1061
-
1062
- if (legacyGlobalCodexCleanup && !cleanGlobalCodex && !yes) {
1063
- const shouldRemoveGlobal = await p.confirm({
1064
- message: "Also remove the stale global Codex MCP entry for this project from ~/.codex/config.toml?",
1065
- initialValue: false,
1066
- });
1067
- if (p.isCancel(shouldRemoveGlobal)) {
1068
- p.cancel("Removal cancelled.");
1069
- process.exit(0);
1070
- }
1071
- removeGlobalCodex = shouldRemoveGlobal;
1072
- }
1073
-
1074
- await removePlugin(projectRoot, pluginDir, {
1075
- removeGlobalCodex,
1076
- legacyGlobalCodexCleanup,
1077
- });
1120
+ const removeOptions = await resolveRemovePluginOptions(projectRoot, yes, cleanGlobalCodex);
1121
+ await removePlugin(projectRoot, pluginDir, removeOptions);
1078
1122
 
1079
- if (legacyGlobalCodexCleanup && !removeGlobalCodex) {
1080
- p.log.warn(
1081
- "Left a stale global Codex MCP entry for this project in ~/.codex/config.toml. " +
1082
- "Codex may show MCP startup warnings or errors until you remove it. " +
1083
- "Re-run `typegraph-mcp remove --clean-global-codex` or remove the `typegraph` block manually."
1084
- );
1123
+ if (removeOptions.warnAboutGlobalCodex) {
1124
+ warnAboutStaleGlobalCodex();
1085
1125
  }
1086
1126
  }
1087
1127
 
package/commands/bench.md CHANGED
@@ -12,7 +12,7 @@ Run benchmarks to measure typegraph-mcp performance on this project.
12
12
  1. Run the benchmark command:
13
13
 
14
14
  ```bash
15
- npx tsx ${CLAUDE_PLUGIN_ROOT}/cli.ts bench
15
+ "__TYPEGRAPH_NODE__" "${CLAUDE_PLUGIN_ROOT}/node_modules/tsx/dist/cli.mjs" "${CLAUDE_PLUGIN_ROOT}/cli.ts" bench
16
16
  ```
17
17
 
18
18
  2. Parse the output and report results:
package/commands/check.md CHANGED
@@ -12,7 +12,7 @@ Run health checks to verify typegraph-mcp is correctly set up for this project.
12
12
  1. Run the health check command:
13
13
 
14
14
  ```bash
15
- npx tsx ${CLAUDE_PLUGIN_ROOT}/cli.ts check
15
+ "__TYPEGRAPH_NODE__" "${CLAUDE_PLUGIN_ROOT}/node_modules/tsx/dist/cli.mjs" "${CLAUDE_PLUGIN_ROOT}/cli.ts" check
16
16
  ```
17
17
 
18
18
  2. Parse the output and report results:
@@ -23,7 +23,7 @@ Follow the phases below in order. Each phase produces findings.
23
23
 
24
24
  Run the health check first:
25
25
  ```bash
26
- npx tsx ${CLAUDE_PLUGIN_ROOT}/cli.ts check
26
+ "__TYPEGRAPH_NODE__" "${CLAUDE_PLUGIN_ROOT}/node_modules/tsx/dist/cli.mjs" "${CLAUDE_PLUGIN_ROOT}/cli.ts" check
27
27
  ```
28
28
 
29
29
  Record three numbers from the output:
package/commands/test.md CHANGED
@@ -12,7 +12,7 @@ Run smoke tests that exercise all 14 tools against the current project.
12
12
  1. Run the smoke test command:
13
13
 
14
14
  ```bash
15
- npx tsx ${CLAUDE_PLUGIN_ROOT}/cli.ts test
15
+ "__TYPEGRAPH_NODE__" "${CLAUDE_PLUGIN_ROOT}/node_modules/tsx/dist/cli.mjs" "${CLAUDE_PLUGIN_ROOT}/cli.ts" test
16
16
  ```
17
17
 
18
18
  2. Parse the output and report results:
package/dist/cli.js CHANGED
@@ -2941,6 +2941,7 @@ Practical rule:
2941
2941
  - combine both when a task spans TypeScript code and surrounding docs/config
2942
2942
  `.trimStart();
2943
2943
  var SNIPPET_MARKER = "## TypeScript Navigation (typegraph-mcp)";
2944
+ var CLAUDE_NODE_PLACEHOLDER = "__TYPEGRAPH_NODE__";
2944
2945
  var PLUGIN_DIR_NAME = "plugins/typegraph-mcp";
2945
2946
  var AGENT_IDS = ["claude-code", "cursor", "codex", "gemini", "copilot"];
2946
2947
  var AGENTS = {
@@ -3007,6 +3008,13 @@ var SKILL_FILES = [
3007
3008
  "skills/code-exploration/SKILL.md",
3008
3009
  "skills/deep-survey/SKILL.md"
3009
3010
  ];
3011
+ var CLAUDE_TEMPLATE_FILES = /* @__PURE__ */ new Set([
3012
+ "commands/check.md",
3013
+ "commands/test.md",
3014
+ "commands/bench.md",
3015
+ "commands/deep-survey.md",
3016
+ "skills/deep-survey/SKILL.md"
3017
+ ]);
3010
3018
  var SKILL_NAMES = [
3011
3019
  "tool-selection",
3012
3020
  "impact-analysis",
@@ -3202,6 +3210,31 @@ function removeLegacyGlobalCodexMcp(cleanup) {
3202
3210
  }
3203
3211
  p.log.info("~/.codex/config.toml: removed stale global typegraph MCP server entry for this project");
3204
3212
  }
3213
+ async function resolveRemovePluginOptions(projectRoot3, yes2, cleanGlobalCodex) {
3214
+ const legacyGlobalCodexCleanup = findLegacyGlobalCodexCleanup(projectRoot3);
3215
+ let removeGlobalCodex = cleanGlobalCodex;
3216
+ if (legacyGlobalCodexCleanup && !cleanGlobalCodex && !yes2) {
3217
+ const shouldRemoveGlobal = await p.confirm({
3218
+ message: "Also remove the stale global Codex MCP entry for this project from ~/.codex/config.toml?",
3219
+ initialValue: false
3220
+ });
3221
+ if (p.isCancel(shouldRemoveGlobal)) {
3222
+ p.cancel("Removal cancelled.");
3223
+ process.exit(0);
3224
+ }
3225
+ removeGlobalCodex = shouldRemoveGlobal;
3226
+ }
3227
+ return {
3228
+ removeGlobalCodex,
3229
+ legacyGlobalCodexCleanup,
3230
+ warnAboutGlobalCodex: legacyGlobalCodexCleanup !== null && !removeGlobalCodex
3231
+ };
3232
+ }
3233
+ function warnAboutStaleGlobalCodex() {
3234
+ p.log.warn(
3235
+ "Left a stale global Codex MCP entry for this project in ~/.codex/config.toml. Codex may show MCP startup warnings or errors until you remove it. Re-run `typegraph-mcp remove --clean-global-codex` or remove the `typegraph` block manually."
3236
+ );
3237
+ }
3205
3238
  function registerMcpServers(projectRoot3, selectedAgents) {
3206
3239
  if (selectedAgents.includes("cursor")) {
3207
3240
  registerJsonMcp(projectRoot3, ".cursor/mcp.json", "mcpServers");
@@ -3439,7 +3472,11 @@ async function setup(yes2) {
3439
3472
  process.exit(0);
3440
3473
  }
3441
3474
  if (action === "remove") {
3442
- await removePlugin(projectRoot3, targetDir);
3475
+ const removeOptions = await resolveRemovePluginOptions(projectRoot3, false, false);
3476
+ await removePlugin(projectRoot3, targetDir, removeOptions);
3477
+ if (removeOptions.warnAboutGlobalCodex) {
3478
+ warnAboutStaleGlobalCodex();
3479
+ }
3443
3480
  return;
3444
3481
  }
3445
3482
  if (action === "exit") {
@@ -3465,7 +3502,13 @@ async function setup(yes2) {
3465
3502
  const src = path9.join(sourceDir, file);
3466
3503
  const dest = path9.join(targetDir, file);
3467
3504
  if (fs8.existsSync(src)) {
3468
- copyFile(src, dest);
3505
+ if (selectedAgents.includes("claude-code") && CLAUDE_TEMPLATE_FILES.has(file)) {
3506
+ const content = fs8.readFileSync(src, "utf-8").replaceAll(CLAUDE_NODE_PLACEHOLDER, process.execPath);
3507
+ fs8.mkdirSync(path9.dirname(dest), { recursive: true });
3508
+ fs8.writeFileSync(dest, content);
3509
+ } else {
3510
+ copyFile(src, dest);
3511
+ }
3469
3512
  copied++;
3470
3513
  } else {
3471
3514
  p.log.warn(`Source file not found: ${file}`);
@@ -3475,8 +3518,8 @@ async function setup(yes2) {
3475
3518
  const mcpConfig = {
3476
3519
  mcpServers: {
3477
3520
  typegraph: {
3478
- command: "npx",
3479
- args: ["tsx", "${CLAUDE_PLUGIN_ROOT}/server.ts"],
3521
+ command: process.execPath,
3522
+ args: ["${CLAUDE_PLUGIN_ROOT}/node_modules/tsx/dist/cli.mjs", "${CLAUDE_PLUGIN_ROOT}/server.ts"],
3480
3523
  env: {
3481
3524
  TYPEGRAPH_PROJECT_ROOT: ".",
3482
3525
  TYPEGRAPH_TSCONFIG: "./tsconfig.json"
@@ -3681,27 +3724,10 @@ async function remove(yes2) {
3681
3724
  process.exit(0);
3682
3725
  }
3683
3726
  }
3684
- const legacyGlobalCodexCleanup = findLegacyGlobalCodexCleanup(projectRoot3);
3685
- let removeGlobalCodex = cleanGlobalCodex;
3686
- if (legacyGlobalCodexCleanup && !cleanGlobalCodex && !yes2) {
3687
- const shouldRemoveGlobal = await p.confirm({
3688
- message: "Also remove the stale global Codex MCP entry for this project from ~/.codex/config.toml?",
3689
- initialValue: false
3690
- });
3691
- if (p.isCancel(shouldRemoveGlobal)) {
3692
- p.cancel("Removal cancelled.");
3693
- process.exit(0);
3694
- }
3695
- removeGlobalCodex = shouldRemoveGlobal;
3696
- }
3697
- await removePlugin(projectRoot3, pluginDir, {
3698
- removeGlobalCodex,
3699
- legacyGlobalCodexCleanup
3700
- });
3701
- if (legacyGlobalCodexCleanup && !removeGlobalCodex) {
3702
- p.log.warn(
3703
- "Left a stale global Codex MCP entry for this project in ~/.codex/config.toml. Codex may show MCP startup warnings or errors until you remove it. Re-run `typegraph-mcp remove --clean-global-codex` or remove the `typegraph` block manually."
3704
- );
3727
+ const removeOptions = await resolveRemovePluginOptions(projectRoot3, yes2, cleanGlobalCodex);
3728
+ await removePlugin(projectRoot3, pluginDir, removeOptions);
3729
+ if (removeOptions.warnAboutGlobalCodex) {
3730
+ warnAboutStaleGlobalCodex();
3705
3731
  }
3706
3732
  }
3707
3733
  function resolvePluginDir() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typegraph-mcp",
3
- "version": "0.9.35",
3
+ "version": "0.9.37",
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",
@@ -31,7 +31,7 @@ Follow the phases below in order. Each phase produces findings.
31
31
 
32
32
  Run the health check first:
33
33
  ```bash
34
- npx tsx ${CLAUDE_PLUGIN_ROOT}/cli.ts check
34
+ "__TYPEGRAPH_NODE__" "${CLAUDE_PLUGIN_ROOT}/node_modules/tsx/dist/cli.mjs" "${CLAUDE_PLUGIN_ROOT}/cli.ts" check
35
35
  ```
36
36
 
37
37
  Record three numbers from the output: