@ttsc/graph 0.16.10 → 0.16.11

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 (40) 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/model/TtscGraphMemory.d.ts +41 -0
  5. package/lib/model/loadGraph.d.ts +23 -0
  6. package/lib/reduce.d.ts +46 -0
  7. package/lib/resolveGraphBinary.d.ts +18 -0
  8. package/lib/server/accessAliases.d.ts +8 -0
  9. package/lib/server/createServer.d.ts +15 -0
  10. package/lib/server/pathPolicy.d.ts +9 -0
  11. package/lib/server/resolveHandle.d.ts +8 -0
  12. package/lib/server/resultGuide.d.ts +3 -0
  13. package/lib/server/runDetails.d.ts +24 -0
  14. package/lib/server/runEntrypoints.d.ts +9 -0
  15. package/lib/server/runLookup.d.ts +10 -0
  16. package/lib/server/runOverview.d.ts +10 -0
  17. package/lib/server/runTour.d.ts +8 -0
  18. package/lib/server/runTrace.d.ts +10 -0
  19. package/lib/server/startServer.d.ts +11 -0
  20. package/lib/structures/ITtscGraphApplication.d.ts +161 -0
  21. package/lib/structures/ITtscGraphDecorator.d.ts +30 -0
  22. package/lib/structures/ITtscGraphDetails.d.ts +157 -0
  23. package/lib/structures/ITtscGraphDiagnostic.d.ts +27 -0
  24. package/lib/structures/ITtscGraphDump.d.ts +30 -0
  25. package/lib/structures/ITtscGraphEdge.d.ts +20 -0
  26. package/lib/structures/ITtscGraphEntrypoints.d.ts +117 -0
  27. package/lib/structures/ITtscGraphEscape.d.ts +40 -0
  28. package/lib/structures/ITtscGraphEvidence.d.ts +22 -0
  29. package/lib/structures/ITtscGraphLookup.d.ts +67 -0
  30. package/lib/structures/ITtscGraphNext.d.ts +15 -0
  31. package/lib/structures/ITtscGraphNode.d.ts +58 -0
  32. package/lib/structures/ITtscGraphOverview.d.ts +85 -0
  33. package/lib/structures/ITtscGraphTour.d.ts +113 -0
  34. package/lib/structures/ITtscGraphTrace.d.ts +143 -0
  35. package/lib/structures/TtscGraphEdgeKind.d.ts +10 -0
  36. package/lib/structures/TtscGraphNodeKind.d.ts +12 -0
  37. package/lib/structures/TtscGraphNodeModifier.d.ts +7 -0
  38. package/lib/structures/index.d.ts +18 -0
  39. package/lib/view.d.ts +7 -0
  40. package/package.json +2 -2
