@ttsc/graph 0.16.6 → 0.16.7
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 +22 -0
- package/lib/TtscGraphApplication.js +39 -16
- package/lib/TtscGraphApplication.js.map +1 -1
- package/lib/model/TtscGraphMemory.js +43 -4
- package/lib/model/TtscGraphMemory.js.map +1 -1
- package/lib/server/createServer.js +555 -221
- package/lib/server/createServer.js.map +1 -1
- package/lib/server/instructions.js +81 -69
- package/lib/server/instructions.js.map +1 -1
- package/lib/server/pathPolicy.js +35 -0
- package/lib/server/pathPolicy.js.map +1 -0
- package/lib/server/resultGuide.js +16 -0
- package/lib/server/resultGuide.js.map +1 -0
- package/lib/server/runDetails.js +71 -10
- package/lib/server/runDetails.js.map +1 -1
- package/lib/server/runEntrypoints.js +3 -4
- package/lib/server/runEntrypoints.js.map +1 -1
- package/lib/server/runLookup.js +21 -9
- package/lib/server/runLookup.js.map +1 -1
- package/lib/server/runOverview.js +13 -6
- package/lib/server/runOverview.js.map +1 -1
- package/lib/server/runTour.js +737 -0
- package/lib/server/runTour.js.map +1 -0
- package/lib/server/runTrace.js +108 -22
- package/lib/server/runTrace.js.map +1 -1
- package/lib/structures/ITtscGraphNext.js +3 -0
- package/lib/structures/ITtscGraphNext.js.map +1 -0
- package/lib/structures/ITtscGraphTour.js +3 -0
- package/lib/structures/ITtscGraphTour.js.map +1 -0
- package/lib/structures/index.js +2 -0
- package/lib/structures/index.js.map +1 -1
- package/package.json +2 -2
- package/src/TtscGraphApplication.ts +49 -16
- package/src/model/TtscGraphMemory.ts +46 -4
- package/src/server/instructions.ts +81 -69
- package/src/server/pathPolicy.ts +43 -0
- package/src/server/resultGuide.ts +20 -0
- package/src/server/runDetails.ts +90 -6
- package/src/server/runEntrypoints.ts +9 -4
- package/src/server/runLookup.ts +33 -6
- package/src/server/runOverview.ts +24 -8
- package/src/server/runTour.ts +881 -0
- package/src/server/runTrace.ts +151 -23
- package/src/structures/ITtscGraphApplication.ts +35 -64
- package/src/structures/ITtscGraphDetails.ts +74 -11
- package/src/structures/ITtscGraphEntrypoints.ts +46 -15
- package/src/structures/ITtscGraphEscape.ts +19 -9
- package/src/structures/ITtscGraphLookup.ts +36 -15
- package/src/structures/ITtscGraphNext.ts +23 -0
- package/src/structures/ITtscGraphOverview.ts +20 -5
- package/src/structures/ITtscGraphTour.ts +150 -0
- package/src/structures/ITtscGraphTrace.ts +58 -21
- package/src/structures/index.ts +2 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ITtscGraphEvidence } from "./ITtscGraphEvidence";
|
|
2
|
+
import { ITtscGraphNext } from "./ITtscGraphNext";
|
|
2
3
|
|
|
3
|
-
/** The
|
|
4
|
+
/** The compact dependency or caller flow returned from a selected start symbol. */
|
|
4
5
|
export interface ITtscGraphTrace {
|
|
5
6
|
/** Discriminator for dependency tracing. */
|
|
6
7
|
type: "trace";
|
|
@@ -8,6 +9,7 @@ export interface ITtscGraphTrace {
|
|
|
8
9
|
/** The resolved start node, or undefined when `from` matched nothing. */
|
|
9
10
|
start?: ITtscGraphTrace.INode;
|
|
10
11
|
|
|
12
|
+
/** Trace direction actually used by this result. */
|
|
11
13
|
direction: string;
|
|
12
14
|
|
|
13
15
|
/** Edges traversed, in breadth-first order. */
|
|
@@ -32,8 +34,11 @@ export interface ITtscGraphTrace {
|
|
|
32
34
|
/** Compact hop summaries preserving node names and edge evidence, capped. */
|
|
33
35
|
steps?: string[];
|
|
34
36
|
|
|
35
|
-
/**
|
|
36
|
-
next
|
|
37
|
+
/** How to use this source-free result next. */
|
|
38
|
+
next: ITtscGraphNext;
|
|
39
|
+
|
|
40
|
+
/** Human-readable compatibility note mirroring `next`. */
|
|
41
|
+
guide: string;
|
|
37
42
|
|
|
38
43
|
/** When `from` was an ambiguous name, the matches to disambiguate with. */
|
|
39
44
|
candidates?: ITtscGraphTrace.INode[];
|
|
@@ -55,14 +60,16 @@ export namespace ITtscGraphTrace {
|
|
|
55
60
|
* A target symbol: node id, simple symbol name, or dotted member name. When
|
|
56
61
|
* given, the tool returns the dependency path from `from` to this target,
|
|
57
62
|
* the one-call answer for "how does A reach B", instead of an open-ended
|
|
58
|
-
* trace.
|
|
63
|
+
* trace. Prefer this path mode whenever both ends are known.
|
|
59
64
|
*/
|
|
60
65
|
to?: string;
|
|
61
66
|
|
|
62
67
|
/**
|
|
63
68
|
* `forward` follows what the start uses (callees, instantiations, renders);
|
|
64
69
|
* `reverse` follows what uses the start (callers); `impact` is a reverse
|
|
65
|
-
* trace that
|
|
70
|
+
* trace that prioritizes public API and test nodes a change would reach.
|
|
71
|
+
* Its test nodes are semantic usage edges, not a text-search inventory.
|
|
72
|
+
* Caller questions usually fit `reverse`.
|
|
66
73
|
*
|
|
67
74
|
* @default "forward"
|
|
68
75
|
*/
|
|
@@ -71,15 +78,19 @@ export namespace ITtscGraphTrace {
|
|
|
71
78
|
/**
|
|
72
79
|
* Which non-structural edge family to follow: `execution` follows runtime
|
|
73
80
|
* calls, instantiations, property access, and JSX renders; `types` follows
|
|
74
|
-
* type references and inheritance; `all` preserves the full graph.
|
|
81
|
+
* type references and inheritance; `all` preserves the full graph. Flow
|
|
82
|
+
* questions should usually choose `execution` rather than `all`.
|
|
75
83
|
*
|
|
76
84
|
* @default "all"
|
|
77
85
|
*/
|
|
78
86
|
focus?: "all" | "execution" | "types";
|
|
79
87
|
|
|
80
88
|
/**
|
|
81
|
-
* How many hops deep to follow. Open traces are capped at
|
|
82
|
-
*
|
|
89
|
+
* How many hops deep to follow. Open forward/reverse traces are capped at
|
|
90
|
+
* 2; impact traces at 4; path mode at 12.
|
|
91
|
+
*
|
|
92
|
+
* Prefer the default for open traces. Raise only for path mode or when the
|
|
93
|
+
* previous trace named the missing next hop.
|
|
83
94
|
*
|
|
84
95
|
* @default 2
|
|
85
96
|
*/
|
|
@@ -87,27 +98,45 @@ export namespace ITtscGraphTrace {
|
|
|
87
98
|
|
|
88
99
|
/**
|
|
89
100
|
* Cap on reached nodes; the trace stops and marks itself truncated past it.
|
|
90
|
-
* Open traces are capped at
|
|
91
|
-
*
|
|
101
|
+
* Open forward/reverse traces are capped at 8 nodes, impact at 16 nodes.
|
|
102
|
+
*
|
|
103
|
+
* Prefer the default; use larger open traces only when a named missing edge
|
|
104
|
+
* requires it.
|
|
92
105
|
*
|
|
93
106
|
* @default 6
|
|
94
107
|
*/
|
|
95
108
|
maxNodes?: number;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Include dependency-boundary nodes from node_modules or bundled `.d.ts`
|
|
112
|
+
* libraries. Leave false for source-flow tours; enable only when the user
|
|
113
|
+
* asks about external type/API boundaries.
|
|
114
|
+
*
|
|
115
|
+
* @default false
|
|
116
|
+
*/
|
|
117
|
+
includeExternal?: boolean;
|
|
96
118
|
}
|
|
97
119
|
|
|
98
120
|
/** One traversed edge, with its depth from the start. */
|
|
99
121
|
export interface IHop {
|
|
122
|
+
/** Source node id for this traversed edge. */
|
|
100
123
|
from: string;
|
|
124
|
+
|
|
125
|
+
/** Target node id for this traversed edge. */
|
|
101
126
|
to: string;
|
|
127
|
+
|
|
128
|
+
/** Edge kind (`calls`, `type_ref`, `accesses`, ...). */
|
|
102
129
|
kind: string;
|
|
130
|
+
|
|
103
131
|
/** Hops from the start (1 = direct). */
|
|
104
132
|
depth: number;
|
|
133
|
+
|
|
105
134
|
/**
|
|
106
|
-
* Source span for the expression that produced this hop. It
|
|
107
|
-
*
|
|
108
|
-
* the file.
|
|
135
|
+
* Source span for the expression that produced this hop. It is repository
|
|
136
|
+
* evidence for the hop and can be cited without opening the file.
|
|
109
137
|
*/
|
|
110
138
|
evidence?: ITtscGraphEvidence;
|
|
139
|
+
|
|
111
140
|
/**
|
|
112
141
|
* Stable access-path aliases derived from edge evidence. These preserve a
|
|
113
142
|
* resolved member's owner and the concrete property path used at the call
|
|
@@ -118,23 +147,31 @@ export namespace ITtscGraphTrace {
|
|
|
118
147
|
|
|
119
148
|
/** A node on the trace: the start, a reached node, or a candidate. */
|
|
120
149
|
export interface INode {
|
|
150
|
+
/** Stable node id for subsequent graph calls. */
|
|
121
151
|
id: string;
|
|
152
|
+
|
|
153
|
+
/** Qualified symbol name when available, otherwise the simple name. */
|
|
122
154
|
name: string;
|
|
155
|
+
|
|
156
|
+
/** Declaration kind (`class`, `method`, `function`, ...). */
|
|
123
157
|
kind: string;
|
|
158
|
+
|
|
159
|
+
/** Project-relative path of the declaration file. */
|
|
124
160
|
file: string;
|
|
161
|
+
|
|
162
|
+
/** 1-based declaration line, when known. */
|
|
163
|
+
line?: number;
|
|
164
|
+
|
|
165
|
+
/** Declaration or implementation citation range, when known. */
|
|
166
|
+
sourceSpan?: Pick<ITtscGraphEvidence, "file" | "startLine" | "endLine">;
|
|
167
|
+
|
|
125
168
|
/** Hops from the start, on a reached node. */
|
|
126
169
|
depth?: number;
|
|
170
|
+
|
|
127
171
|
/** The node's signature, carried on path nodes so the path explains itself. */
|
|
128
172
|
signature?: string;
|
|
173
|
+
|
|
129
174
|
/** Why this node matters to an impact trace: `exported`, `test`. */
|
|
130
175
|
roles?: string[];
|
|
131
176
|
}
|
|
132
|
-
|
|
133
|
-
/** Tool-call handles suggested by this trace. */
|
|
134
|
-
export interface INext {
|
|
135
|
-
/** Pass these ids to `details` for selected symbol details. */
|
|
136
|
-
details: string[];
|
|
137
|
-
/** Continue tracing from these ids when the current result is intermediate. */
|
|
138
|
-
traceFrom: string[];
|
|
139
|
-
}
|
|
140
177
|
}
|
package/src/structures/index.ts
CHANGED
|
@@ -16,7 +16,9 @@ export * from "./ITtscGraphEntrypoints";
|
|
|
16
16
|
export * from "./ITtscGraphNode";
|
|
17
17
|
export * from "./ITtscGraphOverview";
|
|
18
18
|
export * from "./ITtscGraphLookup";
|
|
19
|
+
export * from "./ITtscGraphNext";
|
|
19
20
|
export * from "./ITtscGraphTrace";
|
|
21
|
+
export * from "./ITtscGraphTour";
|
|
20
22
|
export * from "./TtscGraphEdgeKind";
|
|
21
23
|
export * from "./TtscGraphNodeKind";
|
|
22
24
|
export * from "./TtscGraphNodeModifier";
|