typegraph-mcp 0.9.32 → 0.9.33

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 CHANGED
@@ -142,7 +142,7 @@ npx typegraph-mcp check
142
142
  | Symptom | Fix |
143
143
  |---|---|
144
144
  | Server won't start | `cd plugins/typegraph-mcp && npm install --include=optional` |
145
- | "TypeScript not found" | Add `typescript` to devDependencies |
145
+ | "TypeScript not found" | Run `pnpm install` or `npm install`; if TypeScript is not declared, add it to devDependencies first |
146
146
  | Tools return empty results | Check `TYPEGRAPH_TSCONFIG` points to the right tsconfig |
147
147
  | Build errors from plugins/ | Add `"plugins/**"` to tsconfig.json `exclude` array |
148
148
  | `@esbuild/*` or `@rollup/*` package missing | Reinstall with Node 22: `npm install --include=optional` |
package/check.ts CHANGED
@@ -162,6 +162,45 @@ function hasTrustedCodexProject(projectRoot: string): boolean | null {
162
162
  return matchesTrustedProject();
163
163
  }
164
164
 
165
+ function readProjectPackageJson(projectRoot: string): Record<string, unknown> | null {
166
+ const packageJsonPath = path.resolve(projectRoot, "package.json");
167
+ if (!fs.existsSync(packageJsonPath)) return null;
168
+
169
+ try {
170
+ return JSON.parse(fs.readFileSync(packageJsonPath, "utf-8")) as Record<string, unknown>;
171
+ } catch {
172
+ return null;
173
+ }
174
+ }
175
+
176
+ function getProjectInstallCommand(projectRoot: string, packageJson: Record<string, unknown> | null): string {
177
+ const packageManager = typeof packageJson?.["packageManager"] === "string"
178
+ ? packageJson["packageManager"]
179
+ : "";
180
+
181
+ if (packageManager.startsWith("pnpm@") || fs.existsSync(path.join(projectRoot, "pnpm-lock.yaml"))) {
182
+ return "pnpm install";
183
+ }
184
+ if (packageManager.startsWith("yarn@") || fs.existsSync(path.join(projectRoot, "yarn.lock"))) {
185
+ return "yarn install";
186
+ }
187
+ return "npm install";
188
+ }
189
+
190
+ function hasDeclaredDependency(packageJson: Record<string, unknown> | null, packageName: string): boolean {
191
+ const depKeys = [
192
+ "dependencies",
193
+ "devDependencies",
194
+ "peerDependencies",
195
+ "optionalDependencies",
196
+ ] as const;
197
+
198
+ return depKeys.some((key) => {
199
+ const deps = packageJson?.[key];
200
+ return typeof deps === "object" && deps !== null && packageName in deps;
201
+ });
202
+ }
203
+
165
204
  // ─── Main ────────────────────────────────────────────────────────────────────
166
205
 
167
206
  export async function main(configOverride?: TypegraphConfig): Promise<CheckResult> {
@@ -171,6 +210,8 @@ export async function main(configOverride?: TypegraphConfig): Promise<CheckResul
171
210
  let passed = 0;
172
211
  let failed = 0;
173
212
  let warned = 0;
213
+ const projectPackageJson = readProjectPackageJson(projectRoot);
214
+ const installCommand = getProjectInstallCommand(projectRoot, projectPackageJson);
174
215
 
175
216
  function pass(msg: string): void {
176
217
  console.log(` \u2713 ${msg}`);
@@ -228,9 +269,14 @@ export async function main(configOverride?: TypegraphConfig): Promise<CheckResul
228
269
  tsVersion = tsPkg.version;
229
270
  pass(`TypeScript found (v${tsVersion})`);
230
271
  } catch {
272
+ const hasDeclaredTs = hasDeclaredDependency(projectPackageJson, "typescript");
231
273
  fail(
232
- "TypeScript not found in project",
233
- "Add `typescript` to devDependencies and run `npm install`"
274
+ hasDeclaredTs
275
+ ? "TypeScript is declared but not installed in project"
276
+ : "TypeScript not found in project",
277
+ hasDeclaredTs
278
+ ? `Run \`${installCommand}\` to install project dependencies`
279
+ : `Add \`typescript\` to devDependencies and run \`${installCommand}\``
234
280
  );
235
281
  }
236
282
 
package/dist/check.js CHANGED
@@ -472,11 +472,44 @@ function hasTrustedCodexProject(projectRoot) {
472
472
  }
473
473
  return matchesTrustedProject();
474
474
  }
