@ttsc/graph 0.16.7 → 0.16.8

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.
@@ -1 +1 @@
1
- {"version":3,"file":"createServer.js","sourceRoot":"","sources":["../../src/server/createServer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oEAAoE;AACpE,iEAG4C;AAC5C,kDAA0B;AAE1B,kEAAgF;AAGhF,iDAA8C;AAE9C;;;;;;;;;;;;;GAaG;AACH,sBACE,KAAsB,EACtB,OAAe;IAEf,MAAM,UAAU;;gBACd,OAAO;mBACP,IAAI,2CAAoB,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,SAAS,CAAC,MAAM,CAAC;qBAChE;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,SAAS,EAAE,CAAC;YACnB,OAAO,KAAK,CACV,SAAS,YAAY,KAAK;gBACxB,CAAC,CAAC,GAAG,SAAS,CAAC,IAAI,KAAK,SAAS,CAAC,OAAO,EAAE;gBAC3C,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CACtB,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,KAAK,CAAC,IAAY;IAIzB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;AAC9D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttsc/graph",
3
- "version": "0.16.7",
3
+ "version": "0.16.8",
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",
@@ -14,14 +14,9 @@
14
14
  },
15
15
  "./package.json": "./package.json"
16
16
  },
17
- "ttsc": {
18
- "plugin": {
19
- "transform": "typia/lib/transform"
20
- }
21
- },
22
17
  "dependencies": {
23
18
  "@modelcontextprotocol/sdk": "^1.26.0",
24
- "typia": "13.0.0-dev.20260605.1"
19
+ "typia": "13.0.0-dev.20260701.1"
25
20
  },
26
21
  "keywords": [
27
22
  "ttsc",
@@ -43,7 +38,7 @@
43
38
  "three": "^0.184.0",
44
39
  "three-forcegraph": "^1.43.4",
45
40
  "typescript": "7.0.1-rc",
46
- "ttsc": "0.16.7"
41
+ "ttsc": "0.16.8"
47
42
  },
