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
Migrate this repo's committed graph to graft/ (deep build)
anirudhkumar-nanonets64d1bef31ea9
diff --git a/graft/.graph/wiring.json b/graft/.graph/wiring.jsonnew file mode 100644index 00000000..e77e4160--- /dev/null+++ b/graft/.graph/wiring.json@@ -0,0 +1,9592 @@+{+ "meta": {+ "version": 1,+ "nodeCount": 319,+ "edgeCount": 730,+ "languages": [+ "typescript"+ ]+ },+ "nodes": [+ {+ "id": "bench/agent.ts",+ "name": "agent.ts",+ "kind": "file",+ "path": "bench/agent.ts",+ "span": "L1-L323",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "e10d64f913c9517cef84cce58ea042d71bed3e94182c791245170eca54060e31",+ "summary_state": "ready",+ "summary": "This file implements a benchmark agent that processes questions about a codebase using filesystem tools and a language model.",+ "crux": null+ },+ {+ "id": "bench/agent.ts#AgentResult",+ "name": "AgentResult",+ "kind": "interface",+ "path": "bench/agent.ts",+ "span": "L19-L27",+ "signature": "interface AgentResult",+ "exported": true,+ "origin": "ast",+ "body_hash": "f4e0672910fa23856c22d12c1cdd474a4d144a773e9147f6e70b67fcbc2f9cdc",+ "summary_state": "ready",+ "summary": "Defines the structure of the result returned by the agent, encapsulating the answer and various metrics.",+ "crux": null+ },+ {+ "id": "bench/agent.ts#globToRegExp",+ "name": "globToRegExp",+ "kind": "function",+ "path": "bench/agent.ts",+ "span": "L92-L106",+ "signature": "function globToRegExp(glob: string): RegExp",+ "exported": false,+ "origin": "ast",+ "body_hash": "bf9f513a64c4a25612509c1bc9ca3e5ab141d47051aee3cb4d487fc6d87fd484",+ "summary_state": "ready",+ "summary": "Converts a glob pattern into a regular expression for matching file paths.",+ "crux": {+ "code": " } else re += \"[^/]*\";\n } else if (c === \"?\") re += \"[^/]\";\n else if (\".+^${}()|[]\\\\\".includes(c)) re += \"\\\\\" + c;\n else re += c;\n }\n return new RegExp(\"^\" + re + \"$\");",+ "span": "L100-L105"+ }+ },+ {+ "id": "bench/agent.ts#listFiles",+ "name": "listFiles",+ "kind": "function",+ "path": "bench/agent.ts",+ "span": "L62-L89",+ "signature": "function listFiles(root: string): string[]",+ "exported": false,+ "origin": "ast",+ "body_hash": "c99c73e1c6a44093a6f779cd0b4c54db649c4f0fb0c03a6af9c38673bc24f711",+ "summary_state": "ready",+ "summary": "Recursively lists all files in a directory while respecting size limits and skipping specified directories.",+ "crux": {+ "code": " try {\n if (statSync(full).size > MAX_FILE_BYTES) continue;\n } catch {\n continue;\n }\n out.push(full);\n }",+ "span": "L78-L84"+ }+ },+ {+ "id": "bench/agent.ts#listFiles.walk",+ "name": "walk",+ "kind": "function",+ "path": "bench/agent.ts",+ "span": "L64-L86",+ "signature": "walk = (dir: string)",+ "exported": false,+ "origin": "ast",+ "body_hash": "5a2365b8f09853c622d73cf63ed6804cf9fe3667bfc30f981759e2aff5483b43",+ "summary_state": "ready",+ "summary": "A helper function that traverses a directory to collect file paths, avoiding hidden files and skipped directories.",+ "crux": {+ "code": " if (e.name.startsWith(\".\")) continue;\n const full = join(dir, e.name);\n if (e.isDirectory()) {\n if (SKIP_DIRS.has(e.name)) continue;\n walk(full);\n } else if (e.isFile()) {\n try {\n if (statSync(full).size > MAX_FILE_BYTES) continue;\n } catch {\n continue;\n }\n out.push(full);",+ "span": "L72-L83"+ }+ },+ {+ "id": "bench/agent.ts#runAgent",+ "name": "runAgent",+ "kind": "function",+ "path": "bench/agent.ts",+ "span": "L230-L322",+ "signature": "async function runAgent(opts: RunAgentOptions): Promise<AgentResult>",+ "exported": true,+ "origin": "ast",+ "body_hash": "32cb0dc584762b0c9da95c2c69d73afb0d7a9b59628e53e306cd341a0d92cb44",+ "summary_state": "ready",+ "summary": "Manages the execution of the agent's logic, including handling user questions and tool interactions.",+ "crux": {+ "code": " const resp = await client.chat.completions.create({\n model: AGENT_MODEL,\n max_tokens: 4096,\n messages,\n tools: TOOLS,\n });\n const u: any = resp.usage ?? {};\n const cached = u.prompt_tokens_details?.cached_tokens ?? 0;\n tokens.cacheRead += cached;\n tokens.input += Math.max(0, (u.prompt_tokens ?? 0) - cached); // uncached input only\n tokens.output += u.completion_tokens ?? 0;\n const choice = resp.choices[0];",+ "span": "L270-L281"+ }+ },+ {+ "id": "bench/agent.ts#runAgent.slideCacheBreakpoint",+ "name": "slideCacheBreakpoint",+ "kind": "function",+ "path": "bench/agent.ts",+ "span": "L254-L260",+ "signature": "slideCacheBreakpoint = ()",+ "exported": true,+ "origin": "ast",+ "body_hash": "c5c9e42b4e085cfd27d6614a97f5208d50aed8551304862e6eb81c56edab795a",+ "summary_state": "ready",+ "summary": "Maintains the cache state by updating the cache control for the most recent tool result in the message history.",+ "crux": {+ "code": " const toolMsgs = messages.filter((m) => m.role === \"tool\");\n toolMsgs.forEach((m, i) => {\n const part = Array.isArray(m.content) ? m.content[m.content.length - 1] : null;\n if (part) part.cache_control = i === toolMsgs.length - 1 ? cc : undefined;\n });",+ "span": "L255-L259"+ }+ },+ {+ "id": "bench/agent.ts#RunAgentOptions",+ "name": "RunAgentOptions",+ "kind": "interface",+ "path": "bench/agent.ts",+ "span": "L29-L37",+ "signature": "interface RunAgentOptions",+ "exported": true,+ "origin": "ast",+ "body_hash": "b786c099fceddc6e582d26ab2a302637b256ba7144fae8629b8611325b0018e0",+ "summary_state": "ready",+ "summary": "Specifies the options for running the agent, including the root directory and the question to be answered.",+ "crux": null+ },+ {+ "id": "bench/agent.ts#runTool",+ "name": "runTool",+ "kind": "function",+ "path": "bench/agent.ts",+ "span": "L168-L228",+ "signature": "function runTool(root: string, name: string, input: any): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "e4b0b544cf7ac1c6c08fa61827000496bb74311f04305b9868e5d70695cea9e1",+ "summary_state": "ready",+ "summary": "Executes a specified tool (like reading a file or listing a directory) based on the provided input parameters.",+ "crux": {+ "code": " if (name === \"read_file\") {\n const file = safePath(root, String(input.path));\n const lines = readFileSync(file, \"utf8\").split(\"\\n\");\n const start = input.start_line ? Math.max(1, input.start_line) : 1;\n const end = input.end_line ? Math.min(lines.length, input.end_line) : Math.min(lines.length, start - 1 + MAX_READ_LINES);\n const slice = lines.slice(start - 1, end);\n const numbered = slice.map((l: string, i: number) => `${start + i}\\t${l}`).join(\"\\n\");\n const more = end < lines.length ? `\\n… (${lines.length - end} more lines)` : \"\";\n return numbered + more || \"(empty file)\";\n }\n if (name === \"list_dir\") {\n const dir = input.path ? safePath(root, String(input.path)) : root;",+ "span": "L170-L181"+ }+ },+ {+ "id": "bench/agent.ts#safePath",+ "name": "safePath",+ "kind": "function",+ "path": "bench/agent.ts",+ "span": "L46-L60",+ "signature": "function safePath(root: string, p: string): string",+ "exported": true,+ "origin": "ast",+ "body_hash": "8a6349aeb94f54f93a15bde379809135e40fcb4844de10eab68d4c95f0301a16",+ "summary_state": "ready",+ "summary": "Ensures that a given path is safely resolved within a specified root directory, preventing directory traversal attacks.",+ "crux": {+ "code": " if (rel.startsWith(\"..\") || isAbsolute(rel)) throw new Error(`path escapes root: ${p}`);\n try {\n const real = realpathSync(abs);\n const realRoot = realpathSync(root);\n rel = relative(realRoot, real);\n if (rel.startsWith(\"..\") || isAbsolute(rel)) throw new Error(`path escapes root: ${p}`);\n return real;",+ "span": "L49-L55"+ }+ },+ {+ "id": "bench/judge.ts",+ "name": "judge.ts",+ "kind": "file",+ "path": "bench/judge.ts",+ "span": "L1-L88",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "94c222341b066e4f3134b3d9d3f30f31b9ffe7b92967086b07c58f297d349936",+ "summary_state": "ready",+ "summary": "This file implements a correctness scoring system that evaluates AI-generated answers against a reference answer using keyword checks and an LLM judge.",+ "crux": null+ },+ {+ "id": "bench/judge.ts#extractJson",+ "name": "extractJson",+ "kind": "function",+ "path": "bench/judge.ts",+ "span": "L35-L49",+ "signature": "function extractJson(text: string): any",+ "exported": false,+ "origin": "ast",+ "body_hash": "8598a77c27df0c2d51964f8e5bd27752fca0c0af9b038302069d9440535fe911",+ "summary_state": "ready",+ "summary": "The extractJson function retrieves the first JSON object from a string, handling cases where the JSON is wrapped in additional text.",+ "crux": {+ "code": " return JSON.parse(text);\n } catch {\n const m = text.match(/\\{[\\s\\S]*\\}/);\n if (m) {\n try {\n return JSON.parse(m[0]);",+ "span": "L37-L42"+ }+ },+ {+ "id": "bench/judge.ts#judge",+ "name": "judge",+ "kind": "function",+ "path": "bench/judge.ts",+ "span": "L51-L87",+ "signature": "async function judge(input: JudgeInput): Promise<Verdict>",+ "exported": true,+ "origin": "ast",+ "body_hash": "98496fb2f15740ca1a47bcfd39f9a44f0b320a2c53d3c21086fdcb8304f88f43",+ "summary_state": "ready",+ "summary": "The judge function evaluates an AI agent's answer against a reference answer, returning a Verdict based on keyword presence and LLM scoring.",+ "crux": {+ "code": " const keywordPass = kw.every((k) => hay.includes(k.toLowerCase()));\n\n const prompt =\n `You are grading an AI agent's answer to a factual question about a codebase/document set. ` +\n `Respond with ONLY a JSON object of the form {\"correct\": boolean, \"score\": number, \"reasoning\": string} ` +\n `where score is 0.0 (wrong/irrelevant) to 1.0 (fully correct and complete). No prose, no code fences.\\n\\n` +\n `Question:\\n${input.question}\\n\\n` +\n `Reference answer (ground truth):\\n${input.referenceAnswer}\\n\\n` +\n `Agent's answer:\\n${input.agentAnswer}\\n\\n` +\n `Grade whether the agent's answer is factually correct and responsive, judged against the reference. ` +\n `Extra correct detail is fine; contradicting the reference or missing the core fact is not.`;\n",+ "span": "L56-L67"+ }+ },+ {+ "id": "bench/judge.ts#JudgeInput",+ "name": "JudgeInput",+ "kind": "interface",+ "path": "bench/judge.ts",+ "span": "L26-L32",+ "signature": "interface JudgeInput",+ "exported": true,+ "origin": "ast",+ "body_hash": "d22eb2a46b81a9e2f6f55c9f1409b5afc682ab8028ef88f8522a0397dcb1a2bc",+ "summary_state": "ready",+ "summary": "The JudgeInput interface defines the structure of input data required for the judging process, including the question and answers.",+ "crux": null+ },+ {+ "id": "bench/judge.ts#Verdict",+ "name": "Verdict",+ "kind": "interface",+ "path": "bench/judge.ts",+ "span": "L18-L24",+ "signature": "interface Verdict",+ "exported": true,+ "origin": "ast",+ "body_hash": "650e88981503f18e5a30dc0050ad111724eb40d2d32ebb0bec9106bb3d934e50",+ "summary_state": "ready",+ "summary": "The Verdict interface encapsulates the scoring results and correctness evaluation of an AI agent's answer.",+ "crux": null+ },+ {+ "id": "bench/llm.ts",+ "name": "llm.ts",+ "kind": "file",+ "path": "bench/llm.ts",+ "span": "L1-L19",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "6c0d2a02ac6aa86de94f779355020700a4d9016e2f4b431bf75560e1d3c51229",+ "summary_state": "ready",+ "summary": "This file configures and provides access to the OpenRouter API for benchmarking LLMs without needing separate API keys.",+ "crux": null+ },+ {+ "id": "bench/llm.ts#makeClient",+ "name": "makeClient",+ "kind": "function",+ "path": "bench/llm.ts",+ "span": "L14-L18",+ "signature": "function makeClient(): OpenAI",+ "exported": true,+ "origin": "ast",+ "body_hash": "1de90a5deaf00c7680162630fe437cfc2cc72204aaabf5150922b9b40da021bf",+ "summary_state": "ready",+ "summary": "Creates an OpenAI client instance, ensuring that the necessary API key is provided for operation.",+ "crux": {+ "code": " if (!apiKey) throw new Error(\"OPENROUTER_API_KEY is required (agent + judge run through OpenRouter).\");\n return new OpenAI({ apiKey, baseURL: OPENROUTER_BASE_URL });",+ "span": "L16-L17"+ }+ },+ {+ "id": "bench/report.ts",+ "name": "report.ts",+ "kind": "file",+ "path": "bench/report.ts",+ "span": "L1-L126",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "775be8c40a8e4172521bba8f6a1f026fa23c4d24b9b5225da3ed5b745077a5b0",+ "summary_state": "ready",+ "summary": "This file provides functionality for aggregating and reporting benchmark results for different agent configurations.",+ "crux": null+ },+ {+ "id": "bench/report.ts#aggregate",+ "name": "aggregate",+ "kind": "function",+ "path": "bench/report.ts",+ "span": "L56-L68",+ "signature": "function aggregate(rows: Row[]): ArmAgg",+ "exported": false,+ "origin": "ast",+ "body_hash": "2dc5a442b3d9d4a3a674a2bee1a8ceddd9410a4d92bacf30bea4503e7588f3fb",+ "summary_state": "ready",+ "summary": "Aggregates multiple benchmark rows into a single ArmAgg object, calculating averages for various metrics.",+ "crux": {+ "code": "function aggregate(rows: Row[]): ArmAgg {\n return {\n n: rows.length,\n tokensTotal: mean(rows.map((r) => r.tokensTotal)),\n tokensInput: mean(rows.map((r) => r.tokensInput)),\n tokensOutput: mean(rows.map((r) => r.tokensOutput)),\n toolCalls: mean(rows.map((r) => r.toolCalls)),\n wallMs: mean(rows.map((r) => r.wallMs)),\n correctness: mean(rows.map((r) => (r.correct ? 1 : 0))),\n score: mean(rows.map((r) => r.score)),\n cost: mean(rows.map((r) => costOf(r))),\n };",+ "span": "L56-L67"+ }+ },+ {+ "id": "bench/report.ts#ArmAgg",+ "name": "ArmAgg",+ "kind": "interface",+ "path": "bench/report.ts",+ "span": "L44-L54",+ "signature": "interface ArmAgg",+ "exported": false,+ "origin": "ast",+ "body_hash": "a7a78cc5f14ddd30155d952a75e96f4508ffbf4d3bf432e53945cbf055cc67dd",+ "summary_state": "ready",+ "summary": "Represents aggregated metrics for a specific arm of the benchmark, including totals and averages.",+ "crux": null+ },+ {+ "id": "bench/report.ts#buildMarkdown",+ "name": "buildMarkdown",+ "kind": "function",+ "path": "bench/report.ts",+ "span": "L80-L125",+ "signature": "function buildMarkdown(rows: Row[]): string",+ "exported": true,+ "origin": "ast",+ "body_hash": "9534d62231f50105f1ef247af6dd99e180786c443307f1eb82b47e5c9d631152",+ "summary_state": "ready",+ "summary": "Generates a markdown report summarizing benchmark results across different corpora and arms.",+ "crux": {+ "code": "export function buildMarkdown(rows: Row[]): string {\n const corpora = [...new Set(rows.map((r) => r.corpus))];\n const lines: string[] = [];\n lines.push(\"# Context Graph Engine — Benchmark Results\", \"\");\n lines.push(\n `Agent: Claude Sonnet 5 · Judge: Claude Opus 4.8 · ${rows.length} agent runs total.`,\n \"\",\n \"Each cell is the mean across all tasks × trials for that corpus/arm. \" +\n \"**Cold** = agent explores with filesystem tools from zero. **Graph** = same agent, \" +\n \"same tools, plus the graph context bundle injected up front.\",\n \"\",\n );",+ "span": "L80-L91"+ }+ },+ {+ "id": "bench/report.ts#costOf",+ "name": "costOf",+ "kind": "function",+ "path": "bench/report.ts",+ "span": "L33-L38",+ "signature": "function costOf(r: { tokensInput: number; tokensOutput: number; cacheRead: number; cacheCreate: number }): number",+ "exported": true,+ "origin": "ast",+ "body_hash": "413c8810eda0e5edbb94cf5a7491732fdc1e4cb3df89eda614e7ce145f2b7c11",+ "summary_state": "ready",+ "summary": "Calculates the approximate cost of running an agent based on input and output tokens and cache operations.",+ "crux": {+ "code": " return (\n (r.tokensInput + r.cacheCreate * 1.25 + r.cacheRead * 0.1) * IN_PER_TOK +\n r.tokensOutput * OUT_PER_TOK\n );",+ "span": "L34-L37"+ }+ },+ {+ "id": "bench/report.ts#fmt",+ "name": "fmt",+ "kind": "function",+ "path": "bench/report.ts",+ "span": "L76-L78",+ "signature": "function fmt(n: number): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "e5554c617b5485df92a2ba8792f4bb715431c2aa0a21f7e900465d0a2690e5b1",+ "summary_state": "ready",+ "summary": "Formats a number for display, adjusting for thousands and decimal precision.",+ "crux": null+ },+ {+ "id": "bench/report.ts#mean",+ "name": "mean",+ "kind": "function",+ "path": "bench/report.ts",+ "span": "L40-L42",+ "signature": "function mean(xs: number[]): number",+ "exported": false,+ "origin": "ast",+ "body_hash": "bc3ca4cedc8d6833e415c55049ed08517980bbc60e432640f883cbed2e5aafae",+ "summary_state": "ready",+ "summary": "Computes the mean of an array of numbers, returning zero for an empty array.",+ "crux": null+ },+ {+ "id": "bench/report.ts#pctDelta",+ "name": "pctDelta",+ "kind": "function",+ "path": "bench/report.ts",+ "span": "L70-L74",+ "signature": "function pctDelta(cold: number, graph: number): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "e8adea58e85eb9a811c2fbdd6e999781ca014f54162f777f2dbd29cbc541e972",+ "summary_state": "ready",+ "summary": "Calculates the percentage delta between two values, handling the case where the first value is zero.",+ "crux": {+ "code": "function pctDelta(cold: number, graph: number): string {\n if (cold === 0) return \"n/a\";\n const d = ((graph - cold) / cold) * 100;\n return (d > 0 ? \"+\" : \"\") + d.toFixed(0) + \"%\";",+ "span": "L70-L73"+ }+ },+ {+ "id": "bench/report.ts#Row",+ "name": "Row",+ "kind": "interface",+ "path": "bench/report.ts",+ "span": "L6-L26",+ "signature": "interface Row",+ "exported": true,+ "origin": "ast",+ "body_hash": "5715f0dee9c689834b1869bbb14379fbc55d730fbf32dbee62bb7d4ec87f3915",+ "summary_state": "ready",+ "summary": "Defines the structure of a benchmark trial row, capturing various metrics related to agent performance.",+ "crux": null+ },+ {+ "id": "bench/run.ts",+ "name": "run.ts",+ "kind": "file",+ "path": "bench/run.ts",+ "span": "L1-L207",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "a0d2859628588f45ae31862f5f801d6219802449c23bbbdba9aa51b7b9febf47",+ "summary_state": "ready",+ "summary": "This file orchestrates the benchmarking process for various corpora and tasks, managing the execution and reporting of results.",+ "crux": {+ "code": " for (const corpus of corpora) {\n const tasks = args.tasks ? corpus.tasks.slice(0, args.tasks) : corpus.tasks;\n console.log(`\\n=== corpus: ${corpus.id} (${corpus.kind}) — ${tasks.length} tasks × ${args.trials} trials ===`);\n\n // Fresh temp-backed engine; ingest once and reuse for the whole corpus.\n const dbDir = mkdtempSync(join(tmpdir(), \"cge-bench-db-\"));\n tmpDbDirs.push(dbDir);\n const engine = new Graft({ dbPath: join(dbDir, \"graph.db\") });\n\n let agentRoot = corpus.path;\n let docsWorkdir: string | undefined;\n",+ "span": "L101-L112"+ }+ },+ {+ "id": "bench/run.ts#Args",+ "name": "Args",+ "kind": "interface",+ "path": "bench/run.ts",+ "span": "L29-L35",+ "signature": "interface Args",+ "exported": false,+ "origin": "ast",+ "body_hash": "07bb0961cc69a2894c3baf9941dd072b901a4d94d3527b04a94397d5c88a749f",+ "summary_state": "ready",+ "summary": "Defines the structure for command-line arguments used to configure the benchmarking run.",+ "crux": null+ },+ {+ "id": "bench/run.ts#main",+ "name": "main",+ "kind": "function",+ "path": "bench/run.ts",+ "span": "L84-L201",+ "signature": "async function main()",+ "exported": false,+ "origin": "ast",+ "body_hash": "dbf48031433ab51d95363a6e6c55ea949fab2c2a53e903da497fe05f1d58edf5",+ "summary_state": "ready",+ "summary": "Coordinates the overall benchmarking process, including argument parsing, corpus ingestion, and result reporting.",+ "crux": {+ "code": "async function main() {\n const args = parseArgs(process.argv.slice(2));\n if (!process.env.OPENROUTER_API_KEY) {\n console.error(\"Set OPENROUTER_API_KEY (agent, judge, and graph extraction all run through OpenRouter).\");\n process.exit(1);\n }\n const client = makeClient();\n\n const corpora = CORPORA.filter((c) => !args.corpora || args.corpora.includes(c.id));\n if (corpora.length === 0) {\n console.error(`No matching corpora. Available: ${CORPORA.map((c) => c.id).join(\", \")}`);\n process.exit(1);",+ "span": "L84-L95"+ }+ },+ {+ "id": "bench/run.ts#makeDocsWorkdir",+ "name": "makeDocsWorkdir",+ "kind": "function",+ "path": "bench/run.ts",+ "span": "L69-L82",+ "signature": "async function makeDocsWorkdir(corpus: Corpus): Promise<string>",+ "exported": false,+ "origin": "ast",+ "body_hash": "9688c56522bfdc0e8c20e07526ee021ddd45ab6d77a116b06df1fb770021e017",+ "summary_state": "ready",+ "summary": "Creates a temporary working directory for processing documents in a specified corpus.",+ "crux": {+ "code": " const dir = mkdtempSync(join(tmpdir(), \"cge-bench-docs-\"));\n const files = readdirSync(corpus.path).filter((f) => DOC_EXTENSIONS.some((e) => f.toLowerCase().endsWith(e)));\n for (const f of files) {\n const src = join(corpus.path, f);\n if (isPdfPath(f)) {\n const text = await extractPdfText(src);\n writeFileSync(join(dir, f.replace(/\\.pdf$/i, \".txt\")), text);\n } else {\n copyFileSync(src, join(dir, f));\n }\n }\n return dir;",+ "span": "L70-L81"+ }+ },+ {+ "id": "bench/run.ts#parseArgs",+ "name": "parseArgs",+ "kind": "function",+ "path": "bench/run.ts",+ "span": "L37-L52",+ "signature": "function parseArgs(argv: string[]): Args",+ "exported": false,+ "origin": "ast",+ "body_hash": "dd2d7d4756b068252199a77e1af829fea67d99e8924610198ca79f48a994635b",+ "summary_state": "ready",+ "summary": "Parses command-line arguments to extract configuration options for the benchmarking process.",+ "crux": {+ "code": " const a: Args = { trials: 3, arms: [\"cold\", \"graph\"], concurrency: 6 };\n for (let i = 0; i < argv.length; i++) {\n const arg = argv[i];\n if (arg === \"--smoke\") {\n a.corpora = [\"unified-accounts-login-server\"]; // smallest corpus — cheapest plumbing check\n a.tasks = 1;\n a.trials = 1;\n } else if (arg === \"--corpora\" || arg === \"--repos\") a.corpora = argv[++i].split(\",\");\n else if (arg === \"--tasks\") a.tasks = Number(argv[++i]);\n else if (arg === \"--trials\") a.trials = Number(argv[++i]);\n else if (arg === \"--arms\") a.arms = argv[++i].split(\",\") as Array<\"cold\" | \"graph\">;\n else if (arg === \"--concurrency\") a.concurrency = Math.max(1, Number(argv[++i]));",+ "span": "L38-L49"+ }+ },+ {+ "id": "bench/run.ts#pool",+ "name": "pool",+ "kind": "function",+ "path": "bench/run.ts",+ "span": "L55-L66",+ "signature": "async function pool<T, R>(items: T[], n: number, fn: (item: T) => Promise<R>): Promise<R[]>",+ "exported": false,+ "origin": "ast",+ "body_hash": "a7195db3e63798d9ce8138057327e135cc12f0187a870a4856f5b0c5b1c21e84",+ "summary_state": "ready",+ "summary": "Executes a function on a set of items concurrently, limiting the number of simultaneous operations.",+ "crux": {+ "code": "async function pool<T, R>(items: T[], n: number, fn: (item: T) => Promise<R>): Promise<R[]> {\n const results: R[] = new Array(items.length);\n let next = 0;\n async function worker() {\n while (next < items.length) {\n const idx = next++;\n results[idx] = await fn(items[idx]);\n }\n }\n await Promise.all(Array.from({ length: Math.min(n, items.length) }, worker));\n return results;",+ "span": "L55-L65"+ }+ },+ {+ "id": "bench/run.ts#pool.worker",+ "name": "worker",+ "kind": "function",+ "path": "bench/run.ts",+ "span": "L58-L63",+ "signature": "async function worker()",+ "exported": false,+ "origin": "ast",+ "body_hash": "b9705c00faf21752c1d6cd68735d93e6f2a95a30b4ca5b5df894f01966715f79",+ "summary_state": "ready",+ "summary": "Processes items in the pool function, handling each item asynchronously.",+ "crux": {+ "code": " while (next < items.length) {\n const idx = next++;\n results[idx] = await fn(items[idx]);",+ "span": "L59-L61"+ }+ },+ {+ "id": "bench/selfcheck.ts",+ "name": "selfcheck.ts",+ "kind": "file",+ "path": "bench/selfcheck.ts",+ "span": "L1-L120",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "0eaf577938e20fa27d9cd0157bc8843fdc37165d85696789334b8605138f4bb4",+ "summary_state": "ready",+ "summary": "This file performs an offline verification of the harness plumbing to ensure control flow works correctly without needing an API key.",+ "crux": {+ "code": "async function main() {\n const root = mkdtempSync(join(tmpdir(), \"cge-selfcheck-\"));\n mkdirSync(join(root, \"src\"), { recursive: true });\n writeFileSync(join(root, \"src\", \"config.ts\"), \"export const token = 'SECRET_TOKEN';\\n\");\n\n const client = makeStubClient();\n\n // 1. Agent loop: should call the grep tool once, then answer.\n const ar = await runAgent({ client, root, question: \"What is the secret token?\" });\n assert.equal(ar.toolCalls, 1, \"expected exactly one tool call\");\n assert.equal(ar.toolLog[0].name, \"grep\", \"expected the grep tool to run\");\n assert.ok(ar.answer.includes(\"SECRET_TOKEN\"), \"answer should contain the fact\");",+ "span": "L50-L61"+ }+ },+ {+ "id": "bench/selfcheck.ts#main",+ "name": "main",+ "kind": "function",+ "path": "bench/selfcheck.ts",+ "span": "L50-L114",+ "signature": "async function main()",+ "exported": false,+ "origin": "ast",+ "body_hash": "5f20853f3387db063509fe8426e6f34758fdac602fbef13cba81514ec752483b",+ "summary_state": "ready",+ "summary": "Coordinates the self-check process by setting up a temporary environment, running the agent, and validating the results.",+ "crux": {+ "code": " const ar = await runAgent({ client, root, question: \"What is the secret token?\" });\n assert.equal(ar.toolCalls, 1, \"expected exactly one tool call\");\n assert.equal(ar.toolLog[0].name, \"grep\", \"expected the grep tool to run\");\n assert.ok(ar.answer.includes(\"SECRET_TOKEN\"), \"answer should contain the fact\");\n assert.equal(ar.tokens.total, 300, \"tokens should sum across 2 turns (150 each)\");\n assert.equal(ar.stopReason, \"stop\");\n console.log(`✓ agent loop: ${ar.toolCalls} tool call, ${ar.tokens.total} tokens, answer=\"${ar.answer}\"`);",+ "span": "L58-L64"+ }+ },+ {+ "id": "bench/selfcheck.ts#makeStubClient",+ "name": "makeStubClient",+ "kind": "function",+ "path": "bench/selfcheck.ts",+ "span": "L19-L48",+ "signature": "function makeStubClient()",+ "exported": false,+ "origin": "ast",+ "body_hash": "3ac524103f28630ba8f080c62707872e56d513b46b57b6753cb07c8c6c44f249",+ "summary_state": "ready",+ "summary": "Creates a stub client that simulates responses for agent and judge interactions during testing.",+ "crux": {+ "code": " if (params.response_format) {\n // Judge call → JSON verdict.\n return {\n choices: [{ message: { role: \"assistant\", content: JSON.stringify({ correct: true, score: 0.9, reasoning: \"matches reference\" }) }, finish_reason: \"stop\" }],\n usage,\n };\n }\n // Agent call. First turn: use grep. Second turn: final answer.\n agentTurn++;\n if (agentTurn === 1) {\n return {\n choices: [{ message: { role: \"assistant\", content: null, tool_calls: [{ id: \"tc_1\", type: \"function\", function: { name: \"grep\", arguments: JSON.stringify({ pattern: \"SECRET_TOKEN\" }) } }] }, finish_reason: \"tool_calls\" }],",+ "span": "L25-L36"+ }+ },+ {+ "id": "bench/tasks.ts",+ "name": "tasks.ts",+ "kind": "file",+ "path": "bench/tasks.ts",+ "span": "L1-L281",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "d21168797f40d193a914aca0c438409d29d300441bc0a6a518c93869240b3b69",+ "summary_state": "ready",+ "summary": "This file defines benchmark tasks and their corresponding reference answers for validating code understanding across multiple repositories.",+ "crux": {+ "code": "/** Sibling repo path by default; overridable via BENCH_REPO_<ID_UPPER> (dashes → underscores). */\nfunction repoPath(id: string): string {\n const envKey = \"BENCH_REPO_\" + id.toUpperCase().replace(/-/g, \"_\");\n return process.env[envKey] ?? resolve(parent, id);\n}\n\nexport interface Task {\n id: string;\n question: string;\n referenceAnswer: string;\n /** Case-insensitive substrings the answer must contain (deterministic floor). */\n requiredKeywords: string[];",+ "span": "L25-L36"+ }+ },+ {+ "id": "bench/tasks.ts#Corpus",+ "name": "Corpus",+ "kind": "interface",+ "path": "bench/tasks.ts",+ "span": "L39-L45",+ "signature": "interface Corpus",+ "exported": true,+ "origin": "ast",+ "body_hash": "4b3ae3ef3d07322b65aaa6b2821f5c8e6871251bdc7ab6d8248ce584a28a5603",+ "summary_state": "ready",+ "summary": "This interface defines a corpus of benchmark tasks, specifying its ID, type, path, and associated tasks.",+ "crux": null+ },+ {+ "id": "bench/tasks.ts#repoPath",+ "name": "repoPath",+ "kind": "function",+ "path": "bench/tasks.ts",+ "span": "L26-L29",+ "signature": "function repoPath(id: string): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "96ac12ff90253b3d673f747af65246aa6707ba09fda29f12266b75fbc9ae50f7",+ "summary_state": "ready",+ "summary": "This function determines the file path for sibling repositories, allowing for environment variable overrides.",+ "crux": {+ "code": " return process.env[envKey] ?? resolve(parent, id);",+ "span": "L28-L28"+ }+ },+ {+ "id": "bench/tasks.ts#Task",+ "name": "Task",+ "kind": "interface",+ "path": "bench/tasks.ts",+ "span": "L31-L37",+ "signature": "interface Task",+ "exported": true,+ "origin": "ast",+ "body_hash": "ec755cc45cea139405762338ce104dfa8b2307f7bfa4f7733f731e6d80c21cb8",+ "summary_state": "ready",+ "summary": "This interface outlines the structure of a benchmark task, including its ID, question, reference answer, and required keywords.",+ "crux": null+ },+ {+ "id": "scripts/build-viewer.mjs",+ "name": "build-viewer.mjs",+ "kind": "file",+ "path": "scripts/build-viewer.mjs",+ "span": "L1-L29",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "fb4ba16d7815dbdbaf2fd818362f914671903132be5573fbdd9a7734549b833d",+ "summary_state": "ready",+ "summary": "This script automates the bundling of the viewer application and its static assets for deployment.",+ "crux": {+ "code": "await build({\n entryPoints: [join(root, \"viewer\", \"main.ts\")],\n bundle: true,\n minify: true,\n format: \"esm\",\n target: \"es2022\",\n outfile: join(outDir, \"app.js\"),\n});",+ "span": "L15-L22"+ }+ },+ {+ "id": "src/ai/crux.ts",+ "name": "crux.ts",+ "kind": "file",+ "path": "src/ai/crux.ts",+ "span": "L1-L128",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "e81750029e4c8641cdaf2b4894f595297839e07a73076e4cdac1522515f923a8",+ "summary_state": "ready",+ "summary": "This file provides a mechanism to summarize code definitions for better navigation and understanding of a codebase.",+ "crux": {+ "code": "const SYSTEM_PROMPT = `You explain code definitions for a code graph that helps engineers navigate a codebase.\n\nYou are given ONE source file with 1-based line numbers, and a list of TARGET definitions in it. For every target, return its purpose and the line range of its core logic.\n\nReturn STRICT JSON, exactly:\n{ \"symbols\": [ { \"id\": string, \"summary\": string, \"crux_start\": number, \"crux_end\": number }, ... ] }\n\nRules:\n- Emit exactly one entry per target id given, using that id verbatim.\n- summary: ONE sentence — what the symbol is FOR at the business-logic level. Say what problem it solves or rule it enforces, not what its signature already says.\n- crux_start / crux_end: FILE line numbers (as shown), inside that symbol's own line range. Pick the SINGLE most important contiguous span — the core branch, formula, guard, or state change. Keep it TIGHT: at most ~8 lines, and NEVER the whole function. If you can't narrow it below that, the symbol has no distinct crux — use 0/0.\n- Skip boilerplate, logging, and plumbing. If a symbol has no meaningful crux (trivial getter, data holder, one-line delegation, or logic spread evenly with no focal point), use \"crux_start\": 0 and \"crux_end\": 0.",+ "span": "L46-L57"+ }+ },+ {+ "id": "src/ai/crux.ts#CruxSummarizer",+ "name": "CruxSummarizer",+ "kind": "interface",+ "path": "src/ai/crux.ts",+ "span": "L42-L44",+ "signature": "interface CruxSummarizer",+ "exported": true,+ "origin": "ast",+ "body_hash": "03333336a2e057667a15b39364d3ba6f09ea739b8c1a35c4b3dfdd71c6f5d4d9",+ "summary_state": "ready",+ "summary": "Interface for summarizing code definitions from a file.",+ "crux": {+ "code": "export interface CruxSummarizer {\n describeFile(input: FileCruxInput): Promise<NodeCrux[]>;\n}",+ "span": "L42-L44"+ }+ },+ {+ "id": "src/ai/crux.ts#FileCruxInput",+ "name": "FileCruxInput",+ "kind": "interface",+ "path": "src/ai/crux.ts",+ "span": "L29-L33",+ "signature": "interface FileCruxInput",+ "exported": true,+ "origin": "ast",+ "body_hash": "5216f1ff3c8ce99cfac0130265f5b9597634df473889050b2af1e193c545ebab",+ "summary_state": "ready",+ "summary": "Encapsulates the input data required for summarizing a file's code definitions.",+ "crux": {+ "code": "export interface FileCruxInput {\n path: string;\n source: string;\n nodes: NodeRef[];\n}",+ "span": "L29-L33"+ }+ },+ {+ "id": "src/ai/crux.ts#NodeCrux",+ "name": "NodeCrux",+ "kind": "interface",+ "path": "src/ai/crux.ts",+ "span": "L35-L40",+ "signature": "interface NodeCrux",+ "exported": true,+ "origin": "ast",+ "body_hash": "df4fb16fefdd35c322e1af2e13c09a9afff91dbd0e96584daaec163aa147c1cd",+ "summary_state": "ready",+ "summary": "Represents the summarized information for a code definition in the file.",+ "crux": {+ "code": "export interface NodeCrux {\n id: string;\n summary: string;\n crux_start: number; // file line, within the symbol's span; 0 = no distinct crux\n crux_end: number;\n}",+ "span": "L35-L40"+ }+ },+ {+ "id": "src/ai/crux.ts#NodeRef",+ "name": "NodeRef",+ "kind": "interface",+ "path": "src/ai/crux.ts",+ "span": "L21-L27",+ "signature": "interface NodeRef",+ "exported": true,+ "origin": "ast",+ "body_hash": "5c9fb969ad7415cf5ba23dfaa412ca015165fe5f8ef98d626b780facc4f6492f",+ "summary_state": "ready",+ "summary": "Defines the structure for referencing a node in the code graph.",+ "crux": {+ "code": "export interface NodeRef {\n id: string;\n kind: Kind;\n signature: string | null;\n startLine: number; // 1-based file line where the definition starts\n endLine: number;\n}",+ "span": "L21-L27"+ }+ },+ {+ "id": "src/ai/crux.ts#numberLines",+ "name": "numberLines",+ "kind": "function",+ "path": "src/ai/crux.ts",+ "span": "L63-L70",+ "signature": "function numberLines(source: string): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "a80ad2a4410262e8c7ff4a8827e3c2f29bf357defa21d228d71b8d278b09acce",+ "summary_state": "ready",+ "summary": "Formats the source code into a numbered string for better readability.",+ "crux": {+ "code": "function numberLines(source: string): string {\n const clipped =\n source.length > MAX_CODE_CHARS ? `${source.slice(0, MAX_CODE_CHARS)}\\n… (truncated)` : source;\n return clipped\n .split(\"\\n\")\n .map((line, i) => `${i + 1}\\t${line}`)\n .join(\"\\n\");\n}",+ "span": "L63-L70"+ }+ },+ {+ "id": "src/ai/crux.ts#OpenRouterCruxSummarizer",+ "name": "OpenRouterCruxSummarizer",+ "kind": "class",+ "path": "src/ai/crux.ts",+ "span": "L101-L127",+ "signature": "class OpenRouterCruxSummarizer implements CruxSummarizer",+ "exported": true,+ "origin": "ast",+ "body_hash": "20704346ba50c09895e6a19c3574156db46df9e20baa6286bf1bf6a479c2650b",+ "summary_state": "ready",+ "summary": "Implements the CruxSummarizer interface using OpenAI's chat API for summarization.",+ "crux": {+ "code": "export class OpenRouterCruxSummarizer implements CruxSummarizer {\n private client: OpenAI;\n private model: string;\n\n constructor(apiKey: string, model: string, baseUrl = \"https://openrouter.ai/api/v1\") {\n this.client = new OpenAI({\n apiKey,\n baseURL: baseUrl,\n defaultHeaders: { \"X-Title\": \"Context Graph Engine\" },\n });\n this.model = model;\n }",+ "span": "L101-L112"+ }+ },+ {+ "id": "src/ai/crux.ts#OpenRouterCruxSummarizer.constructor",+ "name": "constructor",+ "kind": "method",+ "path": "src/ai/crux.ts",+ "span": "L105-L112",+ "signature": "constructor(apiKey: string, model: string, baseUrl = \"https://openrouter.ai/api/v1\")",+ "exported": true,+ "origin": "ast",+ "body_hash": "11789569c2566d5187db773c70ebb755e57415aafb4b2d35fd3473dfdfda4958",+ "summary_state": "ready",+ "summary": "Initializes the OpenRouterCruxSummarizer with API key and model.",+ "crux": {+ "code": " constructor(apiKey: string, model: string, baseUrl = \"https://openrouter.ai/api/v1\") {\n this.client = new OpenAI({\n apiKey,\n baseURL: baseUrl,\n defaultHeaders: { \"X-Title\": \"Context Graph Engine\" },\n });\n this.model = model;\n }",+ "span": "L105-L112"+ }+ },+ {+ "id": "src/ai/crux.ts#OpenRouterCruxSummarizer.describeFile",+ "name": "describeFile",+ "kind": "method",+ "path": "src/ai/crux.ts",+ "span": "L114-L126",+ "signature": "async describeFile(input: FileCruxInput): Promise<NodeCrux[]>",+ "exported": true,+ "origin": "ast",+ "body_hash": "f9db855cb28cb76a21cabb928924cf83d145fc206bce5c340d4615c260653e18",+ "summary_state": "ready",+ "summary": "Generates summaries for the code definitions in a given file.",+ "crux": {+ "code": " async describeFile(input: FileCruxInput): Promise<NodeCrux[]> {\n if (input.nodes.length === 0) return [];\n const response = await this.client.chat.completions.create({\n model: this.model,\n temperature: 0,\n response_format: { type: \"json_object\" },\n messages: [\n { role: \"system\", content: SYSTEM_PROMPT },\n { role: \"user\", content: userContent(input) },\n ],\n });\n return parseResults(response.choices[0]?.message?.content ?? \"\");",+ "span": "L114-L125"+ }+ },+ {+ "id": "src/ai/crux.ts#parseResults",+ "name": "parseResults",+ "kind": "function",+ "path": "src/ai/crux.ts",+ "span": "L84-L98",+ "signature": "function parseResults(raw: string): NodeCrux[]",+ "exported": false,+ "origin": "ast",+ "body_hash": "91399ce86a0308307952e61ac203bef3df08f912fe4bfdab3ef7260ae6830da1",+ "summary_state": "ready",+ "summary": "Parses the JSON response from the summarization model into a usable format.",+ "crux": {+ "code": "function parseResults(raw: string): NodeCrux[] {\n const text = raw.trim().replace(/^```(?:json)?\\s*/i, \"\").replace(/\\s*```$/, \"\");\n const obj = JSON.parse(text) as { symbols?: unknown };\n if (!Array.isArray(obj.symbols)) return [];\n const num = (v: unknown) => (typeof v === \"number\" && Number.isFinite(v) ? Math.trunc(v) : 0);\n return obj.symbols\n .map((s) => s as Record<string, unknown>)\n .filter((s) => typeof s.id === \"string\")\n .map((s) => ({\n id: s.id as string,\n summary: typeof s.summary === \"string\" ? s.summary.trim() : \"\",\n crux_start: num(s.crux_start),",+ "span": "L84-L95"+ }+ },+ {+ "id": "src/ai/crux.ts#parseResults.num",+ "name": "num",+ "kind": "function",+ "path": "src/ai/crux.ts",+ "span": "L88-L88",+ "signature": "num = (v: unknown)",+ "exported": false,+ "origin": "ast",+ "body_hash": "63e8d8e280862f40666698b44f9fb1b4ca58c1712ed8c1f3266c59b683c83471",+ "summary_state": "ready",+ "summary": "This function converts a potentially non-finite number to a finite integer or zero, ensuring valid numerical output.",+ "crux": {+ "code": " const num = (v: unknown) => (typeof v === \"number\" && Number.isFinite(v) ? Math.trunc(v) : 0);",+ "span": "L88-L88"+ }+ },+ {+ "id": "src/ai/crux.ts#userContent",+ "name": "userContent",+ "kind": "function",+ "path": "src/ai/crux.ts",+ "span": "L72-L81",+ "signature": "function userContent(input: FileCruxInput): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "c69c7e7741d7da1191a463b960489184527e8d4e0deae84306011fae6469159e",+ "summary_state": "ready",+ "summary": "Constructs a user content string that includes file details and target nodes.",+ "crux": {+ "code": "function userContent(input: FileCruxInput): string {\n const targets = input.nodes\n .map(\n (n) =>\n `- id=${n.id} | ${n.kind} | lines L${n.startLine}-L${n.endLine}` +\n (n.signature ? ` | ${n.signature}` : \"\"),\n )\n .join(\"\\n\");\n return `FILE: ${input.path}\\n\\n${numberLines(input.source)}\\n\\nTARGETS:\\n${targets}`;\n}",+ "span": "L72-L81"+ }+ },+ {+ "id": "src/ai/providers.ts",+ "name": "providers.ts",+ "kind": "file",+ "path": "src/ai/providers.ts",+ "span": "L1-L56",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "c0d1294d6fa49f6d06ff9bb137b34ea897f94a67810a839cd5705a1fa5995483",+ "summary_state": "ready",+ "summary": "This file defines configurations for an AI engine, allowing customization and default settings for its operation.",+ "crux": null+ },+ {+ "id": "src/ai/providers.ts#EngineConfig",+ "name": "EngineConfig",+ "kind": "interface",+ "path": "src/ai/providers.ts",+ "span": "L9-L25",+ "signature": "interface EngineConfig",+ "exported": true,+ "origin": "ast",+ "body_hash": "a7457b873338ce2ea7e53be6eca715bcbfce5cc85dd0d8b770145702027e6836",+ "summary_state": "ready",+ "summary": "EngineConfig provides a structure for user-defined settings, enabling flexibility in configuring the AI engine's behavior.",+ "crux": null+ },+ {+ "id": "src/ai/providers.ts#resolveConfig",+ "name": "resolveConfig",+ "kind": "function",+ "path": "src/ai/providers.ts",+ "span": "L43-L55",+ "signature": "function resolveConfig(config: EngineConfig = {}): ResolvedConfig",+ "exported": true,+ "origin": "ast",+ "body_hash": "9bc6a9e9d026366226705cba49e3d45fc68ee309ec3106c750983cba9d292bad",+ "summary_state": "ready",+ "summary": "resolveConfig combines user configuration with environment variables and defaults to produce a complete configuration for the AI engine.",+ "crux": {+ "code": " contextDir: config.contextDir ?? env.GRAFT_DIR,\n openrouterApiKey: config.openrouterApiKey ?? env.OPENROUTER_API_KEY,\n openrouterModel:\n config.openrouterModel ?? env.GRAFT_OPENROUTER_MODEL ?? DEFAULTS.openrouterModel,\n openrouterBaseUrl:\n config.openrouterBaseUrl ?? env.OPENROUTER_BASE_URL ?? DEFAULTS.openrouterBaseUrl,",+ "span": "L46-L51"+ }+ },+ {+ "id": "src/ai/providers.ts#ResolvedConfig",+ "name": "ResolvedConfig",+ "kind": "interface",+ "path": "src/ai/providers.ts",+ "span": "L28-L35",+ "signature": "interface ResolvedConfig",+ "exported": true,+ "origin": "ast",+ "body_hash": "7f4ebf13b13a0cf260534237a8b8ee71fb2dfa23c113c63aa860169af6d6ad70",+ "summary_state": "ready",+ "summary": "ResolvedConfig represents the final configuration after merging user inputs with defaults and environment variables, ensuring all necessary settings are available.",+ "crux": null+ },+ {+ "id": "src/ai/summarize.ts",+ "name": "summarize.ts",+ "kind": "file",+ "path": "src/ai/summarize.ts",+ "span": "L1-L62",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "6e67f3866c75d88a8b1d265e510578f3e3014d9cfd8b2469e6e4afbd67977f93",+ "summary_state": "ready",+ "summary": "This file provides functionality to summarize source code files into plain English for a knowledge graph.",+ "crux": {+ "code": "/**\n * Turns one source-code file into a short prose summary for the knowledge graph.\n *\n * Code repos are deliberately NOT fed through the per-chunk entity extractor:\n * static structure is better served by grep/tree-sitter in the consuming agent,\n * and LLM extraction over raw code produces noisy, duplicated entities. Instead\n * the repo ingest path summarizes each file into plain English (purpose, key\n * exports, dependencies, design decisions) and ingests those summaries — prose\n * the existing extraction pipeline is actually good at.",+ "span": "L3-L11"+ }+ },+ {+ "id": "src/ai/summarize.ts#OpenRouterSummarizer",+ "name": "OpenRouterSummarizer",+ "kind": "class",+ "path": "src/ai/summarize.ts",+ "span": "L37-L61",+ "signature": "class OpenRouterSummarizer implements Summarizer",+ "exported": true,+ "origin": "ast",+ "body_hash": "d5ccc8425da5d5e01cb9d0371aa4b7f6ddc27ca2f5b33d06315b2141b1ba5f44",+ "summary_state": "ready",+ "summary": "The OpenRouterSummarizer class implements the Summarizer interface using OpenAI's chat API to generate summaries.",+ "crux": {+ "code": "export class OpenRouterSummarizer implements Summarizer {\n private client: OpenAI;\n private model: string;\n\n constructor(apiKey: string, model: string, baseUrl = \"https://openrouter.ai/api/v1\") {\n this.client = new OpenAI({\n apiKey,\n baseURL: baseUrl,\n defaultHeaders: { \"X-Title\": \"Context Graph Engine\" },\n });\n this.model = model;\n }",+ "span": "L37-L48"+ }+ },+ {+ "id": "src/ai/summarize.ts#OpenRouterSummarizer.constructor",+ "name": "constructor",+ "kind": "method",+ "path": "src/ai/summarize.ts",+ "span": "L41-L48",+ "signature": "constructor(apiKey: string, model: string, baseUrl = \"https://openrouter.ai/api/v1\")",+ "exported": true,+ "origin": "ast",+ "body_hash": "11789569c2566d5187db773c70ebb755e57415aafb4b2d35fd3473dfdfda4958",+ "summary_state": "ready",+ "summary": "The constructor initializes the OpenRouterSummarizer with an API key and model for making API calls.",+ "crux": {+ "code": " constructor(apiKey: string, model: string, baseUrl = \"https://openrouter.ai/api/v1\") {\n this.client = new OpenAI({\n apiKey,\n baseURL: baseUrl,\n defaultHeaders: { \"X-Title\": \"Context Graph Engine\" },\n });\n this.model = model;\n }",+ "span": "L41-L48"+ }+ },+ {+ "id": "src/ai/summarize.ts#OpenRouterSummarizer.summarize",+ "name": "summarize",+ "kind": "method",+ "path": "src/ai/summarize.ts",+ "span": "L50-L60",+ "signature": "async summarize(code: string, opts: { path: string }): Promise<string>",+ "exported": true,+ "origin": "ast",+ "body_hash": "b87a1b9c3fa411f6d60e20f3668c506deaf6675277847809f4da00b7bde5d2b7",+ "summary_state": "ready",+ "summary": "The summarize method generates a summary of the provided code by interacting with the OpenAI API.",+ "crux": {+ "code": " const response = await this.client.chat.completions.create({\n model: this.model,\n temperature: 0,\n messages: [\n { role: \"system\", content: SYSTEM_PROMPT },\n { role: \"user\", content: userContent(code, opts.path) },\n ],\n });\n return response.choices[0]?.message?.content?.trim() ?? \"\";",+ "span": "L51-L59"+ }+ },+ {+ "id": "src/ai/summarize.ts#Summarizer",+ "name": "Summarizer",+ "kind": "interface",+ "path": "src/ai/summarize.ts",+ "span": "L13-L15",+ "signature": "interface Summarizer",+ "exported": true,+ "origin": "ast",+ "body_hash": "53141087f1297119f32328d09c2f9289dcb09ab0ca3d9ac4b066be98e868166e",+ "summary_state": "ready",+ "summary": "The Summarizer interface defines a contract for summarizing source code files.",+ "crux": null+ },+ {+ "id": "src/ai/summarize.ts#userContent",+ "name": "userContent",+ "kind": "function",+ "path": "src/ai/summarize.ts",+ "span": "L28-L34",+ "signature": "function userContent(code: string, path: string): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "96aac9962d6811777880bc7062fa497e9cc46e103b7c4620c2d84eaf7d8e4ba2",+ "summary_state": "ready",+ "summary": "The userContent function formats the source code and its path into a structured string for summarization.",+ "crux": {+ "code": " code.length > MAX_CODE_CHARS\n ? `${code.slice(0, MAX_CODE_CHARS)}\\n… (truncated at ${MAX_CODE_CHARS} characters)`\n : code;\n return `File: ${path}\\n\\n${clipped}`;",+ "span": "L30-L33"+ }+ },+ {+ "id": "src/ai/synthesize.ts",+ "name": "synthesize.ts",+ "kind": "file",+ "path": "src/ai/synthesize.ts",+ "span": "L1-L165",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "982ab91da10ae51fdba64466cbb614db14a51f2e100bb12a72178961d8dd97d7",+ "summary_state": "ready",+ "summary": "This file defines the architecture for synthesizing a graph of nodes from file summaries, enabling a structured representation of a codebase.",+ "crux": {+ "code": "const SYSTEM_PROMPT = `You build an ARCHITECTURE graph of a codebase from per-file summaries. The reader is an AI agent that will read this graph before working on the code, so it must describe the system at the level a senior engineer would explain it — not file by file.\n\nProduce a CURATED set of nodes of mixed granularity:\n- \"system\" nodes: GROUP files that collaborate as one component (usually a directory or a cohesive set) into a SINGLE node. This should be the most common node type. Prefer one system node over several file nodes.\n- \"file\" nodes: only for a substantial, standalone module that genuinely deserves its own node apart from its system.\n- \"concept\" nodes: cross-cutting ideas, design decisions, or invariants that span multiple files (e.g. \"local-first provider fallback\", \"staleness checking\", \"content-hash provenance\"). Include several — they are the most valuable nodes for an agent.\n\nRules:\n- Strongly prefer FEWER, larger, meaningful nodes. For a repo of N files, aim for well under N nodes. Do NOT emit one node per file, and never a node per incidental identifier (a local interface, helper, or third-party symbol).\n- Merge duplicates and surface-form variants into one node.\n- For each node give: a canonical human-readable name; a type (\"system\" | \"file\" | \"concept\"); a 1-3 sentence summary of its ROLE in the system; \"sources\" = the exact file paths (from the input) it is grounded in (a system lists all its files; a concept lists the files that motivate it); and \"links\" to other nodes you define, each with a relation and a short description of what concretely happens in the code.\n- The relation MUST be one of exactly these verbs (each answers a question a code reviewer asks): \"part_of\" (where does this live?), \"uses\" (what breaks if the target changes?), \"depends_on\" (same, for non-call dependencies), \"produces\" (where does this output come from?), \"configures\" (what changes its behavior without a code change?), \"validates\" (what checks or judges this? tests, drift checks, scoring), \"implements\" (what contract must this honor?). Never invent vague relations like \"influences\", \"supports\", or \"relates_to\" — if none of the verbs fit, drop the link.",+ "span": "L39-L50"+ }+ },+ {+ "id": "src/ai/synthesize.ts#clean",+ "name": "clean",+ "kind": "function",+ "path": "src/ai/synthesize.ts",+ "span": "L100-L122",+ "signature": "function clean(nodes: unknown): SynthNode[]",+ "exported": false,+ "origin": "ast",+ "body_hash": "2344d8c4c88dd2126c437bedfed4688859387f3303ae33aae9a056f42ff7bad8",+ "summary_state": "ready",+ "summary": "Normalizes and cleans a raw model response into a structured array of SynthNode objects.",+ "crux": {+ "code": " if (!Array.isArray(nodes)) return [];\n const out: SynthNode[] = [];\n for (const n of nodes as Array<Record<string, unknown>>) {\n if (!n || typeof n.name !== \"string\" || typeof n.type !== \"string\") continue;\n out.push({\n name: n.name,\n type: n.type,\n summary: typeof n.summary === \"string\" ? n.summary : \"\",\n sources: Array.isArray(n.sources) ? (n.sources as unknown[]).filter((s): s is string => typeof s === \"string\") : [],\n links: Array.isArray(n.links)\n ? (n.links as Array<Record<string, unknown>>)\n .filter((l) => l && typeof l.to === \"string\" && typeof l.relation === \"string\")",+ "span": "L101-L112"+ }+ },+ {+ "id": "src/ai/synthesize.ts#FileSummary",+ "name": "FileSummary",+ "kind": "interface",+ "path": "src/ai/synthesize.ts",+ "span": "L30-L33",+ "signature": "interface FileSummary",+ "exported": true,+ "origin": "ast",+ "body_hash": "4c10af76458e184f8d32e13ead75fdbba2b173af7e915f3b6378f895b64bacff",+ "summary_state": "ready",+ "summary": "Holds the summary information for a single file, including its path and a descriptive summary.",+ "crux": {+ "code": " path: string;\n summary: string;",+ "span": "L31-L32"+ }+ },+ {+ "id": "src/ai/synthesize.ts#OpenRouterSynthesizer",+ "name": "OpenRouterSynthesizer",+ "kind": "class",+ "path": "src/ai/synthesize.ts",+ "span": "L134-L163",+ "signature": "class OpenRouterSynthesizer implements Synthesizer",+ "exported": true,+ "origin": "ast",+ "body_hash": "8281c93146b94be4f6d884607e02a9fe4d3a48537eb10044253dcdbe5394c8ac",+ "summary_state": "ready",+ "summary": "Implements the Synthesizer interface using OpenRouter's API to generate nodes from file summaries.",+ "crux": {+ "code": " async synthesize(files: FileSummary[]): Promise<SynthNode[]> {\n if (files.length === 0) return [];\n const response = await this.client.chat.completions.create({\n model: this.model,\n temperature: 0,\n tools: [RECORD_TOOL],\n tool_choice: { type: \"function\", function: { name: \"record_graph\" } },\n messages: [\n { role: \"system\", content: SYSTEM_PROMPT },\n { role: \"user\", content: userContent(files) },\n ],\n });",+ "span": "L143-L154"+ }+ },+ {+ "id": "src/ai/synthesize.ts#OpenRouterSynthesizer.constructor",+ "name": "constructor",+ "kind": "method",+ "path": "src/ai/synthesize.ts",+ "span": "L138-L141",+ "signature": "constructor(apiKey: string, model: string, baseUrl = \"https://openrouter.ai/api/v1\")",+ "exported": true,+ "origin": "ast",+ "body_hash": "20d1ed2a31c60772d22eb649c1eb6d3cb646b80d751cce76eb8e71c6cc3018a6",+ "summary_state": "ready",+ "summary": "Initializes the OpenRouterSynthesizer with API key, model, and optional base URL for the OpenAI client.",+ "crux": {+ "code": " constructor(apiKey: string, model: string, baseUrl = \"https://openrouter.ai/api/v1\") {\n this.client = new OpenAI({ apiKey, baseURL: baseUrl, defaultHeaders: { \"X-Title\": \"Context Graph Engine\" } });\n this.model = model;\n }",+ "span": "L138-L141"+ }+ },+ {+ "id": "src/ai/synthesize.ts#OpenRouterSynthesizer.synthesize",+ "name": "synthesize",+ "kind": "method",+ "path": "src/ai/synthesize.ts",+ "span": "L143-L162",+ "signature": "async synthesize(files: FileSummary[]): Promise<SynthNode[]>",+ "exported": true,+ "origin": "ast",+ "body_hash": "f1b94e63417194a18be9062aa3f46838f9c92d65231ceea54d554ecc2aadc767",+ "summary_state": "ready",+ "summary": "Processes an array of file summaries to produce a structured array of SynthNode objects by interacting with the OpenAI API.",+ "crux": {+ "code": " if (files.length === 0) return [];\n const response = await this.client.chat.completions.create({\n model: this.model,\n temperature: 0,\n tools: [RECORD_TOOL],\n tool_choice: { type: \"function\", function: { name: \"record_graph\" } },\n messages: [\n { role: \"system\", content: SYSTEM_PROMPT },\n { role: \"user\", content: userContent(files) },\n ],\n });\n const call = response.choices[0]?.message?.tool_calls?.[0];",+ "span": "L144-L155"+ }+ },+ {+ "id": "src/ai/synthesize.ts#Synthesizer",+ "name": "Synthesizer",+ "kind": "interface",+ "path": "src/ai/synthesize.ts",+ "span": "L35-L37",+ "signature": "interface Synthesizer",+ "exported": true,+ "origin": "ast",+ "body_hash": "55ed4f6b07f808a7591164fad62527f00d6c042c12f5ff1445f29edaf2674d74",+ "summary_state": "ready",+ "summary": "Defines the interface for synthesizers that convert file summaries into structured nodes.",+ "crux": null+ },+ {+ "id": "src/ai/synthesize.ts#SynthLink",+ "name": "SynthLink",+ "kind": "interface",+ "path": "src/ai/synthesize.ts",+ "span": "L12-L16",+ "signature": "interface SynthLink",+ "exported": true,+ "origin": "ast",+ "body_hash": "0881e19e19cb63095252ce3b817cad3adb83241167ae37dfc274d245e3e9caac",+ "summary_state": "ready",+ "summary": "Defines the structure of a directed edge between nodes, specifying relationships in the synthesized graph.",+ "crux": {+ "code": " to: string;\n relation: string;\n description?: string;",+ "span": "L13-L15"+ }+ },+ {+ "id": "src/ai/synthesize.ts#SynthNode",+ "name": "SynthNode",+ "kind": "interface",+ "path": "src/ai/synthesize.ts",+ "span": "L19-L27",+ "signature": "interface SynthNode",+ "exported": true,+ "origin": "ast",+ "body_hash": "b53b2a25e45cfe4a931d93e2a908bafb4ea7d5fe1a02282a18af3f2010b14277",+ "summary_state": "ready",+ "summary": "Represents a node in the synthesized graph, encapsulating its name, type, summary, sources, and links to other nodes.",+ "crux": {+ "code": " name: string;\n /** system | api | file | concept */\n type: string;\n summary: string;\n /** Source file paths (from the provided set) this node is grounded in. */\n sources: string[];\n links: SynthLink[];",+ "span": "L20-L26"+ }+ },+ {+ "id": "src/ai/synthesize.ts#userContent",+ "name": "userContent",+ "kind": "function",+ "path": "src/ai/synthesize.ts",+ "span": "L92-L97",+ "signature": "function userContent(files: FileSummary[]): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "6873b0a9e5dedbebac883fdce991492dd5d2260990d1dd440dcaa60b1bb1c4e9",+ "summary_state": "ready",+ "summary": "Constructs a formatted string from an array of file summaries, ensuring it does not exceed a specified character limit.",+ "crux": {+ "code": " const body = files.map((f) => `## ${f.path}\\n\\n${f.summary}`).join(\"\\n\\n\");\n return body.length > MAX_INPUT_CHARS\n ? `${body.slice(0, MAX_INPUT_CHARS)}\\n… (truncated)`\n : body;",+ "span": "L93-L96"+ }+ },+ {+ "id": "src/ask/ask.ts",+ "name": "ask.ts",+ "kind": "file",+ "path": "src/ask/ask.ts",+ "span": "L1-L277",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "62415cb36e835e8a5e9329a770489a726028284b8f40497beba6a721ecf05e21",+ "summary_state": "ready",+ "summary": "This file implements a query routing tool that processes natural language queries to return relevant context from a codebase.",+ "crux": null+ },+ {+ "id": "src/ask/ask.ts#ask",+ "name": "ask",+ "kind": "function",+ "path": "src/ask/ask.ts",+ "span": "L242-L252",+ "signature": "function ask(dir: string, query: string, opts: AskOptions = {}): AskResult",+ "exported": true,+ "origin": "ast",+ "body_hash": "c025c4d20293ee7c251599d4bb566b5083a1d259963706f24d33c3c8074f5719",+ "summary_state": "ready",+ "summary": "Handles a query by loading the appropriate corpus and executing either structural or lexical search.",+ "crux": {+ "code": " const s = structural(query, corpus.graph, limit);\n if (s) return s;\n }",+ "span": "L248-L250"+ }+ },+ {+ "id": "src/ask/ask.ts#AskHit",+ "name": "AskHit",+ "kind": "interface",+ "path": "src/ask/ask.ts",+ "span": "L23-L32",+ "signature": "interface AskHit",+ "exported": true,+ "origin": "ast",+ "body_hash": "990a0462418d06bfb0c6debc05ef1267d263ca5eb436928e441444da89a62227",+ "summary_state": "ready",+ "summary": "Represents a hit in the query results, encapsulating details about a concept or symbol found in the codebase.",+ "crux": null+ },+ {+ "id": "src/ask/ask.ts#AskOptions",+ "name": "AskOptions",+ "kind": "interface",+ "path": "src/ask/ask.ts",+ "span": "L236-L239",+ "signature": "interface AskOptions",+ "exported": true,+ "origin": "ast",+ "body_hash": "36b587f0f7a73149b5024a13a7ac4ff596fc101ce5de200ea50bbc0159f517b3",+ "summary_state": "ready",+ "summary": "Defines options for the ask function, allowing customization of the query context and result limits.",+ "crux": null+ },+ {+ "id": "src/ask/ask.ts#AskResult",+ "name": "AskResult",+ "kind": "interface",+ "path": "src/ask/ask.ts",+ "span": "L34-L41",+ "signature": "interface AskResult",+ "exported": true,+ "origin": "ast",+ "body_hash": "385acaee56a1f36f6f8dbafd0dcdb0e539ca47a774b1f14ec0d7ae2dde5b0101",+ "summary_state": "ready",+ "summary": "Encapsulates the result of a query, including the query string, mode of operation, and the hits found.",+ "crux": null+ },+ {+ "id": "src/ask/ask.ts#Corpus",+ "name": "Corpus",+ "kind": "interface",+ "path": "src/ask/ask.ts",+ "span": "L75-L78",+ "signature": "interface Corpus",+ "exported": false,+ "origin": "ast",+ "body_hash": "8f29f53a7eb72207fae41ba9a163ddbe90d6105fa62f4c7c48153eb895ccecfb",+ "summary_state": "ready",+ "summary": "Defines the structure for a corpus containing concepts and a graph, used for processing queries.",+ "crux": null+ },+ {+ "id": "src/ask/ask.ts#counts",+ "name": "counts",+ "kind": "function",+ "path": "src/ask/ask.ts",+ "span": "L59-L63",+ "signature": "function counts(tokens: string[]): Map<string, number>",+ "exported": false,+ "origin": "ast",+ "body_hash": "55edb54385b8591bd6442f62f998d9d774eda8c15abd3e368e4b3a8086c84112",+ "summary_state": "ready",+ "summary": "Creates a frequency count map of tokens, allowing for analysis of term occurrences in a document.",+ "crux": {+ "code": " const m = new Map<string, number>();\n for (const t of tokens) m.set(t, (m.get(t) ?? 0) + 1);\n return m;",+ "span": "L60-L62"+ }+ },+ {+ "id": "src/ask/ask.ts#findSubject",+ "name": "findSubject",+ "kind": "function",+ "path": "src/ask/ask.ts",+ "span": "L125-L143",+ "signature": "function findSubject(query: string, graph: GraphV1): NodeV1[]",+ "exported": false,+ "origin": "ast",+ "body_hash": "a4ca179ce0a30c212e9481f8da15176f2df209dbe21de3a600b1bf74f1728071",+ "summary_state": "ready",+ "summary": "Identifies the most relevant symbols in the graph that match the query, prioritizing exact name matches.",+ "crux": {+ "code": "function findSubject(query: string, graph: GraphV1): NodeV1[] {\n const byName = new Map<string, NodeV1[]>();\n for (const n of graph.nodes) {\n if (n.kind === \"file\") continue;\n const key = n.name.toLowerCase();\n byName.set(key, [...(byName.get(key) ?? []), n]);\n }\n const words = query.split(/[^A-Za-z0-9_.]+/).filter(Boolean);\n let best: NodeV1[] = [];\n let bestLen = 0;\n for (const w of words) {\n const hit = byName.get(w.toLowerCase());",+ "span": "L125-L136"+ }+ },+ {+ "id": "src/ask/ask.ts#firstProse",+ "name": "firstProse",+ "kind": "function",+ "path": "src/ask/ask.ts",+ "span": "L66-L73",+ "signature": "function firstProse(body: string): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "29dae1ad2ad4bdf2c695c5a817addfb02012d8d1c4093dac9d61bb8d35ef34c5",+ "summary_state": "ready",+ "summary": "Extracts the first meaningful prose line from a body of text, ignoring headings and blank lines.",+ "crux": {+ "code": "function firstProse(body: string): string {\n for (const raw of body.split(\"\\n\")) {\n const line = raw.trim();\n if (!line || line.startsWith(\"#\") || line.startsWith(\"<!--\") || line.startsWith(\"-\")) continue;\n return line;",+ "span": "L66-L70"+ }+ },+ {+ "id": "src/ask/ask.ts#formatAsk",+ "name": "formatAsk",+ "kind": "function",+ "path": "src/ask/ask.ts",+ "span": "L255-L276",+ "signature": "function formatAsk(r: AskResult): string",+ "exported": true,+ "origin": "ast",+ "body_hash": "655f23a018eff9da0eee605dfea6bca21949cda37f6d5a5265a2f83cdb84ab69",+ "summary_state": "ready",+ "summary": "Formats the results of an AskResult into a markdown string for easy presentation.",+ "crux": {+ "code": "export function formatAsk(r: AskResult): string {\n const head = `graft ask — \"${r.query}\" (${r.mode}${r.note ? `: ${r.note}` : \"\"})`;\n if (r.hits.length === 0) {\n return `${head}\\n\\n${r.note ?? \"no matches.\"}`;\n }\n const lines = [head, \"\"];\n if (r.mode === \"structural\") {\n for (const h of r.hits) {\n const tail = h.snippet ? ` — ${h.snippet}` : \"\";\n lines.push(`- ${h.title} ${h.pointer} (${h.relation})${tail}`);\n }\n } else {",+ "span": "L255-L266"+ }+ },+ {+ "id": "src/ask/ask.ts#lexical",+ "name": "lexical",+ "kind": "function",+ "path": "src/ask/ask.ts",+ "span": "L190-L234",+ "signature": "function lexical(query: string, corpus: Corpus, limit: number): AskResult",+ "exported": false,+ "origin": "ast",+ "body_hash": "e0bc699f1554d18d6384e1b5be7f042880937e06b973b93ff5ed38167c4bb84c",+ "summary_state": "ready",+ "summary": "Ranks concepts and symbols based on lexical matching with the query, returning the most relevant results.",+ "crux": {+ "code": "function lexical(query: string, corpus: Corpus, limit: number): AskResult {\n const q = counts(tokenize(query));\n const scored: AskHit[] = [];\n\n for (const c of corpus.concepts) {\n const nameScore = score(q, counts(tokenize(c.name))) * 3;\n const bodyScore = score(q, counts(tokenize(c.text)));\n const total = nameScore + bodyScore;\n if (total > 0) {\n scored.push({\n kind: \"concept\",\n title: c.name || c.slug,",+ "span": "L190-L201"+ }+ },+ {+ "id": "src/ask/ask.ts#loadCorpus",+ "name": "loadCorpus",+ "kind": "function",+ "path": "src/ask/ask.ts",+ "span": "L80-L105",+ "signature": "function loadCorpus(outDir: string): Corpus",+ "exported": false,+ "origin": "ast",+ "body_hash": "f786c06a38416a071db52498f73fc733ac330d19e507c5127f83992f61a6900f",+ "summary_state": "ready",+ "summary": "Loads a corpus from a specified directory, extracting concepts and building a graph for query processing.",+ "crux": {+ "code": " const snippet = firstProse(parsed.content);\n concepts.push({\n slug: String(fm.slug ?? entry.replace(/\\.md$/, \"\")),\n name: String(fm.name ?? \"\"),\n sources,\n related,\n snippet,\n text: `${fm.name ?? \"\"} ${snippet} ${sources.join(\" \")}`,\n });",+ "span": "L93-L101"+ }+ },+ {+ "id": "src/ask/ask.ts#score",+ "name": "score",+ "kind": "function",+ "path": "src/ask/ask.ts",+ "span": "L108-L115",+ "signature": "function score(query: Map<string, number>, doc: Map<string, number>): number",+ "exported": false,+ "origin": "ast",+ "body_hash": "54f8b9f6a5d14966e01000fe77bd71e2f1898431946f12653203351c5be39a80",+ "summary_state": "ready",+ "summary": "Calculates a score for a document's token counts against a query, facilitating relevance ranking.",+ "crux": {+ "code": "function score(query: Map<string, number>, doc: Map<string, number>): number {\n let s = 0;\n for (const [t, qn] of query) {\n const dn = doc.get(t);\n if (dn) s += qn * dn;\n }\n return s;",+ "span": "L108-L114"+ }+ },+ {+ "id": "src/ask/ask.ts#structural",+ "name": "structural",+ "kind": "function",+ "path": "src/ask/ask.ts",+ "span": "L145-L186",+ "signature": "function structural(query: string, graph: GraphV1, limit: number): AskResult | null",+ "exported": false,+ "origin": "ast",+ "body_hash": "c45c0934ab5e0b17ed1fefd0855cb0fe293ee2ff106308599f4d218172a91652",+ "summary_state": "ready",+ "summary": "Processes a structural query to find and return relevant callers or callees from the graph based on the query.",+ "crux": {+ "code": " if (!wantsIn && !wantsOut) return null;\n\n const subjects = findSubject(query, graph);\n if (subjects.length === 0) return null;\n\n const ids = new Set(subjects.map((n) => n.id));\n const byId = new Map(graph.nodes.map((n) => [n.id, n]));\n const outgoing = wantsOut && !wantsIn; // \"what does X call / import\" — else default to callers\n const rels = new Set(outgoing ? OUTGOING_RELS : INCOMING_RELS);\n\n const hits: AskHit[] = [];\n const seen = new Set<string>();",+ "span": "L148-L159"+ }+ },+ {+ "id": "src/ask/ask.ts#tokenize",+ "name": "tokenize",+ "kind": "function",+ "path": "src/ask/ask.ts",+ "span": "L50-L56",+ "signature": "function tokenize(text: string): string[]",+ "exported": false,+ "origin": "ast",+ "body_hash": "d97d4f8b5422d7b236c0966ab1b1b82002c4691a389eff29fd97e93460269f21",+ "summary_state": "ready",+ "summary": "Transforms a string of text into an array of lowercased subword tokens, filtering out common stop words.",+ "crux": {+ "code": " return text\n .replace(/([a-z0-9])([A-Z])/g, \"$1 $2\") // camelCase → camel Case\n .toLowerCase()\n .split(/[^a-z0-9]+/)\n .filter((t) => t.length > 1 && !STOP.has(t));",+ "span": "L51-L55"+ }+ },+ {+ "id": "src/cli.ts",+ "name": "cli.ts",+ "kind": "file",+ "path": "src/cli.ts",+ "span": "L1-L166",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "294b01aae943b958a291aa17387fe05439ca3b5ffe1a4ed97a4a2c378dcd7947",+ "summary_state": "ready",+ "summary": "This file implements the `graft` CLI tool for building and maintaining a context graph from code, ensuring synchronization and providing querying capabilities.",+ "crux": null+ },+ {+ "id": "src/cli.ts#engineFrom",+ "name": "engineFrom",+ "kind": "function",+ "path": "src/cli.ts",+ "span": "L26-L29",+ "signature": "function engineFrom(): Graft",+ "exported": false,+ "origin": "ast",+ "body_hash": "ddbb4f4e57bee5d05b95dc81f034e26183495162d84c6a290e12c6fda6c92ee8",+ "summary_state": "ready",+ "summary": "Creates an instance of the Graft engine configured with the specified context directory.",+ "crux": {+ "code": " return new Graft({ contextDir: opts.dir });",+ "span": "L28-L28"+ }+ },+ {+ "id": "src/cli.ts#fmt",+ "name": "fmt",+ "kind": "function",+ "path": "src/cli.ts",+ "span": "L42-L46",+ "signature": "fmt = (o: Record<string, number>)",+ "exported": false,+ "origin": "ast",+ "body_hash": "31c01b913d716a1932fff4c3a0e4a82dfa745d73f488f05b3d71910145bf98ad",+ "summary_state": "ready",+ "summary": "Formats a record of counts into a human-readable string for console output.",+ "crux": {+ "code": " const fmt = (o: Record<string, number>) =>\n Object.entries(o)\n .sort((a, b) => b[1] - a[1])\n .map(([k, n]) => `${n} ${k}`)\n .join(\", \");",+ "span": "L42-L46"+ }+ },+ {+ "id": "src/context/build.ts",+ "name": "build.ts",+ "kind": "file",+ "path": "src/context/build.ts",+ "span": "L1-L350",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "8c614e5dc6b1ef2d6949016ce7480099f95f021ea6b0882f2919397f97a68ce7",+ "summary_state": "ready",+ "summary": "This file builds a context graph from a code repository by summarizing source files and synthesizing nodes.",+ "crux": {+ "code": "export async function buildContext(dir: string, opts: BuildOptions): Promise<BuildResult> {\n const root = resolve(dir);\n const outDir = contextDirFor(root, opts.contextDir);\n const exts = opts.extensions ?? CODE_EXTENSIONS;\n const files = walkDir(root)\n .filter((f) => exts.some((e) => f.toLowerCase().endsWith(e)))\n .filter((f) => !f.startsWith(outDir));\n\n const cache = loadCache(outDir);\n const result: BuildResult = {\n contextDir: outDir,\n files: 0,",+ "span": "L99-L110"+ }+ },+ {+ "id": "src/context/build.ts#batchBySize",+ "name": "batchBySize",+ "kind": "function",+ "path": "src/context/build.ts",+ "span": "L269-L285",+ "signature": "function batchBySize(files: FileSummary[], budget: number): FileSummary[][]",+ "exported": false,+ "origin": "ast",+ "body_hash": "5875cfc2eae35e10fbe5105c48209f37d2b121b15dff5a0ebf1bb9dbf96f8eb7",+ "summary_state": "ready",+ "summary": "Groups file summaries into batches that fit within a specified character budget for processing.",+ "crux": {+ "code": "function batchBySize(files: FileSummary[], budget: number): FileSummary[][] {\n const batches: FileSummary[][] = [];\n let cur: FileSummary[] = [];\n let size = 0;\n for (const f of files) {\n const len = f.path.length + f.summary.length + 8;\n if (cur.length > 0 && size + len > budget) {\n batches.push(cur);\n cur = [];\n size = 0;\n }\n cur.push(f);",+ "span": "L269-L280"+ }+ },+ {+ "id": "src/context/build.ts#batchKey",+ "name": "batchKey",+ "kind": "function",+ "path": "src/context/build.ts",+ "span": "L288-L295",+ "signature": "function batchKey(batch: FileSummary[], hashByPath: Map<string, string>): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "8fece338d989b714e96a275a7d4febdf2292a4a25590ce4b3ec73d6be5b45827",+ "summary_state": "ready",+ "summary": "Generates a stable key for a batch of file summaries based on their content hashes.",+ "crux": {+ "code": "function batchKey(batch: FileSummary[], hashByPath: Map<string, string>): string {\n return contentHash(\n batch\n .map((f) => `${f.path}:${hashByPath.get(f.path) ?? \"\"}`)\n .sort()\n .join(\"\\n\"),\n );\n}",+ "span": "L288-L295"+ }+ },+ {+ "id": "src/context/build.ts#BuildCache",+ "name": "BuildCache",+ "kind": "interface",+ "path": "src/context/build.ts",+ "span": "L78-L81",+ "signature": "interface BuildCache",+ "exported": false,+ "origin": "ast",+ "body_hash": "c359f1a92e6d72b2734f0ff2f8f38879f95eca1af6ddb47c4c6cab0f62a32133",+ "summary_state": "ready",+ "summary": "Stores cached summaries and synthesized nodes to optimize the build process.",+ "crux": {+ "code": "interface BuildCache {\n summaries: Record<string, { hash: string; summary: string }>;\n synth: Record<string, SynthNode[]>;\n}",+ "span": "L78-L81"+ }+ },+ {+ "id": "src/context/build.ts#buildContext",+ "name": "buildContext",+ "kind": "function",+ "path": "src/context/build.ts",+ "span": "L99-L266",+ "signature": "async function buildContext(dir: string, opts: BuildOptions): Promise<BuildResult>",+ "exported": true,+ "origin": "ast",+ "body_hash": "e2afee780fd3be28d7cf55c8aa3fdfebc10ddb1ec63ffbe50f5e712a4625c0f2",+ "summary_state": "ready",+ "summary": "Main function that orchestrates the building of the context graph from the source files.",+ "crux": {+ "code": " // Phase 1: summarize each file, concurrent, content-hash cached.\n const work = await mapWithConcurrency(files, 8, async (file, i): Promise<FileWork | undefined> => {\n const rel = relative(root, file);\n opts.onProgress?.({ phase: \"summarize\", index: i, total: files.length, file: rel });\n let code: string;\n try {\n code = readFileSync(file, \"utf8\");\n } catch (err) {\n result.errors.push(`${rel}: ${errMsg(err)}`);\n return undefined;\n }\n const hash = contentHash(code);",+ "span": "L119-L130"+ }+ },+ {+ "id": "src/context/build.ts#BuildOptions",+ "name": "BuildOptions",+ "kind": "interface",+ "path": "src/context/build.ts",+ "span": "L54-L64",+ "signature": "interface BuildOptions",+ "exported": true,+ "origin": "ast",+ "body_hash": "a8c3781581f56372337a3c3ddd980b7be084f78b359820f8540ec384807c57a8",+ "summary_state": "ready",+ "summary": "Defines options for customizing the build process, including output directory and model settings.",+ "crux": {+ "code": "export interface BuildOptions {\n /** Override the output dir (default: `<root>/.context`). */\n contextDir?: string;\n /** Extensions to treat as code. Default: {@link CODE_EXTENSIONS}. */\n extensions?: string[];\n /** Human label for the model, recorded in the manifest (e.g. \"openrouter:openai/gpt-4o-mini\"). */\n model: string;\n summarizer: Summarizer;\n synthesizer: Synthesizer;\n onProgress?: (info: BuildProgress) => void;\n}",+ "span": "L54-L64"+ }+ },+ {+ "id": "src/context/build.ts#BuildProgress",+ "name": "BuildProgress",+ "kind": "interface",+ "path": "src/context/build.ts",+ "span": "L47-L52",+ "signature": "interface BuildProgress",+ "exported": true,+ "origin": "ast",+ "body_hash": "144303735947dfd0c43c5a58e2f8d53ad35ad62b438f65c29c51a56e1dfa56b2",+ "summary_state": "ready",+ "summary": "Tracks the progress of the build process across different phases.",+ "crux": {+ "code": " phase: \"summarize\" | \"synthesize\" | \"write\";\n index: number;\n total: number;\n file: string;\n}",+ "span": "L48-L52"+ }+ },+ {+ "id": "src/context/build.ts#BuildResult",+ "name": "BuildResult",+ "kind": "interface",+ "path": "src/context/build.ts",+ "span": "L66-L75",+ "signature": "interface BuildResult",+ "exported": true,+ "origin": "ast",+ "body_hash": "5d4316f8de68fbeba849eaa7a8b12892855205f006361e2a32049e135cf9407e",+ "summary_state": "ready",+ "summary": "Holds the results of the build process, including counts of files and nodes processed.",+ "crux": {+ "code": "export interface BuildResult {\n contextDir: string;\n files: number;\n summarized: number;\n cached: number;\n batches: number;\n nodes: number;\n links: number;\n errors: string[];\n}",+ "span": "L66-L75"+ }+ },+ {+ "id": "src/context/build.ts#cachePath",+ "name": "cachePath",+ "kind": "function",+ "path": "src/context/build.ts",+ "span": "L310-L312",+ "signature": "function cachePath(outDir: string): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "ff252b490e39f50d7aa97d0a9fc2ad6330248f194cf27cc31981329e833fb8aa",+ "summary_state": "ready",+ "summary": "Constructs the file path for the cache storage based on the output directory.",+ "crux": {+ "code": "function cachePath(outDir: string): string {\n return join(outDir, CACHE_DIR, \"summaries.json\");\n}",+ "span": "L310-L312"+ }+ },+ {+ "id": "src/context/build.ts#errMsg",+ "name": "errMsg",+ "kind": "function",+ "path": "src/context/build.ts",+ "span": "L306-L308",+ "signature": "function errMsg(err: unknown): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "79993b725e730fcec35e4a32479a51dfba694b5c9bf900db729b6fc821caee71",+ "summary_state": "ready",+ "summary": "Formats error messages for better readability.",+ "crux": {+ "code": "function errMsg(err: unknown): string {\n return err instanceof Error ? err.message : String(err);\n}",+ "span": "L306-L308"+ }+ },+ {+ "id": "src/context/build.ts#FileWork",+ "name": "FileWork",+ "kind": "interface",+ "path": "src/context/build.ts",+ "span": "L83-L87",+ "signature": "interface FileWork",+ "exported": false,+ "origin": "ast",+ "body_hash": "06db66a9c25581eac975d533a049ce38bfed463080492389915feb84d9634171",+ "summary_state": "ready",+ "summary": "Represents the work done on each file during the build process, including its summary and hash.",+ "crux": {+ "code": "interface FileWork {\n rel: string;\n hash: string;\n summary?: string;\n}",+ "span": "L83-L87"+ }+ },+ {+ "id": "src/context/build.ts#loadCache",+ "name": "loadCache",+ "kind": "function",+ "path": "src/context/build.ts",+ "span": "L314-L325",+ "signature": "function loadCache(outDir: string): BuildCache",+ "exported": false,+ "origin": "ast",+ "body_hash": "8f0f4b949cd4d774433b4043ef9d154fa5722e45d19f69fb4fb1843c4071a3af",+ "summary_state": "ready",+ "summary": "Loads the build cache from disk, returning existing summaries and synthesized nodes.",+ "crux": {+ "code": "function loadCache(outDir: string): BuildCache {\n const path = cachePath(outDir);\n if (existsSync(path)) {\n try {\n const parsed = JSON.parse(readFileSync(path, \"utf8\")) as Partial<BuildCache>;\n return { summaries: parsed.summaries ?? {}, synth: parsed.synth ?? {} };\n } catch {\n /* fall through to empty */\n }\n }\n return { summaries: {}, synth: {} };\n}",+ "span": "L314-L325"+ }+ },+ {+ "id": "src/context/build.ts#mapWithConcurrency",+ "name": "mapWithConcurrency",+ "kind": "function",+ "path": "src/context/build.ts",+ "span": "L334-L349",+ "signature": "async function mapWithConcurrency<T, R>( items: T[], limit: number, fn: (item: T, index: number) => Promise<R>, ): Promise<R[]>",+ "exported": false,+ "origin": "ast",+ "body_hash": "a4c9438ba7cb397b91c5ab695f081e20db5678db9eea0be35a086fda1d9714e5",+ "summary_state": "ready",+ "summary": "Executes a function over a list of items with a limit on concurrent executions, preserving order.",+ "crux": {+ "code": "async function mapWithConcurrency<T, R>(\n items: T[],\n limit: number,\n fn: (item: T, index: number) => Promise<R>,\n): Promise<R[]> {\n const results: R[] = new Array(items.length);\n let next = 0;\n const workers = Array.from({ length: Math.min(limit, items.length) }, async () => {\n while (next < items.length) {\n const i = next++;\n results[i] = await fn(items[i], i);\n }",+ "span": "L334-L345"+ }+ },+ {+ "id": "src/context/build.ts#NodeDraft",+ "name": "NodeDraft",+ "kind": "interface",+ "path": "src/context/build.ts",+ "span": "L90-L97",+ "signature": "interface NodeDraft",+ "exported": false,+ "origin": "ast",+ "body_hash": "8ced91ed9a81f2acf4c6047b5091d9d972531cda6c94dfeacd8f52032a37e479",+ "summary_state": "ready",+ "summary": "Represents a node being constructed before finalizing its properties and links.",+ "crux": {+ "code": "interface NodeDraft {\n name: string;\n slug: string;\n type: string;\n summary: string;\n sources: Map<string, string>; // path → hash\n links: Map<string, NodeLink>; // \"to|relation\" → link\n}",+ "span": "L90-L97"+ }+ },+ {+ "id": "src/context/build.ts#registerName",+ "name": "registerName",+ "kind": "function",+ "path": "src/context/build.ts",+ "span": "L297-L300",+ "signature": "function registerName(table: Map<string, string>, name: string, slug: string): void",+ "exported": false,+ "origin": "ast",+ "body_hash": "19baf28fe22be9ee095b9158cc475114b372193f75407ad731aff306f455d432",+ "summary_state": "ready",+ "summary": "Registers a name and its corresponding slug in a mapping table to avoid duplicates.",+ "crux": {+ "code": "function registerName(table: Map<string, string>, name: string, slug: string): void {\n const key = name.trim().toLowerCase();\n if (key && !table.has(key)) table.set(key, slug);\n}",+ "span": "L297-L300"+ }+ },+ {+ "id": "src/context/build.ts#resolveSlug",+ "name": "resolveSlug",+ "kind": "function",+ "path": "src/context/build.ts",+ "span": "L302-L304",+ "signature": "function resolveSlug(table: Map<string, string>, name: string): string | undefined",+ "exported": false,+ "origin": "ast",+ "body_hash": "e3b335543a5eb9e316abcb762fcc43a8e66ef10b9217c3b5682958d58eccb40b",+ "summary_state": "ready",+ "summary": "Retrieves the slug associated with a given name from a mapping table.",+ "crux": {+ "code": "function resolveSlug(table: Map<string, string>, name: string): string | undefined {\n return table.get(name.trim().toLowerCase());\n}",+ "span": "L302-L304"+ }+ },+ {+ "id": "src/context/build.ts#saveCache",+ "name": "saveCache",+ "kind": "function",+ "path": "src/context/build.ts",+ "span": "L327-L331",+ "signature": "function saveCache(outDir: string, cache: BuildCache): void",+ "exported": false,+ "origin": "ast",+ "body_hash": "858a9e1dd3769382de94bbf1c7dc76b4c137a777872fca251d2d214eb185a6e3",+ "summary_state": "ready",+ "summary": "Saves the current build cache to disk to persist summaries and synthesized nodes.",+ "crux": {+ "code": "function saveCache(outDir: string, cache: BuildCache): void {\n const path = cachePath(outDir);\n mkdirSync(join(outDir, CACHE_DIR), { recursive: true });\n writeFileSync(path, JSON.stringify(cache, null, 2));\n}",+ "span": "L327-L331"+ }+ },+ {+ "id": "src/context/check.ts",+ "name": "check.ts",+ "kind": "file",+ "path": "src/context/check.ts",+ "span": "L1-L140",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "2444e1f4dfd78208a9b54942364ee1811d064459857c6d6cee178426e278d481",+ "summary_state": "ready",+ "summary": "This file provides functionality to verify if the committed context graph is synchronized with the current codebase, ensuring consistency in CI environments.",+ "crux": {+ "code": " const manifest = readManifest(outDir);\n if (!manifest) {\n result.missing = true;\n return result;\n }\n\n // Current code files on disk (same rules `init` used).\n const current = new Map<string, string>(); // rel → hash\n for (const file of walkDir(root)) {\n if (file.startsWith(outDir)) continue;\n if (!exts.some((e) => file.toLowerCase().endsWith(e))) continue;\n try {",+ "span": "L51-L62"+ }+ },+ {+ "id": "src/context/check.ts#checkContext",+ "name": "checkContext",+ "kind": "function",+ "path": "src/context/check.ts",+ "span": "L37-L107",+ "signature": "function checkContext(dir: string, opts: CheckOptions = {}): CheckResult",+ "exported": true,+ "origin": "ast",+ "body_hash": "06ef9cdf299314884c2c167ef2b07261c310fa4973c392ec8f951354e4657195",+ "summary_state": "ready",+ "summary": "Checks the current state of the context graph against the recorded manifest, identifying any content drift, removals, or coverage issues.",+ "crux": {+ "code": " result.ok =\n result.contentDrift.length === 0 &&\n result.removed.length === 0 &&\n result.coverage.length === 0 &&\n result.indexDrift.length === 0;\n return result;",+ "span": "L101-L106"+ }+ },+ {+ "id": "src/context/check.ts#CheckOptions",+ "name": "CheckOptions",+ "kind": "interface",+ "path": "src/context/check.ts",+ "span": "L32-L35",+ "signature": "interface CheckOptions",+ "exported": true,+ "origin": "ast",+ "body_hash": "9ea98ccd24c4398fa3c15b57991778a2c5f300000220e01c3e36e0b52093f097",+ "summary_state": "ready",+ "summary": "Specifies optional parameters for the checkContext function, allowing customization of the context directory and file extensions to check.",+ "crux": null+ },+ {+ "id": "src/context/check.ts#CheckResult",+ "name": "CheckResult",+ "kind": "interface",+ "path": "src/context/check.ts",+ "span": "L22-L30",+ "signature": "interface CheckResult",+ "exported": true,+ "origin": "ast",+ "body_hash": "91144295d6967be1d7e9675698c39f552001f149346f052f92582dcb23353a6c",+ "summary_state": "ready",+ "summary": "Defines the structure of the result returned by the checkContext function, encapsulating the status and details of any discrepancies found.",+ "crux": null+ },+ {+ "id": "src/context/check.ts#formatCheckReport",+ "name": "formatCheckReport",+ "kind": "function",+ "path": "src/context/check.ts",+ "span": "L110-L135",+ "signature": "function formatCheckReport(r: CheckResult): string",+ "exported": true,+ "origin": "ast",+ "body_hash": "b1b96c36f7f186373c1d51db9acd9b9a975e7197a9a75d8c4cd8e821990228d3",+ "summary_state": "ready",+ "summary": "Generates a human-readable report summarizing the results of the checkContext function, detailing any discrepancies found.",+ "crux": {+ "code": " const lines: string[] = [\"graft check: STALE\", \"\"];\n if (r.contentDrift.length) {\n lines.push(`changed (${r.contentDrift.length}):`);\n for (const c of r.contentDrift) lines.push(` ~ ${c.path} (${c.from} → ${c.to})`);\n }\n if (r.removed.length) {\n lines.push(`removed (${r.removed.length}):`);\n for (const p of r.removed) lines.push(` - ${p}`);\n }\n if (r.coverage.length) {\n lines.push(`not in graph (${r.coverage.length}):`);\n for (const p of r.coverage) lines.push(` + ${p}`);",+ "span": "L116-L127"+ }+ },+ {+ "id": "src/context/check.ts#short",+ "name": "short",+ "kind": "function",+ "path": "src/context/check.ts",+ "span": "L137-L139",+ "signature": "function short(hash: string): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "174b5d08d0283571566816317520c72d2d9a1416f660ce45a854c34aa4cb45e6",+ "summary_state": "ready",+ "summary": "Shortens a hash string to its first eight characters for easier readability in reports.",+ "crux": {+ "code": "function short(hash: string): string {\n return hash.slice(0, 8);\n}",+ "span": "L137-L139"+ }+ },+ {+ "id": "src/context/node-file.ts",+ "name": "node-file.ts",+ "kind": "file",+ "path": "src/context/node-file.ts",+ "span": "L1-L230",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "9e958d74597b4d6d31fa5391882ddab8faab4076d7d33f93de861ab6c2e0b93a",+ "summary_state": "ready",+ "summary": "This file defines the structure and operations for managing a context graph represented as markdown files.",+ "crux": {+ "code": "/**\n * The on-disk format of the context graph: a folder of plain markdown files\n * under `.context/`, one per node. The files ARE the graph — the frontmatter\n * carries the machine-readable node (identity, source provenance, edges) and\n * the body is human/agent-readable prose. There is no database.",+ "span": "L1-L5"+ }+ },+ {+ "id": "src/context/node-file.ts#contextDirFor",+ "name": "contextDirFor",+ "kind": "function",+ "path": "src/context/node-file.ts",+ "span": "L100-L103",+ "signature": "function contextDirFor(root: string, override?: string): string",+ "exported": true,+ "origin": "ast",+ "body_hash": "bff3e70e01fbfde31e41893ba3bc3d41dc29b9359c55dd9333670aa02aecc088",+ "summary_state": "ready",+ "summary": "Determines the absolute path for the graft directory in a repository, allowing for file operations.",+ "crux": {+ "code": "export function contextDirFor(root: string, override?: string): string {\n if (override) return override;\n return join(root, \"graft\");\n}",+ "span": "L100-L103"+ }+ },+ {+ "id": "src/context/node-file.ts#ContextNode",+ "name": "ContextNode",+ "kind": "interface",+ "path": "src/context/node-file.ts",+ "span": "L43-L58",+ "signature": "interface ContextNode",+ "exported": true,+ "origin": "ast",+ "body_hash": "6cb97dab12942b8742efa5c785547222aa0350e75d994ccc99f0e1867f1e09d3",+ "summary_state": "ready",+ "summary": "Models a single node in the context graph, encapsulating its metadata and relationships.",+ "crux": {+ "code": "export interface ContextNode {\n name: string;\n slug: string;\n /** Coarse category from extraction: system | service | api | concept | … */\n type: string;\n /** Prose description that becomes the node body. */\n summary: string;\n /** Source files that produced this node (empty only for hand-authored nodes). */\n sources: SourceRef[];\n /** sha256 over the sorted `path:hash` lines of {@link sources}. */\n sourcesDigest: string;\n /** Outbound edges. */",+ "span": "L43-L54"+ }+ },+ {+ "id": "src/context/node-file.ts#defaultHuman",+ "name": "defaultHuman",+ "kind": "function",+ "path": "src/context/node-file.ts",+ "span": "L121-L123",+ "signature": "function defaultHuman(): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "ea0f628a1792282addf319eaa6469945e4229bacdbba7ad9b44854bd5bfb5373",+ "summary_state": "ready",+ "summary": "Provides a default human-readable section for a new node, which is preserved in future generations.",+ "crux": {+ "code": "function defaultHuman(): string {\n return `\\n## Notes\\n\\n_Anything written below the generated block is preserved when the graph is regenerated._\\n`;\n}",+ "span": "L121-L123"+ }+ },+ {+ "id": "src/context/node-file.ts#deleteNode",+ "name": "deleteNode",+ "kind": "function",+ "path": "src/context/node-file.ts",+ "span": "L211-L214",+ "signature": "function deleteNode(dir: string, slug: string): void",+ "exported": true,+ "origin": "ast",+ "body_hash": "49e161325092c3caf6c1b6d39d78b2d948445dd7609a72f9490e4898e9a973d3",+ "summary_state": "ready",+ "summary": "Deletes a specified node file from the filesystem, if it exists.",+ "crux": {+ "code": "export function deleteNode(dir: string, slug: string): void {\n const path = join(dir, `${slug}.md`);\n if (existsSync(path)) rmSync(path);\n}",+ "span": "L211-L214"+ }+ },+ {+ "id": "src/context/node-file.ts#digestSources",+ "name": "digestSources",+ "kind": "function",+ "path": "src/context/node-file.ts",+ "span": "L89-L95",+ "signature": "function digestSources(sources: SourceRef[]): string",+ "exported": true,+ "origin": "ast",+ "body_hash": "4c53e7543bc40ada4b0b0d853a6af071965175bef7b90980fa911149b2d691db",+ "summary_state": "ready",+ "summary": "Calculates a SHA256 hash over the sorted lines of source file paths and hashes to ensure integrity.",+ "crux": {+ "code": "export function digestSources(sources: SourceRef[]): string {\n const lines = sources\n .map((s) => `${s.path}:${s.hash}`)\n .sort()\n .join(\"\\n\");\n return contentHash(lines);\n}",+ "span": "L89-L95"+ }+ },+ {+ "id": "src/context/node-file.ts#existingNodeSlugs",+ "name": "existingNodeSlugs",+ "kind": "function",+ "path": "src/context/node-file.ts",+ "span": "L201-L208",+ "signature": "function existingNodeSlugs(dir: string): Set<string>",+ "exported": true,+ "origin": "ast",+ "body_hash": "2f1f56206f2ae542e8cfaeebc0e3b9cc3e245a83f5ed7c70e4124d3d985a6403",+ "summary_state": "ready",+ "summary": "Lists the slugs of existing node files in a directory, aiding in the management of deleted nodes.",+ "crux": {+ "code": "export function existingNodeSlugs(dir: string): Set<string> {\n if (!existsSync(dir)) return new Set();\n return new Set(\n readdirSync(dir)\n .filter((e) => e.endsWith(\".md\") && e !== \"INDEX.md\")\n .map((e) => e.replace(/\\.md$/, \"\")),\n );\n}",+ "span": "L201-L208"+ }+ },+ {+ "id": "src/context/node-file.ts#Manifest",+ "name": "Manifest",+ "kind": "interface",+ "path": "src/context/node-file.ts",+ "span": "L61-L71",+ "signature": "interface Manifest",+ "exported": true,+ "origin": "ast",+ "body_hash": "5caafb5633830210bfe7a9d72a8d202f01560f80e2195995013a437e5ab59202",+ "summary_state": "ready",+ "summary": "Represents the generated index of all nodes and their metadata for quick access and integrity checks.",+ "crux": {+ "code": "export interface Manifest {\n version: number;\n /** Human label for the model that built the graph, e.g. \"openrouter:openai/gpt-4o-mini\". */\n model: string;\n /** sha256 over every source file's `path:hash` — the whole-graph fingerprint. */\n repoDigest: string;\n /** Every source file `init` processed, with its hash. The staleness ground-truth. */\n files: SourceRef[];\n /** Node roster (a subset of each node's frontmatter, for fast reads). */\n nodes: Array<{ slug: string; name: string; type: string; sources: string[]; sourcesDigest: string }>;\n}",+ "span": "L61-L71"+ }+ },+ {+ "id": "src/context/node-file.ts#NodeLink",+ "name": "NodeLink",+ "kind": "interface",+ "path": "src/context/node-file.ts",+ "span": "L36-L40",+ "signature": "interface NodeLink",+ "exported": true,+ "origin": "ast",+ "body_hash": "126d9b834cb0560714092dabc06b13ac71402695d797a7b770040112c180d9a5",+ "summary_state": "ready",+ "summary": "Defines a directed edge to another node, capturing the relationship and optional description.",+ "crux": {+ "code": "export interface NodeLink {\n to: string;\n relation: string;\n description?: string;\n}",+ "span": "L36-L40"+ }+ },+ {+ "id": "src/context/node-file.ts#ParsedNode",+ "name": "ParsedNode",+ "kind": "interface",+ "path": "src/context/node-file.ts",+ "span": "L172-L179",+ "signature": "interface ParsedNode",+ "exported": true,+ "origin": "ast",+ "body_hash": "1ffb557b4f3f224db4f31fd909bd40d4c25dfe521a4ce551e984167aa6365954",+ "summary_state": "ready",+ "summary": "Represents a parsed node file, capturing essential metadata without the body content.",+ "crux": {+ "code": "export interface ParsedNode {\n slug: string;\n name: string;\n type: string;\n sources: SourceRef[];\n sourcesDigest: string;\n links: NodeLink[];\n}",+ "span": "L172-L179"+ }+ },+ {+ "id": "src/context/node-file.ts#preserveHuman",+ "name": "preserveHuman",+ "kind": "function",+ "path": "src/context/node-file.ts",+ "span": "L148-L152",+ "signature": "function preserveHuman(existingContent: string): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "c36a99d53cd67a0c767859701d8efcf4e50c975709f8295b4a5579d9bda574aa",+ "summary_state": "ready",+ "summary": "Extracts the human region from an existing node file to ensure it is not lost during regeneration.",+ "crux": {+ "code": "function preserveHuman(existingContent: string): string {\n const idx = existingContent.indexOf(GEN_END);\n if (idx === -1) return defaultHuman();\n return existingContent.slice(idx + GEN_END.length).replace(/^\\n/, \"\");\n}",+ "span": "L148-L152"+ }+ },+ {+ "id": "src/context/node-file.ts#readManifest",+ "name": "readManifest",+ "kind": "function",+ "path": "src/context/node-file.ts",+ "span": "L221-L229",+ "signature": "function readManifest(dir: string): Manifest | undefined",+ "exported": true,+ "origin": "ast",+ "body_hash": "0e0c22b3cdad566ef833ddc0a4cc2e7be2c262ce50ecc63fbc2c7431c83d2549",+ "summary_state": "ready",+ "summary": "Reads and parses the manifest file from disk, returning its contents or undefined if not found.",+ "crux": {+ "code": "export function readManifest(dir: string): Manifest | undefined {\n const path = join(dir, MANIFEST_FILE);\n if (!existsSync(path)) return undefined;\n try {\n return JSON.parse(readFileSync(path, \"utf8\")) as Manifest;\n } catch {\n return undefined;\n }\n}",+ "span": "L221-L229"+ }+ },+ {+ "id": "src/context/node-file.ts#readNodes",+ "name": "readNodes",+ "kind": "function",+ "path": "src/context/node-file.ts",+ "span": "L182-L198",+ "signature": "function readNodes(dir: string): ParsedNode[]",+ "exported": true,+ "origin": "ast",+ "body_hash": "55afcb307fdd33693c8eec1154da27f67cf834744c42e4b061eb99f646592eb0",+ "summary_state": "ready",+ "summary": "Reads and parses all markdown node files in a specified directory, returning their metadata.",+ "crux": {+ "code": "export function readNodes(dir: string): ParsedNode[] {\n if (!existsSync(dir)) return [];\n const out: ParsedNode[] = [];\n for (const entry of readdirSync(dir)) {\n if (!entry.endsWith(\".md\") || entry === \"INDEX.md\") continue;\n const fm = matter(readFileSync(join(dir, entry), \"utf8\")).data as Record<string, unknown>;\n out.push({\n slug: String(fm.slug ?? entry.replace(/\\.md$/, \"\")),\n name: String(fm.name ?? \"\"),\n type: String(fm.type ?? \"\"),\n sources: Array.isArray(fm.sources) ? (fm.sources as SourceRef[]) : [],\n sourcesDigest: String(fm.sources_digest ?? \"\"),",+ "span": "L182-L193"+ }+ },+ {+ "id": "src/context/node-file.ts#renderGenerated",+ "name": "renderGenerated",+ "kind": "function",+ "path": "src/context/node-file.ts",+ "span": "L106-L118",+ "signature": "function renderGenerated(node: ContextNode): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "2e1f760d1c196c9bcbef16789bdb3d3860fc7c406e1b5f5745e7cf4bbe1f40f0",+ "summary_state": "ready",+ "summary": "Generates the markdown content for the summary and related links of a node.",+ "crux": {+ "code": "function renderGenerated(node: ContextNode): string {\n const lines = [`## Summary`, ``, node.summary.trim() || \"_(no summary)_\", ``];\n if (node.links.length > 0) {\n lines.push(`## Related`, ``);\n for (const link of [...node.links].sort((a, b) => a.to.localeCompare(b.to))) {\n const rel = link.relation.replace(/_/g, \" \");\n const tail = link.description ? ` — ${link.description}` : \"\";\n lines.push(`- ${rel} [[${link.to}]]${tail}`);\n }\n lines.push(``);\n }\n return lines.join(\"\\n\");",+ "span": "L106-L117"+ }+ },+ {+ "id": "src/context/node-file.ts#renderNodeFile",+ "name": "renderNodeFile",+ "kind": "function",+ "path": "src/context/node-file.ts",+ "span": "L126-L141",+ "signature": "function renderNodeFile(node: ContextNode): string",+ "exported": true,+ "origin": "ast",+ "body_hash": "f064173ff3e72f9f7f703694379edf165ba55d72949f4e6f097118e8e9d79a96",+ "summary_state": "ready",+ "summary": "Serializes a node into its complete markdown file format, including generated and human sections.",+ "crux": {+ "code": "export function renderNodeFile(node: ContextNode): string {\n const data = {\n name: node.name,\n slug: node.slug,\n type: node.type,\n sources: node.sources.map((s) => ({ path: s.path, hash: s.hash })),\n sources_digest: node.sourcesDigest,\n links: node.links.map((l) =>\n l.description ? { to: l.to, relation: l.relation, description: l.description } : { to: l.to, relation: l.relation },\n ),\n generator: { version: MANIFEST_VERSION },\n };",+ "span": "L126-L137"+ }+ },+ {+ "id": "src/context/node-file.ts#slugify",+ "name": "slugify",+ "kind": "function",+ "path": "src/context/node-file.ts",+ "span": "L81-L86",+ "signature": "function slugify(name: string): string",+ "exported": true,+ "origin": "ast",+ "body_hash": "70fca5f67f42bcb40f42175a26795d6a6ac72953f62ada7775a91d8300581fb0",+ "summary_state": "ready",+ "summary": "Converts a display name into a URL-safe slug for use in file naming and linking.",+ "crux": {+ "code": "export function slugify(name: string): string {\n const base = normalizeName(name)\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n return base || \"node\";\n}",+ "span": "L81-L86"+ }+ },+ {+ "id": "src/context/node-file.ts#SourceRef",+ "name": "SourceRef",+ "kind": "interface",+ "path": "src/context/node-file.ts",+ "span": "L30-L33",+ "signature": "interface SourceRef",+ "exported": true,+ "origin": "ast",+ "body_hash": "2603554df891243f1f9c13ab6639a48627c787e5869c2bf692fdd481ae5050dd",+ "summary_state": "ready",+ "summary": "Represents a source file that contributed to the creation of a node, including its content hash.",+ "crux": {+ "code": "export interface SourceRef {\n path: string;\n hash: string;\n}",+ "span": "L30-L33"+ }+ },+ {+ "id": "src/context/node-file.ts#writeManifest",+ "name": "writeManifest",+ "kind": "function",+ "path": "src/context/node-file.ts",+ "span": "L216-L219",+ "signature": "function writeManifest(dir: string, manifest: Manifest): void",+ "exported": true,+ "origin": "ast",+ "body_hash": "049e90311a97eda62d11bd8b35ed1debded19d6f06daa975c938287943e22d88",+ "summary_state": "ready",+ "summary": "Writes the manifest file to disk, containing metadata about the context graph.",+ "crux": {+ "code": "export function writeManifest(dir: string, manifest: Manifest): void {\n mkdirSync(dir, { recursive: true });\n writeFileSync(join(dir, MANIFEST_FILE), JSON.stringify(manifest, null, 2) + \"\\n\");\n}",+ "span": "L216-L219"+ }+ },+ {+ "id": "src/context/node-file.ts#writeNode",+ "name": "writeNode",+ "kind": "function",+ "path": "src/context/node-file.ts",+ "span": "L158-L169",+ "signature": "function writeNode(dir: string, node: ContextNode): string",+ "exported": true,+ "origin": "ast",+ "body_hash": "78ec07695ac8cf3949025497d7f56b47e5b8f0c16d6eb1dbe237c1ecc3e2fffe",+ "summary_state": "ready",+ "summary": "Writes a node to disk, preserving any existing human content and ensuring directory structure.",+ "crux": {+ "code": "export function writeNode(dir: string, node: ContextNode): string {\n mkdirSync(dir, { recursive: true });\n const path = join(dir, `${node.slug}.md`);\n if (existsSync(path)) {\n const parsed = matter(readFileSync(path, \"utf8\"));\n node = { ...node, human: preserveHuman(parsed.content) };\n } else {\n node = { ...node, human: node.human || defaultHuman() };\n }\n writeFileSync(path, renderNodeFile(node));\n return path;\n}",+ "span": "L158-L169"+ }+ },+ {+ "id": "src/engine.ts",+ "name": "engine.ts",+ "kind": "file",+ "path": "src/engine.ts",+ "span": "L1-L126",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "26307935c472954b6511e7352cf6c0f11ce53dd151ac2407e5fcadc0b9b7c01b",+ "summary_state": "ready",+ "summary": "This file implements the Context Graph Engine, which builds and checks a code context graph from a repository without a database.",+ "crux": {+ "code": "/**\n * The Context Graph Engine.\n *\n * Two operations, no database:\n * - {@link Graft.init} build `.context/` from a code repo.\n * - {@link Graft.check} report whether `.context/` is still in\n * sync with the code (for CI).\n *\n * The graph is a folder of linked markdown files committed to the repo; git is\n * the sync. This class wires the OpenRouter LLM providers into the build/check\n * pipelines; an API key is required for any LLM-backed operation.\n */",+ "span": "L1-L12"+ }+ },+ {+ "id": "src/engine.ts#CheckRunOptions",+ "name": "CheckRunOptions",+ "kind": "interface",+ "path": "src/engine.ts",+ "span": "L33-L35",+ "signature": "interface CheckRunOptions",+ "exported": true,+ "origin": "ast",+ "body_hash": "705bea732f08c471e6566f8b6621038988554944b4bf9eca74674cdf518bf9b1",+ "summary_state": "ready",+ "summary": "Specifies options for checking the context graph, allowing for code extensions to be included.",+ "crux": null+ },+ {+ "id": "src/engine.ts#Graft",+ "name": "Graft",+ "kind": "class",+ "path": "src/engine.ts",+ "span": "L43-L125",+ "signature": "class Graft",+ "exported": true,+ "origin": "ast",+ "body_hash": "64bc71b4d06ee6365c1848cd45b4375af6d26d2b7dd45d2ba81bb406813d271c",+ "summary_state": "ready",+ "summary": "The Graft class manages the context graph operations, including building and checking the graph against the codebase.",+ "crux": {+ "code": "export class Graft {\n private cfg: ResolvedConfig;\n\n constructor(config: EngineConfig = {}) {\n this.cfg = resolveConfig(config);\n }\n\n /** Build the `.context/` graph from the repo at `dir`. */\n async init(dir: string, opts: InitOptions = {}): Promise<BuildResult> {\n return buildContext(dir, {\n contextDir: this.cfg.contextDir,\n extensions: opts.extensions,",+ "span": "L43-L54"+ }+ },+ {+ "id": "src/engine.ts#Graft.ask",+ "name": "ask",+ "kind": "method",+ "path": "src/engine.ts",+ "span": "L90-L92",+ "signature": "ask(dir: string, query: string, opts: { limit?: number } = {}): AskResult",+ "exported": true,+ "origin": "ast",+ "body_hash": "a41f3683c1fcac67f48b6cc443e76bceba15b279b302ce847774a81fb0612285",+ "summary_state": "ready",+ "summary": "Processes a query against the committed graph, returning results based on structural and lexical rankings.",+ "crux": {+ "code": " ask(dir: string, query: string, opts: { limit?: number } = {}): AskResult {\n return ask(dir, query, { contextDir: this.cfg.contextDir, limit: opts.limit });\n }",+ "span": "L90-L92"+ }+ },+ {+ "id": "src/engine.ts#Graft.check",+ "name": "check",+ "kind": "method",+ "path": "src/engine.ts",+ "span": "L63-L65",+ "signature": "check(dir: string, opts: CheckRunOptions = {}): CheckResult",+ "exported": true,+ "origin": "ast",+ "body_hash": "c0ef54370f24e88b0dfc83f2dd21d3db0a44c44538b3ec8bd54d38fac8be2c49",+ "summary_state": "ready",+ "summary": "Checks if the committed context graph is in sync with the code in the specified directory.",+ "crux": {+ "code": " check(dir: string, opts: CheckRunOptions = {}): CheckResult {\n return checkContext(dir, { contextDir: this.cfg.contextDir, extensions: opts.extensions });\n }",+ "span": "L63-L65"+ }+ },+ {+ "id": "src/engine.ts#Graft.checkGraph",+ "name": "checkGraph",+ "kind": "method",+ "path": "src/engine.ts",+ "span": "L68-L70",+ "signature": "checkGraph(dir: string): GraphCheckResult",+ "exported": true,+ "origin": "ast",+ "body_hash": "eda4bef32536dd54b29cba56c59d4ea971625167a482e8fe15c5d799be81f870",+ "summary_state": "ready",+ "summary": "Verifies if the committed graph.json file is in sync with the code, focusing on the Tier-1 differences.",+ "crux": {+ "code": " checkGraph(dir: string): GraphCheckResult {\n return checkGraph(dir, { contextDir: this.cfg.contextDir });\n }",+ "span": "L68-L70"+ }+ },+ {+ "id": "src/engine.ts#Graft.constructor",+ "name": "constructor",+ "kind": "method",+ "path": "src/engine.ts",+ "span": "L46-L48",+ "signature": "constructor(config: EngineConfig = {})",+ "exported": true,+ "origin": "ast",+ "body_hash": "374d5de4021aadc3150f3cb521b536653584976599a4956fea4b26c40131c19f",+ "summary_state": "ready",+ "summary": "Initializes the Graft class with a configuration, resolving the necessary settings for the context graph.",+ "crux": {+ "code": " constructor(config: EngineConfig = {}) {\n this.cfg = resolveConfig(config);\n }",+ "span": "L46-L48"+ }+ },+ {+ "id": "src/engine.ts#Graft.cruxSummarizer",+ "name": "cruxSummarizer",+ "kind": "method",+ "path": "src/engine.ts",+ "span": "L111-L113",+ "signature": "private cruxSummarizer(): CruxSummarizer",+ "exported": true,+ "origin": "ast",+ "body_hash": "3b07279c83115a1232de5b510ce2f501f8699e7b8c70a052c4c455e136f01ca6",+ "summary_state": "ready",+ "summary": "Creates a crux summarizer for the code graph's Tier-2 pass, ensuring it is properly configured.",+ "crux": {+ "code": " private cruxSummarizer(): CruxSummarizer {\n return new OpenRouterCruxSummarizer(this.requireKey(), this.cfg.openrouterModel, this.cfg.openrouterBaseUrl);\n }",+ "span": "L111-L113"+ }+ },+ {+ "id": "src/engine.ts#Graft.graph",+ "name": "graph",+ "kind": "method",+ "path": "src/engine.ts",+ "span": "L77-L83",+ "signature": "graph(dir: string, opts: GraphRunOptions = {}): Promise<GraphBuildResult>",+ "exported": true,+ "origin": "ast",+ "body_hash": "227e5765f18483fe86dcc7c78c3955f141d0630c869b5111f2283366c8162a06",+ "summary_state": "ready",+ "summary": "Builds a per-symbol code graph in JSON format, optionally including a meaning layer based on the provided options.",+ "crux": {+ "code": " graph(dir: string, opts: GraphRunOptions = {}): Promise<GraphBuildResult> {\n return buildGraph(dir, {\n contextDir: this.cfg.contextDir,\n summarizer: opts.llm ? this.cruxSummarizer() : undefined,\n onProgress: opts.onProgress,\n });\n }",+ "span": "L77-L83"+ }+ },+ {+ "id": "src/engine.ts#Graft.init",+ "name": "init",+ "kind": "method",+ "path": "src/engine.ts",+ "span": "L51-L60",+ "signature": "async init(dir: string, opts: InitOptions = {}): Promise<BuildResult>",+ "exported": true,+ "origin": "ast",+ "body_hash": "7ee2e73a5a5412667db890e91f0f2abfb15b94ea1331db17aef0f841c348fbf1",+ "summary_state": "ready",+ "summary": "Builds the context graph from the specified directory, utilizing various options and configurations.",+ "crux": {+ "code": " async init(dir: string, opts: InitOptions = {}): Promise<BuildResult> {\n return buildContext(dir, {\n contextDir: this.cfg.contextDir,\n extensions: opts.extensions,\n model: this.modelLabel(),\n summarizer: this.summarizer(),\n synthesizer: this.synthesizer(),\n onProgress: opts.onProgress,\n });\n }",+ "span": "L51-L60"+ }+ },+ {+ "id": "src/engine.ts#Graft.modelLabel",+ "name": "modelLabel",+ "kind": "method",+ "path": "src/engine.ts",+ "span": "L121-L124",+ "signature": "private modelLabel(): string",+ "exported": true,+ "origin": "ast",+ "body_hash": "7034c4cd5e06b1b37f2ef068736f35fddaca136a3cae2ae5e595fda7efa2bd89",+ "summary_state": "ready",+ "summary": "Determines the human-readable label for the active model used in the context graph.",+ "crux": {+ "code": " private modelLabel(): string {\n if (this.cfg.synthesizer || this.cfg.summarizer) return \"custom\";\n return `openrouter:${this.cfg.openrouterModel}`;\n }",+ "span": "L121-L124"+ }+ },+ {+ "id": "src/engine.ts#Graft.requireKey",+ "name": "requireKey",+ "kind": "method",+ "path": "src/engine.ts",+ "span": "L95-L103",+ "signature": "private requireKey(): string",+ "exported": true,+ "origin": "ast",+ "body_hash": "9aed1d64896a6e8f8d3cd6c00e53f8e8baf2b424e0522d28408861b2f7c22912",+ "summary_state": "ready",+ "summary": "Ensures that a valid OpenRouter API key is available, throwing an error if it is not set.",+ "crux": {+ "code": " if (!this.cfg.openrouterApiKey) {\n throw new Error(\n \"No OpenRouter API key. Set OPENROUTER_API_KEY (get one at https://openrouter.ai/keys) \" +\n \"to build or summarize the graph.\",\n );\n }\n return this.cfg.openrouterApiKey;",+ "span": "L96-L102"+ }+ },+ {+ "id": "src/engine.ts#Graft.summarizer",+ "name": "summarizer",+ "kind": "method",+ "path": "src/engine.ts",+ "span": "L115-L118",+ "signature": "private summarizer(): Summarizer",+ "exported": true,+ "origin": "ast",+ "body_hash": "160e884c1dd10b916c36a737886880d98430fb84c5dd7828e69536b8198e3b2f",+ "summary_state": "ready",+ "summary": "Obtains the summarizer instance, initializing it if no custom summarizer is provided.",+ "crux": {+ "code": " private summarizer(): Summarizer {\n if (this.cfg.summarizer) return this.cfg.summarizer;\n return new OpenRouterSummarizer(this.requireKey(), this.cfg.openrouterModel, this.cfg.openrouterBaseUrl);\n }",+ "span": "L115-L118"+ }+ },+ {+ "id": "src/engine.ts#Graft.synthesizer",+ "name": "synthesizer",+ "kind": "method",+ "path": "src/engine.ts",+ "span": "L105-L108",+ "signature": "private synthesizer(): Synthesizer",+ "exported": true,+ "origin": "ast",+ "body_hash": "2a65f2a449bd40274d81542edfb36e20ceb8cf0160b030e8bd42b9698a386d20",+ "summary_state": "ready",+ "summary": "Retrieves the synthesizer instance, creating one if it is not already configured.",+ "crux": {+ "code": " private synthesizer(): Synthesizer {\n if (this.cfg.synthesizer) return this.cfg.synthesizer;\n return new OpenRouterSynthesizer(this.requireKey(), this.cfg.openrouterModel, this.cfg.openrouterBaseUrl);\n }",+ "span": "L105-L108"+ }+ },+ {+ "id": "src/engine.ts#GraphRunOptions",+ "name": "GraphRunOptions",+ "kind": "interface",+ "path": "src/engine.ts",+ "span": "L37-L41",+ "signature": "interface GraphRunOptions",+ "exported": true,+ "origin": "ast",+ "body_hash": "39ff67f6cc34aa0019b25dcee492776cfbb3872146ec3920492b97331fca894b",+ "summary_state": "ready",+ "summary": "Holds options for running the graph build, including whether to use a Tier-2 LLM meaning pass.",+ "crux": null+ },+ {+ "id": "src/engine.ts#InitOptions",+ "name": "InitOptions",+ "kind": "interface",+ "path": "src/engine.ts",+ "span": "L26-L31",+ "signature": "interface InitOptions",+ "exported": true,+ "origin": "ast",+ "body_hash": "4a606cc2ac6df47d7b50de2a7ce33b2bd85e5dad93bea127871b9b952ddb0f8a",+ "summary_state": "ready",+ "summary": "Defines options for initializing the context graph build, including code extensions and a progress callback.",+ "crux": null+ },+ {+ "id": "src/graph/build.ts",+ "name": "build.ts",+ "kind": "file",+ "path": "src/graph/build.ts",+ "span": "L1-L144",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "8b05c94896ca63d9c66bf5b3340db53cb8600d536a36880a3012599edf1b3a44",+ "summary_state": "ready",+ "summary": "This file defines the logic to build a graph representation of a code repository, facilitating analysis and visualization of its structure.",+ "crux": {+ "code": " const edges = resolveEdges(nodes, rawEdges);\n\n // graph.json is its own Tier-2 cache: fold in the prior meaning layer so an\n // unchanged body is never re-summarized (and a Tier-1-only run never wipes it).\n const prior = readGraph(wiringPath(outDir));\n const priorById = new Map((prior?.nodes ?? []).map((n) => [n.id, n]));\n const meaning = await enrichGraph(nodes, priorById, sources, {\n summarizer: opts.summarizer,\n onProgress: ({ index, total, node }) =>\n opts.onProgress?.({ phase: \"enrich\", index, total, file: node }),\n });\n errors.push(...meaning.errors);",+ "span": "L91-L102"+ }+ },+ {+ "id": "src/graph/build.ts#buildGraph",+ "name": "buildGraph",+ "kind": "function",+ "path": "src/graph/build.ts",+ "span": "L55-L143",+ "signature": "async function buildGraph( dir: string, opts: GraphBuildOptions = {}, ): Promise<GraphBuildResult>",+ "exported": true,+ "origin": "ast",+ "body_hash": "694834a4a621098b82506032a8e46930190050190c3c0231bf264f8404529465",+ "summary_state": "ready",+ "summary": "This function orchestrates the process of building a graph from source files, including parsing, enriching, and writing the graph data.",+ "crux": {+ "code": " const edges = resolveEdges(nodes, rawEdges);\n\n // graph.json is its own Tier-2 cache: fold in the prior meaning layer so an\n // unchanged body is never re-summarized (and a Tier-1-only run never wipes it).\n const prior = readGraph(wiringPath(outDir));\n const priorById = new Map((prior?.nodes ?? []).map((n) => [n.id, n]));\n const meaning = await enrichGraph(nodes, priorById, sources, {\n summarizer: opts.summarizer,\n onProgress: ({ index, total, node }) =>\n opts.onProgress?.({ phase: \"enrich\", index, total, file: node }),\n });\n errors.push(...meaning.errors);",+ "span": "L91-L102"+ }+ },+ {+ "id": "src/graph/build.ts#GraphBuildOptions",+ "name": "GraphBuildOptions",+ "kind": "interface",+ "path": "src/graph/build.ts",+ "span": "L22-L33",+ "signature": "interface GraphBuildOptions",+ "exported": true,+ "origin": "ast",+ "body_hash": "71abfa189c81e3297978ab399e0918f9504d8fffe5730d8f604a6df9640bdd4f",+ "summary_state": "ready",+ "summary": "This interface specifies options for customizing the graph build process, including output directory and summarization behavior.",+ "crux": null+ },+ {+ "id": "src/graph/build.ts#GraphBuildResult",+ "name": "GraphBuildResult",+ "kind": "interface",+ "path": "src/graph/build.ts",+ "span": "L35-L48",+ "signature": "interface GraphBuildResult",+ "exported": true,+ "origin": "ast",+ "body_hash": "66898435298552c740219c8ca50f06d430551bf605b2903064a6459db0095ec3",+ "summary_state": "ready",+ "summary": "This interface outlines the structure of the result returned from the graph build process, detailing the generated graph's metadata and statistics.",+ "crux": null+ },+ {+ "id": "src/graph/build.ts#listSourceFiles",+ "name": "listSourceFiles",+ "kind": "function",+ "path": "src/graph/build.ts",+ "span": "L51-L53",+ "signature": "function listSourceFiles(root: string, outDir: string): string[]",+ "exported": true,+ "origin": "ast",+ "body_hash": "09c58d7bb3b7c55ef5688af18f41e0d4eda5c4cb444a9ffb3290697794834ba0",+ "summary_state": "ready",+ "summary": "This function retrieves a list of source files from a given directory, excluding the output directory and unsupported languages.",+ "crux": {+ "code": " return walkDir(root).filter((f) => !f.startsWith(outDir) && languageOf(f) !== null);",+ "span": "L52-L52"+ }+ },+ {+ "id": "src/graph/cards.ts",+ "name": "cards.ts",+ "kind": "file",+ "path": "src/graph/cards.ts",+ "span": "L1-L284",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "aef80e6f26a00e406385cd1faeb03d3b4e35a3cc7f1e0c50f7d94ad8a380f913",+ "summary_state": "ready",+ "summary": "This module generates markdown cards that summarize source files and their symbols for easier navigation and understanding of the codebase.",+ "crux": null+ },+ {+ "id": "src/graph/cards.ts#CardFileInfo",+ "name": "CardFileInfo",+ "kind": "interface",+ "path": "src/graph/cards.ts",+ "span": "L26-L32",+ "signature": "interface CardFileInfo",+ "exported": true,+ "origin": "ast",+ "body_hash": "bc918882882be5be102c1a9ff1127e100c3fe83f380828d8d62ad1063693d6db",+ "summary_state": "ready",+ "summary": "Holds information about a card's path, the source file it mirrors, and the number of symbols it contains.",+ "crux": null+ },+ {+ "id": "src/graph/cards.ts#cardPathFor",+ "name": "cardPathFor",+ "kind": "function",+ "path": "src/graph/cards.ts",+ "span": "L41-L44",+ "signature": "function cardPathFor(outDir: string, sourcePath: string): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "af75114def2a26067a8f595c3937bb3e8aea6f257205de146b435f804729c1cc",+ "summary_state": "ready",+ "summary": "Constructs the markdown file path for a card by replacing the source file's extension with .md.",+ "crux": {+ "code": " const md = sourcePath.replace(/\\.[^./]+$/, \"\") + \".md\";\n return join(outDir, md);",+ "span": "L42-L43"+ }+ },+ {+ "id": "src/graph/cards.ts#CardStats",+ "name": "CardStats",+ "kind": "interface",+ "path": "src/graph/cards.ts",+ "span": "L34-L38",+ "signature": "interface CardStats",+ "exported": true,+ "origin": "ast",+ "body_hash": "1c3e57e9c5bf329c4248f01c551c6d0a2a9af394980dbe537f026c15c933fe58",+ "summary_state": "ready",+ "summary": "Tracks the statistics of card generation, including how many cards were written and pruned.",+ "crux": null+ },+ {+ "id": "src/graph/cards.ts#conceptsByPath",+ "name": "conceptsByPath",+ "kind": "function",+ "path": "src/graph/cards.ts",+ "span": "L60-L70",+ "signature": "function conceptsByPath(outDir: string): Map<string, string[]>",+ "exported": false,+ "origin": "ast",+ "body_hash": "ea08d13224b288f66ba9378d392b955657db6661dee7d33b3c68ad04cf5594b1",+ "summary_state": "ready",+ "summary": "Maps source paths to their corresponding concept node slugs, facilitating the creation of up-links in cards.",+ "crux": {+ "code": " for (const node of readNodes(outDir)) {\n for (const src of node.sources) {\n const list = map.get(src.path) ?? [];\n list.push(node.slug);\n map.set(src.path, list);\n }\n }\n return map;",+ "span": "L62-L69"+ }+ },+ {+ "id": "src/graph/cards.ts#CoverRef",+ "name": "CoverRef",+ "kind": "interface",+ "path": "src/graph/cards.ts",+ "span": "L227-L232",+ "signature": "interface CoverRef",+ "exported": true,+ "origin": "ast",+ "body_hash": "b905acf1827c4b1c7b212eee322bfffb6ef0bea196277d5c20e66157c11ada8f",+ "summary_state": "ready",+ "summary": "Represents a symbol covered by a concept node, including its name, kind, and location.",+ "crux": null+ },+ {+ "id": "src/graph/cards.ts#listExistingCards",+ "name": "listExistingCards",+ "kind": "function",+ "path": "src/graph/cards.ts",+ "span": "L102-L121",+ "signature": "function listExistingCards(outDir: string): string[]",+ "exported": false,+ "origin": "ast",+ "body_hash": "8b1734950dc59ac84f5de645a42350d5024837fe4b4ace980c469f68649fd1a2",+ "summary_state": "ready",+ "summary": "Lists all existing markdown card files in the output directory, excluding concept nodes and specific top-level files.",+ "crux": {+ "code": "function listExistingCards(outDir: string): string[] {\n const out: string[] = [];\n const walk = (dir: string): void => {\n for (const e of readdirSync(dir, { withFileTypes: true })) {\n if (e.isDirectory()) {\n if (dir === outDir && (e.name === CACHE_DIR || e.name === GRAPH_DIR)) continue;\n walk(join(dir, e.name));\n } else if (e.isFile() && e.name.endsWith(\".md\")) {\n out.push(join(dir, e.name));\n }\n }\n };",+ "span": "L102-L113"+ }+ },+ {+ "id": "src/graph/cards.ts#listExistingCards.walk",+ "name": "walk",+ "kind": "function",+ "path": "src/graph/cards.ts",+ "span": "L104-L113",+ "signature": "walk = (dir: string): void",+ "exported": false,+ "origin": "ast",+ "body_hash": "ba6dde008e5cbd07399e992182055ae60636e68a4acfa2457d3cf8f317b1dc84",+ "summary_state": "ready",+ "summary": "Recursively traverses directories to find markdown files for existing cards.",+ "crux": {+ "code": " if (e.isDirectory()) {\n if (dir === outDir && (e.name === CACHE_DIR || e.name === GRAPH_DIR)) continue;\n walk(join(dir, e.name));\n } else if (e.isFile() && e.name.endsWith(\".md\")) {\n out.push(join(dir, e.name));\n }",+ "span": "L106-L111"+ }+ },+ {+ "id": "src/graph/cards.ts#oneLiner",+ "name": "oneLiner",+ "kind": "function",+ "path": "src/graph/cards.ts",+ "span": "L53-L57",+ "signature": "function oneLiner(node: NodeV1): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "f164d443f9ca9ab5785a61f1cd21b9fee70b0d444dc9161f8f79b26dae28b571",+ "summary_state": "ready",+ "summary": "Retrieves a concise summary or signature of a node, prioritizing the summary if available.",+ "crux": {+ "code": " const s = node.summary?.trim();\n if (s) return s.split(\"\\n\")[0].trim();\n return node.signature?.trim() ?? \"\";",+ "span": "L54-L56"+ }+ },+ {+ "id": "src/graph/cards.ts#pruneEmptyDirs",+ "name": "pruneEmptyDirs",+ "kind": "function",+ "path": "src/graph/cards.ts",+ "span": "L124-L144",+ "signature": "function pruneEmptyDirs(outDir: string): void",+ "exported": false,+ "origin": "ast",+ "body_hash": "7c58c5eb58948bd353fa0eaf6db614a6f3a66943f10e422352dbb62a67308d46",+ "summary_state": "ready",+ "summary": "Removes empty directories from the output directory, ensuring a clean structure after card generation.",+ "crux": {+ "code": " // returns true if dir is empty after visiting children\n let empty = true;\n for (const e of readdirSync(dir, { withFileTypes: true })) {\n if (dir === outDir && (e.name === CACHE_DIR || e.name === GRAPH_DIR)) {\n empty = false;\n continue;\n }\n const child = join(dir, e.name);\n if (e.isDirectory()) {\n if (visit(child)) rmSync(child, { recursive: true, force: true });\n else empty = false;\n } else {",+ "span": "L126-L137"+ }+ },+ {+ "id": "src/graph/cards.ts#pruneEmptyDirs.visit",+ "name": "visit",+ "kind": "function",+ "path": "src/graph/cards.ts",+ "span": "L125-L142",+ "signature": "visit = (dir: string): boolean",+ "exported": false,+ "origin": "ast",+ "body_hash": "f92031cda975f10bd7b09706f2b6ad09399ac06897c6ed89afd114ccd1032e7e",+ "summary_state": "ready",+ "summary": "Visits directories to determine if they are empty after processing their contents.",+ "crux": {+ "code": " // returns true if dir is empty after visiting children\n let empty = true;\n for (const e of readdirSync(dir, { withFileTypes: true })) {\n if (dir === outDir && (e.name === CACHE_DIR || e.name === GRAPH_DIR)) {\n empty = false;\n continue;\n }\n const child = join(dir, e.name);\n if (e.isDirectory()) {\n if (visit(child)) rmSync(child, { recursive: true, force: true });\n else empty = false;\n } else {",+ "span": "L126-L137"+ }+ },+ {+ "id": "src/graph/cards.ts#renderCard",+ "name": "renderCard",+ "kind": "function",+ "path": "src/graph/cards.ts",+ "span": "L73-L99",+ "signature": "function renderCard( sourcePath: string, fileNode: NodeV1 | undefined, symbols: NodeV1[], conceptSlugs: string[], ): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "6f1076c555ccd93979599e6ab7a7c3f5e7ec69f8dfc9c12893ed5caf0052cdf3",+ "summary_state": "ready",+ "summary": "Generates the markdown content for a card, including the source file's summary and its symbols.",+ "crux": {+ "code": " const fileSummary = fileNode ? oneLiner(fileNode) : \"\";\n if (fileSummary) lines.push(fileSummary, \"\");\n\n const sorted = [...symbols].sort(\n (a, b) => spanStart(a.span) - spanStart(b.span) || a.name.localeCompare(b.name),\n );\n for (const n of sorted) {\n const desc = oneLiner(n);\n const tail = desc ? ` — ${desc}` : \"\";\n lines.push(`- ${n.name} · ${n.kind} · ${n.span}${tail}`);\n }\n if (sorted.length === 0) lines.push(\"_No extracted symbols in this file._\");",+ "span": "L86-L97"+ }+ },+ {+ "id": "src/graph/cards.ts#spanStart",+ "name": "spanStart",+ "kind": "function",+ "path": "src/graph/cards.ts",+ "span": "L47-L50",+ "signature": "function spanStart(span: string): number",+ "exported": false,+ "origin": "ast",+ "body_hash": "c556d0ee70964557755678794a12cb22fe0f72f158ec186e32975ff01e8d44eb",+ "summary_state": "ready",+ "summary": "Extracts the starting line number from a given span string, returning 0 if the format is unparseable.",+ "crux": {+ "code": " const m = /^L(\\d+)/.exec(span);\n return m ? Number(m[1]) : 0;",+ "span": "L48-L49"+ }+ },+ {+ "id": "src/graph/cards.ts#writeCards",+ "name": "writeCards",+ "kind": "function",+ "path": "src/graph/cards.ts",+ "span": "L150-L183",+ "signature": "function writeCards(graph: GraphV1, outDir: string): CardStats",+ "exported": true,+ "origin": "ast",+ "body_hash": "ef71834ba8bfb9f009b04afe5a3d63bb0d3a2e44384377cd02045a57c18e28c6",+ "summary_state": "ready",+ "summary": "Writes markdown cards for each source file, reflecting the source tree and pruning any outdated cards.",+ "crux": {+ "code": " for (const [sourcePath, group] of byPath) {\n const fileNode = group.find((n) => n.kind === \"file\");\n const symbols = group.filter((n) => n.kind !== \"file\");\n const cardPath = cardPathFor(outDir, sourcePath);\n mkdirSync(dirname(cardPath), { recursive: true });\n writeFileSync(cardPath, renderCard(sourcePath, fileNode, symbols, concepts.get(sourcePath) ?? []));\n written.add(cardPath);\n files.push({ card: relative(outDir, cardPath), path: sourcePath, symbols: symbols.length });\n }",+ "span": "L162-L170"+ }+ },+ {+ "id": "src/graph/cards.ts#writeCovers",+ "name": "writeCovers",+ "kind": "function",+ "path": "src/graph/cards.ts",+ "span": "L247-L283",+ "signature": "function writeCovers(graph: GraphV1, outDir: string): number",+ "exported": true,+ "origin": "ast",+ "body_hash": "09f3d72e14a6ded303111818b4b4d8edce65b6f7e807e521001ca0b6eca973ba",+ "summary_state": "ready",+ "summary": "Backfills concept nodes with a list of symbols they cover, enhancing their metadata for better navigation.",+ "crux": {+ "code": " const covers: CoverRef[] = [];\n for (const path of [...new Set(sources.map((s) => s.path ?? \"\"))].sort()) {\n for (const n of symbolsByPath.get(path) ?? []) {\n covers.push({ symbol: n.name, kind: n.kind, at: `${n.path}:${n.span}` });\n }\n }\n\n // Re-stringify with covers appended last, so re-runs produce a stable diff.\n const { covers: _prev, ...rest } = parsed.data as Record<string, unknown>;\n writeFileSync(full, matter.stringify(parsed.content, { ...rest, covers }));\n enriched++;",+ "span": "L270-L280"+ }+ },+ {+ "id": "src/graph/cards.ts#writeIndex",+ "name": "writeIndex",+ "kind": "function",+ "path": "src/graph/cards.ts",+ "span": "L189-L224",+ "signature": "function writeIndex(outDir: string, files: CardFileInfo[]): void",+ "exported": true,+ "origin": "ast",+ "body_hash": "ad4dcc7f053176ce9dd9173fa98751133ff049abb0138e0b59fbef8995f49cf3",+ "summary_state": "ready",+ "summary": "Creates an index markdown file that lists all concept nodes and per-file cards for easy navigation.",+ "crux": {+ "code": " const lines: string[] = [\n \"# graft — repo map\",\n \"\",\n \"Small markdown nodes summarising this repo. `grep` any term, symbol, or\",\n 'filename here, or run `graft ask \"<task>\"`. Each node carries prose plus exact',\n \"`file:line`; open a source file only to edit the named span.\",\n \"\",\n ];\n\n const concepts = readNodes(outDir).sort((a, b) => a.slug.localeCompare(b.slug));\n if (concepts.length) {\n lines.push(\"## Concepts\", \"\");",+ "span": "L190-L201"+ }+ },+ {+ "id": "src/graph/check.ts",+ "name": "check.ts",+ "kind": "file",+ "path": "src/graph/check.ts",+ "span": "L1-L136",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "f0b73053e31d03ec1280d465d614c97044541691675f2b3d09e10bcab5078b58",+ "summary_state": "ready",+ "summary": "This file contains logic to verify if the committed graph is in sync with the current codebase, ensuring that any discrepancies are reported for CI purposes.",+ "crux": {+ "code": " const committed = readGraph(wiringPath(outDir));\n if (!committed) {\n result.missing = true;\n return result;\n }\n\n // Freshly extract Tier-1 nodes from the code on disk (same file set as build).\n const current = new Map<string, string>(); // id → body_hash\n for (const file of listSourceFiles(root, outDir)) {\n const lang = languageOf(file)!;\n let source: string;\n try {",+ "span": "L57-L68"+ }+ },+ {+ "id": "src/graph/check.ts#checkGraph",+ "name": "checkGraph",+ "kind": "function",+ "path": "src/graph/check.ts",+ "span": "L43-L101",+ "signature": "function checkGraph(dir: string, opts: GraphCheckOptions = {}): GraphCheckResult",+ "exported": true,+ "origin": "ast",+ "body_hash": "992b2d4efeb36d881a5818fd98f1de4be119e1c5597e207578b55bbe40797aca",+ "summary_state": "ready",+ "summary": "This function checks if the current code's graph representation matches the committed graph, identifying any added, removed, or changed nodes.",+ "crux": {+ "code": " const committedById = new Map(committed.nodes.map((n) => [n.id, n]));\n for (const [id, node] of committedById) {\n const now = current.get(id);\n if (now === undefined) result.removed.push(id);\n else if (now !== node.body_hash) result.changed.push(id);\n if (node.summary_state === \"stale\") result.stale.push(id);\n if (node.summary_state === \"pending\") result.pending++;\n }\n for (const id of current.keys()) {\n if (!committedById.has(id)) result.added.push(id);\n }\n",+ "span": "L81-L92"+ }+ },+ {+ "id": "src/graph/check.ts#formatGraphCheckReport",+ "name": "formatGraphCheckReport",+ "kind": "function",+ "path": "src/graph/check.ts",+ "span": "L104-L135",+ "signature": "function formatGraphCheckReport(r: GraphCheckResult): string",+ "exported": true,+ "origin": "ast",+ "body_hash": "aadc77c803de8c04dac0f5c9bbb53d15c91944adfbc5a35dcebfc9983d105fd0",+ "summary_state": "ready",+ "summary": "This function generates a human-readable report summarizing the results of the graph check, indicating any discrepancies found.",+ "crux": {+ "code": " const lines: string[] = [\"graph check: STALE\", \"\"];\n const structural = r.added.length + r.removed.length + r.changed.length;\n if (r.changed.length) {\n lines.push(`changed (${r.changed.length}):`);\n for (const id of r.changed) lines.push(` ~ ${id}`);\n }\n if (r.added.length) {\n lines.push(`added (${r.added.length}):`);\n for (const id of r.added) lines.push(` + ${id}`);\n }\n if (r.removed.length) {\n lines.push(`removed (${r.removed.length}):`);",+ "span": "L113-L124"+ }+ },+ {+ "id": "src/graph/check.ts#GraphCheckOptions",+ "name": "GraphCheckOptions",+ "kind": "interface",+ "path": "src/graph/check.ts",+ "span": "L39-L41",+ "signature": "interface GraphCheckOptions",+ "exported": true,+ "origin": "ast",+ "body_hash": "deb14aad6be2a49d6d6d059a64a4eb55a7041a039cbabf92c55222647c2b0679",+ "summary_state": "ready",+ "summary": "This interface provides optional parameters for configuring the context directory when performing a graph check.",+ "crux": null+ },+ {+ "id": "src/graph/check.ts#GraphCheckResult",+ "name": "GraphCheckResult",+ "kind": "interface",+ "path": "src/graph/check.ts",+ "span": "L27-L37",+ "signature": "interface GraphCheckResult",+ "exported": true,+ "origin": "ast",+ "body_hash": "8b12129196b2a1b6d3c7a45a086708e123527cbc0417ce5db07a710a853719c0",+ "summary_state": "ready",+ "summary": "This interface defines the structure of the result returned by the graph check, detailing the state of the graph in relation to the code.",+ "crux": null+ },+ {+ "id": "src/graph/enrich.ts",+ "name": "enrich.ts",+ "kind": "file",+ "path": "src/graph/enrich.ts",+ "span": "L1-L187",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "7b8238702835246bfc446ae017157e627c7609fde83b090619de71d013edf8e6",+ "summary_state": "ready",+ "summary": "This file implements a mechanism to enrich graph nodes with summaries and cruxes based on their state and prior computations.",+ "crux": {+ "code": " // Which nodes actually need an LLM call this run (after cache carry-over).\n const dirty: NodeV1[] = [];\n\n for (const node of nodes) {\n const was = prior.get(node.id);\n if (was?.summary_state === \"ready\" && was.body_hash === node.body_hash) {\n node.summary = was.summary;\n node.crux = was.crux;\n node.summary_state = \"ready\";\n stats.cached++;\n continue;\n }",+ "span": "L51-L62"+ }+ },+ {+ "id": "src/graph/enrich.ts#buildCrux",+ "name": "buildCrux",+ "kind": "function",+ "path": "src/graph/enrich.ts",+ "span": "L162-L177",+ "signature": "function buildCrux(r: NodeCrux, node: NodeV1, source: string, lineCount: number): Crux | null",+ "exported": false,+ "origin": "ast",+ "body_hash": "b8e82b1a1f721cdba2a3ff1a6d46db8b30a0048178d7c7e7df0731e60c059a81",+ "summary_state": "ready",+ "summary": "Extracts and formats the crux text from a source file based on the model's provided line range.",+ "crux": {+ "code": "function buildCrux(r: NodeCrux, node: NodeV1, source: string, lineCount: number): Crux | null {\n // 0/0 (or an invalid range) is the model saying \"nothing to highlight here\".\n if (r.crux_start < 1 || r.crux_end < r.crux_start) return null;\n const [nodeStart, nodeEnd] = spanLines(node.span, lineCount);\n const start = Math.max(nodeStart, Math.min(r.crux_start, nodeEnd));\n let end = Math.max(start, Math.min(r.crux_end, nodeEnd));\n\n // Keep the crux readable: if the model pointed at a big region, store its\n // leading slice (the anchor it chose) rather than the whole blob — still the\n // most important part, and the full definition is reachable via node.span.\n if (end - start + 1 > MAX_CRUX_LINES) end = start + MAX_CRUX_LINES - 1;",+ "span": "L162-L172"+ }+ },+ {+ "id": "src/graph/enrich.ts#collectFileCrux",+ "name": "collectFileCrux",+ "kind": "function",+ "path": "src/graph/enrich.ts",+ "span": "L135-L155",+ "signature": "async function collectFileCrux( summarizer: CruxSummarizer, path: string, source: string, refs: NodeRef[], ): Promise<{ results: Map<string, NodeCrux>; error?: string }>",+ "exported": false,+ "origin": "ast",+ "body_hash": "e549b76d14ae5d596c084dd5f655bded2092a36e3505ff6135c054ccf043efda",+ "summary_state": "ready",+ "summary": "Collects crux information for nodes in a file, handling potential errors and ensuring partial results are returned.",+ "crux": {+ "code": " const list = await summarizer.describeFile({ path, source, nodes: missing });\n for (const r of list) if (!results.has(r.id)) results.set(r.id, r);\n missing = refs.filter((r) => !results.has(r.id));",+ "span": "L146-L148"+ }+ },+ {+ "id": "src/graph/enrich.ts#enrichGraph",+ "name": "enrichGraph",+ "kind": "function",+ "path": "src/graph/enrich.ts",+ "span": "L43-L128",+ "signature": "async function enrichGraph( nodes: NodeV1[], prior: Map<string, NodeV1>, sources: Map<string, string>, opts: EnrichOptions = {}, ): Promise<EnrichStats>",+ "exported": true,+ "origin": "ast",+ "body_hash": "67bf09b50cd3f75e72e7c8ce7b7f20847e380dcc731531d00d17e8866945336b",+ "summary_state": "ready",+ "summary": "Enriches a set of graph nodes by determining which need new summaries and processing them accordingly.",+ "crux": {+ "code": " // Which nodes actually need an LLM call this run (after cache carry-over).\n const dirty: NodeV1[] = [];\n\n for (const node of nodes) {\n const was = prior.get(node.id);\n if (was?.summary_state === \"ready\" && was.body_hash === node.body_hash) {\n node.summary = was.summary;\n node.crux = was.crux;\n node.summary_state = \"ready\";\n stats.cached++;\n continue;\n }",+ "span": "L51-L62"+ }+ },+ {+ "id": "src/graph/enrich.ts#EnrichOptions",+ "name": "EnrichOptions",+ "kind": "interface",+ "path": "src/graph/enrich.ts",+ "span": "L28-L33",+ "signature": "interface EnrichOptions",+ "exported": true,+ "origin": "ast",+ "body_hash": "5b1a8379d9c8f934883d81912390338ba9917af35f05b8eb378f405e114adddb",+ "summary_state": "ready",+ "summary": "Defines options for enriching graph nodes, including the ability to compute new summaries and report progress.",+ "crux": null+ },+ {+ "id": "src/graph/enrich.ts#EnrichStats",+ "name": "EnrichStats",+ "kind": "interface",+ "path": "src/graph/enrich.ts",+ "span": "L35-L41",+ "signature": "interface EnrichStats",+ "exported": true,+ "origin": "ast",+ "body_hash": "63a93dfdf61c8da0d3a05c601b74619ad84942d37425b4391b8da2b01d2d694c",+ "summary_state": "ready",+ "summary": "Tracks the statistics of the enrichment process, including counts of cached, computed, stale, and pending nodes.",+ "crux": null+ },+ {+ "id": "src/graph/enrich.ts#spanLines",+ "name": "spanLines",+ "kind": "function",+ "path": "src/graph/enrich.ts",+ "span": "L180-L186",+ "signature": "function spanLines(span: string, fileLines: number): [number, number]",+ "exported": false,+ "origin": "ast",+ "body_hash": "d7f074949c35eaa3f883194e41cda61c34a624a66ec368ef352dc7f0b2e7e256",+ "summary_state": "ready",+ "summary": "Parses a line span string into a clamped range of line numbers, ensuring valid boundaries.",+ "crux": null+ },+ {+ "id": "src/graph/extract.ts",+ "name": "extract.ts",+ "kind": "file",+ "path": "src/graph/extract.ts",+ "span": "L1-L298",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "58cd002d5ee7dfb750cb85293a795148ffbec31e68e2a9b693e0794543a7f727",+ "summary_state": "ready",+ "summary": "This module extracts structured data from source files into a normalized format for further processing.",+ "crux": {+ "code": " return { nodes, rawEdges };",+ "span": "L126-L126"+ }+ },+ {+ "id": "src/graph/extract.ts#calleeName",+ "name": "calleeName",+ "kind": "function",+ "path": "src/graph/extract.ts",+ "span": "L244-L260",+ "signature": "function calleeName( node: Parser.SyntaxNode, lang: Language, ): { name: string; viaMember: boolean } | null",+ "exported": false,+ "origin": "ast",+ "body_hash": "06353b6cf0a05cf60bad712082837f52c169e6db9209488f1ee04ea22bef8082",+ "summary_state": "ready",+ "summary": "Extracts the name of a function or method being called in the syntax tree.",+ "crux": {+ "code": " if (fn.type === \"identifier\") return { name: fn.text, viaMember: false };\n if (lang === \"python\" && fn.type === \"attribute\") {\n const a = fn.childForFieldName(\"attribute\") ?? fn.namedChildren.at(-1);\n return a ? { name: a.text, viaMember: true } : null;\n }\n if (lang !== \"python\" && fn.type === \"member_expression\") {\n const p = fn.childForFieldName(\"property\") ?? fn.namedChildren.at(-1);\n return p ? { name: p.text, viaMember: true } : null;",+ "span": "L250-L257"+ }+ },+ {+ "id": "src/graph/extract.ts#clean",+ "name": "clean",+ "kind": "function",+ "path": "src/graph/extract.ts",+ "span": "L280-L287",+ "signature": "function clean(raw: string): string | null",+ "exported": false,+ "origin": "ast",+ "body_hash": "38343faa35f42e41e98c93d6816454cfe294123505d2bae14f045624cf6d80e1",+ "summary_state": "ready",+ "summary": "Cleans and normalizes a function signature by removing unnecessary whitespace and punctuation.",+ "crux": {+ "code": "function clean(raw: string): string | null {\n const sig = raw\n .replace(/\\s+/g, \" \")\n .trim()\n .replace(/(=>|[{:=])\\s*$/, \"\")\n .trim();\n return sig || null;",+ "span": "L280-L286"+ }+ },+ {+ "id": "src/graph/extract.ts#DefDescriptor",+ "name": "DefDescriptor",+ "kind": "interface",+ "path": "src/graph/extract.ts",+ "span": "L87-L92",+ "signature": "interface DefDescriptor",+ "exported": false,+ "origin": "ast",+ "body_hash": "414875473c4cf1728483558f5354b6f37c279d2bc49393b3b93322a9573a7f00",+ "summary_state": "ready",+ "summary": "Describes a definition in the syntax tree, including its name and type.",+ "crux": null+ },+ {+ "id": "src/graph/extract.ts#describe",+ "name": "describe",+ "kind": "function",+ "path": "src/graph/extract.ts",+ "span": "L184-L213",+ "signature": "function describe(node: Parser.SyntaxNode, ctx: WalkCtx): DefDescriptor | null",+ "exported": false,+ "origin": "ast",+ "body_hash": "9a6919ff2bed807cf790adcea3b0d423db94baa10fc2069514e0c20c1b5f7117",+ "summary_state": "ready",+ "summary": "Identifies and describes definitions in the syntax tree based on their node types.",+ "crux": {+ "code": " if (mapped) {\n const name = node.childForFieldName(\"name\")?.text;\n if (!name) return null;\n let kind = mapped;\n if (ctx.lang === \"python\" && mapped === \"function\" && ctx.enclosingKind === \"class\") {\n kind = \"method\";\n }\n const body = node.childForFieldName(\"body\");\n return { name, kind, headerEnd: body ? body.startIndex : node.endIndex, hashNode: node };\n }",+ "span": "L186-L195"+ }+ },+ {+ "id": "src/graph/extract.ts#extractFile",+ "name": "extractFile",+ "kind": "function",+ "path": "src/graph/extract.ts",+ "span": "L94-L127",+ "signature": "function extractFile(rel: string, source: string, lang: Language): ExtractResult",+ "exported": true,+ "origin": "ast",+ "body_hash": "464dc6d27977ade3cd0a52213f5cc1b963e4dfafc328cc1e059925bac9c9436d",+ "summary_state": "ready",+ "summary": "Extracts nodes and edges from a source file based on its syntax tree.",+ "crux": {+ "code": " return { nodes, rawEdges };",+ "span": "L126-L126"+ }+ },+ {+ "id": "src/graph/extract.ts#ExtractResult",+ "name": "ExtractResult",+ "kind": "interface",+ "path": "src/graph/extract.ts",+ "span": "L41-L44",+ "signature": "interface ExtractResult",+ "exported": true,+ "origin": "ast",+ "body_hash": "7bef2217a3edd0ae64ae3585affe29e5bc0e0f471ca1d7901910fa737e4d01af",+ "summary_state": "ready",+ "summary": "Holds the result of the extraction process, containing nodes and raw edges.",+ "crux": null+ },+ {+ "id": "src/graph/extract.ts#heritageEdges",+ "name": "heritageEdges",+ "kind": "function",+ "path": "src/graph/extract.ts",+ "span": "L215-L242",+ "signature": "function heritageEdges(node: Parser.SyntaxNode, classId: string, ctx: WalkCtx): RawEdge[]",+ "exported": false,+ "origin": "ast",+ "body_hash": "a73044fd4c3636db388dcd17dc5cebfa2090322501f2674989e892f89f2e1b03",+ "summary_state": "ready",+ "summary": "Generates edges representing class inheritance and implementation relationships.",+ "crux": {+ "code": "function heritageEdges(node: Parser.SyntaxNode, classId: string, ctx: WalkCtx): RawEdge[] {\n const edges: RawEdge[] = [];\n if (ctx.lang === \"python\") {\n const supers = node.childForFieldName(\"superclasses\"); // argument_list\n for (const c of supers?.namedChildren ?? []) {\n if (c.type === \"identifier\") {\n edges.push({ source: classId, relation: \"extends\", name: c.text, file: ctx.rel });\n }\n }\n return edges;\n }\n const heritage = node.namedChildren.find((c) => c.type === \"class_heritage\");",+ "span": "L215-L226"+ }+ },+ {+ "id": "src/graph/extract.ts#importSpecifier",+ "name": "importSpecifier",+ "kind": "function",+ "path": "src/graph/extract.ts",+ "span": "L266-L277",+ "signature": "function importSpecifier(node: Parser.SyntaxNode, lang: Language): string | null",+ "exported": false,+ "origin": "ast",+ "body_hash": "edf2e115d4815ca2b2c480f6ab6ec254114fdb5fa329439fb1092449c6222ff5",+ "summary_state": "ready",+ "summary": "Extracts the module name from an import statement in the syntax tree.",+ "crux": {+ "code": "function importSpecifier(node: Parser.SyntaxNode, lang: Language): string | null {\n if (lang === \"python\") {\n const m =\n node.childForFieldName(\"module_name\") ??\n node.namedChildren.find((c) => c.type === \"dotted_name\" || c.type === \"relative_import\");\n return m?.text ?? null;\n }\n const str = node.namedChildren.find((c) => c.type === \"string\");\n if (!str) return null;\n const frag = str.namedChildren.find((c) => c.type === \"string_fragment\");\n return frag?.text ?? str.text.replace(/^['\"]|['\"]$/g, \"\");",+ "span": "L266-L276"+ }+ },+ {+ "id": "src/graph/extract.ts#isImport",+ "name": "isImport",+ "kind": "function",+ "path": "src/graph/extract.ts",+ "span": "L262-L264",+ "signature": "function isImport(node: Parser.SyntaxNode): boolean",+ "exported": false,+ "origin": "ast",+ "body_hash": "70722311d982f2fa892674266eddfe75b20ad22c62a323448a86a29044a6b7f6",+ "summary_state": "ready",+ "summary": "Determines if a node represents an import statement in the syntax tree.",+ "crux": null+ },+ {+ "id": "src/graph/extract.ts#Language",+ "name": "Language",+ "kind": "type",+ "path": "src/graph/extract.ts",+ "span": "L16-L16",+ "signature": "type Language = \"typescript\" | \"tsx\" | \"python\";",+ "exported": true,+ "origin": "ast",+ "body_hash": "5a7c4ffe69a0058e67f6150fd6d7a941265322ef73669c6fae36bdd9a92af5c6",+ "summary_state": "ready",+ "summary": "Defines the supported programming languages for extraction.",+ "crux": null+ },+ {+ "id": "src/graph/extract.ts#languageOf",+ "name": "languageOf",+ "kind": "function",+ "path": "src/graph/extract.ts",+ "span": "L19-L25",+ "signature": "function languageOf(path: string): Language | null",+ "exported": true,+ "origin": "ast",+ "body_hash": "d68b32ad7c9702e80d148c718d03ef4d64d44805d4294c2503426ea9143e9e1d",+ "summary_state": "ready",+ "summary": "Determines the programming language of a given file path.",+ "crux": {+ "code": " if (p.endsWith(\".tsx\") || p.endsWith(\".jsx\")) return \"tsx\";\n if (/\\.(ts|mts|cts|js|mjs|cjs)$/.test(p)) return \"typescript\";\n if (p.endsWith(\".py\") || p.endsWith(\".pyi\")) return \"python\";",+ "span": "L21-L23"+ }+ },+ {+ "id": "src/graph/extract.ts#RawEdge",+ "name": "RawEdge",+ "kind": "interface",+ "path": "src/graph/extract.ts",+ "span": "L31-L39",+ "signature": "interface RawEdge",+ "exported": true,+ "origin": "ast",+ "body_hash": "707c4b43d565711035439d2541197427ac0d4da52241d33cf63dd3fb3ac98754",+ "summary_state": "ready",+ "summary": "Represents an unresolved edge in the extraction process, linking nodes in the graph.",+ "crux": null+ },+ {+ "id": "src/graph/extract.ts#tsExported",+ "name": "tsExported",+ "kind": "function",+ "path": "src/graph/extract.ts",+ "span": "L290-L297",+ "signature": "function tsExported(node: Parser.SyntaxNode): boolean",+ "exported": false,+ "origin": "ast",+ "body_hash": "dd6c141ae925e333baeebc3f3d19c3043670c76a4f32b711e8166ac6eb86f2f4",+ "summary_state": "ready",+ "summary": "Checks if a node is exported based on its ancestor nodes in the syntax tree.",+ "crux": {+ "code": "function tsExported(node: Parser.SyntaxNode): boolean {\n let p = node.parent;\n while (p) {\n if (p.type === \"export_statement\") return true;\n p = p.parent;\n }\n return false;",+ "span": "L290-L296"+ }+ },+ {+ "id": "src/graph/extract.ts#walk",+ "name": "walk",+ "kind": "function",+ "path": "src/graph/extract.ts",+ "span": "L129-L181",+ "signature": "function walk(node: Parser.SyntaxNode, ctx: WalkCtx, out: NodeV1[], edges: RawEdge[]): void",+ "exported": false,+ "origin": "ast",+ "body_hash": "7cd315e50d1665cc130f049e5b655ac09f3e87f406fd7eba2b3fd6a4aca1c749",+ "summary_state": "ready",+ "summary": "Recursively traverses the syntax tree to collect definitions and their relationships.",+ "crux": {+ "code": " const desc = describe(node, ctx);\n if (desc) {\n const id = `${ctx.rel}#${[...ctx.scope, desc.name].join(\".\")}`;\n out.push({\n id,\n name: desc.name,\n kind: desc.kind,\n path: ctx.rel,\n span: `L${desc.hashNode.startPosition.row + 1}-L${desc.hashNode.endPosition.row + 1}`,\n signature: clean(ctx.source.slice(desc.hashNode.startIndex, desc.headerEnd)),\n exported: ctx.lang === \"python\" ? !desc.name.startsWith(\"_\") : tsExported(node),\n origin: \"ast\",",+ "span": "L130-L141"+ }+ },+ {+ "id": "src/graph/extract.ts#WalkCtx",+ "name": "WalkCtx",+ "kind": "interface",+ "path": "src/graph/extract.ts",+ "span": "L76-L84",+ "signature": "interface WalkCtx",+ "exported": false,+ "origin": "ast",+ "body_hash": "b2e93ec2af59e0078d500a068b620a426b6a588804ba62faba20d7f47f90bb3e",+ "summary_state": "ready",+ "summary": "Context for walking through the syntax tree during extraction, maintaining state and scope.",+ "crux": null+ },+ {+ "id": "src/graph/resolve.ts",+ "name": "resolve.ts",+ "kind": "file",+ "path": "src/graph/resolve.ts",+ "span": "L1-L101",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "dad41f73d773c45f5237b85e10a36ae45331cd5959df578816ee8ab47622cffe",+ "summary_state": "ready",+ "summary": "This file resolves raw edge intents into concrete edges by matching names against a node index, ensuring accurate relationships between nodes.",+ "crux": {+ "code": "export function resolveEdges(nodes: NodeV1[], rawEdges: RawEdge[]): EdgeV1[] {\n const byId = new Map(nodes.map((n) => [n.id, n]));\n const globalName = new Map<string, NodeV1[]>();\n const perFileName = new Map<string, Map<string, NodeV1[]>>();\n for (const n of nodes) {\n if (n.kind === \"file\") continue;\n push(globalName, n.name, n);\n let fileMap = perFileName.get(n.path);\n if (!fileMap) perFileName.set(n.path, (fileMap = new Map()));\n push(fileMap, n.name, n);\n }\n",+ "span": "L20-L31"+ }+ },+ {+ "id": "src/graph/resolve.ts#push",+ "name": "push",+ "kind": "function",+ "path": "src/graph/resolve.ts",+ "span": "L60-L64",+ "signature": "function push<T>(map: Map<string, T[]>, key: string, val: T): void",+ "exported": false,+ "origin": "ast",+ "body_hash": "0f349e9ed1ee9ef1c7695b65c3f3948140eb20a60f36ba9d915a79e92eed7391",+ "summary_state": "ready",+ "summary": "This function adds a value to an array in a map, creating the array if it doesn't exist, facilitating grouped storage of nodes.",+ "crux": null+ },+ {+ "id": "src/graph/resolve.ts#resolveEdges",+ "name": "resolveEdges",+ "kind": "function",+ "path": "src/graph/resolve.ts",+ "span": "L20-L58",+ "signature": "function resolveEdges(nodes: NodeV1[], rawEdges: RawEdge[]): EdgeV1[]",+ "exported": true,+ "origin": "ast",+ "body_hash": "ace9e1eb0f3e9bc400f1341e0c23209b13d3c4f2b004e55a2397ebf4902cb41e",+ "summary_state": "ready",+ "summary": "This function processes raw edges and establishes relationships between nodes based on their types and specified relations.",+ "crux": {+ "code": " for (const e of rawEdges) {\n if (e.relation === \"contains\" && e.targetId) {\n add(e.source, e.targetId, \"contains\", \"extracted\");\n } else if (e.relation === \"imports\" && e.specifier) {\n add(e.source, resolveImport(e.specifier, e.file, byId), \"imports\", \"extracted\");\n } else if (e.relation === \"extends\" || e.relation === \"implements\") {\n const kinds: Kind[] = e.relation === \"implements\" ? [\"interface\"] : [\"class\", \"interface\"];\n const hit = resolveName(e.name!, e.file, kinds, perFileName, globalName);\n // an unresolved base is usually an external/imported type — keep the name.\n add(e.source, hit?.id ?? e.name!, e.relation, hit?.confidence ?? \"inferred\");\n } else if (e.relation === \"calls\") {\n const kinds: Kind[] = e.viaMember ? [\"method\"] : [\"function\"];",+ "span": "L41-L52"+ }+ },+ {+ "id": "src/graph/resolve.ts#resolveEdges.add",+ "name": "add",+ "kind": "function",+ "path": "src/graph/resolve.ts",+ "span": "L34-L39",+ "signature": "add = (source: string, target: string, relation: Relation, confidence: EdgeV1[\"confidence\"])",+ "exported": true,+ "origin": "ast",+ "body_hash": "7f8c2ba06670d38fd33b508c463d4c8e08ae614f7559b3571c8b7db1d51fd380",+ "summary_state": "ready",+ "summary": "This function adds a new edge to the output if it hasn't been seen before, preventing duplicate edges in the result.",+ "crux": {+ "code": " const add = (source: string, target: string, relation: Relation, confidence: EdgeV1[\"confidence\"]) => {\n const key = `${source}\u0000${relation}\u0000${target}`;\n if (seen.has(key)) return;\n seen.add(key);\n out.push({ source, target, relation, confidence });\n };",+ "span": "L34-L39"+ }+ },+ {+ "id": "src/graph/resolve.ts#resolveImport",+ "name": "resolveImport",+ "kind": "function",+ "path": "src/graph/resolve.ts",+ "span": "L88-L100",+ "signature": "function resolveImport(spec: string, file: string, byId: Map<string, NodeV1>): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "5dcee73ae49d61baf6cba0f1430bcc799975d19b6d72ac0a6da911e14fafa955",+ "summary_state": "ready",+ "summary": "This function resolves a module specifier to a file node ID if it points within the repository, ensuring correct imports.",+ "crux": {+ "code": "function resolveImport(spec: string, file: string, byId: Map<string, NodeV1>): string {\n if (!spec.startsWith(\".\")) return spec;\n const dir = posix.dirname(file.split(sep).join(\"/\"));\n const base = posix.normalize(posix.join(dir, spec));\n const noExt = base.replace(/\\.(js|jsx|mjs|cjs|ts|tsx|py)$/, \"\");\n const candidates = [\n base,\n ...IMPORT_EXTS.map((e) => noExt + e),\n ...IMPORT_EXTS.map((e) => `${noExt}/index${e}`),\n ];\n for (const c of candidates) if (byId.has(c)) return c;",+ "span": "L88-L98"+ }+ },+ {+ "id": "src/graph/resolve.ts#resolveName",+ "name": "resolveName",+ "kind": "function",+ "path": "src/graph/resolve.ts",+ "span": "L70-L82",+ "signature": "function resolveName( name: string, file: string, kinds: Kind[], perFileName: Map<string, Map<string, NodeV1[]>>, globalName: Map<string, NodeV1[]>, ): { id: string; confidence: EdgeV1[\"confidence\"] } | null",+ "exported": false,+ "origin": "ast",+ "body_hash": "612a086f93eb383b759795d9e5b93d6f429bd4a17c22c9b3e65fcf7d79e0e6f0",+ "summary_state": "ready",+ "summary": "This function resolves a symbol name to its corresponding node ID, prioritizing local matches and handling ambiguities appropriately.",+ "crux": {+ "code": " if (local.length) return { id: local[0].id, confidence: \"extracted\" };\n const global = (globalName.get(name) ?? []).filter((n) => kinds.includes(n.kind));\n if (global.length === 1) return { id: global[0].id, confidence: \"inferred\" };",+ "span": "L78-L80"+ }+ },+ {+ "id": "src/graph/types.ts",+ "name": "types.ts",+ "kind": "file",+ "path": "src/graph/types.ts",+ "span": "L1-L82",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "757b84c059d13cda49e0f29518b31a5473f0d6e243b2ab1f374a7f7ff02492e4",+ "summary_state": "ready",+ "summary": "Defines the schema for a code graph, outlining nodes and edges for code structure representation.",+ "crux": {+ "code": "/**\n * `graph.json` — the code graph schema (v1).\n *\n * One node per definition (file, class, function, method, interface, type, enum),\n * wired by edges (contains, imports, calls, ...). Field names follow the LSP /\n * SCIP vocabulary (`name`, `kind`, ...) rather than any one tool's conventions.\n *\n * Two tiers of data live on a node:\n * - Tier-1 (deterministic, $0): everything from the AST. Rebuilt on every run.\n * - Tier-2 (one LLM call, cached on `body_hash`): `summary` + `crux`.\n * M1 populates Tier-1 only; Tier-2 fields ship as `pending`/null.\n */",+ "span": "L1-L12"+ }+ },+ {+ "id": "src/graph/types.ts#Confidence",+ "name": "Confidence",+ "kind": "type",+ "path": "src/graph/types.ts",+ "span": "L25-L25",+ "signature": "type Confidence = \"extracted\" | \"inferred\";",+ "exported": true,+ "origin": "ast",+ "body_hash": "305d107dc8cea0d8fcf2e42c13eef23345a53cd6a24672d8a017d5c8d393d46c",+ "summary_state": "ready",+ "summary": "Specifies the confidence levels for the truth of edges in the graph, aiding in the assessment of relationships.",+ "crux": {+ "code": "export type Confidence = \"extracted\" | \"inferred\";",+ "span": "L25-L25"+ }+ },+ {+ "id": "src/graph/types.ts#Crux",+ "name": "Crux",+ "kind": "interface",+ "path": "src/graph/types.ts",+ "span": "L32-L35",+ "signature": "interface Crux",+ "exported": true,+ "origin": "ast",+ "body_hash": "157f97611f592b25b78af3bd626d10c866b4aa23344a96823de466eb1ecbe28d",+ "summary_state": "ready",+ "summary": "Holds the LLM-chosen business-logic excerpt for a node, providing a source of truth for code interpretation.",+ "crux": {+ "code": "export interface Crux {\n code: string;\n span: string; // e.g. \"L189-L196\"\n}",+ "span": "L32-L35"+ }+ },+ {+ "id": "src/graph/types.ts#EdgeV1",+ "name": "EdgeV1",+ "kind": "interface",+ "path": "src/graph/types.ts",+ "span": "L65-L70",+ "signature": "interface EdgeV1",+ "exported": true,+ "origin": "ast",+ "body_hash": "ab2ffb1ba27a286985e517d71d7866d2d389e585d1584647a90fb520b4d92628",+ "summary_state": "ready",+ "summary": "Describes the edges connecting nodes in the graph, detailing the source, target, and relationship type.",+ "crux": {+ "code": "export interface EdgeV1 {\n source: string; // node id\n target: string; // node id, or an unresolved module string for imports\n relation: Relation;\n confidence: Confidence;\n}",+ "span": "L65-L70"+ }+ },+ {+ "id": "src/graph/types.ts#GraphV1",+ "name": "GraphV1",+ "kind": "interface",+ "path": "src/graph/types.ts",+ "span": "L72-L81",+ "signature": "interface GraphV1",+ "exported": true,+ "origin": "ast",+ "body_hash": "fa588451b38bfa2c1ea17eeabb5cd4d18769ecbf75ba79fb160d59d2d2666e8e",+ "summary_state": "ready",+ "summary": "Encapsulates the entire graph structure, including metadata and collections of nodes and edges.",+ "crux": {+ "code": "export interface GraphV1 {\n meta: {\n version: 1;\n nodeCount: number;\n edgeCount: number;\n languages: string[];\n };\n nodes: NodeV1[];\n edges: EdgeV1[];\n}",+ "span": "L72-L81"+ }+ },+ {+ "id": "src/graph/types.ts#Kind",+ "name": "Kind",+ "kind": "type",+ "path": "src/graph/types.ts",+ "span": "L15-L22",+ "signature": "type Kind = | \"file\" | \"class\" | \"function\" | \"method\" | \"interface\" // TS only | \"type\" // TS only (type alias) | \"enum\";",+ "exported": true,+ "origin": "ast",+ "body_hash": "b233aa721b3c652dd7f3b4de6e3410e0f44a1da079cbb90df6d8e05eb4cc49f0",+ "summary_state": "ready",+ "summary": "Enumerates the types of symbols that can exist in the code graph, facilitating type identification.",+ "crux": {+ "code": "export type Kind =\n | \"file\"\n | \"class\"\n | \"function\"\n | \"method\"\n | \"interface\" // TS only\n | \"type\" // TS only (type alias)\n | \"enum\"; // TS only",+ "span": "L15-L22"+ }+ },+ {+ "id": "src/graph/types.ts#NodeV1",+ "name": "NodeV1",+ "kind": "interface",+ "path": "src/graph/types.ts",+ "span": "L37-L55",+ "signature": "interface NodeV1",+ "exported": true,+ "origin": "ast",+ "body_hash": "beaac037e2ce6292f6f5883e10c6a1df41963629d9090bbde0d88ef5b6fd8309",+ "summary_state": "ready",+ "summary": "Represents a node in the graph with its identity, location, and meaning, essential for graph construction.",+ "crux": {+ "code": "export interface NodeV1 {\n // identity\n id: string; // path-scoped: \"src/cache.ts#Cache.get\"\n name: string; // the symbol's own name: \"get\"\n kind: Kind;\n\n // location (Tier-1, deterministic)\n path: string; // repo-relative: \"src/cache.ts\"\n span: string; // whole definition: \"L165-L222\"\n signature: string | null; // \"get(k: string): number\" — null for kind:\"file\"\n exported: boolean;\n origin: \"ast\";",+ "span": "L37-L48"+ }+ },+ {+ "id": "src/graph/types.ts#Relation",+ "name": "Relation",+ "kind": "type",+ "path": "src/graph/types.ts",+ "span": "L57-L63",+ "signature": "type Relation = | \"contains\" // file → symbol, class → method (structural) | \"calls\" // function → function it invokes | \"imports\" // file → module | \"references\" // symbol → symbol it names but doesn't call | \"implements\" // TS: class → interface | \"extends\";",+ "exported": true,+ "origin": "ast",+ "body_hash": "226fd93c673f4bfa583e44e3be8c2ca8e0957bf1b95771f067e4999b1e89d145",+ "summary_state": "ready",+ "summary": "Defines the types of relationships between nodes in the graph, clarifying how symbols interact.",+ "crux": {+ "code": "export type Relation =\n | \"contains\" // file → symbol, class → method (structural)\n | \"calls\" // function → function it invokes\n | \"imports\" // file → module\n | \"references\" // symbol → symbol it names but doesn't call\n | \"implements\" // TS: class → interface\n | \"extends\"; // class → base class",+ "span": "L57-L63"+ }+ },+ {+ "id": "src/graph/types.ts#SummaryState",+ "name": "SummaryState",+ "kind": "type",+ "path": "src/graph/types.ts",+ "span": "L28-L28",+ "signature": "type SummaryState = \"pending\" | \"ready\" | \"stale\";",+ "exported": true,+ "origin": "ast",+ "body_hash": "0689b3a76aa3ee3553bec1bccff2817cac613e747d317688f296748e8c929e0e",+ "summary_state": "ready",+ "summary": "Indicates whether the meaning-layer has been computed for a node, managing the state of node summaries.",+ "crux": {+ "code": "export type SummaryState = \"pending\" | \"ready\" | \"stale\";",+ "span": "L28-L28"+ }+ },+ {+ "id": "src/graph/write.ts",+ "name": "write.ts",+ "kind": "file",+ "path": "src/graph/write.ts",+ "span": "L1-L55",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "55dd6ea840135ade4db7f49042234bee0db07a9c8c959ab57767deb8bebc6345",+ "summary_state": "ready",+ "summary": "This file contains functions for managing the serialization and deserialization of a wiring graph used in a context directory.",+ "crux": null+ },+ {+ "id": "src/graph/write.ts#edgeOrder",+ "name": "edgeOrder",+ "kind": "function",+ "path": "src/graph/write.ts",+ "span": "L48-L54",+ "signature": "function edgeOrder(a: EdgeV1, b: EdgeV1): number",+ "exported": false,+ "origin": "ast",+ "body_hash": "1c2665c44f094c37f510a0ca5befc63bf67ae59c52d77dfdcbe15611d2e5abbe",+ "summary_state": "ready",+ "summary": "Defines the sorting order for edges in the wiring graph based on source, relation, and target.",+ "crux": {+ "code": " a.source.localeCompare(b.source) ||\n a.relation.localeCompare(b.relation) ||\n a.target.localeCompare(b.target)",+ "span": "L50-L52"+ }+ },+ {+ "id": "src/graph/write.ts#readGraph",+ "name": "readGraph",+ "kind": "function",+ "path": "src/graph/write.ts",+ "span": "L28-L34",+ "signature": "function readGraph(path: string): GraphV1 | null",+ "exported": true,+ "origin": "ast",+ "body_hash": "a68ca7cd48652a99a350b76c387a19462cc984c42bbc9b00a30e629af5fda52e",+ "summary_state": "ready",+ "summary": "Reads and parses an existing wiring graph from a file, returning null if the file is absent or unparseable.",+ "crux": {+ "code": " return JSON.parse(readFileSync(path, \"utf8\")) as GraphV1;\n } catch {\n return null;",+ "span": "L30-L32"+ }+ },+ {+ "id": "src/graph/write.ts#wiringPath",+ "name": "wiringPath",+ "kind": "function",+ "path": "src/graph/write.ts",+ "span": "L20-L22",+ "signature": "function wiringPath(outDir: string): string",+ "exported": true,+ "origin": "ast",+ "body_hash": "4a454f03e0aa7289fbc47e6493079ab7f8b353b6133b4362158857eda98bb544",+ "summary_state": "ready",+ "summary": "Generates the absolute path for the wiring graph file in a specified output directory.",+ "crux": {+ "code": " return join(outDir, GRAPH_DIR, GRAPH_FILE);",+ "span": "L21-L21"+ }+ },+ {+ "id": "src/graph/write.ts#writeGraph",+ "name": "writeGraph",+ "kind": "function",+ "path": "src/graph/write.ts",+ "span": "L36-L46",+ "signature": "function writeGraph(graph: GraphV1, outDir: string): string",+ "exported": true,+ "origin": "ast",+ "body_hash": "1c7e1c1674a049208f245753f107cf9fb4dceea8ec5c19c8086df2f8af1b7aeb",+ "summary_state": "ready",+ "summary": "Writes a sorted representation of the wiring graph to a specified output directory, ensuring the directory structure exists.",+ "crux": {+ "code": " nodes: [...graph.nodes].sort((a, b) => a.id.localeCompare(b.id)),\n edges: [...graph.edges].sort(edgeOrder),\n };\n const path = wiringPath(outDir);\n mkdirSync(dirname(path), { recursive: true });\n writeFileSync(path, JSON.stringify(sorted, null, 2) + \"\\n\");",+ "span": "L39-L44"+ }+ },+ {+ "id": "src/index.ts",+ "name": "index.ts",+ "kind": "file",+ "path": "src/index.ts",+ "span": "L1-L37",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "e56e74612514fd45665b27e3c47b4a685b503a533b38e1674d256344511107fc",+ "summary_state": "ready",+ "summary": "This file serves as the public API for the Graft library, facilitating the management and synchronization of linked markdown files in a repository.",+ "crux": {+ "code": " * await engine.init(\".\"); // writes .context/*.md + manifest.json\n *\n * const result = engine.check(\".\"); // { ok: boolean, ...drift }\n * if (!result.ok) process.exitCode = 1;",+ "span": "L12-L15"+ }+ },+ {+ "id": "src/ingest/fs.ts",+ "name": "fs.ts",+ "kind": "file",+ "path": "src/ingest/fs.ts",+ "span": "L1-L46",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "a8339532da34b44d35eb9ad16e7106adb1262d73d9895b1bd94574337fb2019f",+ "summary_state": "ready",+ "summary": "This file provides utilities for walking through a filesystem to identify source files while excluding certain directories and large files.",+ "crux": null+ },+ {+ "id": "src/ingest/fs.ts#walkDir",+ "name": "walkDir",+ "kind": "function",+ "path": "src/ingest/fs.ts",+ "span": "L27-L45",+ "signature": "function walkDir(dir: string): string[]",+ "exported": true,+ "origin": "ast",+ "body_hash": "001f6c9f648af0620ed90c55a132464ab87da3ad74b6711df716e9f9493333c4",+ "summary_state": "ready",+ "summary": "The walkDir function recursively collects paths of files in a directory while skipping specified directories and files larger than 1 MB.",+ "crux": {+ "code": " if (entry.name.startsWith(\".\")) continue;\n const full = join(dir, entry.name);\n if (entry.isDirectory()) {\n if (SKIP_DIRS.has(entry.name)) continue;\n out.push(...walkDir(full));\n } else if (entry.isFile()) {\n try {\n if (statSync(full).size > MAX_FILE_BYTES) continue;\n } catch {\n continue;\n }\n out.push(full);",+ "span": "L30-L41"+ }+ },+ {+ "id": "src/util/id.ts",+ "name": "id.ts",+ "kind": "file",+ "path": "src/util/id.ts",+ "span": "L1-L17",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "5fabc8ddcc3abc907ce69f04ad2ebe51933262cf44aa2dfd40589f71f1926e8a",+ "summary_state": "ready",+ "summary": "This file provides utility functions for generating unique identifiers, creating content hashes, and normalizing names for consistent matching.",+ "crux": null+ },+ {+ "id": "src/util/id.ts#contentHash",+ "name": "contentHash",+ "kind": "function",+ "path": "src/util/id.ts",+ "span": "L9-L11",+ "signature": "function contentHash(input: string): string",+ "exported": true,+ "origin": "ast",+ "body_hash": "d83ce720108cb9ea3b0c7b1e7034657603640647ca00283905fcd099ac3fe2ed",+ "summary_state": "ready",+ "summary": "This function creates a stable hash of the input content, which is essential for deduplication of documents.",+ "crux": {+ "code": " return createHash(\"sha256\").update(input).digest(\"hex\");",+ "span": "L10-L10"+ }+ },+ {+ "id": "src/util/id.ts#newId",+ "name": "newId",+ "kind": "function",+ "path": "src/util/id.ts",+ "span": "L4-L6",+ "signature": "function newId(prefix: string): string",+ "exported": true,+ "origin": "ast",+ "body_hash": "55062dee898e1edb76d65f7daf785b67e998a57a7dfd6f78c7eb17f39e3e1dc0",+ "summary_state": "ready",+ "summary": "This function generates a unique identifier with a specified prefix, solving the need for easily identifiable and unique keys.",+ "crux": {+ "code": " return `${prefix}_${randomUUID().replace(/-/g, \"\").slice(0, 20)}`;",+ "span": "L5-L5"+ }+ },+ {+ "id": "src/util/id.ts#normalizeName",+ "name": "normalizeName",+ "kind": "function",+ "path": "src/util/id.ts",+ "span": "L14-L16",+ "signature": "function normalizeName(name: string): string",+ "exported": true,+ "origin": "ast",+ "body_hash": "bac0e298462067a441b2b76566ed29c3787280585b956f84b81d7a766cd7211a",+ "summary_state": "ready",+ "summary": "This function normalizes names for case- and whitespace-insensitive matching, ensuring consistency in name comparisons.",+ "crux": {+ "code": " return name.trim().toLowerCase().replace(/\\s+/g, \" \");",+ "span": "L15-L15"+ }+ },+ {+ "id": "src/viz/assemble.ts",+ "name": "assemble.ts",+ "kind": "file",+ "path": "src/viz/assemble.ts",+ "span": "L1-L131",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "58ad5caed087bd7b929f5b625501a607e79e0476f998636bec241e0296706ece",+ "summary_state": "ready",+ "summary": "Assembles a comprehensive graph document from markdown files in a context directory, ensuring that only valid nodes and edges are included.",+ "crux": {+ "code": "/** Read a context dir and assemble the render-ready graph document. */\nexport function assembleContextGraph(contextDir: string): VizGraph {\n const nodes: VizNode[] = [];\n const rawEdges: VizEdge[] = [];\n let skippedFiles = 0;\n\n if (existsSync(contextDir)) {\n for (const entry of readdirSync(contextDir).sort()) {\n if (!entry.endsWith(\".md\")) continue;\n let parsed: matter.GrayMatterFile<string>;\n try {\n parsed = matter(readFileSync(join(contextDir, entry), \"utf8\"));",+ "span": "L78-L89"+ }+ },+ {+ "id": "src/viz/assemble.ts#assembleContextGraph",+ "name": "assembleContextGraph",+ "kind": "function",+ "path": "src/viz/assemble.ts",+ "span": "L79-L130",+ "signature": "function assembleContextGraph(contextDir: string): VizGraph",+ "exported": true,+ "origin": "ast",+ "body_hash": "8529626bef8abf2e1a326d601cf5a6a4972e0a1b801d6b653ba8227a27b9dbbd",+ "summary_state": "ready",+ "summary": "Processes markdown files in a specified directory to create a structured visualization graph, handling errors gracefully.",+ "crux": {+ "code": " if (existsSync(contextDir)) {\n for (const entry of readdirSync(contextDir).sort()) {\n if (!entry.endsWith(\".md\")) continue;\n let parsed: matter.GrayMatterFile<string>;\n try {\n parsed = matter(readFileSync(join(contextDir, entry), \"utf8\"));\n } catch {\n skippedFiles++;\n continue;\n }\n const fm = parsed.data as Record<string, unknown>;\n const id = String(fm.slug ?? entry.replace(/\\.md$/, \"\"));",+ "span": "L84-L95"+ }+ },+ {+ "id": "src/viz/assemble.ts#extractSummary",+ "name": "extractSummary",+ "kind": "function",+ "path": "src/viz/assemble.ts",+ "span": "L65-L76",+ "signature": "function extractSummary(body: string): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "1857e477bdb012672fa843cfca8d43eb543e7cfba2cc496692a65ebe8c0fa6c5",+ "summary_state": "ready",+ "summary": "Extracts and cleans the summary text from a markdown node's content, ensuring it adheres to length constraints.",+ "crux": {+ "code": "function extractSummary(body: string): string {\n let text = body;\n const start = text.indexOf(GEN_START);\n const end = text.indexOf(GEN_END);\n if (start >= 0 && end > start) text = text.slice(start + GEN_START.length, end);\n // Keep only the Summary section if headings are present.\n const related = text.indexOf(\"## Related\");\n if (related >= 0) text = text.slice(0, related);\n text = text.replace(/^##\\s+Summary\\s*$/m, \"\");\n text = text.trim();\n return text.length > SUMMARY_MAX ? text.slice(0, SUMMARY_MAX).trimEnd() + \"…\" : text;",+ "span": "L65-L75"+ }+ },+ {+ "id": "src/viz/assemble.ts#normalizeRelation",+ "name": "normalizeRelation",+ "kind": "function",+ "path": "src/viz/assemble.ts",+ "span": "L56-L58",+ "signature": "function normalizeRelation(rel: string): string",+ "exported": true,+ "origin": "ast",+ "body_hash": "adfaae55d1d21718adbedaa294194517aa7abdddeb95433642fd358137e48909",+ "summary_state": "ready",+ "summary": "Maps legacy vague verbs to concrete verbs to maintain consistency in the graph's relationships.",+ "crux": {+ "code": "export function normalizeRelation(rel: string): string {\n return NORMALIZE_RELATION[rel] ?? rel;\n}",+ "span": "L56-L58"+ }+ },+ {+ "id": "src/viz/assemble.ts#VizEdge",+ "name": "VizEdge",+ "kind": "interface",+ "path": "src/viz/assemble.ts",+ "span": "L26-L31",+ "signature": "interface VizEdge",+ "exported": true,+ "origin": "ast",+ "body_hash": "bef3aefe267d463b0d4cf617f379adadd4fffb539e9a0a5e240520be60a191cb",+ "summary_state": "ready",+ "summary": "Defines the structure of an edge in the visualization graph, representing relationships between nodes.",+ "crux": null+ },+ {+ "id": "src/viz/assemble.ts#VizGraph",+ "name": "VizGraph",+ "kind": "interface",+ "path": "src/viz/assemble.ts",+ "span": "L33-L42",+ "signature": "interface VizGraph",+ "exported": true,+ "origin": "ast",+ "body_hash": "7edd9c49c11acc8e90963256a92ee2f27415c50446334924e2e260b715b56427",+ "summary_state": "ready",+ "summary": "Encapsulates the complete visualization graph, including metadata about nodes and edges.",+ "crux": null+ },+ {+ "id": "src/viz/assemble.ts#VizNode",+ "name": "VizNode",+ "kind": "interface",+ "path": "src/viz/assemble.ts",+ "span": "L18-L24",+ "signature": "interface VizNode",+ "exported": true,+ "origin": "ast",+ "body_hash": "ec19a79898c594e5afc405cab037fcc0c43144c5766af8a955dccda7df733ba6",+ "summary_state": "ready",+ "summary": "Defines the structure of a node in the visualization graph, encapsulating its identity and attributes.",+ "crux": null+ },+ {+ "id": "src/viz/serve.ts",+ "name": "serve.ts",+ "kind": "file",+ "path": "src/viz/serve.ts",+ "span": "L1-L149",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "14283762f454c01fc95cfbe9c2b41ef063fc17c4c3e5d120b5dc7f66f541fc1c",+ "summary_state": "ready",+ "summary": "This file implements a local server for serving a viewer and handling API requests related to context and code graphs.",+ "crux": {+ "code": " const server = createServer((req, res) => {\n const path = (req.url ?? \"/\").split(\"?\")[0];\n\n const asset = STATIC_FILES[path];\n if (asset) {\n const file = join(opts.viewerDir, asset.file);\n if (!existsSync(file)) {\n res.writeHead(404, { \"content-type\": \"text/plain\" });\n res.end(\"viewer bundle missing — run the package build\");\n return;\n }\n res.writeHead(200, { \"content-type\": asset.type });",+ "span": "L60-L71"+ }+ },+ {+ "id": "src/viz/serve.ts#listen",+ "name": "listen",+ "kind": "function",+ "path": "src/viz/serve.ts",+ "span": "L43-L55",+ "signature": "function listen(server: Server, port: number): Promise<boolean>",+ "exported": false,+ "origin": "ast",+ "body_hash": "b43a357dceb98a6eb6676409503021e6e38f13d7d442d44ba819dda0c0ea6246",+ "summary_state": "ready",+ "summary": "Attempts to bind the server to a specified port, handling errors if the port is in use.",+ "crux": {+ "code": " return new Promise((resolve, reject) => {\n const onError = (err: NodeJS.ErrnoException) => {\n if (err.code === \"EADDRINUSE\") resolve(false);\n else reject(err);\n };\n server.once(\"error\", onError);\n server.listen(port, \"127.0.0.1\", () => {\n server.removeListener(\"error\", onError);\n resolve(true);\n });",+ "span": "L44-L53"+ }+ },+ {+ "id": "src/viz/serve.ts#listen.onError",+ "name": "onError",+ "kind": "function",+ "path": "src/viz/serve.ts",+ "span": "L45-L48",+ "signature": "onError = (err: NodeJS.ErrnoException)",+ "exported": false,+ "origin": "ast",+ "body_hash": "6643919e3ea413fc58afe100fe65dc3beccadb7aa66bf5d3247e072c83d9d000",+ "summary_state": "ready",+ "summary": "Handles errors that occur when trying to bind the server to a port.",+ "crux": null+ },+ {+ "id": "src/viz/serve.ts#sendJson",+ "name": "sendJson",+ "kind": "function",+ "path": "src/viz/serve.ts",+ "span": "L38-L41",+ "signature": "function sendJson(res: ServerResponse, status: number, body: unknown): void",+ "exported": false,+ "origin": "ast",+ "body_hash": "a2b33c898c929db2715116f964722f5e438e61a58fdfa4607d21c4365df5da6a",+ "summary_state": "ready",+ "summary": "Sends a JSON response with the specified status and body to the client.",+ "crux": {+ "code": " res.writeHead(status, { \"content-type\": \"application/json; charset=utf-8\" });\n res.end(JSON.stringify(body));\n}",+ "span": "L39-L41"+ }+ },+ {+ "id": "src/viz/serve.ts#startVizServer",+ "name": "startVizServer",+ "kind": "function",+ "path": "src/viz/serve.ts",+ "span": "L57-L148",+ "signature": "async function startVizServer(opts: VizServerOptions): Promise<VizServer>",+ "exported": true,+ "origin": "ast",+ "body_hash": "d652f8a8b5ea738a1ff68592d9644525dee438568c9158e5edffe536b1f1aa16",+ "summary_state": "ready",+ "summary": "Initializes and starts the visualization server, setting up routes and handling requests.",+ "crux": {+ "code": " const server = createServer((req, res) => {\n const path = (req.url ?? \"/\").split(\"?\")[0];\n\n const asset = STATIC_FILES[path];\n if (asset) {\n const file = join(opts.viewerDir, asset.file);\n if (!existsSync(file)) {\n res.writeHead(404, { \"content-type\": \"text/plain\" });\n res.end(\"viewer bundle missing — run the package build\");\n return;\n }\n res.writeHead(200, { \"content-type\": asset.type });",+ "span": "L60-L71"+ }+ },+ {+ "id": "src/viz/serve.ts#startVizServer.close",+ "name": "close",+ "kind": "method",+ "path": "src/viz/serve.ts",+ "span": "L140-L146",+ "signature": "close(): Promise<void>",+ "exported": true,+ "origin": "ast",+ "body_hash": "69dc0089d8f1d6e843c8add8fabf2e120fd1045505f9c15632ba93bdc58c01d4",+ "summary_state": "ready",+ "summary": "Closes the visualization server and cleans up resources.",+ "crux": {+ "code": " close(): Promise<void> {\n clearTimeout(debounce);\n watcher?.close();\n for (const client of sseClients) client.end();\n sseClients.clear();\n return new Promise((resolve, reject) => server.close((err) => (err ? reject(err) : resolve())));\n },",+ "span": "L140-L146"+ }+ },+ {+ "id": "src/viz/serve.ts#VizServer",+ "name": "VizServer",+ "kind": "interface",+ "path": "src/viz/serve.ts",+ "span": "L23-L26",+ "signature": "interface VizServer",+ "exported": true,+ "origin": "ast",+ "body_hash": "9c56587daccba8982a5f5da3a0ea5f185becea8c4f4927331b15117f5d456214",+ "summary_state": "ready",+ "summary": "Represents the visualization server with its URL and a method to close it.",+ "crux": null+ },+ {+ "id": "src/viz/serve.ts#VizServerOptions",+ "name": "VizServerOptions",+ "kind": "interface",+ "path": "src/viz/serve.ts",+ "span": "L16-L21",+ "signature": "interface VizServerOptions",+ "exported": true,+ "origin": "ast",+ "body_hash": "0b439484269a73c19df0d658113fbdc889c2214d1081e08d92bc86ae99e0c795",+ "summary_state": "ready",+ "summary": "Defines the configuration options required to start the visualization server.",+ "crux": null+ },+ {+ "id": "test/context.test.ts",+ "name": "context.test.ts",+ "kind": "file",+ "path": "test/context.test.ts",+ "span": "L1-L137",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "7c1242872b127117c7cc50404895d7ffcf286a51b611cd23c4ffabd5db8d43f3",+ "summary_state": "ready",+ "summary": "This file contains end-to-end tests for the markdown-graph pipeline to ensure proper functionality and integrity of the context building and checking processes.",+ "crux": {+ "code": "test(\"init builds one markdown node per entity, with links and a manifest\", async () => {\n const dir = makeFixture();\n try {\n const r = await buildContext(dir, buildOpts());\n // Auth Service, Token Store, Billing.\n assert.equal(r.nodes, 3);\n assert.equal(r.links, 2);\n assert.equal(r.files, 2);\n\n const ctx = join(dir, \"graft\");\n assert.ok(existsSync(join(ctx, \"auth-service.md\")));\n assert.ok(existsSync(join(ctx, \"token-store.md\")));",+ "span": "L31-L42"+ }+ },+ {+ "id": "test/context.test.ts#buildOpts",+ "name": "buildOpts",+ "kind": "function",+ "path": "test/context.test.ts",+ "span": "L27-L29",+ "signature": "function buildOpts()",+ "exported": false,+ "origin": "ast",+ "body_hash": "20ec093d8fa9dadc46af8980d9440b6824597f4cdeb74529d4d62ee38d27e52d",+ "summary_state": "ready",+ "summary": "This function generates options for building the context, including a fake model and providers.",+ "crux": null+ },+ {+ "id": "test/context.test.ts#makeFixture",+ "name": "makeFixture",+ "kind": "function",+ "path": "test/context.test.ts",+ "span": "L14-L25",+ "signature": "function makeFixture(): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "515198ac732683d4da4b920e53a0eb439ea8e0107afb22af65cc29c0e702192c",+ "summary_state": "ready",+ "summary": "This function creates a temporary directory with mock service files for testing the context building process.",+ "crux": {+ "code": " const dir = mkdtempSync(join(tmpdir(), \"ctxgraph-\"));\n writeFileSync(\n join(dir, \"auth.ts\"),\n `// [[Auth Service]] ==depends_on==> [[Token Store]]\\nexport const auth = 1;\\n`,\n );\n writeFileSync(\n join(dir, \"billing.ts\"),\n `// [[Billing]] ==uses==> [[Auth Service]]\\nexport const billing = 2;\\n`,\n );\n return dir;",+ "span": "L15-L24"+ }+ },+ {+ "id": "test/covers.test.ts",+ "name": "covers.test.ts",+ "kind": "file",+ "path": "test/covers.test.ts",+ "span": "L1-L77",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "f5a75f405be1a01ad43fc806588858df3a8988fee62ad4ec024440d3f5e0fc0c",+ "summary_state": "ready",+ "summary": "This test suite verifies that the wiring build correctly populates the 'covers' field in concept nodes and maintains stability across builds.",+ "crux": {+ "code": "test(\"wiring build backfills covers: onto concept nodes\", async () => {\n const dir = makeFixture();\n try {\n await buildContext(dir, { model: \"fake\", ...fakeProviders() });\n await buildGraph(dir); // $0, no LLM — still writes cards + covers\n\n const fm = matter(readFileSync(join(dir, \"graft\", \"auth-service.md\"), \"utf8\")).data;\n assert.ok(Array.isArray(fm.covers), \"covers should be an array\");\n const login = fm.covers.find((c: { symbol: string }) => c.symbol === \"login\");\n assert.ok(login, \"covers should include the login function\");\n assert.equal(login.kind, \"function\");\n assert.match(login.at, /^auth\\.ts:L\\d+-L\\d+$/);",+ "span": "L26-L37"+ }+ },+ {+ "id": "test/covers.test.ts#makeFixture",+ "name": "makeFixture",+ "kind": "function",+ "path": "test/covers.test.ts",+ "span": "L16-L24",+ "signature": "function makeFixture(): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "c50f4905cfffe46da829a42a2bcab6838f96a17497009a9efe7a64a98729540f",+ "summary_state": "ready",+ "summary": "Creates a temporary directory with a sample TypeScript file for testing the wiring build.",+ "crux": {+ "code": " const dir = mkdtempSync(join(tmpdir(), \"graft-covers-\"));\n writeFileSync(\n join(dir, \"auth.ts\"),\n `// [[Auth Service]] ==depends_on==> [[Token Store]]\\n` +\n `export function login(user: string): boolean {\\n return user.length > 0;\\n}\\n`,\n );\n return dir;",+ "span": "L17-L23"+ }+ },+ {+ "id": "test/helpers.ts",+ "name": "helpers.ts",+ "kind": "file",+ "path": "test/helpers.ts",+ "span": "L1-L55",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "e45af1d38d7c6d4abc804fc74e9ae4c3373cf78769c17b16b185c3ee0e2c3228",+ "summary_state": "ready",+ "summary": "This file provides test doubles for offline, deterministic testing of components without external dependencies.",+ "crux": null+ },+ {+ "id": "test/helpers.ts#BracketSynthesizer",+ "name": "BracketSynthesizer",+ "kind": "class",+ "path": "test/helpers.ts",+ "span": "L21-L50",+ "signature": "class BracketSynthesizer implements Synthesizer",+ "exported": true,+ "origin": "ast",+ "body_hash": "6a30b1293990bb2dce95f1f1f77219dbcdc54eef7e6a01d0db03403f4d344bcc",+ "summary_state": "ready",+ "summary": "This class synthesizes a graph structure from simple markup, enabling tests to define the relationships between nodes explicitly.",+ "crux": {+ "code": " async synthesize(files: FileSummary[]): Promise<SynthNode[]> {\n const byName = new Map<string, { sources: Set<string>; links: Map<string, SynthLink> }>();\n const ensure = (name: string) => {\n let e = byName.get(name);\n if (!e) {\n e = { sources: new Set(), links: new Map() };\n byName.set(name, e);\n }\n return e;\n };\n for (const f of files) {\n for (const m of f.summary.matchAll(/\\[\\[([^\\]]+)\\]\\]/g)) {",+ "span": "L22-L33"+ }+ },+ {+ "id": "test/helpers.ts#BracketSynthesizer.synthesize",+ "name": "synthesize",+ "kind": "method",+ "path": "test/helpers.ts",+ "span": "L22-L49",+ "signature": "async synthesize(files: FileSummary[]): Promise<SynthNode[]>",+ "exported": true,+ "origin": "ast",+ "body_hash": "b42a19064389576a02ba334fcab8bfb5d8d985a46f995be864095e770d47e26d",+ "summary_state": "ready",+ "summary": "This method processes file summaries to create a structured representation of nodes and their relationships based on markup.",+ "crux": {+ "code": " for (const m of f.summary.matchAll(/\\[\\[([^\\]]+)\\]\\]\\s*==([a-z_]+)==>\\s*\\[\\[([^\\]]+)\\]\\]/g)) {\n const [, from, relation, to] = m;\n ensure(to.trim()).sources.add(f.path);\n ensure(from.trim()).links.set(`${to}|${relation}`, { to: to.trim(), relation });\n }",+ "span": "L36-L40"+ }+ },+ {+ "id": "test/helpers.ts#BracketSynthesizer.synthesize.ensure",+ "name": "ensure",+ "kind": "function",+ "path": "test/helpers.ts",+ "span": "L24-L31",+ "signature": "ensure = (name: string)",+ "exported": true,+ "origin": "ast",+ "body_hash": "3b8cc65a6170766e70a5b038f9f27176e60114ce70e0e2dc1463f720ed384c4c",+ "summary_state": "ready",+ "summary": "This function ensures that a node exists in the map, creating it if necessary, to maintain the graph structure.",+ "crux": {+ "code": " const ensure = (name: string) => {\n let e = byName.get(name);\n if (!e) {\n e = { sources: new Set(), links: new Map() };\n byName.set(name, e);\n }\n return e;\n };",+ "span": "L24-L31"+ }+ },+ {+ "id": "test/helpers.ts#fakeProviders",+ "name": "fakeProviders",+ "kind": "function",+ "path": "test/helpers.ts",+ "span": "L52-L54",+ "signature": "function fakeProviders()",+ "exported": true,+ "origin": "ast",+ "body_hash": "0395bc21ba030a5d0e1fc9e5fdd0d8780c4309c87d899bedbc940f1bdcd2864f",+ "summary_state": "ready",+ "summary": "This function creates and returns instances of the test doubles for summarization and synthesis.",+ "crux": null+ },+ {+ "id": "test/helpers.ts#PassthroughSummarizer",+ "name": "PassthroughSummarizer",+ "kind": "class",+ "path": "test/helpers.ts",+ "span": "L9-L13",+ "signature": "class PassthroughSummarizer implements Summarizer",+ "exported": true,+ "origin": "ast",+ "body_hash": "43c71f9e449859d657d6cef17b80d2bb650734751530e8401c356fc963f7b012",+ "summary_state": "ready",+ "summary": "This class serves as a no-op summarizer that returns the input code unchanged for controlled testing.",+ "crux": {+ "code": " async summarize(code: string): Promise<string> {\n return code;\n }",+ "span": "L10-L12"+ }+ },+ {+ "id": "test/helpers.ts#PassthroughSummarizer.summarize",+ "name": "summarize",+ "kind": "method",+ "path": "test/helpers.ts",+ "span": "L10-L12",+ "signature": "async summarize(code: string): Promise<string>",+ "exported": true,+ "origin": "ast",+ "body_hash": "8836e78c4875dee01aeae5cb976c217cd347554542e387996b7c190b1a73af18",+ "summary_state": "ready",+ "summary": "This method returns the input code as-is, allowing tests to control the output precisely.",+ "crux": {+ "code": " async summarize(code: string): Promise<string> {\n return code;\n }",+ "span": "L10-L12"+ }+ },+ {+ "id": "test/viz-assemble.test.ts",+ "name": "viz-assemble.test.ts",+ "kind": "file",+ "path": "test/viz-assemble.test.ts",+ "span": "L1-L106",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "89a2a9f11f459a8110f9d89b2de780dfd164504f3b4c7dc61953a6c83c5911cb",+ "summary_state": "ready",+ "summary": "This file contains tests that validate the assembly of a context graph from markdown frontmatter, ensuring proper relation normalization and error handling for malformed files.",+ "crux": {+ "code": "test(\"assembleContextGraph builds nodes and edges from frontmatter\", () => {\n const dir = makeContextDir();\n try {\n const g = assembleContextGraph(dir);\n\n assert.equal(g.nodes.length, 2);\n assert.deepEqual(g.nodes.map((n) => n.id).sort(), [\"alpha\", \"beta\"]);\n\n const alpha = g.nodes.find((n) => n.id === \"alpha\")!;\n assert.equal(alpha.name, \"Alpha\");\n assert.equal(alpha.type, \"system\");\n assert.deepEqual(alpha.sources, [\"src/a.ts\"]);",+ "span": "L62-L73"+ }+ },+ {+ "id": "test/viz-assemble.test.ts#makeContextDir",+ "name": "makeContextDir",+ "kind": "function",+ "path": "test/viz-assemble.test.ts",+ "span": "L12-L60",+ "signature": "function makeContextDir(): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "4fab7dd2dc5bc7c0b9d575f8396bdca67e8d2d5a9f337aa14ef7740dd87b2119",+ "summary_state": "ready",+ "summary": "This function creates a temporary directory with markdown files to simulate context data for testing the graph assembly.",+ "crux": {+ "code": " const dir = mkdtempSync(join(tmpdir(), \"graftviz-\"));\n writeFileSync(\n join(dir, \"alpha.md\"),\n `---\nname: Alpha\nslug: alpha\ntype: system\nsources:\n - path: src/a.ts\n hash: abc123\nlinks:\n - to: beta",+ "span": "L13-L24"+ }+ },+ {+ "id": "test/viz-serve.test.ts",+ "name": "viz-serve.test.ts",+ "kind": "file",+ "path": "test/viz-serve.test.ts",+ "span": "L1-L101",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "d22168054844e83bc5257271c4cc80a6e3eb1315e600c03b48fe6b54afd5c243",+ "summary_state": "ready",+ "summary": "This file contains tests for the viz server, ensuring it serves the correct endpoints and handles various scenarios like port fallback and context directory changes.",+ "crux": {+ "code": "test(\"viz server serves viewer, context graph, and gates code graph\", async () => {\n const { contextDir, viewerDir, root } = makeDirs();\n const srv = await startVizServer({ contextDir, viewerDir, port: 4831, repoName: \"fixture\" });\n try {\n const html = await fetch(`${srv.url}/`).then((r) => r.text());\n assert.match(html, /stub/);\n\n const graph = await fetch(`${srv.url}/api/context-graph`).then((r) => r.json());\n assert.equal(graph.meta.nodeCount, 1);\n assert.equal(graph.meta.repoName, \"fixture\");\n assert.equal(graph.nodes[0].id, \"alpha\");\n",+ "span": "L29-L40"+ }+ },+ {+ "id": "test/viz-serve.test.ts#makeDirs",+ "name": "makeDirs",+ "kind": "function",+ "path": "test/viz-serve.test.ts",+ "span": "L13-L27",+ "signature": "function makeDirs(): { contextDir: string; viewerDir: string; root: string }",+ "exported": false,+ "origin": "ast",+ "body_hash": "cff2ec95e868528eec2623a2907ab4c4e3e4a55224d0551b1fb8a63e8bbc124d",+ "summary_state": "ready",+ "summary": "This function creates necessary directory structures and files for testing the viz server.",+ "crux": {+ "code": " const root = mkdtempSync(join(tmpdir(), \"graftviz-srv-\"));\n const contextDir = join(root, \".context\");\n const viewerDir = join(root, \"viewer\");\n mkdirSync(contextDir);\n mkdirSync(viewerDir);\n writeFileSync(join(viewerDir, \"index.html\"), \"<title>stub</title>\\n\");\n writeFileSync(join(viewerDir, \"app.js\"), \"// stub\\n\");\n writeFileSync(join(viewerDir, \"style.css\"), \"/* stub */\\n\");\n writeFileSync(\n join(contextDir, \"alpha.md\"),\n `---\\nname: Alpha\\nslug: alpha\\ntype: system\\nsources: []\\nlinks: []\\n---\\nbody\\n`,\n );",+ "span": "L14-L25"+ }+ },+ {+ "id": "viewer/data.ts",+ "name": "data.ts",+ "kind": "file",+ "path": "viewer/data.ts",+ "span": "L1-L122",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "e9c5c89ad933e06004cbeddc1b1d7b60a6057726a463c66f9673ba20a3c61afd",+ "summary_state": "ready",+ "summary": "This file defines data structures and functions for managing and visualizing graph data from a server.",+ "crux": null+ },+ {+ "id": "viewer/data.ts#chipKey",+ "name": "chipKey",+ "kind": "function",+ "path": "viewer/data.ts",+ "span": "L47-L51",+ "signature": "function chipKey(rel: string): string",+ "exported": true,+ "origin": "ast",+ "body_hash": "85dd128b9f3bf028efaeac2428474b0d70ac47e8e94bcba80c111d59a6006df9",+ "summary_state": "ready",+ "summary": "Generates a key for chip grouping based on the relation verb, simplifying the visualization of relationships.",+ "crux": {+ "code": " if (famOf(rel) === \"structure\") return \"part of\";\n if (rel === \"calls\" || rel === \"uses\" || rel === \"depends_on\" || rel === \"imports\") return \"uses\";\n return rel.replace(/_/g, \" \");",+ "span": "L48-L50"+ }+ },+ {+ "id": "viewer/data.ts#CodeGraphV1",+ "name": "CodeGraphV1",+ "kind": "interface",+ "path": "viewer/data.ts",+ "span": "L86-L93",+ "signature": "interface CodeGraphV1",+ "exported": false,+ "origin": "ast",+ "body_hash": "e494a9a322973f3bc8af2017764ac546a8e9cb7b03cae5aeb730f48ad2521d90",+ "summary_state": "ready",+ "summary": "Defines the structure of the code graph data received from the server, including nodes and edges.",+ "crux": null+ },+ {+ "id": "viewer/data.ts#colorToken",+ "name": "colorToken",+ "kind": "function",+ "path": "viewer/data.ts",+ "span": "L72-L75",+ "signature": "function colorToken(tab: \"context\" | \"code\", type: string): string",+ "exported": true,+ "origin": "ast",+ "body_hash": "dc48f14294140f474d97fdedf0bdbbbe487d5f0bcdeda6ae84f87251ab24b007",+ "summary_state": "ready",+ "summary": "Maps a type to its corresponding CSS custom property for styling in the visualization.",+ "crux": {+ "code": " return m[type] ?? \"--edge\";",+ "span": "L74-L74"+ }+ },+ {+ "id": "viewer/data.ts#cvar",+ "name": "cvar",+ "kind": "function",+ "path": "viewer/data.ts",+ "span": "L77-L79",+ "signature": "function cvar(name: string): string",+ "exported": true,+ "origin": "ast",+ "body_hash": "89e6f3b44e0dd358542573894691c925266e88da9160b79be00d043ae17245e8",+ "summary_state": "ready",+ "summary": "Retrieves the value of a CSS custom property from the document's root element.",+ "crux": null+ },+ {+ "id": "viewer/data.ts#Family",+ "name": "Family",+ "kind": "type",+ "path": "viewer/data.ts",+ "span": "L29-L29",+ "signature": "type Family = \"structure\" | \"dependency\" | \"contract\" | \"association\";",+ "exported": true,+ "origin": "ast",+ "body_hash": "324db0cd1c7f2eebbda194734b2a8db880eb835949f0325780ea5ae75308ef05",+ "summary_state": "ready",+ "summary": "Categorizes relation verbs into families to enforce consistent semantics in graph relationships.",+ "crux": null+ },+ {+ "id": "viewer/data.ts#famOf",+ "name": "famOf",+ "kind": "function",+ "path": "viewer/data.ts",+ "span": "L39-L41",+ "signature": "function famOf(rel: string): Family",+ "exported": true,+ "origin": "ast",+ "body_hash": "faed31084ad49496d754f589593081a76a4cd98e714ff10a10c07d5cd476738d",+ "summary_state": "ready",+ "summary": "Determines the family category of a given relation verb, defaulting to 'association' if unknown.",+ "crux": {+ "code": " return FAMILY[rel] ?? \"association\";",+ "span": "L40-L40"+ }+ },+ {+ "id": "viewer/data.ts#loadCodeGraph",+ "name": "loadCodeGraph",+ "kind": "function",+ "path": "viewer/data.ts",+ "span": "L96-L113",+ "signature": "async function loadCodeGraph(): Promise<VizGraph | null>",+ "exported": true,+ "origin": "ast",+ "body_hash": "343a1a01362fa33345082eb6cd5a04cfc1b7a1411de7bc23422c5ac5ebb1fae1",+ "summary_state": "ready",+ "summary": "Loads the code graph from the server, filtering out unresolved edges and returning a structured graph.",+ "crux": {+ "code": " if (!res.ok) return null;\n const raw = (await res.json()) as CodeGraphV1;\n const nodes: VizNode[] = raw.nodes.map((n) => ({\n id: n.id,\n name: n.name,\n type: n.kind,\n summary: n.summary ?? n.signature ?? \"\",\n sources: [`${n.path} · ${n.span}`],\n }));\n const known = new Set(nodes.map((n) => n.id));\n // imports edges may point at unresolved module strings — drop those for rendering\n const edges: VizEdge[] = raw.edges",+ "span": "L98-L109"+ }+ },+ {+ "id": "viewer/data.ts#loadContextGraph",+ "name": "loadContextGraph",+ "kind": "function",+ "path": "viewer/data.ts",+ "span": "L81-L84",+ "signature": "async function loadContextGraph(): Promise<VizGraph>",+ "exported": true,+ "origin": "ast",+ "body_hash": "c65d9227bea8ceceffd49b4eb8475677aef8ca8820b966d9228a31875a6589e1",+ "summary_state": "ready",+ "summary": "Fetches the context graph data from the server and returns it in a structured format.",+ "crux": {+ "code": " const res = await fetch(\"/api/context-graph\");\n return (await res.json()) as VizGraph;",+ "span": "L82-L83"+ }+ },+ {+ "id": "viewer/data.ts#onServerChange",+ "name": "onServerChange",+ "kind": "function",+ "path": "viewer/data.ts",+ "span": "L116-L121",+ "signature": "function onServerChange(handler: () => void): void",+ "exported": true,+ "origin": "ast",+ "body_hash": "d864a1d7995232ad54351830e5963a2c6fc8c64cc5a941cf9cfea74d688514c9",+ "summary_state": "ready",+ "summary": "Subscribes to server events to trigger updates in the application when changes occur.",+ "crux": {+ "code": " if (ev.data === \"change\") handler();",+ "span": "L119-L119"+ }+ },+ {+ "id": "viewer/data.ts#VizEdge",+ "name": "VizEdge",+ "kind": "interface",+ "path": "viewer/data.ts",+ "span": "L14-L20",+ "signature": "interface VizEdge",+ "exported": true,+ "origin": "ast",+ "body_hash": "13baa6c9acc4c78eec36835e02fd49df79e869f836880341a959be134ceaabb1",+ "summary_state": "ready",+ "summary": "Defines the relationship between two nodes in the visualization graph, including its type and description.",+ "crux": null+ },+ {+ "id": "viewer/data.ts#VizGraph",+ "name": "VizGraph",+ "kind": "interface",+ "path": "viewer/data.ts",+ "span": "L22-L26",+ "signature": "interface VizGraph",+ "exported": true,+ "origin": "ast",+ "body_hash": "6448a4bb9c71c7932dce92d9d8a452f99a0a100041bd30c5b6759c5784b0f098",+ "summary_state": "ready",+ "summary": "Encapsulates the entire visualization graph structure, including its nodes and edges.",+ "crux": null+ },+ {+ "id": "viewer/data.ts#VizNode",+ "name": "VizNode",+ "kind": "interface",+ "path": "viewer/data.ts",+ "span": "L6-L12",+ "signature": "interface VizNode",+ "exported": true,+ "origin": "ast",+ "body_hash": "ec19a79898c594e5afc405cab037fcc0c43144c5766af8a955dccda7df733ba6",+ "summary_state": "ready",+ "summary": "Represents a node in the visualization graph, encapsulating its identity and metadata.",+ "crux": null+ },+ {+ "id": "viewer/detail.ts",+ "name": "detail.ts",+ "kind": "file",+ "path": "viewer/detail.ts",+ "span": "L1-L59",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "fe8df7c5561f2a8588cf4e1ecb367d19cb6b480fe4855f05e4f96137d8078884",+ "summary_state": "ready",+ "summary": "This file provides the logic to render a detailed view of a selected node in a graph, including its properties and relationships.",+ "crux": {+ "code": " if (!id || !graph) {\n host.innerHTML = '<div class=\"empty\">Select a node to view details</div>';\n return;\n }\n const node = graph.nodes.find((n) => n.id === id);\n if (!node) {\n host.innerHTML = '<div class=\"empty\">Select a node to view details</div>';\n return;\n }\n const color = cvar(colorToken(tab, node.type));\n const name = (nid: string) => graph.nodes.find((n) => n.id === nid)?.name ?? nid;\n const out = graph.edges.filter((e) => e.source === id);",+ "span": "L19-L30"+ }+ },+ {+ "id": "viewer/detail.ts#esc",+ "name": "esc",+ "kind": "function",+ "path": "viewer/detail.ts",+ "span": "L8-L10",+ "signature": "function esc(s: string): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "9fb927f7f1c881ee1fe325c0dc8a25b8c5cdb2c101b08ae935a35bb428f5bbdb",+ "summary_state": "ready",+ "summary": "This function sanitizes a string for safe HTML rendering by escaping special characters.",+ "crux": {+ "code": " return s.replace(/&/g, \"&\").replace(/</g, \"<\");\n}",+ "span": "L9-L10"+ }+ },+ {+ "id": "viewer/detail.ts#renderDetail",+ "name": "renderDetail",+ "kind": "function",+ "path": "viewer/detail.ts",+ "span": "L12-L58",+ "signature": "function renderDetail( host: HTMLElement, graph: VizGraph | null, tab: \"context\" | \"code\", id: string | null, onNavigate: (id: string) => void, ): void",+ "exported": true,+ "origin": "ast",+ "body_hash": "bbd0db0a7f39cbfbd9b0ca31f88118c9a2cd037d394ad47bff7203a6f399f5ca",+ "summary_state": "ready",+ "summary": "This function renders the details of a selected node, including its type, name, summary, sources, and relationships.",+ "crux": {+ "code": " const color = cvar(colorToken(tab, node.type));\n const name = (nid: string) => graph.nodes.find((n) => n.id === nid)?.name ?? nid;\n const out = graph.edges.filter((e) => e.source === id);\n const inn = graph.edges.filter((e) => e.target === id);\n\n let html = `<span class=\"d-type\"><span class=\"sw\" style=\"background:${color}\"></span>${esc(node.type)}</span>`;\n html += `<h3>${esc(node.name)}</h3>`;\n if (node.summary) html += `<p class=\"summary\">${esc(node.summary)}</p>`;\n if (node.sources.length) {\n html += `<div class=\"d-label\">Sources · ${node.sources.length}</div>`;\n for (const s of node.sources) html += `<div class=\"src mono\">${esc(s)}</div>`;\n }",+ "span": "L28-L39"+ }+ },+ {+ "id": "viewer/detail.ts#renderDetail.linkList",+ "name": "linkList",+ "kind": "function",+ "path": "viewer/detail.ts",+ "span": "L40-L50",+ "signature": "linkList = (edges: typeof out, dotColor: string, title: string, other: (e: (typeof out)[number]) => string)",+ "exported": true,+ "origin": "ast",+ "body_hash": "f103fe554602f3315706280d7eba1016c647c77fa6af27e9a4ec0442d6cf1d89",+ "summary_state": "ready",+ "summary": "This function generates HTML for displaying a list of links related to a node, categorized by their relationship type.",+ "crux": {+ "code": " if (!edges.length) return;\n html += `<div class=\"d-label\"><span class=\"dot\" style=\"background:${dotColor}\"></span>${title} · ${edges.length}</div>`;\n for (const e of edges) {\n html += `<button class=\"lnk\" data-go=\"${esc(other(e))}\">` +\n `<span class=\"rel\">${esc(e.relation.replace(/_/g, \" \"))}</span> ` +\n `<span class=\"to\">${esc(name(other(e)))}</span>` +\n (e.description ? `<div class=\"desc\">${esc(e.description)}</div>` : \"\") +\n `</button>`;\n }\n };",+ "span": "L41-L50"+ }+ },+ {+ "id": "viewer/detail.ts#renderDetail.name",+ "name": "name",+ "kind": "function",+ "path": "viewer/detail.ts",+ "span": "L29-L29",+ "signature": "name = (nid: string)",+ "exported": true,+ "origin": "ast",+ "body_hash": "617c48812e0f0520b45da770cf91aeea5330b7e690c6d93defd4da77edf11b8a",+ "summary_state": "ready",+ "summary": "This function retrieves the name of a node by its ID, providing a fallback if not found.",+ "crux": {+ "code": " const name = (nid: string) => graph.nodes.find((n) => n.id === nid)?.name ?? nid;",+ "span": "L29-L29"+ }+ },+ {+ "id": "viewer/graph.ts",+ "name": "graph.ts",+ "kind": "file",+ "path": "viewer/graph.ts",+ "span": "L1-L335",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "192a59b16da8327457de6723893fd9207dd9570a35cd664f96534a7b85e73e01",+ "summary_state": "ready",+ "summary": "This file implements a force-directed graph visualization using D3.js, allowing interactive exploration of nodes and edges.",+ "crux": {+ "code": " setData(graph: VizGraph, tab: \"context\" | \"code\"): void {\n this.tab = tab;\n const prev = new Map(this.nodes.map((n) => [n.id, n]));\n const deg: Record<string, number> = {};\n for (const e of graph.edges) {\n deg[e.source] = (deg[e.source] ?? 0) + 1;\n deg[e.target] = (deg[e.target] ?? 0) + 1;\n }\n const W = this.svg.clientWidth || 800;\n const H = this.svg.clientHeight || 600;\n this.nodes = graph.nodes.map((n, i) => {\n const p = prev.get(n.id);",+ "span": "L94-L105"+ }+ },+ {+ "id": "viewer/graph.ts#el",+ "name": "el",+ "kind": "function",+ "path": "viewer/graph.ts",+ "span": "L42-L46",+ "signature": "function el<K extends keyof SVGElementTagNameMap>(tag: K, attrs: Record<string, string | number>): SVGElementTagNameMap[K]",+ "exported": false,+ "origin": "ast",+ "body_hash": "de7f696c06af5d771e8e661f398d9d275ca2cc06d86f4e91458d671480e346b7",+ "summary_state": "ready",+ "summary": "Creates and returns an SVG element with specified attributes, facilitating dynamic SVG generation.",+ "crux": null+ },+ {+ "id": "viewer/graph.ts#GraphView",+ "name": "GraphView",+ "kind": "class",+ "path": "viewer/graph.ts",+ "span": "L48-L334",+ "signature": "class GraphView",+ "exported": true,+ "origin": "ast",+ "body_hash": "1405c1f292294538c45794740adf01c59c83d3fd7047b6efa8c04c90a4409310",+ "summary_state": "ready",+ "summary": "Manages the rendering and interaction of the graph view, including node and edge updates.",+ "crux": {+ "code": " setData(graph: VizGraph, tab: \"context\" | \"code\"): void {\n this.tab = tab;\n const prev = new Map(this.nodes.map((n) => [n.id, n]));\n const deg: Record<string, number> = {};\n for (const e of graph.edges) {\n deg[e.source] = (deg[e.source] ?? 0) + 1;\n deg[e.target] = (deg[e.target] ?? 0) + 1;\n }\n const W = this.svg.clientWidth || 800;\n const H = this.svg.clientHeight || 600;\n this.nodes = graph.nodes.map((n, i) => {\n const p = prev.get(n.id);",+ "span": "L94-L105"+ }+ },+ {+ "id": "viewer/graph.ts#GraphView.applyView",+ "name": "applyView",+ "kind": "method",+ "path": "viewer/graph.ts",+ "span": "L268-L270",+ "signature": "private applyView(): void",+ "exported": true,+ "origin": "ast",+ "body_hash": "2adb54996d6ef9272cd69144b4b6c4bb92236506a3f5bf2d589faffd5218554b",+ "summary_state": "ready",+ "summary": "Applies the current view transformation to the graph, adjusting the viewport accordingly.",+ "crux": {+ "code": " private applyView(): void {\n this.viewport.setAttribute(\"transform\", `translate(${this.view.x},${this.view.y}) scale(${this.view.k})`);\n }",+ "span": "L268-L270"+ }+ },+ {+ "id": "viewer/graph.ts#GraphView.bindDrag",+ "name": "bindDrag",+ "kind": "method",+ "path": "viewer/graph.ts",+ "span": "L290-L309",+ "signature": "private bindDrag(group: SVGGElement, node: SimNode): void",+ "exported": true,+ "origin": "ast",+ "body_hash": "00e851d11e1029516256411b627b60e78d781cdc62ada046a0eb93c55c2dd009",+ "summary_state": "ready",+ "summary": "Enables dragging functionality for nodes, allowing users to reposition them interactively.",+ "crux": {+ "code": " private bindDrag(group: SVGGElement, node: SimNode): void {\n group.addEventListener(\"pointerdown\", (ev) => {\n ev.stopPropagation();\n group.setPointerCapture(ev.pointerId);\n const move = (mv: PointerEvent) => {\n const rect = this.svg.getBoundingClientRect();\n node.fx = (mv.clientX - rect.left - this.view.x) / this.view.k;\n node.fy = (mv.clientY - rect.top - this.view.y) / this.view.k;\n this.sim?.alphaTarget(0.25).restart();\n };\n const up = () => {\n node.fx = null; node.fy = null;",+ "span": "L290-L301"+ }+ },+ {+ "id": "viewer/graph.ts#GraphView.bindDrag.move",+ "name": "move",+ "kind": "function",+ "path": "viewer/graph.ts",+ "span": "L294-L299",+ "signature": "move = (mv: PointerEvent)",+ "exported": true,+ "origin": "ast",+ "body_hash": "656f371efff6a0eed7868895a4044e4fdf1dc88840de21376c388ba03149fbd0",+ "summary_state": "ready",+ "summary": "Handles the movement of a node during drag events, updating its fixed position.",+ "crux": {+ "code": " const move = (mv: PointerEvent) => {\n const rect = this.svg.getBoundingClientRect();\n node.fx = (mv.clientX - rect.left - this.view.x) / this.view.k;\n node.fy = (mv.clientY - rect.top - this.view.y) / this.view.k;\n this.sim?.alphaTarget(0.25).restart();\n };",+ "span": "L294-L299"+ }+ },+ {+ "id": "viewer/graph.ts#GraphView.bindDrag.up",+ "name": "up",+ "kind": "function",+ "path": "viewer/graph.ts",+ "span": "L300-L305",+ "signature": "up = ()",+ "exported": true,+ "origin": "ast",+ "body_hash": "a935b15e42eefdf45da528afe3172b559d3e9ee97fe4be67f682dedccaac64c2",+ "summary_state": "ready",+ "summary": "Finalizes the drag operation by releasing the node's fixed position.",+ "crux": {+ "code": " const up = () => {\n node.fx = null; node.fy = null;\n this.sim?.alphaTarget(0);\n group.removeEventListener(\"pointermove\", move);\n group.removeEventListener(\"pointerup\", up);\n };",+ "span": "L300-L305"+ }+ },+ {+ "id": "viewer/graph.ts#GraphView.bindPanZoom",+ "name": "bindPanZoom",+ "kind": "method",+ "path": "viewer/graph.ts",+ "span": "L311-L333",+ "signature": "private bindPanZoom(): void",+ "exported": true,+ "origin": "ast",+ "body_hash": "737e5f69bc32913d3b061a4a878b61245d242e217f451a81d72d21e1d28fae30",+ "summary_state": "ready",+ "summary": "Sets up event listeners for panning and zooming the graph view based on user interactions.",+ "crux": {+ "code": " private bindPanZoom(): void {\n let panStart: { x: number; y: number } | null = null;\n this.svg.addEventListener(\"pointerdown\", (ev) => {\n panStart = { x: ev.clientX - this.view.x, y: ev.clientY - this.view.y };\n });\n this.svg.addEventListener(\"pointermove\", (ev) => {\n if (!panStart) return;\n this.view.x = ev.clientX - panStart.x;\n this.view.y = ev.clientY - panStart.y;\n this.applyView();\n });\n window.addEventListener(\"pointerup\", () => { panStart = null; });",+ "span": "L311-L322"+ }+ },+ {+ "id": "viewer/graph.ts#GraphView.buildChrome",+ "name": "buildChrome",+ "kind": "method",+ "path": "viewer/graph.ts",+ "span": "L71-L78",+ "signature": "private buildChrome(): void",+ "exported": true,+ "origin": "ast",+ "body_hash": "592cef68d76f99ad8da470cc3c8b4eda64701c02b8740a21e659fdd5e5325def",+ "summary_state": "ready",+ "summary": "Sets up the initial SVG structure for the graph, including definitions and viewport.",+ "crux": {+ "code": " this.svg.textContent = \"\";\n this.defs = el(\"defs\", {});\n this.svg.appendChild(this.defs);\n this.viewport = el(\"g\", {});\n this.svg.appendChild(this.viewport);\n this.svg.addEventListener(\"click\", () => this.select(null));\n }",+ "span": "L72-L78"+ }+ },+ {+ "id": "viewer/graph.ts#GraphView.buildElements",+ "name": "buildElements",+ "kind": "method",+ "path": "viewer/graph.ts",+ "span": "L138-L164",+ "signature": "private buildElements(): void",+ "exported": true,+ "origin": "ast",+ "body_hash": "a608a77fab16447bd9ef9c465a192abc0cb7167807f7c1718d961d730d7f055d",+ "summary_state": "ready",+ "summary": "Constructs the SVG elements for nodes and edges based on the current dataset.",+ "crux": {+ "code": " private buildElements(): void {\n this.ensureMarkers();\n this.viewport.textContent = \"\";\n this.edgeEls = this.edges.map((edge) => {\n const path = el(\"path\", { fill: \"none\", \"stroke-linecap\": \"round\" });\n const title = el(\"title\", {});\n title.textContent = edge.relation.replace(/_/g, \" \") + (edge.description ? ` — ${edge.description}` : \"\");\n path.appendChild(title);\n const label = el(\"text\", { \"text-anchor\": \"middle\", \"font-size\": 9.5, \"font-weight\": 700, \"stroke-width\": 3, \"paint-order\": \"stroke\", display: \"none\" });\n label.textContent = edge.relation.replace(/_/g, \" \");\n this.viewport.appendChild(path);\n this.viewport.appendChild(label);",+ "span": "L138-L149"+ }+ },+ {+ "id": "viewer/graph.ts#GraphView.constructor",+ "name": "constructor",+ "kind": "method",+ "path": "viewer/graph.ts",+ "span": "L65-L69",+ "signature": "constructor(svg: SVGSVGElement)",+ "exported": true,+ "origin": "ast",+ "body_hash": "27abb788d7de0ece37719a0a23d4fed7778c02dda10700bbfb4f110ea8c16984",+ "summary_state": "ready",+ "summary": "Initializes the GraphView instance and sets up the SVG environment for rendering.",+ "crux": null+ },+ {+ "id": "viewer/graph.ts#GraphView.ensureMarkers",+ "name": "ensureMarkers",+ "kind": "method",+ "path": "viewer/graph.ts",+ "span": "L80-L91",+ "signature": "private ensureMarkers(): void",+ "exported": true,+ "origin": "ast",+ "body_hash": "9517cfdb2ccb4ce235405356f6ff9b2fb3fcd2f7d687689bde33cf5df9bd6906",+ "summary_state": "ready",+ "summary": "Ensures that the necessary SVG markers for edges are created and available for rendering.",+ "crux": {+ "code": " this.defs.textContent = \"\";\n const chevron = el(\"marker\", { id: \"arr\", viewBox: \"0 0 10 10\", refX: 8, refY: 5, markerWidth: 4.5, markerHeight: 4.5, orient: \"auto-start-reverse\" });\n chevron.appendChild(el(\"path\", { d: \"M2,1.5L8.5,5L2,8.5\", fill: \"none\", stroke: cvar(\"--edge\"), \"stroke-width\": 1.8, \"stroke-linecap\": \"round\", \"stroke-linejoin\": \"round\", opacity: 0.75 }));\n const hollow = el(\"marker\", { id: \"arrH\", viewBox: \"0 0 12 12\", refX: 10, refY: 6, markerWidth: 6.5, markerHeight: 6.5, orient: \"auto-start-reverse\" });\n hollow.appendChild(el(\"path\", { d: \"M1.5,1.5L10.5,6L1.5,10.5z\", fill: cvar(\"--canvas\"), stroke: cvar(\"--edge\"), \"stroke-width\": 1.4 }));\n const out = el(\"marker\", { id: \"arrOut\", viewBox: \"0 0 10 10\", refX: 8, refY: 5, markerWidth: 5, markerHeight: 5, orient: \"auto-start-reverse\" });\n out.appendChild(el(\"path\", { d: \"M1,1L9,5L1,9z\", fill: cvar(\"--fil\") }));\n const inn = el(\"marker\", { id: \"arrIn\", viewBox: \"0 0 10 10\", refX: 8, refY: 5, markerWidth: 5, markerHeight: 5, orient: \"auto-start-reverse\" });\n inn.appendChild(el(\"path\", { d: \"M1,1L9,5L1,9z\", fill: cvar(\"--accent\") }));\n for (const m of [chevron, hollow, out, inn]) this.defs.appendChild(m);",+ "span": "L81-L90"+ }+ },+ {+ "id": "viewer/graph.ts#GraphView.firstMatch",+ "name": "firstMatch",+ "kind": "method",+ "path": "viewer/graph.ts",+ "span": "L263-L266",+ "signature": "firstMatch(): SimNode | undefined",+ "exported": true,+ "origin": "ast",+ "body_hash": "d43343323ad49732d473f46773ac41a0ee7472f6289d324eb369d739e8cb0352",+ "summary_state": "ready",+ "summary": "Finds the first node that matches the current query, facilitating search functionality.",+ "crux": {+ "code": " firstMatch(): SimNode | undefined {\n const q = this.query.toLowerCase();\n return this.nodes.find((n) => !this.hiddenTypes[n.type] && n.name.toLowerCase().includes(q));\n }",+ "span": "L263-L266"+ }+ },+ {+ "id": "viewer/graph.ts#GraphView.focus",+ "name": "focus",+ "kind": "method",+ "path": "viewer/graph.ts",+ "span": "L252-L261",+ "signature": "focus(id: string): void",+ "exported": true,+ "origin": "ast",+ "body_hash": "a64691876d1786ccdb2027028d00210b8cb56557c65c1afa81a886b506d7b459",+ "summary_state": "ready",+ "summary": "Centers the view on a specified node, enhancing its visibility and selection.",+ "crux": {+ "code": " focus(id: string): void {\n const node = this.nodes.find((n) => n.id === id);\n if (!node) return;\n const W = this.svg.clientWidth, H = this.svg.clientHeight;\n this.view.k = Math.max(this.view.k, 1.4);\n this.view.x = W / 2 - (node.x ?? 0) * this.view.k;\n this.view.y = H / 2 - (node.y ?? 0) * this.view.k;\n this.applyView();\n this.select(id);\n }",+ "span": "L252-L261"+ }+ },+ {+ "id": "viewer/graph.ts#GraphView.reheat",+ "name": "reheat",+ "kind": "method",+ "path": "viewer/graph.ts",+ "span": "L286-L288",+ "signature": "reheat(): void",+ "exported": true,+ "origin": "ast",+ "body_hash": "ca57d7cb11e71985bcd27b937b4f6d0a62428a0ae84f5a297cb1147861032a59",+ "summary_state": "ready",+ "summary": "Restarts the simulation with increased alpha, making the graph more dynamic.",+ "crux": {+ "code": " reheat(): void {\n this.sim?.alpha(0.6).restart();\n }",+ "span": "L286-L288"+ }+ },+ {+ "id": "viewer/graph.ts#GraphView.resetView",+ "name": "resetView",+ "kind": "method",+ "path": "viewer/graph.ts",+ "span": "L281-L284",+ "signature": "resetView(): void",+ "exported": true,+ "origin": "ast",+ "body_hash": "ae1f1ee82c804ff145b1f4aa9de70cad49a5287735aa9825f6accbe21591794c",+ "summary_state": "ready",+ "summary": "Resets the graph view to its initial state, centering and scaling the view.",+ "crux": {+ "code": " resetView(): void {\n this.view = { x: 0, y: 0, k: 1 };\n this.applyView();\n }",+ "span": "L281-L284"+ }+ },+ {+ "id": "viewer/graph.ts#GraphView.restyle",+ "name": "restyle",+ "kind": "method",+ "path": "viewer/graph.ts",+ "span": "L185-L243",+ "signature": "restyle(): void",+ "exported": true,+ "origin": "ast",+ "body_hash": "a928dd40f55ad9a091ba969afdf370f2a265bf30fb94efdc6879fcc0fb01edda",+ "summary_state": "ready",+ "summary": "Applies styles to nodes and edges based on their visibility and selection state.",+ "crux": {+ "code": " restyle(): void {\n this.ensureMarkers();\n const neighbors = new Set<string>();\n if (this.selected) {\n for (const e of this.edges) {\n if (e.source.id === this.selected) neighbors.add(e.target.id);\n if (e.target.id === this.selected) neighbors.add(e.source.id);\n }\n }\n const q = this.query.toLowerCase();\n const nodeShown = (n: SimNode) => !this.hiddenTypes[n.type];\n",+ "span": "L185-L196"+ }+ },+ {+ "id": "viewer/graph.ts#GraphView.restyle.nodeShown",+ "name": "nodeShown",+ "kind": "function",+ "path": "viewer/graph.ts",+ "span": "L195-L195",+ "signature": "nodeShown = (n: SimNode)",+ "exported": true,+ "origin": "ast",+ "body_hash": "a598aac16da1955aecc62f39590f30d0c7e780d99429b1657c1bbba7d157ddea",+ "summary_state": "ready",+ "summary": "Determines if a node should be displayed based on its type and visibility settings.",+ "crux": null+ },+ {+ "id": "viewer/graph.ts#GraphView.select",+ "name": "select",+ "kind": "method",+ "path": "viewer/graph.ts",+ "span": "L245-L249",+ "signature": "select(id: string | null): void",+ "exported": true,+ "origin": "ast",+ "body_hash": "7ba52874ad2ddda2bc80c3442e011c9d2b464fb8851a3ba527d3dba8ac6061c2",+ "summary_state": "ready",+ "summary": "Selects a node in the graph and updates the visual representation accordingly.",+ "crux": {+ "code": " select(id: string | null): void {\n this.selected = id;\n this.restyle();\n this.onSelect(id);\n }",+ "span": "L245-L249"+ }+ },+ {+ "id": "viewer/graph.ts#GraphView.setData",+ "name": "setData",+ "kind": "method",+ "path": "viewer/graph.ts",+ "span": "L94-L136",+ "signature": "setData(graph: VizGraph, tab: \"context\" | \"code\"): void",+ "exported": true,+ "origin": "ast",+ "body_hash": "d8063d2226148959298ca10074e09f00b7530c0b6a87f023502c4bd1c02041a6",+ "summary_state": "ready",+ "summary": "Loads a new dataset into the graph, updating node positions and relationships accordingly.",+ "crux": {+ "code": " setData(graph: VizGraph, tab: \"context\" | \"code\"): void {\n this.tab = tab;\n const prev = new Map(this.nodes.map((n) => [n.id, n]));\n const deg: Record<string, number> = {};\n for (const e of graph.edges) {\n deg[e.source] = (deg[e.source] ?? 0) + 1;\n deg[e.target] = (deg[e.target] ?? 0) + 1;\n }\n const W = this.svg.clientWidth || 800;\n const H = this.svg.clientHeight || 600;\n this.nodes = graph.nodes.map((n, i) => {\n const p = prev.get(n.id);",+ "span": "L94-L105"+ }+ },+ {+ "id": "viewer/graph.ts#GraphView.tick",+ "name": "tick",+ "kind": "method",+ "path": "viewer/graph.ts",+ "span": "L166-L182",+ "signature": "private tick(): void",+ "exported": true,+ "origin": "ast",+ "body_hash": "0fbefdd43e29e9d5134e756074fe1fa190fa23cf6afaa72a52d27f098ac8e6bb",+ "summary_state": "ready",+ "summary": "Updates the positions of nodes and edges on each simulation tick, ensuring the graph remains interactive.",+ "crux": {+ "code": " private tick(): void {\n for (const { path, label, edge } of this.edgeEls) {\n const a = edge.source, b = edge.target;\n const dx = (b.x ?? 0) - (a.x ?? 0), dy = (b.y ?? 0) - (a.y ?? 0);\n const d = Math.sqrt(dx * dx + dy * dy) || 1;\n const ux = dx / d, uy = dy / d;\n const sx = (a.x ?? 0) + ux * (a.r + 2), sy = (a.y ?? 0) + uy * (a.r + 2);\n const tx = (b.x ?? 0) - ux * (b.r + 6), ty = (b.y ?? 0) - uy * (b.r + 6);\n const mx = (sx + tx) / 2 - uy * 10, my = (sy + ty) / 2 + ux * 10;\n path.setAttribute(\"d\", `M${sx},${sy} Q${mx},${my} ${tx},${ty}`);\n label.setAttribute(\"x\", String((sx + tx) / 2 - uy * 14));\n label.setAttribute(\"y\", String((sy + ty) / 2 + ux * 14));",+ "span": "L166-L177"+ }+ },+ {+ "id": "viewer/graph.ts#GraphView.zoomBy",+ "name": "zoomBy",+ "kind": "method",+ "path": "viewer/graph.ts",+ "span": "L272-L279",+ "signature": "zoomBy(factor: number): void",+ "exported": true,+ "origin": "ast",+ "body_hash": "2dd28ba55cc461ab1f950d582e10b63c6862804f17d518ef346fe4e3f49af289",+ "summary_state": "ready",+ "summary": "Adjusts the zoom level of the graph view based on user input, allowing for detailed exploration.",+ "crux": {+ "code": " zoomBy(factor: number): void {\n const W = this.svg.clientWidth / 2, H = this.svg.clientHeight / 2;\n const k = Math.max(0.35, Math.min(3, this.view.k * factor));\n this.view.x = W - (W - this.view.x) * (k / this.view.k);\n this.view.y = H - (H - this.view.y) * (k / this.view.k);\n this.view.k = k;\n this.applyView();\n }",+ "span": "L272-L279"+ }+ },+ {+ "id": "viewer/graph.ts#SimEdge",+ "name": "SimEdge",+ "kind": "interface",+ "path": "viewer/graph.ts",+ "span": "L32-L38",+ "signature": "interface SimEdge",+ "exported": false,+ "origin": "ast",+ "body_hash": "06690141adf5c47ffc6dd6b55a3cf9f041a4750f0b512cf49d3596928485fca8",+ "summary_state": "ready",+ "summary": "Defines the structure of an edge in the simulation, representing the relationship between two nodes.",+ "crux": null+ },+ {+ "id": "viewer/graph.ts#SimNode",+ "name": "SimNode",+ "kind": "interface",+ "path": "viewer/graph.ts",+ "span": "L22-L30",+ "signature": "interface SimNode extends SimulationNodeDatum",+ "exported": false,+ "origin": "ast",+ "body_hash": "b000c5412e66a114ce7349ebddb8f536c040a6c6f158c641a8370ea049b6a69d",+ "summary_state": "ready",+ "summary": "Defines the structure of a node in the simulation, including its position and properties.",+ "crux": null+ },+ {+ "id": "viewer/main.ts",+ "name": "main.ts",+ "kind": "file",+ "path": "viewer/main.ts",+ "span": "L1-L233",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "ab45ce4dfe66aafbe779b71d49d6370b3fe64482307b994e857ce34d3f317325",+ "summary_state": "ready",+ "summary": "This file serves as the entry point for the graft visualization viewer, managing the user interface and interactions for displaying graphs.",+ "crux": {+ "code": "const view = new GraphView($(\"graphSvg\") as unknown as SVGSVGElement);",+ "span": "L21-L21"+ }+ },+ {+ "id": "viewer/main.ts#$",+ "name": "$",+ "kind": "function",+ "path": "viewer/main.ts",+ "span": "L12-L12",+ "signature": "$ = <T extends HTMLElement>(id: string): T",+ "exported": false,+ "origin": "ast",+ "body_hash": "e46dd7aa9ed3186876ec11a8520b5af609af327108e045bce175d535aa9ed0e5",+ "summary_state": "ready",+ "summary": "Provides a type-safe way to retrieve HTML elements by their ID, enhancing code readability and reducing errors.",+ "crux": null+ },+ {+ "id": "viewer/main.ts#activeGraph",+ "name": "activeGraph",+ "kind": "function",+ "path": "viewer/main.ts",+ "span": "L23-L25",+ "signature": "function activeGraph(): VizGraph | null",+ "exported": false,+ "origin": "ast",+ "body_hash": "71591b2a66c0aa4d34f5b96cb2f1293248bdf02f55f6a73c2ee48258f6e2c445",+ "summary_state": "ready",+ "summary": "Determines which graph is currently active based on the selected tab, facilitating the correct data display.",+ "crux": {+ "code": " return state.tab === \"context\" ? state.context : state.code;",+ "span": "L24-L24"+ }+ },+ {+ "id": "viewer/main.ts#glyphFor",+ "name": "glyphFor",+ "kind": "function",+ "path": "viewer/main.ts",+ "span": "L62-L71",+ "signature": "function glyphFor(key: string): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "bd36f5f7c09e4d09ac342de7015c4cbda2ec86e36ab0c22716dd37b006444581",+ "summary_state": "ready",+ "summary": "Maps edge types to their corresponding visual glyphs, enhancing the graphical representation of relationships.",+ "crux": {+ "code": " const fam = key === \"part of\" ? \"structure\" : key === \"uses\" ? \"dependency\" : famOf(key.replace(/ /g, \"_\"));\n const glyphs: Record<string, string> = {\n structure: '<svg width=\"20\" height=\"8\" aria-hidden=\"true\"><line x1=\"1\" y1=\"4\" x2=\"19\" y2=\"4\" stroke=\"currentColor\" stroke-width=\"3\" opacity=\".5\"/></svg>',\n dependency: '<svg width=\"20\" height=\"8\" aria-hidden=\"true\"><line x1=\"1\" y1=\"4\" x2=\"14\" y2=\"4\" stroke=\"currentColor\" stroke-width=\"1.6\"/><path d=\"M14,1 L19,4 L14,7 z\" fill=\"currentColor\"/></svg>',\n contract: '<svg width=\"20\" height=\"8\" aria-hidden=\"true\"><line x1=\"1\" y1=\"4\" x2=\"13\" y2=\"4\" stroke=\"currentColor\" stroke-width=\"1.4\"/><path d=\"M13,1 L19,4 L13,7 z\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.2\"/></svg>',\n association: '<svg width=\"20\" height=\"8\" aria-hidden=\"true\"><line x1=\"1\" y1=\"4\" x2=\"19\" y2=\"4\" stroke=\"currentColor\" stroke-width=\"1.4\" stroke-dasharray=\"2 4\" opacity=\".7\"/></svg>',\n };\n return glyphs[fam];",+ "span": "L63-L70"+ }+ },+ {+ "id": "viewer/main.ts#graphTab",+ "name": "graphTab",+ "kind": "function",+ "path": "viewer/main.ts",+ "span": "L27-L29",+ "signature": "function graphTab(): \"context\" | \"code\"",+ "exported": false,+ "origin": "ast",+ "body_hash": "8bf89d024fe38470c469c719795eaf902c0e903157cf7ed24fe58a85db40cea4",+ "summary_state": "ready",+ "summary": "Identifies the current graph tab, ensuring the correct context is used for rendering and interactions.",+ "crux": {+ "code": " return state.tab === \"code\" || state.tab === \"outline\" ? \"code\" : \"context\";",+ "span": "L28-L28"+ }+ },+ {+ "id": "viewer/main.ts#loadAll",+ "name": "loadAll",+ "kind": "function",+ "path": "viewer/main.ts",+ "span": "L216-L223",+ "signature": "async function loadAll(): Promise<void>",+ "exported": false,+ "origin": "ast",+ "body_hash": "c896b70116fce23a9b9846a95ed257835d18d1368d091a56cec01674e36bc480",+ "summary_state": "ready",+ "summary": "Loads the context and code graphs asynchronously, ensuring the viewer is populated with the latest data.",+ "crux": {+ "code": " state.context = context;\n state.code = code;\n $(\"repoName\").textContent = context.meta.repoName ?? \"\";\n document.title = `graft viz — ${context.meta.repoName ?? \"\"}`;\n setTab(state.tab);",+ "span": "L218-L222"+ }+ },+ {+ "id": "viewer/main.ts#renderChips",+ "name": "renderChips",+ "kind": "function",+ "path": "viewer/main.ts",+ "span": "L32-L60",+ "signature": "function renderChips(): void",+ "exported": false,+ "origin": "ast",+ "body_hash": "1ef41cd967e509d6342b72755564e0975cb6b87edfcc2911fe79404f906eddcb",+ "summary_state": "ready",+ "summary": "Generates and displays interactive chips for graph edges, allowing users to filter and manage edge visibility.",+ "crux": {+ "code": " const graph = activeGraph();\n if (!graph) return;\n const counts = new Map<string, number>();\n for (const e of graph.edges) {\n const key = chipKey(e.relation);\n counts.set(key, (counts.get(key) ?? 0) + 1);\n }\n const keys = [...counts.keys()].sort((a, b) => {\n const rank = (k: string) => (k === \"part of\" ? 0 : k === \"uses\" ? 1 : 2);\n return rank(a) - rank(b) || a.localeCompare(b);\n });\n for (const key of keys) {",+ "span": "L35-L46"+ }+ },+ {+ "id": "viewer/main.ts#renderChips.rank",+ "name": "rank",+ "kind": "function",+ "path": "viewer/main.ts",+ "span": "L43-L43",+ "signature": "rank = (k: string)",+ "exported": false,+ "origin": "ast",+ "body_hash": "2b14b986fe4648076445602ac03c0f7c788760e8910fa9322617251aa60af5ce",+ "summary_state": "ready",+ "summary": "Establishes a ranking system for edge types to ensure they are displayed in a meaningful order.",+ "crux": {+ "code": " const rank = (k: string) => (k === \"part of\" ? 0 : k === \"uses\" ? 1 : 2);",+ "span": "L43-L43"+ }+ },+ {+ "id": "viewer/main.ts#renderLegend",+ "name": "renderLegend",+ "kind": "function",+ "path": "viewer/main.ts",+ "span": "L74-L94",+ "signature": "function renderLegend(): void",+ "exported": false,+ "origin": "ast",+ "body_hash": "ec1a1aba1d086d035890c60aadf98d7418c018c5488f106100102deaf0eafc01",+ "summary_state": "ready",+ "summary": "Creates a legend for node types in the graph, providing users with context about the displayed data.",+ "crux": {+ "code": " const graph = activeGraph();\n if (!graph) return;\n const counts = new Map<string, number>();\n for (const n of graph.nodes) counts.set(n.type, (counts.get(n.type) ?? 0) + 1);\n for (const [type, count] of counts) {\n const chip = document.createElement(\"button\");\n chip.type = \"button\";\n chip.className = \"lchip\" + (view.hiddenTypes[type] ? \" off\" : \"\");\n chip.innerHTML = `<span class=\"sw\" style=\"background:${cvar(colorToken(graphTab(), type))}\"></span>${type} <span style=\"color:var(--muted);font-weight:500\">${count}</span>`;\n chip.addEventListener(\"click\", () => {\n view.hiddenTypes[type] = !view.hiddenTypes[type];\n renderLegend();",+ "span": "L77-L88"+ }+ },+ {+ "id": "viewer/main.ts#setTab",+ "name": "setTab",+ "kind": "function",+ "path": "viewer/main.ts",+ "span": "L129-L167",+ "signature": "function setTab(tab: Tab): void",+ "exported": false,+ "origin": "ast",+ "body_hash": "c269ec25c7011b7343bdcec22729b23b0c65a57255598ac5145a46397809b321",+ "summary_state": "ready",+ "summary": "Handles the logic for switching between different graph views, ensuring the UI reflects the current context accurately.",+ "crux": {+ "code": " state.tab = tab;\n document.querySelectorAll<HTMLButtonElement>(\".tab\").forEach((b) => {\n b.setAttribute(\"aria-selected\", b.dataset.tab === tab ? \"true\" : \"false\");\n });\n const isOutline = tab === \"outline\";\n $(\"canvasWrap\").hidden = isOutline;\n $(\"outlineView\").hidden = !isOutline;\n view.hiddenRels = {};\n view.hiddenTypes = {};\n view.selected = null;\n showDetail(null);\n",+ "span": "L130-L141"+ }+ },+ {+ "id": "viewer/main.ts#showDetail",+ "name": "showDetail",+ "kind": "function",+ "path": "viewer/main.ts",+ "span": "L115-L124",+ "signature": "function showDetail(id: string | null): void",+ "exported": false,+ "origin": "ast",+ "body_hash": "e2b6f6a27ee1e3bac515ec8140678caa7c6cff3baab943cf43f8fdbdd7ab2e62",+ "summary_state": "ready",+ "summary": "Displays detailed information about a selected graph element, enhancing user interaction and understanding.",+ "crux": {+ "code": " view.focus(next);\n }\n });",+ "span": "L121-L123"+ }+ },+ {+ "id": "viewer/main.ts#showEmpty",+ "name": "showEmpty",+ "kind": "function",+ "path": "viewer/main.ts",+ "span": "L169-L173",+ "signature": "function showEmpty(html: string): void",+ "exported": false,+ "origin": "ast",+ "body_hash": "981ef1b3d68cfcc89b2804a326c87ce023df618bfee612f158fa72291fe7a6d1",+ "summary_state": "ready",+ "summary": "Displays a message when no graph data is available, guiding users on how to generate the necessary data.",+ "crux": {+ "code": " empty.innerHTML = html;\n empty.hidden = false;",+ "span": "L171-L172"+ }+ },+ {+ "id": "viewer/main.ts#Tab",+ "name": "Tab",+ "kind": "type",+ "path": "viewer/main.ts",+ "span": "L10-L10",+ "signature": "type Tab = \"context\" | \"code\" | \"outline\";",+ "exported": false,+ "origin": "ast",+ "body_hash": "4cd3b4afb6647f09ba09efccca7c53a333edbebe109fb1e24db04aa24df610de",+ "summary_state": "ready",+ "summary": "Defines the possible tab types for the viewer, ensuring that only valid tab selections are made.",+ "crux": null+ },+ {+ "id": "viewer/main.ts#updateCounts",+ "name": "updateCounts",+ "kind": "function",+ "path": "viewer/main.ts",+ "span": "L103-L112",+ "signature": "function updateCounts(): void",+ "exported": false,+ "origin": "ast",+ "body_hash": "170a2eec2d377c150839d170cd45a244584ecc9fdbd44ad194e8cac97fdfafb6",+ "summary_state": "ready",+ "summary": "Refreshes the displayed counts of nodes and edges based on the active graph, ensuring accurate information is presented.",+ "crux": {+ "code": " el.textContent = graph ? `${graph.meta.nodeCount} nodes · ${graph.meta.edgeCount} links` : \"\";",+ "span": "L110-L110"+ }+ },+ {+ "id": "viewer/main.ts#updateShownCount",+ "name": "updateShownCount",+ "kind": "function",+ "path": "viewer/main.ts",+ "span": "L96-L101",+ "signature": "function updateShownCount(): void",+ "exported": false,+ "origin": "ast",+ "body_hash": "11ab0ffa5da9e8d010f80cb1f95962900b0649019b7876e2b5213b85605d75ee",+ "summary_state": "ready",+ "summary": "Updates the displayed count of visible nodes in the graph, helping users understand the current view's scope.",+ "crux": {+ "code": " const shown = graph.nodes.filter((n) => !view.hiddenTypes[n.type]).length;\n $(\"lcount\").textContent = `${shown} / ${graph.nodes.length} nodes shown`;",+ "span": "L99-L100"+ }+ },+ {+ "id": "viewer/tree.ts",+ "name": "tree.ts",+ "kind": "file",+ "path": "viewer/tree.ts",+ "span": "L1-L67",+ "signature": null,+ "exported": true,+ "origin": "ast",+ "body_hash": "d66e0157f4c2a1525c16505306eb3aabce82565c3d0e56199ea5b7a860290b01",+ "summary_state": "ready",+ "summary": "Generates a collapsible tree view of a code graph's hierarchy, allowing users to navigate through files, classes, and methods.",+ "crux": {+ "code": " host.innerHTML =\n '<div class=\"tree-tools\"><button data-tool=\"expand\">Expand all</button><button data-tool=\"collapse\">Collapse all</button></div>' +\n files.map(row).join(\"\");",+ "span": "L44-L46"+ }+ },+ {+ "id": "viewer/tree.ts#esc",+ "name": "esc",+ "kind": "function",+ "path": "viewer/tree.ts",+ "span": "L7-L9",+ "signature": "function esc(s: string): string",+ "exported": false,+ "origin": "ast",+ "body_hash": "9fb927f7f1c881ee1fe325c0dc8a25b8c5cdb2c101b08ae935a35bb428f5bbdb",+ "summary_state": "ready",+ "summary": "Escapes special HTML characters in a string to prevent rendering issues in the tree view.",+ "crux": {+ "code": " return s.replace(/&/g, \"&\").replace(/</g, \"<\");\n}",+ "span": "L8-L9"+ }+ },+ {+ "id": "viewer/tree.ts#renderOutline",+ "name": "renderOutline",+ "kind": "function",+ "path": "viewer/tree.ts",+ "span": "L11-L66",+ "signature": "function renderOutline( host: HTMLElement, graph: VizGraph, selected: string | null, openState: Record<string, boolean>, onSelect: (id: string) => void, ): void",+ "exported": true,+ "origin": "ast",+ "body_hash": "1448ed396d7ec6d8adc0e375aba7be5465c4e4db6d4184c6b5b01ac5a0788591",+ "summary_state": "ready",+ "summary": "Renders the outline view of the code graph, managing the display of files and their hierarchical relationships.",+ "crux": {+ "code": " const kids = (pid: string) =>\n graph.edges\n .filter((e) => e.relation === \"contains\" && e.source === pid)\n .map((e) => graph.nodes.find((n) => n.id === e.target))\n .filter((n): n is NonNullable<typeof n> => Boolean(n));",+ "span": "L18-L22"+ }+ },+ {+ "id": "viewer/tree.ts#renderOutline.countDesc",+ "name": "countDesc",+ "kind": "function",+ "path": "viewer/tree.ts",+ "span": "L23-L26",+ "signature": "countDesc = (pid: string): number",+ "exported": true,+ "origin": "ast",+ "body_hash": "1054af458d2de230dfb45cea7a5a0141f2f4d12521ee04f0919e7defdea719dd",+ "summary_state": "ready",+ "summary": "Counts the total number of descendant nodes for a given parent node, including its children and their descendants.",+ "crux": {+ "code": " return k.length + k.reduce((sum, c) => sum + countDesc(c.id), 0);\n };",+ "span": "L25-L26"+ }+ },+ {+ "id": "viewer/tree.ts#renderOutline.kids",+ "name": "kids",+ "kind": "function",+ "path": "viewer/tree.ts",+ "span": "L18-L22",+ "signature": "kids = (pid: string)",+ "exported": true,+ "origin": "ast",+ "body_hash": "67a4d31f225a0006966aa2a39bdf245c514475f777082275626585879ce9b867",+ "summary_state": "ready",+ "summary": "Retrieves the child nodes of a given parent node in the graph based on the 'contains' relationship.",+ "crux": {+ "code": " .filter((e) => e.relation === \"contains\" && e.source === pid)\n .map((e) => graph.nodes.find((n) => n.id === e.target))",+ "span": "L20-L21"+ }+ },+ {+ "id": "viewer/tree.ts#renderOutline.row",+ "name": "row",+ "kind": "function",+ "path": "viewer/tree.ts",+ "span": "L29-L42",+ "signature": "row = (node: (typeof files)[number]): string",+ "exported": true,+ "origin": "ast",+ "body_hash": "a62af44af8ff57bd1307237e130956ce85cb42fc0c2fc4889907fd4e87e75ab2",+ "summary_state": "ready",+ "summary": "Constructs the HTML representation of a tree row for a given node, including its children and symbol count.",+ "crux": {+ "code": " const children = kids(node.id);\n const open = openState[node.id] !== false;\n let html = `<button class=\"tree-row${open ? \" open\" : \"\"}${selected === node.id ? \" sel\" : \"\"}\"` +\n ` data-id=\"${esc(node.id)}\" data-haskids=\"${children.length ? 1 : 0}\">` +\n `<span class=\"chev\">${children.length ? \"▶\" : \"\"}</span>` +\n `<span class=\"k\" style=\"background:${cvar(colorToken(\"code\", node.type))}\"></span>` +\n `<span class=\"t${node.type === \"file\" ? \" mono\" : \"\"}\">${esc(node.name)}</span>` +\n `<span class=\"badge\">${children.length ? countDesc(node.id) + \" sym\" : esc(node.type)}</span></button>`;\n if (children.length && open) {\n html += `<div class=\"tree-kids\">${children.map(row).join(\"\")}</div>`;\n }\n return html;",+ "span": "L30-L41"+ }+ }+ ],+ "edges": [+ {+ "source": "bench/agent.ts",+ "target": "bench/agent.ts#AgentResult",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/agent.ts",+ "target": "bench/agent.ts#globToRegExp",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/agent.ts",+ "target": "bench/agent.ts#listFiles",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/agent.ts",+ "target": "bench/agent.ts#runAgent",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/agent.ts",+ "target": "bench/agent.ts#RunAgentOptions",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/agent.ts",+ "target": "bench/agent.ts#runTool",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/agent.ts",+ "target": "bench/agent.ts#safePath",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/agent.ts",+ "target": "bench/llm.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/agent.ts",+ "target": "node:fs",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/agent.ts",+ "target": "node:path",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/agent.ts",+ "target": "openai",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/agent.ts",+ "target": "src/ingest/fs.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/agent.ts#listFiles",+ "target": "bench/agent.ts#listFiles.walk",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "bench/agent.ts#listFiles",+ "target": "bench/agent.ts#listFiles.walk",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/agent.ts#listFiles.walk",+ "target": "bench/agent.ts#listFiles.walk",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "bench/agent.ts#runAgent",+ "target": "bench/agent.ts#runAgent.slideCacheBreakpoint",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "bench/agent.ts#runAgent",+ "target": "bench/agent.ts#runTool",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "bench/agent.ts#runAgent",+ "target": "bench/llm.ts#makeClient",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "bench/agent.ts#runAgent",+ "target": "bench/agent.ts#runAgent.slideCacheBreakpoint",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/agent.ts#runTool",+ "target": "bench/agent.ts#globToRegExp",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "bench/agent.ts#runTool",+ "target": "bench/agent.ts#listFiles",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "bench/agent.ts#runTool",+ "target": "bench/agent.ts#safePath",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "bench/judge.ts",+ "target": "bench/judge.ts#extractJson",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/judge.ts",+ "target": "bench/judge.ts#judge",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/judge.ts",+ "target": "bench/judge.ts#JudgeInput",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/judge.ts",+ "target": "bench/judge.ts#Verdict",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/judge.ts",+ "target": "bench/llm.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/judge.ts",+ "target": "openai",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/judge.ts#judge",+ "target": "bench/judge.ts#extractJson",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "bench/judge.ts#judge",+ "target": "bench/llm.ts#makeClient",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "bench/llm.ts",+ "target": "bench/llm.ts#makeClient",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/llm.ts",+ "target": "openai",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/report.ts",+ "target": "bench/report.ts#aggregate",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/report.ts",+ "target": "bench/report.ts#ArmAgg",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/report.ts",+ "target": "bench/report.ts#buildMarkdown",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/report.ts",+ "target": "bench/report.ts#costOf",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/report.ts",+ "target": "bench/report.ts#fmt",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/report.ts",+ "target": "bench/report.ts#mean",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/report.ts",+ "target": "bench/report.ts#pctDelta",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/report.ts",+ "target": "bench/report.ts#Row",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/report.ts#aggregate",+ "target": "bench/report.ts#costOf",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "bench/report.ts#aggregate",+ "target": "bench/report.ts#mean",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "bench/report.ts#buildMarkdown",+ "target": "bench/report.ts#aggregate",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "bench/report.ts#buildMarkdown",+ "target": "bench/report.ts#fmt",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "bench/report.ts#buildMarkdown",+ "target": "bench/report.ts#pctDelta",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "bench/run.ts",+ "target": "bench/run.ts#main",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "bench/run.ts",+ "target": "bench/run.ts#Args",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/run.ts",+ "target": "bench/run.ts#main",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/run.ts",+ "target": "bench/run.ts#makeDocsWorkdir",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/run.ts",+ "target": "bench/run.ts#parseArgs",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/run.ts",+ "target": "bench/run.ts#pool",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/run.ts",+ "target": "../src/ingest/pdf.js",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/run.ts",+ "target": "bench/agent.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/run.ts",+ "target": "bench/judge.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/run.ts",+ "target": "bench/llm.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/run.ts",+ "target": "bench/report.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/run.ts",+ "target": "bench/tasks.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/run.ts",+ "target": "dotenv/config",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/run.ts",+ "target": "node:fs",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/run.ts",+ "target": "node:os",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/run.ts",+ "target": "node:path",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/run.ts",+ "target": "node:url",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/run.ts",+ "target": "src/index.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/run.ts",+ "target": "src/ingest/fs.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/run.ts#main",+ "target": "bench/agent.ts#runAgent",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "bench/run.ts#main",+ "target": "bench/judge.ts#judge",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "bench/run.ts#main",+ "target": "bench/llm.ts#makeClient",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "bench/run.ts#main",+ "target": "bench/report.ts#buildMarkdown",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "bench/run.ts#main",+ "target": "bench/run.ts#makeDocsWorkdir",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "bench/run.ts#main",+ "target": "bench/run.ts#parseArgs",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "bench/run.ts#main",+ "target": "bench/run.ts#pool",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "bench/run.ts#main",+ "target": "src/viz/serve.ts#startVizServer.close",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "bench/run.ts#pool",+ "target": "bench/run.ts#pool.worker",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/selfcheck.ts",+ "target": "bench/selfcheck.ts#main",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "bench/selfcheck.ts",+ "target": "bench/selfcheck.ts#main",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/selfcheck.ts",+ "target": "bench/selfcheck.ts#makeStubClient",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/selfcheck.ts",+ "target": "bench/agent.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/selfcheck.ts",+ "target": "bench/judge.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/selfcheck.ts",+ "target": "bench/report.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/selfcheck.ts",+ "target": "node:assert/strict",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/selfcheck.ts",+ "target": "node:fs",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/selfcheck.ts",+ "target": "node:os",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/selfcheck.ts",+ "target": "node:path",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/selfcheck.ts#main",+ "target": "bench/agent.ts#runAgent",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "bench/selfcheck.ts#main",+ "target": "bench/judge.ts#judge",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "bench/selfcheck.ts#main",+ "target": "bench/report.ts#buildMarkdown",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "bench/selfcheck.ts#main",+ "target": "bench/selfcheck.ts#makeStubClient",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "bench/tasks.ts",+ "target": "bench/tasks.ts#repoPath",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "bench/tasks.ts",+ "target": "bench/tasks.ts#Corpus",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/tasks.ts",+ "target": "bench/tasks.ts#repoPath",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/tasks.ts",+ "target": "bench/tasks.ts#Task",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "bench/tasks.ts",+ "target": "node:path",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "bench/tasks.ts",+ "target": "node:url",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "scripts/build-viewer.mjs",+ "target": "esbuild",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "scripts/build-viewer.mjs",+ "target": "node:fs",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "scripts/build-viewer.mjs",+ "target": "node:path",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "scripts/build-viewer.mjs",+ "target": "node:url",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/crux.ts",+ "target": "src/ai/crux.ts#CruxSummarizer",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/crux.ts",+ "target": "src/ai/crux.ts#FileCruxInput",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/crux.ts",+ "target": "src/ai/crux.ts#NodeCrux",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/crux.ts",+ "target": "src/ai/crux.ts#NodeRef",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/crux.ts",+ "target": "src/ai/crux.ts#numberLines",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/crux.ts",+ "target": "src/ai/crux.ts#OpenRouterCruxSummarizer",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/crux.ts",+ "target": "src/ai/crux.ts#parseResults",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/crux.ts",+ "target": "src/ai/crux.ts#userContent",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/crux.ts",+ "target": "openai",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/crux.ts",+ "target": "src/graph/types.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/crux.ts#OpenRouterCruxSummarizer",+ "target": "src/ai/crux.ts#OpenRouterCruxSummarizer.constructor",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/crux.ts#OpenRouterCruxSummarizer",+ "target": "src/ai/crux.ts#OpenRouterCruxSummarizer.describeFile",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/crux.ts#OpenRouterCruxSummarizer",+ "target": "src/ai/crux.ts#CruxSummarizer",+ "relation": "implements",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/crux.ts#OpenRouterCruxSummarizer.describeFile",+ "target": "src/ai/crux.ts#parseResults",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/crux.ts#OpenRouterCruxSummarizer.describeFile",+ "target": "src/ai/crux.ts#userContent",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/crux.ts#parseResults",+ "target": "src/ai/crux.ts#parseResults.num",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/crux.ts#parseResults",+ "target": "src/ai/crux.ts#parseResults.num",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/crux.ts#userContent",+ "target": "src/ai/crux.ts#numberLines",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/providers.ts",+ "target": "src/ai/providers.ts#EngineConfig",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/providers.ts",+ "target": "src/ai/providers.ts#resolveConfig",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/providers.ts",+ "target": "src/ai/providers.ts#ResolvedConfig",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/providers.ts",+ "target": "src/ai/summarize.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/providers.ts",+ "target": "src/ai/synthesize.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/summarize.ts",+ "target": "src/ai/summarize.ts#OpenRouterSummarizer",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/summarize.ts",+ "target": "src/ai/summarize.ts#Summarizer",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/summarize.ts",+ "target": "src/ai/summarize.ts#userContent",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/summarize.ts",+ "target": "openai",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/summarize.ts#OpenRouterSummarizer",+ "target": "src/ai/summarize.ts#OpenRouterSummarizer.constructor",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/summarize.ts#OpenRouterSummarizer",+ "target": "src/ai/summarize.ts#OpenRouterSummarizer.summarize",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/summarize.ts#OpenRouterSummarizer",+ "target": "src/ai/summarize.ts#Summarizer",+ "relation": "implements",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/summarize.ts#OpenRouterSummarizer.summarize",+ "target": "src/ai/summarize.ts#userContent",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/synthesize.ts",+ "target": "src/ai/synthesize.ts#clean",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/synthesize.ts",+ "target": "src/ai/synthesize.ts#FileSummary",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/synthesize.ts",+ "target": "src/ai/synthesize.ts#OpenRouterSynthesizer",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/synthesize.ts",+ "target": "src/ai/synthesize.ts#Synthesizer",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/synthesize.ts",+ "target": "src/ai/synthesize.ts#SynthLink",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/synthesize.ts",+ "target": "src/ai/synthesize.ts#SynthNode",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/synthesize.ts",+ "target": "src/ai/synthesize.ts#userContent",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/synthesize.ts",+ "target": "openai",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/synthesize.ts#OpenRouterSynthesizer",+ "target": "src/ai/synthesize.ts#OpenRouterSynthesizer.constructor",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/synthesize.ts#OpenRouterSynthesizer",+ "target": "src/ai/synthesize.ts#OpenRouterSynthesizer.synthesize",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/synthesize.ts#OpenRouterSynthesizer",+ "target": "src/ai/synthesize.ts#Synthesizer",+ "relation": "implements",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/synthesize.ts#OpenRouterSynthesizer.synthesize",+ "target": "src/ai/synthesize.ts#clean",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/ai/synthesize.ts#OpenRouterSynthesizer.synthesize",+ "target": "src/ai/synthesize.ts#userContent",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts",+ "target": "src/ask/ask.ts#ask",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts",+ "target": "src/ask/ask.ts#AskHit",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts",+ "target": "src/ask/ask.ts#AskOptions",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts",+ "target": "src/ask/ask.ts#AskResult",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts",+ "target": "src/ask/ask.ts#Corpus",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts",+ "target": "src/ask/ask.ts#counts",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts",+ "target": "src/ask/ask.ts#findSubject",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts",+ "target": "src/ask/ask.ts#firstProse",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts",+ "target": "src/ask/ask.ts#formatAsk",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts",+ "target": "src/ask/ask.ts#lexical",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts",+ "target": "src/ask/ask.ts#loadCorpus",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts",+ "target": "src/ask/ask.ts#score",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts",+ "target": "src/ask/ask.ts#structural",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts",+ "target": "src/ask/ask.ts#tokenize",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts",+ "target": "gray-matter",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts",+ "target": "node:fs",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts",+ "target": "node:path",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts",+ "target": "src/context/node-file.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts",+ "target": "src/graph/types.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts",+ "target": "src/graph/write.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts#ask",+ "target": "src/ask/ask.ts#lexical",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts#ask",+ "target": "src/ask/ask.ts#loadCorpus",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts#ask",+ "target": "src/ask/ask.ts#structural",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts#ask",+ "target": "src/context/node-file.ts#contextDirFor",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/ask/ask.ts#lexical",+ "target": "src/ask/ask.ts#counts",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts#lexical",+ "target": "src/ask/ask.ts#score",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts#lexical",+ "target": "src/ask/ask.ts#tokenize",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts#loadCorpus",+ "target": "src/ask/ask.ts#firstProse",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/ask/ask.ts#loadCorpus",+ "target": "src/graph/write.ts#readGraph",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/ask/ask.ts#loadCorpus",+ "target": "src/graph/write.ts#wiringPath",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/ask/ask.ts#structural",+ "target": "src/ask/ask.ts#findSubject",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/cli.ts",+ "target": "src/ask/ask.ts#formatAsk",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/cli.ts",+ "target": "src/cli.ts#engineFrom",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/cli.ts",+ "target": "src/cli.ts#fmt",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/cli.ts",+ "target": "src/context/check.ts#formatCheckReport",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/cli.ts",+ "target": "src/context/node-file.ts#contextDirFor",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/cli.ts",+ "target": "src/engine.ts#Graft.ask",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/cli.ts",+ "target": "src/engine.ts#Graft.check",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/cli.ts",+ "target": "src/engine.ts#Graft.checkGraph",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/cli.ts",+ "target": "src/engine.ts#Graft.graph",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/cli.ts",+ "target": "src/engine.ts#Graft.init",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/cli.ts",+ "target": "src/graph/check.ts#formatGraphCheckReport",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/cli.ts",+ "target": "src/viz/serve.ts#startVizServer",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/cli.ts",+ "target": "src/cli.ts#engineFrom",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/cli.ts",+ "target": "src/cli.ts#fmt",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/cli.ts",+ "target": "commander",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/cli.ts",+ "target": "dotenv/config",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/cli.ts",+ "target": "node:path",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/cli.ts",+ "target": "src/context/check.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/cli.ts",+ "target": "src/engine.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/cli.ts",+ "target": "src/graph/check.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts",+ "target": "src/context/build.ts#batchBySize",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts",+ "target": "src/context/build.ts#batchKey",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts",+ "target": "src/context/build.ts#BuildCache",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts",+ "target": "src/context/build.ts#buildContext",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts",+ "target": "src/context/build.ts#BuildOptions",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts",+ "target": "src/context/build.ts#BuildProgress",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts",+ "target": "src/context/build.ts#BuildResult",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts",+ "target": "src/context/build.ts#cachePath",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts",+ "target": "src/context/build.ts#errMsg",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts",+ "target": "src/context/build.ts#FileWork",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts",+ "target": "src/context/build.ts#loadCache",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts",+ "target": "src/context/build.ts#mapWithConcurrency",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts",+ "target": "src/context/build.ts#NodeDraft",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts",+ "target": "src/context/build.ts#registerName",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts",+ "target": "src/context/build.ts#resolveSlug",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts",+ "target": "src/context/build.ts#saveCache",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts",+ "target": "node:fs",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts",+ "target": "node:path",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts",+ "target": "src/ai/summarize.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts",+ "target": "src/ai/synthesize.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts",+ "target": "src/context/node-file.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts",+ "target": "src/ingest/fs.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts",+ "target": "src/util/id.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts#batchKey",+ "target": "src/util/id.ts#contentHash",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/context/build.ts#buildContext",+ "target": "src/context/build.ts#batchBySize",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts#buildContext",+ "target": "src/context/build.ts#batchKey",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts#buildContext",+ "target": "src/context/build.ts#errMsg",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts#buildContext",+ "target": "src/context/build.ts#loadCache",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts#buildContext",+ "target": "src/context/build.ts#mapWithConcurrency",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts#buildContext",+ "target": "src/context/build.ts#registerName",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts#buildContext",+ "target": "src/context/build.ts#resolveSlug",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts#buildContext",+ "target": "src/context/build.ts#saveCache",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts#buildContext",+ "target": "src/context/node-file.ts#contextDirFor",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/context/build.ts#buildContext",+ "target": "src/context/node-file.ts#deleteNode",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/context/build.ts#buildContext",+ "target": "src/context/node-file.ts#digestSources",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/context/build.ts#buildContext",+ "target": "src/context/node-file.ts#existingNodeSlugs",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/context/build.ts#buildContext",+ "target": "src/context/node-file.ts#slugify",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/context/build.ts#buildContext",+ "target": "src/context/node-file.ts#writeManifest",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/context/build.ts#buildContext",+ "target": "src/context/node-file.ts#writeNode",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/context/build.ts#buildContext",+ "target": "src/ingest/fs.ts#walkDir",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/context/build.ts#buildContext",+ "target": "src/util/id.ts#contentHash",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/context/build.ts#loadCache",+ "target": "src/context/build.ts#cachePath",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/context/build.ts#saveCache",+ "target": "src/context/build.ts#cachePath",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/context/check.ts",+ "target": "src/context/check.ts#checkContext",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/check.ts",+ "target": "src/context/check.ts#CheckOptions",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/check.ts",+ "target": "src/context/check.ts#CheckResult",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/check.ts",+ "target": "src/context/check.ts#formatCheckReport",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/check.ts",+ "target": "src/context/check.ts#short",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/check.ts",+ "target": "node:fs",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/context/check.ts",+ "target": "node:path",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/context/check.ts",+ "target": "src/context/build.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/context/check.ts",+ "target": "src/context/node-file.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/context/check.ts",+ "target": "src/ingest/fs.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/context/check.ts",+ "target": "src/util/id.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/context/check.ts#checkContext",+ "target": "src/context/check.ts#short",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/context/check.ts#checkContext",+ "target": "src/context/node-file.ts#contextDirFor",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/context/check.ts#checkContext",+ "target": "src/context/node-file.ts#readManifest",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/context/check.ts#checkContext",+ "target": "src/context/node-file.ts#readNodes",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/context/check.ts#checkContext",+ "target": "src/ingest/fs.ts#walkDir",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/context/check.ts#checkContext",+ "target": "src/util/id.ts#contentHash",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/context/node-file.ts",+ "target": "src/context/node-file.ts#contextDirFor",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/node-file.ts",+ "target": "src/context/node-file.ts#ContextNode",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/node-file.ts",+ "target": "src/context/node-file.ts#defaultHuman",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/node-file.ts",+ "target": "src/context/node-file.ts#deleteNode",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/node-file.ts",+ "target": "src/context/node-file.ts#digestSources",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/node-file.ts",+ "target": "src/context/node-file.ts#existingNodeSlugs",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/node-file.ts",+ "target": "src/context/node-file.ts#Manifest",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/node-file.ts",+ "target": "src/context/node-file.ts#NodeLink",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/node-file.ts",+ "target": "src/context/node-file.ts#ParsedNode",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/node-file.ts",+ "target": "src/context/node-file.ts#preserveHuman",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/node-file.ts",+ "target": "src/context/node-file.ts#readManifest",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/node-file.ts",+ "target": "src/context/node-file.ts#readNodes",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/node-file.ts",+ "target": "src/context/node-file.ts#renderGenerated",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/node-file.ts",+ "target": "src/context/node-file.ts#renderNodeFile",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/node-file.ts",+ "target": "src/context/node-file.ts#slugify",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/node-file.ts",+ "target": "src/context/node-file.ts#SourceRef",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/node-file.ts",+ "target": "src/context/node-file.ts#writeManifest",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/node-file.ts",+ "target": "src/context/node-file.ts#writeNode",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/context/node-file.ts",+ "target": "gray-matter",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/context/node-file.ts",+ "target": "node:fs",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/context/node-file.ts",+ "target": "node:path",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/context/node-file.ts",+ "target": "src/util/id.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/context/node-file.ts#digestSources",+ "target": "src/util/id.ts#contentHash",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/context/node-file.ts#preserveHuman",+ "target": "src/context/node-file.ts#defaultHuman",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/context/node-file.ts#renderNodeFile",+ "target": "src/context/node-file.ts#renderGenerated",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/context/node-file.ts#slugify",+ "target": "src/util/id.ts#normalizeName",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/context/node-file.ts#writeNode",+ "target": "src/context/node-file.ts#defaultHuman",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/context/node-file.ts#writeNode",+ "target": "src/context/node-file.ts#preserveHuman",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/context/node-file.ts#writeNode",+ "target": "src/context/node-file.ts#renderNodeFile",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts",+ "target": "src/engine.ts#CheckRunOptions",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts",+ "target": "src/engine.ts#Graft",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts",+ "target": "src/engine.ts#GraphRunOptions",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts",+ "target": "src/engine.ts#InitOptions",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts",+ "target": "src/ai/crux.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts",+ "target": "src/ai/providers.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts",+ "target": "src/ai/summarize.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts",+ "target": "src/ai/synthesize.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts",+ "target": "src/ask/ask.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts",+ "target": "src/context/build.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts",+ "target": "src/context/check.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts",+ "target": "src/graph/build.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts",+ "target": "src/graph/check.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts#Graft",+ "target": "src/engine.ts#Graft.ask",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts#Graft",+ "target": "src/engine.ts#Graft.check",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts#Graft",+ "target": "src/engine.ts#Graft.checkGraph",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts#Graft",+ "target": "src/engine.ts#Graft.constructor",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts#Graft",+ "target": "src/engine.ts#Graft.cruxSummarizer",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts#Graft",+ "target": "src/engine.ts#Graft.graph",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts#Graft",+ "target": "src/engine.ts#Graft.init",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts#Graft",+ "target": "src/engine.ts#Graft.modelLabel",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts#Graft",+ "target": "src/engine.ts#Graft.requireKey",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts#Graft",+ "target": "src/engine.ts#Graft.summarizer",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts#Graft",+ "target": "src/engine.ts#Graft.synthesizer",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts#Graft.ask",+ "target": "src/ask/ask.ts#ask",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/engine.ts#Graft.check",+ "target": "src/context/check.ts#checkContext",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/engine.ts#Graft.checkGraph",+ "target": "src/graph/check.ts#checkGraph",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/engine.ts#Graft.constructor",+ "target": "src/ai/providers.ts#resolveConfig",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/engine.ts#Graft.cruxSummarizer",+ "target": "src/engine.ts#Graft.requireKey",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts#Graft.graph",+ "target": "src/engine.ts#Graft.cruxSummarizer",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts#Graft.graph",+ "target": "src/graph/build.ts#buildGraph",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/engine.ts#Graft.init",+ "target": "src/context/build.ts#buildContext",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/engine.ts#Graft.init",+ "target": "src/engine.ts#Graft.modelLabel",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts#Graft.init",+ "target": "src/engine.ts#Graft.summarizer",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts#Graft.init",+ "target": "src/engine.ts#Graft.synthesizer",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts#Graft.summarizer",+ "target": "src/engine.ts#Graft.requireKey",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/engine.ts#Graft.synthesizer",+ "target": "src/engine.ts#Graft.requireKey",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/build.ts",+ "target": "src/graph/build.ts#buildGraph",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/build.ts",+ "target": "src/graph/build.ts#GraphBuildOptions",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/build.ts",+ "target": "src/graph/build.ts#GraphBuildResult",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/build.ts",+ "target": "src/graph/build.ts#listSourceFiles",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/build.ts",+ "target": "node:fs",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/build.ts",+ "target": "node:path",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/build.ts",+ "target": "src/ai/crux.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/build.ts",+ "target": "src/context/node-file.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/build.ts",+ "target": "src/graph/cards.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/build.ts",+ "target": "src/graph/enrich.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/build.ts",+ "target": "src/graph/extract.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/build.ts",+ "target": "src/graph/resolve.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/build.ts",+ "target": "src/graph/types.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/build.ts",+ "target": "src/graph/write.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/build.ts",+ "target": "src/ingest/fs.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/build.ts#buildGraph",+ "target": "src/context/node-file.ts#contextDirFor",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/graph/build.ts#buildGraph",+ "target": "src/graph/build.ts#listSourceFiles",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/build.ts#buildGraph",+ "target": "src/graph/cards.ts#writeCards",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/graph/build.ts#buildGraph",+ "target": "src/graph/cards.ts#writeCovers",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/graph/build.ts#buildGraph",+ "target": "src/graph/cards.ts#writeIndex",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/graph/build.ts#buildGraph",+ "target": "src/graph/enrich.ts#enrichGraph",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/graph/build.ts#buildGraph",+ "target": "src/graph/extract.ts#extractFile",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/graph/build.ts#buildGraph",+ "target": "src/graph/extract.ts#languageOf",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/graph/build.ts#buildGraph",+ "target": "src/graph/resolve.ts#resolveEdges",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/graph/build.ts#buildGraph",+ "target": "src/graph/write.ts#readGraph",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/graph/build.ts#buildGraph",+ "target": "src/graph/write.ts#wiringPath",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/graph/build.ts#buildGraph",+ "target": "src/graph/write.ts#writeGraph",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/graph/build.ts#listSourceFiles",+ "target": "src/graph/extract.ts#languageOf",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/graph/build.ts#listSourceFiles",+ "target": "src/ingest/fs.ts#walkDir",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/graph/cards.ts",+ "target": "src/graph/cards.ts#CardFileInfo",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts",+ "target": "src/graph/cards.ts#cardPathFor",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts",+ "target": "src/graph/cards.ts#CardStats",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts",+ "target": "src/graph/cards.ts#conceptsByPath",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts",+ "target": "src/graph/cards.ts#CoverRef",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts",+ "target": "src/graph/cards.ts#listExistingCards",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts",+ "target": "src/graph/cards.ts#oneLiner",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts",+ "target": "src/graph/cards.ts#pruneEmptyDirs",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts",+ "target": "src/graph/cards.ts#renderCard",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts",+ "target": "src/graph/cards.ts#spanStart",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts",+ "target": "src/graph/cards.ts#writeCards",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts",+ "target": "src/graph/cards.ts#writeCovers",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts",+ "target": "src/graph/cards.ts#writeIndex",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts",+ "target": "gray-matter",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts",+ "target": "node:fs",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts",+ "target": "node:path",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts",+ "target": "src/context/node-file.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts",+ "target": "src/graph/types.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts",+ "target": "src/graph/write.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts#conceptsByPath",+ "target": "src/context/node-file.ts#readNodes",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/graph/cards.ts#listExistingCards",+ "target": "src/graph/cards.ts#listExistingCards.walk",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts#listExistingCards",+ "target": "src/graph/cards.ts#listExistingCards.walk",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts#listExistingCards.walk",+ "target": "src/graph/cards.ts#listExistingCards.walk",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts#pruneEmptyDirs",+ "target": "src/graph/cards.ts#pruneEmptyDirs.visit",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts#pruneEmptyDirs",+ "target": "src/graph/cards.ts#pruneEmptyDirs.visit",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts#pruneEmptyDirs.visit",+ "target": "src/graph/cards.ts#pruneEmptyDirs.visit",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts#renderCard",+ "target": "src/graph/cards.ts#oneLiner",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts#renderCard",+ "target": "src/graph/cards.ts#spanStart",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts#writeCards",+ "target": "src/graph/cards.ts#cardPathFor",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts#writeCards",+ "target": "src/graph/cards.ts#conceptsByPath",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts#writeCards",+ "target": "src/graph/cards.ts#listExistingCards",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts#writeCards",+ "target": "src/graph/cards.ts#pruneEmptyDirs",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts#writeCards",+ "target": "src/graph/cards.ts#renderCard",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts#writeCovers",+ "target": "src/graph/cards.ts#spanStart",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/cards.ts#writeIndex",+ "target": "src/context/node-file.ts#readNodes",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/graph/check.ts",+ "target": "src/graph/check.ts#checkGraph",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/check.ts",+ "target": "src/graph/check.ts#formatGraphCheckReport",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/check.ts",+ "target": "src/graph/check.ts#GraphCheckOptions",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/check.ts",+ "target": "src/graph/check.ts#GraphCheckResult",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/check.ts",+ "target": "node:fs",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/check.ts",+ "target": "node:path",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/check.ts",+ "target": "src/context/node-file.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/check.ts",+ "target": "src/graph/build.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/check.ts",+ "target": "src/graph/extract.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/check.ts",+ "target": "src/graph/write.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/check.ts#checkGraph",+ "target": "src/context/node-file.ts#contextDirFor",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/graph/check.ts#checkGraph",+ "target": "src/graph/build.ts#listSourceFiles",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/graph/check.ts#checkGraph",+ "target": "src/graph/extract.ts#extractFile",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/graph/check.ts#checkGraph",+ "target": "src/graph/extract.ts#languageOf",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/graph/check.ts#checkGraph",+ "target": "src/graph/write.ts#readGraph",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/graph/check.ts#checkGraph",+ "target": "src/graph/write.ts#wiringPath",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/graph/enrich.ts",+ "target": "src/graph/enrich.ts#buildCrux",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/enrich.ts",+ "target": "src/graph/enrich.ts#collectFileCrux",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/enrich.ts",+ "target": "src/graph/enrich.ts#enrichGraph",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/enrich.ts",+ "target": "src/graph/enrich.ts#EnrichOptions",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/enrich.ts",+ "target": "src/graph/enrich.ts#EnrichStats",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/enrich.ts",+ "target": "src/graph/enrich.ts#spanLines",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/enrich.ts",+ "target": "src/ai/crux.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/enrich.ts",+ "target": "src/graph/types.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/enrich.ts#buildCrux",+ "target": "src/graph/enrich.ts#spanLines",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/enrich.ts#collectFileCrux",+ "target": "src/ai/crux.ts#OpenRouterCruxSummarizer.describeFile",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/graph/enrich.ts#enrichGraph",+ "target": "src/graph/enrich.ts#buildCrux",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/enrich.ts#enrichGraph",+ "target": "src/graph/enrich.ts#collectFileCrux",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/enrich.ts#enrichGraph",+ "target": "src/graph/enrich.ts#spanLines",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts",+ "target": "src/graph/extract.ts#calleeName",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts",+ "target": "src/graph/extract.ts#clean",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts",+ "target": "src/graph/extract.ts#DefDescriptor",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts",+ "target": "src/graph/extract.ts#describe",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts",+ "target": "src/graph/extract.ts#extractFile",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts",+ "target": "src/graph/extract.ts#ExtractResult",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts",+ "target": "src/graph/extract.ts#heritageEdges",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts",+ "target": "src/graph/extract.ts#importSpecifier",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts",+ "target": "src/graph/extract.ts#isImport",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts",+ "target": "src/graph/extract.ts#Language",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts",+ "target": "src/graph/extract.ts#languageOf",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts",+ "target": "src/graph/extract.ts#RawEdge",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts",+ "target": "src/graph/extract.ts#tsExported",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts",+ "target": "src/graph/extract.ts#walk",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts",+ "target": "src/graph/extract.ts#WalkCtx",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts",+ "target": "node:path",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts",+ "target": "src/graph/types.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts",+ "target": "src/util/id.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts",+ "target": "tree-sitter",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts",+ "target": "tree-sitter-python",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts",+ "target": "tree-sitter-typescript",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts#extractFile",+ "target": "src/graph/extract.ts#walk",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts#extractFile",+ "target": "src/util/id.ts#contentHash",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/graph/extract.ts#walk",+ "target": "src/graph/extract.ts#calleeName",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts#walk",+ "target": "src/graph/extract.ts#clean",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts#walk",+ "target": "src/graph/extract.ts#describe",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts#walk",+ "target": "src/graph/extract.ts#heritageEdges",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts#walk",+ "target": "src/graph/extract.ts#importSpecifier",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts#walk",+ "target": "src/graph/extract.ts#isImport",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts#walk",+ "target": "src/graph/extract.ts#tsExported",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts#walk",+ "target": "src/graph/extract.ts#walk",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/extract.ts#walk",+ "target": "src/util/id.ts#contentHash",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/graph/resolve.ts",+ "target": "src/graph/resolve.ts#push",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/resolve.ts",+ "target": "src/graph/resolve.ts#resolveEdges",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/resolve.ts",+ "target": "src/graph/resolve.ts#resolveImport",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/resolve.ts",+ "target": "src/graph/resolve.ts#resolveName",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/resolve.ts",+ "target": "node:path",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/resolve.ts",+ "target": "src/graph/extract.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/resolve.ts",+ "target": "src/graph/types.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/resolve.ts#resolveEdges",+ "target": "src/graph/resolve.ts#push",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/resolve.ts#resolveEdges",+ "target": "src/graph/resolve.ts#resolveEdges.add",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/resolve.ts#resolveEdges",+ "target": "src/graph/resolve.ts#resolveImport",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/resolve.ts#resolveEdges",+ "target": "src/graph/resolve.ts#resolveName",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/resolve.ts#resolveEdges",+ "target": "src/graph/resolve.ts#resolveEdges.add",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/types.ts",+ "target": "src/graph/types.ts#Confidence",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/types.ts",+ "target": "src/graph/types.ts#Crux",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/types.ts",+ "target": "src/graph/types.ts#EdgeV1",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/types.ts",+ "target": "src/graph/types.ts#GraphV1",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/types.ts",+ "target": "src/graph/types.ts#Kind",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/types.ts",+ "target": "src/graph/types.ts#NodeV1",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/types.ts",+ "target": "src/graph/types.ts#Relation",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/types.ts",+ "target": "src/graph/types.ts#SummaryState",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/write.ts",+ "target": "src/graph/write.ts#edgeOrder",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/write.ts",+ "target": "src/graph/write.ts#readGraph",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/write.ts",+ "target": "src/graph/write.ts#wiringPath",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/write.ts",+ "target": "src/graph/write.ts#writeGraph",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/write.ts",+ "target": "node:fs",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/write.ts",+ "target": "node:path",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/write.ts",+ "target": "src/graph/types.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/graph/write.ts#writeGraph",+ "target": "src/graph/write.ts#wiringPath",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/ingest/fs.ts",+ "target": "src/ingest/fs.ts#walkDir",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/ingest/fs.ts",+ "target": "node:fs",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/ingest/fs.ts",+ "target": "node:path",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/ingest/fs.ts#walkDir",+ "target": "src/ingest/fs.ts#walkDir",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/util/id.ts",+ "target": "src/util/id.ts#contentHash",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/util/id.ts",+ "target": "src/util/id.ts#newId",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/util/id.ts",+ "target": "src/util/id.ts#normalizeName",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/util/id.ts",+ "target": "node:crypto",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/viz/assemble.ts",+ "target": "src/viz/assemble.ts#assembleContextGraph",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/viz/assemble.ts",+ "target": "src/viz/assemble.ts#extractSummary",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/viz/assemble.ts",+ "target": "src/viz/assemble.ts#normalizeRelation",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/viz/assemble.ts",+ "target": "src/viz/assemble.ts#VizEdge",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/viz/assemble.ts",+ "target": "src/viz/assemble.ts#VizGraph",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/viz/assemble.ts",+ "target": "src/viz/assemble.ts#VizNode",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/viz/assemble.ts",+ "target": "gray-matter",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/viz/assemble.ts",+ "target": "node:fs",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/viz/assemble.ts",+ "target": "node:path",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/viz/assemble.ts",+ "target": "src/context/node-file.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/viz/assemble.ts#assembleContextGraph",+ "target": "src/viz/assemble.ts#extractSummary",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/viz/assemble.ts#assembleContextGraph",+ "target": "src/viz/assemble.ts#normalizeRelation",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/viz/serve.ts",+ "target": "src/viz/serve.ts#listen",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/viz/serve.ts",+ "target": "src/viz/serve.ts#sendJson",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/viz/serve.ts",+ "target": "src/viz/serve.ts#startVizServer",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/viz/serve.ts",+ "target": "src/viz/serve.ts#VizServer",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/viz/serve.ts",+ "target": "src/viz/serve.ts#VizServerOptions",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/viz/serve.ts",+ "target": "node:fs",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/viz/serve.ts",+ "target": "node:http",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/viz/serve.ts",+ "target": "node:path",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/viz/serve.ts",+ "target": "src/viz/assemble.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "src/viz/serve.ts#listen",+ "target": "src/viz/serve.ts#listen.onError",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/viz/serve.ts#startVizServer",+ "target": "src/viz/assemble.ts#assembleContextGraph",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "src/viz/serve.ts#startVizServer",+ "target": "src/viz/serve.ts#listen",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/viz/serve.ts#startVizServer",+ "target": "src/viz/serve.ts#sendJson",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "src/viz/serve.ts#startVizServer",+ "target": "src/viz/serve.ts#startVizServer.close",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "src/viz/serve.ts#startVizServer.close",+ "target": "src/viz/serve.ts#startVizServer.close",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "test/context.test.ts",+ "target": "src/context/build.ts#buildContext",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "test/context.test.ts",+ "target": "src/context/check.ts#checkContext",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "test/context.test.ts",+ "target": "test/context.test.ts#buildOpts",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "test/context.test.ts",+ "target": "test/context.test.ts#makeFixture",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "test/context.test.ts",+ "target": "test/context.test.ts#buildOpts",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "test/context.test.ts",+ "target": "test/context.test.ts#makeFixture",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "test/context.test.ts",+ "target": "node:assert/strict",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/context.test.ts",+ "target": "node:fs",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/context.test.ts",+ "target": "node:os",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/context.test.ts",+ "target": "node:path",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/context.test.ts",+ "target": "node:test",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/context.test.ts",+ "target": "src/context/build.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/context.test.ts",+ "target": "src/context/check.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/context.test.ts",+ "target": "test/helpers.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/context.test.ts#buildOpts",+ "target": "test/helpers.ts#fakeProviders",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "test/covers.test.ts",+ "target": "src/context/build.ts#buildContext",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "test/covers.test.ts",+ "target": "src/graph/build.ts#buildGraph",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "test/covers.test.ts",+ "target": "test/covers.test.ts#makeFixture",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "test/covers.test.ts",+ "target": "test/helpers.ts#fakeProviders",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "test/covers.test.ts",+ "target": "test/covers.test.ts#makeFixture",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "test/covers.test.ts",+ "target": "gray-matter",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/covers.test.ts",+ "target": "node:assert/strict",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/covers.test.ts",+ "target": "node:fs",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/covers.test.ts",+ "target": "node:os",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/covers.test.ts",+ "target": "node:path",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/covers.test.ts",+ "target": "node:test",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/covers.test.ts",+ "target": "src/context/build.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/covers.test.ts",+ "target": "src/graph/build.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/covers.test.ts",+ "target": "test/helpers.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/helpers.ts",+ "target": "test/helpers.ts#BracketSynthesizer",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "test/helpers.ts",+ "target": "test/helpers.ts#fakeProviders",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "test/helpers.ts",+ "target": "test/helpers.ts#PassthroughSummarizer",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "test/helpers.ts",+ "target": "src/index.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/helpers.ts#BracketSynthesizer",+ "target": "test/helpers.ts#BracketSynthesizer.synthesize",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "test/helpers.ts#BracketSynthesizer",+ "target": "src/ai/synthesize.ts#Synthesizer",+ "relation": "implements",+ "confidence": "inferred"+ },+ {+ "source": "test/helpers.ts#BracketSynthesizer.synthesize",+ "target": "test/helpers.ts#BracketSynthesizer.synthesize.ensure",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "test/helpers.ts#BracketSynthesizer.synthesize",+ "target": "test/helpers.ts#BracketSynthesizer.synthesize.ensure",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "test/helpers.ts#PassthroughSummarizer",+ "target": "test/helpers.ts#PassthroughSummarizer.summarize",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "test/helpers.ts#PassthroughSummarizer",+ "target": "src/ai/summarize.ts#Summarizer",+ "relation": "implements",+ "confidence": "inferred"+ },+ {+ "source": "test/viz-assemble.test.ts",+ "target": "src/viz/assemble.ts#assembleContextGraph",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "test/viz-assemble.test.ts",+ "target": "src/viz/assemble.ts#normalizeRelation",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "test/viz-assemble.test.ts",+ "target": "test/viz-assemble.test.ts#makeContextDir",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "test/viz-assemble.test.ts",+ "target": "test/viz-assemble.test.ts#makeContextDir",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "test/viz-assemble.test.ts",+ "target": "node:assert/strict",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/viz-assemble.test.ts",+ "target": "node:fs",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/viz-assemble.test.ts",+ "target": "node:os",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/viz-assemble.test.ts",+ "target": "node:path",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/viz-assemble.test.ts",+ "target": "node:test",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/viz-assemble.test.ts",+ "target": "src/viz/assemble.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/viz-serve.test.ts",+ "target": "src/viz/serve.ts#startVizServer",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "test/viz-serve.test.ts",+ "target": "src/viz/serve.ts#startVizServer.close",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "test/viz-serve.test.ts",+ "target": "test/viz-serve.test.ts#makeDirs",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "test/viz-serve.test.ts",+ "target": "test/viz-serve.test.ts#makeDirs",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "test/viz-serve.test.ts",+ "target": "node:assert/strict",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/viz-serve.test.ts",+ "target": "node:fs",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/viz-serve.test.ts",+ "target": "node:http",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/viz-serve.test.ts",+ "target": "node:os",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/viz-serve.test.ts",+ "target": "node:path",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/viz-serve.test.ts",+ "target": "node:test",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "test/viz-serve.test.ts",+ "target": "src/viz/serve.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "viewer/data.ts",+ "target": "viewer/data.ts#chipKey",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/data.ts",+ "target": "viewer/data.ts#CodeGraphV1",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/data.ts",+ "target": "viewer/data.ts#colorToken",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/data.ts",+ "target": "viewer/data.ts#cvar",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/data.ts",+ "target": "viewer/data.ts#Family",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/data.ts",+ "target": "viewer/data.ts#famOf",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/data.ts",+ "target": "viewer/data.ts#loadCodeGraph",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/data.ts",+ "target": "viewer/data.ts#loadContextGraph",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/data.ts",+ "target": "viewer/data.ts#onServerChange",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/data.ts",+ "target": "viewer/data.ts#VizEdge",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/data.ts",+ "target": "viewer/data.ts#VizGraph",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/data.ts",+ "target": "viewer/data.ts#VizNode",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/data.ts#chipKey",+ "target": "viewer/data.ts#famOf",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/detail.ts",+ "target": "viewer/detail.ts#esc",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/detail.ts",+ "target": "viewer/detail.ts#renderDetail",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/detail.ts",+ "target": "viewer/data.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "viewer/detail.ts#renderDetail",+ "target": "viewer/data.ts#colorToken",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/detail.ts#renderDetail",+ "target": "viewer/data.ts#cvar",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/detail.ts#renderDetail",+ "target": "viewer/detail.ts#esc",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/detail.ts#renderDetail",+ "target": "viewer/detail.ts#renderDetail.linkList",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/detail.ts#renderDetail",+ "target": "viewer/detail.ts#renderDetail.linkList",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/detail.ts#renderDetail",+ "target": "viewer/detail.ts#renderDetail.name",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/detail.ts#renderDetail.linkList",+ "target": "viewer/detail.ts#esc",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/detail.ts#renderDetail.linkList",+ "target": "viewer/detail.ts#renderDetail.name",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts",+ "target": "viewer/graph.ts#el",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts",+ "target": "viewer/graph.ts#GraphView",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts",+ "target": "viewer/graph.ts#SimEdge",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts",+ "target": "viewer/graph.ts#SimNode",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts",+ "target": "d3-force",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts",+ "target": "viewer/data.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView",+ "target": "viewer/graph.ts#GraphView.applyView",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView",+ "target": "viewer/graph.ts#GraphView.bindDrag",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView",+ "target": "viewer/graph.ts#GraphView.bindPanZoom",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView",+ "target": "viewer/graph.ts#GraphView.buildChrome",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView",+ "target": "viewer/graph.ts#GraphView.buildElements",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView",+ "target": "viewer/graph.ts#GraphView.constructor",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView",+ "target": "viewer/graph.ts#GraphView.ensureMarkers",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView",+ "target": "viewer/graph.ts#GraphView.firstMatch",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView",+ "target": "viewer/graph.ts#GraphView.focus",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView",+ "target": "viewer/graph.ts#GraphView.reheat",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView",+ "target": "viewer/graph.ts#GraphView.resetView",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView",+ "target": "viewer/graph.ts#GraphView.restyle",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView",+ "target": "viewer/graph.ts#GraphView.select",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView",+ "target": "viewer/graph.ts#GraphView.setData",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView",+ "target": "viewer/graph.ts#GraphView.tick",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView",+ "target": "viewer/graph.ts#GraphView.zoomBy",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView.bindDrag",+ "target": "viewer/graph.ts#GraphView.bindDrag.move",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView.bindDrag",+ "target": "viewer/graph.ts#GraphView.bindDrag.up",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView.bindPanZoom",+ "target": "viewer/graph.ts#GraphView.applyView",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView.buildChrome",+ "target": "viewer/graph.ts#el",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView.buildChrome",+ "target": "viewer/graph.ts#GraphView.select",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView.buildElements",+ "target": "viewer/graph.ts#el",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView.buildElements",+ "target": "viewer/graph.ts#GraphView.bindDrag",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView.buildElements",+ "target": "viewer/graph.ts#GraphView.ensureMarkers",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView.buildElements",+ "target": "viewer/graph.ts#GraphView.select",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView.constructor",+ "target": "viewer/graph.ts#GraphView.bindPanZoom",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView.constructor",+ "target": "viewer/graph.ts#GraphView.buildChrome",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView.ensureMarkers",+ "target": "viewer/data.ts#cvar",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/graph.ts#GraphView.ensureMarkers",+ "target": "viewer/graph.ts#el",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView.focus",+ "target": "viewer/graph.ts#GraphView.applyView",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView.focus",+ "target": "viewer/graph.ts#GraphView.select",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView.resetView",+ "target": "viewer/graph.ts#GraphView.applyView",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView.restyle",+ "target": "viewer/data.ts#chipKey",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/graph.ts#GraphView.restyle",+ "target": "viewer/data.ts#colorToken",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/graph.ts#GraphView.restyle",+ "target": "viewer/data.ts#cvar",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/graph.ts#GraphView.restyle",+ "target": "viewer/data.ts#famOf",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/graph.ts#GraphView.restyle",+ "target": "viewer/graph.ts#GraphView.ensureMarkers",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView.restyle",+ "target": "viewer/graph.ts#GraphView.restyle.nodeShown",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView.restyle",+ "target": "viewer/graph.ts#GraphView.restyle.nodeShown",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView.select",+ "target": "viewer/graph.ts#GraphView.restyle",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView.setData",+ "target": "viewer/data.ts#famOf",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/graph.ts#GraphView.setData",+ "target": "viewer/graph.ts#GraphView.buildElements",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView.setData",+ "target": "viewer/graph.ts#GraphView.restyle",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView.setData",+ "target": "viewer/graph.ts#GraphView.tick",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/graph.ts#GraphView.zoomBy",+ "target": "viewer/graph.ts#GraphView.applyView",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/data.ts#onServerChange",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/graph.ts#GraphView.firstMatch",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/graph.ts#GraphView.focus",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/graph.ts#GraphView.resetView",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/graph.ts#GraphView.restyle",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/graph.ts#GraphView.zoomBy",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/main.ts#$",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/main.ts#loadAll",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/main.ts#renderChips",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/main.ts#renderLegend",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/main.ts#setTab",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/main.ts#showDetail",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/main.ts#$",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/main.ts#activeGraph",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/main.ts#glyphFor",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/main.ts#graphTab",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/main.ts#loadAll",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/main.ts#renderChips",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/main.ts#renderLegend",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/main.ts#setTab",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/main.ts#showDetail",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/main.ts#showEmpty",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/main.ts#Tab",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/main.ts#updateCounts",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/main.ts#updateShownCount",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/data.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/detail.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/graph.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts",+ "target": "viewer/tree.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#glyphFor",+ "target": "viewer/data.ts#famOf",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/main.ts#loadAll",+ "target": "viewer/data.ts#loadCodeGraph",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/main.ts#loadAll",+ "target": "viewer/data.ts#loadContextGraph",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/main.ts#loadAll",+ "target": "viewer/main.ts#$",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#loadAll",+ "target": "viewer/main.ts#setTab",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#renderChips",+ "target": "viewer/data.ts#chipKey",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/main.ts#renderChips",+ "target": "viewer/graph.ts#GraphView.restyle",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/main.ts#renderChips",+ "target": "viewer/main.ts#$",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#renderChips",+ "target": "viewer/main.ts#activeGraph",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#renderChips",+ "target": "viewer/main.ts#glyphFor",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#renderChips",+ "target": "viewer/main.ts#renderChips",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#renderChips",+ "target": "viewer/main.ts#renderChips.rank",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#renderChips",+ "target": "viewer/main.ts#updateShownCount",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#renderChips",+ "target": "viewer/main.ts#renderChips.rank",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#renderLegend",+ "target": "viewer/data.ts#colorToken",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/main.ts#renderLegend",+ "target": "viewer/data.ts#cvar",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/main.ts#renderLegend",+ "target": "viewer/graph.ts#GraphView.restyle",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/main.ts#renderLegend",+ "target": "viewer/main.ts#$",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#renderLegend",+ "target": "viewer/main.ts#activeGraph",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#renderLegend",+ "target": "viewer/main.ts#graphTab",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#renderLegend",+ "target": "viewer/main.ts#renderLegend",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#renderLegend",+ "target": "viewer/main.ts#updateShownCount",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#setTab",+ "target": "viewer/graph.ts#GraphView.reheat",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/main.ts#setTab",+ "target": "viewer/graph.ts#GraphView.resetView",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/main.ts#setTab",+ "target": "viewer/graph.ts#GraphView.setData",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/main.ts#setTab",+ "target": "viewer/main.ts#$",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#setTab",+ "target": "viewer/main.ts#activeGraph",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#setTab",+ "target": "viewer/main.ts#graphTab",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#setTab",+ "target": "viewer/main.ts#renderChips",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#setTab",+ "target": "viewer/main.ts#renderLegend",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#setTab",+ "target": "viewer/main.ts#showDetail",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#setTab",+ "target": "viewer/main.ts#showEmpty",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#setTab",+ "target": "viewer/main.ts#updateCounts",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#setTab",+ "target": "viewer/main.ts#updateShownCount",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#setTab",+ "target": "viewer/tree.ts#renderOutline",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/main.ts#showDetail",+ "target": "viewer/detail.ts#renderDetail",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/main.ts#showDetail",+ "target": "viewer/graph.ts#GraphView.focus",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/main.ts#showDetail",+ "target": "viewer/main.ts#$",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#showDetail",+ "target": "viewer/main.ts#graphTab",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#showDetail",+ "target": "viewer/main.ts#showDetail",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#showDetail",+ "target": "viewer/tree.ts#renderOutline",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/main.ts#showEmpty",+ "target": "viewer/main.ts#$",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#updateCounts",+ "target": "viewer/main.ts#$",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#updateCounts",+ "target": "viewer/main.ts#activeGraph",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#updateShownCount",+ "target": "viewer/main.ts#$",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/main.ts#updateShownCount",+ "target": "viewer/main.ts#activeGraph",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/tree.ts",+ "target": "viewer/tree.ts#esc",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/tree.ts",+ "target": "viewer/tree.ts#renderOutline",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/tree.ts",+ "target": "viewer/data.ts",+ "relation": "imports",+ "confidence": "extracted"+ },+ {+ "source": "viewer/tree.ts#renderOutline",+ "target": "viewer/tree.ts#renderOutline",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/tree.ts#renderOutline",+ "target": "viewer/tree.ts#renderOutline.countDesc",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/tree.ts#renderOutline",+ "target": "viewer/tree.ts#renderOutline.kids",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/tree.ts#renderOutline",+ "target": "viewer/tree.ts#renderOutline.row",+ "relation": "contains",+ "confidence": "extracted"+ },+ {+ "source": "viewer/tree.ts#renderOutline.countDesc",+ "target": "viewer/tree.ts#renderOutline.countDesc",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/tree.ts#renderOutline.countDesc",+ "target": "viewer/tree.ts#renderOutline.kids",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/tree.ts#renderOutline.row",+ "target": "viewer/data.ts#colorToken",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/tree.ts#renderOutline.row",+ "target": "viewer/data.ts#cvar",+ "relation": "calls",+ "confidence": "inferred"+ },+ {+ "source": "viewer/tree.ts#renderOutline.row",+ "target": "viewer/tree.ts#esc",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/tree.ts#renderOutline.row",+ "target": "viewer/tree.ts#renderOutline.countDesc",+ "relation": "calls",+ "confidence": "extracted"+ },+ {+ "source": "viewer/tree.ts#renderOutline.row",+ "target": "viewer/tree.ts#renderOutline.kids",+ "relation": "calls",+ "confidence": "extracted"+ }+ ]+}diff --git a/graft/INDEX.md b/graft/INDEX.mdnew file mode 100644index 00000000..e56b0883--- /dev/null+++ b/graft/INDEX.md@@ -0,0 +1,68 @@+# graft — repo map++Small markdown nodes summarising this repo. `grep` any term, symbol, or+filename here, or run `graft ask "<task>"`. Each node carries prose plus exact+`file:line`; open a source file only to edit the named span.++## Concepts++- [ai-model-evaluation](ai-model-evaluation.md) — AI Model Evaluation · bench/judge.ts+- [benchmarking-framework](benchmarking-framework.md) — Benchmarking Framework · bench/agent.ts, bench/judge.ts, bench/report.ts, bench/run.ts, bench/selfcheck.ts, bench/tasks.ts+- [benchmarking-results-reporting](benchmarking-results-reporting.md) — Benchmarking Results Reporting · bench/report.ts+- [caching-mechanism](caching-mechanism.md) — Caching Mechanism · bench/agent.ts, bench/report.ts, src/context/build.ts, src/graph/enrich.ts+- [code-summarization-and-synthesis](code-summarization-and-synthesis.md) — Code Summarization and Synthesis · src/ai/crux.ts, src/ai/summarize.ts, src/ai/synthesize.ts+- [configuration-management](configuration-management.md) — Configuration Management · src/ai/providers.ts+- [context-graph-management](context-graph-management.md) — Context Graph Management · src/context/build.ts, src/context/check.ts, src/context/node-file.ts, src/graph/build.ts, src/graph/check.ts, src/graph/enrich.ts, src/graph/extract.ts, src/graph/resolve.ts, src/graph/types.ts, src/graph/write.ts+- [error-handling-and-robustness](error-handling-and-robustness.md) — Error Handling and Robustness · bench/run.ts, bench/selfcheck.ts, src/engine.ts+- [graph-visualization](graph-visualization.md) — Graph Visualization · viewer/data.ts, viewer/detail.ts, viewer/graph.ts, viewer/main.ts, viewer/tree.ts+- [markdown-context-graph](markdown-context-graph.md) — Markdown Context Graph · src/graph/write.ts, src/index.ts+- [openrouter-integration](openrouter-integration.md) — OpenRouter Integration · bench/llm.ts+- [self-check-mechanism](self-check-mechanism.md) — Self-Check Mechanism · bench/selfcheck.ts+- [task-management](task-management.md) — Task Management · bench/tasks.ts++## Files++Per-file wiring cards mirror the source tree. `grep` a symbol or `find` a+filename to land on its card.++- [bench/agent.md](bench/agent.md) — 9 symbols+- [bench/judge.md](bench/judge.md) — 4 symbols+- [bench/llm.md](bench/llm.md) — 1 symbol+- [bench/report.md](bench/report.md) — 8 symbols+- [bench/run.md](bench/run.md) — 6 symbols+- [bench/selfcheck.md](bench/selfcheck.md) — 2 symbols+- [bench/tasks.md](bench/tasks.md) — 3 symbols+- [scripts/build-viewer.md](scripts/build-viewer.md) — 0 symbols+- [src/ai/crux.md](src/ai/crux.md) — 11 symbols+- [src/ai/providers.md](src/ai/providers.md) — 3 symbols+- [src/ai/summarize.md](src/ai/summarize.md) — 5 symbols+- [src/ai/synthesize.md](src/ai/synthesize.md) — 9 symbols+- [src/ask/ask.md](src/ask/ask.md) — 14 symbols+- [src/cli.md](src/cli.md) — 2 symbols+- [src/context/build.md](src/context/build.md) — 16 symbols+- [src/context/check.md](src/context/check.md) — 5 symbols+- [src/context/node-file.md](src/context/node-file.md) — 18 symbols+- [src/engine.md](src/engine.md) — 15 symbols+- [src/graph/build.md](src/graph/build.md) — 4 symbols+- [src/graph/cards.md](src/graph/cards.md) — 15 symbols+- [src/graph/check.md](src/graph/check.md) — 4 symbols+- [src/graph/enrich.md](src/graph/enrich.md) — 6 symbols+- [src/graph/extract.md](src/graph/extract.md) — 15 symbols+- [src/graph/resolve.md](src/graph/resolve.md) — 5 symbols+- [src/graph/types.md](src/graph/types.md) — 8 symbols+- [src/graph/write.md](src/graph/write.md) — 4 symbols+- [src/index.md](src/index.md) — 0 symbols+- [src/ingest/fs.md](src/ingest/fs.md) — 1 symbol+- [src/util/id.md](src/util/id.md) — 3 symbols+- [src/viz/assemble.md](src/viz/assemble.md) — 6 symbols+- [src/viz/serve.md](src/viz/serve.md) — 7 symbols+- [test/context.test.md](test/context.test.md) — 2 symbols+- [test/covers.test.md](test/covers.test.md) — 1 symbol+- [test/helpers.md](test/helpers.md) — 6 symbols+- [test/viz-assemble.test.md](test/viz-assemble.test.md) — 1 symbol+- [test/viz-serve.test.md](test/viz-serve.test.md) — 1 symbol+- [viewer/data.md](viewer/data.md) — 12 symbols+- [viewer/detail.md](viewer/detail.md) — 4 symbols+- [viewer/graph.md](viewer/graph.md) — 23 symbols+- [viewer/main.md](viewer/main.md) — 14 symbols+- [viewer/tree.md](viewer/tree.md) — 5 symbolsdiff --git a/graft/ai-model-evaluation.md b/graft/ai-model-evaluation.mdnew file mode 100644index 00000000..3d6d5f18--- /dev/null+++ b/graft/ai-model-evaluation.md@@ -0,0 +1,43 @@+---+name: AI Model Evaluation+slug: ai-model-evaluation+type: system+sources:+ - path: bench/judge.ts+ hash: 94c222341b066e4f3134b3d9d3f30f31b9ffe7b92967086b07c58f297d349936+sources_digest: bfba2049dadf6f189e964206041bfbb54d9515eabe1bf3cc28ea06450fa65de7+links:+ - to: benchmarking-framework+ relation: part_of+ description: >-+ It is a critical part of the benchmarking framework that assesses the+ correctness of AI outputs.+generator:+ version: 1+covers:+ - symbol: Verdict+ kind: interface+ at: 'bench/judge.ts:L18-L24'+ - symbol: JudgeInput+ kind: interface+ at: 'bench/judge.ts:L26-L32'+ - symbol: extractJson+ kind: function+ at: 'bench/judge.ts:L35-L49'+ - symbol: judge+ kind: function+ at: 'bench/judge.ts:L51-L87'+---+<!-- context:generated:start -->+## Summary++This component encompasses the evaluation of AI-generated answers against reference answers, utilizing a two-layer scoring mechanism to ensure robust correctness assessments. It integrates with the OpenRouter service for model interactions.++## Related++- part of [[benchmarking-framework]] — It is a critical part of the benchmarking framework that assesses the correctness of AI outputs.+<!-- context:generated:end -->++## Notes++_Anything written below the generated block is preserved when the graph is regenerated._diff --git a/graft/bench/agent.md b/graft/bench/agent.mdnew file mode 100644index 00000000..513e770a--- /dev/null+++ b/graft/bench/agent.md@@ -0,0 +1,13 @@+# bench/agent.ts · [[benchmarking-framework]] [[caching-mechanism]]++This file implements a benchmark agent that processes questions about a codebase using filesystem tools and a language model.++- AgentResult · interface · L19-L27 — Defines the structure of the result returned by the agent, encapsulating the answer and various metrics.+- RunAgentOptions · interface · L29-L37 — Specifies the options for running the agent, including the root directory and the question to be answered.+- safePath · function · L46-L60 — Ensures that a given path is safely resolved within a specified root directory, preventing directory traversal attacks.+- listFiles · function · L62-L89 — Recursively lists all files in a directory while respecting size limits and skipping specified directories.+- walk · function · L64-L86 — A helper function that traverses a directory to collect file paths, avoiding hidden files and skipped directories.+- globToRegExp · function · L92-L106 — Converts a glob pattern into a regular expression for matching file paths.+- runTool · function · L168-L228 — Executes a specified tool (like reading a file or listing a directory) based on the provided input parameters.+- runAgent · function · L230-L322 — Manages the execution of the agent's logic, including handling user questions and tool interactions.+- slideCacheBreakpoint · function · L254-L260 — Maintains the cache state by updating the cache control for the most recent tool result in the message history.diff --git a/graft/bench/judge.md b/graft/bench/judge.mdnew file mode 100644index 00000000..d2a8d4a4--- /dev/null+++ b/graft/bench/judge.md@@ -0,0 +1,8 @@+# bench/judge.ts · [[ai-model-evaluation]] [[benchmarking-framework]]++This file implements a correctness scoring system that evaluates AI-generated answers against a reference answer using keyword checks and an LLM judge.++- Verdict · interface · L18-L24 — The Verdict interface encapsulates the scoring results and correctness evaluation of an AI agent's answer.+- JudgeInput · interface · L26-L32 — The JudgeInput interface defines the structure of input data required for the judging process, including the question and answers.+- extractJson · function · L35-L49 — The extractJson function retrieves the first JSON object from a string, handling cases where the JSON is wrapped in additional text.+- judge · function · L51-L87 — The judge function evaluates an AI agent's answer against a reference answer, returning a Verdict based on keyword presence and LLM scoring.diff --git a/graft/bench/llm.md b/graft/bench/llm.mdnew file mode 100644index 00000000..01798b8f--- /dev/null+++ b/graft/bench/llm.md@@ -0,0 +1,5 @@+# bench/llm.ts · [[openrouter-integration]]++This file configures and provides access to the OpenRouter API for benchmarking LLMs without needing separate API keys.++- makeClient · function · L14-L18 — Creates an OpenAI client instance, ensuring that the necessary API key is provided for operation.diff --git a/graft/bench/report.md b/graft/bench/report.mdnew file mode 100644index 00000000..351dc40c--- /dev/null+++ b/graft/bench/report.md@@ -0,0 +1,12 @@+# bench/report.ts · [[benchmarking-framework]] [[benchmarking-results-reporting]] [[caching-mechanism]]++This file provides functionality for aggregating and reporting benchmark results for different agent configurations.++- Row · interface · L6-L26 — Defines the structure of a benchmark trial row, capturing various metrics related to agent performance.+- costOf · function · L33-L38 — Calculates the approximate cost of running an agent based on input and output tokens and cache operations.+- mean · function · L40-L42 — Computes the mean of an array of numbers, returning zero for an empty array.+- ArmAgg · interface · L44-L54 — Represents aggregated metrics for a specific arm of the benchmark, including totals and averages.+- aggregate · function · L56-L68 — Aggregates multiple benchmark rows into a single ArmAgg object, calculating averages for various metrics.+- pctDelta · function · L70-L74 — Calculates the percentage delta between two values, handling the case where the first value is zero.+- fmt · function · L76-L78 — Formats a number for display, adjusting for thousands and decimal precision.+- buildMarkdown · function · L80-L125 — Generates a markdown report summarizing benchmark results across different corpora and arms.diff --git a/graft/bench/run.md b/graft/bench/run.mdnew file mode 100644index 00000000..1d339914--- /dev/null+++ b/graft/bench/run.md@@ -0,0 +1,10 @@+# bench/run.ts · [[benchmarking-framework]] [[error-handling-and-robustness]]++This file orchestrates the benchmarking process for various corpora and tasks, managing the execution and reporting of results.++- Args · interface · L29-L35 — Defines the structure for command-line arguments used to configure the benchmarking run.+- parseArgs · function · L37-L52 — Parses command-line arguments to extract configuration options for the benchmarking process.+- pool · function · L55-L66 — Executes a function on a set of items concurrently, limiting the number of simultaneous operations.+- worker · function · L58-L63 — Processes items in the pool function, handling each item asynchronously.+- makeDocsWorkdir · function · L69-L82 — Creates a temporary working directory for processing documents in a specified corpus.+- main · function · L84-L201 — Coordinates the overall benchmarking process, including argument parsing, corpus ingestion, and result reporting.diff --git a/graft/bench/selfcheck.md b/graft/bench/selfcheck.mdnew file mode 100644index 00000000..94e33b15--- /dev/null+++ b/graft/bench/selfcheck.md@@ -0,0 +1,6 @@+# bench/selfcheck.ts · [[benchmarking-framework]] [[error-handling-and-robustness]] [[self-check-mechanism]]++This file performs an offline verification of the harness plumbing to ensure control flow works correctly without needing an API key.++- makeStubClient · function · L19-L48 — Creates a stub client that simulates responses for agent and judge interactions during testing.+- main · function · L50-L114 — Coordinates the self-check process by setting up a temporary environment, running the agent, and validating the results.diff --git a/graft/bench/tasks.md b/graft/bench/tasks.mdnew file mode 100644index 00000000..be516b04--- /dev/null+++ b/graft/bench/tasks.md@@ -0,0 +1,7 @@+# bench/tasks.ts · [[benchmarking-framework]] [[task-management]]++This file defines benchmark tasks and their corresponding reference answers for validating code understanding across multiple repositories.++- repoPath · function · L26-L29 — This function determines the file path for sibling repositories, allowing for environment variable overrides.+- Task · interface · L31-L37 — This interface outlines the structure of a benchmark task, including its ID, question, reference answer, and required keywords.+- Corpus · interface · L39-L45 — This interface defines a corpus of benchmark tasks, specifying its ID, type, path, and associated tasks.diff --git a/graft/benchmarking-framework.md b/graft/benchmarking-framework.mdnew file mode 100644index 00000000..82b0b0e3--- /dev/null+++ b/graft/benchmarking-framework.md@@ -0,0 +1,143 @@+---+name: Benchmarking Framework+slug: benchmarking-framework+type: system+sources:+ - path: bench/agent.ts+ hash: e10d64f913c9517cef84cce58ea042d71bed3e94182c791245170eca54060e31+ - path: bench/judge.ts+ hash: 94c222341b066e4f3134b3d9d3f30f31b9ffe7b92967086b07c58f297d349936+ - path: bench/report.ts+ hash: 775be8c40a8e4172521bba8f6a1f026fa23c4d24b9b5225da3ed5b745077a5b0+ - path: bench/run.ts+ hash: a0d2859628588f45ae31862f5f801d6219802449c23bbbdba9aa51b7b9febf47+ - path: bench/selfcheck.ts+ hash: 0eaf577938e20fa27d9cd0157bc8843fdc37165d85696789334b8605138f4bb4+ - path: bench/tasks.ts+ hash: d21168797f40d193a914aca0c438409d29d300441bc0a6a518c93869240b3b69+sources_digest: cc0c5db726f28fff7640e4c1d4705d7cd4eb54660db1b399622bd8f580ffe58d+links:+ - to: benchmarking-results-reporting+ relation: produces+ description: >-+ It generates detailed reports summarizing the performance metrics of the+ evaluated models.+ - to: openrouter-integration+ relation: depends_on+ description: >-+ The benchmarking framework relies on the OpenRouter service for model+ interactions.+generator:+ version: 1+covers:+ - symbol: AgentResult+ kind: interface+ at: 'bench/agent.ts:L19-L27'+ - symbol: RunAgentOptions+ kind: interface+ at: 'bench/agent.ts:L29-L37'+ - symbol: safePath+ kind: function+ at: 'bench/agent.ts:L46-L60'+ - symbol: listFiles+ kind: function+ at: 'bench/agent.ts:L62-L89'+ - symbol: walk+ kind: function+ at: 'bench/agent.ts:L64-L86'+ - symbol: globToRegExp+ kind: function+ at: 'bench/agent.ts:L92-L106'+ - symbol: runTool+ kind: function+ at: 'bench/agent.ts:L168-L228'+ - symbol: runAgent+ kind: function+ at: 'bench/agent.ts:L230-L322'+ - symbol: slideCacheBreakpoint+ kind: function+ at: 'bench/agent.ts:L254-L260'+ - symbol: Verdict+ kind: interface+ at: 'bench/judge.ts:L18-L24'+ - symbol: JudgeInput+ kind: interface+ at: 'bench/judge.ts:L26-L32'+ - symbol: extractJson+ kind: function+ at: 'bench/judge.ts:L35-L49'+ - symbol: judge+ kind: function+ at: 'bench/judge.ts:L51-L87'+ - symbol: Row+ kind: interface+ at: 'bench/report.ts:L6-L26'+ - symbol: costOf+ kind: function+ at: 'bench/report.ts:L33-L38'+ - symbol: mean+ kind: function+ at: 'bench/report.ts:L40-L42'+ - symbol: ArmAgg+ kind: interface+ at: 'bench/report.ts:L44-L54'+ - symbol: aggregate+ kind: function+ at: 'bench/report.ts:L56-L68'+ - symbol: pctDelta+ kind: function+ at: 'bench/report.ts:L70-L74'+ - symbol: fmt+ kind: function+ at: 'bench/report.ts:L76-L78'+ - symbol: buildMarkdown+ kind: function+ at: 'bench/report.ts:L80-L125'+ - symbol: Args+ kind: interface+ at: 'bench/run.ts:L29-L35'+ - symbol: parseArgs+ kind: function+ at: 'bench/run.ts:L37-L52'+ - symbol: pool+ kind: function+ at: 'bench/run.ts:L55-L66'+ - symbol: worker+ kind: function+ at: 'bench/run.ts:L58-L63'+ - symbol: makeDocsWorkdir+ kind: function+ at: 'bench/run.ts:L69-L82'+ - symbol: main+ kind: function+ at: 'bench/run.ts:L84-L201'+ - symbol: makeStubClient+ kind: function+ at: 'bench/selfcheck.ts:L19-L48'+ - symbol: main+ kind: function+ at: 'bench/selfcheck.ts:L50-L114'+ - symbol: repoPath+ kind: function+ at: 'bench/tasks.ts:L26-L29'+ - symbol: Task+ kind: interface+ at: 'bench/tasks.ts:L31-L37'+ - symbol: Corpus+ kind: interface+ at: 'bench/tasks.ts:L39-L45'+---+<!-- context:generated:start -->+## Summary++This component orchestrates the benchmarking process for evaluating AI models, including agents and judges, through various tasks and configurations. It integrates multiple files to manage agent execution, correctness scoring, and result reporting, ensuring a comprehensive evaluation of model performance.++## Related++- produces [[benchmarking-results-reporting]] — It generates detailed reports summarizing the performance metrics of the evaluated models.+- depends on [[openrouter-integration]] — The benchmarking framework relies on the OpenRouter service for model interactions.+<!-- context:generated:end -->++## Notes++_Anything written below the generated block is preserved when the graph is regenerated._diff --git a/graft/benchmarking-results-reporting.md b/graft/benchmarking-results-reporting.mdnew file mode 100644index 00000000..901248ee--- /dev/null+++ b/graft/benchmarking-results-reporting.md@@ -0,0 +1,55 @@+---+name: Benchmarking Results Reporting+slug: benchmarking-results-reporting+type: system+sources:+ - path: bench/report.ts+ hash: 775be8c40a8e4172521bba8f6a1f026fa23c4d24b9b5225da3ed5b745077a5b0+sources_digest: f7b46f3036503f43413cb48d25fa6ce54585514fb19e9b4e923c0c5628ce8aed+links:+ - to: benchmarking-framework+ relation: part_of+ description: >-+ It is responsible for reporting the outcomes of the benchmarking+ framework's evaluations.+generator:+ version: 1+covers:+ - symbol: Row+ kind: interface+ at: 'bench/report.ts:L6-L26'+ - symbol: costOf+ kind: function+ at: 'bench/report.ts:L33-L38'+ - symbol: mean+ kind: function+ at: 'bench/report.ts:L40-L42'+ - symbol: ArmAgg+ kind: interface+ at: 'bench/report.ts:L44-L54'+ - symbol: aggregate+ kind: function+ at: 'bench/report.ts:L56-L68'+ - symbol: pctDelta+ kind: function+ at: 'bench/report.ts:L70-L74'+ - symbol: fmt+ kind: function+ at: 'bench/report.ts:L76-L78'+ - symbol: buildMarkdown+ kind: function+ at: 'bench/report.ts:L80-L125'+---+<!-- context:generated:start -->+## Summary++This component aggregates and formats the results of benchmarking trials, providing insights into model performance across different configurations. It emphasizes clarity in reporting and includes cost calculations for agent runs.++## Related++- part of [[benchmarking-framework]] — It is responsible for reporting the outcomes of the benchmarking framework's evaluations.+<!-- context:generated:end -->++## Notes++_Anything written below the generated block is preserved when the graph is regenerated._diff --git a/graft/caching-mechanism.md b/graft/caching-mechanism.mdnew file mode 100644index 00000000..929fd8ff--- /dev/null+++ b/graft/caching-mechanism.md@@ -0,0 +1,152 @@+---+name: Caching Mechanism+slug: caching-mechanism+type: concept+sources:+ - path: bench/agent.ts+ hash: e10d64f913c9517cef84cce58ea042d71bed3e94182c791245170eca54060e31+ - path: bench/report.ts+ hash: 775be8c40a8e4172521bba8f6a1f026fa23c4d24b9b5225da3ed5b745077a5b0+ - path: src/context/build.ts+ hash: 8c614e5dc6b1ef2d6949016ce7480099f95f021ea6b0882f2919397f97a68ce7+ - path: src/graph/enrich.ts+ hash: 7b8238702835246bfc446ae017157e627c7609fde83b090619de71d013edf8e6+sources_digest: bb866199bd2f821c5a9b3a9d3fbeff70c9b09d3f6f3b52200219b1a0b89e0fdd+links:+ - to: benchmarking-framework+ relation: validates+ description: It ensures that the benchmarking results are accurate and efficient.+generator:+ version: 1+covers:+ - symbol: AgentResult+ kind: interface+ at: 'bench/agent.ts:L19-L27'+ - symbol: RunAgentOptions+ kind: interface+ at: 'bench/agent.ts:L29-L37'+ - symbol: safePath+ kind: function+ at: 'bench/agent.ts:L46-L60'+ - symbol: listFiles+ kind: function+ at: 'bench/agent.ts:L62-L89'+ - symbol: walk+ kind: function+ at: 'bench/agent.ts:L64-L86'+ - symbol: globToRegExp+ kind: function+ at: 'bench/agent.ts:L92-L106'+ - symbol: runTool+ kind: function+ at: 'bench/agent.ts:L168-L228'+ - symbol: runAgent+ kind: function+ at: 'bench/agent.ts:L230-L322'+ - symbol: slideCacheBreakpoint+ kind: function+ at: 'bench/agent.ts:L254-L260'+ - symbol: Row+ kind: interface+ at: 'bench/report.ts:L6-L26'+ - symbol: costOf+ kind: function+ at: 'bench/report.ts:L33-L38'+ - symbol: mean+ kind: function+ at: 'bench/report.ts:L40-L42'+ - symbol: ArmAgg+ kind: interface+ at: 'bench/report.ts:L44-L54'+ - symbol: aggregate+ kind: function+ at: 'bench/report.ts:L56-L68'+ - symbol: pctDelta+ kind: function+ at: 'bench/report.ts:L70-L74'+ - symbol: fmt+ kind: function+ at: 'bench/report.ts:L76-L78'+ - symbol: buildMarkdown+ kind: function+ at: 'bench/report.ts:L80-L125'+ - symbol: BuildProgress+ kind: interface+ at: 'src/context/build.ts:L47-L52'+ - symbol: BuildOptions+ kind: interface+ at: 'src/context/build.ts:L54-L64'+ - symbol: BuildResult+ kind: interface+ at: 'src/context/build.ts:L66-L75'+ - symbol: BuildCache+ kind: interface+ at: 'src/context/build.ts:L78-L81'+ - symbol: FileWork+ kind: interface+ at: 'src/context/build.ts:L83-L87'+ - symbol: NodeDraft+ kind: interface+ at: 'src/context/build.ts:L90-L97'+ - symbol: buildContext+ kind: function+ at: 'src/context/build.ts:L99-L266'+ - symbol: batchBySize+ kind: function+ at: 'src/context/build.ts:L269-L285'+ - symbol: batchKey+ kind: function+ at: 'src/context/build.ts:L288-L295'+ - symbol: registerName+ kind: function+ at: 'src/context/build.ts:L297-L300'+ - symbol: resolveSlug+ kind: function+ at: 'src/context/build.ts:L302-L304'+ - symbol: errMsg+ kind: function+ at: 'src/context/build.ts:L306-L308'+ - symbol: cachePath+ kind: function+ at: 'src/context/build.ts:L310-L312'+ - symbol: loadCache+ kind: function+ at: 'src/context/build.ts:L314-L325'+ - symbol: saveCache+ kind: function+ at: 'src/context/build.ts:L327-L331'+ - symbol: mapWithConcurrency+ kind: function+ at: 'src/context/build.ts:L334-L349'+ - symbol: EnrichOptions+ kind: interface+ at: 'src/graph/enrich.ts:L28-L33'+ - symbol: EnrichStats+ kind: interface+ at: 'src/graph/enrich.ts:L35-L41'+ - symbol: enrichGraph+ kind: function+ at: 'src/graph/enrich.ts:L43-L128'+ - symbol: collectFileCrux+ kind: function+ at: 'src/graph/enrich.ts:L135-L155'+ - symbol: buildCrux+ kind: function+ at: 'src/graph/enrich.ts:L162-L177'+ - symbol: spanLines+ kind: function+ at: 'src/graph/enrich.ts:L180-L186'+---+<!-- context:generated:start -->+## Summary++This concept involves the use of caching to optimize performance and reduce costs associated with repeated prompts in the benchmarking process. It ensures that redundant processing is avoided and that results are efficiently managed.++## Related++- validates [[benchmarking-framework]] — It ensures that the benchmarking results are accurate and efficient.+<!-- context:generated:end -->++## Notes++_Anything written below the generated block is preserved when the graph is regenerated._diff --git a/graft/code-summarization-and-synthesis.md b/graft/code-summarization-and-synthesis.mdnew file mode 100644index 00000000..003eaaf5--- /dev/null+++ b/graft/code-summarization-and-synthesis.md@@ -0,0 +1,110 @@+---+name: Code Summarization and Synthesis+slug: code-summarization-and-synthesis+type: system+sources:+ - path: src/ai/crux.ts+ hash: e81750029e4c8641cdaf2b4894f595297839e07a73076e4cdac1522515f923a8+ - path: src/ai/summarize.ts+ hash: 6e67f3866c75d88a8b1d265e510578f3e3014d9cfd8b2469e6e4afbd67977f93+ - path: src/ai/synthesize.ts+ hash: 982ab91da10ae51fdba64466cbb614db14a51f2e100bb12a72178961d8dd97d7+sources_digest: 1916d34902c4bd664703e6c5da273beb26c2be5f55e971b3cc3f590f65cde3c7+links:+ - to: context-graph-management+ relation: produces+ description: >-+ It generates structured nodes that represent the architecture of the+ codebase.+generator:+ version: 1+covers:+ - symbol: NodeRef+ kind: interface+ at: 'src/ai/crux.ts:L21-L27'+ - symbol: FileCruxInput+ kind: interface+ at: 'src/ai/crux.ts:L29-L33'+ - symbol: NodeCrux+ kind: interface+ at: 'src/ai/crux.ts:L35-L40'+ - symbol: CruxSummarizer+ kind: interface+ at: 'src/ai/crux.ts:L42-L44'+ - symbol: numberLines+ kind: function+ at: 'src/ai/crux.ts:L63-L70'+ - symbol: userContent+ kind: function+ at: 'src/ai/crux.ts:L72-L81'+ - symbol: parseResults+ kind: function+ at: 'src/ai/crux.ts:L84-L98'+ - symbol: num+ kind: function+ at: 'src/ai/crux.ts:L88-L88'+ - symbol: OpenRouterCruxSummarizer+ kind: class+ at: 'src/ai/crux.ts:L101-L127'+ - symbol: constructor+ kind: method+ at: 'src/ai/crux.ts:L105-L112'+ - symbol: describeFile+ kind: method+ at: 'src/ai/crux.ts:L114-L126'+ - symbol: Summarizer+ kind: interface+ at: 'src/ai/summarize.ts:L13-L15'+ - symbol: userContent+ kind: function+ at: 'src/ai/summarize.ts:L28-L34'+ - symbol: OpenRouterSummarizer+ kind: class+ at: 'src/ai/summarize.ts:L37-L61'+ - symbol: constructor+ kind: method+ at: 'src/ai/summarize.ts:L41-L48'+ - symbol: summarize+ kind: method+ at: 'src/ai/summarize.ts:L50-L60'+ - symbol: SynthLink+ kind: interface+ at: 'src/ai/synthesize.ts:L12-L16'+ - symbol: SynthNode+ kind: interface+ at: 'src/ai/synthesize.ts:L19-L27'+ - symbol: FileSummary+ kind: interface+ at: 'src/ai/synthesize.ts:L30-L33'+ - symbol: Synthesizer+ kind: interface+ at: 'src/ai/synthesize.ts:L35-L37'+ - symbol: userContent+ kind: function+ at: 'src/ai/synthesize.ts:L92-L97'+ - symbol: clean+ kind: function+ at: 'src/ai/synthesize.ts:L100-L122'+ - symbol: OpenRouterSynthesizer+ kind: class+ at: 'src/ai/synthesize.ts:L134-L163'+ - symbol: constructor+ kind: method+ at: 'src/ai/synthesize.ts:L138-L141'+ - symbol: synthesize+ kind: method+ at: 'src/ai/synthesize.ts:L143-L162'+---+<!-- context:generated:start -->+## Summary++This component focuses on summarizing code definitions and synthesizing a structured representation of the codebase architecture. It utilizes AI models to generate concise summaries and structured nodes for the context graph.++## Related++- produces [[context-graph-management]] — It generates structured nodes that represent the architecture of the codebase.+<!-- context:generated:end -->++## Notes++_Anything written below the generated block is preserved when the graph is regenerated._diff --git a/graft/configuration-management.md b/graft/configuration-management.mdnew file mode 100644index 00000000..857fd0a6--- /dev/null+++ b/graft/configuration-management.md@@ -0,0 +1,38 @@+---+name: Configuration Management+slug: configuration-management+type: concept+sources:+ - path: src/ai/providers.ts+ hash: c0d1294d6fa49f6d06ff9bb137b34ea897f94a67810a839cd5705a1fa5995483+sources_digest: a131fc0c197424e0b9a6a1da0c7e97f8aaa37eb06f6720480e7959923c918071+links:+ - to: ai-model-evaluation+ relation: configures+ description: It configures the settings for the AI evaluation process.+generator:+ version: 1+covers:+ - symbol: EngineConfig+ kind: interface+ at: 'src/ai/providers.ts:L9-L25'+ - symbol: ResolvedConfig+ kind: interface+ at: 'src/ai/providers.ts:L28-L35'+ - symbol: resolveConfig+ kind: function+ at: 'src/ai/providers.ts:L43-L55'+---+<!-- context:generated:start -->+## Summary++This concept encompasses the management of user-facing configurations for the AI engine, allowing customization of settings such as context directories and API credentials. It ensures that all necessary parameters are set for the engine to function correctly.++## Related++- configures [[ai-model-evaluation]] — It configures the settings for the AI evaluation process.+<!-- context:generated:end -->++## Notes++_Anything written below the generated block is preserved when the graph is regenerated._diff --git a/graft/context-graph-management.md b/graft/context-graph-management.mdnew file mode 100644index 00000000..9c0e98d1--- /dev/null+++ b/graft/context-graph-management.md@@ -0,0 +1,308 @@+---+name: Context Graph Management+slug: context-graph-management+type: system+sources:+ - path: src/context/build.ts+ hash: 8c614e5dc6b1ef2d6949016ce7480099f95f021ea6b0882f2919397f97a68ce7+ - path: src/context/check.ts+ hash: 2444e1f4dfd78208a9b54942364ee1811d064459857c6d6cee178426e278d481+ - path: src/context/node-file.ts+ hash: 9e958d74597b4d6d31fa5391882ddab8faab4076d7d33f93de861ab6c2e0b93a+ - path: src/graph/build.ts+ hash: 8b05c94896ca63d9c66bf5b3340db53cb8600d536a36880a3012599edf1b3a44+ - path: src/graph/check.ts+ hash: f0b73053e31d03ec1280d465d614c97044541691675f2b3d09e10bcab5078b58+ - path: src/graph/enrich.ts+ hash: 7b8238702835246bfc446ae017157e627c7609fde83b090619de71d013edf8e6+ - path: src/graph/extract.ts+ hash: 58cd002d5ee7dfb750cb85293a795148ffbec31e68e2a9b693e0794543a7f727+ - path: src/graph/resolve.ts+ hash: dad41f73d773c45f5237b85e10a36ae45331cd5959df578816ee8ab47622cffe+ - path: src/graph/types.ts+ hash: 757b84c059d13cda49e0f29518b31a5473f0d6e243b2ab1f374a7f7ff02492e4+ - path: src/graph/write.ts+ hash: 55dd6ea840135ade4db7f49042234bee0db07a9c8c959ab57767deb8bebc6345+sources_digest: 55e6a39238b64c950511c3f7ca87ed1629d82b42231ba60ef5e8e90098ec441c+links:+ - to: code-summarization-and-synthesis+ relation: depends_on+ description: >-+ It relies on the summarization and synthesis components to generate+ structured nodes.+ - to: graph-visualization+ relation: produces+ description: It outputs a structured graph representation for visualization.+generator:+ version: 1+covers:+ - symbol: BuildProgress+ kind: interface+ at: 'src/context/build.ts:L47-L52'+ - symbol: BuildOptions+ kind: interface+ at: 'src/context/build.ts:L54-L64'+ - symbol: BuildResult+ kind: interface+ at: 'src/context/build.ts:L66-L75'+ - symbol: BuildCache+ kind: interface+ at: 'src/context/build.ts:L78-L81'+ - symbol: FileWork+ kind: interface+ at: 'src/context/build.ts:L83-L87'+ - symbol: NodeDraft+ kind: interface+ at: 'src/context/build.ts:L90-L97'+ - symbol: buildContext+ kind: function+ at: 'src/context/build.ts:L99-L266'+ - symbol: batchBySize+ kind: function+ at: 'src/context/build.ts:L269-L285'+ - symbol: batchKey+ kind: function+ at: 'src/context/build.ts:L288-L295'+ - symbol: registerName+ kind: function+ at: 'src/context/build.ts:L297-L300'+ - symbol: resolveSlug+ kind: function+ at: 'src/context/build.ts:L302-L304'+ - symbol: errMsg+ kind: function+ at: 'src/context/build.ts:L306-L308'+ - symbol: cachePath+ kind: function+ at: 'src/context/build.ts:L310-L312'+ - symbol: loadCache+ kind: function+ at: 'src/context/build.ts:L314-L325'+ - symbol: saveCache+ kind: function+ at: 'src/context/build.ts:L327-L331'+ - symbol: mapWithConcurrency+ kind: function+ at: 'src/context/build.ts:L334-L349'+ - symbol: CheckResult+ kind: interface+ at: 'src/context/check.ts:L22-L30'+ - symbol: CheckOptions+ kind: interface+ at: 'src/context/check.ts:L32-L35'+ - symbol: checkContext+ kind: function+ at: 'src/context/check.ts:L37-L107'+ - symbol: formatCheckReport+ kind: function+ at: 'src/context/check.ts:L110-L135'+ - symbol: short+ kind: function+ at: 'src/context/check.ts:L137-L139'+ - symbol: SourceRef+ kind: interface+ at: 'src/context/node-file.ts:L30-L33'+ - symbol: NodeLink+ kind: interface+ at: 'src/context/node-file.ts:L36-L40'+ - symbol: ContextNode+ kind: interface+ at: 'src/context/node-file.ts:L43-L58'+ - symbol: Manifest+ kind: interface+ at: 'src/context/node-file.ts:L61-L71'+ - symbol: slugify+ kind: function+ at: 'src/context/node-file.ts:L81-L86'+ - symbol: digestSources+ kind: function+ at: 'src/context/node-file.ts:L89-L95'+ - symbol: contextDirFor+ kind: function+ at: 'src/context/node-file.ts:L100-L103'+ - symbol: renderGenerated+ kind: function+ at: 'src/context/node-file.ts:L106-L118'+ - symbol: defaultHuman+ kind: function+ at: 'src/context/node-file.ts:L121-L123'+ - symbol: renderNodeFile+ kind: function+ at: 'src/context/node-file.ts:L126-L141'+ - symbol: preserveHuman+ kind: function+ at: 'src/context/node-file.ts:L148-L152'+ - symbol: writeNode+ kind: function+ at: 'src/context/node-file.ts:L158-L169'+ - symbol: ParsedNode+ kind: interface+ at: 'src/context/node-file.ts:L172-L179'+ - symbol: readNodes+ kind: function+ at: 'src/context/node-file.ts:L182-L198'+ - symbol: existingNodeSlugs+ kind: function+ at: 'src/context/node-file.ts:L201-L208'+ - symbol: deleteNode+ kind: function+ at: 'src/context/node-file.ts:L211-L214'+ - symbol: writeManifest+ kind: function+ at: 'src/context/node-file.ts:L216-L219'+ - symbol: readManifest+ kind: function+ at: 'src/context/node-file.ts:L221-L229'+ - symbol: GraphBuildOptions+ kind: interface+ at: 'src/graph/build.ts:L22-L33'+ - symbol: GraphBuildResult+ kind: interface+ at: 'src/graph/build.ts:L35-L48'+ - symbol: listSourceFiles+ kind: function+ at: 'src/graph/build.ts:L51-L53'+ - symbol: buildGraph+ kind: function+ at: 'src/graph/build.ts:L55-L143'+ - symbol: GraphCheckResult+ kind: interface+ at: 'src/graph/check.ts:L27-L37'+ - symbol: GraphCheckOptions+ kind: interface+ at: 'src/graph/check.ts:L39-L41'+ - symbol: checkGraph+ kind: function+ at: 'src/graph/check.ts:L43-L101'+ - symbol: formatGraphCheckReport+ kind: function+ at: 'src/graph/check.ts:L104-L135'+ - symbol: EnrichOptions+ kind: interface+ at: 'src/graph/enrich.ts:L28-L33'+ - symbol: EnrichStats+ kind: interface+ at: 'src/graph/enrich.ts:L35-L41'+ - symbol: enrichGraph+ kind: function+ at: 'src/graph/enrich.ts:L43-L128'+ - symbol: collectFileCrux+ kind: function+ at: 'src/graph/enrich.ts:L135-L155'+ - symbol: buildCrux+ kind: function+ at: 'src/graph/enrich.ts:L162-L177'+ - symbol: spanLines+ kind: function+ at: 'src/graph/enrich.ts:L180-L186'+ - symbol: Language+ kind: type+ at: 'src/graph/extract.ts:L16-L16'+ - symbol: languageOf+ kind: function+ at: 'src/graph/extract.ts:L19-L25'+ - symbol: RawEdge+ kind: interface+ at: 'src/graph/extract.ts:L31-L39'+ - symbol: ExtractResult+ kind: interface+ at: 'src/graph/extract.ts:L41-L44'+ - symbol: WalkCtx+ kind: interface+ at: 'src/graph/extract.ts:L76-L84'+ - symbol: DefDescriptor+ kind: interface+ at: 'src/graph/extract.ts:L87-L92'+ - symbol: extractFile+ kind: function+ at: 'src/graph/extract.ts:L94-L127'+ - symbol: walk+ kind: function+ at: 'src/graph/extract.ts:L129-L181'+ - symbol: describe+ kind: function+ at: 'src/graph/extract.ts:L184-L213'+ - symbol: heritageEdges+ kind: function+ at: 'src/graph/extract.ts:L215-L242'+ - symbol: calleeName+ kind: function+ at: 'src/graph/extract.ts:L244-L260'+ - symbol: isImport+ kind: function+ at: 'src/graph/extract.ts:L262-L264'+ - symbol: importSpecifier+ kind: function+ at: 'src/graph/extract.ts:L266-L277'+ - symbol: clean+ kind: function+ at: 'src/graph/extract.ts:L280-L287'+ - symbol: tsExported+ kind: function+ at: 'src/graph/extract.ts:L290-L297'+ - symbol: resolveEdges+ kind: function+ at: 'src/graph/resolve.ts:L20-L58'+ - symbol: add+ kind: function+ at: 'src/graph/resolve.ts:L34-L39'+ - symbol: push+ kind: function+ at: 'src/graph/resolve.ts:L60-L64'+ - symbol: resolveName+ kind: function+ at: 'src/graph/resolve.ts:L70-L82'+ - symbol: resolveImport+ kind: function+ at: 'src/graph/resolve.ts:L88-L100'+ - symbol: Kind+ kind: type+ at: 'src/graph/types.ts:L15-L22'+ - symbol: Confidence+ kind: type+ at: 'src/graph/types.ts:L25-L25'+ - symbol: SummaryState+ kind: type+ at: 'src/graph/types.ts:L28-L28'+ - symbol: Crux+ kind: interface+ at: 'src/graph/types.ts:L32-L35'+ - symbol: NodeV1+ kind: interface+ at: 'src/graph/types.ts:L37-L55'+ - symbol: Relation+ kind: type+ at: 'src/graph/types.ts:L57-L63'+ - symbol: EdgeV1+ kind: interface+ at: 'src/graph/types.ts:L65-L70'+ - symbol: GraphV1+ kind: interface+ at: 'src/graph/types.ts:L72-L81'+ - symbol: wiringPath+ kind: function+ at: 'src/graph/write.ts:L20-L22'+ - symbol: readGraph+ kind: function+ at: 'src/graph/write.ts:L28-L34'+ - symbol: writeGraph+ kind: function+ at: 'src/graph/write.ts:L36-L46'+ - symbol: edgeOrder+ kind: function+ at: 'src/graph/write.ts:L48-L54'+---+<!-- context:generated:start -->+## Summary++This component manages the construction and verification of a context graph from the code repository, ensuring synchronization with the source code. It includes functionalities for building, checking, and writing the graph data.++## Related++- depends on [[code-summarization-and-synthesis]] — It relies on the summarization and synthesis components to generate structured nodes.+- produces [[graph-visualization]] — It outputs a structured graph representation for visualization.+<!-- context:generated:end -->++## Notes++_Anything written below the generated block is preserved when the graph is regenerated._diff --git a/graft/error-handling-and-robustness.md b/graft/error-handling-and-robustness.mdnew file mode 100644index 00000000..9dbfa6d1--- /dev/null+++ b/graft/error-handling-and-robustness.md@@ -0,0 +1,102 @@+---+name: Error Handling and Robustness+slug: error-handling-and-robustness+type: concept+sources:+ - path: bench/run.ts+ hash: a0d2859628588f45ae31862f5f801d6219802449c23bbbdba9aa51b7b9febf47+ - path: bench/selfcheck.ts+ hash: 0eaf577938e20fa27d9cd0157bc8843fdc37165d85696789334b8605138f4bb4+ - path: src/engine.ts+ hash: 26307935c472954b6511e7352cf6c0f11ce53dd151ac2407e5fcadc0b9b7c01b+sources_digest: f316b70320a3b6166ab65b4721c724c3b21b9e78cb80e77e2e94c67e3355f8aa+links:+ - to: benchmarking-framework+ relation: validates+ description: It ensures that the benchmarking framework can handle errors gracefully.+generator:+ version: 1+covers:+ - symbol: Args+ kind: interface+ at: 'bench/run.ts:L29-L35'+ - symbol: parseArgs+ kind: function+ at: 'bench/run.ts:L37-L52'+ - symbol: pool+ kind: function+ at: 'bench/run.ts:L55-L66'+ - symbol: worker+ kind: function+ at: 'bench/run.ts:L58-L63'+ - symbol: makeDocsWorkdir+ kind: function+ at: 'bench/run.ts:L69-L82'+ - symbol: main+ kind: function+ at: 'bench/run.ts:L84-L201'+ - symbol: makeStubClient+ kind: function+ at: 'bench/selfcheck.ts:L19-L48'+ - symbol: main+ kind: function+ at: 'bench/selfcheck.ts:L50-L114'+ - symbol: InitOptions+ kind: interface+ at: 'src/engine.ts:L26-L31'+ - symbol: CheckRunOptions+ kind: interface+ at: 'src/engine.ts:L33-L35'+ - symbol: GraphRunOptions+ kind: interface+ at: 'src/engine.ts:L37-L41'+ - symbol: Graft+ kind: class+ at: 'src/engine.ts:L43-L125'+ - symbol: constructor+ kind: method+ at: 'src/engine.ts:L46-L48'+ - symbol: init+ kind: method+ at: 'src/engine.ts:L51-L60'+ - symbol: check+ kind: method+ at: 'src/engine.ts:L63-L65'+ - symbol: checkGraph+ kind: method+ at: 'src/engine.ts:L68-L70'+ - symbol: graph+ kind: method+ at: 'src/engine.ts:L77-L83'+ - symbol: ask+ kind: method+ at: 'src/engine.ts:L90-L92'+ - symbol: requireKey+ kind: method+ at: 'src/engine.ts:L95-L103'+ - symbol: synthesizer+ kind: method+ at: 'src/engine.ts:L105-L108'+ - symbol: cruxSummarizer+ kind: method+ at: 'src/engine.ts:L111-L113'+ - symbol: summarizer+ kind: method+ at: 'src/engine.ts:L115-L118'+ - symbol: modelLabel+ kind: method+ at: 'src/engine.ts:L121-L124'+---+<!-- context:generated:start -->+## Summary++This concept emphasizes the importance of error handling and robustness in the benchmarking framework, ensuring that failures in one part do not halt the entire process and that comprehensive testing is possible without external dependencies.++## Related++- validates [[benchmarking-framework]] — It ensures that the benchmarking framework can handle errors gracefully.+<!-- context:generated:end -->++## Notes++_Anything written below the generated block is preserved when the graph is regenerated._diff --git a/graft/graph-visualization.md b/graft/graph-visualization.mdnew file mode 100644index 00000000..84bd9a6e--- /dev/null+++ b/graft/graph-visualization.md@@ -0,0 +1,213 @@+---+name: Graph Visualization+slug: graph-visualization+type: system+sources:+ - path: viewer/data.ts+ hash: e9c5c89ad933e06004cbeddc1b1d7b60a6057726a463c66f9673ba20a3c61afd+ - path: viewer/detail.ts+ hash: fe8df7c5561f2a8588cf4e1ecb367d19cb6b480fe4855f05e4f96137d8078884+ - path: viewer/graph.ts+ hash: 192a59b16da8327457de6723893fd9207dd9570a35cd664f96534a7b85e73e01+ - path: viewer/main.ts+ hash: ab45ce4dfe66aafbe779b71d49d6370b3fe64482307b994e857ce34d3f317325+ - path: viewer/tree.ts+ hash: d66e0157f4c2a1525c16505306eb3aabce82565c3d0e56199ea5b7a860290b01+sources_digest: fd0623540e7f7eed9942e3db2bc219f9a08b3814ac219dfb2b9a74f8c1aea966+links:+ - to: context-graph-management+ relation: depends_on+ description: >-+ It relies on the context graph management component to provide the+ necessary data for visualization.+generator:+ version: 1+covers:+ - symbol: VizNode+ kind: interface+ at: 'viewer/data.ts:L6-L12'+ - symbol: VizEdge+ kind: interface+ at: 'viewer/data.ts:L14-L20'+ - symbol: VizGraph+ kind: interface+ at: 'viewer/data.ts:L22-L26'+ - symbol: Family+ kind: type+ at: 'viewer/data.ts:L29-L29'+ - symbol: famOf+ kind: function+ at: 'viewer/data.ts:L39-L41'+ - symbol: chipKey+ kind: function+ at: 'viewer/data.ts:L47-L51'+ - symbol: colorToken+ kind: function+ at: 'viewer/data.ts:L72-L75'+ - symbol: cvar+ kind: function+ at: 'viewer/data.ts:L77-L79'+ - symbol: loadContextGraph+ kind: function+ at: 'viewer/data.ts:L81-L84'+ - symbol: CodeGraphV1+ kind: interface+ at: 'viewer/data.ts:L86-L93'+ - symbol: loadCodeGraph+ kind: function+ at: 'viewer/data.ts:L96-L113'+ - symbol: onServerChange+ kind: function+ at: 'viewer/data.ts:L116-L121'+ - symbol: esc+ kind: function+ at: 'viewer/detail.ts:L8-L10'+ - symbol: renderDetail+ kind: function+ at: 'viewer/detail.ts:L12-L58'+ - symbol: name+ kind: function+ at: 'viewer/detail.ts:L29-L29'+ - symbol: linkList+ kind: function+ at: 'viewer/detail.ts:L40-L50'+ - symbol: SimNode+ kind: interface+ at: 'viewer/graph.ts:L22-L30'+ - symbol: SimEdge+ kind: interface+ at: 'viewer/graph.ts:L32-L38'+ - symbol: el+ kind: function+ at: 'viewer/graph.ts:L42-L46'+ - symbol: GraphView+ kind: class+ at: 'viewer/graph.ts:L48-L334'+ - symbol: constructor+ kind: method+ at: 'viewer/graph.ts:L65-L69'+ - symbol: buildChrome+ kind: method+ at: 'viewer/graph.ts:L71-L78'+ - symbol: ensureMarkers+ kind: method+ at: 'viewer/graph.ts:L80-L91'+ - symbol: setData+ kind: method+ at: 'viewer/graph.ts:L94-L136'+ - symbol: buildElements+ kind: method+ at: 'viewer/graph.ts:L138-L164'+ - symbol: tick+ kind: method+ at: 'viewer/graph.ts:L166-L182'+ - symbol: restyle+ kind: method+ at: 'viewer/graph.ts:L185-L243'+ - symbol: nodeShown+ kind: function+ at: 'viewer/graph.ts:L195-L195'+ - symbol: select+ kind: method+ at: 'viewer/graph.ts:L245-L249'+ - symbol: focus+ kind: method+ at: 'viewer/graph.ts:L252-L261'+ - symbol: firstMatch+ kind: method+ at: 'viewer/graph.ts:L263-L266'+ - symbol: applyView+ kind: method+ at: 'viewer/graph.ts:L268-L270'+ - symbol: zoomBy+ kind: method+ at: 'viewer/graph.ts:L272-L279'+ - symbol: resetView+ kind: method+ at: 'viewer/graph.ts:L281-L284'+ - symbol: reheat+ kind: method+ at: 'viewer/graph.ts:L286-L288'+ - symbol: bindDrag+ kind: method+ at: 'viewer/graph.ts:L290-L309'+ - symbol: move+ kind: function+ at: 'viewer/graph.ts:L294-L299'+ - symbol: up+ kind: function+ at: 'viewer/graph.ts:L300-L305'+ - symbol: bindPanZoom+ kind: method+ at: 'viewer/graph.ts:L311-L333'+ - symbol: Tab+ kind: type+ at: 'viewer/main.ts:L10-L10'+ - symbol: $+ kind: function+ at: 'viewer/main.ts:L12-L12'+ - symbol: activeGraph+ kind: function+ at: 'viewer/main.ts:L23-L25'+ - symbol: graphTab+ kind: function+ at: 'viewer/main.ts:L27-L29'+ - symbol: renderChips+ kind: function+ at: 'viewer/main.ts:L32-L60'+ - symbol: rank+ kind: function+ at: 'viewer/main.ts:L43-L43'+ - symbol: glyphFor+ kind: function+ at: 'viewer/main.ts:L62-L71'+ - symbol: renderLegend+ kind: function+ at: 'viewer/main.ts:L74-L94'+ - symbol: updateShownCount+ kind: function+ at: 'viewer/main.ts:L96-L101'+ - symbol: updateCounts+ kind: function+ at: 'viewer/main.ts:L103-L112'+ - symbol: showDetail+ kind: function+ at: 'viewer/main.ts:L115-L124'+ - symbol: setTab+ kind: function+ at: 'viewer/main.ts:L129-L167'+ - symbol: showEmpty+ kind: function+ at: 'viewer/main.ts:L169-L173'+ - symbol: loadAll+ kind: function+ at: 'viewer/main.ts:L216-L223'+ - symbol: esc+ kind: function+ at: 'viewer/tree.ts:L7-L9'+ - symbol: renderOutline+ kind: function+ at: 'viewer/tree.ts:L11-L66'+ - symbol: kids+ kind: function+ at: 'viewer/tree.ts:L18-L22'+ - symbol: countDesc+ kind: function+ at: 'viewer/tree.ts:L23-L26'+ - symbol: row+ kind: function+ at: 'viewer/tree.ts:L29-L42'+---+<!-- context:generated:start -->+## Summary++This component provides the visualization layer for the context graph, rendering nodes and edges in an interactive format. It includes functionalities for user interaction and dynamic updates based on graph data.++## Related++- depends on [[context-graph-management]] — It relies on the context graph management component to provide the necessary data for visualization.+<!-- context:generated:end -->++## Notes++_Anything written below the generated block is preserved when the graph is regenerated._diff --git a/graft/manifest.json b/graft/manifest.jsonnew file mode 100644index 00000000..840a009a--- /dev/null+++ b/graft/manifest.json@@ -0,0 +1,320 @@+{+ "version": 1,+ "model": "openrouter:openai/gpt-4o-mini",+ "repoDigest": "3b2a2ca79a7b49123c81fa6f4dc1bf949e12042e28aa491bca058d8ca300b913",+ "files": [+ {+ "path": "bench/agent.ts",+ "hash": "e10d64f913c9517cef84cce58ea042d71bed3e94182c791245170eca54060e31"+ },+ {+ "path": "bench/judge.ts",+ "hash": "94c222341b066e4f3134b3d9d3f30f31b9ffe7b92967086b07c58f297d349936"+ },+ {+ "path": "bench/llm.ts",+ "hash": "6c0d2a02ac6aa86de94f779355020700a4d9016e2f4b431bf75560e1d3c51229"+ },+ {+ "path": "bench/report.ts",+ "hash": "775be8c40a8e4172521bba8f6a1f026fa23c4d24b9b5225da3ed5b745077a5b0"+ },+ {+ "path": "bench/run.ts",+ "hash": "a0d2859628588f45ae31862f5f801d6219802449c23bbbdba9aa51b7b9febf47"+ },+ {+ "path": "bench/selfcheck.ts",+ "hash": "0eaf577938e20fa27d9cd0157bc8843fdc37165d85696789334b8605138f4bb4"+ },+ {+ "path": "bench/tasks.ts",+ "hash": "d21168797f40d193a914aca0c438409d29d300441bc0a6a518c93869240b3b69"+ },+ {+ "path": "install.sh",+ "hash": "e320ae0015d2d1fa093b919c95a1c233ccb355888f3c8cadd2b6ef0d97559467"+ },+ {+ "path": "scripts/build-viewer.mjs",+ "hash": "fb4ba16d7815dbdbaf2fd818362f914671903132be5573fbdd9a7734549b833d"+ },+ {+ "path": "src/ai/crux.ts",+ "hash": "e81750029e4c8641cdaf2b4894f595297839e07a73076e4cdac1522515f923a8"+ },+ {+ "path": "src/ai/providers.ts",+ "hash": "c0d1294d6fa49f6d06ff9bb137b34ea897f94a67810a839cd5705a1fa5995483"+ },+ {+ "path": "src/ai/summarize.ts",+ "hash": "6e67f3866c75d88a8b1d265e510578f3e3014d9cfd8b2469e6e4afbd67977f93"+ },+ {+ "path": "src/ai/synthesize.ts",+ "hash": "982ab91da10ae51fdba64466cbb614db14a51f2e100bb12a72178961d8dd97d7"+ },+ {+ "path": "src/ask/ask.ts",+ "hash": "62415cb36e835e8a5e9329a770489a726028284b8f40497beba6a721ecf05e21"+ },+ {+ "path": "src/cli.ts",+ "hash": "294b01aae943b958a291aa17387fe05439ca3b5ffe1a4ed97a4a2c378dcd7947"+ },+ {+ "path": "src/context/build.ts",+ "hash": "8c614e5dc6b1ef2d6949016ce7480099f95f021ea6b0882f2919397f97a68ce7"+ },+ {+ "path": "src/context/check.ts",+ "hash": "2444e1f4dfd78208a9b54942364ee1811d064459857c6d6cee178426e278d481"+ },+ {+ "path": "src/context/node-file.ts",+ "hash": "9e958d74597b4d6d31fa5391882ddab8faab4076d7d33f93de861ab6c2e0b93a"+ },+ {+ "path": "src/engine.ts",+ "hash": "26307935c472954b6511e7352cf6c0f11ce53dd151ac2407e5fcadc0b9b7c01b"+ },+ {+ "path": "src/graph/build.ts",+ "hash": "8b05c94896ca63d9c66bf5b3340db53cb8600d536a36880a3012599edf1b3a44"+ },+ {+ "path": "src/graph/cards.ts",+ "hash": "aef80e6f26a00e406385cd1faeb03d3b4e35a3cc7f1e0c50f7d94ad8a380f913"+ },+ {+ "path": "src/graph/check.ts",+ "hash": "f0b73053e31d03ec1280d465d614c97044541691675f2b3d09e10bcab5078b58"+ },+ {+ "path": "src/graph/enrich.ts",+ "hash": "7b8238702835246bfc446ae017157e627c7609fde83b090619de71d013edf8e6"+ },+ {+ "path": "src/graph/extract.ts",+ "hash": "58cd002d5ee7dfb750cb85293a795148ffbec31e68e2a9b693e0794543a7f727"+ },+ {+ "path": "src/graph/resolve.ts",+ "hash": "dad41f73d773c45f5237b85e10a36ae45331cd5959df578816ee8ab47622cffe"+ },+ {+ "path": "src/graph/types.ts",+ "hash": "757b84c059d13cda49e0f29518b31a5473f0d6e243b2ab1f374a7f7ff02492e4"+ },+ {+ "path": "src/graph/write.ts",+ "hash": "55dd6ea840135ade4db7f49042234bee0db07a9c8c959ab57767deb8bebc6345"+ },+ {+ "path": "src/index.ts",+ "hash": "e56e74612514fd45665b27e3c47b4a685b503a533b38e1674d256344511107fc"+ },+ {+ "path": "src/ingest/fs.ts",+ "hash": "a8339532da34b44d35eb9ad16e7106adb1262d73d9895b1bd94574337fb2019f"+ },+ {+ "path": "src/util/id.ts",+ "hash": "5fabc8ddcc3abc907ce69f04ad2ebe51933262cf44aa2dfd40589f71f1926e8a"+ },+ {+ "path": "src/viz/assemble.ts",+ "hash": "58ad5caed087bd7b929f5b625501a607e79e0476f998636bec241e0296706ece"+ },+ {+ "path": "src/viz/serve.ts",+ "hash": "14283762f454c01fc95cfbe9c2b41ef063fc17c4c3e5d120b5dc7f66f541fc1c"+ },+ {+ "path": "test/context.test.ts",+ "hash": "7c1242872b127117c7cc50404895d7ffcf286a51b611cd23c4ffabd5db8d43f3"+ },+ {+ "path": "test/covers.test.ts",+ "hash": "f5a75f405be1a01ad43fc806588858df3a8988fee62ad4ec024440d3f5e0fc0c"+ },+ {+ "path": "test/helpers.ts",+ "hash": "e45af1d38d7c6d4abc804fc74e9ae4c3373cf78769c17b16b185c3ee0e2c3228"+ },+ {+ "path": "test/viz-assemble.test.ts",+ "hash": "89a2a9f11f459a8110f9d89b2de780dfd164504f3b4c7dc61953a6c83c5911cb"+ },+ {+ "path": "test/viz-serve.test.ts",+ "hash": "d22168054844e83bc5257271c4cc80a6e3eb1315e600c03b48fe6b54afd5c243"+ },+ {+ "path": "viewer/data.ts",+ "hash": "e9c5c89ad933e06004cbeddc1b1d7b60a6057726a463c66f9673ba20a3c61afd"+ },+ {+ "path": "viewer/detail.ts",+ "hash": "fe8df7c5561f2a8588cf4e1ecb367d19cb6b480fe4855f05e4f96137d8078884"+ },+ {+ "path": "viewer/graph.ts",+ "hash": "192a59b16da8327457de6723893fd9207dd9570a35cd664f96534a7b85e73e01"+ },+ {+ "path": "viewer/main.ts",+ "hash": "ab45ce4dfe66aafbe779b71d49d6370b3fe64482307b994e857ce34d3f317325"+ },+ {+ "path": "viewer/tree.ts",+ "hash": "d66e0157f4c2a1525c16505306eb3aabce82565c3d0e56199ea5b7a860290b01"+ }+ ],+ "nodes": [+ {+ "slug": "ai-model-evaluation",+ "name": "AI Model Evaluation",+ "type": "system",+ "sources": [+ "bench/judge.ts"+ ],+ "sourcesDigest": "bfba2049dadf6f189e964206041bfbb54d9515eabe1bf3cc28ea06450fa65de7"+ },+ {+ "slug": "benchmarking-framework",+ "name": "Benchmarking Framework",+ "type": "system",+ "sources": [+ "bench/agent.ts",+ "bench/judge.ts",+ "bench/report.ts",+ "bench/run.ts",+ "bench/selfcheck.ts",+ "bench/tasks.ts"+ ],+ "sourcesDigest": "cc0c5db726f28fff7640e4c1d4705d7cd4eb54660db1b399622bd8f580ffe58d"+ },+ {+ "slug": "benchmarking-results-reporting",+ "name": "Benchmarking Results Reporting",+ "type": "system",+ "sources": [+ "bench/report.ts"+ ],+ "sourcesDigest": "f7b46f3036503f43413cb48d25fa6ce54585514fb19e9b4e923c0c5628ce8aed"+ },+ {+ "slug": "caching-mechanism",+ "name": "Caching Mechanism",+ "type": "concept",+ "sources": [+ "bench/agent.ts",+ "bench/report.ts",+ "src/context/build.ts",+ "src/graph/enrich.ts"+ ],+ "sourcesDigest": "bb866199bd2f821c5a9b3a9d3fbeff70c9b09d3f6f3b52200219b1a0b89e0fdd"+ },+ {+ "slug": "code-summarization-and-synthesis",+ "name": "Code Summarization and Synthesis",+ "type": "system",+ "sources": [+ "src/ai/crux.ts",+ "src/ai/summarize.ts",+ "src/ai/synthesize.ts"+ ],+ "sourcesDigest": "1916d34902c4bd664703e6c5da273beb26c2be5f55e971b3cc3f590f65cde3c7"+ },+ {+ "slug": "configuration-management",+ "name": "Configuration Management",+ "type": "concept",+ "sources": [+ "src/ai/providers.ts"+ ],+ "sourcesDigest": "a131fc0c197424e0b9a6a1da0c7e97f8aaa37eb06f6720480e7959923c918071"+ },+ {+ "slug": "context-graph-management",+ "name": "Context Graph Management",+ "type": "system",+ "sources": [+ "src/context/build.ts",+ "src/context/check.ts",+ "src/context/node-file.ts",+ "src/graph/build.ts",+ "src/graph/check.ts",+ "src/graph/enrich.ts",+ "src/graph/extract.ts",+ "src/graph/resolve.ts",+ "src/graph/types.ts",+ "src/graph/write.ts"+ ],+ "sourcesDigest": "55e6a39238b64c950511c3f7ca87ed1629d82b42231ba60ef5e8e90098ec441c"+ },+ {+ "slug": "error-handling-and-robustness",+ "name": "Error Handling and Robustness",+ "type": "concept",+ "sources": [+ "bench/run.ts",+ "bench/selfcheck.ts",+ "src/engine.ts"+ ],+ "sourcesDigest": "f316b70320a3b6166ab65b4721c724c3b21b9e78cb80e77e2e94c67e3355f8aa"+ },+ {+ "slug": "graph-visualization",+ "name": "Graph Visualization",+ "type": "system",+ "sources": [+ "viewer/data.ts",+ "viewer/detail.ts",+ "viewer/graph.ts",+ "viewer/main.ts",+ "viewer/tree.ts"+ ],+ "sourcesDigest": "fd0623540e7f7eed9942e3db2bc219f9a08b3814ac219dfb2b9a74f8c1aea966"+ },+ {+ "slug": "markdown-context-graph",+ "name": "Markdown Context Graph",+ "type": "concept",+ "sources": [+ "src/graph/write.ts",+ "src/index.ts"+ ],+ "sourcesDigest": "7883f522ca32a5ffcf1b690631a79925bbb7af24c682d2b389611674a5720a65"+ },+ {+ "slug": "openrouter-integration",+ "name": "OpenRouter Integration",+ "type": "system",+ "sources": [+ "bench/llm.ts"+ ],+ "sourcesDigest": "1bdc59307386b5187ea92242900b2c3b286de3f9f45a08a7dfcf1c2d11801b27"+ },+ {+ "slug": "self-check-mechanism",+ "name": "Self-Check Mechanism",+ "type": "system",+ "sources": [+ "bench/selfcheck.ts"+ ],+ "sourcesDigest": "bfb889927e966de42eecbab5b0186d21e7c5fc8fbde68f2a8a68c657bb120a9a"+ },+ {+ "slug": "task-management",+ "name": "Task Management",+ "type": "system",+ "sources": [+ "bench/tasks.ts"+ ],+ "sourcesDigest": "2940a72050e0bee89a860d904a1ebf289505f797cd93c71d86c2e776227e3fb4"+ }+ ]+}diff --git a/graft/markdown-context-graph.md b/graft/markdown-context-graph.mdnew file mode 100644index 00000000..fb525fc3--- /dev/null+++ b/graft/markdown-context-graph.md@@ -0,0 +1,43 @@+---+name: Markdown Context Graph+slug: markdown-context-graph+type: concept+sources:+ - path: src/graph/write.ts+ hash: 55dd6ea840135ade4db7f49042234bee0db07a9c8c959ab57767deb8bebc6345+ - path: src/index.ts+ hash: e56e74612514fd45665b27e3c47b4a685b503a533b38e1674d256344511107fc+sources_digest: 7883f522ca32a5ffcf1b690631a79925bbb7af24c682d2b389611674a5720a65+links:+ - to: context-graph-management+ relation: part_of+ description: It is a key output of the context graph management process.+generator:+ version: 1+covers:+ - symbol: wiringPath+ kind: function+ at: 'src/graph/write.ts:L20-L22'+ - symbol: readGraph+ kind: function+ at: 'src/graph/write.ts:L28-L34'+ - symbol: writeGraph+ kind: function+ at: 'src/graph/write.ts:L36-L46'+ - symbol: edgeOrder+ kind: function+ at: 'src/graph/write.ts:L48-L54'+---+<!-- context:generated:start -->+## Summary++This concept refers to the use of markdown files to represent the context graph of a codebase, facilitating easy sharing and maintainability across different environments. It emphasizes the importance of version control and human-readable formats.++## Related++- part of [[context-graph-management]] — It is a key output of the context graph management process.+<!-- context:generated:end -->++## Notes++_Anything written below the generated block is preserved when the graph is regenerated._diff --git a/graft/openrouter-integration.md b/graft/openrouter-integration.mdnew file mode 100644index 00000000..b8ba0094--- /dev/null+++ b/graft/openrouter-integration.md@@ -0,0 +1,34 @@+---+name: OpenRouter Integration+slug: openrouter-integration+type: system+sources:+ - path: bench/llm.ts+ hash: 6c0d2a02ac6aa86de94f779355020700a4d9016e2f4b431bf75560e1d3c51229+sources_digest: 1bdc59307386b5187ea92242900b2c3b286de3f9f45a08a7dfcf1c2d11801b27+links:+ - to: benchmarking-framework+ relation: part_of+ description: >-+ It is a foundational component that supports the benchmarking framework's+ operations.+generator:+ version: 1+covers:+ - symbol: makeClient+ kind: function+ at: 'bench/llm.ts:L14-L18'+---+<!-- context:generated:start -->+## Summary++This component serves as the integration layer for interacting with the OpenRouter service, allowing the benchmarking framework to utilize various AI models without requiring separate API keys. It manages client creation and configuration for model interactions.++## Related++- part of [[benchmarking-framework]] — It is a foundational component that supports the benchmarking framework's operations.+<!-- context:generated:end -->++## Notes++_Anything written below the generated block is preserved when the graph is regenerated._diff --git a/graft/scripts/build-viewer.md b/graft/scripts/build-viewer.mdnew file mode 100644index 00000000..3781c1a3--- /dev/null+++ b/graft/scripts/build-viewer.md@@ -0,0 +1,5 @@+# scripts/build-viewer.mjs++This script automates the bundling of the viewer application and its static assets for deployment.++_No extracted symbols in this file._diff --git a/graft/self-check-mechanism.md b/graft/self-check-mechanism.mdnew file mode 100644index 00000000..55578cda--- /dev/null+++ b/graft/self-check-mechanism.md@@ -0,0 +1,35 @@+---+name: Self-Check Mechanism+slug: self-check-mechanism+type: system+sources:+ - path: bench/selfcheck.ts+ hash: 0eaf577938e20fa27d9cd0157bc8843fdc37165d85696789334b8605138f4bb4+sources_digest: bfb889927e966de42eecbab5b0186d21e7c5fc8fbde68f2a8a68c657bb120a9a+links:+ - to: benchmarking-framework+ relation: part_of+ description: It supports the benchmarking framework by providing a testing mechanism.+generator:+ version: 1+covers:+ - symbol: makeStubClient+ kind: function+ at: 'bench/selfcheck.ts:L19-L48'+ - symbol: main+ kind: function+ at: 'bench/selfcheck.ts:L50-L114'+---+<!-- context:generated:start -->+## Summary++This component allows for offline verification of the benchmarking harness, enabling developers to test control flow without needing an API key. It simulates responses from AI services for comprehensive testing.++## Related++- part of [[benchmarking-framework]] — It supports the benchmarking framework by providing a testing mechanism.+<!-- context:generated:end -->++## Notes++_Anything written below the generated block is preserved when the graph is regenerated._diff --git a/graft/src/ai/crux.md b/graft/src/ai/crux.mdnew file mode 100644index 00000000..5df63102--- /dev/null+++ b/graft/src/ai/crux.md@@ -0,0 +1,15 @@+# src/ai/crux.ts · [[code-summarization-and-synthesis]]++This file provides a mechanism to summarize code definitions for better navigation and understanding of a codebase.++- NodeRef · interface · L21-L27 — Defines the structure for referencing a node in the code graph.+- FileCruxInput · interface · L29-L33 — Encapsulates the input data required for summarizing a file's code definitions.+- NodeCrux · interface · L35-L40 — Represents the summarized information for a code definition in the file.+- CruxSummarizer · interface · L42-L44 — Interface for summarizing code definitions from a file.+- numberLines · function · L63-L70 — Formats the source code into a numbered string for better readability.+- userContent · function · L72-L81 — Constructs a user content string that includes file details and target nodes.+- parseResults · function · L84-L98 — Parses the JSON response from the summarization model into a usable format.+- num · function · L88-L88 — This function converts a potentially non-finite number to a finite integer or zero, ensuring valid numerical output.+- OpenRouterCruxSummarizer · class · L101-L127 — Implements the CruxSummarizer interface using OpenAI's chat API for summarization.+- constructor · method · L105-L112 — Initializes the OpenRouterCruxSummarizer with API key and model.+- describeFile · method · L114-L126 — Generates summaries for the code definitions in a given file.diff --git a/graft/src/ai/providers.md b/graft/src/ai/providers.mdnew file mode 100644index 00000000..1dff7589--- /dev/null+++ b/graft/src/ai/providers.md@@ -0,0 +1,7 @@+# src/ai/providers.ts · [[configuration-management]]++This file defines configurations for an AI engine, allowing customization and default settings for its operation.++- EngineConfig · interface · L9-L25 — EngineConfig provides a structure for user-defined settings, enabling flexibility in configuring the AI engine's behavior.+- ResolvedConfig · interface · L28-L35 — ResolvedConfig represents the final configuration after merging user inputs with defaults and environment variables, ensuring all necessary settings are available.+- resolveConfig · function · L43-L55 — resolveConfig combines user configuration with environment variables and defaults to produce a complete configuration for the AI engine.diff --git a/graft/src/ai/summarize.md b/graft/src/ai/summarize.mdnew file mode 100644index 00000000..bff34287--- /dev/null+++ b/graft/src/ai/summarize.md@@ -0,0 +1,9 @@+# src/ai/summarize.ts · [[code-summarization-and-synthesis]]++This file provides functionality to summarize source code files into plain English for a knowledge graph.++- Summarizer · interface · L13-L15 — The Summarizer interface defines a contract for summarizing source code files.+- userContent · function · L28-L34 — The userContent function formats the source code and its path into a structured string for summarization.+- OpenRouterSummarizer · class · L37-L61 — The OpenRouterSummarizer class implements the Summarizer interface using OpenAI's chat API to generate summaries.+- constructor · method · L41-L48 — The constructor initializes the OpenRouterSummarizer with an API key and model for making API calls.+- summarize · method · L50-L60 — The summarize method generates a summary of the provided code by interacting with the OpenAI API.diff --git a/graft/src/ai/synthesize.md b/graft/src/ai/synthesize.mdnew file mode 100644index 00000000..67041ce0--- /dev/null+++ b/graft/src/ai/synthesize.md@@ -0,0 +1,13 @@+# src/ai/synthesize.ts · [[code-summarization-and-synthesis]]++This file defines the architecture for synthesizing a graph of nodes from file summaries, enabling a structured representation of a codebase.++- SynthLink · interface · L12-L16 — Defines the structure of a directed edge between nodes, specifying relationships in the synthesized graph.+- SynthNode · interface · L19-L27 — Represents a node in the synthesized graph, encapsulating its name, type, summary, sources, and links to other nodes.+- FileSummary · interface · L30-L33 — Holds the summary information for a single file, including its path and a descriptive summary.+- Synthesizer · interface · L35-L37 — Defines the interface for synthesizers that convert file summaries into structured nodes.+- userContent · function · L92-L97 — Constructs a formatted string from an array of file summaries, ensuring it does not exceed a specified character limit.+- clean · function · L100-L122 — Normalizes and cleans a raw model response into a structured array of SynthNode objects.+- OpenRouterSynthesizer · class · L134-L163 — Implements the Synthesizer interface using OpenRouter's API to generate nodes from file summaries.+- constructor · method · L138-L141 — Initializes the OpenRouterSynthesizer with API key, model, and optional base URL for the OpenAI client.+- synthesize · method · L143-L162 — Processes an array of file summaries to produce a structured array of SynthNode objects by interacting with the OpenAI API.diff --git a/graft/src/ask/ask.md b/graft/src/ask/ask.mdnew file mode 100644index 00000000..b2330181--- /dev/null+++ b/graft/src/ask/ask.md@@ -0,0 +1,18 @@+# src/ask/ask.ts++This file implements a query routing tool that processes natural language queries to return relevant context from a codebase.++- AskHit · interface · L23-L32 — Represents a hit in the query results, encapsulating details about a concept or symbol found in the codebase.+- AskResult · interface · L34-L41 — Encapsulates the result of a query, including the query string, mode of operation, and the hits found.+- tokenize · function · L50-L56 — Transforms a string of text into an array of lowercased subword tokens, filtering out common stop words.+- counts · function · L59-L63 — Creates a frequency count map of tokens, allowing for analysis of term occurrences in a document.+- firstProse · function · L66-L73 — Extracts the first meaningful prose line from a body of text, ignoring headings and blank lines.+- Corpus · interface · L75-L78 — Defines the structure for a corpus containing concepts and a graph, used for processing queries.+- loadCorpus · function · L80-L105 — Loads a corpus from a specified directory, extracting concepts and building a graph for query processing.+- score · function · L108-L115 — Calculates a score for a document's token counts against a query, facilitating relevance ranking.+- findSubject · function · L125-L143 — Identifies the most relevant symbols in the graph that match the query, prioritizing exact name matches.+- structural · function · L145-L186 — Processes a structural query to find and return relevant callers or callees from the graph based on the query.+- lexical · function · L190-L234 — Ranks concepts and symbols based on lexical matching with the query, returning the most relevant results.+- AskOptions · interface · L236-L239 — Defines options for the ask function, allowing customization of the query context and result limits.+- ask · function · L242-L252 — Handles a query by loading the appropriate corpus and executing either structural or lexical search.+- formatAsk · function · L255-L276 — Formats the results of an AskResult into a markdown string for easy presentation.diff --git a/graft/src/cli.md b/graft/src/cli.mdnew file mode 100644index 00000000..c9001d64--- /dev/null+++ b/graft/src/cli.md@@ -0,0 +1,6 @@+# src/cli.ts++This file implements the `graft` CLI tool for building and maintaining a context graph from code, ensuring synchronization and providing querying capabilities.++- engineFrom · function · L26-L29 — Creates an instance of the Graft engine configured with the specified context directory.+- fmt · function · L42-L46 — Formats a record of counts into a human-readable string for console output.diff --git a/graft/src/context/build.md b/graft/src/context/build.mdnew file mode 100644index 00000000..a34fea07--- /dev/null+++ b/graft/src/context/build.md@@ -0,0 +1,20 @@+# src/context/build.ts · [[caching-mechanism]] [[context-graph-management]]++This file builds a context graph from a code repository by summarizing source files and synthesizing nodes.++- BuildProgress · interface · L47-L52 — Tracks the progress of the build process across different phases.+- BuildOptions · interface · L54-L64 — Defines options for customizing the build process, including output directory and model settings.+- BuildResult · interface · L66-L75 — Holds the results of the build process, including counts of files and nodes processed.+- BuildCache · interface · L78-L81 — Stores cached summaries and synthesized nodes to optimize the build process.+- FileWork · interface · L83-L87 — Represents the work done on each file during the build process, including its summary and hash.+- NodeDraft · interface · L90-L97 — Represents a node being constructed before finalizing its properties and links.+- buildContext · function · L99-L266 — Main function that orchestrates the building of the context graph from the source files.+- batchBySize · function · L269-L285 — Groups file summaries into batches that fit within a specified character budget for processing.+- batchKey · function · L288-L295 — Generates a stable key for a batch of file summaries based on their content hashes.+- registerName · function · L297-L300 — Registers a name and its corresponding slug in a mapping table to avoid duplicates.+- resolveSlug · function · L302-L304 — Retrieves the slug associated with a given name from a mapping table.+- errMsg · function · L306-L308 — Formats error messages for better readability.+- cachePath · function · L310-L312 — Constructs the file path for the cache storage based on the output directory.+- loadCache · function · L314-L325 — Loads the build cache from disk, returning existing summaries and synthesized nodes.+- saveCache · function · L327-L331 — Saves the current build cache to disk to persist summaries and synthesized nodes.+- mapWithConcurrency · function · L334-L349 — Executes a function over a list of items with a limit on concurrent executions, preserving order.diff --git a/graft/src/context/check.md b/graft/src/context/check.mdnew file mode 100644index 00000000..3b250d25--- /dev/null+++ b/graft/src/context/check.md@@ -0,0 +1,9 @@+# src/context/check.ts · [[context-graph-management]]++This file provides functionality to verify if the committed context graph is synchronized with the current codebase, ensuring consistency in CI environments.++- CheckResult · interface · L22-L30 — Defines the structure of the result returned by the checkContext function, encapsulating the status and details of any discrepancies found.+- CheckOptions · interface · L32-L35 — Specifies optional parameters for the checkContext function, allowing customization of the context directory and file extensions to check.+- checkContext · function · L37-L107 — Checks the current state of the context graph against the recorded manifest, identifying any content drift, removals, or coverage issues.+- formatCheckReport · function · L110-L135 — Generates a human-readable report summarizing the results of the checkContext function, detailing any discrepancies found.+- short · function · L137-L139 — Shortens a hash string to its first eight characters for easier readability in reports.diff --git a/graft/src/context/node-file.md b/graft/src/context/node-file.mdnew file mode 100644index 00000000..08f4b388--- /dev/null+++ b/graft/src/context/node-file.md@@ -0,0 +1,22 @@+# src/context/node-file.ts · [[context-graph-management]]++This file defines the structure and operations for managing a context graph represented as markdown files.++- SourceRef · interface · L30-L33 — Represents a source file that contributed to the creation of a node, including its content hash.+- NodeLink · interface · L36-L40 — Defines a directed edge to another node, capturing the relationship and optional description.+- ContextNode · interface · L43-L58 — Models a single node in the context graph, encapsulating its metadata and relationships.+- Manifest · interface · L61-L71 — Represents the generated index of all nodes and their metadata for quick access and integrity checks.+- slugify · function · L81-L86 — Converts a display name into a URL-safe slug for use in file naming and linking.+- digestSources · function · L89-L95 — Calculates a SHA256 hash over the sorted lines of source file paths and hashes to ensure integrity.+- contextDirFor · function · L100-L103 — Determines the absolute path for the graft directory in a repository, allowing for file operations.+- renderGenerated · function · L106-L118 — Generates the markdown content for the summary and related links of a node.+- defaultHuman · function · L121-L123 — Provides a default human-readable section for a new node, which is preserved in future generations.+- renderNodeFile · function · L126-L141 — Serializes a node into its complete markdown file format, including generated and human sections.+- preserveHuman · function · L148-L152 — Extracts the human region from an existing node file to ensure it is not lost during regeneration.+- writeNode · function · L158-L169 — Writes a node to disk, preserving any existing human content and ensuring directory structure.+- ParsedNode · interface · L172-L179 — Represents a parsed node file, capturing essential metadata without the body content.+- readNodes · function · L182-L198 — Reads and parses all markdown node files in a specified directory, returning their metadata.+- existingNodeSlugs · function · L201-L208 — Lists the slugs of existing node files in a directory, aiding in the management of deleted nodes.+- deleteNode · function · L211-L214 — Deletes a specified node file from the filesystem, if it exists.+- writeManifest · function · L216-L219 — Writes the manifest file to disk, containing metadata about the context graph.+- readManifest · function · L221-L229 — Reads and parses the manifest file from disk, returning its contents or undefined if not found.diff --git a/graft/src/engine.md b/graft/src/engine.mdnew file mode 100644index 00000000..918de1f6--- /dev/null+++ b/graft/src/engine.md@@ -0,0 +1,19 @@+# src/engine.ts · [[error-handling-and-robustness]]++This file implements the Context Graph Engine, which builds and checks a code context graph from a repository without a database.++- InitOptions · interface · L26-L31 — Defines options for initializing the context graph build, including code extensions and a progress callback.+- CheckRunOptions · interface · L33-L35 — Specifies options for checking the context graph, allowing for code extensions to be included.+- GraphRunOptions · interface · L37-L41 — Holds options for running the graph build, including whether to use a Tier-2 LLM meaning pass.+- Graft · class · L43-L125 — The Graft class manages the context graph operations, including building and checking the graph against the codebase.+- constructor · method · L46-L48 — Initializes the Graft class with a configuration, resolving the necessary settings for the context graph.+- init · method · L51-L60 — Builds the context graph from the specified directory, utilizing various options and configurations.+- check · method · L63-L65 — Checks if the committed context graph is in sync with the code in the specified directory.+- checkGraph · method · L68-L70 — Verifies if the committed graph.json file is in sync with the code, focusing on the Tier-1 differences.+- graph · method · L77-L83 — Builds a per-symbol code graph in JSON format, optionally including a meaning layer based on the provided options.+- ask · method · L90-L92 — Processes a query against the committed graph, returning results based on structural and lexical rankings.+- requireKey · method · L95-L103 — Ensures that a valid OpenRouter API key is available, throwing an error if it is not set.+- synthesizer · method · L105-L108 — Retrieves the synthesizer instance, creating one if it is not already configured.+- cruxSummarizer · method · L111-L113 — Creates a crux summarizer for the code graph's Tier-2 pass, ensuring it is properly configured.+- summarizer · method · L115-L118 — Obtains the summarizer instance, initializing it if no custom summarizer is provided.+- modelLabel · method · L121-L124 — Determines the human-readable label for the active model used in the context graph.diff --git a/graft/src/graph/build.md b/graft/src/graph/build.mdnew file mode 100644index 00000000..3c3df9b0--- /dev/null+++ b/graft/src/graph/build.md@@ -0,0 +1,8 @@+# src/graph/build.ts · [[context-graph-management]]++This file defines the logic to build a graph representation of a code repository, facilitating analysis and visualization of its structure.++- GraphBuildOptions · interface · L22-L33 — This interface specifies options for customizing the graph build process, including output directory and summarization behavior.+- GraphBuildResult · interface · L35-L48 — This interface outlines the structure of the result returned from the graph build process, detailing the generated graph's metadata and statistics.+- listSourceFiles · function · L51-L53 — This function retrieves a list of source files from a given directory, excluding the output directory and unsupported languages.+- buildGraph · function · L55-L143 — This function orchestrates the process of building a graph from source files, including parsing, enriching, and writing the graph data.diff --git a/graft/src/graph/cards.md b/graft/src/graph/cards.mdnew file mode 100644index 00000000..d7273ae4--- /dev/null+++ b/graft/src/graph/cards.md@@ -0,0 +1,19 @@+# src/graph/cards.ts++This module generates markdown cards that summarize source files and their symbols for easier navigation and understanding of the codebase.++- CardFileInfo · interface · L26-L32 — Holds information about a card's path, the source file it mirrors, and the number of symbols it contains.+- CardStats · interface · L34-L38 — Tracks the statistics of card generation, including how many cards were written and pruned.+- cardPathFor · function · L41-L44 — Constructs the markdown file path for a card by replacing the source file's extension with .md.+- spanStart · function · L47-L50 — Extracts the starting line number from a given span string, returning 0 if the format is unparseable.+- oneLiner · function · L53-L57 — Retrieves a concise summary or signature of a node, prioritizing the summary if available.+- conceptsByPath · function · L60-L70 — Maps source paths to their corresponding concept node slugs, facilitating the creation of up-links in cards.+- renderCard · function · L73-L99 — Generates the markdown content for a card, including the source file's summary and its symbols.+- listExistingCards · function · L102-L121 — Lists all existing markdown card files in the output directory, excluding concept nodes and specific top-level files.+- walk · function · L104-L113 — Recursively traverses directories to find markdown files for existing cards.+- pruneEmptyDirs · function · L124-L144 — Removes empty directories from the output directory, ensuring a clean structure after card generation.+- visit · function · L125-L142 — Visits directories to determine if they are empty after processing their contents.+- writeCards · function · L150-L183 — Writes markdown cards for each source file, reflecting the source tree and pruning any outdated cards.+- writeIndex · function · L189-L224 — Creates an index markdown file that lists all concept nodes and per-file cards for easy navigation.+- CoverRef · interface · L227-L232 — Represents a symbol covered by a concept node, including its name, kind, and location.+- writeCovers · function · L247-L283 — Backfills concept nodes with a list of symbols they cover, enhancing their metadata for better navigation.diff --git a/graft/src/graph/check.md b/graft/src/graph/check.mdnew file mode 100644index 00000000..79f9448d--- /dev/null+++ b/graft/src/graph/check.md@@ -0,0 +1,8 @@+# src/graph/check.ts · [[context-graph-management]]++This file contains logic to verify if the committed graph is in sync with the current codebase, ensuring that any discrepancies are reported for CI purposes.++- GraphCheckResult · interface · L27-L37 — This interface defines the structure of the result returned by the graph check, detailing the state of the graph in relation to the code.+- GraphCheckOptions · interface · L39-L41 — This interface provides optional parameters for configuring the context directory when performing a graph check.+- checkGraph · function · L43-L101 — This function checks if the current code's graph representation matches the committed graph, identifying any added, removed, or changed nodes.+- formatGraphCheckReport · function · L104-L135 — This function generates a human-readable report summarizing the results of the graph check, indicating any discrepancies found.diff --git a/graft/src/graph/enrich.md b/graft/src/graph/enrich.mdnew file mode 100644index 00000000..5188f203--- /dev/null+++ b/graft/src/graph/enrich.md@@ -0,0 +1,10 @@+# src/graph/enrich.ts · [[caching-mechanism]] [[context-graph-management]]++This file implements a mechanism to enrich graph nodes with summaries and cruxes based on their state and prior computations.++- EnrichOptions · interface · L28-L33 — Defines options for enriching graph nodes, including the ability to compute new summaries and report progress.+- EnrichStats · interface · L35-L41 — Tracks the statistics of the enrichment process, including counts of cached, computed, stale, and pending nodes.+- enrichGraph · function · L43-L128 — Enriches a set of graph nodes by determining which need new summaries and processing them accordingly.+- collectFileCrux · function · L135-L155 — Collects crux information for nodes in a file, handling potential errors and ensuring partial results are returned.+- buildCrux · function · L162-L177 — Extracts and formats the crux text from a source file based on the model's provided line range.+- spanLines · function · L180-L186 — Parses a line span string into a clamped range of line numbers, ensuring valid boundaries.diff --git a/graft/src/graph/extract.md b/graft/src/graph/extract.mdnew file mode 100644index 00000000..71cd59a2--- /dev/null+++ b/graft/src/graph/extract.md@@ -0,0 +1,19 @@+# src/graph/extract.ts · [[context-graph-management]]++This module extracts structured data from source files into a normalized format for further processing.++- Language · type · L16-L16 — Defines the supported programming languages for extraction.+- languageOf · function · L19-L25 — Determines the programming language of a given file path.+- RawEdge · interface · L31-L39 — Represents an unresolved edge in the extraction process, linking nodes in the graph.+- ExtractResult · interface · L41-L44 — Holds the result of the extraction process, containing nodes and raw edges.+- WalkCtx · interface · L76-L84 — Context for walking through the syntax tree during extraction, maintaining state and scope.+- DefDescriptor · interface · L87-L92 — Describes a definition in the syntax tree, including its name and type.+- extractFile · function · L94-L127 — Extracts nodes and edges from a source file based on its syntax tree.+- walk · function · L129-L181 — Recursively traverses the syntax tree to collect definitions and their relationships.+- describe · function · L184-L213 — Identifies and describes definitions in the syntax tree based on their node types.+- heritageEdges · function · L215-L242 — Generates edges representing class inheritance and implementation relationships.+- calleeName · function · L244-L260 — Extracts the name of a function or method being called in the syntax tree.+- isImport · function · L262-L264 — Determines if a node represents an import statement in the syntax tree.+- importSpecifier · function · L266-L277 — Extracts the module name from an import statement in the syntax tree.+- clean · function · L280-L287 — Cleans and normalizes a function signature by removing unnecessary whitespace and punctuation.+- tsExported · function · L290-L297 — Checks if a node is exported based on its ancestor nodes in the syntax tree.diff --git a/graft/src/graph/resolve.md b/graft/src/graph/resolve.mdnew file mode 100644index 00000000..15534a20--- /dev/null+++ b/graft/src/graph/resolve.md@@ -0,0 +1,9 @@+# src/graph/resolve.ts · [[context-graph-management]]++This file resolves raw edge intents into concrete edges by matching names against a node index, ensuring accurate relationships between nodes.++- resolveEdges · function · L20-L58 — This function processes raw edges and establishes relationships between nodes based on their types and specified relations.+- add · function · L34-L39 — This function adds a new edge to the output if it hasn't been seen before, preventing duplicate edges in the result.+- push · function · L60-L64 — This function adds a value to an array in a map, creating the array if it doesn't exist, facilitating grouped storage of nodes.+- resolveName · function · L70-L82 — This function resolves a symbol name to its corresponding node ID, prioritizing local matches and handling ambiguities appropriately.+- resolveImport · function · L88-L100 — This function resolves a module specifier to a file node ID if it points within the repository, ensuring correct imports.diff --git a/graft/src/graph/types.md b/graft/src/graph/types.mdnew file mode 100644index 00000000..b10ddf2a--- /dev/null+++ b/graft/src/graph/types.md@@ -0,0 +1,12 @@+# src/graph/types.ts · [[context-graph-management]]++Defines the schema for a code graph, outlining nodes and edges for code structure representation.++- Kind · type · L15-L22 — Enumerates the types of symbols that can exist in the code graph, facilitating type identification.+- Confidence · type · L25-L25 — Specifies the confidence levels for the truth of edges in the graph, aiding in the assessment of relationships.+- SummaryState · type · L28-L28 — Indicates whether the meaning-layer has been computed for a node, managing the state of node summaries.+- Crux · interface · L32-L35 — Holds the LLM-chosen business-logic excerpt for a node, providing a source of truth for code interpretation.+- NodeV1 · interface · L37-L55 — Represents a node in the graph with its identity, location, and meaning, essential for graph construction.+- Relation · type · L57-L63 — Defines the types of relationships between nodes in the graph, clarifying how symbols interact.+- EdgeV1 · interface · L65-L70 — Describes the edges connecting nodes in the graph, detailing the source, target, and relationship type.+- GraphV1 · interface · L72-L81 — Encapsulates the entire graph structure, including metadata and collections of nodes and edges.diff --git a/graft/src/graph/write.md b/graft/src/graph/write.mdnew file mode 100644index 00000000..e3c51316--- /dev/null+++ b/graft/src/graph/write.md@@ -0,0 +1,8 @@+# src/graph/write.ts · [[context-graph-management]] [[markdown-context-graph]]++This file contains functions for managing the serialization and deserialization of a wiring graph used in a context directory.++- wiringPath · function · L20-L22 — Generates the absolute path for the wiring graph file in a specified output directory.+- readGraph · function · L28-L34 — Reads and parses an existing wiring graph from a file, returning null if the file is absent or unparseable.+- writeGraph · function · L36-L46 — Writes a sorted representation of the wiring graph to a specified output directory, ensuring the directory structure exists.+- edgeOrder · function · L48-L54 — Defines the sorting order for edges in the wiring graph based on source, relation, and target.diff --git a/graft/src/index.md b/graft/src/index.mdnew file mode 100644index 00000000..97f9eff5--- /dev/null+++ b/graft/src/index.md@@ -0,0 +1,5 @@+# src/index.ts · [[markdown-context-graph]]++This file serves as the public API for the Graft library, facilitating the management and synchronization of linked markdown files in a repository.++_No extracted symbols in this file._diff --git a/graft/src/ingest/fs.md b/graft/src/ingest/fs.mdnew file mode 100644index 00000000..d063db85--- /dev/null+++ b/graft/src/ingest/fs.md@@ -0,0 +1,5 @@+# src/ingest/fs.ts++This file provides utilities for walking through a filesystem to identify source files while excluding certain directories and large files.++- walkDir · function · L27-L45 — The walkDir function recursively collects paths of files in a directory while skipping specified directories and files larger than 1 MB.diff --git a/graft/src/util/id.md b/graft/src/util/id.mdnew file mode 100644index 00000000..ddee9552--- /dev/null+++ b/graft/src/util/id.md@@ -0,0 +1,7 @@+# src/util/id.ts++This file provides utility functions for generating unique identifiers, creating content hashes, and normalizing names for consistent matching.++- newId · function · L4-L6 — This function generates a unique identifier with a specified prefix, solving the need for easily identifiable and unique keys.+- contentHash · function · L9-L11 — This function creates a stable hash of the input content, which is essential for deduplication of documents.+- normalizeName · function · L14-L16 — This function normalizes names for case- and whitespace-insensitive matching, ensuring consistency in name comparisons.diff --git a/graft/src/viz/assemble.md b/graft/src/viz/assemble.mdnew file mode 100644index 00000000..a0f286bc--- /dev/null+++ b/graft/src/viz/assemble.md@@ -0,0 +1,10 @@+# src/viz/assemble.ts++Assembles a comprehensive graph document from markdown files in a context directory, ensuring that only valid nodes and edges are included.++- VizNode · interface · L18-L24 — Defines the structure of a node in the visualization graph, encapsulating its identity and attributes.+- VizEdge · interface · L26-L31 — Defines the structure of an edge in the visualization graph, representing relationships between nodes.+- VizGraph · interface · L33-L42 — Encapsulates the complete visualization graph, including metadata about nodes and edges.+- normalizeRelation · function · L56-L58 — Maps legacy vague verbs to concrete verbs to maintain consistency in the graph's relationships.+- extractSummary · function · L65-L76 — Extracts and cleans the summary text from a markdown node's content, ensuring it adheres to length constraints.+- assembleContextGraph · function · L79-L130 — Processes markdown files in a specified directory to create a structured visualization graph, handling errors gracefully.diff --git a/graft/src/viz/serve.md b/graft/src/viz/serve.mdnew file mode 100644index 00000000..1ad6c676--- /dev/null+++ b/graft/src/viz/serve.md@@ -0,0 +1,11 @@+# src/viz/serve.ts++This file implements a local server for serving a viewer and handling API requests related to context and code graphs.++- VizServerOptions · interface · L16-L21 — Defines the configuration options required to start the visualization server.+- VizServer · interface · L23-L26 — Represents the visualization server with its URL and a method to close it.+- sendJson · function · L38-L41 — Sends a JSON response with the specified status and body to the client.+- listen · function · L43-L55 — Attempts to bind the server to a specified port, handling errors if the port is in use.+- onError · function · L45-L48 — Handles errors that occur when trying to bind the server to a port.+- startVizServer · function · L57-L148 — Initializes and starts the visualization server, setting up routes and handling requests.+- close · method · L140-L146 — Closes the visualization server and cleans up resources.diff --git a/graft/task-management.md b/graft/task-management.mdnew file mode 100644index 00000000..4ca74013--- /dev/null+++ b/graft/task-management.md@@ -0,0 +1,38 @@+---+name: Task Management+slug: task-management+type: system+sources:+ - path: bench/tasks.ts+ hash: d21168797f40d193a914aca0c438409d29d300441bc0a6a518c93869240b3b69+sources_digest: 2940a72050e0bee89a860d904a1ebf289505f797cd93c71d86c2e776227e3fb4+links:+ - to: benchmarking-framework+ relation: part_of+ description: It provides the tasks that the benchmarking framework evaluates.+generator:+ version: 1+covers:+ - symbol: repoPath+ kind: function+ at: 'bench/tasks.ts:L26-L29'+ - symbol: Task+ kind: interface+ at: 'bench/tasks.ts:L31-L37'+ - symbol: Corpus+ kind: interface+ at: 'bench/tasks.ts:L39-L45'+---+<!-- context:generated:start -->+## Summary++This component defines the benchmark tasks and corpora used for evaluation, ensuring that each task has a verifiable answer based on actual source code. It emphasizes fair assessments of code comprehension across various tasks.++## Related++- part of [[benchmarking-framework]] — It provides the tasks that the benchmarking framework evaluates.+<!-- context:generated:end -->++## Notes++_Anything written below the generated block is preserved when the graph is regenerated._diff --git a/graft/test/context.test.md b/graft/test/context.test.mdnew file mode 100644index 00000000..2a06d83e--- /dev/null+++ b/graft/test/context.test.md@@ -0,0 +1,6 @@+# test/context.test.ts++This file contains end-to-end tests for the markdown-graph pipeline to ensure proper functionality and integrity of the context building and checking processes.++- makeFixture · function · L14-L25 — This function creates a temporary directory with mock service files for testing the context building process.+- buildOpts · function · L27-L29 — This function generates options for building the context, including a fake model and providers.diff --git a/graft/test/covers.test.md b/graft/test/covers.test.mdnew file mode 100644index 00000000..d3407b99--- /dev/null+++ b/graft/test/covers.test.md@@ -0,0 +1,5 @@+# test/covers.test.ts++This test suite verifies that the wiring build correctly populates the 'covers' field in concept nodes and maintains stability across builds.++- makeFixture · function · L16-L24 — Creates a temporary directory with a sample TypeScript file for testing the wiring build.diff --git a/graft/test/helpers.md b/graft/test/helpers.mdnew file mode 100644index 00000000..fdf10ba5--- /dev/null+++ b/graft/test/helpers.md@@ -0,0 +1,10 @@+# test/helpers.ts++This file provides test doubles for offline, deterministic testing of components without external dependencies.++- PassthroughSummarizer · class · L9-L13 — This class serves as a no-op summarizer that returns the input code unchanged for controlled testing.+- summarize · method · L10-L12 — This method returns the input code as-is, allowing tests to control the output precisely.+- BracketSynthesizer · class · L21-L50 — This class synthesizes a graph structure from simple markup, enabling tests to define the relationships between nodes explicitly.+- synthesize · method · L22-L49 — This method processes file summaries to create a structured representation of nodes and their relationships based on markup.+- ensure · function · L24-L31 — This function ensures that a node exists in the map, creating it if necessary, to maintain the graph structure.+- fakeProviders · function · L52-L54 — This function creates and returns instances of the test doubles for summarization and synthesis.diff --git a/graft/test/viz-assemble.test.md b/graft/test/viz-assemble.test.mdnew file mode 100644index 00000000..7a777d4b--- /dev/null+++ b/graft/test/viz-assemble.test.md@@ -0,0 +1,5 @@+# test/viz-assemble.test.ts++This file contains tests that validate the assembly of a context graph from markdown frontmatter, ensuring proper relation normalization and error handling for malformed files.++- makeContextDir · function · L12-L60 — This function creates a temporary directory with markdown files to simulate context data for testing the graph assembly.diff --git a/graft/test/viz-serve.test.md b/graft/test/viz-serve.test.mdnew file mode 100644index 00000000..0082dc18--- /dev/null+++ b/graft/test/viz-serve.test.md@@ -0,0 +1,5 @@+# test/viz-serve.test.ts++This file contains tests for the viz server, ensuring it serves the correct endpoints and handles various scenarios like port fallback and context directory changes.++- makeDirs · function · L13-L27 — This function creates necessary directory structures and files for testing the viz server.diff --git a/graft/viewer/data.md b/graft/viewer/data.mdnew file mode 100644index 00000000..2484009f--- /dev/null+++ b/graft/viewer/data.md@@ -0,0 +1,16 @@+# viewer/data.ts · [[graph-visualization]]++This file defines data structures and functions for managing and visualizing graph data from a server.++- VizNode · interface · L6-L12 — Represents a node in the visualization graph, encapsulating its identity and metadata.+- VizEdge · interface · L14-L20 — Defines the relationship between two nodes in the visualization graph, including its type and description.+- VizGraph · interface · L22-L26 — Encapsulates the entire visualization graph structure, including its nodes and edges.+- Family · type · L29-L29 — Categorizes relation verbs into families to enforce consistent semantics in graph relationships.+- famOf · function · L39-L41 — Determines the family category of a given relation verb, defaulting to 'association' if unknown.+- chipKey · function · L47-L51 — Generates a key for chip grouping based on the relation verb, simplifying the visualization of relationships.+- colorToken · function · L72-L75 — Maps a type to its corresponding CSS custom property for styling in the visualization.+- cvar · function · L77-L79 — Retrieves the value of a CSS custom property from the document's root element.+- loadContextGraph · function · L81-L84 — Fetches the context graph data from the server and returns it in a structured format.+- CodeGraphV1 · interface · L86-L93 — Defines the structure of the code graph data received from the server, including nodes and edges.+- loadCodeGraph · function · L96-L113 — Loads the code graph from the server, filtering out unresolved edges and returning a structured graph.+- onServerChange · function · L116-L121 — Subscribes to server events to trigger updates in the application when changes occur.diff --git a/graft/viewer/detail.md b/graft/viewer/detail.mdnew file mode 100644index 00000000..9dfda324--- /dev/null+++ b/graft/viewer/detail.md@@ -0,0 +1,8 @@+# viewer/detail.ts · [[graph-visualization]]++This file provides the logic to render a detailed view of a selected node in a graph, including its properties and relationships.++- esc · function · L8-L10 — This function sanitizes a string for safe HTML rendering by escaping special characters.+- renderDetail · function · L12-L58 — This function renders the details of a selected node, including its type, name, summary, sources, and relationships.+- name · function · L29-L29 — This function retrieves the name of a node by its ID, providing a fallback if not found.+- linkList · function · L40-L50 — This function generates HTML for displaying a list of links related to a node, categorized by their relationship type.diff --git a/graft/viewer/graph.md b/graft/viewer/graph.mdnew file mode 100644index 00000000..b0389713--- /dev/null+++ b/graft/viewer/graph.md@@ -0,0 +1,27 @@+# viewer/graph.ts · [[graph-visualization]]++This file implements a force-directed graph visualization using D3.js, allowing interactive exploration of nodes and edges.++- SimNode · interface · L22-L30 — Defines the structure of a node in the simulation, including its position and properties.+- SimEdge · interface · L32-L38 — Defines the structure of an edge in the simulation, representing the relationship between two nodes.+- el · function · L42-L46 — Creates and returns an SVG element with specified attributes, facilitating dynamic SVG generation.+- GraphView · class · L48-L334 — Manages the rendering and interaction of the graph view, including node and edge updates.+- constructor · method · L65-L69 — Initializes the GraphView instance and sets up the SVG environment for rendering.+- buildChrome · method · L71-L78 — Sets up the initial SVG structure for the graph, including definitions and viewport.+- ensureMarkers · method · L80-L91 — Ensures that the necessary SVG markers for edges are created and available for rendering.+- setData · method · L94-L136 — Loads a new dataset into the graph, updating node positions and relationships accordingly.+- buildElements · method · L138-L164 — Constructs the SVG elements for nodes and edges based on the current dataset.+- tick · method · L166-L182 — Updates the positions of nodes and edges on each simulation tick, ensuring the graph remains interactive.+- restyle · method · L185-L243 — Applies styles to nodes and edges based on their visibility and selection state.+- nodeShown · function · L195-L195 — Determines if a node should be displayed based on its type and visibility settings.+- select · method · L245-L249 — Selects a node in the graph and updates the visual representation accordingly.+- focus · method · L252-L261 — Centers the view on a specified node, enhancing its visibility and selection.+- firstMatch · method · L263-L266 — Finds the first node that matches the current query, facilitating search functionality.+- applyView · method · L268-L270 — Applies the current view transformation to the graph, adjusting the viewport accordingly.+- zoomBy · method · L272-L279 — Adjusts the zoom level of the graph view based on user input, allowing for detailed exploration.+- resetView · method · L281-L284 — Resets the graph view to its initial state, centering and scaling the view.+- reheat · method · L286-L288 — Restarts the simulation with increased alpha, making the graph more dynamic.+- bindDrag · method · L290-L309 — Enables dragging functionality for nodes, allowing users to reposition them interactively.+- move · function · L294-L299 — Handles the movement of a node during drag events, updating its fixed position.+- up · function · L300-L305 — Finalizes the drag operation by releasing the node's fixed position.+- bindPanZoom · method · L311-L333 — Sets up event listeners for panning and zooming the graph view based on user interactions.diff --git a/graft/viewer/main.md b/graft/viewer/main.mdnew file mode 100644index 00000000..ea54f3d2--- /dev/null+++ b/graft/viewer/main.md@@ -0,0 +1,18 @@+# viewer/main.ts · [[graph-visualization]]++This file serves as the entry point for the graft visualization viewer, managing the user interface and interactions for displaying graphs.++- Tab · type · L10-L10 — Defines the possible tab types for the viewer, ensuring that only valid tab selections are made.+- $ · function · L12-L12 — Provides a type-safe way to retrieve HTML elements by their ID, enhancing code readability and reducing errors.+- activeGraph · function · L23-L25 — Determines which graph is currently active based on the selected tab, facilitating the correct data display.+- graphTab · function · L27-L29 — Identifies the current graph tab, ensuring the correct context is used for rendering and interactions.+- renderChips · function · L32-L60 — Generates and displays interactive chips for graph edges, allowing users to filter and manage edge visibility.+- rank · function · L43-L43 — Establishes a ranking system for edge types to ensure they are displayed in a meaningful order.+- glyphFor · function · L62-L71 — Maps edge types to their corresponding visual glyphs, enhancing the graphical representation of relationships.+- renderLegend · function · L74-L94 — Creates a legend for node types in the graph, providing users with context about the displayed data.+- updateShownCount · function · L96-L101 — Updates the displayed count of visible nodes in the graph, helping users understand the current view's scope.+- updateCounts · function · L103-L112 — Refreshes the displayed counts of nodes and edges based on the active graph, ensuring accurate information is presented.+- showDetail · function · L115-L124 — Displays detailed information about a selected graph element, enhancing user interaction and understanding.+- setTab · function · L129-L167 — Handles the logic for switching between different graph views, ensuring the UI reflects the current context accurately.+- showEmpty · function · L169-L173 — Displays a message when no graph data is available, guiding users on how to generate the necessary data.+- loadAll · function · L216-L223 — Loads the context and code graphs asynchronously, ensuring the viewer is populated with the latest data.diff --git a/graft/viewer/tree.md b/graft/viewer/tree.mdnew file mode 100644index 00000000..434211f4--- /dev/null+++ b/graft/viewer/tree.md@@ -0,0 +1,9 @@+# viewer/tree.ts · [[graph-visualization]]++Generates a collapsible tree view of a code graph's hierarchy, allowing users to navigate through files, classes, and methods.++- esc · function · L7-L9 — Escapes special HTML characters in a string to prevent rendering issues in the tree view.+- renderOutline · function · L11-L66 — Renders the outline view of the code graph, managing the display of files and their hierarchical relationships.+- kids · function · L18-L22 — Retrieves the child nodes of a given parent node in the graph based on the 'contains' relationship.+- countDesc · function · L23-L26 — Counts the total number of descendant nodes for a given parent node, including its children and their descendants.+- row · function · L29-L42 — Constructs the HTML representation of a tree row for a given node, including its children and symbol count.