475
+ function readProjectPackageJson(projectRoot) {
476
+ const packageJsonPath = path3.resolve(projectRoot, "package.json");
477
+ if (!fs2.existsSync(packageJsonPath)) return null;
478
+ try {
479
+ return JSON.parse(fs2.readFileSync(packageJsonPath, "utf-8"));
480
+ } catch {
481
+ return null;
482
+ }
483
+ }
484
+ function getProjectInstallCommand(projectRoot, packageJson) {
485
+ const packageManager = typeof packageJson?.["packageManager"] === "string" ? packageJson["packageManager"] : "";
486
+ if (packageManager.startsWith("pnpm@") || fs2.existsSync(path3.join(projectRoot, "pnpm-lock.yaml"))) {
487
+ return "pnpm install";
488
+ }
489
+ if (packageManager.startsWith("yarn@") || fs2.existsSync(path3.join(projectRoot, "yarn.lock"))) {
490
+ return "yarn install";
491
+ }
492
+ return "npm install";
493
+ }
494
+ function hasDeclaredDependency(packageJson, packageName) {
495
+ const depKeys = [
496
+ "dependencies",
497
+ "devDependencies",
498
+ "peerDependencies",
499
+ "optionalDependencies"
500
+ ];
501
+ return depKeys.some((key) => {
502
+ const deps = packageJson?.[key];
503
+ return typeof deps === "object" && deps !== null && packageName in deps;
504
+ });
505
+ }
475
506
  async function main(configOverride) {
476
507
  const { projectRoot, tsconfigPath, toolDir, toolIsEmbedded, toolRelPath } = configOverride ?? resolveConfig(import.meta.dirname);
477
508
  let passed = 0;
478
509
  let failed = 0;
479
510
  let warned = 0;
511
+ const projectPackageJson = readProjectPackageJson(projectRoot);
512
+ const installCommand = getProjectInstallCommand(projectRoot, projectPackageJson);
480
513
  function pass(msg) {
481
514
  console.log(` \u2713 ${msg}`);
482
515
  passed++;
@@ -522,9 +555,10 @@ async function main(configOverride) {
522
555
  tsVersion = tsPkg.version;
523
556
  pass(`TypeScript found (v${tsVersion})`);
524
557
  } catch {
558
+ const hasDeclaredTs = hasDeclaredDependency(projectPackageJson, "typescript");
525
559
  fail(
526
- "TypeScript not found in project",
527
- "Add `typescript` to devDependencies and run `npm install`"
560
+ hasDeclaredTs ? "TypeScript is declared but not installed in project" : "TypeScript not found in project",
561
+ hasDeclaredTs ? `Run \`${installCommand}\` to install project dependencies` : `Add \`typescript\` to devDependencies and run \`${installCommand}\``
528
562
  );
529
563
  }
530
564
  const tsconfigAbs = path3.resolve(projectRoot, tsconfigPath);
package/dist/cli.js CHANGED
@@ -479,11 +479,44 @@ function hasTrustedCodexProject(projectRoot3) {
479
479
  }
480
480
  return matchesTrustedProject();
481
481
  }
482
+ function readProjectPackageJson(projectRoot3) {
483
+ const packageJsonPath = path3.resolve(projectRoot3, "package.json");
484
+ if (!fs2.existsSync(packageJsonPath)) return null;
485
+ try {
486
+ return JSON.parse(fs2.readFileSync(packageJsonPath, "utf-8"));
487
+ } catch {
488
+ return null;
489
+ }
490
+ }
491
+ function getProjectInstallCommand(projectRoot3, packageJson) {
492
+ const packageManager = typeof packageJson?.["packageManager"] === "string" ? packageJson["packageManager"] : "";
493
+ if (packageManager.startsWith("pnpm@") || fs2.existsSync(path3.join(projectRoot3, "pnpm-lock.yaml"))) {
494
+ return "pnpm install";
495
+ }
496
+ if (packageManager.startsWith("yarn@") || fs2.existsSync(path3.join(projectRoot3, "yarn.lock"))) {
497
+ return "yarn install";
498
+ }
499
+ return "npm install";
500
+ }
501
+ function hasDeclaredDependency(packageJson, packageName) {
502
+ const depKeys = [
503
+ "dependencies",
504
+ "devDependencies",
505
+ "peerDependencies",
506
+ "optionalDependencies"
507
+ ];
508
+ return depKeys.some((key) => {
509
+ const deps = packageJson?.[key];
510
+ return typeof deps === "object" && deps !== null && packageName in deps;
511
+ });
512
+ }
482
513
  async function main(configOverride) {
483
514
  const { projectRoot: projectRoot3, tsconfigPath: tsconfigPath3, toolDir, toolIsEmbedded, toolRelPath } = configOverride ?? resolveConfig(import.meta.dirname);
484
515
  let passed = 0;
485
516
  let failed = 0;
486
517
  let warned = 0;
518
+ const projectPackageJson = readProjectPackageJson(projectRoot3);
519
+ const installCommand = getProjectInstallCommand(projectRoot3, projectPackageJson);
487
520
  function pass(msg) {
488
521
  console.log(` \u2713 ${msg}`);
489
522
  passed++;
@@ -529,9 +562,10 @@ async function main(configOverride) {
529
562
  tsVersion = tsPkg.version;
530
563
  pass(`TypeScript found (v${tsVersion})`);
531
564
  } catch {
565
+ const hasDeclaredTs = hasDeclaredDependency(projectPackageJson, "typescript");
532
566
  fail(
533
- "TypeScript not found in project",
534
- "Add `typescript` to devDependencies and run `npm install`"
567
+ hasDeclaredTs ? "TypeScript is declared but not installed in project" : "TypeScript not found in project",
568
+ hasDeclaredTs ? `Run \`${installCommand}\` to install project dependencies` : `Add \`typescript\` to devDependencies and run \`${installCommand}\``
535
569
  );
536
570
  }
537
571
  const tsconfigAbs = path3.resolve(projectRoot3, tsconfigPath3);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typegraph-mcp",
3
- "version": "0.9.32",
3
+ "version": "0.9.33",
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",