Turbocharge Claude Code, Cursor, Codex, Gemini & every coding agent: faster, cheaper, with contextual understanding specific to your codebase.
TypeScript ai-agentsanthropicclaude-codeclicode-graphcodexcontext-engineeringcursordeveloper-toolsgeminiknowledge-graphllmmcpmcp-serveropen-sourceopenaitree-sitter
feat(mcp,ask): graph tools + loud structural fallback
Shrish Dwivedi60a6e290f06b
diff --git a/src/ask/ask.ts b/src/ask/ask.tsindex f5df2a48..e8ea755e 100644--- a/src/ask/ask.ts+++ b/src/ask/ask.ts@@ -18,6 +18,7 @@ import { join, resolve } from "node:path";import matter from "gray-matter";import { contextDirFor } from "../context/node-file.js";import { loadGraphCached, loadAskIndexCached } from "../graph/load.js";+import { resolveSymbol } from "../graph/traverse.js";import type { EdgeV1, GraphV1, NodeV1, Relation } from "../graph/types.js";import { personalizedPageRank } from "./graphrank.js";import { counts, tokenize, type AskIndex, type AskIndexDoc } from "./index-file.js";@@ -181,34 +182,52 @@ const OUTGOING = /\b(callee|callees|what\s+does\s+\w+\s+call|calls\s+what|importconst INCOMING_RELS: Relation[] = ["calls", "references", "implements", "extends"];const OUTGOING_RELS: Relation[] = ["calls", "references", "imports", "implements", "extends"];-/** Pick the query word that names a real symbol (longest exact name match wins). */-function findSubject(query: string, graph: GraphV1): NodeV1[] {- const byName = new Map<string, NodeV1[]>();- for (const n of graph.nodes) {- if (n.kind === "file") continue;- const key = n.name.toLowerCase();- byName.set(key, [...(byName.get(key) ?? []), n]);- }- const words = query.split(/[^A-Za-z0-9_.]+/).filter(Boolean);- let best: NodeV1[] = [];- let bestLen = 0;+/** Split a prose query into word-like tokens, keeping dots so a qualified name+ * ("Cache.get") or package-qualified name ("pkg.Fn") survives as one token —+ * `resolveSymbol`'s own suffix/last-segment matching handles the rest. */+function subjectWords(query: string): string[] {+ return [...new Set(query.split(/[^A-Za-z0-9_.]+/).filter(Boolean))];+}++/** Resolve the query's structural subject via {@link resolveSymbol}, trying+ * each word longest-first — the intended subject of a structural query is+ * usually the most specific (longest) identifier-shaped word, never a short+ * verb like "calls" — until one resolves. `tried` is the word that was tried+ * last regardless of outcome, so a caller can name *something* in a fallthrough+ * note even when nothing resolved (e.g. `subjects.length === 0`). This is what+ * makes a qualified/dotted subject like `Cache.get` resolve, where the old+ * plain name-equality lookup (`findSubject`) never matched it. */+function findSubjectNodes(query: string, graph: GraphV1): { nodes: NodeV1[]; tried: string } {+ const words = subjectWords(query).sort((a, b) => b.length - a.length);for (const w of words) {- const hit = byName.get(w.toLowerCase());- if (hit && w.length > bestLen) {- best = hit;- bestLen = w.length;- }+ const nodes = resolveSymbol(graph, w);+ if (nodes.length > 0) return { nodes, tried: w };}- return best;+ return { nodes: [], tried: words[0] ?? query };}-function structural(query: string, graph: GraphV1, limit: number): AskResult | null {+/** `structural()`'s result: either a genuine structural `AskResult`, a signal+ * to fall through to `lexical()` with a loud note prepended (subject resolved+ * to zero nodes, or resolved but the walk found zero edges — never a bare+ * empty structural result), or `null` when the query has no structural intent+ * at all (not a "who calls"/"what does X import" shape), in which case the+ * caller falls through to `lexical()` silently, same as before this fix. */+type StructuralOutcome = { result: AskResult } | { fallthroughNote: string } | null;++function fallthroughNoteFor(subject: string): string {+ return (+ `structural index: no entries for '${subject}' — showing lexical matches; ` ++ `for exhaustive callers use grep -rn '${subject}'`+ );+}++function structural(query: string, graph: GraphV1, limit: number): StructuralOutcome {const wantsIn = INCOMING.test(query);const wantsOut = OUTGOING.test(query);if (!wantsIn && !wantsOut) return null;- const subjects = findSubject(query, graph);- if (subjects.length === 0) return null;+ const { nodes: subjects, tried } = findSubjectNodes(query, graph);+ if (subjects.length === 0) return { fallthroughNote: fallthroughNoteFor(tried) };const ids = new Set(subjects.map((n) => n.id));const byId = new Map(graph.nodes.map((n) => [n.id, n]));@@ -233,15 +252,23 @@ function structural(query: string, graph: GraphV1, limit: number): AskResult | nscore: 1,});}++ // Subject resolved but the graph has no indexed edges for it — same "loud,+ // never a bare empty" contract as `graft callers`/`callees` — fall through+ // to lexical rather than returning a structural result with zero hits.+ if (hits.length === 0) return { fallthroughNote: fallthroughNoteFor(subjects[0].name) };+hits.sort((a, b) => a.pointer.localeCompare(b.pointer));return {- query,- mode: "structural",- subject: subjects[0].name,- hits: hits.slice(0, limit),- note: outgoing- ? `outgoing edges from ${subjects[0].name}`- : `callers / references of ${subjects[0].name}`,+ result: {+ query,+ mode: "structural",+ subject: subjects[0].name,+ hits: hits.slice(0, limit),+ note: outgoing+ ? `outgoing edges from ${subjects[0].name}`+ : `callers / references of ${subjects[0].name}`,+ },};}@@ -499,8 +526,17 @@ export function ask(dir: string, query: string, opts: AskOptions = {}): AskResullet result: AskResult;if (corpus.graph) {- const s = structural(query, corpus.graph, limit);- result = s ?? lexical(query, corpus, limit, graphRank);+ const outcome = structural(query, corpus.graph, limit);+ if (outcome && "result" in outcome) {+ result = outcome.result;+ } else {+ result = lexical(query, corpus, limit, graphRank);+ // A structural-intent query that couldn't be answered structurally still+ // gets a prominent note on the lexical fallback result — never silent.+ if (outcome && "fallthroughNote" in outcome) {+ result.note = result.note ? `${outcome.fallthroughNote}\n${result.note}` : outcome.fallthroughNote;+ }+ }} else {result = lexical(query, corpus, limit, graphRank);}@@ -520,11 +556,21 @@ function toTokens(chars: number): number {/** Render an {@link AskResult} as a compact markdown context pack. */export function formatAsk(r: AskResult): string {- const head = `graft ask — "${r.query}" (${r.mode}${r.note ? `: ${r.note}` : ""})`;+ const head = `graft ask — "${r.query}" (${r.mode})`;+ // The note prints as its own prominent line(s) right under the header —+ // above every hit — so a loud structural-fallthrough note (or the+ // no-structural-edges / no-lexical-match note) can never be missed by only+ // being embedded inline in the header parenthetical.+ const noteBlock = r.note+ ? r.note+ .split("\n")+ .map((l) => `⚠ ${l}`)+ .join("\n")+ : "";if (r.hits.length === 0) {- return `${head}\n\n${r.note ?? "no matches."}`;+ return `${head}\n\n${noteBlock || "no matches."}`;}- const lines = [head, ""];+ const lines = noteBlock ? [head, "", noteBlock, ""] : [head, ""];if (r.mode === "structural") {for (const h of r.hits) {const tail = h.snippet ? ` — ${h.snippet}` : "";diff --git a/src/graph/traverse-cli.ts b/src/graph/traverse-cli.tsindex bbb77a82..23a1394a 100644--- a/src/graph/traverse-cli.ts+++ b/src/graph/traverse-cli.ts@@ -34,11 +34,15 @@ function edgesFor(kind: TraverseKind, graph: GraphV1, node: NodeV1, depth: numbereturn impactOf(graph, node, depth);}-function headerOf(n: NodeV1): string {+/** Exported so the MCP tools (`graft_callers`/`graft_callees`/`graft_blast_radius`+ * in `src/mcp/tools.ts`) can render the same human report format as the CLI,+ * rather than re-implementing it — both surfaces walk the same edges via the+ * same `resolveSymbol`/`callersOf`/`calleesOf`/`impactOf` core. */+export function headerOf(n: NodeV1): string {return `${n.name} · ${n.kind} · ${n.path}:${n.span}`;}-function hitLine(kind: TraverseKind, hit: EdgeHit): string {+export function hitLine(kind: TraverseKind, hit: EdgeHit): string {const arrow = ARROW[kind];const depthTag = kind === "impact" ? ` [depth ${hit.depth}]` : "";const label = hit.node ? `${hit.node.name} (${hit.node.path}:${hit.node.span})` : `${hit.id} (unresolved import)`;@@ -47,7 +51,7 @@ function hitLine(kind: TraverseKind, hit: EdgeHit): string {/** Loud, actionable empty-result note — never a bare empty list. `callers` and* `impact` both walk incoming edges, so they share the "callers" wording. */-function looseNoteFor(kind: TraverseKind, name: string): string {+export function looseNoteFor(kind: TraverseKind, name: string): string {const label = kind === "callees" ? "callees" : "callers";const direction = kind === "callees" ? "outgoing" : "incoming";return ` no indexed ${label} — the graph has no ${direction} call/reference edges for this symbol; try grep -rn "${name}"`;diff --git a/src/mcp/tools.ts b/src/mcp/tools.tsindex 1f6aa964..e6ed8ca5 100644--- a/src/mcp/tools.ts+++ b/src/mcp/tools.ts@@ -1,14 +1,16 @@/**- * The three MCP tools, as pure functions over the existing engine.+ * The MCP tools, as pure functions over the existing engine.* `callTool` never throws — hosts get soft errors as isError content.*/import { Graft } from '../engine.js';import { formatAsk } from '../ask/ask.js';import { formatCheckReport } from '../context/check.js';import { formatGraphCheckReport } from '../graph/check.js';-import { formatBlastRadius } from '../claude/format.js';import { loadGraphCached } from '../graph/load.js';import { contextDirFor } from '../context/node-file.js';+import { resolveSymbol, callersOf, calleesOf, impactOf, type EdgeHit } from '../graph/traverse.js';+import { headerOf, hitLine, looseNoteFor, type TraverseKind } from '../graph/traverse-cli.js';+import type { NodeV1 } from '../graph/types.js';export interface ToolDef {name: string;@@ -16,6 +18,15 @@ export interface ToolDef {inputSchema: object;}+/** Default BFS depth for `graft_blast_radius`, same default as `graft impact`. */+const DEFAULT_BLAST_DEPTH = 2;++const NO_GRAPH = 'no graph found — run `graft build` first';++function unknownSymbolText(query: string): string {+ return `no symbol "${query}" in the graph — check spelling or run \`graft build\``;+}+export const TOOLS: ToolDef[] = [{name: 'graft_ask',@@ -37,15 +48,58 @@ export const TOOLS: ToolDef[] = [},{name: 'graft_blast_radius',- description: 'List what depends on a file — who breaks if it changes.',+ description:+ 'BFS over incoming call/reference/import/implements/extends edges from a file or symbol — who breaks if it changes ($0, no LLM).',inputSchema: {type: 'object',- properties: { file: { type: 'string', description: 'repo-relative path, e.g. src/cache.ts' } },+ properties: {+ file: { type: 'string', description: 'repo-relative file path, or a symbol name (bare, qualified, or package-qualified)' },+ depth: { type: 'number', description: 'max BFS depth (default 2)' },+ },required: ['file'],},},+ {+ name: 'graft_callers',+ description: 'Who calls/references/imports/implements/extends a symbol (depth 1, $0, no LLM).',+ inputSchema: {+ type: 'object',+ properties: {+ symbol: { type: 'string', description: 'bare name, qualified (Class.method), or package-qualified (pkg.Fn)' },+ in: { type: 'string', description: 'narrow matches to nodes whose path contains this substring' },+ },+ required: ['symbol'],+ },+ },+ {+ name: 'graft_callees',+ description: 'What a symbol calls/references/imports/implements/extends (depth 1, $0, no LLM).',+ inputSchema: {+ type: 'object',+ properties: {+ symbol: { type: 'string', description: 'bare name, qualified (Class.method), or package-qualified (pkg.Fn)' },+ in: { type: 'string', description: 'narrow matches to nodes whose path contains this substring' },+ },+ required: ['symbol'],+ },+ },];+/** Render every resolved match's header + edge report (or the loud zero-edge+ * note), one block per match, joined with a blank line — the same grouping+ * `graft callers`/`callees`/`impact` use for multi-match symbols. */+function renderMatches(kind: TraverseKind, matches: NodeV1[], hitsFor: (n: NodeV1) => EdgeHit[]): string {+ return matches+ .map((m) => {+ const hits = hitsFor(m);+ const lines = [headerOf(m)];+ if (hits.length === 0) lines.push(looseNoteFor(kind, m.name));+ else for (const h of hits) lines.push(hitLine(kind, h));+ return lines.join('\n');+ })+ .join('\n\n');+}+export function callTool(root: string,name: string,@@ -70,12 +124,33 @@ export function callTool(return { text: parts.join('\n\n'), isError: false };}case 'graft_blast_radius': {- const file = String(args.file ?? '');- if (!file) return { text: 'graft_blast_radius requires a file', isError: true };+ const query = String(args.symbol ?? args.file ?? '');+ if (!query) return { text: 'graft_blast_radius requires a file or symbol', isError: true };+ const w = loadGraphCached(contextDirFor(root));+ if (!w) return { text: NO_GRAPH, isError: true };+ const matches = resolveSymbol(w, query);+ if (matches.length === 0) return { text: unknownSymbolText(query), isError: true };+ const depth =+ typeof args.depth === 'number' && Number.isFinite(args.depth) && args.depth >= 1+ ? args.depth+ : DEFAULT_BLAST_DEPTH;+ // impactOf's BFS is over incoming edges — same wording family as "callers".+ const text = renderMatches('impact', matches, (m) => impactOf(w, m, depth));+ return { text, isError: false };+ }+ case 'graft_callers':+ case 'graft_callees': {+ const symbol = String(args.symbol ?? '');+ if (!symbol) return { text: `${name} requires a symbol`, isError: true };const w = loadGraphCached(contextDirFor(root));- if (!w) return { text: 'no graph found — run `graft build` first', isError: true };- const br = formatBlastRadius(w, file);- return { text: br ?? `no known dependents of ${file}`, isError: false };+ if (!w) return { text: NO_GRAPH, isError: true };+ const inOpt = typeof args.in === 'string' && args.in ? { in: args.in } : {};+ const matches = resolveSymbol(w, symbol, inOpt);+ if (matches.length === 0) return { text: unknownSymbolText(symbol), isError: true };+ const kind: TraverseKind = name === 'graft_callers' ? 'callers' : 'callees';+ const walk = kind === 'callers' ? callersOf : calleesOf;+ const text = renderMatches(kind, matches, (m) => walk(w, m));+ return { text, isError: false };}default:return { text: `unknown tool: ${name}`, isError: true };diff --git a/test/ask.test.ts b/test/ask.test.tsindex 88cc6c09..9094a9ef 100644--- a/test/ask.test.ts+++ b/test/ask.test.ts@@ -99,6 +99,92 @@ test("ask indexes a symbol past the 32KB tree-sitter boundary (chunked parse)",}});+// ── Structural intent: resolveSymbol fix + loud fallthrough ────────────────++/** `Cache.get` is called (via `c.get(key)`) from `loadItem`; `unusedHelper` is+ * never called by anything, so structural resolves the subject but finds zero+ * edges. Same shapes the traversal-core fixture (test/graph-traverse.test.ts)+ * uses for the qualified-name bug class. */+function qualifiedFixture(): string {+ const dir = mkdtempSync(join(tmpdir(), "graft-ask-qualified-"));+ writeFileSync(+ join(dir, "cache.ts"),+ `export class Cache {\n` ++ ` get(key: string): string {\n` ++ ` return key;\n` ++ ` }\n` ++ `}\n\n` ++ `export function loadItem(key: string): string {\n` ++ ` const c = new Cache();\n` ++ ` return c.get(key);\n` ++ `}\n\n` ++ `export function unusedHelper(): number {\n` ++ ` return 42;\n` ++ `}\n`,+ );+ return dir;+}++test("ask: 'who calls Cache.get' resolves via qualified id-suffix (the previously-broken case)", async () => {+ const dir = qualifiedFixture();+ try {+ await buildGraph(dir);+ const r = ask(dir, "who calls Cache.get");+ assert.equal(r.mode, "structural");+ assert.equal(r.subject, "get");+ assert.ok(+ r.hits.some((h) => h.title === "loadItem"),+ "loadItem calls Cache.get, and must show up as a caller",+ );+ } finally {+ rmSync(dir, { recursive: true, force: true });+ }+});++test("ask: structural subject resolves but has zero edges — falls through to lexical with a loud note", async () => {+ const dir = qualifiedFixture();+ try {+ await buildGraph(dir);+ const r = ask(dir, "who calls unusedHelper");+ assert.equal(r.mode, "lexical", "never a bare empty structural result");+ assert.ok(r.note, "a fallthrough note must be set");+ assert.match(r.note!, /structural index: no entries for 'unusedHelper'/);+ assert.match(r.note!, /grep -rn 'unusedHelper'/);+ assert.ok(r.hits.length > 0, "lexical fallback still finds the function by name");+ } finally {+ rmSync(dir, { recursive: true, force: true });+ }+});++test("ask: structural intent for an unresolvable subject also falls through with a note, never a silent null", async () => {+ const dir = qualifiedFixture();+ try {+ await buildGraph(dir);+ const r = ask(dir, "who calls NoSuchSymbolXyz");+ assert.notEqual(r.mode, "structural");+ assert.ok(r.note, "a fallthrough note must be set even when nothing resolved");+ assert.match(r.note!, /structural index: no entries for 'NoSuchSymbolXyz'/);+ } finally {+ rmSync(dir, { recursive: true, force: true });+ }+});++test("formatAsk: the structural fallthrough note prints prominently, before any hit line", async () => {+ const dir = qualifiedFixture();+ try {+ await buildGraph(dir);+ const r = ask(dir, "who calls unusedHelper");+ const out = formatAsk(r);+ assert.ok(out.startsWith("graft ask —"), "header is the first line");+ const noteIdx = out.indexOf("⚠ structural index: no entries");+ assert.ok(noteIdx > 0, "the note is rendered");+ const firstHitIdx = out.search(/\n1\.\s/); // lexical hit numbering starts at "1. "+ assert.ok(firstHitIdx === -1 || noteIdx < firstHitIdx, "the note prints before any hit");+ } finally {+ rmSync(dir, { recursive: true, force: true });+ }+});+test("ask with source inlines the actual span from disk", async () => {const dir = makeFixture();try {diff --git a/test/graph-load.test.ts b/test/graph-load.test.tsindex 2cdd388e..8aade04c 100644--- a/test/graph-load.test.ts+++ b/test/graph-load.test.ts@@ -124,7 +124,14 @@ test("callTool: graft_blast_radius on the same dir twice doesn't reparse the grawriteFileSync(join(dir, "src", "math.ts"), "export function add() { return 1; }\n");const graph: GraphV1 = {version: 1,- nodes: [{ ...node("src/math.ts#add"), path: "src/math.ts" }],+ // A real `buildGraph` always emits a `kind: "file"` node per source file;+ // include one here too so `graft_blast_radius` (now a `resolveSymbol` ++ // `impactOf` walk, same as `graft impact`) can resolve the filename-shaped+ // query the way it would against a real build.+ nodes: [+ { ...node("src/math.ts#add"), path: "src/math.ts" },+ { ...node("src/math.ts"), kind: "file", path: "src/math.ts", name: "math.ts", signature: null },+ ],edges: [],} as GraphV1;// graft_blast_radius reads through `contextDirFor(root)`, i.e. `<root>/graft`diff --git a/test/mcp-server.test.ts b/test/mcp-server.test.tsindex 2a5f799d..330dfe03 100644--- a/test/mcp-server.test.ts+++ b/test/mcp-server.test.ts@@ -45,7 +45,13 @@ test('initialize → tools/list → tools/call round-trip', async () => {assert.ok(init.result.capabilities.tools);assert.equal(init.result.serverInfo.name, 'graft');const list = rs.find((r) => r.id === 2);- assert.deepEqual(list.result.tools.map((t: any) => t.name), ['graft_ask', 'graft_check', 'graft_blast_radius']);+ assert.deepEqual(list.result.tools.map((t: any) => t.name), [+ 'graft_ask',+ 'graft_check',+ 'graft_blast_radius',+ 'graft_callers',+ 'graft_callees',+ ]);const call = rs.find((r) => r.id === 3);assert.equal(call.result.isError, true); // unbuilt repo → soft error contentassert.match(call.result.content[0].text, /graft build/);diff --git a/test/mcp-tools.test.ts b/test/mcp-tools.test.tsindex 9656a224..980c4732 100644--- a/test/mcp-tools.test.ts+++ b/test/mcp-tools.test.ts@@ -15,8 +15,31 @@ function builtRepo(): string {return d;}-test('TOOLS lists the three tools with schemas', () => {- assert.deepEqual(TOOLS.map((t) => t.name), ['graft_ask', 'graft_check', 'graft_blast_radius']);+/** Three-deep call chain (compute -> sub -> add) so a `--depth`/`depth` param+ * has something to distinguish: depth 1 from `add` reaches only `sub`, the+ * default depth (2) also reaches `compute`. Same fixture shape as+ * test/graph-traverse-cli.test.ts's `impact -d` test. */+function chainRepo(): string {+ const d = mkdtempSync(join(tmpdir(), 'graft-mcptools-chain-'));+ mkdirSync(join(d, 'src'), { recursive: true });+ writeFileSync(+ join(d, 'src', 'math.ts'),+ 'export function add(a: number, b: number): number {\n return a + b;\n}\n' ++ 'export function sub(a: number, b: number): number {\n return add(a, -b);\n}\n' ++ 'export function compute(a: number, b: number): number {\n return sub(a, b);\n}\n',+ );+ execFileSync(process.execPath, ['--import', 'tsx', 'src/cli.ts', 'build', d], { stdio: 'pipe' });+ return d;+}++test('TOOLS lists all five tools with schemas', () => {+ assert.deepEqual(TOOLS.map((t) => t.name), [+ 'graft_ask',+ 'graft_check',+ 'graft_blast_radius',+ 'graft_callers',+ 'graft_callees',+ ]);for (const t of TOOLS) {assert.ok(t.description.length > 0);assert.equal((t.inputSchema as { type: string }).type, 'object');@@ -54,3 +77,69 @@ test('unbuilt repo and unknown tool are soft errors', () => {assert.equal(r2.isError, true);assert.match(r2.text, /unknown tool/i);});++test('graft_callers round-trips a caller on the built fixture', () => {+ const d = builtRepo();+ const r = callTool(d, 'graft_callers', { symbol: 'add' });+ assert.equal(r.isError, false);+ assert.match(r.text, /add · function · src\/math\.ts:/);+ assert.match(r.text, /calls ← sub \(src\/math\.ts:/);+});++test('graft_callers: qualified/--in narrowing still resolves through the shared resolver', () => {+ const d = builtRepo();+ const r = callTool(d, 'graft_callers', { symbol: 'add', in: 'math' });+ assert.equal(r.isError, false);+ assert.match(r.text, /calls ← sub/);+ const miss = callTool(d, 'graft_callers', { symbol: 'add', in: 'nowhere' });+ assert.equal(miss.isError, true);+ assert.match(miss.text, /no symbol "add" in the graph/);+});++test('graft_callees round-trips a callee, and reports a loud note when there are none', () => {+ const d = builtRepo();+ const callee = callTool(d, 'graft_callees', { symbol: 'sub' });+ assert.equal(callee.isError, false);+ assert.match(callee.text, /calls → add \(src\/math\.ts:/);++ // `add` calls nothing, so its callees are empty — must be a loud note, not silence.+ const empty = callTool(d, 'graft_callees', { symbol: 'add' });+ assert.equal(empty.isError, false);+ assert.match(empty.text, /no indexed callees/);+ assert.match(empty.text, /grep -rn "add"/);+});++test('graft_callers/graft_callees: unknown symbol is a soft isError', () => {+ const d = builtRepo();+ const r1 = callTool(d, 'graft_callers', { symbol: 'noSuchSymbolAnywhere' });+ assert.equal(r1.isError, true);+ assert.match(r1.text, /no symbol "noSuchSymbolAnywhere" in the graph/);+ assert.match(r1.text, /check spelling|graft build/);++ const r2 = callTool(d, 'graft_callees', {});+ assert.equal(r2.isError, true);+ assert.match(r2.text, /requires a symbol/);+});++test('graft_blast_radius: depth param is honored (default 2 reaches further than depth 1)', () => {+ const d = chainRepo();+ const shallow = callTool(d, 'graft_blast_radius', { file: 'add', depth: 1 });+ assert.equal(shallow.isError, false);+ assert.match(shallow.text, /← sub \(/);+ assert.doesNotMatch(shallow.text, /compute/);++ const deeper = callTool(d, 'graft_blast_radius', { file: 'add' });+ assert.equal(deeper.isError, false);+ assert.match(deeper.text, /← sub \(/);+ assert.match(deeper.text, /\[depth 1\]/);+ assert.match(deeper.text, /← compute \(/);+ assert.match(deeper.text, /\[depth 2\]/);+});++test('graft_blast_radius: unknown symbol is a soft isError with the check-spelling message', () => {+ const d = builtRepo();+ const r = callTool(d, 'graft_blast_radius', { file: 'noSuchSymbolAnywhere' });+ assert.equal(r.isError, true);+ assert.match(r.text, /no symbol "noSuchSymbolAnywhere" in the graph/);+ assert.match(r.text, /check spelling/);+});