@ttsc/graph 0.16.10 → 0.16.12

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.
Files changed (53) hide show
  1. package/lib/TtscGraphApplication.d.ts +24 -0
  2. package/lib/bin.d.ts +2 -0
  3. package/lib/index.d.ts +12 -0
  4. package/lib/index.js +2 -0
  5. package/lib/index.js.map +1 -1
  6. package/lib/model/TtscGraphMemory.d.ts +41 -0
  7. package/lib/model/loadGraph.d.ts +23 -0
  8. package/lib/model/loadGraph.js +2 -0
  9. package/lib/model/loadGraph.js.map +1 -1
  10. package/lib/nativeExecutable.d.ts +9 -0
  11. package/lib/nativeExecutable.js +33 -0
  12. package/lib/nativeExecutable.js.map +1 -0
  13. package/lib/reduce.d.ts +46 -0
  14. package/lib/resolveGraphBinary.d.ts +18 -0
  15. package/lib/server/accessAliases.d.ts +8 -0
  16. package/lib/server/createServer.d.ts +15 -0
  17. package/lib/server/pathPolicy.d.ts +9 -0
  18. package/lib/server/resolveHandle.d.ts +8 -0
  19. package/lib/server/resultGuide.d.ts +3 -0
  20. package/lib/server/runDetails.d.ts +24 -0
  21. package/lib/server/runEntrypoints.d.ts +9 -0
  22. package/lib/server/runLookup.d.ts +10 -0
  23. package/lib/server/runOverview.d.ts +10 -0
  24. package/lib/server/runTour.d.ts +8 -0
  25. package/lib/server/runTrace.d.ts +10 -0
  26. package/lib/server/startServer.d.ts +11 -0
  27. package/lib/structures/ITtscGraphApplication.d.ts +161 -0
  28. package/lib/structures/ITtscGraphDecorator.d.ts +30 -0
  29. package/lib/structures/ITtscGraphDetails.d.ts +157 -0
  30. package/lib/structures/ITtscGraphDiagnostic.d.ts +27 -0
  31. package/lib/structures/ITtscGraphDump.d.ts +30 -0
  32. package/lib/structures/ITtscGraphEdge.d.ts +20 -0
  33. package/lib/structures/ITtscGraphEntrypoints.d.ts +117 -0
  34. package/lib/structures/ITtscGraphEscape.d.ts +40 -0
  35. package/lib/structures/ITtscGraphEvidence.d.ts +22 -0
  36. package/lib/structures/ITtscGraphLookup.d.ts +67 -0
  37. package/lib/structures/ITtscGraphNext.d.ts +15 -0
  38. package/lib/structures/ITtscGraphNode.d.ts +58 -0
  39. package/lib/structures/ITtscGraphOverview.d.ts +85 -0
  40. package/lib/structures/ITtscGraphTour.d.ts +113 -0
  41. package/lib/structures/ITtscGraphTrace.d.ts +143 -0
  42. package/lib/structures/TtscGraphEdgeKind.d.ts +10 -0
  43. package/lib/structures/TtscGraphNodeKind.d.ts +12 -0
  44. package/lib/structures/TtscGraphNodeModifier.d.ts +7 -0
  45. package/lib/structures/index.d.ts +18 -0
  46. package/lib/view.d.ts +7 -0
  47. package/lib/view.js +2 -0
  48. package/lib/view.js.map +1 -1
  49. package/package.json +2 -2
  50. package/src/index.ts +2 -0
  51. package/src/model/loadGraph.ts +2 -0
  52. package/src/nativeExecutable.ts +24 -0
  53. package/src/view.ts +2 -0
