@ttsc/graph 0.16.4 → 0.16.5
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/LICENSE +21 -21
- package/README.md +24 -53
- package/lib/TtscGraphApplication.js +46 -0
- package/lib/TtscGraphApplication.js.map +1 -0
- package/lib/index.js +31 -108
- package/lib/index.js.map +1 -1
- package/lib/model/TtscGraphMemory.js +185 -0
- package/lib/model/TtscGraphMemory.js.map +1 -0
- package/lib/model/loadGraph.js +418 -0
- package/lib/model/loadGraph.js.map +1 -0
- package/lib/reduce.js +101 -0
- package/lib/reduce.js.map +1 -0
- package/lib/resolveGraphBinary.js +42 -0
- package/lib/resolveGraphBinary.js.map +1 -0
- package/lib/server/createServer.js +1227 -0
- package/lib/server/createServer.js.map +1 -0
- package/lib/server/instructions.js +32 -0
- package/lib/server/instructions.js.map +1 -0
- package/lib/server/resolveHandle.js +25 -0
- package/lib/server/resolveHandle.js.map +1 -0
- package/lib/server/runExpand.js +177 -0
- package/lib/server/runExpand.js.map +1 -0
- package/lib/server/runIndex.js +146 -0
- package/lib/server/runIndex.js.map +1 -0
- package/lib/server/runOverview.js +150 -0
- package/lib/server/runOverview.js.map +1 -0
- package/lib/server/runQuery.js +147 -0
- package/lib/server/runQuery.js.map +1 -0
- package/lib/server/runTrace.js +219 -0
- package/lib/server/runTrace.js.map +1 -0
- package/lib/server/startServer.js +21 -0
- package/lib/server/startServer.js.map +1 -0
- package/lib/structures/ITtscGraphApplication.js +3 -0
- package/lib/structures/ITtscGraphApplication.js.map +1 -0
- package/lib/structures/ITtscGraphDecorator.js +3 -0
- package/lib/structures/ITtscGraphDecorator.js.map +1 -0
- package/lib/structures/ITtscGraphDiagnostic.js +3 -0
- package/lib/structures/ITtscGraphDiagnostic.js.map +1 -0
- package/lib/structures/ITtscGraphDump.js +3 -0
- package/lib/structures/ITtscGraphDump.js.map +1 -0
- package/lib/structures/ITtscGraphEdge.js +3 -0
- package/lib/structures/ITtscGraphEdge.js.map +1 -0
- package/lib/structures/ITtscGraphEvidence.js +3 -0
- package/lib/structures/ITtscGraphEvidence.js.map +1 -0
- package/lib/structures/ITtscGraphExpand.js +3 -0
- package/lib/structures/ITtscGraphExpand.js.map +1 -0
- package/lib/structures/ITtscGraphIndex.js +3 -0
- package/lib/structures/ITtscGraphIndex.js.map +1 -0
- package/lib/structures/ITtscGraphNode.js +3 -0
- package/lib/structures/ITtscGraphNode.js.map +1 -0
- package/lib/structures/ITtscGraphOverview.js +3 -0
- package/lib/structures/ITtscGraphOverview.js.map +1 -0
- package/lib/structures/ITtscGraphQuery.js +3 -0
- package/lib/structures/ITtscGraphQuery.js.map +1 -0
- package/lib/structures/ITtscGraphTrace.js +3 -0
- package/lib/structures/ITtscGraphTrace.js.map +1 -0
- package/lib/structures/TtscGraphEdgeKind.js +3 -0
- package/lib/structures/TtscGraphEdgeKind.js.map +1 -0
- package/lib/structures/TtscGraphNodeKind.js +3 -0
- package/lib/structures/TtscGraphNodeKind.js.map +1 -0
- package/lib/structures/TtscGraphNodeModifier.js +3 -0
- package/lib/structures/TtscGraphNodeModifier.js.map +1 -0
- package/lib/structures/index.js +37 -0
- package/lib/structures/index.js.map +1 -0
- package/lib/view.js +140 -0
- package/lib/view.js.map +1 -0
- package/lib/viewer/index.html +123 -0
- package/lib/viewer/viewer.js +4610 -0
- package/package.json +17 -4
- package/src/TtscGraphApplication.ts +57 -0
- package/src/index.ts +40 -126
- package/src/model/TtscGraphMemory.ts +204 -0
- package/src/model/loadGraph.ts +85 -0
- package/src/reduce.ts +165 -0
- package/src/resolveGraphBinary.ts +40 -0
- package/src/server/createServer.ts +104 -0
- package/src/server/instructions.ts +28 -0
- package/src/server/resolveHandle.ts +34 -0
- package/src/server/runExpand.ts +186 -0
- package/src/server/runIndex.ts +181 -0
- package/src/server/runOverview.ts +154 -0
- package/src/server/runQuery.ts +150 -0
- package/src/server/runTrace.ts +233 -0
- package/src/server/startServer.ts +25 -0
- package/src/structures/ITtscGraphApplication.ts +68 -0
- package/src/structures/ITtscGraphDecorator.ts +33 -0
- package/src/structures/ITtscGraphDiagnostic.ts +34 -0
- package/src/structures/ITtscGraphDump.ts +35 -0
- package/src/structures/ITtscGraphEdge.ts +24 -0
- package/src/structures/ITtscGraphEvidence.ts +29 -0
- package/src/structures/ITtscGraphExpand.ts +85 -0
- package/src/structures/ITtscGraphIndex.ts +100 -0
- package/src/structures/ITtscGraphNode.ts +64 -0
- package/src/structures/ITtscGraphOverview.ts +79 -0
- package/src/structures/ITtscGraphQuery.ts +49 -0
- package/src/structures/ITtscGraphTrace.ts +97 -0
- package/src/structures/TtscGraphEdgeKind.ts +23 -0
- package/src/structures/TtscGraphNodeKind.ts +26 -0
- package/src/structures/TtscGraphNodeModifier.ts +19 -0
- package/src/structures/index.ts +21 -0
- package/src/view.ts +155 -0
- package/src/viewer/index.html +123 -0
- package/src/viewer/main.ts +209 -0
- package/lib/bin.d.ts +0 -2
- package/lib/diagnostics.d.ts +0 -23
- package/lib/diagnostics.js +0 -84
- package/lib/diagnostics.js.map +0 -1
- package/lib/index.d.ts +0 -29
- package/src/diagnostics.ts +0 -93
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Jeongho Nam
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jeongho Nam
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -4,53 +4,33 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://github.com/samchon/ttsc/blob/master/LICENSE) [](https://www.npmjs.com/package/@ttsc/graph) [](https://www.npmjs.com/package/@ttsc/graph) [](https://github.com/samchon/ttsc/actions?query=workflow%3Atest) [](https://ttsc.dev/docs/graph) [](https://discord.gg/E94XhzrUCZ)
|
|
6
6
|
|
|
7
|
-
Gives your AI coding
|
|
7
|
+
Gives your AI coding agent a **map of your TypeScript codebase**, over MCP, so it answers "how does this work?" without opening file after file.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Ask an agent like Claude Code or Codex about your project and it works file by file: open one, follow an import, open the next, until it has pieced the picture together by hand. Slow, token-hungry, and every relationship is a guess from reading text.
|
|
10
10
|
|
|
11
|
-
`@ttsc/graph` hands it the map up front: what calls what, what depends on what,
|
|
11
|
+
`@ttsc/graph` hands it the map up front: what calls what, what depends on what, where each piece lives. Drawn by the real TypeScript compiler, so it is exact, not skimmed.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
On a public benchmark, an agent answered while reading **zero files**, cutting tokens by **77% to 86%** and tool calls by **94% to 95%** (see the [benchmark](https://ttsc.dev/docs/benchmark/graph)).
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
You can also browse the whole map. This is TypeORM in 3D, colored by kind ([live viewer](https://ttsc.dev/docs/graph/viewer)):
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
[](https://ttsc.dev/docs/graph/viewer)
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
## Setup
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
ShapeRenderer — src/render/shape.ts (line 18)
|
|
23
|
-
→ calls rasterize(), new Canvas()
|
|
24
|
-
← used by Editor
|
|
25
|
-
change it and 9 other things are affected
|
|
26
|
-
18 export class ShapeRenderer {
|
|
27
|
-
19 constructor(private canvas: Canvas) {}
|
|
28
|
-
...
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
One step shows what this thing calls, what uses it, and its source.
|
|
32
|
-
|
|
33
|
-
The answer comes from the compiler, so it is precise. When one file just re-exports something from another, the map still points at the file that really defines it.
|
|
34
|
-
|
|
35
|
-
Anything from `node_modules` is left out, because that is not your code.
|
|
36
|
-
|
|
37
|
-
On a public benchmark, a Claude agent answered reading zero files, cutting its token use by **77% to 86%** and its tool calls by **94% to 95%**.
|
|
38
|
-
|
|
39
|
-
See the [benchmark](https://ttsc.dev/docs/benchmark#code-graph-mcp) for the full numbers.
|
|
40
|
-
|
|
41
|
-
## Install
|
|
21
|
+
### Install
|
|
42
22
|
|
|
43
23
|
```bash
|
|
44
24
|
npm install -D ttsc @ttsc/graph typescript@rc
|
|
45
25
|
```
|
|
46
26
|
|
|
47
|
-
|
|
27
|
+
`@ttsc/graph` reads the map from the program `ttsc` already type-checked, so install the two together.
|
|
48
28
|
|
|
49
|
-
|
|
29
|
+
### Connect your agent
|
|
50
30
|
|
|
51
|
-
|
|
31
|
+
Add the server to your agent's MCP config, once.
|
|
52
32
|
|
|
53
|
-
|
|
33
|
+
For Claude Code, that is a `.mcp.json` in your project root:
|
|
54
34
|
|
|
55
35
|
```json
|
|
56
36
|
{
|
|
@@ -63,35 +43,26 @@ Add this to your AI tool's config once. For Claude Code, that is a `.mcp.json` f
|
|
|
63
43
|
}
|
|
64
44
|
```
|
|
65
45
|
|
|
66
|
-
Start your agent from your project
|
|
67
|
-
|
|
68
|
-
Your agent now has two new abilities:
|
|
46
|
+
Start your agent from your project root so the server finds your `tsconfig.json`. The agent queries the map on its own; you never call it by hand.
|
|
69
47
|
|
|
70
|
-
|
|
71
|
-
| --- | --- |
|
|
72
|
-
| `graph_explore` | Look up a name or a file. Get back what it connects to — what it calls, what uses it, its types — and its source code. |
|
|
73
|
-
| `graph_diagnostics` | Get the errors in one file: TypeScript type errors, plus your project's `@ttsc/lint` and plugin findings, as `ttsc` reports them. |
|
|
48
|
+
### Browse it in 3D
|
|
74
49
|
|
|
75
|
-
|
|
50
|
+
Run this in your own project to open that 3D map in your browser, served from a local port:
|
|
76
51
|
|
|
77
|
-
|
|
52
|
+
```bash
|
|
53
|
+
npx @ttsc/graph view
|
|
54
|
+
```
|
|
78
55
|
|
|
79
|
-
##
|
|
56
|
+
## Sponsors
|
|
80
57
|
|
|
81
|
-
|
|
58
|
+
[](https://github.com/sponsors/samchon)
|
|
82
59
|
|
|
83
|
-
|
|
60
|
+
Thanks for your support.
|
|
84
61
|
|
|
85
|
-
|
|
62
|
+
Your [donation](https://github.com/sponsors/samchon) encourages `ttsc` development.
|
|
86
63
|
|
|
87
64
|
## References
|
|
88
65
|
|
|
89
|
-
`@ttsc/graph` is inspired by [codegraph](https://github.com/colbymchenry/codegraph), which
|
|
90
|
-
|
|
91
|
-
The difference is how the map is built.
|
|
92
|
-
|
|
93
|
-
codegraph reads your code with tree-sitter, across many languages, and saves the result in a database it keeps in sync as files change. Its edges are a best guess from the syntax.
|
|
94
|
-
|
|
95
|
-
`@ttsc/graph` is TypeScript-only and keeps no database. It reads the graph live from the program `ttsc` already type-checked in memory.
|
|
66
|
+
`@ttsc/graph` is inspired by [codegraph](https://github.com/colbymchenry/codegraph), which first put a code graph in front of an agent over MCP. The [benchmark](https://ttsc.dev/docs/benchmark/graph) here is a faithful port of codegraph's.
|
|
96
67
|
|
|
97
|
-
|
|
68
|
+
The difference is where the map comes from. codegraph parses the shape of your code and infers how the pieces connect, while `@ttsc/graph` asks the real TypeScript compiler, which has already resolved every import and reference, so the map is exact rather than inferred.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TtscGraphApplication = void 0;
|
|
4
|
+
const runExpand_1 = require("./server/runExpand");
|
|
5
|
+
const runIndex_1 = require("./server/runIndex");
|
|
6
|
+
const runOverview_1 = require("./server/runOverview");
|
|
7
|
+
const runQuery_1 = require("./server/runQuery");
|
|
8
|
+
const runTrace_1 = require("./server/runTrace");
|
|
9
|
+
/**
|
|
10
|
+
* The MCP tool surface as a plain class over the resident
|
|
11
|
+
* {@link TtscGraphMemory}.
|
|
12
|
+
*
|
|
13
|
+
* Each public method is one MCP tool — `typia.llm.controller` reflects
|
|
14
|
+
* {@link ITtscGraphApplication} to generate every tool's JSON schema and
|
|
15
|
+
* argument validator from these signatures and their JSDoc, with no
|
|
16
|
+
* hand-written schema. The methods delegate to the pure tool functions in
|
|
17
|
+
* `./server`, which are unit-testable without a transport; this class only
|
|
18
|
+
* binds them to the graph.
|
|
19
|
+
*
|
|
20
|
+
* Every method answers from the resident graph; none recompiles. Output is kept
|
|
21
|
+
* compact and bounded so a model can read structure without a file read, which
|
|
22
|
+
* is the token win the redesign exists for.
|
|
23
|
+
*/
|
|
24
|
+
class TtscGraphApplication {
|
|
25
|
+
graph;
|
|
26
|
+
constructor(source) {
|
|
27
|
+
this.graph = typeof source === "function" ? source : () => source;
|
|
28
|
+
}
|
|
29
|
+
graph_index(props) {
|
|
30
|
+
return (0, runIndex_1.runIndex)(this.graph(), props);
|
|
31
|
+
}
|
|
32
|
+
graph_overview(props) {
|
|
33
|
+
return (0, runOverview_1.runOverview)(this.graph(), props);
|
|
34
|
+
}
|
|
35
|
+
graph_expand(props) {
|
|
36
|
+
return (0, runExpand_1.runExpand)(this.graph(), props);
|
|
37
|
+
}
|
|
38
|
+
graph_query(props) {
|
|
39
|
+
return (0, runQuery_1.runQuery)(this.graph(), props);
|
|
40
|
+
}
|
|
41
|
+
graph_trace(props) {
|
|
42
|
+
return (0, runTrace_1.runTrace)(this.graph(), props);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.TtscGraphApplication = TtscGraphApplication;
|
|
46
|
+
//# sourceMappingURL=TtscGraphApplication.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TtscGraphApplication.js","sourceRoot":"","sources":["../src/TtscGraphApplication.ts"],"names":[],"mappings":";;;AACA,kDAA+C;AAC/C,gDAA6C;AAC7C,sDAAmD;AACnD,gDAA6C;AAC7C,gDAA6C;AAU7C;;;;;;;;;;;;;;GAcG;AACH;IACmB,KAAK,CAAwB;IAE9C,YAAmB,MAAuB;QACxC,IAAI,CAAC,KAAK,GAAG,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC;IACpE,CAAC;IAEM,WAAW,CAAC,KAA6B;QAC9C,OAAO,IAAA,mBAAQ,EAAC,IAAI,CAAC,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;IAEM,cAAc,CAAC,KAAgC;QACpD,OAAO,IAAA,yBAAW,EAAC,IAAI,CAAC,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAEM,YAAY,CAAC,KAA8B;QAChD,OAAO,IAAA,qBAAS,EAAC,IAAI,CAAC,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;IAEM,WAAW,CAAC,KAA6B;QAC9C,OAAO,IAAA,mBAAQ,EAAC,IAAI,CAAC,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;IAEM,WAAW,CAAC,KAA6B;QAC9C,OAAO,IAAA,mBAAQ,EAAC,IAAI,CAAC,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;CACF"}
|
package/lib/index.js
CHANGED
|
@@ -3,49 +3,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.resolveGraphBinary = resolveGraphBinary;
|
|
7
6
|
exports.runGraph = runGraph;
|
|
8
7
|
const node_child_process_1 = require("node:child_process");
|
|
9
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
10
|
-
const node_module_1 = require("node:module");
|
|
11
|
-
const node_os_1 = __importDefault(require("node:os"));
|
|
12
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const resolveGraphBinary_1 = require("./resolveGraphBinary");
|
|
10
|
+
const startServer_1 = require("./server/startServer");
|
|
11
|
+
const view_1 = require("./view");
|
|
12
|
+
// The server version reported in the MCP handshake; read from this package.
|
|
13
|
+
const VERSION = require("../package.json")
|
|
14
|
+
.version;
|
|
13
15
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* `ttsc` is a peer the user installs alongside `@ttsc/graph` (not a dependency
|
|
18
|
-
* of this launcher), so resolution starts from the user's project, not from
|
|
19
|
-
* this package's own tree.
|
|
20
|
-
*
|
|
21
|
-
* Resolution order:
|
|
22
|
-
*
|
|
23
|
-
* 1. `TTSC_GRAPH_BINARY` env var, when set to an absolute path.
|
|
24
|
-
* 2. The per-platform npm package `@ttsc/<platform>-<arch>/bin/ttscgraph[.exe]`.
|
|
25
|
-
* That package carries `ttsc`, `ttscserver`, and `ttscgraph` together and is
|
|
26
|
-
* an `optionalDependency` of `ttsc`, so it is resolved from `ttsc`'s
|
|
27
|
-
* location — found from `process.cwd()` (the project where the agent ran the
|
|
28
|
-
* server).
|
|
16
|
+
* The project root and tsconfig to build the graph for, from the `--cwd` /
|
|
17
|
+
* `--tsconfig` flags (the same ones `ttscgraph dump` accepts). Defaults are the
|
|
18
|
+
* process working directory and `tsconfig.json`.
|
|
29
19
|
*/
|
|
30
|
-
function resolveGraphBinary(env = process.env, cwd = process.cwd()) {
|
|
31
|
-
if (env.TTSC_GRAPH_BINARY && node_path_1.default.isAbsolute(env.TTSC_GRAPH_BINARY)) {
|
|
32
|
-
return env.TTSC_GRAPH_BINARY;
|
|
33
|
-
}
|
|
34
|
-
const exe = process.platform === "win32" ? "ttscgraph.exe" : "ttscgraph";
|
|
35
|
-
try {
|
|
36
|
-
const ttscPackageJson = require.resolve("ttsc/package.json", {
|
|
37
|
-
paths: [cwd],
|
|
38
|
-
});
|
|
39
|
-
const fromTtsc = (0, node_module_1.createRequire)(ttscPackageJson);
|
|
40
|
-
return fromTtsc.resolve(`@ttsc/${process.platform}-${process.arch}/bin/${exe}`);
|
|
41
|
-
}
|
|
42
|
-
catch {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
/** The project root and tsconfig the server was pointed at, mirroring the
|
|
47
|
-
* `--cwd` / `--tsconfig` flags ttscgraph itself parses, so the background
|
|
48
|
-
* diagnostics worker checks the same project. */
|
|
49
20
|
function parseProjectArgs(argv) {
|
|
50
21
|
let cwd = process.cwd();
|
|
51
22
|
let tsconfig = "tsconfig.json";
|
|
@@ -62,92 +33,44 @@ function parseProjectArgs(argv) {
|
|
|
62
33
|
}
|
|
63
34
|
return { cwd: node_path_1.default.resolve(cwd), tsconfig };
|
|
64
35
|
}
|
|
65
|
-
/** A `--connect` proxy pipes stdio to a running daemon and serves no graph of
|
|
66
|
-
* its own, so it needs no diagnostics computed locally. */
|
|
67
|
-
function isConnectProxy(argv) {
|
|
68
|
-
return argv.some((a) => a === "--connect" || a.startsWith("--connect="));
|
|
69
|
-
}
|
|
70
36
|
/**
|
|
71
|
-
*
|
|
72
|
-
* (`@ttsc/lint` and transform-plugin findings) and writes them to
|
|
73
|
-
* `diagnosticsFile`, where the server picks them up. Returns the child handle
|
|
74
|
-
* for cleanup, or `null` when it could not be spawned.
|
|
37
|
+
* Run the `@ttsc/graph` launcher.
|
|
75
38
|
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
39
|
+
* - `view`: JS-orchestrated 3D viewer (dump -> reduce -> serve -> open).
|
|
40
|
+
* - `dump`: pass through to the native `ttscgraph dump`, which prints the whole
|
|
41
|
+
* graph as JSON for piping or the viewer.
|
|
42
|
+
* - Default: serve the MCP graph over stdio. The TypeScript server runs
|
|
43
|
+
* `ttscgraph dump` once to build the resident graph, then answers tool calls
|
|
44
|
+
* from memory; the agent's MCP client speaks JSON-RPC over this process's
|
|
45
|
+
* stdin/stdout. The process stays alive on the stdio transport.
|
|
80
46
|
*/
|
|
81
|
-
function
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
catch {
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
47
|
+
function runGraph(argv = process.argv.slice(2)) {
|
|
48
|
+
if (argv[0] === "view")
|
|
49
|
+
return (0, view_1.runView)(argv.slice(1));
|
|
50
|
+
if (argv[0] === "dump")
|
|
51
|
+
return runDump(argv);
|
|
52
|
+
const { cwd, tsconfig } = parseProjectArgs(argv);
|
|
53
|
+
void (0, startServer_1.startServer)({ cwd, tsconfig, version: VERSION }).catch((error) => {
|
|
54
|
+
process.stderr.write(`@ttsc/graph: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
55
|
+
process.exit(1);
|
|
56
|
+
});
|
|
94
57
|
}
|
|
95
58
|
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* child's exit code.
|
|
99
|
-
*
|
|
100
|
-
* Before spawning, it kicks off the background diagnostics worker (except in
|
|
101
|
-
* `--connect` proxy mode) and points the server at its output file, so a
|
|
102
|
-
* plugin-using project's lint and transform-plugin diagnostics fuse onto the
|
|
103
|
-
* graph without blocking startup.
|
|
59
|
+
* Pass `dump` through to the native binary, inheriting stdio so the JSON lands
|
|
60
|
+
* on this process's stdout. Returns the child's exit code.
|
|
104
61
|
*/
|
|
105
|
-
function
|
|
106
|
-
const binary = resolveGraphBinary();
|
|
62
|
+
function runDump(argv) {
|
|
63
|
+
const binary = (0, resolveGraphBinary_1.resolveGraphBinary)();
|
|
107
64
|
if (binary === null) {
|
|
108
65
|
process.stderr.write("@ttsc/graph: could not resolve the ttscgraph binary. " +
|
|
109
66
|
"Install `ttsc` so its platform package is present, " +
|
|
110
67
|
"or set TTSC_GRAPH_BINARY to an absolute path.\n");
|
|
111
68
|
return 1;
|
|
112
69
|
}
|
|
113
|
-
const env = { ...process.env };
|
|
114
|
-
let diagnosticsFile = null;
|
|
115
|
-
let worker = null;
|
|
116
|
-
if (!isConnectProxy(argv)) {
|
|
117
|
-
diagnosticsFile = node_path_1.default.join(node_os_1.default.tmpdir(), `ttsc-graph-diagnostics-${process.pid}.json`);
|
|
118
|
-
env.TTSC_GRAPH_DIAGNOSTICS_FILE = diagnosticsFile;
|
|
119
|
-
worker = startDiagnosticsWorker(argv, diagnosticsFile);
|
|
120
|
-
}
|
|
121
70
|
const result = (0, node_child_process_1.spawnSync)(binary, [...argv], {
|
|
122
71
|
stdio: "inherit",
|
|
123
|
-
env,
|
|
124
72
|
windowsHide: true,
|
|
125
73
|
});
|
|
126
|
-
const workerPid = worker?.pid;
|
|
127
|
-
try {
|
|
128
|
-
worker?.kill();
|
|
129
|
-
}
|
|
130
|
-
catch {
|
|
131
|
-
/* ignore */
|
|
132
|
-
}
|
|
133
|
-
if (diagnosticsFile) {
|
|
134
|
-
try {
|
|
135
|
-
node_fs_1.default.rmSync(diagnosticsFile, { force: true });
|
|
136
|
-
}
|
|
137
|
-
catch {
|
|
138
|
-
/* ignore */
|
|
139
|
-
}
|
|
140
|
-
// The worker writes atomically through `<file>.<pid>.tmp`; remove a leftover
|
|
141
|
-
// if it was killed mid-write, so a churning daemon does not litter tmpdir.
|
|
142
|
-
if (workerPid !== undefined) {
|
|
143
|
-
try {
|
|
144
|
-
node_fs_1.default.rmSync(`${diagnosticsFile}.${workerPid}.tmp`, { force: true });
|
|
145
|
-
}
|
|
146
|
-
catch {
|
|
147
|
-
/* ignore */
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
74
|
if (result.error) {
|
|
152
75
|
process.stderr.write(`@ttsc/graph: ${result.error.message}\n`);
|
|
153
76
|
return 1;
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sour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KAAK,CAAC,gBAAgB,MAAM,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;QAC/D,OAAO,CAAC,CAAC;IACX,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TtscGraphMemory = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The in-memory resident graph the MCP tools answer from.
|
|
6
|
+
*
|
|
7
|
+
* It loads one `ttscgraph dump` — the checker-resolved fact graph — then
|
|
8
|
+
* synthesizes the structural relationships the dump deliberately leaves to this
|
|
9
|
+
* layer: `file` container nodes, the `contains` ownership tree, and `exports`
|
|
10
|
+
* edges, plus the refinement of a class-member `variable` to a `property`.
|
|
11
|
+
* Every tool call is then a lookup or a traversal over the indexes built here;
|
|
12
|
+
* nothing recompiles.
|
|
13
|
+
*/
|
|
14
|
+
class TtscGraphMemory {
|
|
15
|
+
byId;
|
|
16
|
+
outEdges;
|
|
17
|
+
inEdges;
|
|
18
|
+
byNameIndex;
|
|
19
|
+
bySymbolIndex;
|
|
20
|
+
/** The absolute project root the dump was built for. */
|
|
21
|
+
project;
|
|
22
|
+
/** Every node, raw plus synthesized (file containers). */
|
|
23
|
+
nodes;
|
|
24
|
+
/** Every edge, raw plus synthesized (contains, exports). */
|
|
25
|
+
edges;
|
|
26
|
+
constructor(project, nodes, edges) {
|
|
27
|
+
this.project = project;
|
|
28
|
+
this.nodes = nodes;
|
|
29
|
+
this.edges = edges;
|
|
30
|
+
this.byId = new Map(nodes.map((n) => [n.id, n]));
|
|
31
|
+
this.byNameIndex = new Map();
|
|
32
|
+
this.bySymbolIndex = new Map();
|
|
33
|
+
for (const node of nodes) {
|
|
34
|
+
const bucket = this.byNameIndex.get(node.name);
|
|
35
|
+
if (bucket)
|
|
36
|
+
bucket.push(node);
|
|
37
|
+
else
|
|
38
|
+
this.byNameIndex.set(node.name, [node]);
|
|
39
|
+
if (node.kind !== "file") {
|
|
40
|
+
push(this.bySymbolIndex, node.name, node);
|
|
41
|
+
if (node.qualifiedName !== undefined) {
|
|
42
|
+
push(this.bySymbolIndex, node.qualifiedName, node);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
this.outEdges = new Map();
|
|
47
|
+
this.inEdges = new Map();
|
|
48
|
+
for (const edge of edges) {
|
|
49
|
+
push(this.outEdges, edge.from, edge);
|
|
50
|
+
push(this.inEdges, edge.to, edge);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/** Build a model from a parsed dump, synthesizing structural relationships. */
|
|
54
|
+
static from(dump) {
|
|
55
|
+
const { nodes, edges } = synthesize(dump);
|
|
56
|
+
return new TtscGraphMemory(dump.project, nodes, edges);
|
|
57
|
+
}
|
|
58
|
+
/** The node with this id, or undefined. */
|
|
59
|
+
node(id) {
|
|
60
|
+
return this.byId.get(id);
|
|
61
|
+
}
|
|
62
|
+
/** Edges leaving a node (the node is the `from`). */
|
|
63
|
+
outgoing(id) {
|
|
64
|
+
return this.outEdges.get(id) ?? [];
|
|
65
|
+
}
|
|
66
|
+
/** Edges entering a node (the node is the `to`). */
|
|
67
|
+
incoming(id) {
|
|
68
|
+
return this.inEdges.get(id) ?? [];
|
|
69
|
+
}
|
|
70
|
+
/** Every node whose simple name equals `name`. */
|
|
71
|
+
named(name) {
|
|
72
|
+
return this.byNameIndex.get(name) ?? [];
|
|
73
|
+
}
|
|
74
|
+
/** Every non-file node whose simple or owner-qualified symbol handle matches. */
|
|
75
|
+
symbols(handle) {
|
|
76
|
+
return this.bySymbolIndex.get(handle) ?? [];
|
|
77
|
+
}
|
|
78
|
+
/** Every workspace node on its module's export surface. */
|
|
79
|
+
exported() {
|
|
80
|
+
return this.nodes.filter((n) => n.exported && !n.external);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.TtscGraphMemory = TtscGraphMemory;
|
|
84
|
+
/** Append value to the slice stored at key, creating the slice on first use. */
|
|
85
|
+
function push(map, key, value) {
|
|
86
|
+
const bucket = map.get(key);
|
|
87
|
+
if (bucket)
|
|
88
|
+
bucket.push(value);
|
|
89
|
+
else
|
|
90
|
+
map.set(key, [value]);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The within-file identity of a node: its owner-qualified name when it has one
|
|
94
|
+
* (`Class.method`), else its simple name. Two nodes in one file never share a
|
|
95
|
+
* key, so it is the handle the ownership synthesis looks owners up by.
|
|
96
|
+
*/
|
|
97
|
+
function keyOf(node) {
|
|
98
|
+
return node.qualifiedName ?? node.name;
|
|
99
|
+
}
|
|
100
|
+
/** The owner key of a dotted key (`A.B.c` -> `A.B`), or "" for a top-level key. */
|
|
101
|
+
function ownerKey(key) {
|
|
102
|
+
const dot = key.lastIndexOf(".");
|
|
103
|
+
return dot >= 0 ? key.slice(0, dot) : "";
|
|
104
|
+
}
|
|
105
|
+
/** A file's id and node name from its project-relative path. */
|
|
106
|
+
function fileNodeId(file) {
|
|
107
|
+
return file;
|
|
108
|
+
}
|
|
109
|
+
function basename(file) {
|
|
110
|
+
const slash = file.lastIndexOf("/");
|
|
111
|
+
return slash >= 0 ? file.slice(slash + 1) : file;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Derive the structural layer from a dump's faithful facts: refine class-member
|
|
115
|
+
* variables to properties, add a `file` node per workspace source, and connect
|
|
116
|
+
* the `contains` ownership tree and `exports` surface.
|
|
117
|
+
*/
|
|
118
|
+
function synthesize(dump) {
|
|
119
|
+
// Clone nodes so property refinement does not mutate the caller's dump.
|
|
120
|
+
const nodes = dump.nodes.map((n) => ({ ...n }));
|
|
121
|
+
const edges = dump.edges.slice();
|
|
122
|
+
// Index workspace nodes by (file, within-file key) so ownership can resolve a
|
|
123
|
+
// member to its declaring class/namespace.
|
|
124
|
+
const byFileKey = new Map();
|
|
125
|
+
for (const node of nodes) {
|
|
126
|
+
if (!node.external)
|
|
127
|
+
byFileKey.set(node.file + "\0" + keyOf(node), node);
|
|
128
|
+
}
|
|
129
|
+
const owner = (node) => {
|
|
130
|
+
const parent = ownerKey(keyOf(node));
|
|
131
|
+
if (parent === "")
|
|
132
|
+
return undefined;
|
|
133
|
+
return byFileKey.get(node.file + "\0" + parent);
|
|
134
|
+
};
|
|
135
|
+
// Refine: a `variable` whose owner is a class or interface is a property.
|
|
136
|
+
for (const node of nodes) {
|
|
137
|
+
if (node.kind !== "variable" || node.external)
|
|
138
|
+
continue;
|
|
139
|
+
const parent = owner(node);
|
|
140
|
+
if (parent && (parent.kind === "class" || parent.kind === "interface")) {
|
|
141
|
+
node.kind = "property";
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
// One file container node per distinct workspace source file.
|
|
145
|
+
const fileNodes = new Map();
|
|
146
|
+
for (const node of nodes) {
|
|
147
|
+
if (node.external || node.file === "")
|
|
148
|
+
continue;
|
|
149
|
+
if (!fileNodes.has(node.file)) {
|
|
150
|
+
fileNodes.set(node.file, {
|
|
151
|
+
id: fileNodeId(node.file),
|
|
152
|
+
kind: "file",
|
|
153
|
+
name: basename(node.file),
|
|
154
|
+
file: node.file,
|
|
155
|
+
external: false,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// Ownership: a member is contained by its owner; a top-level declaration by
|
|
160
|
+
// its file. Exports: a file exports each of its public nodes.
|
|
161
|
+
const structural = [];
|
|
162
|
+
for (const node of nodes) {
|
|
163
|
+
if (node.external || node.file === "")
|
|
164
|
+
continue;
|
|
165
|
+
const parent = owner(node);
|
|
166
|
+
const container = parent ? parent.id : fileNodeId(node.file);
|
|
167
|
+
structural.push({
|
|
168
|
+
from: container,
|
|
169
|
+
to: node.id,
|
|
170
|
+
kind: "contains",
|
|
171
|
+
});
|
|
172
|
+
if (node.exported) {
|
|
173
|
+
structural.push({
|
|
174
|
+
from: fileNodeId(node.file),
|
|
175
|
+
to: node.id,
|
|
176
|
+
kind: "exports",
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return {
|
|
181
|
+
nodes: [...nodes, ...fileNodes.values()],
|
|
182
|
+
edges: [...edges, ...structural],
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=TtscGraphMemory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TtscGraphMemory.js","sourceRoot":"","sources":["../../src/model/TtscGraphMemory.ts"],"names":[],"mappings":";;;AAKA;;;;;;;;;GASG;AACH;IACmB,IAAI,CAA8B;IAClC,QAAQ,CAAgC;IACxC,OAAO,CAAgC;IACvC,WAAW,CAAgC;IAC3C,aAAa,CAAgC;IAE9D,wDAAwD;IAC/C,OAAO,CAAS;IACzB,0DAA0D;IACjD,KAAK,CAA4B;IAC1C,4DAA4D;IACnD,KAAK,CAA4B;IAE1C,YACE,OAAe,EACf,KAAuB,EACvB,KAAuB;QAEvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACjD,IAAI,CAAC,WAAW,GAAG,IAAI,GAAG,EAAE,CAAC;QAC7B,IAAI,CAAC,aAAa,GAAG,IAAI,GAAG,EAAE,CAAC;QAC/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC/C,IAAI,MAAM;gBAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;gBACzB,IAAI,CA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