@@ -0,0 +1,113 @@
1
+ import { ITtscGraphDecorator } from "./ITtscGraphDecorator";
2
+ import { ITtscGraphNext } from "./ITtscGraphNext";
3
+ /** Answer-ready, source-free tour evidence for broad code-flow questions. */
4
+ export interface ITtscGraphTour {
5
+ /** Discriminator for code-tour indexing. */
6
+ type: "tour";
7
+ /** Natural code question this tour was built for. */
8
+ query: string;
9
+ /** Central entrypoints selected for the tour. */
10
+ entrypoints: ITtscGraphTour.INode[];
11
+ /** Selected primary runtime flows; sufficient for an index-level tour. */
12
+ primaryFlow: ITtscGraphTour.IFlow[];
13
+ /** Nearby dependency anchors around the selected entrypoints. */
14
+ nearby: ITtscGraphTour.IAnchor[];
15
+ /** Test or usage anchors reached through graph impact edges. */
16
+ tests: ITtscGraphTour.IAnchor[];
17
+ /** Ordered file/line anchors to cite in the final answer, not file reads. */
18
+ answerAnchors: ITtscGraphTour.IAnchor[];
19
+ /** How to use this source-free result next. */
20
+ next: ITtscGraphNext;
21
+ /** Human-readable compatibility note mirroring `next`. */
22
+ guide: string;
23
+ /** True when any internal slice hit its cap. */
24
+ truncated?: boolean;
25
+ }
26
+ export declare namespace ITtscGraphTour {
27
+ /**
28
+ * Build the complete index-level answer surface for broad code tours: central
29
+ * entrypoints, primary flow, nearby paths, tests, and answer anchors. Use
30
+ * this instead of decomposing repository-orientation, read-next,
31
+ * architecture, or multi-phase runtime-flow questions into many
32
+ * lookup/details/trace calls.
33
+ */
34
+ interface IRequest {
35
+ /** Discriminator for code-tour indexing. */
36
+ type: "tour";
37
+ /** The user's natural code-tour question. */
38
+ query: string;
39
+ /**
40
+ * Maximum central entrypoints to seed the tour.
41
+ *
42
+ * Prefer the default. Raise only when the question names several distinct
43
+ * public paths that must all appear in one answer.
44
+ *
45
+ * @default 4
46
+ */
47
+ limit?: number;
48
+ /**
49
+ * Include graph-reached test or usage anchors when available.
50
+ *
51
+ * @default true
52
+ */
53
+ includeTests?: boolean;
54
+ }
55
+ /** A compact symbol coordinate for a tour. */
56
+ interface INode {
57
+ /** Stable node id for later graph calls. */
58
+ id: string;
59
+ /** Qualified symbol name when available, otherwise the simple name. */
60
+ name: string;
61
+ /** Declaration kind (`class`, `method`, `function`, ...). */
62
+ kind: string;
63
+ /** Project-relative declaration file. */
64
+ file: string;
65
+ /** 1-based declaration line, when known. */
66
+ line?: number;
67
+ /** Declaration or implementation range, when known. */
68
+ sourceSpan?: ITtscGraphTour.ISpan;
69
+ /** Declaration head, when available. */
70
+ signature?: string;
71
+ /** Decorators written on the declaration, when any. */
72
+ decorators?: ITtscGraphDecorator[];
73
+ }
74
+ /** A primary flow slice from one selected entrypoint. */
75
+ interface IFlow {
76
+ /** Flow start node. */
77
+ start: ITtscGraphTour.INode;
78
+ /** Compact edge summaries in graph order. */
79
+ steps: string[];
80
+ /** Nodes reached by this flow. */
81
+ reached: ITtscGraphTour.INode[];
82
+ /** Edge and node anchors that explain the flow. */
83
+ anchors: ITtscGraphTour.IAnchor[];
84
+ /** True when the flow hit graph caps. */
85
+ truncated?: boolean;
86
+ }
87
+ /** A file/line citation chosen by the graph, not source body text. */
88
+ interface IAnchor {
89
+ /** Why this anchor matters in the tour. */
90
+ reason: string;
91
+ /** Stable node id when the anchor belongs to a node. */
92
+ id?: string;
93
+ /** Symbol, edge, or test name to show in the answer. */
94
+ name: string;
95
+ /** Declaration kind, when this anchor belongs to a node. */
96
+ kind?: string;
97
+ /** Project-relative file. */
98
+ file: string;
99
+ /** 1-based start line. */
100
+ startLine: number;
101
+ /** 1-based end line, when known. */
102
+ endLine?: number;
103
+ }
104
+ /** Source coordinates without source text. */
105
+ interface ISpan {
106
+ /** Project-relative file. */
107
+ file: string;
108
+ /** 1-based start line. */
109
+ startLine: number;
110
+ /** 1-based end line, when known. */
111
+ endLine?: number;
112
+ }
113
+ }
@@ -0,0 +1,143 @@
1
+ import { ITtscGraphEvidence } from "./ITtscGraphEvidence";
2
+ import { ITtscGraphNext } from "./ITtscGraphNext";
3
+ /** The compact dependency or caller flow returned from a selected start symbol. */
4
+ export interface ITtscGraphTrace {
5
+ /** Discriminator for dependency tracing. */
6
+ type: "trace";
7
+ /** The resolved start node, or undefined when `from` matched nothing. */
8
+ start?: ITtscGraphTrace.INode;
9
+ /** Trace direction actually used by this result. */
10
+ direction: string;
11
+ /** Edges traversed, in breadth-first order. */
12
+ hops: ITtscGraphTrace.IHop[];
13
+ /** Unique nodes reached (excluding the start), each with its depth and roles. */
14
+ reached: ITtscGraphTrace.INode[];
15
+ /** True when the trace hit maxNodes or maxDepth and more flow exists. */
16
+ truncated: boolean;
17
+ /** The resolved `to` target, when a path was requested. */
18
+ target?: ITtscGraphTrace.INode;
19
+ /**
20
+ * When `to` was given: the ordered dependency path from `from` to `to`
21
+ * (`from` first, `to` last), or empty when `to` is not reachable from
22
+ * `from`.
23
+ */
24
+ path?: ITtscGraphTrace.INode[];
25
+ /** Compact hop summaries preserving node names and edge evidence, capped. */
26
+ steps?: string[];
27
+ /** How to use this source-free result next. */
28
+ next: ITtscGraphNext;
29
+ /** Human-readable compatibility note mirroring `next`. */
30
+ guide: string;
31
+ /** When `from` was an ambiguous name, the matches to disambiguate with. */
32
+ candidates?: ITtscGraphTrace.INode[];
33
+ }
34
+ export declare namespace ITtscGraphTrace {
35
+ /** Where and how far to trace dependency flow. */
36
+ interface IRequest {
37
+ /** Discriminator for dependency tracing. */
38
+ type: "trace";
39
+ /**
40
+ * Where to start: a node id from another tool, a simple symbol name, or a
41
+ * dotted member name such as `OrderService.create`. An ambiguous name
42
+ * returns its candidates instead of a trace.
43
+ */
44
+ from: string;
45
+ /**
46
+ * A target symbol: node id, simple symbol name, or dotted member name. When
47
+ * given, the tool returns the dependency path from `from` to this target,
48
+ * the one-call answer for "how does A reach B", instead of an open-ended
49
+ * trace. Prefer this path mode whenever both ends are known.
50
+ */
51
+ to?: string;
52
+ /**
53
+ * `forward` follows what the start uses (callees, instantiations, renders);
54
+ * `reverse` follows what uses the start (callers); `impact` is a reverse
55
+ * trace that prioritizes public API and test nodes a change would reach.
56
+ * Its test nodes are semantic usage edges, not a text-search inventory.
57
+ * Caller questions usually fit `reverse`.
58
+ *
59
+ * @default "forward"
60
+ */
61
+ direction?: "forward" | "reverse" | "impact";
62
+ /**
63
+ * Which non-structural edge family to follow: `execution` follows runtime
64
+ * calls, instantiations, property access, and JSX renders; `types` follows
65
+ * type references and inheritance; `all` preserves the full graph. Flow
66
+ * questions should usually choose `execution` rather than `all`.
67
+ *
68
+ * @default "all"
69
+ */
70
+ focus?: "all" | "execution" | "types";
71
+ /**
72
+ * How many hops deep to follow. Open forward/reverse traces are capped at
73
+ * 2; impact traces at 4; path mode at 12.
74
+ *
75
+ * Prefer the default for open traces. Raise only for path mode or when the
76
+ * previous trace named the missing next hop.
77
+ *
78
+ * @default 2
79
+ */
80
+ maxDepth?: number;
81
+ /**
82
+ * Cap on reached nodes; the trace stops and marks itself truncated past it.
83
+ * Open forward/reverse traces are capped at 8 nodes, impact at 16 nodes.
84
+ *
85
+ * Prefer the default; use larger open traces only when a named missing edge
86
+ * requires it.
87
+ *
88
+ * @default 6
89
+ */
90
+ maxNodes?: number;
91
+ /**
92
+ * Include dependency-boundary nodes from node_modules or bundled `.d.ts`
93
+ * libraries. Leave false for source-flow tours; enable only when the user
94
+ * asks about external type/API boundaries.
95
+ *
96
+ * @default false
97
+ */
98
+ includeExternal?: boolean;
99
+ }
100
+ /** One traversed edge, with its depth from the start. */
101
+ interface IHop {
102
+ /** Source node id for this traversed edge. */
103
+ from: string;
104
+ /** Target node id for this traversed edge. */
105
+ to: string;
106
+ /** Edge kind (`calls`, `type_ref`, `accesses`, ...). */
107
+ kind: string;
108
+ /** Hops from the start (1 = direct). */
109
+ depth: number;
110
+ /**
111
+ * Source span for the expression that produced this hop. It is repository
112
+ * evidence for the hop and can be cited without opening the file.
113
+ */
114
+ evidence?: ITtscGraphEvidence;
115
+ /**
116
+ * Stable access-path aliases derived from edge evidence. These preserve a
117
+ * resolved member's owner and the concrete property path used at the call
118
+ * site.
119
+ */
120
+ aliases?: string[];
121
+ }
122
+ /** A node on the trace: the start, a reached node, or a candidate. */
123
+ interface INode {
124
+ /** Stable node id for subsequent graph calls. */
125
+ id: string;
126
+ /** Qualified symbol name when available, otherwise the simple name. */
127
+ name: string;
128
+ /** Declaration kind (`class`, `method`, `function`, ...). */
129
+ kind: string;
130
+ /** Project-relative path of the declaration file. */
131
+ file: string;
132
+ /** 1-based declaration line, when known. */
133
+ line?: number;
134
+ /** Declaration or implementation citation range, when known. */
135
+ sourceSpan?: Pick<ITtscGraphEvidence, "file" | "startLine" | "endLine">;
136
+ /** Hops from the start, on a reached node. */
137
+ depth?: number;
138
+ /** The node's signature, carried on path nodes so the path explains itself. */
139
+ signature?: string;
140
+ /** Why this node matters to an impact trace: `exported`, `test`. */
141
+ roles?: string[];
142
+ }
143
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The relationship a directed edge encodes between two {@link ITtscGraphNode}s.
3
+ *
4
+ * Structural edges (`contains`, `exports`, `imports`) come from the declaration
5
+ * pass. Value and type edges (`calls`, `accesses`, `instantiates`, `type_ref`,
6
+ * `extends`, `implements`, `overrides`, `renders`) are resolved by the checker
7
+ * — `renders` is a JSX component use. `decorates` carries a decorator fact and
8
+ * `tests` a test-to-subject relationship.
9
+ */
10
+ export type TtscGraphEdgeKind = "contains" | "exports" | "imports" | "calls" | "accesses" | "instantiates" | "type_ref" | "extends" | "implements" | "overrides" | "decorates" | "renders" | "tests";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * What a graph node represents.
3
+ *
4
+ * The symbol kinds (`file` through `parameter`) are declarations the TypeScript
5
+ * program owns and the checker resolves. `external_symbol` is a
6
+ * dependency-boundary leaf the workspace references but does not declare. The
7
+ * graph keeps it as a named endpoint without walking into the dependency's
8
+ * internals.
9
+ *
10
+ * Used as the `kind` discriminant on {@link ITtscGraphNode}.
11
+ */
12
+ export type TtscGraphNodeKind = "file" | "package" | "namespace" | "module" | "function" | "class" | "interface" | "type" | "enum" | "variable" | "method" | "property" | "parameter" | "external_symbol";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * A declaration modifier carried on a symbol {@link ITtscGraphNode}, when the
3
+ * declaration pass records it. Used by projections that reason about visibility
4
+ * and shape — e.g. a public-API overview filters on `export`, a class outline
5
+ * separates `static` members.
6
+ */
7
+ export type TtscGraphNodeModifier = "export" | "default" | "declare" | "abstract" | "static" | "readonly" | "async" | "const" | "public" | "private" | "protected" | "optional";
@@ -0,0 +1,18 @@
1
+ export * from "./ITtscGraphApplication";
2
+ export * from "./ITtscGraphDecorator";
3
+ export * from "./ITtscGraphDiagnostic";
4
+ export * from "./ITtscGraphDump";
5
+ export * from "./ITtscGraphEdge";
6
+ export * from "./ITtscGraphEvidence";
7
+ export * from "./ITtscGraphEscape";
8
+ export * from "./ITtscGraphDetails";
9
+ export * from "./ITtscGraphEntrypoints";
10
+ export * from "./ITtscGraphNode";
11
+ export * from "./ITtscGraphOverview";
12
+ export * from "./ITtscGraphLookup";
13
+ export * from "./ITtscGraphNext";
14
+ export * from "./ITtscGraphTrace";
15
+ export * from "./ITtscGraphTour";
16
+ export * from "./TtscGraphEdgeKind";
17
+ export * from "./TtscGraphNodeKind";
18
+ export * from "./TtscGraphNodeModifier";
package/lib/view.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * `ttsc-graph view`: build the project's code graph, reduce it, and serve a
3
+ * self-contained 3D viewer on a localhost port, opening the browser. The native
4
+ * binary produces the graph (the same `dump` the docs document); everything
5
+ * else is local and offline. The process stays alive serving until Ctrl+C.
6
+ */
7
+ export declare function runView(argv: readonly string[]): number | void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttsc/graph",
3
- "version": "0.16.10",
3
+ "version": "0.16.11",
4
4
  "description": "Checker-resolved architecture graph over MCP for coding agents, backed by ttsc's in-process TypeScript-Go compiler.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -39,7 +39,7 @@
39
39
  "three": "^0.184.0",
40
40
  "three-forcegraph": "^1.43.4",
41
41
  "typescript": "7.0.1-rc",
42
- "ttsc": "0.16.10"
42
+ "ttsc": "0.16.11"
43
43
  },
44
44
  "repository": {
45
45
  "type": "git",