typegraph-mcp 0.9.36 → 0.9.38
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 +21 -3
- package/commands/bench.md +1 -1
- package/commands/check.md +1 -1
- package/commands/deep-survey.md +1 -1
- package/commands/test.md +1 -1
- package/dist/cli.js +19 -3
- package/package.json +1 -1
- package/skills/code-exploration/SKILL.md +7 -0
- package/skills/deep-survey/SKILL.md +5 -1
- package/skills/tool-selection/SKILL.md +3 -0
package/cli.ts
CHANGED
|
@@ -59,6 +59,8 @@ Where suitable, use the \`ts_*\` MCP tools instead of grep/glob for navigating T
|
|
|
59
59
|
|
|
60
60
|
Start with the navigation tools before reading entire files. Use direct file reads only after the MCP tools identify the exact symbols or lines that matter.
|
|
61
61
|
|
|
62
|
+
For quick architectural insight, prefer composition modules and entrypoints over top-level barrel files. If \`ts_module_exports\` on an \`index.ts\` or other barrel looks empty or uninformative, pivot to the app entrypoint, router, handler, service composition root, or API module that wires real behavior together.
|
|
63
|
+
|
|
62
64
|
Use \`rg\` or \`grep\` when semantic symbol navigation is not the right tool, especially for:
|
|
63
65
|
|
|
64
66
|
- docs, config, SQL, migrations, JSON, env vars, route strings, and other non-TypeScript assets
|
|
@@ -74,6 +76,7 @@ Practical rule:
|
|
|
74
76
|
`.trimStart();
|
|
75
77
|
|
|
76
78
|
const SNIPPET_MARKER = "## TypeScript Navigation (typegraph-mcp)";
|
|
79
|
+
const CLAUDE_NODE_PLACEHOLDER = "__TYPEGRAPH_NODE__";
|
|
77
80
|
|
|
78
81
|
const PLUGIN_DIR_NAME = "plugins/typegraph-mcp";
|
|
79
82
|
|
|
@@ -151,6 +154,14 @@ const SKILL_FILES = [
|
|
|
151
154
|
"skills/deep-survey/SKILL.md",
|
|
152
155
|
];
|
|
153
156
|
|
|
157
|
+
const CLAUDE_TEMPLATE_FILES = new Set([
|
|
158
|
+
"commands/check.md",
|
|
159
|
+
"commands/test.md",
|
|
160
|
+
"commands/bench.md",
|
|
161
|
+
"commands/deep-survey.md",
|
|
162
|
+
"skills/deep-survey/SKILL.md",
|
|
163
|
+
]);
|
|
164
|
+
|
|
154
165
|
|
|
155
166
|
const SKILL_NAMES = [
|
|
156
167
|
"tool-selection",
|
|
@@ -810,7 +821,14 @@ async function setup(yes: boolean): Promise<void> {
|
|
|
810
821
|
const src = path.join(sourceDir, file);
|
|
811
822
|
const dest = path.join(targetDir, file);
|
|
812
823
|
if (fs.existsSync(src)) {
|
|
813
|
-
|
|
824
|
+
if (selectedAgents.includes("claude-code") && CLAUDE_TEMPLATE_FILES.has(file)) {
|
|
825
|
+
const content = fs.readFileSync(src, "utf-8")
|
|
826
|
+
.replaceAll(CLAUDE_NODE_PLACEHOLDER, process.execPath);
|
|
827
|
+
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
828
|
+
fs.writeFileSync(dest, content);
|
|
829
|
+
} else {
|
|
830
|
+
copyFile(src, dest);
|
|
831
|
+
}
|
|
814
832
|
copied++;
|
|
815
833
|
} else {
|
|
816
834
|
p.log.warn(`Source file not found: ${file}`);
|
|
@@ -822,8 +840,8 @@ async function setup(yes: boolean): Promise<void> {
|
|
|
822
840
|
const mcpConfig = {
|
|
823
841
|
mcpServers: {
|
|
824
842
|
typegraph: {
|
|
825
|
-
command:
|
|
826
|
-
args: ["tsx", "${CLAUDE_PLUGIN_ROOT}/server.ts"],
|
|
843
|
+
command: process.execPath,
|
|
844
|
+
args: ["${CLAUDE_PLUGIN_ROOT}/node_modules/tsx/dist/cli.mjs", "${CLAUDE_PLUGIN_ROOT}/server.ts"],
|
|
827
845
|
env: {
|
|
828
846
|
TYPEGRAPH_PROJECT_ROOT: ".",
|
|
829
847
|
TYPEGRAPH_TSCONFIG: "./tsconfig.json",
|
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
|
-
|
|
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
|
-
|
|
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:
|
package/commands/deep-survey.md
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
@@ -2927,6 +2927,8 @@ Where suitable, use the \`ts_*\` MCP tools instead of grep/glob for navigating T
|
|
|
2927
2927
|
|
|
2928
2928
|
Start with the navigation tools before reading entire files. Use direct file reads only after the MCP tools identify the exact symbols or lines that matter.
|
|
2929
2929
|
|
|
2930
|
+
For quick architectural insight, prefer composition modules and entrypoints over top-level barrel files. If \`ts_module_exports\` on an \`index.ts\` or other barrel looks empty or uninformative, pivot to the app entrypoint, router, handler, service composition root, or API module that wires real behavior together.
|
|
2931
|
+
|
|
2930
2932
|
Use \`rg\` or \`grep\` when semantic symbol navigation is not the right tool, especially for:
|
|
2931
2933
|
|
|
2932
2934
|
- docs, config, SQL, migrations, JSON, env vars, route strings, and other non-TypeScript assets
|
|
@@ -2941,6 +2943,7 @@ Practical rule:
|
|
|
2941
2943
|
- combine both when a task spans TypeScript code and surrounding docs/config
|
|
2942
2944
|
`.trimStart();
|
|
2943
2945
|
var SNIPPET_MARKER = "## TypeScript Navigation (typegraph-mcp)";
|
|
2946
|
+
var CLAUDE_NODE_PLACEHOLDER = "__TYPEGRAPH_NODE__";
|
|
2944
2947
|
var PLUGIN_DIR_NAME = "plugins/typegraph-mcp";
|
|
2945
2948
|
var AGENT_IDS = ["claude-code", "cursor", "codex", "gemini", "copilot"];
|
|
2946
2949
|
var AGENTS = {
|
|
@@ -3007,6 +3010,13 @@ var SKILL_FILES = [
|
|
|
3007
3010
|
"skills/code-exploration/SKILL.md",
|
|
3008
3011
|
"skills/deep-survey/SKILL.md"
|
|
3009
3012
|
];
|
|
3013
|
+
var CLAUDE_TEMPLATE_FILES = /* @__PURE__ */ new Set([
|
|
3014
|
+
"commands/check.md",
|
|
3015
|
+
"commands/test.md",
|
|
3016
|
+
"commands/bench.md",
|
|
3017
|
+
"commands/deep-survey.md",
|
|
3018
|
+
"skills/deep-survey/SKILL.md"
|
|
3019
|
+
]);
|
|
3010
3020
|
var SKILL_NAMES = [
|
|
3011
3021
|
"tool-selection",
|
|
3012
3022
|
"impact-analysis",
|
|
@@ -3494,7 +3504,13 @@ async function setup(yes2) {
|
|
|
3494
3504
|
const src = path9.join(sourceDir, file);
|
|
3495
3505
|
const dest = path9.join(targetDir, file);
|
|
3496
3506
|
if (fs8.existsSync(src)) {
|
|
3497
|
-
|
|
3507
|
+
if (selectedAgents.includes("claude-code") && CLAUDE_TEMPLATE_FILES.has(file)) {
|
|
3508
|
+
const content = fs8.readFileSync(src, "utf-8").replaceAll(CLAUDE_NODE_PLACEHOLDER, process.execPath);
|
|
3509
|
+
fs8.mkdirSync(path9.dirname(dest), { recursive: true });
|
|
3510
|
+
fs8.writeFileSync(dest, content);
|
|
3511
|
+
} else {
|
|
3512
|
+
copyFile(src, dest);
|
|
3513
|
+
}
|
|
3498
3514
|
copied++;
|
|
3499
3515
|
} else {
|
|
3500
3516
|
p.log.warn(`Source file not found: ${file}`);
|
|
@@ -3504,8 +3520,8 @@ async function setup(yes2) {
|
|
|
3504
3520
|
const mcpConfig = {
|
|
3505
3521
|
mcpServers: {
|
|
3506
3522
|
typegraph: {
|
|
3507
|
-
command:
|
|
3508
|
-
args: ["tsx", "${CLAUDE_PLUGIN_ROOT}/server.ts"],
|
|
3523
|
+
command: process.execPath,
|
|
3524
|
+
args: ["${CLAUDE_PLUGIN_ROOT}/node_modules/tsx/dist/cli.mjs", "${CLAUDE_PLUGIN_ROOT}/server.ts"],
|
|
3509
3525
|
env: {
|
|
3510
3526
|
TYPEGRAPH_PROJECT_ROOT: ".",
|
|
3511
3527
|
TYPEGRAPH_TSCONFIG: "./tsconfig.json"
|
package/package.json
CHANGED
|
@@ -24,6 +24,11 @@ If you know the file:
|
|
|
24
24
|
- Call `ts_module_exports` to see what the file provides
|
|
25
25
|
- Call `ts_find_symbol` to locate a specific symbol within it
|
|
26
26
|
|
|
27
|
+
If `ts_module_exports` on a top-level `index.ts` is empty or mostly re-exports:
|
|
28
|
+
- Treat it as a barrel, not a dead end
|
|
29
|
+
- Pivot to a composition module such as an app entrypoint, router, handler, API module, or service composition root
|
|
30
|
+
- Use `ts_dependency_tree` on that composition module to get quick architectural context
|
|
31
|
+
|
|
27
32
|
### Step 2: Understand the Type
|
|
28
33
|
Call `ts_type_info` on the entry point symbol. This gives you the full type signature and documentation without reading the entire file.
|
|
29
34
|
|
|
@@ -33,6 +38,8 @@ Call `ts_trace_chain` to follow the definition chain from the entry point to the
|
|
|
33
38
|
### Step 4: Explore the Neighborhood
|
|
34
39
|
Call `ts_subgraph` with the key files discovered in step 3 to see the surrounding module structure. Use `direction: "both"` and `depth: 1` for immediate context.
|
|
35
40
|
|
|
41
|
+
For a fast system-level read, `ts_dependency_tree` on the composition module often gives a better first picture than reading a barrel file's exports.
|
|
42
|
+
|
|
36
43
|
### Step 5: Deep Dive Where Needed
|
|
37
44
|
Only now, read specific files at the lines identified by the tools. You have precise coordinates — no need to read entire files.
|
|
38
45
|
|
|
@@ -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
|
-
|
|
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:
|
|
@@ -54,6 +54,8 @@ Glob: **/index.ts, **/main.ts, **/entry*.ts, **/worker*.ts, **/server.ts, **/app
|
|
|
54
54
|
|
|
55
55
|
Exclude `node_modules/` hits. The results are your starting nodes.
|
|
56
56
|
|
|
57
|
+
Prefer these composition modules over top-level barrel files for your first passes. Barrels often describe the public API surface, but entry points and composition roots reveal how the system is actually wired.
|
|
58
|
+
|
|
57
59
|
### 1b. Dependency tree from every entry point (depth 2)
|
|
58
60
|
|
|
59
61
|
For each entry point, run:
|
|
@@ -121,6 +123,8 @@ Record for each:
|
|
|
121
123
|
- **Export types** — classes, interfaces, types, constants, functions. A file that exports 8 interfaces is a contract definition. A file that exports 8 constants is a configuration. A file that exports a mix of class + error + test layer is a service module.
|
|
122
124
|
- **Naming patterns** — do exports follow consistent naming (`*Service`, `*Error`, `*Test`, `*Live`)? Consistency across files is evidence of intentional patterns.
|
|
123
125
|
|
|
126
|
+
If a file is a barrel and `ts_module_exports` is sparse or uninformative, do not stop there. Pivot to the concrete composition modules it fronts and use `ts_dependency_tree` or `ts_module_exports` there instead.
|
|
127
|
+
|
|
124
128
|
### 2c. Module boundaries — how coupled are directories?
|
|
125
129
|
|
|
126
130
|
Identify 3-5 directories that look like they should be self-contained modules (e.g., `services/billing/`, `providers/email/`, `middleware/`).
|
|
@@ -29,6 +29,8 @@ Use **ts_type_info** — returns the same info as hovering in VS Code. Includes
|
|
|
29
29
|
### "What are all the exports of this file?"
|
|
30
30
|
Use **ts_module_exports** — lists all exported symbols with their resolved types.
|
|
31
31
|
|
|
32
|
+
If the file is a top-level barrel (`index.ts`, re-export hub), the result may be sparse or unhelpful for architecture discovery. For quick project insight, prefer composition modules such as entrypoints, routers, handler modules, service composition roots, or API modules that wire concrete behavior together.
|
|
33
|
+
|
|
32
34
|
### "Where is X used?"
|
|
33
35
|
Use **ts_references** for all semantic references. Unlike grep, this returns only real code references, not string matches in comments or unrelated variables.
|
|
34
36
|
|
|
@@ -63,6 +65,7 @@ Use **ts_module_boundary** — analyzes incoming/outgoing edges, shared dependen
|
|
|
63
65
|
3. **Combine tools for workflows.** Impact analysis = ts_blast_radius + ts_dependents. Refactor safety = ts_trace_chain + ts_import_cycles.
|
|
64
66
|
4. **Graph queries are instant** (~0.1ms). Point queries are fast (~2-50ms). Don't hesitate to use them liberally.
|
|
65
67
|
5. **First query may be slow** (~2s) as tsserver warms up. All subsequent queries are fast.
|
|
68
|
+
6. **For fast architecture reads, start at composition modules, not barrels.** Barrels are useful for API shape, but entrypoints and composition roots tell you how the system is actually wired.
|
|
66
69
|
|
|
67
70
|
## Tool Reference
|
|
68
71
|
|