@@ -0,0 +1,157 @@
1
+ import { ITtscGraphDecorator } from "./ITtscGraphDecorator";
2
+ import { ITtscGraphEvidence } from "./ITtscGraphEvidence";
3
+ import { ITtscGraphNext } from "./ITtscGraphNext";
4
+ /**
5
+ * The source-free facts for a few selected handles.
6
+ *
7
+ * This is not a file reader. It returns signatures, member outlines, direct
8
+ * calls, direct types, implementation candidates, dependency summaries, and
9
+ * sourceSpan citation anchors.
10
+ */
11
+ export interface ITtscGraphDetails {
12
+ /** Discriminator for selected symbol inspection. */
13
+ type: "details";
14
+ /** Selected node facts, in the same order as resolved handles when possible. */
15
+ nodes: ITtscGraphDetails.INode[];
16
+ /** How to use this source-free result next. */
17
+ next: ITtscGraphNext;
18
+ /** Human-readable compatibility note mirroring `next`. */
19
+ guide: string;
20
+ /** Handles that resolved to no node, or that were ambiguous. */
21
+ unknown: string[];
22
+ }
23
+ export declare namespace ITtscGraphDetails {
24
+ /** Which selected handles to inspect, and how much of each to return. */
25
+ interface IRequest {
26
+ /** Discriminator for selected symbol inspection. */
27
+ type: "details";
28
+ /**
29
+ * Node ids from another tool, or dotted symbol handles such as
30
+ * `OrderService.create`. Pass the few handles you need for source-free
31
+ * details. Prefer one to three handles. Use `trace` when you need a path
32
+ * instead of widening this call.
33
+ */
34
+ handles: string[];
35
+ /**
36
+ * Also list each node's direct dependencies and dependents (the symbols it
37
+ * uses and the symbols that use it). The list is capped; raise
38
+ * `neighborLimit` when the first slice is truncated and the missing
39
+ * relation is named. This remains a relationship summary, not a file body.
40
+ *
41
+ * @default false
42
+ */
43
+ neighbors?: boolean;
44
+ /**
45
+ * Maximum dependencies and dependents to return per side when
46
+ * `neighbors:true`.
47
+ *
48
+ * Prefer the default. Values above a few neighbors are usually overfetch;
49
+ * call `trace` for flow instead.
50
+ *
51
+ * @default 2
52
+ */
53
+ neighborLimit?: number;
54
+ /**
55
+ * Maximum owned members to return for a container or object literal. Raise
56
+ * only when the first outline is truncated and the missing member is
57
+ * named.
58
+ *
59
+ * @default 6
60
+ */
61
+ memberLimit?: number;
62
+ /**
63
+ * Maximum direct execution and type references to return per group. Raise
64
+ * only when the first dependency slice is truncated and the missing
65
+ * dependency is named.
66
+ *
67
+ * @default 1
68
+ */
69
+ dependencyLimit?: number;
70
+ /**
71
+ * Include dependency-boundary references from node_modules or bundled
72
+ * `.d.ts` libraries. Leave false for source-architecture answers; enable
73
+ * only when external type/API boundaries are the question.
74
+ *
75
+ * @default false
76
+ */
77
+ includeExternal?: boolean;
78
+ }
79
+ /** One inspected node: its declared shape and graph coordinates. */
80
+ interface INode {
81
+ /** Stable node id for subsequent `details` or `trace` calls. */
82
+ id: string;
83
+ /** Qualified symbol name when available, otherwise the simple name. */
84
+ name: string;
85
+ /** Declaration kind (`class`, `method`, `function`, ...). */
86
+ kind: string;
87
+ /** Project-relative path of the file that declares this node. */
88
+ file: string;
89
+ /** 1-based declaration line, when known. */
90
+ line?: number;
91
+ /** The declaration signature: its first line(s) up to the body. */
92
+ signature?: string;
93
+ /** Decorators written on this declaration, when any. */
94
+ decorators?: ITtscGraphDecorator[];
95
+ /** Assigned implementation span, when source comes from one. */
96
+ implementation?: ITtscGraphEvidence;
97
+ /** Direct execution dependencies in source order, with edge evidence. */
98
+ calls?: IReference[];
99
+ /** Direct type dependencies in source order, with edge evidence. */
100
+ types?: IReference[];
101
+ /** Concrete nodes that implement or override this interface/base member. */
102
+ implementedBy?: IReference[];
103
+ /** String literal values from the signature. */
104
+ literals?: string[];
105
+ /**
106
+ * For a container or object-literal variable: the owned symbol or top-level
107
+ * property outline a consumer reaches for, without bodies.
108
+ */
109
+ members?: IMember[];
110
+ /** Declaration or implementation citation range, when known. */
111
+ sourceSpan?: Pick<ITtscGraphEvidence, "file" | "startLine" | "endLine">;
112
+ /** Symbols this node uses (outgoing dependency edges). */
113
+ dependsOn?: IReference[];
114
+ /** Symbols that use this node (incoming dependency edges). */
115
+ dependedOnBy?: IReference[];
116
+ }
117
+ /** One member of a container node, with its signature but not its body. */
118
+ interface IMember {
119
+ /** Member name, qualified when the graph records an owner-qualified handle. */
120
+ name: string;
121
+ /** Member kind (`method`, `property`, `class`, ...). */
122
+ kind: string;
123
+ /** 1-based declaration line, when known. */
124
+ line?: number;
125
+ /** The member's declaration signature. */
126
+ signature?: string;
127
+ /** Decorators written on this member, when any. */
128
+ decorators?: ITtscGraphDecorator[];
129
+ }
130
+ /** A dependency neighbor of an inspected node and the edge that links them. */
131
+ interface IReference {
132
+ /** Stable id of the neighboring node. */
133
+ id: string;
134
+ /** Neighbor symbol name, qualified when available. */
135
+ name: string;
136
+ /** Neighbor declaration kind. */
137
+ kind: string;
138
+ /** Project-relative declaration file for the neighbor. */
139
+ file: string;
140
+ /** 1-based declaration line, when known. */
141
+ line?: number;
142
+ /** The edge kind connecting the two (`calls`, `type_ref`, ...). */
143
+ relation: string;
144
+ /**
145
+ * Source span for the expression that produced this relationship. It is
146
+ * repository evidence for the edge, not a file-read instruction.
147
+ */
148
+ evidence?: ITtscGraphEvidence;
149
+ /**
150
+ * Stable access-path aliases derived from edge evidence. For example, an
151
+ * edge to `Owner.member` through `obj.slot.member` may expose
152
+ * `Owner.slot.member` so answers can preserve both the resolved symbol and
153
+ * the source access path.
154
+ */
155
+ aliases?: string[];
156
+ }
157
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * A compiler or plugin diagnostic, fused onto the graph so an edit-triage query
3
+ * can name the owning symbol of an error.
4
+ *
5
+ * The TypeScript semantic pass contributes numeric-coded `tsc` diagnostics;
6
+ * `@ttsc/lint` rules and transform plugins (typia, nestia, …) contribute
7
+ * `plugin`/`lint` findings whose `code` is a string. `node` is set when the
8
+ * finding's position was attributed to a graph node.
9
+ */
10
+ export interface ITtscGraphDiagnostic {
11
+ /** Project-relative path of the file the diagnostic is reported in. */
12
+ file: string;
13
+ /** 1-based line of the diagnostic. */
14
+ line: number;
15
+ /** 1-based column of the diagnostic, when known. */
16
+ column?: number;
17
+ /** Numeric `tsc` code, or string rule id for a lint/plugin finding. */
18
+ code: number | string;
19
+ /** The human-readable diagnostic message. */
20
+ message: string;
21
+ /** Severity, when the producer distinguishes it. */
22
+ severity?: "error" | "warning" | "info" | "hint";
23
+ /** Which lane produced the diagnostic. */
24
+ origin?: "tsc" | "plugin" | "lint";
25
+ /** Node id the diagnostic was fused onto, when resolved. */
26
+ node?: string;
27
+ }
@@ -0,0 +1,30 @@
1
+ import { ITtscGraphDiagnostic } from "./ITtscGraphDiagnostic";
2
+ import { ITtscGraphEdge } from "./ITtscGraphEdge";
3
+ import { ITtscGraphNode } from "./ITtscGraphNode";
4
+ /**
5
+ * The whole-graph export `ttscgraph dump` writes and the MCP server loads — the
6
+ * wire contract between the Go fact-builder and the TypeScript graph engine.
7
+ *
8
+ * It is the complete graph with none of the per-response caps the MCP tools
9
+ * apply: every node and edge the build resolved. The server parses it once at
10
+ * startup (typia-validated) into an in-memory resident graph and answers every
11
+ * tool call from that warm model; the bundled 3D viewer reduces the same dump.
12
+ *
13
+ * Paths in `project` and `tsconfig` are absolute; `file` fields on nodes,
14
+ * edges, and diagnostics are project-relative.
15
+ */
16
+ export interface ITtscGraphDump {
17
+ /** Absolute path of the project root the graph was built for. */
18
+ project: string;
19
+ /** The tsconfig the program was loaded from, relative to `project`. */
20
+ tsconfig: string;
21
+ /** Every node the build recorded. */
22
+ nodes: ITtscGraphNode[];
23
+ /** Every edge the build resolved. */
24
+ edges: ITtscGraphEdge[];
25
+ /**
26
+ * Fused compiler and plugin diagnostics, when diagnostics were collected.
27
+ * Absent when the dump was built without a diagnostics pass.
28
+ */
29
+ diagnostics?: ITtscGraphDiagnostic[];
30
+ }
@@ -0,0 +1,20 @@
1
+ import { ITtscGraphEvidence } from "./ITtscGraphEvidence";
2
+ import { TtscGraphEdgeKind } from "./TtscGraphEdgeKind";
3
+ /**
4
+ * A directed relationship from one {@link ITtscGraphNode} to another, both named
5
+ * by `id`. The triple `(from, to, kind)` is unique; a repeated relationship
6
+ * keeps the first source-order evidence.
7
+ *
8
+ * Every edge is resolved by the compiler, so there is no per-edge trust flag to
9
+ * carry — the whole graph is checker-resolved fact.
10
+ */
11
+ export interface ITtscGraphEdge {
12
+ /** Node id the relationship originates from. */
13
+ from: string;
14
+ /** Node id the relationship points to. */
15
+ to: string;
16
+ /** The relationship kind. */
17
+ kind: TtscGraphEdgeKind;
18
+ /** The source expression that produced the edge, for display and expansion. */
19
+ evidence?: ITtscGraphEvidence;
20
+ }
@@ -0,0 +1,117 @@
1
+ import { ITtscGraphDecorator } from "./ITtscGraphDecorator";
2
+ import { ITtscGraphEvidence } from "./ITtscGraphEvidence";
3
+ import { ITtscGraphNext } from "./ITtscGraphNext";
4
+ /** The first compact source-free handle list for a TypeScript code question. */
5
+ export interface ITtscGraphEntrypoints {
6
+ /** Discriminator for first-pass question indexing. */
7
+ type: "entrypoints";
8
+ /** The original question/search phrase the entrypoints were built for. */
9
+ query: string;
10
+ /** Ranked symbols relevant to the query. */
11
+ hits: ITtscGraphEntrypoints.IHit[];
12
+ /** Code handles written directly in the query, resolved when possible. */
13
+ mentions: ITtscGraphEntrypoints.IMention[];
14
+ /** Direct dependency context for the resolved mentions and highest hits. */
15
+ neighborhood: ITtscGraphEntrypoints.INeighborhood[];
16
+ /** How to use this source-free result next. */
17
+ next: ITtscGraphNext;
18
+ /** Human-readable compatibility note mirroring `next`. */
19
+ guide: string;
20
+ /** True when result caps hid additional seeds or references. */
21
+ truncated?: boolean;
22
+ }
23
+ export declare namespace ITtscGraphEntrypoints {
24
+ /**
25
+ * Ask for first handles when the question is narrow but the symbol is not yet
26
+ * known. For broad tours, read-next, architecture, or multi-phase runtime
27
+ * flow, use `tour` instead of decomposing the answer into entrypoints and
28
+ * follow-up calls.
29
+ */
30
+ interface IRequest {
31
+ /** Discriminator for first-pass question indexing. */
32
+ type: "entrypoints";
33
+ /**
34
+ * A natural code question or search phrase. Mix prose with code handles,
35
+ * for example `how Repository.find loads relations` or
36
+ * `SelectQueryBuilder.setFindOptions join aliases`. Keep this close to the
37
+ * user's question; do not turn it into a broad keyword dump.
38
+ */
39
+ query: string;
40
+ /**
41
+ * Maximum ranked hits to return.
42
+ *
43
+ * Prefer the default. Raise only when the first result was truncated and
44
+ * the missing handle is named.
45
+ *
46
+ * @default 4
47
+ */
48
+ limit?: number;
49
+ /**
50
+ * Maximum direct dependencies and dependents to return per indexed symbol.
51
+ * This is an orientation slice, not a dependency dump; use `trace` or
52
+ * `details` with `neighbors:true` after choosing the specific handles.
53
+ * Prefer the default zero for the first call.
54
+ *
55
+ * @default 0
56
+ */
57
+ neighbors?: number;
58
+ }
59
+ /** A compact symbol coordinate, optionally with its declaration signature. */
60
+ interface INode {
61
+ /** Stable node id for subsequent graph calls. */
62
+ id: string;
63
+ /** Qualified symbol name when available, otherwise the simple name. */
64
+ name: string;
65
+ /** Declaration kind (`class`, `method`, `function`, ...). */
66
+ kind: string;
67
+ /** Project-relative path of the declaration file. */
68
+ file: string;
69
+ /** 1-based declaration line, when known. */
70
+ line?: number;
71
+ /** Declaration head, included only for indexed symbols. */
72
+ signature?: string;
73
+ /** Decorators written on this declaration, when any. */
74
+ decorators?: ITtscGraphDecorator[];
75
+ }
76
+ /** One ranked search hit. */
77
+ interface IHit extends INode {
78
+ /** Relative relevance; higher is a better match. */
79
+ score: number;
80
+ }
81
+ /** A code handle written in the query, with its resolution status. */
82
+ interface IMention {
83
+ /** The exact handle text found in the query. */
84
+ handle: string;
85
+ /** Resolved node when the handle maps unambiguously. */
86
+ node?: INode;
87
+ /** Candidate nodes when the handle is ambiguous. */
88
+ candidates?: INode[];
89
+ }
90
+ /** Direct dependency context around one indexed symbol. */
91
+ interface INeighborhood extends INode {
92
+ /** Symbols this node directly uses, capped by `neighbors`. */
93
+ dependsOn: IReference[];
94
+ /** Symbols that directly use this node, capped by `neighbors`. */
95
+ dependedOnBy: IReference[];
96
+ }
97
+ /** One neighboring symbol and the relationship leading to it. */
98
+ interface IReference {
99
+ /** Stable id of the neighboring node. */
100
+ id: string;
101
+ /** Neighbor symbol name, qualified when available. */
102
+ name: string;
103
+ /** Neighbor declaration kind. */
104
+ kind: string;
105
+ /** Project-relative declaration file for the neighbor. */
106
+ file: string;
107
+ /** 1-based declaration line, when known. */
108
+ line?: number;
109
+ /** Edge kind connecting the indexed node and this neighbor. */
110
+ relation: string;
111
+ /**
112
+ * Source span for the expression that produced this relationship. It lets
113
+ * an agent see why the edge exists without opening the file.
114
+ */
115
+ evidence?: ITtscGraphEvidence;
116
+ }
117
+ }
@@ -0,0 +1,40 @@
1
+ import { ITtscGraphNext } from "./ITtscGraphNext";
2
+ /** The no-op result for when graph is not the useful next evidence source. */
3
+ export interface ITtscGraphEscape {
4
+ /** Discriminator for the no-op escape route. */
5
+ type: "escape";
6
+ /** Always true so callers can distinguish an intentional no-op. */
7
+ skipped: true;
8
+ /** Why no graph operation should run. */
9
+ reason: string;
10
+ /** How to proceed after skipping graph work. */
11
+ next: ITtscGraphNext;
12
+ /** Human-readable compatibility note mirroring `next`. */
13
+ guide: string;
14
+ /** Optional note about the next non-graph step. */
15
+ nextStep?: string;
16
+ }
17
+ export declare namespace ITtscGraphEscape {
18
+ /** Skip graph work when graph evidence is unnecessary or exhausted. */
19
+ interface IRequest {
20
+ /** Discriminator for the no-op escape route. */
21
+ type: "escape";
22
+ /**
23
+ * Why no graph operation should run.
24
+ *
25
+ * Use this only when the next evidence is outside the indexed TypeScript
26
+ * graph: package scripts, config files, generated output, prose docs, exact
27
+ * text, or exact source body text. Name the smallest returned sourceSpan
28
+ * when source body text is truly required.
29
+ */
30
+ reason: string;
31
+ /**
32
+ * The final non-graph note, if useful.
33
+ *
34
+ * Keep this short. Examples: `answer from the prior graph result`, `source
35
+ * body needed at returned sourceSpan`, or `ask the user for a concrete
36
+ * symbol`.
37
+ */
38
+ nextStep?: string;
39
+ }
40
+ }
@@ -0,0 +1,22 @@
1
+ /**
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
+ *
5
+ * Evidence is display and grounding only; it is never identity. A node's id is
6
+ * position-invariant (see {@link ITtscGraphNode}), so an edit that shifts a span
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
+ */
11
+ export interface ITtscGraphEvidence {
12
+ /** Project-relative path of the file the span lives in. */
13
+ file: string;
14
+ /** 1-based line where the span starts. */
15
+ startLine: number;
16
+ /** 1-based column where the span starts, when known. */
17
+ startCol?: number;
18
+ /** 1-based line where the span ends, when it differs from `startLine`. */
19
+ endLine?: number;
20
+ /** 1-based column where the span ends, when known. */
21
+ endCol?: number;
22
+ }
@@ -0,0 +1,67 @@
1
+ import { ITtscGraphDecorator } from "./ITtscGraphDecorator";
2
+ import { ITtscGraphNext } from "./ITtscGraphNext";
3
+ /** Targeted symbol lookup when a concrete name or handle is being resolved. */
4
+ export interface ITtscGraphLookup {
5
+ /** Discriminator for targeted symbol lookup. */
6
+ type: "lookup";
7
+ /** Ranked symbol matches for the query. */
8
+ hits: ITtscGraphLookup.IHit[];
9
+ /** How to use this source-free result next. */
10
+ next: ITtscGraphNext;
11
+ /** Human-readable compatibility note mirroring `next`. */
12
+ guide: string;
13
+ }
14
+ export declare namespace ITtscGraphLookup {
15
+ /** Find a concrete class, method, function, property, type, or dotted handle. */
16
+ interface IRequest {
17
+ /** Discriminator for targeted symbol lookup. */
18
+ type: "lookup";
19
+ /**
20
+ * What to find, in natural language and code vocabulary mixed freely: a
21
+ * symbol name, a dotted member (`Service.create`), or a short phrase
22
+ * (`request handler`). Exact names are not required, but this is not a
23
+ * second broad entrypoints call. Use it when a named handle is missing or
24
+ * ambiguous.
25
+ */
26
+ query: string;
27
+ /**
28
+ * Maximum hits to return.
29
+ *
30
+ * Prefer the default. Large hit lists usually mean the query is too broad;
31
+ * refine the name instead of raising this.
32
+ *
33
+ * @default 5
34
+ */
35
+ limit?: number;
36
+ /**
37
+ * Include dependency-boundary declarations from node_modules or bundled
38
+ * `.d.ts` libraries. Leave false for project-source answers; enable only
39
+ * when external type/API boundaries are the question.
40
+ *
41
+ * @default false
42
+ */
43
+ includeExternal?: boolean;
44
+ }
45
+ /** One ranked hit with a handle to follow via `details` or `trace`. */
46
+ interface IHit {
47
+ /** Stable node id for subsequent graph calls. */
48
+ id: string;
49
+ /** Qualified symbol name when available, otherwise the simple name. */
50
+ name: string;
51
+ /** Declaration kind (`class`, `method`, `function`, ...). */
52
+ kind: string;
53
+ /** Project-relative path of the declaration file. */
54
+ file: string;
55
+ /** 1-based declaration line, when known. */
56
+ line?: number;
57
+ /**
58
+ * The hit's declaration signature, so you can often answer without
59
+ * requesting details.
60
+ */
61
+ signature?: string;
62
+ /** Decorators written on this declaration, when any. */
63
+ decorators?: ITtscGraphDecorator[];
64
+ /** Relative relevance; higher is a better match. */
65
+ score: number;
66
+ }
67
+ }
@@ -0,0 +1,15 @@
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
+ /** Smallest graph request type to use when `action` is `inspect`. */
12
+ request?: "entrypoints" | "lookup" | "trace" | "details" | "overview" | "tour";
13
+ /** Why the returned graph evidence supports that action. */
14
+ reason: string;
15
+ }
@@ -0,0 +1,58 @@
1
+ import { ITtscGraphDecorator } from "./ITtscGraphDecorator";
2
+ import { ITtscGraphEvidence } from "./ITtscGraphEvidence";
3
+ import { TtscGraphNodeKind } from "./TtscGraphNodeKind";
4
+ import { TtscGraphNodeModifier } from "./TtscGraphNodeModifier";
5
+ /**
6
+ * One node in the graph: a declared symbol or a structural container (file,
7
+ * package).
8
+ *
9
+ * The `id` is position-invariant: `path#qualifiedName:kind` (e.g.
10
+ * `src/order.ts#OrderService.create:method`), so inserting a line above a
11
+ * declaration does not re-key it. Line and span live in `evidence` and are
12
+ * never part of identity.
13
+ */
14
+ export interface ITtscGraphNode {
15
+ /** Position-invariant identity (see the interface doc for the id grammar). */
16
+ id: string;
17
+ /** What this node represents. */
18
+ kind: TtscGraphNodeKind;
19
+ /** The simple, unqualified declared name (`create`, `OrderService`, `App`). */
20
+ name: string;
21
+ /**
22
+ * The owner-qualified name, when the node lives inside another declaration:
23
+ * `OrderService.create`, `Shopping.ISale`. Absent for a top-level
24
+ * declaration.
25
+ */
26
+ qualifiedName?: string;
27
+ /** Project-relative path of the file that declares this node. */
28
+ file: string;
29
+ /**
30
+ * True when the declaration lives outside the workspace (a dependency). The
31
+ * graph keeps the leaf as a named endpoint but does not walk into its
32
+ * internals.
33
+ */
34
+ external: boolean;
35
+ /**
36
+ * True when `file` is git-ignored generated code (a Prisma client, a codegen
37
+ * output). Projections desurface these so generated nodes do not bury the
38
+ * authored graph.
39
+ */
40
+ ignored?: boolean;
41
+ /** True when the symbol is part of its module's export surface. */
42
+ exported?: boolean;
43
+ /** Declaration modifiers, when the declaration pass recorded any. */
44
+ modifiers?: TtscGraphNodeModifier[];
45
+ /**
46
+ * The decorators written on this declaration, in source order, when it has
47
+ * any: raw decorator facts (`@Controller`, `@Get`) a consumer can interpret
48
+ * without re-parsing source.
49
+ */
50
+ decorators?: ITtscGraphDecorator[];
51
+ /** The declaration span, for display and signatures. */
52
+ evidence?: ITtscGraphEvidence;
53
+ /**
54
+ * The implementation span when a callable/property member is implemented by a
55
+ * function assignment separate from its declaration.
56
+ */
57
+ implementation?: ITtscGraphEvidence;
58
+ }
@@ -0,0 +1,85 @@
1
+ import { ITtscGraphNext } from "./ITtscGraphNext";
2
+ /** A compact, source-read-free project map for broad orientation only. */
3
+ export interface ITtscGraphOverview {
4
+ /** Discriminator for source-free project overview. */
5
+ type: "overview";
6
+ /** Absolute project root. */
7
+ project: string;
8
+ /** Size of the graph. */
9
+ counts: ITtscGraphOverview.ICounts;
10
+ /** How to use this source-free result next. */
11
+ next: ITtscGraphNext;
12
+ /** Human-readable compatibility note mirroring `next`. */
13
+ guide: string;
14
+ /** Folder layering, largest first. */
15
+ layers?: ITtscGraphOverview.ILayer[];
16
+ /** Highest-dependency symbols, busiest first. */
17
+ hotspots?: ITtscGraphOverview.IHotspot[];
18
+ /** Exported API symbols, most-depended-on first. */
19
+ publicApi?: ITtscGraphOverview.IPublicApi[];
20
+ }
21
+ export declare namespace ITtscGraphOverview {
22
+ /** Which broad architecture facets `overview` should return. */
23
+ interface IRequest {
24
+ /** Discriminator for source-free project overview. */
25
+ type: "overview";
26
+ /**
27
+ * The facet to project, or `all` for every facet. `layers` is the folder
28
+ * layering, `hotspots` the highest-dependency symbols, `publicApi` the
29
+ * exported API symbols ranked by how depended-on they are.
30
+ *
31
+ * Use this only for broad public API or layer orientation. For behavior,
32
+ * lifecycle, request-flow, rendering-flow, validation-flow, caller, or
33
+ * dependency questions, use `entrypoints` then `trace` instead.
34
+ *
35
+ * @default "all"
36
+ */
37
+ aspect?: "all" | "layers" | "hotspots" | "publicApi";
38
+ }
39
+ /** Size of the graph by node/edge totals and per-kind node counts. */
40
+ interface ICounts {
41
+ /** Number of source file container nodes. */
42
+ files: number;
43
+ /** Total node count, including declarations and file containers. */
44
+ nodes: number;
45
+ /** Total edge count, including structural edges. */
46
+ edges: number;
47
+ /** Node count per kind. */
48
+ byKind: Record<string, number>;
49
+ }
50
+ /** One folder layer: its source files and export surface. */
51
+ interface ILayer {
52
+ /** Directory, project-relative. */
53
+ dir: string;
54
+ /** Distinct source files under it. */
55
+ files: number;
56
+ /** Exported symbols declared under it. */
57
+ exported: number;
58
+ }
59
+ /** A compact symbol coordinate that can be passed to deeper graph tools. */
60
+ interface INode {
61
+ /** Stable handle for `details` or `trace`. */
62
+ id: string;
63
+ /** The symbol's qualified name when available. */
64
+ name: string;
65
+ /** Its declaration kind (`class`, `interface`, `function`, ...). */
66
+ kind: string;
67
+ /** Project-relative path of the file that declares it. */
68
+ file: string;
69
+ /** 1-based declaration line, when known. */
70
+ line?: number;
71
+ }
72
+ /** A high-dependency symbol with its non-structural fan-in and fan-out. */
73
+ interface IHotspot extends INode {
74
+ /** Non-structural edges pointing at this symbol. */
75
+ fanIn: number;
76
+ /** Non-structural edges leaving this symbol. */
77
+ fanOut: number;
78
+ }
79
+ /**
80
+ * One symbol on the project's exported public API surface. The list is ranked
81
+ * by how depended-on the symbol is, with test, typings, and generated files
82
+ * excluded.
83
+ */
84
+ type IPublicApi = INode;
85
+ }