@ttsc/graph 0.16.5 → 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 +58 -22
- package/lib/TtscGraphApplication.js.map +1 -1
- package/lib/model/TtscGraphMemory.js +43 -4
- package/lib/model/TtscGraphMemory.js.map +1 -1
- package/lib/model/loadGraph.js +17 -17
- package/lib/server/accessAliases.js +53 -0
- package/lib/server/accessAliases.js.map +1 -0
- package/lib/server/createServer.js +1490 -657
- package/lib/server/createServer.js.map +1 -1
- package/lib/server/instructions.js +81 -21
- 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 +474 -0
- package/lib/server/runDetails.js.map +1 -0
- package/lib/server/{runIndex.js → runEntrypoints.js} +92 -28
- package/lib/server/runEntrypoints.js.map +1 -0
- package/lib/server/runLookup.js +246 -0
- package/lib/server/runLookup.js.map +1 -0
- package/lib/server/runOverview.js +44 -27
- 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 +224 -43
- package/lib/server/runTrace.js.map +1 -1
- package/lib/structures/ITtscGraphDetails.js +3 -0
- package/lib/structures/ITtscGraphDetails.js.map +1 -0
- package/lib/structures/ITtscGraphEntrypoints.js +3 -0
- package/lib/structures/ITtscGraphEntrypoints.js.map +1 -0
- package/lib/structures/{ITtscGraphExpand.js → ITtscGraphEscape.js} +1 -1
- package/lib/structures/ITtscGraphEscape.js.map +1 -0
- package/lib/structures/ITtscGraphLookup.js +3 -0
- package/lib/structures/ITtscGraphLookup.js.map +1 -0
- package/lib/structures/{ITtscGraphIndex.js → ITtscGraphNext.js} +1 -1
- package/lib/structures/ITtscGraphNext.js.map +1 -0
- package/lib/structures/{ITtscGraphQuery.js → ITtscGraphTour.js} +1 -1
- package/lib/structures/ITtscGraphTour.js.map +1 -0
- package/lib/structures/index.js +6 -3
- package/lib/structures/index.js.map +1 -1
- package/package.json +2 -2
- package/src/TtscGraphApplication.ts +70 -30
- package/src/model/TtscGraphMemory.ts +46 -4
- package/src/server/accessAliases.ts +55 -0
- package/src/server/createServer.ts +4 -7
- package/src/server/instructions.ts +81 -21
- package/src/server/pathPolicy.ts +43 -0
- package/src/server/resultGuide.ts +20 -0
- package/src/server/runDetails.ts +553 -0
- package/src/server/{runIndex.ts → runEntrypoints.ts} +116 -36
- package/src/server/runLookup.ts +284 -0
- package/src/server/runOverview.ts +59 -31
- package/src/server/runTour.ts +881 -0
- package/src/server/runTrace.ts +299 -45
- package/src/structures/ITtscGraphApplication.ts +75 -56
- package/src/structures/ITtscGraphDecorator.ts +12 -14
- package/src/structures/ITtscGraphDetails.ts +197 -0
- package/src/structures/ITtscGraphEntrypoints.ts +149 -0
- package/src/structures/ITtscGraphEscape.ts +49 -0
- package/src/structures/ITtscGraphEvidence.ts +5 -8
- package/src/structures/ITtscGraphLookup.ts +82 -0
- package/src/structures/ITtscGraphNext.ts +23 -0
- package/src/structures/ITtscGraphNode.ts +10 -4
- package/src/structures/ITtscGraphOverview.ts +41 -18
- package/src/structures/ITtscGraphTour.ts +150 -0
- package/src/structures/ITtscGraphTrace.ts +93 -13
- package/src/structures/TtscGraphNodeKind.ts +2 -2
- package/src/structures/index.ts +6 -3
- package/lib/server/runExpand.js +0 -177
- package/lib/server/runExpand.js.map +0 -1
- package/lib/server/runIndex.js.map +0 -1
- package/lib/server/runQuery.js +0 -147
- package/lib/server/runQuery.js.map +0 -1
- package/lib/structures/ITtscGraphExpand.js.map +0 -1
- package/lib/structures/ITtscGraphIndex.js.map +0 -1
- package/lib/structures/ITtscGraphQuery.js.map +0 -1
- package/src/server/runExpand.ts +0 -186
- package/src/server/runQuery.ts +0 -150
- package/src/structures/ITtscGraphExpand.ts +0 -85
- package/src/structures/ITtscGraphIndex.ts +0 -100
- package/src/structures/ITtscGraphQuery.ts +0 -49
|
@@ -1,32 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A decorator as written on a declaration, carried on the decorated
|
|
3
|
-
* {@link ITtscGraphNode}'s `decorators`.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
3
|
+
* {@link ITtscGraphNode}'s `decorators`.
|
|
4
|
+
*
|
|
5
|
+
* The graph reports the decorator faithfully rather than interpreting any
|
|
6
|
+
* framework's convention: the `name` is the decorator as written (`Controller`,
|
|
7
|
+
* `Get`, `TypedRoute.Get`, ...), and statically resolvable literal arguments
|
|
8
|
+
* are preserved so a consumer can apply its own meaning without re-parsing
|
|
9
|
+
* source.
|
|
8
10
|
*/
|
|
9
11
|
export interface ITtscGraphDecorator {
|
|
10
12
|
/**
|
|
11
|
-
* The decorator name as written, qualified through its access path
|
|
13
|
+
* The decorator name as written, qualified through its access path:
|
|
12
14
|
* `Controller`, `Get`, `TypedRoute.Get`, `MessagePattern`.
|
|
13
15
|
*/
|
|
14
16
|
name: string;
|
|
15
17
|
|
|
16
|
-
/** The call arguments, in source order. Empty for a bare decorator. */
|
|
18
|
+
/** The literal call arguments, in source order. Empty for a bare decorator. */
|
|
17
19
|
arguments: ITtscGraphDecorator.IArgument[];
|
|
18
20
|
}
|
|
19
21
|
export namespace ITtscGraphDecorator {
|
|
20
22
|
/**
|
|
21
|
-
* One argument of an {@link ITtscGraphDecorator}. `
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* so a consumer can use it without evaluating code.
|
|
23
|
+
* One argument of an {@link ITtscGraphDecorator}. `literal` is set only when
|
|
24
|
+
* the argument is a string, number, or boolean literal the producer could
|
|
25
|
+
* resolve statically, so a consumer can use it without evaluating code.
|
|
25
26
|
*/
|
|
26
27
|
export interface IArgument {
|
|
27
|
-
/** The argument expression's source text. */
|
|
28
|
-
text: string;
|
|
29
|
-
|
|
30
28
|
/** The statically-resolved literal value, when the argument is a literal. */
|
|
31
29
|
literal?: string | number | boolean;
|
|
32
30
|
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { ITtscGraphDecorator } from "./ITtscGraphDecorator";
|
|
2
|
+
import { ITtscGraphEvidence } from "./ITtscGraphEvidence";
|
|
3
|
+
import { ITtscGraphNext } from "./ITtscGraphNext";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The source-free facts for a few selected handles.
|
|
7
|
+
*
|
|
8
|
+
* This is not a file reader. It returns signatures, member outlines, direct
|
|
9
|
+
* calls, direct types, implementation candidates, dependency summaries, and
|
|
10
|
+
* sourceSpan citation anchors.
|
|
11
|
+
*/
|
|
12
|
+
export interface ITtscGraphDetails {
|
|
13
|
+
/** Discriminator for selected symbol inspection. */
|
|
14
|
+
type: "details";
|
|
15
|
+
|
|
16
|
+
/** Selected node facts, in the same order as resolved handles when possible. */
|
|
17
|
+
nodes: ITtscGraphDetails.INode[];
|
|
18
|
+
|
|
19
|
+
/** How to use this source-free result next. */
|
|
20
|
+
next: ITtscGraphNext;
|
|
21
|
+
|
|
22
|
+
/** Human-readable compatibility note mirroring `next`. */
|
|
23
|
+
guide: string;
|
|
24
|
+
|
|
25
|
+
/** Handles that resolved to no node, or that were ambiguous. */
|
|
26
|
+
unknown: string[];
|
|
27
|
+
}
|
|
28
|
+
export namespace ITtscGraphDetails {
|
|
29
|
+
/** Which selected handles to inspect, and how much of each to return. */
|
|
30
|
+
export interface IRequest {
|
|
31
|
+
/** Discriminator for selected symbol inspection. */
|
|
32
|
+
type: "details";
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Node ids from another tool, or dotted symbol handles such as
|
|
36
|
+
* `OrderService.create`. Pass the few handles you need for source-free
|
|
37
|
+
* details. Prefer one to three handles. Use `trace` when you need a path
|
|
38
|
+
* instead of widening this call.
|
|
39
|
+
*/
|
|
40
|
+
handles: string[];
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Also list each node's direct dependencies and dependents (the symbols it
|
|
44
|
+
* uses and the symbols that use it). The list is capped; raise
|
|
45
|
+
* `neighborLimit` when the first slice is truncated and the missing
|
|
46
|
+
* relation is named. This remains a relationship summary, not a file body.
|
|
47
|
+
*
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
neighbors?: boolean;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Maximum dependencies and dependents to return per side when
|
|
54
|
+
* `neighbors:true`.
|
|
55
|
+
*
|
|
56
|
+
* Prefer the default. Values above a few neighbors are usually overfetch;
|
|
57
|
+
* call `trace` for flow instead.
|
|
58
|
+
*
|
|
59
|
+
* @default 2
|
|
60
|
+
*/
|
|
61
|
+
neighborLimit?: number;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Maximum owned members to return for a container or object literal. Raise
|
|
65
|
+
* only when the first outline is truncated and the missing member is
|
|
66
|
+
* named.
|
|
67
|
+
*
|
|
68
|
+
* @default 6
|
|
69
|
+
*/
|
|
70
|
+
memberLimit?: number;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Maximum direct execution and type references to return per group. Raise
|
|
74
|
+
* only when the first dependency slice is truncated and the missing
|
|
75
|
+
* dependency is named.
|
|
76
|
+
*
|
|
77
|
+
* @default 1
|
|
78
|
+
*/
|
|
79
|
+
dependencyLimit?: number;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Include dependency-boundary references from node_modules or bundled
|
|
83
|
+
* `.d.ts` libraries. Leave false for source-architecture answers; enable
|
|
84
|
+
* only when external type/API boundaries are the question.
|
|
85
|
+
*
|
|
86
|
+
* @default false
|
|
87
|
+
*/
|
|
88
|
+
includeExternal?: boolean;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** One inspected node: its declared shape and graph coordinates. */
|
|
92
|
+
export interface INode {
|
|
93
|
+
/** Stable node id for subsequent `details` or `trace` calls. */
|
|
94
|
+
id: string;
|
|
95
|
+
|
|
96
|
+
/** Qualified symbol name when available, otherwise the simple name. */
|
|
97
|
+
name: string;
|
|
98
|
+
|
|
99
|
+
/** Declaration kind (`class`, `method`, `function`, ...). */
|
|
100
|
+
kind: string;
|
|
101
|
+
|
|
102
|
+
/** Project-relative path of the file that declares this node. */
|
|
103
|
+
file: string;
|
|
104
|
+
|
|
105
|
+
/** 1-based declaration line, when known. */
|
|
106
|
+
line?: number;
|
|
107
|
+
|
|
108
|
+
/** The declaration signature: its first line(s) up to the body. */
|
|
109
|
+
signature?: string;
|
|
110
|
+
|
|
111
|
+
/** Decorators written on this declaration, when any. */
|
|
112
|
+
decorators?: ITtscGraphDecorator[];
|
|
113
|
+
|
|
114
|
+
/** Assigned implementation span, when source comes from one. */
|
|
115
|
+
implementation?: ITtscGraphEvidence;
|
|
116
|
+
|
|
117
|
+
/** Direct execution dependencies in source order, with edge evidence. */
|
|
118
|
+
calls?: IReference[];
|
|
119
|
+
|
|
120
|
+
/** Direct type dependencies in source order, with edge evidence. */
|
|
121
|
+
types?: IReference[];
|
|
122
|
+
|
|
123
|
+
/** Concrete nodes that implement or override this interface/base member. */
|
|
124
|
+
implementedBy?: IReference[];
|
|
125
|
+
|
|
126
|
+
/** String literal values from the signature. */
|
|
127
|
+
literals?: string[];
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* For a container or object-literal variable: the owned symbol or top-level
|
|
131
|
+
* property outline a consumer reaches for, without bodies.
|
|
132
|
+
*/
|
|
133
|
+
members?: IMember[];
|
|
134
|
+
|
|
135
|
+
/** Declaration or implementation citation range, when known. */
|
|
136
|
+
sourceSpan?: Pick<ITtscGraphEvidence, "file" | "startLine" | "endLine">;
|
|
137
|
+
|
|
138
|
+
/** Symbols this node uses (outgoing dependency edges). */
|
|
139
|
+
dependsOn?: IReference[];
|
|
140
|
+
|
|
141
|
+
/** Symbols that use this node (incoming dependency edges). */
|
|
142
|
+
dependedOnBy?: IReference[];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** One member of a container node, with its signature but not its body. */
|
|
146
|
+
export interface IMember {
|
|
147
|
+
/** Member name, qualified when the graph records an owner-qualified handle. */
|
|
148
|
+
name: string;
|
|
149
|
+
|
|
150
|
+
/** Member kind (`method`, `property`, `class`, ...). */
|
|
151
|
+
kind: string;
|
|
152
|
+
|
|
153
|
+
/** 1-based declaration line, when known. */
|
|
154
|
+
line?: number;
|
|
155
|
+
|
|
156
|
+
/** The member's declaration signature. */
|
|
157
|
+
signature?: string;
|
|
158
|
+
|
|
159
|
+
/** Decorators written on this member, when any. */
|
|
160
|
+
decorators?: ITtscGraphDecorator[];
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** A dependency neighbor of an inspected node and the edge that links them. */
|
|
164
|
+
export interface IReference {
|
|
165
|
+
/** Stable id of the neighboring node. */
|
|
166
|
+
id: string;
|
|
167
|
+
|
|
168
|
+
/** Neighbor symbol name, qualified when available. */
|
|
169
|
+
name: string;
|
|
170
|
+
|
|
171
|
+
/** Neighbor declaration kind. */
|
|
172
|
+
kind: string;
|
|
173
|
+
|
|
174
|
+
/** Project-relative declaration file for the neighbor. */
|
|
175
|
+
file: string;
|
|
176
|
+
|
|
177
|
+
/** 1-based declaration line, when known. */
|
|
178
|
+
line?: number;
|
|
179
|
+
|
|
180
|
+
/** The edge kind connecting the two (`calls`, `type_ref`, ...). */
|
|
181
|
+
relation: string;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Source span for the expression that produced this relationship. It is
|
|
185
|
+
* repository evidence for the edge, not a file-read instruction.
|
|
186
|
+
*/
|
|
187
|
+
evidence?: ITtscGraphEvidence;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Stable access-path aliases derived from edge evidence. For example, an
|
|
191
|
+
* edge to `Owner.member` through `obj.slot.member` may expose
|
|
192
|
+
* `Owner.slot.member` so answers can preserve both the resolved symbol and
|
|
193
|
+
* the source access path.
|
|
194
|
+
*/
|
|
195
|
+
aliases?: string[];
|
|
196
|
+
}
|
|
197
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { ITtscGraphDecorator } from "./ITtscGraphDecorator";
|
|
2
|
+
import { ITtscGraphEvidence } from "./ITtscGraphEvidence";
|
|
3
|
+
import { ITtscGraphNext } from "./ITtscGraphNext";
|
|
4
|
+
|
|
5
|
+
/** The first compact source-free handle list for a TypeScript code question. */
|
|
6
|
+
export interface ITtscGraphEntrypoints {
|
|
7
|
+
/** Discriminator for first-pass question indexing. */
|
|
8
|
+
type: "entrypoints";
|
|
9
|
+
|
|
10
|
+
/** The original question/search phrase the entrypoints were built for. */
|
|
11
|
+
query: string;
|
|
12
|
+
|
|
13
|
+
/** Ranked symbols relevant to the query. */
|
|
14
|
+
hits: ITtscGraphEntrypoints.IHit[];
|
|
15
|
+
|
|
16
|
+
/** Code handles written directly in the query, resolved when possible. */
|
|
17
|
+
mentions: ITtscGraphEntrypoints.IMention[];
|
|
18
|
+
|
|
19
|
+
/** Direct dependency context for the resolved mentions and highest hits. */
|
|
20
|
+
neighborhood: ITtscGraphEntrypoints.INeighborhood[];
|
|
21
|
+
|
|
22
|
+
/** How to use this source-free result next. */
|
|
23
|
+
next: ITtscGraphNext;
|
|
24
|
+
|
|
25
|
+
/** Human-readable compatibility note mirroring `next`. */
|
|
26
|
+
guide: string;
|
|
27
|
+
|
|
28
|
+
/** True when result caps hid additional seeds or references. */
|
|
29
|
+
truncated?: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export namespace ITtscGraphEntrypoints {
|
|
33
|
+
/**
|
|
34
|
+
* Ask for first handles when the question is narrow but the symbol is not yet
|
|
35
|
+
* known. For broad tours, read-next, architecture, or multi-phase runtime
|
|
36
|
+
* flow, use `tour` instead of decomposing the answer into entrypoints and
|
|
37
|
+
* follow-up calls.
|
|
38
|
+
*/
|
|
39
|
+
export interface IRequest {
|
|
40
|
+
/** Discriminator for first-pass question indexing. */
|
|
41
|
+
type: "entrypoints";
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* A natural code question or search phrase. Mix prose with code handles,
|
|
45
|
+
* for example `how Repository.find loads relations` or
|
|
46
|
+
* `SelectQueryBuilder.setFindOptions join aliases`. Keep this close to the
|
|
47
|
+
* user's question; do not turn it into a broad keyword dump.
|
|
48
|
+
*/
|
|
49
|
+
query: string;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Maximum ranked hits to return.
|
|
53
|
+
*
|
|
54
|
+
* Prefer the default. Raise only when the first result was truncated and
|
|
55
|
+
* the missing handle is named.
|
|
56
|
+
*
|
|
57
|
+
* @default 4
|
|
58
|
+
*/
|
|
59
|
+
limit?: number;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Maximum direct dependencies and dependents to return per indexed symbol.
|
|
63
|
+
* This is an orientation slice, not a dependency dump; use `trace` or
|
|
64
|
+
* `details` with `neighbors:true` after choosing the specific handles.
|
|
65
|
+
* Prefer the default zero for the first call.
|
|
66
|
+
*
|
|
67
|
+
* @default 0
|
|
68
|
+
*/
|
|
69
|
+
neighbors?: number;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** A compact symbol coordinate, optionally with its declaration signature. */
|
|
73
|
+
export interface INode {
|
|
74
|
+
/** Stable node id for subsequent graph calls. */
|
|
75
|
+
id: string;
|
|
76
|
+
|
|
77
|
+
/** Qualified symbol name when available, otherwise the simple name. */
|
|
78
|
+
name: string;
|
|
79
|
+
|
|
80
|
+
/** Declaration kind (`class`, `method`, `function`, ...). */
|
|
81
|
+
kind: string;
|
|
82
|
+
|
|
83
|
+
/** Project-relative path of the declaration file. */
|
|
84
|
+
file: string;
|
|
85
|
+
|
|
86
|
+
/** 1-based declaration line, when known. */
|
|
87
|
+
line?: number;
|
|
88
|
+
|
|
89
|
+
/** Declaration head, included only for indexed symbols. */
|
|
90
|
+
signature?: string;
|
|
91
|
+
|
|
92
|
+
/** Decorators written on this declaration, when any. */
|
|
93
|
+
decorators?: ITtscGraphDecorator[];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** One ranked search hit. */
|
|
97
|
+
export interface IHit extends INode {
|
|
98
|
+
/** Relative relevance; higher is a better match. */
|
|
99
|
+
score: number;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** A code handle written in the query, with its resolution status. */
|
|
103
|
+
export interface IMention {
|
|
104
|
+
/** The exact handle text found in the query. */
|
|
105
|
+
handle: string;
|
|
106
|
+
|
|
107
|
+
/** Resolved node when the handle maps unambiguously. */
|
|
108
|
+
node?: INode;
|
|
109
|
+
|
|
110
|
+
/** Candidate nodes when the handle is ambiguous. */
|
|
111
|
+
candidates?: INode[];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** Direct dependency context around one indexed symbol. */
|
|
115
|
+
export interface INeighborhood extends INode {
|
|
116
|
+
/** Symbols this node directly uses, capped by `neighbors`. */
|
|
117
|
+
dependsOn: IReference[];
|
|
118
|
+
|
|
119
|
+
/** Symbols that directly use this node, capped by `neighbors`. */
|
|
120
|
+
dependedOnBy: IReference[];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** One neighboring symbol and the relationship leading to it. */
|
|
124
|
+
export interface IReference {
|
|
125
|
+
/** Stable id of the neighboring node. */
|
|
126
|
+
id: string;
|
|
127
|
+
|
|
128
|
+
/** Neighbor symbol name, qualified when available. */
|
|
129
|
+
name: string;
|
|
130
|
+
|
|
131
|
+
/** Neighbor declaration kind. */
|
|
132
|
+
kind: string;
|
|
133
|
+
|
|
134
|
+
/** Project-relative declaration file for the neighbor. */
|
|
135
|
+
file: string;
|
|
136
|
+
|
|
137
|
+
/** 1-based declaration line, when known. */
|
|
138
|
+
line?: number;
|
|
139
|
+
|
|
140
|
+
/** Edge kind connecting the indexed node and this neighbor. */
|
|
141
|
+
relation: string;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Source span for the expression that produced this relationship. It lets
|
|
145
|
+
* an agent see why the edge exists without opening the file.
|
|
146
|
+
*/
|
|
147
|
+
evidence?: ITtscGraphEvidence;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ITtscGraphNext } from "./ITtscGraphNext";
|
|
2
|
+
|
|
3
|
+
/** The no-op result for when graph is not the useful next evidence source. */
|
|
4
|
+
export interface ITtscGraphEscape {
|
|
5
|
+
/** Discriminator for the no-op escape route. */
|
|
6
|
+
type: "escape";
|
|
7
|
+
|
|
8
|
+
/** Always true so callers can distinguish an intentional no-op. */
|
|
9
|
+
skipped: true;
|
|
10
|
+
|
|
11
|
+
/** Why no graph operation should run. */
|
|
12
|
+
reason: string;
|
|
13
|
+
|
|
14
|
+
/** How to proceed after skipping graph work. */
|
|
15
|
+
next: ITtscGraphNext;
|
|
16
|
+
|
|
17
|
+
/** Human-readable compatibility note mirroring `next`. */
|
|
18
|
+
guide: string;
|
|
19
|
+
|
|
20
|
+
/** Optional note about the next non-graph step. */
|
|
21
|
+
nextStep?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export namespace ITtscGraphEscape {
|
|
25
|
+
/** Skip graph work when graph evidence is unnecessary or exhausted. */
|
|
26
|
+
export interface IRequest {
|
|
27
|
+
/** Discriminator for the no-op escape route. */
|
|
28
|
+
type: "escape";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Why no graph operation should run.
|
|
32
|
+
*
|
|
33
|
+
* Use this only when the next evidence is outside the indexed TypeScript
|
|
34
|
+
* graph: package scripts, config files, generated output, prose docs, exact
|
|
35
|
+
* text, or exact source body text. Name the smallest returned sourceSpan
|
|
36
|
+
* when source body text is truly required.
|
|
37
|
+
*/
|
|
38
|
+
reason: string;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The final non-graph note, if useful.
|
|
42
|
+
*
|
|
43
|
+
* Keep this short. Examples: `answer from the prior graph result`, `source
|
|
44
|
+
* body needed at returned sourceSpan`, or `ask the user for a concrete
|
|
45
|
+
* symbol`.
|
|
46
|
+
*/
|
|
47
|
+
nextStep?: string;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A source location that grounds a node or edge in real code
|
|
3
|
-
* span for a node, or the expression that produced an edge.
|
|
2
|
+
* A source location that grounds a node or edge in real code: the declaration
|
|
3
|
+
* span for a node, or the expression range that produced an edge.
|
|
4
4
|
*
|
|
5
5
|
* Evidence is display and grounding only; it is never identity. A node's id is
|
|
6
6
|
* position-invariant (see {@link ITtscGraphNode}), so an edit that shifts a span
|
|
7
|
-
* does not re-key anything. `startLine`/`startCol` are 1-based.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* does not re-key anything. `startLine`/`startCol` are 1-based. MCP output
|
|
8
|
+
* keeps evidence as coordinates; consumers can read the file themselves when
|
|
9
|
+
* they truly need source text.
|
|
10
10
|
*/
|
|
11
11
|
export interface ITtscGraphEvidence {
|
|
12
12
|
/** Project-relative path of the file the span lives in. */
|
|
@@ -23,7 +23,4 @@ export interface ITtscGraphEvidence {
|
|
|
23
23
|
|
|
24
24
|
/** 1-based column where the span ends, when known. */
|
|
25
25
|
endCol?: number;
|
|
26
|
-
|
|
27
|
-
/** A short source excerpt of the span, when the producer inlines one. */
|
|
28
|
-
text?: string;
|
|
29
26
|
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { ITtscGraphDecorator } from "./ITtscGraphDecorator";
|
|
2
|
+
import { ITtscGraphNext } from "./ITtscGraphNext";
|
|
3
|
+
|
|
4
|
+
/** Targeted symbol lookup when a concrete name or handle is being resolved. */
|
|
5
|
+
export interface ITtscGraphLookup {
|
|
6
|
+
/** Discriminator for targeted symbol lookup. */
|
|
7
|
+
type: "lookup";
|
|
8
|
+
|
|
9
|
+
/** Ranked symbol matches for the query. */
|
|
10
|
+
hits: ITtscGraphLookup.IHit[];
|
|
11
|
+
|
|
12
|
+
/** How to use this source-free result next. */
|
|
13
|
+
next: ITtscGraphNext;
|
|
14
|
+
|
|
15
|
+
/** Human-readable compatibility note mirroring `next`. */
|
|
16
|
+
guide: string;
|
|
17
|
+
}
|
|
18
|
+
export namespace ITtscGraphLookup {
|
|
19
|
+
/** Find a concrete class, method, function, property, type, or dotted handle. */
|
|
20
|
+
export interface IRequest {
|
|
21
|
+
/** Discriminator for targeted symbol lookup. */
|
|
22
|
+
type: "lookup";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* What to find, in natural language and code vocabulary mixed freely: a
|
|
26
|
+
* symbol name, a dotted member (`Service.create`), or a short phrase
|
|
27
|
+
* (`request handler`). Exact names are not required, but this is not a
|
|
28
|
+
* second broad entrypoints call. Use it when a named handle is missing or
|
|
29
|
+
* ambiguous.
|
|
30
|
+
*/
|
|
31
|
+
query: string;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Maximum hits to return.
|
|
35
|
+
*
|
|
36
|
+
* Prefer the default. Large hit lists usually mean the query is too broad;
|
|
37
|
+
* refine the name instead of raising this.
|
|
38
|
+
*
|
|
39
|
+
* @default 5
|
|
40
|
+
*/
|
|
41
|
+
limit?: number;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Include dependency-boundary declarations from node_modules or bundled
|
|
45
|
+
* `.d.ts` libraries. Leave false for project-source answers; enable only
|
|
46
|
+
* when external type/API boundaries are the question.
|
|
47
|
+
*
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
includeExternal?: boolean;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** One ranked hit with a handle to follow via `details` or `trace`. */
|
|
54
|
+
export interface IHit {
|
|
55
|
+
/** Stable node id for subsequent graph calls. */
|
|
56
|
+
id: string;
|
|
57
|
+
|
|
58
|
+
/** Qualified symbol name when available, otherwise the simple name. */
|
|
59
|
+
name: string;
|
|
60
|
+
|
|
61
|
+
/** Declaration kind (`class`, `method`, `function`, ...). */
|
|
62
|
+
kind: string;
|
|
63
|
+
|
|
64
|
+
/** Project-relative path of the declaration file. */
|
|
65
|
+
file: string;
|
|
66
|
+
|
|
67
|
+
/** 1-based declaration line, when known. */
|
|
68
|
+
line?: number;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The hit's declaration signature, so you can often answer without
|
|
72
|
+
* requesting details.
|
|
73
|
+
*/
|
|
74
|
+
signature?: string;
|
|
75
|
+
|
|
76
|
+
/** Decorators written on this declaration, when any. */
|
|
77
|
+
decorators?: ITtscGraphDecorator[];
|
|
78
|
+
|
|
79
|
+
/** Relative relevance; higher is a better match. */
|
|
80
|
+
score: number;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** The required next step from a compiler-derived graph result. */
|
|
2
|
+
export interface ITtscGraphNext {
|
|
3
|
+
/**
|
|
4
|
+
* Answer, continue graph inspection, leave graph, or clarify.
|
|
5
|
+
*
|
|
6
|
+
* `answer` means the returned graph result already carries the evidence
|
|
7
|
+
* contract for the current question, even when the slice is capped. Do not
|
|
8
|
+
* call graph again or read files to re-check or complete it.
|
|
9
|
+
*/
|
|
10
|
+
action: "answer" | "inspect" | "outside" | "clarify";
|
|
11
|
+
|
|
12
|
+
/** Smallest graph request type to use when `action` is `inspect`. */
|
|
13
|
+
request?:
|
|
14
|
+
| "entrypoints"
|
|
15
|
+
| "lookup"
|
|
16
|
+
| "trace"
|
|
17
|
+
| "details"
|
|
18
|
+
| "overview"
|
|
19
|
+
| "tour";
|
|
20
|
+
|
|
21
|
+
/** Why the returned graph evidence supports that action. */
|
|
22
|
+
reason: string;
|
|
23
|
+
}
|
|
@@ -23,7 +23,7 @@ export interface ITtscGraphNode {
|
|
|
23
23
|
name: string;
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* The owner-qualified name, when the node lives inside another declaration
|
|
26
|
+
* The owner-qualified name, when the node lives inside another declaration:
|
|
27
27
|
* `OrderService.create`, `Shopping.ISale`. Absent for a top-level
|
|
28
28
|
* declaration.
|
|
29
29
|
*/
|
|
@@ -34,7 +34,7 @@ export interface ITtscGraphNode {
|
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* True when the declaration lives outside the workspace (a dependency). The
|
|
37
|
-
* graph keeps the leaf as a named endpoint but does not
|
|
37
|
+
* graph keeps the leaf as a named endpoint but does not walk into its
|
|
38
38
|
* internals.
|
|
39
39
|
*/
|
|
40
40
|
external: boolean;
|
|
@@ -54,11 +54,17 @@ export interface ITtscGraphNode {
|
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
56
|
* The decorators written on this declaration, in source order, when it has
|
|
57
|
-
* any
|
|
57
|
+
* any: raw decorator facts (`@Controller`, `@Get`) a consumer can interpret
|
|
58
58
|
* without re-parsing source.
|
|
59
59
|
*/
|
|
60
60
|
decorators?: ITtscGraphDecorator[];
|
|
61
61
|
|
|
62
|
-
/** The declaration span, for display and
|
|
62
|
+
/** The declaration span, for display and signatures. */
|
|
63
63
|
evidence?: ITtscGraphEvidence;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The implementation span when a callable/property member is implemented by a
|
|
67
|
+
* function assignment separate from its declaration.
|
|
68
|
+
*/
|
|
69
|
+
implementation?: ITtscGraphEvidence;
|
|
64
70
|
}
|