48
43
  "repository": {
49
44
  "type": "git",
package/src/reduce.ts CHANGED
@@ -55,6 +55,11 @@ function posix(p: string): string {
55
55
  return p.replace(/\\/g, "/");
56
56
  }
57
57
 
58
+ /** An absolute path (POSIX or Windows drive); relative dumps skip rerooting. */
59
+ function isAbsolute(p: string): boolean {
60
+ return /^(?:[A-Za-z]:)?\//.test(posix(p));
61
+ }
62
+
58
63
  function commonRoot(files: string[]): string {
59
64
  if (files.length === 0) return "";
60
65
  let parts = posix(files[0]!).split("/");
@@ -68,10 +73,13 @@ function commonRoot(files: string[]): string {
68
73
  return parts.join("/");
69
74
  }
70
75
 
76
+ // An empty root means the dump's paths are already project-relative (the
77
+ // current `ttscgraph dump` contract); they pass through structure-intact.
71
78
  function relativize(abs: string, root: string): string {
72
79
  const a = posix(abs);
73
80
  const r = posix(root).replace(/\/+$/, "");
74
- if (r && (a === r || a.startsWith(r + "/")))
81
+ if (!r) return a;
82
+ if (a === r || a.startsWith(r + "/"))
75
83
  return a.slice(r.length).replace(/^\/+/, "");
76
84
  const nm = a.lastIndexOf("node_modules/");
77
85
  if (nm >= 0) return a.slice(nm);
@@ -97,6 +105,26 @@ function degreeOf(
97
105
  return degree;
98
106
  }
99
107
 
108
+ /**
109
+ * Collapse the fine-grained wire kinds `ttscgraph dump` emits (calls,
110
+ * instantiates, renders, accesses, type_ref, extends, implements) into the
111
+ * three display families the viewer colors and its legend name. An unknown kind
112
+ * passes through and renders with the fallback color.
113
+ */
114
+ const DISPLAY_KIND: Record<string, string> = {
115
+ calls: "value-call",
116
+ instantiates: "value-call",
117
+ renders: "value-call",
118
+ accesses: "value-call",
119
+ type_ref: "type-ref",
120
+ extends: "heritage",
121
+ implements: "heritage",
122
+ };
123
+
124
+ function displayKind(kind: string): string {
125
+ return DISPLAY_KIND[kind] ?? kind;
126
+ }
127
+
100
128
  export function reduce(
101
129
  raw: RawDump,
102
130
  {
@@ -105,9 +133,13 @@ export function reduce(
105
133
  }: { maxNodes?: number; keepExternal?: boolean } = {},
106
134
  ): ViewerPayload {
107
135
  const keptByExternal = raw.nodes.filter((n) => keepExternal || !n.external);
108
- const root = commonRoot(
109
- raw.nodes.filter((n) => !n.external).map((n) => n.file),
110
- );
136
+ // Reroot only absolute paths (the legacy dump contract); a current dump's
137
+ // paths are already project-relative and keep their structure as-is.
138
+ const projectFiles = raw.nodes.filter((n) => !n.external).map((n) => n.file);
139
+ const root =
140
+ projectFiles.length > 0 && isAbsolute(projectFiles[0]!)
141
+ ? commonRoot(projectFiles)
142
+ : "";
111
143
 
112
144
  const liveIds = new Set(keptByExternal.map((n) => n.id));
113
145
  const liveEdges = raw.edges.filter(
@@ -145,7 +177,7 @@ export function reduce(
145
177
  .map((e) => ({
146
178
  source: rewriteId(e.from, root),
147
179
  target: rewriteId(e.to, root),
148
- kind: e.kind,
180
+ kind: displayKind(e.kind),
149
181
  }))
150
182
  .filter((e) => nodeIds.has(e.source) && nodeIds.has(e.target));
151
183
 
@@ -8,7 +8,6 @@ import typia from "typia";
8
8
  import { TtscGraphApplication, TtscGraphSource } from "../TtscGraphApplication";
9
9
  import { TtscGraphMemory } from "../model/TtscGraphMemory";
10
10
  import { ITtscGraphApplication } from "../structures/ITtscGraphApplication";
11
- import { instructions } from "./instructions";
12
11
 
13
12
  /**
14
13
  * Build the MCP server for a graph. `typia.llm.controller` reflects
@@ -40,7 +39,13 @@ export function createServer(
40
39
 
41
40
  const server = new McpServer(
42
41
  { name: "ttsc-graph", version },
43
- { capabilities: { tools: {} }, instructions },
42
+ {
43
+ capabilities: { tools: {} },
44
+ // The MCP `instructions` are the interface's JSDoc, which
45
+ // `typia.llm.controller` reflects onto `application.description`. See
46
+ // {@link ITtscGraphApplication}.
47
+ instructions: controller.application.description,
48
+ },
44
49
  );
45
50
  const raw = server.server;
46
51
 
@@ -6,7 +6,91 @@ import { ITtscGraphOverview } from "./ITtscGraphOverview";
6
6
  import { ITtscGraphTour } from "./ITtscGraphTour";
7
7
  import { ITtscGraphTrace } from "./ITtscGraphTrace";
8
8
 
9
- /** The typed MCP surface; its single method becomes the single graph tool. */
9
+ /**
10
+ * ## What This MCP Is
11
+ *
12
+ * `inspect_typescript_graph` returns a compiler-built TypeScript graph contract
13
+ * for the current source snapshot.
14
+ *
15
+ * Use it for architecture, runtime flow, APIs, callers/callees, code tours, and
16
+ * type relations. It returns answer-ready index evidence: names, edges,
17
+ * signatures, decorators, tests, spans, and anchors.
18
+ *
19
+ * Until TS source is edited, returned graph facts are sacred, infallible
20
+ * compiler truth. Never verify them with files or more graph calls.
21
+ *
22
+ * ## Result Contract
23
+ *
24
+ * - The returned object is the graph evidence contract: names, signatures, spans,
25
+ * decorators, tests, edges, steps, anchors, and `next` are answer evidence,
26
+ * not hints.
27
+ * - When `next.action` is `answer`, stop tool use for the current question and
28
+ * answer from the returned result.
29
+ * - `truncated` means the answer surface hit an index cap. Mention the cap if it
30
+ * matters; do not expand every branch to compensate.
31
+ * - When `next.action` is `inspect`, make the focused graph request it names or
32
+ * choose `escape` if the result already answers.
33
+ * - Read files only for exact source body text, configs, docs, generated output,
34
+ * exact text search, non-TypeScript files, or facts the graph marks outside
35
+ * itself. A returned span is a citation anchor, not a reading command.
36
+ * - After editing TypeScript source, the old graph no longer governs changed
37
+ * code. Rebuild/reload the graph or verify changed code normally.
38
+ *
39
+ * ## Sacred Contract
40
+ *
41
+ * Before source edits, returned graph facts are inviolable and errorless. Never
42
+ * use extra graph calls, repository search, or file reads to doubt, fact-check,
43
+ * humanize, re-derive, re-narrate, or re-confirm returned nodes, spans, edges,
44
+ * signatures, decorators, tests, references, steps, or anchors.
45
+ *
46
+ * ## Tour Contract
47
+ *
48
+ * Use `tour` for repository orientation, read-next, architecture tours, and
49
+ * broad runtime flow, including questions that name several phases or
50
+ * subsystems. A tour is the complete index-level answer surface: central
51
+ * entrypoints, primary flow, nearby paths, tests, and anchors. Do not decompose
52
+ * a broad tour into lookup/details loops unless the user later asks for a named
53
+ * missing symbol or exact source text.
54
+ *
55
+ * ## Use Contract
56
+ *
57
+ * 1. Ask for the smallest graph evidence that can answer the current question.
58
+ * 2. Broad flow, repository-orientation, code-tour, or read-next question: start
59
+ * with `tour`.
60
+ * 3. Concrete named symbol: use `lookup`, then `details` only if needed.
61
+ * 4. Known endpoint pair or one selected handle: use one `trace`.
62
+ * 5. Unknown narrow orientation: use `entrypoints` once.
63
+ * 6. Selected symbol shape: use `details` for one to three handles.
64
+ * 7. Follow the returned `next`: answer, inspect once more, leave graph, or
65
+ * clarify.
66
+ * 8. Use `escape` when another graph call would repeat evidence or the remaining
67
+ * evidence is outside the TypeScript graph.
68
+ *
69
+ * Most TypeScript structure answers need one or two graph calls.
70
+ *
71
+ * ## Request Fields
72
+ *
73
+ * Fill the visible checklist, then exactly one request.
74
+ *
75
+ * - `question`: restate the code question being considered.
76
+ * - `draft`: initial request type and why it seems smallest.
77
+ * - `review`: correct a wrong, broad, stale, or duplicate draft. If graph facts
78
+ * already answer, if prior `next.action` was `answer`, or if the next
79
+ * evidence is outside the indexed TypeScript graph, say so here and make
80
+ * `request.type` be `escape`. If a broad flow draft is not `tour`, correct it
81
+ * here.
82
+ * - `request`: final request after review.
83
+ *
84
+ * ## How to answer from graph evidence
85
+ *
86
+ * - Use returned node names, signatures, edges, references, evidence, and
87
+ * `sourceSpan` ranges directly.
88
+ * - Explain the central path first, then mention important branches.
89
+ * - For tests, impact, or reading lists, returned nodes and ranges are the answer
90
+ * evidence, not search keywords.
91
+ * - A returned range is a sacred citation anchor, not permission to open the
92
+ * file.
93
+ */
10
94
  export interface ITtscGraphApplication {
11
95
  /**
12
96
  * Inspect the TypeScript compiler graph contract.
@@ -44,12 +128,12 @@ export namespace ITtscGraphApplication {
44
128
  /**
45
129
  * Initial request plan before final arguments are filled.
46
130
  *
47
- * Name the intended request type and why it seems smallest. Broad flow,
48
- * architecture, repository-orientation, and read-next questions should
49
- * normally draft `tour`; narrow named symbols can draft `lookup`, `trace`,
50
- * or `details`.
131
+ * Name the intended request type in `type` and why it seems smallest in
132
+ * `reason`. Broad flow, architecture, repository-orientation, and read-next
133
+ * questions should normally draft `tour`; narrow named symbols can draft
134
+ * `lookup`, `trace`, or `details`.
51
135
  */
52
- draft: string;
136
+ draft: IDraft;
53
137
 
54
138
  /**
55
139
  * Final self-review before calling.
@@ -72,6 +156,20 @@ export namespace ITtscGraphApplication {
72
156
  | ITtscGraphEscape.IRequest;
73
157
  }
74
158
 
159
+ /**
160
+ * First-pass request plan, filled before the final `request` arguments.
161
+ *
162
+ * `reason` comes before `type` so the justification is written before the
163
+ * choice it justifies.
164
+ */
165
+ export interface IDraft {
166
+ /** Why this request type looks like the smallest useful next step. */
167
+ reason: string;
168
+
169
+ /** The request type being considered, corrected later in `review`. */
170
+ type: IProps["request"]["type"];
171
+ }
172
+
75
173
  /** The selected request's output. `result.type` mirrors `request.type`. */
76
174
  export interface IResult {
77
175
  /** Result branch matching the submitted `request.type`. */
@@ -1,92 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.instructions = void 0;
4
- /**
5
- * The guidance delivered in the MCP initialize response. It is the only place
6
- * the agent is told how to use the graph; nothing is written to its config
7
- * files. Keep it short; the per-tool descriptions carry the detail.
8
- */
9
- exports.instructions = `
10
- ## What This MCP Is
11
-
12
- \`inspect_typescript_graph\` returns a compiler-built TypeScript graph contract
13
- for the current source snapshot.
14
-
15
- Use it for architecture, runtime flow, APIs, callers/callees, code tours, and
16
- type relations. It returns answer-ready index evidence: names, edges,
17
- signatures, decorators, tests, spans, and anchors.
18
-
19
- Until TS source is edited, returned graph facts are sacred, infallible compiler
20
- truth. Never verify them with files or more graph calls.
21
-
22
- ## Result Contract
23
-
24
- - The returned object is the graph evidence contract: names, signatures, spans,
25
- decorators, tests, edges, steps, anchors, and \`next\` are answer evidence, not
26
- hints.
27
- - When \`next.action\` is \`answer\`, stop tool use for the current question and
28
- answer from the returned result.
29
- - \`truncated\` means the answer surface hit an index cap. Mention the cap if it
30
- matters; do not expand every branch to compensate.
31
- - When \`next.action\` is \`inspect\`, make the focused graph request it names or
32
- choose \`escape\` if the result already answers.
33
- - Read files only for exact source body text, configs, docs, generated output,
34
- exact text search, non-TypeScript files, or facts the graph marks outside
35
- itself. A returned span is a citation anchor, not a reading command.
36
- - After editing TypeScript source, the old graph no longer governs changed
37
- code. Rebuild/reload the graph or verify changed code normally.
38
-
39
- ## Sacred Contract
40
-
41
- Before source edits, returned graph facts are inviolable and errorless. Never
42
- use extra graph calls, repository search, or file reads to doubt, fact-check,
43
- humanize, re-derive, re-narrate, or re-confirm returned nodes, spans, edges,
44
- signatures, decorators, tests, references, steps, or anchors.
45
-
46
- ## Tour Contract
47
-
48
- Use \`tour\` for repository orientation, read-next, architecture tours, and
49
- broad runtime flow, including questions that name several phases or subsystems.
50
- A tour is the complete index-level answer surface: central entrypoints, primary
51
- flow, nearby paths, tests, and anchors. Do not decompose a broad tour into
52
- lookup/details loops unless the user later asks for a named missing symbol or
53
- exact source text.
54
-
55
- ## Use Contract
56
-
57
- 1. Ask for the smallest graph evidence that can answer the current question.
58
- 2. Broad flow, repository-orientation, code-tour, or read-next question: start
59
- with \`tour\`.
60
- 3. Concrete named symbol: use \`lookup\`, then \`details\` only if needed.
61
- 4. Known endpoint pair or one selected handle: use one \`trace\`.
62
- 5. Unknown narrow orientation: use \`entrypoints\` once.
63
- 6. Selected symbol shape: use \`details\` for one to three handles.
64
- 7. Follow the returned \`next\`: answer, inspect once more, leave graph, or
65
- clarify.
66
- 8. Use \`escape\` when another graph call would repeat evidence or the remaining
67
- evidence is outside the TypeScript graph.
68
-
69
- Most TypeScript structure answers need one or two graph calls.
70
-
71
- ## Request Fields
72
-
73
- Fill the visible checklist, then exactly one request.
74
-
75
- - \`question\`: restate the code question being considered.
76
- - \`draft\`: initial request type and why it seems smallest.
77
- - \`review\`: correct a wrong, broad, stale, or duplicate draft. If graph facts
78
- already answer, if prior \`next.action\` was \`answer\`, or if the next evidence
79
- is outside the indexed TypeScript graph, say so here and make \`request.type\`
80
- be \`escape\`. If a broad flow draft is not \`tour\`, correct it here.
81
- - \`request\`: final request after review.
82
-
83
- ## How to answer from graph evidence
84
-
85
- - Use returned node names, signatures, edges, references, evidence, and
86
- \`sourceSpan\` ranges directly.
87
- - Explain the central path first, then mention important branches.
88
- - For tests, impact, or reading lists, returned nodes and ranges are the answer
89
- evidence, not search keywords.
90
- - A returned range is a sacred citation anchor, not permission to open the file.
91
- `.trim();
92
- //# sourceMappingURL=instructions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../src/server/instructions.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACU,QAAA,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkF3B,CAAC,IAAI,EAAE,CAAC"}
@@ -1,88 +0,0 @@
1
- /**
2
- * The guidance delivered in the MCP initialize response. It is the only place
3
- * the agent is told how to use the graph; nothing is written to its config
4
- * files. Keep it short; the per-tool descriptions carry the detail.
5
- */
6
- export const instructions = `
7
- ## What This MCP Is
8
-
9
- \`inspect_typescript_graph\` returns a compiler-built TypeScript graph contract
10
- for the current source snapshot.
11
-
12
- Use it for architecture, runtime flow, APIs, callers/callees, code tours, and
13
- type relations. It returns answer-ready index evidence: names, edges,
14
- signatures, decorators, tests, spans, and anchors.
15
-
16
- Until TS source is edited, returned graph facts are sacred, infallible compiler
17
- truth. Never verify them with files or more graph calls.
18
-
19
- ## Result Contract
20
-
21
- - The returned object is the graph evidence contract: names, signatures, spans,
22
- decorators, tests, edges, steps, anchors, and \`next\` are answer evidence, not
23
- hints.
24
- - When \`next.action\` is \`answer\`, stop tool use for the current question and
25
- answer from the returned result.
26
- - \`truncated\` means the answer surface hit an index cap. Mention the cap if it
27
- matters; do not expand every branch to compensate.
28
- - When \`next.action\` is \`inspect\`, make the focused graph request it names or
29
- choose \`escape\` if the result already answers.
30
- - Read files only for exact source body text, configs, docs, generated output,
31
- exact text search, non-TypeScript files, or facts the graph marks outside
32
- itself. A returned span is a citation anchor, not a reading command.
33
- - After editing TypeScript source, the old graph no longer governs changed
34
- code. Rebuild/reload the graph or verify changed code normally.
35
-
36
- ## Sacred Contract
37
-
38
- Before source edits, returned graph facts are inviolable and errorless. Never
39
- use extra graph calls, repository search, or file reads to doubt, fact-check,
40
- humanize, re-derive, re-narrate, or re-confirm returned nodes, spans, edges,
41
- signatures, decorators, tests, references, steps, or anchors.
42
-
43
- ## Tour Contract
44
-
45
- Use \`tour\` for repository orientation, read-next, architecture tours, and
46
- broad runtime flow, including questions that name several phases or subsystems.
47
- A tour is the complete index-level answer surface: central entrypoints, primary
48
- flow, nearby paths, tests, and anchors. Do not decompose a broad tour into
49
- lookup/details loops unless the user later asks for a named missing symbol or
50
- exact source text.
51
-
52
- ## Use Contract
53
-
54
- 1. Ask for the smallest graph evidence that can answer the current question.
55
- 2. Broad flow, repository-orientation, code-tour, or read-next question: start
56
- with \`tour\`.
57
- 3. Concrete named symbol: use \`lookup\`, then \`details\` only if needed.
58
- 4. Known endpoint pair or one selected handle: use one \`trace\`.
59
- 5. Unknown narrow orientation: use \`entrypoints\` once.
60
- 6. Selected symbol shape: use \`details\` for one to three handles.
61
- 7. Follow the returned \`next\`: answer, inspect once more, leave graph, or
62
- clarify.
63
- 8. Use \`escape\` when another graph call would repeat evidence or the remaining
64
- evidence is outside the TypeScript graph.
65
-
66
- Most TypeScript structure answers need one or two graph calls.
67
-
68
- ## Request Fields
69
-
70
- Fill the visible checklist, then exactly one request.
71
-
72
- - \`question\`: restate the code question being considered.
73
- - \`draft\`: initial request type and why it seems smallest.
74
- - \`review\`: correct a wrong, broad, stale, or duplicate draft. If graph facts
75
- already answer, if prior \`next.action\` was \`answer\`, or if the next evidence
76
- is outside the indexed TypeScript graph, say so here and make \`request.type\`
77
- be \`escape\`. If a broad flow draft is not \`tour\`, correct it here.
78
- - \`request\`: final request after review.
79
-
80
- ## How to answer from graph evidence
81
-
82
- - Use returned node names, signatures, edges, references, evidence, and
83
- \`sourceSpan\` ranges directly.
84
- - Explain the central path first, then mention important branches.
85
- - For tests, impact, or reading lists, returned nodes and ranges are the answer
86
- evidence, not search keywords.
87
- - A returned range is a sacred citation anchor, not permission to open the file.
88
- `.trim();