Skip to content

Turbocharge Claude Code, Cursor, Codex, Gemini & every coding agent: faster, cheaper, with contextual understanding specific to your codebase.

update graft

anirudhkumar-nanonets8cbfa183c0a5
diff --git a/graft/.graph/wiring.json b/graft/.graph/wiring.json
index 75b7c471..bfc26d5a 100644
--- a/graft/.graph/wiring.json
+++ b/graft/.graph/wiring.json
@@ -1,8 +1,8 @@
{
"meta": {
"version": 1,
- "nodeCount": 325,
- "edgeCount": 752,
+ "nodeCount": 402,
+ "edgeCount": 977,
"languages": [
"typescript"
]
@@ -18,6 +18,7 @@
"exported": true,
"origin": "ast",
"body_hash": "e10d64f913c9517cef84cce58ea042d71bed3e94182c791245170eca54060e31",
+ "chars": 12147,
"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
@@ -179,6 +180,7 @@
"exported": true,
"origin": "ast",
"body_hash": "94c222341b066e4f3134b3d9d3f30f31b9ffe7b92967086b07c58f297d349936",
+ "chars": 3076,
"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
@@ -255,6 +257,7 @@
"exported": true,
"origin": "ast",
"body_hash": "6c0d2a02ac6aa86de94f779355020700a4d9016e2f4b431bf75560e1d3c51229",
+ "chars": 960,
"summary_state": "ready",
"summary": "This file configures and provides access to the OpenRouter API for benchmarking LLMs without needing separate API keys.",
"crux": null
@@ -286,6 +289,7 @@
"exported": true,
"origin": "ast",
"body_hash": "775be8c40a8e4172521bba8f6a1f026fa23c4d24b9b5225da3ed5b745077a5b0",
+ "chars": 5288,
"summary_state": "ready",
"summary": "This file provides functionality for aggregating and reporting benchmark results for different agent configurations.",
"crux": null
@@ -424,6 +428,7 @@
"exported": true,
"origin": "ast",
"body_hash": "a0d2859628588f45ae31862f5f801d6219802449c23bbbdba9aa51b7b9febf47",
+ "chars": 9000,
"summary_state": "ready",
"summary": "This file orchestrates the benchmarking process for various corpora and tasks, managing the execution and reporting of results.",
"crux": {
@@ -540,6 +545,7 @@
"exported": true,
"origin": "ast",
"body_hash": "0eaf577938e20fa27d9cd0157bc8843fdc37165d85696789334b8605138f4bb4",
+ "chars": 5236,
"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": {
@@ -591,6 +597,7 @@
"exported": true,
"origin": "ast",
"body_hash": "d21168797f40d193a914aca0c438409d29d300441bc0a6a518c93869240b3b69",
+ "chars": 14060,
"summary_state": "ready",
"summary": "This file defines benchmark tasks and their corresponding reference answers for validating code understanding across multiple repositories.",
"crux": {
@@ -643,6 +650,147 @@
"summary": "This interface outlines the structure of a benchmark task, including its ID, question, reference answer, and required keywords.",
"crux": null
},
+ {
+ "id": "bench/token-ab.ts",
+ "name": "token-ab.ts",
+ "kind": "file",
+ "path": "bench/token-ab.ts",
+ "span": "L1-L298",
+ "signature": null,
+ "exported": true,
+ "origin": "ast",
+ "body_hash": "95a6cebca2a72bb8d1dff205392380b8e5ac7da123f9ea8802a3e048b80ea03c",
+ "chars": 11961,
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
+ },
+ {
+ "id": "bench/token-ab.ts#cost",
+ "name": "cost",
+ "kind": "function",
+ "path": "bench/token-ab.ts",
+ "span": "L242-L246",
+ "signature": "function cost(m: Metrics): string",
+ "exported": false,
+ "origin": "ast",
+ "body_hash": "f59a853dd420d918b63ac37c796298e8049f644b1c500928290d0fa095245818",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
+ },
+ {
+ "id": "bench/token-ab.ts#graftPack",
+ "name": "graftPack",
+ "kind": "function",
+ "path": "bench/token-ab.ts",
+ "span": "L229-L240",
+ "signature": "function graftPack(): { pack: string; ms: number }",
+ "exported": false,
+ "origin": "ast",
+ "body_hash": "89a547d4352e3d9dbdb8c04f2a91fc04be812e2a0eb44165ee58e2df0f5f4bdf",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
+ },
+ {
+ "id": "bench/token-ab.ts#main",
+ "name": "main",
+ "kind": "function",
+ "path": "bench/token-ab.ts",
+ "span": "L252-L292",
+ "signature": "async function main()",
+ "exported": false,
+ "origin": "ast",
+ "body_hash": "7e15d43e2c0c022b333db8c2727e7eb184209faff2799a4e8f381a8840072c70",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
+ },
+ {
+ "id": "bench/token-ab.ts#main.pct",
+ "name": "pct",
+ "kind": "function",
+ "path": "bench/token-ab.ts",
+ "span": "L272-L272",
+ "signature": "pct = (a: number, b: number)",
+ "exported": false,
+ "origin": "ast",
+ "body_hash": "a696c500df6bf30f9d1c99fa5c77b12fd6b41d1441dcea77cb160f1ce867e1d3",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
+ },
+ {
+ "id": "bench/token-ab.ts#Metrics",
+ "name": "Metrics",
+ "kind": "interface",
+ "path": "bench/token-ab.ts",
+ "span": "L59-L68",
+ "signature": "interface Metrics",
+ "exported": false,
+ "origin": "ast",
+ "body_hash": "4987dcdcf1ce8f9588ca811ca9c4c77d37368a043e39415784c9fde7dcff35d9",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
+ },
+ {
+ "id": "bench/token-ab.ts#row",
+ "name": "row",
+ "kind": "function",
+ "path": "bench/token-ab.ts",
+ "span": "L248-L250",
+ "signature": "function row(label: string, a: string | number, b: string | number): string",
+ "exported": false,
+ "origin": "ast",
+ "body_hash": "b30daa5cdce52d4742bfca9c507fa0e60e335fdf6b67081f373a7e45f29ca92f",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
+ },
+ {
+ "id": "bench/token-ab.ts#runAgent",
+ "name": "runAgent",
+ "kind": "function",
+ "path": "bench/token-ab.ts",
+ "span": "L160-L226",
+ "signature": "async function runAgent(arm: string, extraContext: string | null): Promise<Metrics>",
+ "exported": false,
+ "origin": "ast",
+ "body_hash": "00a26ff79d6edc7f2dbe2b394bf6370820c026a752b373cae257f32315a7f5b0",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
+ },
+ {
+ "id": "bench/token-ab.ts#runRead",
+ "name": "runRead",
+ "kind": "function",
+ "path": "bench/token-ab.ts",
+ "span": "L140-L157",
+ "signature": "function runRead(path: string, start?: number, end?: number): { text: string; resolved: string }",
+ "exported": false,
+ "origin": "ast",
+ "body_hash": "79923e547c1f135e88cdda255eeffeb2faa75a5fc81be8703694c8eb45a090af",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
+ },
+ {
+ "id": "bench/token-ab.ts#runSearch",
+ "name": "runSearch",
+ "kind": "function",
+ "path": "bench/token-ab.ts",
+ "span": "L108-L138",
+ "signature": "function runSearch(pattern: string): string",
+ "exported": false,
+ "origin": "ast",
+ "body_hash": "52208dc37e9ca679f7d182cfbb80de09e29cc2aa62bd0128bcd7c7c72c6747ea",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
+ },
{
"id": "scripts/build-viewer.mjs",
"name": "build-viewer.mjs",
@@ -653,6 +801,7 @@
"exported": true,
"origin": "ast",
"body_hash": "fb4ba16d7815dbdbaf2fd818362f914671903132be5573fbdd9a7734549b833d",
+ "chars": 879,
"summary_state": "ready",
"summary": "This script automates the bundling of the viewer application and its static assets for deployment.",
"crux": {
@@ -670,6 +819,7 @@
"exported": true,
"origin": "ast",
"body_hash": "e81750029e4c8641cdaf2b4894f595297839e07a73076e4cdac1522515f923a8",
+ "chars": 5223,
"summary_state": "ready",
"summary": "This file provides a mechanism to summarize code definitions for better navigation and understanding of a codebase.",
"crux": {
@@ -874,6 +1024,7 @@
"exported": true,
"origin": "ast",
"body_hash": "c0d1294d6fa49f6d06ff9bb137b34ea897f94a67810a839cd5705a1fa5995483",
+ "chars": 2035,
"summary_state": "ready",
"summary": "This file defines configurations for an AI engine, allowing customization and default settings for its operation.",
"crux": null
@@ -933,6 +1084,7 @@
"exported": true,
"origin": "ast",
"body_hash": "6e67f3866c75d88a8b1d265e510578f3e3014d9cfd8b2469e6e4afbd67977f93",
+ "chars": 2519,
"summary_state": "ready",
"summary": "This file provides functionality to summarize source code files into plain English for a knowledge graph.",
"crux": {
@@ -1032,6 +1184,7 @@
"exported": true,
"origin": "ast",
"body_hash": "982ab91da10ae51fdba64466cbb614db14a51f2e100bb12a72178961d8dd97d7",
+ "chars": 7187,
"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": {
@@ -1194,12 +1347,13 @@
"name": "ask.ts",
"kind": "file",
"path": "src/ask/ask.ts",
- "span": "L1-L332",
+ "span": "L1-L397",
"signature": null,
"exported": true,
"origin": "ast",
- "body_hash": "5dad6519214e9b58feb86b46e2f498338819643ec44dc69a8f70614aad2eb986",
- "summary_state": "ready",
+ "body_hash": "adec0cff818d0e0981f668a7bb92af61312f24a673d27b676446c73871cd1a6e",
+ "chars": 14971,
+ "summary_state": "stale",
"summary": "This file implements a query tool that routes natural language queries to relevant code symbols and returns structured context information.",
"crux": null
},
@@ -1208,12 +1362,12 @@
"name": "ask",
"kind": "function",
"path": "src/ask/ask.ts",
- "span": "L290-L305",
+ "span": "L327-L347",
"signature": "function ask(dir: string, query: string, opts: AskOptions = {}): AskResult",
"exported": true,
"origin": "ast",
- "body_hash": "1124c362b9a0ab463a7c14fe451fcb3ae476344dee54b361904ad0e536aba0f5",
- "summary_state": "ready",
+ "body_hash": "4cecc60efa689e3b8751a00c500a1a48880e82d57f3bd08607b10d0947af04af",
+ "summary_state": "stale",
"summary": "Processes a query against a code graph, returning structured results based on the query type and context.",
"crux": {
"code": " const s = structural(query, corpus.graph, limit);\n result = s ?? lexical(query, corpus, limit);",
@@ -1239,7 +1393,7 @@
"name": "AskOptions",
"kind": "interface",
"path": "src/ask/ask.ts",
- "span": "L244-L250",
+ "span": "L248-L254",
"signature": "interface AskOptions",
"exported": true,
"origin": "ast",
@@ -1253,21 +1407,35 @@
"name": "AskResult",
"kind": "interface",
"path": "src/ask/ask.ts",
- "span": "L42-L49",
+ "span": "L42-L53",
"signature": "interface AskResult",
"exported": true,
"origin": "ast",
- "body_hash": "385acaee56a1f36f6f8dbafd0dcdb0e539ca47a774b1f14ec0d7ae2dde5b0101",
- "summary_state": "ready",
+ "body_hash": "94988e1ce9251abf8e45eb8de671cb40f258c9ef83f60bcc973b58ccc6963483",
+ "summary_state": "stale",
"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#baselineFor",
+ "name": "baselineFor",
+ "kind": "function",
+ "path": "src/ask/ask.ts",
+ "span": "L309-L324",
+ "signature": "function baselineFor(hits: AskHit[], graph: GraphV1 | null): AskResult[\"saved\"] | undefined",
+ "exported": false,
+ "origin": "ast",
+ "body_hash": "72fb36d83f07af995f68449fa92d57766850ea34ff5644a0a09dde44e0f19ae2",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
+ },
{
"id": "src/ask/ask.ts#Corpus",
"name": "Corpus",
"kind": "interface",
"path": "src/ask/ask.ts",
- "span": "L83-L86",
+ "span": "L87-L90",
"signature": "interface Corpus",
"exported": false,
"origin": "ast",
@@ -1281,7 +1449,7 @@
"name": "counts",
"kind": "function",
"path": "src/ask/ask.ts",
- "span": "L67-L71",
+ "span": "L71-L75",
"signature": "function counts(tokens: string[]): Map<string, number>",
"exported": false,
"origin": "ast",
@@ -1298,7 +1466,7 @@
"name": "findSubject",
"kind": "function",
"path": "src/ask/ask.ts",
- "span": "L133-L151",
+ "span": "L137-L155",
"signature": "function findSubject(query: string, graph: GraphV1): NodeV1[]",
"exported": false,
"origin": "ast",
@@ -1315,7 +1483,7 @@
"name": "firstProse",
"kind": "function",
"path": "src/ask/ask.ts",
- "span": "L74-L81",
+ "span": "L78-L85",
"signature": "function firstProse(body: string): string",
"exported": false,
"origin": "ast",
@@ -1332,24 +1500,38 @@
"name": "formatAsk",
"kind": "function",
"path": "src/ask/ask.ts",
- "span": "L308-L331",
+ "span": "L355-L379",
"signature": "function formatAsk(r: AskResult): string",
"exported": true,
"origin": "ast",
- "body_hash": "8af467346c9f58e5f3fdc408b8eea980c3879d954cae8a32bbc62a19eb2cf4cc",
- "summary_state": "ready",
+ "body_hash": "9d7ceb49391b7e126bb8e25b73d28e6747a515c831d2e9f8a2ae2e17b73567be",
+ "summary_state": "stale",
"summary": "Formats the results of a query into a markdown context pack for easy readability and 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 if (h.code) lines.push(\"\", \"```\", h.code, \"```\", \"\");\n }",
"span": "L308-L319"
}
},
+ {
+ "id": "src/ask/ask.ts#hitFiles",
+ "name": "hitFiles",
+ "kind": "function",
+ "path": "src/ask/ask.ts",
+ "span": "L295-L304",
+ "signature": "function hitFiles(hits: AskHit[]): Set<string>",
+ "exported": false,
+ "origin": "ast",
+ "body_hash": "51b7d4fbb4e2ea5979c8e8b308c7158ad764595538ee72714f4aa2f93d5ee89b",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
+ },
{
"id": "src/ask/ask.ts#inlineSource",
"name": "inlineSource",
"kind": "function",
"path": "src/ask/ask.ts",
- "span": "L280-L287",
+ "span": "L284-L291",
"signature": "function inlineSource(root: string, hits: AskHit[]): void",
"exported": false,
"origin": "ast",
@@ -1366,7 +1548,7 @@
"name": "lexical",
"kind": "function",
"path": "src/ask/ask.ts",
- "span": "L198-L242",
+ "span": "L202-L246",
"signature": "function lexical(query: string, corpus: Corpus, limit: number): AskResult",
"exported": false,
"origin": "ast",
@@ -1383,7 +1565,7 @@
"name": "loadCorpus",
"kind": "function",
"path": "src/ask/ask.ts",
- "span": "L88-L113",
+ "span": "L92-L117",
"signature": "function loadCorpus(outDir: string): Corpus",
"exported": false,
"origin": "ast",
@@ -1400,7 +1582,7 @@
"name": "parseSpan",
"kind": "function",
"path": "src/ask/ask.ts",
- "span": "L254-L258",
+ "span": "L258-L262",
"signature": "function parseSpan(pointer: string): { path: string; from: number; to: number } | null",
"exported": false,
"origin": "ast",
@@ -1412,12 +1594,26 @@
"span": "L255-L257"
}
},
+ {
+ "id": "src/ask/ask.ts#savingsFooter",
+ "name": "savingsFooter",
+ "kind": "function",
+ "path": "src/ask/ask.ts",
+ "span": "L384-L396",
+ "signature": "function savingsFooter(r: AskResult, body: string): string",
+ "exported": false,
+ "origin": "ast",
+ "body_hash": "343954821ba1b41301acd0788cd9e648cd4aa44d498a57028a52d290d97de7c5",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
+ },
{
"id": "src/ask/ask.ts#score",
"name": "score",
"kind": "function",
"path": "src/ask/ask.ts",
- "span": "L116-L123",
+ "span": "L120-L127",
"signature": "function score(query: Map<string, number>, doc: Map<string, number>): number",
"exported": false,
"origin": "ast",
@@ -1434,7 +1630,7 @@
"name": "sliceSpan",
"kind": "function",
"path": "src/ask/ask.ts",
- "span": "L262-L277",
+ "span": "L266-L281",
"signature": "function sliceSpan(root: string, path: string, from: number, to: number): string | null",
"exported": false,
"origin": "ast",
@@ -1451,7 +1647,7 @@
"name": "structural",
"kind": "function",
"path": "src/ask/ask.ts",
- "span": "L153-L194",
+ "span": "L157-L198",
"signature": "function structural(query: string, graph: GraphV1, limit: number): AskResult | null",
"exported": false,
"origin": "ast",
@@ -1468,7 +1664,7 @@
"name": "tokenize",
"kind": "function",
"path": "src/ask/ask.ts",
- "span": "L58-L64",
+ "span": "L62-L68",
"signature": "function tokenize(text: string): string[]",
"exported": false,
"origin": "ast",
@@ -1481,6997 +1677,9283 @@
}
},
{
- "id": "src/cli.ts",
- "name": "cli.ts",
+ "id": "src/ask/ask.ts#toTokens",
+ "name": "toTokens",
+ "kind": "function",
+ "path": "src/ask/ask.ts",
+ "span": "L350-L352",
+ "signature": "function toTokens(chars: number): number",
+ "exported": false,
+ "origin": "ast",
+ "body_hash": "c309fa8bd0227742b657331eb45be3225e5a5efc56b1967871624df6c83ab954",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
+ },
+ {
+ "id": "src/claude/format.ts",
+ "name": "format.ts",
"kind": "file",
- "path": "src/cli.ts",
- "span": "L1-L187",
+ "path": "src/claude/format.ts",
+ "span": "L1-L134",
"signature": null,
"exported": true,
"origin": "ast",
- "body_hash": "ba1d90ee4c0f7b5000fa4239461c19d54fdedcad12b8592589312f163e1357dc",
- "summary_state": "ready",
- "summary": "This file implements the `graft` CLI tool for building and maintaining a context graph from code, ensuring it stays in sync with the repository.",
- "crux": {
- "code": "program\n .name(\"graft\")\n .description(\"Build a repo's context graph as linked markdown, and keep it in sync with the code.\")",
- "span": "L22-L24"
- }
+ "body_hash": "014b4077fa11ce2a07b1d7eb7b08c4fbcee9b08c3d06e4489d0c86f196930609",
+ "chars": 5479,
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/cli.ts#engineFrom",
- "name": "engineFrom",
- "kind": "function",
- "path": "src/cli.ts",
- "span": "L27-L30",
- "signature": "function engineFrom(): Graft",
- "exported": false,
+ "id": "src/claude/format.ts#AskJson",
+ "name": "AskJson",
+ "kind": "interface",
+ "path": "src/claude/format.ts",
+ "span": "L77-L82",
+ "signature": "interface AskJson",
+ "exported": true,
"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"
- }
+ "body_hash": "b399ef3e1787b48619f044578ea2cf3cf63cd92876015d55979db78ee6f9e643",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/cli.ts#fmt",
- "name": "fmt",
+ "id": "src/claude/format.ts#enrichedSegment",
+ "name": "enrichedSegment",
"kind": "function",
- "path": "src/cli.ts",
- "span": "L49-L53",
- "signature": "fmt = (o: Record<string, number>)",
- "exported": false,
+ "path": "src/claude/format.ts",
+ "span": "L13-L17",
+ "signature": "function enrichedSegment(s: Stats): string | null",
+ "exported": true,
"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"
- }
+ "body_hash": "13d408559074290e5bd519a136440f0021106ece96bde4eb9130807b43436421",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/build.ts",
- "name": "build.ts",
- "kind": "file",
- "path": "src/context/build.ts",
- "span": "L1-L350",
- "signature": null,
+ "id": "src/claude/format.ts#formatBlastRadius",
+ "name": "formatBlastRadius",
+ "kind": "function",
+ "path": "src/claude/format.ts",
+ "span": "L64-L75",
+ "signature": "function formatBlastRadius(w: GraphV1, filePath: string, cap = 8): string | 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"
- }
+ "body_hash": "060f1af7d88ad5d2667bc25431982a15e05986ab706b647d4881429fc22cf210",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/build.ts#batchBySize",
- "name": "batchBySize",
+ "id": "src/claude/format.ts#formatOrientation",
+ "name": "formatOrientation",
"kind": "function",
- "path": "src/context/build.ts",
- "span": "L269-L285",
- "signature": "function batchBySize(files: FileSummary[], budget: number): FileSummary[][]",
- "exported": false,
+ "path": "src/claude/format.ts",
+ "span": "L125-L127",
+ "signature": "function formatOrientation(indexMd: string, budgetBytes = 1500): string",
+ "exported": true,
"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"
- }
+ "body_hash": "0da076da5c6f3cacf6a7e8d372517b658ae7cd073d52740909684ba5b5aff6f0",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/build.ts#batchKey",
- "name": "batchKey",
+ "id": "src/claude/format.ts#formatRetrieval",
+ "name": "formatRetrieval",
"kind": "function",
- "path": "src/context/build.ts",
- "span": "L288-L295",
- "signature": "function batchKey(batch: FileSummary[], hashByPath: Map<string, string>): string",
- "exported": false,
+ "path": "src/claude/format.ts",
+ "span": "L110-L123",
+ "signature": "function formatRetrieval(ask: AskJson, cap = 5): string | null",
+ "exported": true,
"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"
- }
+ "body_hash": "0e749b34c587c31ea6261a491f49e90e0985ed5171ee2f205dcad3466177572c",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/build.ts#BuildCache",
- "name": "BuildCache",
- "kind": "interface",
- "path": "src/context/build.ts",
- "span": "L78-L81",
- "signature": "interface BuildCache",
- "exported": false,
+ "id": "src/claude/format.ts#freshnessSegment",
+ "name": "freshnessSegment",
+ "kind": "function",
+ "path": "src/claude/format.ts",
+ "span": "L19-L24",
+ "signature": "function freshnessSegment(s: Stats): string",
+ "exported": true,
"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"
- }
+ "body_hash": "4017743e4d027d64db4d0d99f078e8b0f6694409539df5e72ea2951c08e00881",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/build.ts#buildContext",
- "name": "buildContext",
+ "id": "src/claude/format.ts#incomingEdges",
+ "name": "incomingEdges",
"kind": "function",
- "path": "src/context/build.ts",
- "span": "L99-L266",
- "signature": "async function buildContext(dir: string, opts: BuildOptions): Promise<BuildResult>",
+ "path": "src/claude/format.ts",
+ "span": "L58-L62",
+ "signature": "function incomingEdges(w: GraphV1, filePath: string): EdgeV1[]",
"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"
- }
+ "body_hash": "df33e0b502eac5f85c753c6d6ba884e232e75ccbc8296eb1c2f74df403786114",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/build.ts#BuildOptions",
- "name": "BuildOptions",
- "kind": "interface",
- "path": "src/context/build.ts",
- "span": "L54-L64",
- "signature": "interface BuildOptions",
- "exported": true,
+ "id": "src/claude/format.ts#nodeIdsInFile",
+ "name": "nodeIdsInFile",
+ "kind": "function",
+ "path": "src/claude/format.ts",
+ "span": "L50-L56",
+ "signature": "function nodeIdsInFile(w: GraphV1, filePath: string): Set<string>",
+ "exported": false,
"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"
- }
+ "body_hash": "4364752508d77072bf49b2e9f5b788665932916b6c0c081c7d2825f4190d593d",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/build.ts#BuildProgress",
- "name": "BuildProgress",
- "kind": "interface",
- "path": "src/context/build.ts",
- "span": "L47-L52",
- "signature": "interface BuildProgress",
+ "id": "src/claude/format.ts#renderStatusline",
+ "name": "renderStatusline",
+ "kind": "function",
+ "path": "src/claude/format.ts",
+ "span": "L26-L48",
+ "signature": "function renderStatusline( stats: Stats | null, session: SessionState | null, ctx: { ctxPct: number | null }, ): string[]",
"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"
- }
+ "body_hash": "2879019a5dec5846bba4fadb443068e54af2abb162af24c233c02cab01a82815",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/build.ts#BuildResult",
- "name": "BuildResult",
- "kind": "interface",
- "path": "src/context/build.ts",
- "span": "L66-L75",
- "signature": "interface BuildResult",
+ "id": "src/claude/format.ts#renderSubagent",
+ "name": "renderSubagent",
+ "kind": "function",
+ "path": "src/claude/format.ts",
+ "span": "L129-L133",
+ "signature": "function renderSubagent(agentName: string, session: SessionState | null): string",
"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"
- }
+ "body_hash": "654ed5b50e9a47279bcc15b69c0b45df6e6b5d5684f33520fd7dda9600392de0",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/build.ts#cachePath",
- "name": "cachePath",
+ "id": "src/claude/format.ts#retrievalBody",
+ "name": "retrievalBody",
"kind": "function",
- "path": "src/context/build.ts",
- "span": "L310-L312",
- "signature": "function cachePath(outDir: string): string",
+ "path": "src/claude/format.ts",
+ "span": "L89-L99",
+ "signature": "function retrievalBody(hits: AskJson['hits']): 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"
- }
+ "body_hash": "2a965bab71b652325c4faf1974b0f4d148e49eb26b7e137156e0f573266bcb5d",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/build.ts#errMsg",
- "name": "errMsg",
+ "id": "src/claude/format.ts#retrievalTokensSaved",
+ "name": "retrievalTokensSaved",
"kind": "function",
- "path": "src/context/build.ts",
- "span": "L306-L308",
- "signature": "function errMsg(err: unknown): string",
+ "path": "src/claude/format.ts",
+ "span": "L102-L108",
+ "signature": "function retrievalTokensSaved(ask: AskJson, cap = 5): number",
+ "exported": true,
+ "origin": "ast",
+ "body_hash": "fcfb9a5c94f35b59d228ea34edb8435c2f110e25c5a12ad572ec47646166d99a",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
+ },
+ {
+ "id": "src/claude/format.ts#tokensOf",
+ "name": "tokensOf",
+ "kind": "function",
+ "path": "src/claude/format.ts",
+ "span": "L84-L84",
+ "signature": "function tokensOf(chars: number): number",
"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"
- }
+ "body_hash": "a72a89f1099c37bae9e03a82e42ac3c2040789815176e99511f9bd5e31cbbe32",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/build.ts#FileWork",
- "name": "FileWork",
- "kind": "interface",
- "path": "src/context/build.ts",
- "span": "L83-L87",
- "signature": "interface FileWork",
+ "id": "src/claude/hooks.ts",
+ "name": "hooks.ts",
+ "kind": "file",
+ "path": "src/claude/hooks.ts",
+ "span": "L1-L111",
+ "signature": null,
+ "exported": true,
+ "origin": "ast",
+ "body_hash": "6505b9c22c766aa21c6b2bb50f029fec483fda0b0974afa0e8d8e6248b4f6862",
+ "chars": 4842,
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
+ },
+ {
+ "id": "src/claude/hooks.ts#checkStaleCount",
+ "name": "checkStaleCount",
+ "kind": "function",
+ "path": "src/claude/hooks.ts",
+ "span": "L43-L47",
+ "signature": "function checkStaleCount(dir: string): number",
"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"
- }
+ "body_hash": "d805c2f6af0f8a76196f80902c408ebe14fd46fb43a79b3944af2bd3c11e1d6a",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/build.ts#loadCache",
- "name": "loadCache",
+ "id": "src/claude/hooks.ts#emit",
+ "name": "emit",
"kind": "function",
- "path": "src/context/build.ts",
- "span": "L314-L325",
- "signature": "function loadCache(outDir: string): BuildCache",
+ "path": "src/claude/hooks.ts",
+ "span": "L48-L50",
+ "signature": "function emit(eventName: string, additionalContext: string): void",
"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"
- }
+ "body_hash": "9f7384f6c6c8562520fdc78864670fe66220557504ab0c21cc4cc2278194c2f1",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/build.ts#mapWithConcurrency",
- "name": "mapWithConcurrency",
+ "id": "src/claude/hooks.ts#graftCli",
+ "name": "graftCli",
"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[]>",
+ "path": "src/claude/hooks.ts",
+ "span": "L24-L27",
+ "signature": "function graftCli(dir: string): { cmd: string; pre: string[] }",
"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"
- }
+ "body_hash": "4617c7080204c5f47d35e9051f44df0440c30fc4035003573e7a575fde6e6aa7",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/build.ts#NodeDraft",
- "name": "NodeDraft",
- "kind": "interface",
- "path": "src/context/build.ts",
- "span": "L90-L97",
- "signature": "interface NodeDraft",
+ "id": "src/claude/hooks.ts#graftJson",
+ "name": "graftJson",
+ "kind": "function",
+ "path": "src/claude/hooks.ts",
+ "span": "L28-L42",
+ "signature": "function graftJson(dir: string, args: string[]): any | null",
"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"
- }
+ "body_hash": "fb91f1d1a251edf20793ce914435d1c3857b6fcda91fc3e26645ba848b8a6dbc",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/build.ts#registerName",
- "name": "registerName",
+ "id": "src/claude/hooks.ts#main",
+ "name": "main",
"kind": "function",
- "path": "src/context/build.ts",
- "span": "L297-L300",
- "signature": "function registerName(table: Map<string, string>, name: string, slug: string): void",
+ "path": "src/claude/hooks.ts",
+ "span": "L52-L110",
+ "signature": "async function main(event: string): Promise<void>",
+ "exported": true,
+ "origin": "ast",
+ "body_hash": "703ca99c2fd552472f099f0dd2784427a3c3ec7d1b62b31d39a6d7f6536d2fd4",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
+ },
+ {
+ "id": "src/claude/hooks.ts#projectDir",
+ "name": "projectDir",
+ "kind": "function",
+ "path": "src/claude/hooks.ts",
+ "span": "L15-L17",
+ "signature": "function projectDir(input: any): string",
"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"
- }
+ "body_hash": "4aa298cb59c252e2c2abe9c18294279b32f78eb55de1a883efd34affdf49cef8",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/build.ts#resolveSlug",
- "name": "resolveSlug",
+ "id": "src/claude/hooks.ts#readStdin",
+ "name": "readStdin",
"kind": "function",
- "path": "src/context/build.ts",
- "span": "L302-L304",
- "signature": "function resolveSlug(table: Map<string, string>, name: string): string | undefined",
+ "path": "src/claude/hooks.ts",
+ "span": "L8-L12",
+ "signature": "function readStdin(): any",
"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"
- }
+ "body_hash": "a0c855d260852d9ede8e16aa40adaf829ecc549c5c7ea5f23a128754abc363a0",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/build.ts#saveCache",
- "name": "saveCache",
+ "id": "src/claude/hooks.ts#safeReadFd0",
+ "name": "safeReadFd0",
"kind": "function",
- "path": "src/context/build.ts",
- "span": "L327-L331",
- "signature": "function saveCache(outDir: string, cache: BuildCache): void",
+ "path": "src/claude/hooks.ts",
+ "span": "L13-L13",
+ "signature": "function safeReadFd0(): string",
"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"
- }
+ "body_hash": "7594a29f0e0cf58a56f3730cad00dc40d449de18fc2baf18deb20d6457a63c15",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/check.ts",
- "name": "check.ts",
+ "id": "src/claude/hooks.ts#underGraft",
+ "name": "underGraft",
+ "kind": "function",
+ "path": "src/claude/hooks.ts",
+ "span": "L18-L21",
+ "signature": "function underGraft(dir: string, file: string): boolean",
+ "exported": true,
+ "origin": "ast",
+ "body_hash": "b87aa3e7ba9049438b7750b8dc3767fc4a2630e3a347e20900d1beaea543df04",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
+ },
+ {
+ "id": "src/claude/state.ts",
+ "name": "state.ts",
"kind": "file",
- "path": "src/context/check.ts",
- "span": "L1-L140",
+ "path": "src/claude/state.ts",
+ "span": "L1-L77",
"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"
- }
+ "body_hash": "fa12661d1253f24bff684f6c9c3197ba5ebde17f7291acd67408165e5a2823f3",
+ "chars": 3385,
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/check.ts#checkContext",
- "name": "checkContext",
+ "id": "src/claude/state.ts#acquireLock",
+ "name": "acquireLock",
"kind": "function",
- "path": "src/context/check.ts",
- "span": "L37-L107",
- "signature": "function checkContext(dir: string, opts: CheckOptions = {}): CheckResult",
+ "path": "src/claude/state.ts",
+ "span": "L59-L75",
+ "signature": "function acquireLock(d: string): boolean",
"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"
- }
+ "body_hash": "d10ac8134d1cc35d9bd14414ba7608b48646c70492b96b624f1e140f86dbd4b6",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/check.ts#CheckOptions",
- "name": "CheckOptions",
- "kind": "interface",
- "path": "src/context/check.ts",
- "span": "L32-L35",
- "signature": "interface CheckOptions",
+ "id": "src/claude/state.ts#cacheDir",
+ "name": "cacheDir",
+ "kind": "function",
+ "path": "src/claude/state.ts",
+ "span": "L28-L28",
+ "signature": "function cacheDir(projectDir: string): string",
"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.",
+ "body_hash": "c5b57c650fe2af36c19b2cad9b398f6c77e16046d173394d0710edde24c516f2",
+ "summary_state": "pending",
+ "summary": null,
"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,
+ "id": "src/claude/state.ts#emptySession",
+ "name": "emptySession",
+ "kind": "function",
+ "path": "src/claude/state.ts",
+ "span": "L24-L26",
+ "signature": "function emptySession(): SessionState",
+ "exported": false,
"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.",
+ "body_hash": "fa6db80cab3fefe96f4cd2d65fe554e2d925a1ec82734d40e883c0ad79fdc542",
+ "summary_state": "pending",
+ "summary": null,
"crux": null
},
{
- "id": "src/context/check.ts#formatCheckReport",
- "name": "formatCheckReport",
+ "id": "src/claude/state.ts#emptyStats",
+ "name": "emptyStats",
"kind": "function",
- "path": "src/context/check.ts",
- "span": "L110-L135",
- "signature": "function formatCheckReport(r: CheckResult): string",
+ "path": "src/claude/state.ts",
+ "span": "L20-L23",
+ "signature": "function emptyStats(): Stats",
"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"
- }
+ "body_hash": "f507d8c6bb5222d97af97220bed44ebab58221672fe4c0f1e43c410c7ad6f03f",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/check.ts#short",
- "name": "short",
+ "id": "src/claude/state.ts#lockPath",
+ "name": "lockPath",
"kind": "function",
- "path": "src/context/check.ts",
- "span": "L137-L139",
- "signature": "function short(hash: string): string",
+ "path": "src/claude/state.ts",
+ "span": "L31-L31",
+ "signature": "function lockPath(d: 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"
- }
+ "body_hash": "d9e771038564b59c8e77023262cf3b4cb19cb67a11bdffd03596b55ba16abd19",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/node-file.ts",
- "name": "node-file.ts",
- "kind": "file",
- "path": "src/context/node-file.ts",
- "span": "L1-L230",
- "signature": null,
+ "id": "src/claude/state.ts#patchStats",
+ "name": "patchStats",
+ "kind": "function",
+ "path": "src/claude/state.ts",
+ "span": "L47-L51",
+ "signature": "function patchStats(d: string, patch: Partial<Stats>): Stats",
"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"
- }
+ "body_hash": "44a7279d2463dc0c60b5992a1bbf3ca152a81fbf281ba3181f66306ea47bac0b",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/node-file.ts#contextDirFor",
- "name": "contextDirFor",
+ "id": "src/claude/state.ts#readJson",
+ "name": "readJson",
"kind": "function",
- "path": "src/context/node-file.ts",
- "span": "L100-L103",
- "signature": "function contextDirFor(root: string, override?: string): string",
- "exported": true,
+ "path": "src/claude/state.ts",
+ "span": "L33-L35",
+ "signature": "function readJson<T>(p: string): T | null",
+ "exported": false,
"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"
- }
+ "body_hash": "70bcbc68383bedc607095d101f70d8bf5a7c0bfa84d2fec3b9583674646386e0",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/node-file.ts#defaultHuman",
- "name": "defaultHuman",
+ "id": "src/claude/state.ts#readSession",
+ "name": "readSession",
"kind": "function",
- "path": "src/context/node-file.ts",
- "span": "L121-L123",
- "signature": "function defaultHuman(): string",
- "exported": false,
+ "path": "src/claude/state.ts",
+ "span": "L52-L54",
+ "signature": "function readSession(d: string, id: string): SessionState",
+ "exported": true,
"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"
- }
+ "body_hash": "9c9ff7506f27585bde3a8218144cc25959b1b5a460f65eedbec712dce641f391",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/node-file.ts#deleteNode",
- "name": "deleteNode",
+ "id": "src/claude/state.ts#readStats",
+ "name": "readStats",
"kind": "function",
- "path": "src/context/node-file.ts",
- "span": "L211-L214",
- "signature": "function deleteNode(dir: string, slug: string): void",
+ "path": "src/claude/state.ts",
+ "span": "L43-L43",
+ "signature": "function readStats(d: string): Stats | null",
"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"
- }
+ "body_hash": "0fc71d400d255e986f4914c0a59304ed5b6d39684e7ddbae7e72fa4edd56a633",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/node-file.ts#digestSources",
- "name": "digestSources",
+ "id": "src/claude/state.ts#releaseLock",
+ "name": "releaseLock",
"kind": "function",
- "path": "src/context/node-file.ts",
- "span": "L89-L95",
- "signature": "function digestSources(sources: SourceRef[]): string",
+ "path": "src/claude/state.ts",
+ "span": "L76-L76",
+ "signature": "function releaseLock(d: string): void",
"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"
- }
+ "body_hash": "0e65162ca2e768f56fcd08d222fb831dc50e2c8f69bf8e3a4b568178d3efb7bb",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/node-file.ts#existingNodeSlugs",
- "name": "existingNodeSlugs",
+ "id": "src/claude/state.ts#sessionPath",
+ "name": "sessionPath",
"kind": "function",
- "path": "src/context/node-file.ts",
- "span": "L201-L208",
- "signature": "function existingNodeSlugs(dir: string): Set<string>",
- "exported": true,
+ "path": "src/claude/state.ts",
+ "span": "L30-L30",
+ "signature": "function sessionPath(d: string, id: string): string",
+ "exported": false,
"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"
- }
+ "body_hash": "2cb9cb73fc21b0857099f40d2df6a5b62657b5464ba8830cda3edd015ef1ccc3",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/node-file.ts#Manifest",
- "name": "Manifest",
+ "id": "src/claude/state.ts#SessionState",
+ "name": "SessionState",
"kind": "interface",
- "path": "src/context/node-file.ts",
- "span": "L61-L71",
- "signature": "interface Manifest",
+ "path": "src/claude/state.ts",
+ "span": "L10-L16",
+ "signature": "interface SessionState",
"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"
- }
+ "body_hash": "8a88a78a3d3bd8120988cf348422bf7ce8214d1b6715cb1f5d4059413e6d9ca8",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/node-file.ts#NodeLink",
- "name": "NodeLink",
+ "id": "src/claude/state.ts#Stats",
+ "name": "Stats",
"kind": "interface",
- "path": "src/context/node-file.ts",
- "span": "L36-L40",
- "signature": "interface NodeLink",
+ "path": "src/claude/state.ts",
+ "span": "L4-L9",
+ "signature": "interface Stats",
"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"
- }
+ "body_hash": "c6f7b600be3741c9535991dad2a97f36768b6376460c696df32a279008044ab0",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "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,
+ "id": "src/claude/state.ts#statsPath",
+ "name": "statsPath",
+ "kind": "function",
+ "path": "src/claude/state.ts",
+ "span": "L29-L29",
+ "signature": "function statsPath(d: string): string",
+ "exported": false,
"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"
- }
+ "body_hash": "82bf554697f883d634f98df066c106f57a2dd1f90f5d2ff5575f04ae5237a829",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/node-file.ts#preserveHuman",
- "name": "preserveHuman",
+ "id": "src/claude/state.ts#writeJsonAtomic",
+ "name": "writeJsonAtomic",
"kind": "function",
- "path": "src/context/node-file.ts",
- "span": "L148-L152",
- "signature": "function preserveHuman(existingContent: string): string",
+ "path": "src/claude/state.ts",
+ "span": "L36-L41",
+ "signature": "function writeJsonAtomic(p: string, value: unknown): void",
"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"
- }
+ "body_hash": "52709eed6470bfb5239dc6472ae93c63768fa95d1bc308cadc7f2c99f4961ba6",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/node-file.ts#readManifest",
- "name": "readManifest",
+ "id": "src/claude/state.ts#writeSession",
+ "name": "writeSession",
"kind": "function",
- "path": "src/context/node-file.ts",
- "span": "L221-L229",
- "signature": "function readManifest(dir: string): Manifest | undefined",
+ "path": "src/claude/state.ts",
+ "span": "L55-L57",
+ "signature": "function writeSession(d: string, id: string, s: SessionState): void",
"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"
- }
+ "body_hash": "a8eead65e532c3c1791cffad444c6fd7622cdb054e1eaae5cf7e441a83d58b81",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/node-file.ts#readNodes",
- "name": "readNodes",
+ "id": "src/claude/state.ts#writeStats",
+ "name": "writeStats",
"kind": "function",
- "path": "src/context/node-file.ts",
- "span": "L182-L198",
- "signature": "function readNodes(dir: string): ParsedNode[]",
+ "path": "src/claude/state.ts",
+ "span": "L44-L44",
+ "signature": "function writeStats(d: string, s: Stats): void",
"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"
- }
+ "body_hash": "9be95135d233dd6454caab02396b7a742dd79d3f7fc3bf7eb4ddc3d5991b56d6",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "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,
+ "id": "src/claude/stats.ts",
+ "name": "stats.ts",
+ "kind": "file",
+ "path": "src/claude/stats.ts",
+ "span": "L1-L26",
+ "signature": null,
+ "exported": true,
"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"
- }
+ "body_hash": "fc205923682e656d3e68bf301ba25702b827262f12057910615b4b648de3338b",
+ "chars": 853,
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/node-file.ts#renderNodeFile",
- "name": "renderNodeFile",
+ "id": "src/claude/stats.ts#computeStats",
+ "name": "computeStats",
"kind": "function",
- "path": "src/context/node-file.ts",
- "span": "L126-L141",
- "signature": "function renderNodeFile(node: ContextNode): string",
+ "path": "src/claude/stats.ts",
+ "span": "L12-L25",
+ "signature": "function computeStats( w: GraphV1, ): Pick<Stats, 'nodeCount' | 'edgeCount' | 'languages' | 'totalCount' | 'readyCount'>",
"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"
- }
+ "body_hash": "87947ad507814b67ebf5ac5ad9517c223db582a48a1731c266e3a2d9eb1ce289",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/node-file.ts#slugify",
- "name": "slugify",
+ "id": "src/claude/stats.ts#readWiring",
+ "name": "readWiring",
"kind": "function",
- "path": "src/context/node-file.ts",
- "span": "L81-L86",
- "signature": "function slugify(name: string): string",
+ "path": "src/claude/stats.ts",
+ "span": "L6-L10",
+ "signature": "function readWiring(projectDir: string): GraphV1 | null",
"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"
- }
+ "body_hash": "af195cd730aedc42089766e76e9e82876adbc6ee689b7b06626ad3aa90ed9ac4",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/node-file.ts#SourceRef",
- "name": "SourceRef",
- "kind": "interface",
- "path": "src/context/node-file.ts",
- "span": "L30-L33",
- "signature": "interface SourceRef",
+ "id": "src/claude/statusline.ts",
+ "name": "statusline.ts",
+ "kind": "file",
+ "path": "src/claude/statusline.ts",
+ "span": "L1-L34",
+ "signature": null,
"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"
- }
+ "body_hash": "0708f2f773f65b931d488688d898c56344cd930fae1af6614a579e6fb47fae16",
+ "chars": 1668,
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/node-file.ts#writeManifest",
- "name": "writeManifest",
+ "id": "src/claude/statusline.ts#main",
+ "name": "main",
"kind": "function",
- "path": "src/context/node-file.ts",
- "span": "L216-L219",
- "signature": "function writeManifest(dir: string, manifest: Manifest): void",
+ "path": "src/claude/statusline.ts",
+ "span": "L22-L33",
+ "signature": "function main(): 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"
- }
+ "body_hash": "bddbcc037fe00e01bb76e40b1ceed83b0a308423cc286bc4b3cc95bf9c98c825",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/context/node-file.ts#writeNode",
- "name": "writeNode",
+ "id": "src/claude/statusline.ts#resolveStats",
+ "name": "resolveStats",
"kind": "function",
- "path": "src/context/node-file.ts",
- "span": "L158-L169",
- "signature": "function writeNode(dir: string, node: ContextNode): string",
+ "path": "src/claude/statusline.ts",
+ "span": "L14-L20",
+ "signature": "function resolveStats(dir: string): Stats | null",
"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"
- }
+ "body_hash": "080c7327bf26883f0575973010484e67024f57e455022563706d85582ca08891",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/engine.ts",
- "name": "engine.ts",
+ "id": "src/claude/sync-run.ts",
+ "name": "sync-run.ts",
"kind": "file",
- "path": "src/engine.ts",
- "span": "L1-L129",
+ "path": "src/claude/sync-run.ts",
+ "span": "L1-L36",
"signature": null,
"exported": true,
"origin": "ast",
- "body_hash": "e237ef6555d8bd2001eccfc32e314ef3881cef1c79d537ee701515a357f87d16",
- "summary_state": "ready",
- "summary": "The Context Graph Engine builds and checks a code context graph from a repository without a database.",
- "crux": {
- "code": " * - {@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.",
- "span": "L5-L11"
- }
+ "body_hash": "faec4572d1c6d8803dc90ae5c19498dd7a7f85661ae979980504c626de5bdf6e",
+ "chars": 1295,
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/engine.ts#CheckRunOptions",
- "name": "CheckRunOptions",
- "kind": "interface",
- "path": "src/engine.ts",
- "span": "L33-L35",
- "signature": "interface CheckRunOptions",
+ "id": "src/claude/sync-run.ts#main",
+ "name": "main",
+ "kind": "function",
+ "path": "src/claude/sync-run.ts",
+ "span": "L29-L32",
+ "signature": "function main(): void",
"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.",
+ "body_hash": "f4921fe8ea499e226c1d9a10d551ed55efcab2c954dfe44299c23bfe7c833b5d",
+ "summary_state": "pending",
+ "summary": null,
"crux": null
},
{
- "id": "src/engine.ts#Graft",
- "name": "Graft",
- "kind": "class",
- "path": "src/engine.ts",
- "span": "L45-L128",
- "signature": "class Graft",
- "exported": true,
+ "id": "src/claude/sync-run.ts#realBuild",
+ "name": "realBuild",
+ "kind": "function",
+ "path": "src/claude/sync-run.ts",
+ "span": "L8-L11",
+ "signature": "function realBuild(dir: string): void",
+ "exported": false,
"origin": "ast",
- "body_hash": "fb35e77789763532926013366fd1fc5027bd02cac2356512d8a5813f6b409009",
- "summary_state": "ready",
- "summary": "Encapsulates methods for building and checking a context graph from a code repository.",
+ "body_hash": "5acdf6616ad5ea5e32990f2868c92bc807bbb7dc75d6348d208acb5719237415",
+ "summary_state": "pending",
+ "summary": null,
"crux": null
},
{
- "id": "src/engine.ts#Graft.ask",
- "name": "ask",
- "kind": "method",
- "path": "src/engine.ts",
- "span": "L93-L95",
- "signature": "ask(dir: string, query: string, opts: { limit?: number; source?: boolean } = {}): AskResult",
+ "id": "src/claude/sync-run.ts#runSync",
+ "name": "runSync",
+ "kind": "function",
+ "path": "src/claude/sync-run.ts",
+ "span": "L13-L27",
+ "signature": "function runSync(dir: string, build: (d: string) => void = realBuild): void",
"exported": true,
"origin": "ast",
- "body_hash": "d076ef89fe91fba4be041009db20e1ff2c709af57fb09103720cb2384f5693c7",
- "summary_state": "ready",
- "summary": "Processes a query against the committed graph to return relevant information based on structural and lexical ranking.",
- "crux": {
- "code": " ask(dir: string, query: string, opts: { limit?: number; source?: boolean } = {}): AskResult {",
- "span": "L93-L93"
- }
+ "body_hash": "31c8d6625fe3855ae2c854d45a6364ad66759b9098596ddacb95b9b8f883fccc",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "src/engine.ts#Graft.check",
- "name": "check",
- "kind": "method",
- "path": "src/engine.ts",
- "span": "L65-L67",
- "signature": "check(dir: string, opts: CheckRunOptions = {}): CheckResult",
+ "id": "src/cli.ts",
+ "name": "cli.ts",
+ "kind": "file",
+ "path": "src/cli.ts",
+ "span": "L1-L187",
+ "signature": null,
"exported": true,
"origin": "ast",
- "body_hash": "c0ef54370f24e88b0dfc83f2dd21d3db0a44c44538b3ec8bd54d38fac8be2c49",
+ "body_hash": "ba1d90ee4c0f7b5000fa4239461c19d54fdedcad12b8592589312f163e1357dc",
+ "chars": 8003,
"summary_state": "ready",
- "summary": "Checks if the committed context graph is in sync with the code in the specified directory.",
+ "summary": "This file implements the `graft` CLI tool for building and maintaining a context graph from code, ensuring it stays in sync with the repository.",
"crux": {
- "code": " check(dir: string, opts: CheckRunOptions = {}): CheckResult {\n return checkContext(dir, { contextDir: this.cfg.contextDir, extensions: opts.extensions });\n }",
- "span": "L63-L65"
+ "code": "program\n .name(\"graft\")\n .description(\"Build a repo's context graph as linked markdown, and keep it in sync with the code.\")",
+ "span": "L22-L24"
}
},
{
- "id": "src/engine.ts#Graft.checkGraph",
- "name": "checkGraph",
- "kind": "method",
- "path": "src/engine.ts",
- "span": "L70-L72",
- "signature": "checkGraph(dir: string): GraphCheckResult",
- "exported": true,
+ "id": "src/cli.ts#engineFrom",
+ "name": "engineFrom",
+ "kind": "function",
+ "path": "src/cli.ts",
+ "span": "L27-L30",
+ "signature": "function engineFrom(): Graft",
+ "exported": false,
"origin": "ast",
- "body_hash": "eda4bef32536dd54b29cba56c59d4ea971625167a482e8fe15c5d799be81f870",
+ "body_hash": "ddbb4f4e57bee5d05b95dc81f034e26183495162d84c6a290e12c6fda6c92ee8",
"summary_state": "ready",
- "summary": "Verifies if the committed graph.json file is in sync with the code, focusing on the Tier-1 differences.",
+ "summary": "Creates an instance of the Graft engine configured with the specified context directory.",
"crux": {
- "code": " checkGraph(dir: string): GraphCheckResult {\n return checkGraph(dir, { contextDir: this.cfg.contextDir });\n }",
- "span": "L68-L70"
+ "code": " return new Graft({ contextDir: opts.dir });",
+ "span": "L28-L28"
}
},
{
- "id": "src/engine.ts#Graft.constructor",
- "name": "constructor",
- "kind": "method",
- "path": "src/engine.ts",
- "span": "L48-L50",
- "signature": "constructor(config: EngineConfig = {})",
- "exported": true,
+ "id": "src/cli.ts#fmt",
+ "name": "fmt",
+ "kind": "function",
+ "path": "src/cli.ts",
+ "span": "L49-L53",
+ "signature": "fmt = (o: Record<string, number>)",
+ "exported": false,
"origin": "ast",
- "body_hash": "374d5de4021aadc3150f3cb521b536653584976599a4956fea4b26c40131c19f",
+ "body_hash": "31c01b913d716a1932fff4c3a0e4a82dfa745d73f488f05b3d71910145bf98ad",
"summary_state": "ready",
- "summary": "Initializes the Graft class with a configuration, resolving the necessary settings for the context graph.",
+ "summary": "Formats a record of counts into a human-readable string for console output.",
"crux": {
- "code": " constructor(config: EngineConfig = {}) {\n this.cfg = resolveConfig(config);\n }",
- "span": "L46-L48"
+ "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/engine.ts#Graft.cruxSummarizer",
- "name": "cruxSummarizer",
- "kind": "method",
- "path": "src/engine.ts",
- "span": "L114-L116",
- "signature": "private cruxSummarizer(): CruxSummarizer",
+ "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": "3b07279c83115a1232de5b510ce2f501f8699e7b8c70a052c4c455e136f01ca6",
+ "body_hash": "8c614e5dc6b1ef2d6949016ce7480099f95f021ea6b0882f2919397f97a68ce7",
+ "chars": 11678,
"summary_state": "ready",
- "summary": "Creates a crux summarizer for the code graph's Tier-2 pass, ensuring it is properly configured.",
+ "summary": "This file builds a context graph from a code repository by summarizing source files and synthesizing nodes.",
"crux": {
- "code": " private cruxSummarizer(): CruxSummarizer {\n return new OpenRouterCruxSummarizer(this.requireKey(), this.cfg.openrouterModel, this.cfg.openrouterBaseUrl);\n }",
- "span": "L111-L113"
+ "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/engine.ts#Graft.graph",
- "name": "graph",
- "kind": "method",
- "path": "src/engine.ts",
- "span": "L79-L86",
- "signature": "graph(dir: string, opts: GraphRunOptions = {}): Promise<GraphBuildResult>",
- "exported": true,
+ "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": "cec39cf7bba0c124990ab186d6aae7ae2dcf5f17bfc56ecbef85f1fcc394050e",
+ "body_hash": "5875cfc2eae35e10fbe5105c48209f37d2b121b15dff5a0ebf1bb9dbf96f8eb7",
"summary_state": "ready",
- "summary": "Builds a per-symbol code graph from the repository, optionally using a meaning layer with LLM.",
+ "summary": "Groups file summaries into batches that fit within a specified character budget for processing.",
"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 concurrency: opts.concurrency,\n onProgress: opts.onProgress,\n });",
- "span": "L79-L85"
+ "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/engine.ts#Graft.init",
- "name": "init",
- "kind": "method",
- "path": "src/engine.ts",
- "span": "L53-L62",
- "signature": "async init(dir: string, opts: InitOptions = {}): Promise<BuildResult>",
- "exported": true,
+ "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": "7ee2e73a5a5412667db890e91f0f2abfb15b94ea1331db17aef0f841c348fbf1",
+ "body_hash": "8fece338d989b714e96a275a7d4febdf2292a4a25590ce4b3ec73d6be5b45827",
"summary_state": "ready",
- "summary": "Builds the context graph from the specified directory, utilizing various options and configurations.",
+ "summary": "Generates a stable key for a batch of file summaries based on their content hashes.",
"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"
+ "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/engine.ts#Graft.modelLabel",
- "name": "modelLabel",
- "kind": "method",
- "path": "src/engine.ts",
- "span": "L124-L127",
- "signature": "private modelLabel(): string",
- "exported": true,
+ "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": "7034c4cd5e06b1b37f2ef068736f35fddaca136a3cae2ae5e595fda7efa2bd89",
+ "body_hash": "c359f1a92e6d72b2734f0ff2f8f38879f95eca1af6ddb47c4c6cab0f62a32133",
"summary_state": "ready",
- "summary": "Determines the human-readable label for the active model used in the context graph.",
+ "summary": "Stores cached summaries and synthesized nodes to optimize the build process.",
"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"
+ "code": "interface BuildCache {\n summaries: Record<string, { hash: string; summary: string }>;\n synth: Record<string, SynthNode[]>;\n}",
+ "span": "L78-L81"
}
},
{
- "id": "src/engine.ts#Graft.requireKey",
- "name": "requireKey",
- "kind": "method",
- "path": "src/engine.ts",
- "span": "L98-L106",
- "signature": "private requireKey(): string",
+ "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": "9aed1d64896a6e8f8d3cd6c00e53f8e8baf2b424e0522d28408861b2f7c22912",
+ "body_hash": "e2afee780fd3be28d7cf55c8aa3fdfebc10ddb1ec63ffbe50f5e712a4625c0f2",
"summary_state": "ready",
- "summary": "Ensures that a valid OpenRouter API key is available, throwing an error if it is not set.",
+ "summary": "Main function that orchestrates the building of the context graph from the source files.",
"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"
+ "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/engine.ts#Graft.summarizer",
- "name": "summarizer",
- "kind": "method",
- "path": "src/engine.ts",
- "span": "L118-L121",
- "signature": "private summarizer(): Summarizer",
+ "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": "160e884c1dd10b916c36a737886880d98430fb84c5dd7828e69536b8198e3b2f",
+ "body_hash": "a8c3781581f56372337a3c3ddd980b7be084f78b359820f8540ec384807c57a8",
"summary_state": "ready",
- "summary": "Obtains the summarizer instance, initializing it if no custom summarizer is provided.",
+ "summary": "Defines options for customizing the build process, including output directory and model settings.",
"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"
+ "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/engine.ts#Graft.synthesizer",
- "name": "synthesizer",
- "kind": "method",
- "path": "src/engine.ts",
- "span": "L108-L111",
- "signature": "private synthesizer(): Synthesizer",
+ "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": "2a65f2a449bd40274d81542edfb36e20ceb8cf0160b030e8bd42b9698a386d20",
+ "body_hash": "144303735947dfd0c43c5a58e2f8d53ad35ad62b438f65c29c51a56e1dfa56b2",
"summary_state": "ready",
- "summary": "Retrieves the synthesizer instance, creating one if it is not already configured.",
+ "summary": "Tracks the progress of the build process across different phases.",
"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"
+ "code": " phase: \"summarize\" | \"synthesize\" | \"write\";\n index: number;\n total: number;\n file: string;\n}",
+ "span": "L48-L52"
}
},
{
- "id": "src/engine.ts#GraphRunOptions",
- "name": "GraphRunOptions",
- "kind": "interface",
- "path": "src/engine.ts",
- "span": "L37-L43",
- "signature": "interface GraphRunOptions",
- "exported": true,
- "origin": "ast",
- "body_hash": "424eba22dc93e6a1f2b948f40d738ef8dd9b0bf4d06d7a3d562c2c6d77443d73",
- "summary_state": "ready",
- "summary": "Defines options for running the graph building process, including LLM usage and concurrency settings.",
- "crux": null
- },
- {
- "id": "src/engine.ts#InitOptions",
- "name": "InitOptions",
+ "id": "src/context/build.ts#BuildResult",
+ "name": "BuildResult",
"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-L147",
- "signature": null,
+ "path": "src/context/build.ts",
+ "span": "L66-L75",
+ "signature": "interface BuildResult",
"exported": true,
"origin": "ast",
- "body_hash": "b18f5fc18dffd77771f39722eb19963c1188fd298cbb5cfd5d71ef8dc45658c6",
+ "body_hash": "5d4316f8de68fbeba849eaa7a8b12892855205f006361e2a32049e135cf9407e",
"summary_state": "ready",
- "summary": "This file defines the logic to build a graph representation from source code files in a repository.",
+ "summary": "Holds the results of the build process, including counts of files and nodes processed.",
"crux": {
- "code": "export async function buildGraph(\n dir: string,\n opts: GraphBuildOptions = {},\n): Promise<GraphBuildResult> {\n const root = resolve(dir);\n const outDir = contextDirFor(root, opts.contextDir);\n const files = listSourceFiles(root, outDir);\n\n const nodes: NodeV1[] = [];\n const rawEdges: RawEdge[] = [];\n const sources = new Map<string, string>();\n const langs = new Set<Language>();",
- "span": "L57-L68"
+ "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/graph/build.ts#buildGraph",
- "name": "buildGraph",
+ "id": "src/context/build.ts#cachePath",
+ "name": "cachePath",
"kind": "function",
- "path": "src/graph/build.ts",
- "span": "L57-L146",
- "signature": "async function buildGraph( dir: string, opts: GraphBuildOptions = {}, ): Promise<GraphBuildResult>",
- "exported": true,
+ "path": "src/context/build.ts",
+ "span": "L310-L312",
+ "signature": "function cachePath(outDir: string): string",
+ "exported": false,
"origin": "ast",
- "body_hash": "aa7152b35e0503aee7e9e7fdb56a5354e737f7b2c41313487906817be90776a2",
+ "body_hash": "ff252b490e39f50d7aa97d0a9fc2ad6330248f194cf27cc31981329e833fb8aa",
"summary_state": "ready",
- "summary": "This function orchestrates the process of reading source files, extracting nodes and edges, and writing the resulting graph to a file.",
+ "summary": "Constructs the file path for the cache storage based on the output directory.",
"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 concurrency: opts.concurrency,\n onProgress: ({ index, total, node }) =>\n opts.onProgress?.({ phase: \"enrich\", index, total, file: node }),\n });",
- "span": "L93-L104"
+ "code": "function cachePath(outDir: string): string {\n return join(outDir, CACHE_DIR, \"summaries.json\");\n}",
+ "span": "L310-L312"
}
},
{
- "id": "src/graph/build.ts#GraphBuildOptions",
- "name": "GraphBuildOptions",
- "kind": "interface",
- "path": "src/graph/build.ts",
- "span": "L22-L35",
- "signature": "interface GraphBuildOptions",
- "exported": true,
+ "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": "09dc36c486449d7e17f9fe9ddb0fbed6ba20104b28ff1ab6f38a1de344975ea8",
+ "body_hash": "79993b725e730fcec35e4a32479a51dfba694b5c9bf900db729b6fc821caee71",
"summary_state": "ready",
- "summary": "This interface specifies options for customizing the graph build process, including output directory and summarization settings.",
- "crux": null
+ "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/graph/build.ts#GraphBuildResult",
- "name": "GraphBuildResult",
+ "id": "src/context/build.ts#FileWork",
+ "name": "FileWork",
"kind": "interface",
- "path": "src/graph/build.ts",
- "span": "L37-L50",
- "signature": "interface GraphBuildResult",
- "exported": true,
+ "path": "src/context/build.ts",
+ "span": "L83-L87",
+ "signature": "interface FileWork",
+ "exported": false,
"origin": "ast",
- "body_hash": "66898435298552c740219c8ca50f06d430551bf605b2903064a6459db0095ec3",
+ "body_hash": "06db66a9c25581eac975d533a049ce38bfed463080492389915feb84d9634171",
"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
+ "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/graph/build.ts#listSourceFiles",
- "name": "listSourceFiles",
+ "id": "src/context/build.ts#loadCache",
+ "name": "loadCache",
"kind": "function",
- "path": "src/graph/build.ts",
- "span": "L53-L55",
- "signature": "function listSourceFiles(root: string, outDir: string): string[]",
- "exported": true,
+ "path": "src/context/build.ts",
+ "span": "L314-L325",
+ "signature": "function loadCache(outDir: string): BuildCache",
+ "exported": false,
"origin": "ast",
- "body_hash": "09c58d7bb3b7c55ef5688af18f41e0d4eda5c4cb444a9ffb3290697794834ba0",
+ "body_hash": "8f0f4b949cd4d774433b4043ef9d154fa5722e45d19f69fb4fb1843c4071a3af",
"summary_state": "ready",
- "summary": "This function retrieves a list of source files from a given directory, excluding the output directory and unsupported languages.",
+ "summary": "Loads the build cache from disk, returning existing summaries and synthesized nodes.",
"crux": {
- "code": " return walkDir(root).filter((f) => !f.startsWith(outDir) && languageOf(f) !== null);",
- "span": "L52-L52"
+ "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/graph/cards.ts",
- "name": "cards.ts",
- "kind": "file",
- "path": "src/graph/cards.ts",
- "span": "L1-L282",
- "signature": null,
- "exported": true,
+ "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": "c45f4bd1be271a9c5ff01c04bae2a2d4fd761eb85bd8d4a302738e6744e636b1",
+ "body_hash": "a4c9438ba7cb397b91c5ab695f081e20db5678db9eea0be35a086fda1d9714e5",
"summary_state": "ready",
- "summary": "This module generates markdown cards that summarize source files and their symbols, facilitating easier navigation and understanding of the codebase.",
- "crux": null
+ "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/graph/cards.ts#CardFileInfo",
- "name": "CardFileInfo",
+ "id": "src/context/build.ts#NodeDraft",
+ "name": "NodeDraft",
"kind": "interface",
- "path": "src/graph/cards.ts",
- "span": "L26-L32",
- "signature": "interface CardFileInfo",
- "exported": true,
+ "path": "src/context/build.ts",
+ "span": "L90-L97",
+ "signature": "interface NodeDraft",
+ "exported": false,
"origin": "ast",
- "body_hash": "bc918882882be5be102c1a9ff1127e100c3fe83f380828d8d62ad1063693d6db",
+ "body_hash": "8ced91ed9a81f2acf4c6047b5091d9d972531cda6c94dfeacd8f52032a37e479",
"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
+ "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/graph/cards.ts#cardPathFor",
- "name": "cardPathFor",
+ "id": "src/context/build.ts#registerName",
+ "name": "registerName",
"kind": "function",
- "path": "src/graph/cards.ts",
- "span": "L41-L44",
- "signature": "function cardPathFor(outDir: string, sourcePath: string): string",
+ "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": "af75114def2a26067a8f595c3937bb3e8aea6f257205de146b435f804729c1cc",
+ "body_hash": "19baf28fe22be9ee095b9158cc475114b372193f75407ad731aff306f455d432",
"summary_state": "ready",
- "summary": "Constructs the markdown file path for a card by replacing the source file's extension with .md.",
+ "summary": "Registers a name and its corresponding slug in a mapping table to avoid duplicates.",
"crux": {
- "code": " const md = sourcePath.replace(/\\.[^./]+$/, \"\") + \".md\";\n return join(outDir, md);",
- "span": "L42-L43"
+ "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/graph/cards.ts#CardStats",
- "name": "CardStats",
- "kind": "interface",
- "path": "src/graph/cards.ts",
- "span": "L34-L38",
- "signature": "interface CardStats",
- "exported": true,
+ "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": "1c3e57e9c5bf329c4248f01c551c6d0a2a9af394980dbe537f026c15c933fe58",
+ "body_hash": "e3b335543a5eb9e316abcb762fcc43a8e66ef10b9217c3b5682958d58eccb40b",
"summary_state": "ready",
- "summary": "Tracks the statistics of card generation, including how many cards were written and pruned.",
- "crux": null
+ "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/graph/cards.ts#conceptsByPath",
- "name": "conceptsByPath",
+ "id": "src/context/build.ts#saveCache",
+ "name": "saveCache",
"kind": "function",
- "path": "src/graph/cards.ts",
- "span": "L60-L70",
- "signature": "function conceptsByPath(outDir: string): Map<string, string[]>",
+ "path": "src/context/build.ts",
+ "span": "L327-L331",
+ "signature": "function saveCache(outDir: string, cache: BuildCache): void",
"exported": false,
"origin": "ast",
- "body_hash": "ea08d13224b288f66ba9378d392b955657db6661dee7d33b3c68ad04cf5594b1",
+ "body_hash": "858a9e1dd3769382de94bbf1c7dc76b4c137a777872fca251d2d214eb185a6e3",
"summary_state": "ready",
- "summary": "Maps source paths to their corresponding concept node slugs, facilitating the creation of up-links in cards.",
+ "summary": "Saves the current build cache to disk to persist summaries and synthesized nodes.",
"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"
+ "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/graph/cards.ts#CoverRef",
- "name": "CoverRef",
- "kind": "interface",
- "path": "src/graph/cards.ts",
- "span": "L225-L230",
- "signature": "interface CoverRef",
+ "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": "b905acf1827c4b1c7b212eee322bfffb6ef0bea196277d5c20e66157c11ada8f",
+ "body_hash": "2444e1f4dfd78208a9b54942364ee1811d064459857c6d6cee178426e278d481",
+ "chars": 4846,
"summary_state": "ready",
- "summary": "Represents a symbol covered by a concept node, including its name, kind, and location.",
- "crux": null
+ "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/graph/cards.ts#listExistingCards",
- "name": "listExistingCards",
+ "id": "src/context/check.ts#checkContext",
+ "name": "checkContext",
"kind": "function",
- "path": "src/graph/cards.ts",
- "span": "L102-L121",
- "signature": "function listExistingCards(outDir: string): string[]",
- "exported": false,
+ "path": "src/context/check.ts",
+ "span": "L37-L107",
+ "signature": "function checkContext(dir: string, opts: CheckOptions = {}): CheckResult",
+ "exported": true,
"origin": "ast",
- "body_hash": "8b1734950dc59ac84f5de645a42350d5024837fe4b4ace980c469f68649fd1a2",
+ "body_hash": "06ef9cdf299314884c2c167ef2b07261c310fa4973c392ec8f951354e4657195",
"summary_state": "ready",
- "summary": "Lists all existing markdown card files in the output directory, excluding concept nodes and specific top-level files.",
+ "summary": "Checks the current state of the context graph against the recorded manifest, identifying any content drift, removals, or coverage issues.",
"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"
+ "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/graph/cards.ts#listExistingCards.walk",
- "name": "walk",
- "kind": "function",
- "path": "src/graph/cards.ts",
- "span": "L104-L113",
- "signature": "walk = (dir: string): void",
- "exported": false,
+ "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": "ba6dde008e5cbd07399e992182055ae60636e68a4acfa2457d3cf8f317b1dc84",
+ "body_hash": "9ea98ccd24c4398fa3c15b57991778a2c5f300000220e01c3e36e0b52093f097",
"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"
- }
+ "summary": "Specifies optional parameters for the checkContext function, allowing customization of the context directory and file extensions to check.",
+ "crux": null
},
{
- "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,
+ "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": "f164d443f9ca9ab5785a61f1cd21b9fee70b0d444dc9161f8f79b26dae28b571",
+ "body_hash": "91144295d6967be1d7e9675698c39f552001f149346f052f92582dcb23353a6c",
"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"
- }
+ "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/graph/cards.ts#pruneEmptyDirs",
- "name": "pruneEmptyDirs",
+ "id": "src/context/check.ts#formatCheckReport",
+ "name": "formatCheckReport",
"kind": "function",
- "path": "src/graph/cards.ts",
- "span": "L124-L144",
- "signature": "function pruneEmptyDirs(outDir: string): void",
- "exported": false,
+ "path": "src/context/check.ts",
+ "span": "L110-L135",
+ "signature": "function formatCheckReport(r: CheckResult): string",
+ "exported": true,
"origin": "ast",
- "body_hash": "7c58c5eb58948bd353fa0eaf6db614a6f3a66943f10e422352dbb62a67308d46",
+ "body_hash": "b1b96c36f7f186373c1d51db9acd9b9a975e7197a9a75d8c4cd8e821990228d3",
"summary_state": "ready",
- "summary": "Removes empty directories from the output directory, ensuring a clean structure after card generation.",
+ "summary": "Generates a human-readable report summarizing the results of the checkContext function, detailing any discrepancies found.",
"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"
+ "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/graph/cards.ts#pruneEmptyDirs.visit",
- "name": "visit",
+ "id": "src/context/check.ts#short",
+ "name": "short",
"kind": "function",
- "path": "src/graph/cards.ts",
- "span": "L125-L142",
- "signature": "visit = (dir: string): boolean",
+ "path": "src/context/check.ts",
+ "span": "L137-L139",
+ "signature": "function short(hash: string): string",
"exported": false,
"origin": "ast",
- "body_hash": "f92031cda975f10bd7b09706f2b6ad09399ac06897c6ed89afd114ccd1032e7e",
+ "body_hash": "174b5d08d0283571566816317520c72d2d9a1416f660ce45a854c34aa4cb45e6",
"summary_state": "ready",
- "summary": "Visits directories to determine if they are empty after processing their contents.",
+ "summary": "Shortens a hash string to its first eight characters for easier readability in reports.",
"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"
+ "code": "function short(hash: string): string {\n return hash.slice(0, 8);\n}",
+ "span": "L137-L139"
}
},
{
- "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,
+ "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": "6f1076c555ccd93979599e6ab7a7c3f5e7ec69f8dfc9c12893ed5caf0052cdf3",
+ "body_hash": "9e958d74597b4d6d31fa5391882ddab8faab4076d7d33f93de861ab6c2e0b93a",
+ "chars": 8479,
"summary_state": "ready",
- "summary": "Generates the markdown content for a card, including the source file's summary and its symbols.",
+ "summary": "This file defines the structure and operations for managing a context graph represented as markdown files.",
"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"
+ "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/graph/cards.ts#spanStart",
- "name": "spanStart",
+ "id": "src/context/node-file.ts#contextDirFor",
+ "name": "contextDirFor",
"kind": "function",
- "path": "src/graph/cards.ts",
- "span": "L47-L50",
- "signature": "function spanStart(span: string): number",
- "exported": false,
+ "path": "src/context/node-file.ts",
+ "span": "L100-L103",
+ "signature": "function contextDirFor(root: string, override?: string): string",
+ "exported": true,
"origin": "ast",
- "body_hash": "c556d0ee70964557755678794a12cb22fe0f72f158ec186e32975ff01e8d44eb",
+ "body_hash": "bff3e70e01fbfde31e41893ba3bc3d41dc29b9359c55dd9333670aa02aecc088",
"summary_state": "ready",
- "summary": "Extracts the starting line number from a given span string, returning 0 if the format is unparseable.",
+ "summary": "Determines the absolute path for the graft directory in a repository, allowing for file operations.",
"crux": {
- "code": " const m = /^L(\\d+)/.exec(span);\n return m ? Number(m[1]) : 0;",
- "span": "L48-L49"
+ "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/graph/cards.ts#writeCards",
- "name": "writeCards",
- "kind": "function",
- "path": "src/graph/cards.ts",
- "span": "L150-L183",
- "signature": "function writeCards(graph: GraphV1, outDir: string): CardStats",
+ "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": "ef71834ba8bfb9f009b04afe5a3d63bb0d3a2e44384377cd02045a57c18e28c6",
+ "body_hash": "6cb97dab12942b8742efa5c785547222aa0350e75d994ccc99f0e1867f1e09d3",
"summary_state": "ready",
- "summary": "Writes markdown cards for each source file, reflecting the source tree and pruning any outdated cards.",
+ "summary": "Models a single node in the context graph, encapsulating its metadata and relationships.",
"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"
+ "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/graph/cards.ts#writeCovers",
- "name": "writeCovers",
+ "id": "src/context/node-file.ts#defaultHuman",
+ "name": "defaultHuman",
"kind": "function",
- "path": "src/graph/cards.ts",
- "span": "L245-L281",
- "signature": "function writeCovers(graph: GraphV1, outDir: string): number",
- "exported": true,
+ "path": "src/context/node-file.ts",
+ "span": "L121-L123",
+ "signature": "function defaultHuman(): string",
+ "exported": false,
"origin": "ast",
- "body_hash": "09f3d72e14a6ded303111818b4b4d8edce65b6f7e807e521001ca0b6eca973ba",
+ "body_hash": "ea0f628a1792282addf319eaa6469945e4229bacdbba7ad9b44854bd5bfb5373",
"summary_state": "ready",
- "summary": "Backfills concept nodes with a list of symbols they cover, enhancing their metadata for better navigation.",
+ "summary": "Provides a default human-readable section for a new node, which is preserved in future generations.",
"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"
+ "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/graph/cards.ts#writeIndex",
- "name": "writeIndex",
+ "id": "src/context/node-file.ts#deleteNode",
+ "name": "deleteNode",
"kind": "function",
- "path": "src/graph/cards.ts",
- "span": "L189-L222",
- "signature": "function writeIndex(outDir: string, files: CardFileInfo[]): void",
+ "path": "src/context/node-file.ts",
+ "span": "L211-L214",
+ "signature": "function deleteNode(dir: string, slug: string): void",
"exported": true,
"origin": "ast",
- "body_hash": "e2e95c9595a5386036af4f9beeda3897fe1b22e53fcb5d79d2c07fa3276481c1",
+ "body_hash": "49e161325092c3caf6c1b6d39d78b2d948445dd7609a72f9490e4898e9a973d3",
"summary_state": "ready",
- "summary": "This function creates an index markdown file that lists concept nodes and per-file cards, providing a quick reference for navigating the repository.",
+ "summary": "Deletes a specified node file from the filesystem, if it exists.",
"crux": {
- "code": " \"# 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\", \"\");\n for (const c of concepts) {",
- "span": "L191-L202"
+ "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/graph/check.ts",
- "name": "check.ts",
- "kind": "file",
- "path": "src/graph/check.ts",
- "span": "L1-L136",
- "signature": null,
+ "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": "5358023fe498fb2878e3aa9b6756272c39926dda865c6495d8f33d13c5ceb376",
+ "body_hash": "4c53e7543bc40ada4b0b0d853a6af071965175bef7b90980fa911149b2d691db",
"summary_state": "ready",
- "summary": "Ensures that the committed graph.json accurately reflects the current state of the codebase, identifying any discrepancies.",
+ "summary": "Calculates a SHA256 hash over the sorted lines of source file paths and hashes to ensure integrity.",
"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"
+ "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/graph/check.ts#checkGraph",
- "name": "checkGraph",
+ "id": "src/context/node-file.ts#existingNodeSlugs",
+ "name": "existingNodeSlugs",
"kind": "function",
- "path": "src/graph/check.ts",
- "span": "L43-L101",
- "signature": "function checkGraph(dir: string, opts: GraphCheckOptions = {}): GraphCheckResult",
+ "path": "src/context/node-file.ts",
+ "span": "L201-L208",
+ "signature": "function existingNodeSlugs(dir: string): Set<string>",
"exported": true,
"origin": "ast",
- "body_hash": "992b2d4efeb36d881a5818fd98f1de4be119e1c5597e207578b55bbe40797aca",
+ "body_hash": "2f1f56206f2ae542e8cfaeebc0e3b9cc3e245a83f5ed7c70e4124d3d985a6403",
"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.",
+ "summary": "Lists the slugs of existing node files in a directory, aiding in the management of deleted 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"
+ "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/graph/check.ts#formatGraphCheckReport",
- "name": "formatGraphCheckReport",
- "kind": "function",
- "path": "src/graph/check.ts",
- "span": "L104-L135",
- "signature": "function formatGraphCheckReport(r: GraphCheckResult): string",
+ "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": "a2489371664b6c2729925dffd9852c85aecbd21a019f72549435ce51a4113b86",
+ "body_hash": "5caafb5633830210bfe7a9d72a8d202f01560f80e2195995013a437e5ab59202",
"summary_state": "ready",
- "summary": "Generates a human-readable report summarizing the results of the graph check, indicating any issues found.",
+ "summary": "Represents the generated index of all nodes and their metadata for quick access and integrity checks.",
"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"
+ "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/graph/check.ts#GraphCheckOptions",
- "name": "GraphCheckOptions",
+ "id": "src/context/node-file.ts#NodeLink",
+ "name": "NodeLink",
"kind": "interface",
- "path": "src/graph/check.ts",
- "span": "L39-L41",
- "signature": "interface GraphCheckOptions",
+ "path": "src/context/node-file.ts",
+ "span": "L36-L40",
+ "signature": "interface NodeLink",
"exported": true,
"origin": "ast",
- "body_hash": "deb14aad6be2a49d6d6d059a64a4eb55a7041a039cbabf92c55222647c2b0679",
+ "body_hash": "126d9b834cb0560714092dabc06b13ac71402695d797a7b770040112c180d9a5",
"summary_state": "ready",
- "summary": "This interface provides optional parameters for configuring the context directory when performing a graph check.",
- "crux": null
+ "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/graph/check.ts#GraphCheckResult",
- "name": "GraphCheckResult",
+ "id": "src/context/node-file.ts#ParsedNode",
+ "name": "ParsedNode",
"kind": "interface",
- "path": "src/graph/check.ts",
- "span": "L27-L37",
- "signature": "interface GraphCheckResult",
+ "path": "src/context/node-file.ts",
+ "span": "L172-L179",
+ "signature": "interface ParsedNode",
"exported": true,
"origin": "ast",
- "body_hash": "8b12129196b2a1b6d3c7a45a086708e123527cbc0417ce5db07a710a853719c0",
+ "body_hash": "1ffb557b4f3f224db4f31fd909bd40d4c25dfe521a4ce551e984167aa6365954",
"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
+ "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/graph/enrich.ts",
- "name": "enrich.ts",
- "kind": "file",
- "path": "src/graph/enrich.ts",
- "span": "L1-L213",
- "signature": null,
+ "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": "c15a0aef99e54d4c24ac748a9b33373512f1511b1f5bcd830f9d2e407ff47917",
+ "body_hash": "0e0c22b3cdad566ef833ddc0a4cc2e7be2c262ce50ecc63fbc2c7431c83d2549",
"summary_state": "ready",
- "summary": "This file implements a mechanism to enrich graph nodes with summaries and cruxes based on their state and prior computations.",
+ "summary": "Reads and parses the manifest file from disk, returning its contents or undefined if not found.",
"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": "L56-L67"
+ "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/graph/enrich.ts#buildCrux",
- "name": "buildCrux",
+ "id": "src/context/node-file.ts#readNodes",
+ "name": "readNodes",
"kind": "function",
- "path": "src/graph/enrich.ts",
- "span": "L188-L203",
- "signature": "function buildCrux(r: NodeCrux, node: NodeV1, source: string, lineCount: number): Crux | null",
- "exported": false,
+ "path": "src/context/node-file.ts",
+ "span": "L182-L198",
+ "signature": "function readNodes(dir: string): ParsedNode[]",
+ "exported": true,
"origin": "ast",
- "body_hash": "b8e82b1a1f721cdba2a3ff1a6d46db8b30a0048178d7c7e7df0731e60c059a81",
+ "body_hash": "55afcb307fdd33693c8eec1154da27f67cf834744c42e4b061eb99f646592eb0",
"summary_state": "ready",
- "summary": "Extracts and formats the crux text from a source file based on the model's provided line range.",
+ "summary": "Reads and parses all markdown node files in a specified directory, returning their metadata.",
"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"
+ "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/graph/enrich.ts#collectFileCrux",
- "name": "collectFileCrux",
+ "id": "src/context/node-file.ts#renderGenerated",
+ "name": "renderGenerated",
"kind": "function",
- "path": "src/graph/enrich.ts",
- "span": "L161-L181",
- "signature": "async function collectFileCrux( summarizer: CruxSummarizer, path: string, source: string, refs: NodeRef[], ): Promise<{ results: Map<string, NodeCrux>; error?: string }>",
+ "path": "src/context/node-file.ts",
+ "span": "L106-L118",
+ "signature": "function renderGenerated(node: ContextNode): string",
"exported": false,
"origin": "ast",
- "body_hash": "e549b76d14ae5d596c084dd5f655bded2092a36e3505ff6135c054ccf043efda",
+ "body_hash": "2e1f760d1c196c9bcbef16789bdb3d3860fc7c406e1b5f5745e7cf4bbe1f40f0",
"summary_state": "ready",
- "summary": "Collects crux information for nodes in a file, handling potential errors and ensuring partial results are returned.",
+ "summary": "Generates the markdown content for the summary and related links of a node.",
"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"
+ "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/graph/enrich.ts#enrichGraph",
- "name": "enrichGraph",
+ "id": "src/context/node-file.ts#renderNodeFile",
+ "name": "renderNodeFile",
"kind": "function",
- "path": "src/graph/enrich.ts",
- "span": "L48-L136",
- "signature": "async function enrichGraph( nodes: NodeV1[], prior: Map<string, NodeV1>, sources: Map<string, string>, opts: EnrichOptions = {}, ): Promise<EnrichStats>",
+ "path": "src/context/node-file.ts",
+ "span": "L126-L141",
+ "signature": "function renderNodeFile(node: ContextNode): string",
"exported": true,
"origin": "ast",
- "body_hash": "f740a8a6957661bd4bedddbe0cbb0c5541e30a3b303cbd01830cf761644e0801",
+ "body_hash": "f064173ff3e72f9f7f703694379edf165ba55d72949f4e6f097118e8e9d79a96",
"summary_state": "ready",
- "summary": "This function processes graph nodes to update their summaries and cruxes based on their state and prior data, potentially invoking an LLM for new computations.",
+ "summary": "Serializes a node into its complete markdown file format, including generated and human sections.",
"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": "L56-L67"
+ "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/graph/enrich.ts#EnrichOptions",
- "name": "EnrichOptions",
- "kind": "interface",
- "path": "src/graph/enrich.ts",
- "span": "L31-L38",
- "signature": "interface EnrichOptions",
+ "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": "a721d24d1e8ad1777bd74f54cdc1f4edcc55d3576b065557a0b10b3fe4b4a183",
+ "body_hash": "70fca5f67f42bcb40f42175a26795d6a6ac72953f62ada7775a91d8300581fb0",
"summary_state": "ready",
- "summary": "This interface defines options for enriching graph nodes, including whether to compute new summaries and the level of concurrency for processing.",
- "crux": null
+ "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/graph/enrich.ts#EnrichStats",
- "name": "EnrichStats",
+ "id": "src/context/node-file.ts#SourceRef",
+ "name": "SourceRef",
"kind": "interface",
- "path": "src/graph/enrich.ts",
- "span": "L40-L46",
- "signature": "interface EnrichStats",
+ "path": "src/context/node-file.ts",
+ "span": "L30-L33",
+ "signature": "interface SourceRef",
"exported": true,
"origin": "ast",
- "body_hash": "63a93dfdf61c8da0d3a05c601b74619ad84942d37425b4391b8da2b01d2d694c",
+ "body_hash": "2603554df891243f1f9c13ab6639a48627c787e5869c2bf692fdd481ae5050dd",
"summary_state": "ready",
- "summary": "Tracks the statistics of the enrichment process, including counts of cached, computed, stale, and pending nodes.",
- "crux": null
+ "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/graph/enrich.ts#mapWithConcurrency",
- "name": "mapWithConcurrency",
+ "id": "src/context/node-file.ts#writeManifest",
+ "name": "writeManifest",
"kind": "function",
- "path": "src/graph/enrich.ts",
- "span": "L139-L154",
- "signature": "async function mapWithConcurrency<T, R>( items: T[], limit: number, fn: (item: T, index: number) => Promise<R>, ): Promise<R[]>",
- "exported": false,
+ "path": "src/context/node-file.ts",
+ "span": "L216-L219",
+ "signature": "function writeManifest(dir: string, manifest: Manifest): void",
+ "exported": true,
"origin": "ast",
- "body_hash": "a4c9438ba7cb397b91c5ab695f081e20db5678db9eea0be35a086fda1d9714e5",
+ "body_hash": "049e90311a97eda62d11bd8b35ed1debded19d6f06daa975c938287943e22d88",
"summary_state": "ready",
- "summary": "This function executes a provided asynchronous function over a list of items with a specified limit on concurrent executions, preserving the order of results.",
- "crux": null
+ "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/graph/enrich.ts#spanLines",
- "name": "spanLines",
+ "id": "src/context/node-file.ts#writeNode",
+ "name": "writeNode",
"kind": "function",
- "path": "src/graph/enrich.ts",
- "span": "L206-L212",
- "signature": "function spanLines(span: string, fileLines: number): [number, number]",
- "exported": false,
+ "path": "src/context/node-file.ts",
+ "span": "L158-L169",
+ "signature": "function writeNode(dir: string, node: ContextNode): string",
+ "exported": true,
"origin": "ast",
- "body_hash": "d7f074949c35eaa3f883194e41cda61c34a624a66ec368ef352dc7f0b2e7e256",
+ "body_hash": "78ec07695ac8cf3949025497d7f56b47e5b8f0c16d6eb1dbe237c1ecc3e2fffe",
"summary_state": "ready",
- "summary": "Parses a line span string into a clamped range of line numbers, ensuring valid boundaries.",
- "crux": null
+ "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/graph/extract.ts",
- "name": "extract.ts",
+ "id": "src/engine.ts",
+ "name": "engine.ts",
"kind": "file",
- "path": "src/graph/extract.ts",
- "span": "L1-L298",
+ "path": "src/engine.ts",
+ "span": "L1-L129",
"signature": null,
"exported": true,
"origin": "ast",
- "body_hash": "58cd002d5ee7dfb750cb85293a795148ffbec31e68e2a9b693e0794543a7f727",
+ "body_hash": "e237ef6555d8bd2001eccfc32e314ef3881cef1c79d537ee701515a357f87d16",
+ "chars": 5112,
"summary_state": "ready",
- "summary": "This module extracts structured data from source files into a normalized format for further processing.",
+ "summary": "The Context Graph Engine builds and checks a code context graph from a repository without a database.",
"crux": {
- "code": " return { nodes, rawEdges };",
- "span": "L126-L126"
+ "code": " * - {@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.",
+ "span": "L5-L11"
}
},
{
- "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,
+ "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": "06353b6cf0a05cf60bad712082837f52c169e6db9209488f1ee04ea22bef8082",
+ "body_hash": "705bea732f08c471e6566f8b6621038988554944b4bf9eca74674cdf518bf9b1",
"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"
- }
+ "summary": "Specifies options for checking the context graph, allowing for code extensions to be included.",
+ "crux": null
},
{
- "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,
+ "id": "src/engine.ts#Graft",
+ "name": "Graft",
+ "kind": "class",
+ "path": "src/engine.ts",
+ "span": "L45-L128",
+ "signature": "class Graft",
+ "exported": true,
"origin": "ast",
- "body_hash": "38343faa35f42e41e98c93d6816454cfe294123505d2bae14f045624cf6d80e1",
+ "body_hash": "fb35e77789763532926013366fd1fc5027bd02cac2356512d8a5813f6b409009",
"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"
- }
+ "summary": "Encapsulates methods for building and checking a context graph from a code repository.",
+ "crux": null
},
{
- "id": "src/graph/extract.ts#DefDescriptor",
- "name": "DefDescriptor",
- "kind": "interface",
- "path": "src/graph/extract.ts",
- "span": "L87-L92",
- "signature": "interface DefDescriptor",
- "exported": false,
+ "id": "src/engine.ts#Graft.ask",
+ "name": "ask",
+ "kind": "method",
+ "path": "src/engine.ts",
+ "span": "L93-L95",
+ "signature": "ask(dir: string, query: string, opts: { limit?: number; source?: boolean } = {}): AskResult",
+ "exported": true,
"origin": "ast",
- "body_hash": "414875473c4cf1728483558f5354b6f37c279d2bc49393b3b93322a9573a7f00",
+ "body_hash": "d076ef89fe91fba4be041009db20e1ff2c709af57fb09103720cb2384f5693c7",
"summary_state": "ready",
- "summary": "Describes a definition in the syntax tree, including its name and type.",
- "crux": null
+ "summary": "Processes a query against the committed graph to return relevant information based on structural and lexical ranking.",
+ "crux": {
+ "code": " ask(dir: string, query: string, opts: { limit?: number; source?: boolean } = {}): AskResult {",
+ "span": "L93-L93"
+ }
},
{
- "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,
+ "id": "src/engine.ts#Graft.check",
+ "name": "check",
+ "kind": "method",
+ "path": "src/engine.ts",
+ "span": "L65-L67",
+ "signature": "check(dir: string, opts: CheckRunOptions = {}): CheckResult",
+ "exported": true,
"origin": "ast",
- "body_hash": "9a6919ff2bed807cf790adcea3b0d423db94baa10fc2069514e0c20c1b5f7117",
+ "body_hash": "c0ef54370f24e88b0dfc83f2dd21d3db0a44c44538b3ec8bd54d38fac8be2c49",
"summary_state": "ready",
- "summary": "Identifies and describes definitions in the syntax tree based on their node types.",
+ "summary": "Checks if the committed context graph is in sync with the code in the specified directory.",
"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"
+ "code": " check(dir: string, opts: CheckRunOptions = {}): CheckResult {\n return checkContext(dir, { contextDir: this.cfg.contextDir, extensions: opts.extensions });\n }",
+ "span": "L63-L65"
}
},
{
- "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",
+ "id": "src/engine.ts#Graft.checkGraph",
+ "name": "checkGraph",
+ "kind": "method",
+ "path": "src/engine.ts",
+ "span": "L70-L72",
+ "signature": "checkGraph(dir: string): GraphCheckResult",
"exported": true,
"origin": "ast",
- "body_hash": "464dc6d27977ade3cd0a52213f5cc1b963e4dfafc328cc1e059925bac9c9436d",
+ "body_hash": "eda4bef32536dd54b29cba56c59d4ea971625167a482e8fe15c5d799be81f870",
"summary_state": "ready",
- "summary": "Extracts nodes and edges from a source file based on its syntax tree.",
+ "summary": "Verifies if the committed graph.json file is in sync with the code, focusing on the Tier-1 differences.",
"crux": {
- "code": " return { nodes, rawEdges };",
- "span": "L126-L126"
+ "code": " checkGraph(dir: string): GraphCheckResult {\n return checkGraph(dir, { contextDir: this.cfg.contextDir });\n }",
+ "span": "L68-L70"
}
},
{
- "id": "src/graph/extract.ts#ExtractResult",
- "name": "ExtractResult",
- "kind": "interface",
- "path": "src/graph/extract.ts",
- "span": "L41-L44",
- "signature": "interface ExtractResult",
+ "id": "src/engine.ts#Graft.constructor",
+ "name": "constructor",
+ "kind": "method",
+ "path": "src/engine.ts",
+ "span": "L48-L50",
+ "signature": "constructor(config: EngineConfig = {})",
"exported": true,
"origin": "ast",
- "body_hash": "7bef2217a3edd0ae64ae3585affe29e5bc0e0f471ca1d7901910fa737e4d01af",
+ "body_hash": "374d5de4021aadc3150f3cb521b536653584976599a4956fea4b26c40131c19f",
"summary_state": "ready",
- "summary": "Holds the result of the extraction process, containing nodes and raw edges.",
- "crux": null
+ "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/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,
+ "id": "src/engine.ts#Graft.cruxSummarizer",
+ "name": "cruxSummarizer",
+ "kind": "method",
+ "path": "src/engine.ts",
+ "span": "L114-L116",
+ "signature": "private cruxSummarizer(): CruxSummarizer",
+ "exported": true,
"origin": "ast",
- "body_hash": "a73044fd4c3636db388dcd17dc5cebfa2090322501f2674989e892f89f2e1b03",
+ "body_hash": "3b07279c83115a1232de5b510ce2f501f8699e7b8c70a052c4c455e136f01ca6",
"summary_state": "ready",
- "summary": "Generates edges representing class inheritance and implementation relationships.",
+ "summary": "Creates a crux summarizer for the code graph's Tier-2 pass, ensuring it is properly configured.",
"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"
+ "code": " private cruxSummarizer(): CruxSummarizer {\n return new OpenRouterCruxSummarizer(this.requireKey(), this.cfg.openrouterModel, this.cfg.openrouterBaseUrl);\n }",
+ "span": "L111-L113"
}
},
{
- "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,
+ "id": "src/engine.ts#Graft.graph",
+ "name": "graph",
+ "kind": "method",
+ "path": "src/engine.ts",
+ "span": "L79-L86",
+ "signature": "graph(dir: string, opts: GraphRunOptions = {}): Promise<GraphBuildResult>",
+ "exported": true,
"origin": "ast",
- "body_hash": "edf2e115d4815ca2b2c480f6ab6ec254114fdb5fa329439fb1092449c6222ff5",
+ "body_hash": "cec39cf7bba0c124990ab186d6aae7ae2dcf5f17bfc56ecbef85f1fcc394050e",
"summary_state": "ready",
- "summary": "Extracts the module name from an import statement in the syntax tree.",
+ "summary": "Builds a per-symbol code graph from the repository, optionally using a meaning layer with LLM.",
"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"
+ "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 concurrency: opts.concurrency,\n onProgress: opts.onProgress,\n });",
+ "span": "L79-L85"
}
},
{
- "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,
+ "id": "src/engine.ts#Graft.init",
+ "name": "init",
+ "kind": "method",
+ "path": "src/engine.ts",
+ "span": "L53-L62",
+ "signature": "async init(dir: string, opts: InitOptions = {}): Promise<BuildResult>",
+ "exported": true,
"origin": "ast",
- "body_hash": "70722311d982f2fa892674266eddfe75b20ad22c62a323448a86a29044a6b7f6",
+ "body_hash": "7ee2e73a5a5412667db890e91f0f2abfb15b94ea1331db17aef0f841c348fbf1",
"summary_state": "ready",
- "summary": "Determines if a node represents an import statement in the syntax tree.",
- "crux": null
+ "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/graph/extract.ts#Language",
- "name": "Language",
- "kind": "type",
- "path": "src/graph/extract.ts",
- "span": "L16-L16",
- "signature": "type Language = \"typescript\" | \"tsx\" | \"python\";",
+ "id": "src/engine.ts#Graft.modelLabel",
+ "name": "modelLabel",
+ "kind": "method",
+ "path": "src/engine.ts",
+ "span": "L124-L127",
+ "signature": "private modelLabel(): string",
"exported": true,
"origin": "ast",
- "body_hash": "5a7c4ffe69a0058e67f6150fd6d7a941265322ef73669c6fae36bdd9a92af5c6",
+ "body_hash": "7034c4cd5e06b1b37f2ef068736f35fddaca136a3cae2ae5e595fda7efa2bd89",
"summary_state": "ready",
- "summary": "Defines the supported programming languages for extraction.",
- "crux": null
+ "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/graph/extract.ts#languageOf",
- "name": "languageOf",
- "kind": "function",
- "path": "src/graph/extract.ts",
- "span": "L19-L25",
- "signature": "function languageOf(path: string): Language | null",
+ "id": "src/engine.ts#Graft.requireKey",
+ "name": "requireKey",
+ "kind": "method",
+ "path": "src/engine.ts",
+ "span": "L98-L106",
+ "signature": "private requireKey(): string",
"exported": true,
"origin": "ast",
- "body_hash": "d68b32ad7c9702e80d148c718d03ef4d64d44805d4294c2503426ea9143e9e1d",
+ "body_hash": "9aed1d64896a6e8f8d3cd6c00e53f8e8baf2b424e0522d28408861b2f7c22912",
"summary_state": "ready",
- "summary": "Determines the programming language of a given file path.",
+ "summary": "Ensures that a valid OpenRouter API key is available, throwing an error if it is not set.",
"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"
+ "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/graph/extract.ts#RawEdge",
- "name": "RawEdge",
- "kind": "interface",
- "path": "src/graph/extract.ts",
- "span": "L31-L39",
- "signature": "interface RawEdge",
+ "id": "src/engine.ts#Graft.summarizer",
+ "name": "summarizer",
+ "kind": "method",
+ "path": "src/engine.ts",
+ "span": "L118-L121",
+ "signature": "private summarizer(): Summarizer",
"exported": true,
"origin": "ast",
- "body_hash": "707c4b43d565711035439d2541197427ac0d4da52241d33cf63dd3fb3ac98754",
+ "body_hash": "160e884c1dd10b916c36a737886880d98430fb84c5dd7828e69536b8198e3b2f",
"summary_state": "ready",
- "summary": "Represents an unresolved edge in the extraction process, linking nodes in the graph.",
- "crux": null
+ "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/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,
+ "id": "src/engine.ts#Graft.synthesizer",
+ "name": "synthesizer",
+ "kind": "method",
+ "path": "src/engine.ts",
+ "span": "L108-L111",
+ "signature": "private synthesizer(): Synthesizer",
+ "exported": true,
"origin": "ast",
- "body_hash": "dd6c141ae925e333baeebc3f3d19c3043670c76a4f32b711e8166ac6eb86f2f4",
+ "body_hash": "2a65f2a449bd40274d81542edfb36e20ceb8cf0160b030e8bd42b9698a386d20",
"summary_state": "ready",
- "summary": "Checks if a node is exported based on its ancestor nodes in the syntax tree.",
+ "summary": "Retrieves the synthesizer instance, creating one if it is not already configured.",
"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"
+ "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/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,
+ "id": "src/engine.ts#GraphRunOptions",
+ "name": "GraphRunOptions",
+ "kind": "interface",
+ "path": "src/engine.ts",
+ "span": "L37-L43",
+ "signature": "interface GraphRunOptions",
+ "exported": true,
"origin": "ast",
- "body_hash": "7cd315e50d1665cc130f049e5b655ac09f3e87f406fd7eba2b3fd6a4aca1c749",
+ "body_hash": "424eba22dc93e6a1f2b948f40d738ef8dd9b0bf4d06d7a3d562c2c6d77443d73",
"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"
- }
+ "summary": "Defines options for running the graph building process, including LLM usage and concurrency settings.",
+ "crux": null
},
{
- "id": "src/graph/extract.ts#WalkCtx",
- "name": "WalkCtx",
+ "id": "src/engine.ts#InitOptions",
+ "name": "InitOptions",
"kind": "interface",
- "path": "src/graph/extract.ts",
- "span": "L76-L84",
- "signature": "interface WalkCtx",
- "exported": false,
+ "path": "src/engine.ts",
+ "span": "L26-L31",
+ "signature": "interface InitOptions",
+ "exported": true,
"origin": "ast",
- "body_hash": "b2e93ec2af59e0078d500a068b620a426b6a588804ba62faba20d7f47f90bb3e",
+ "body_hash": "4a606cc2ac6df47d7b50de2a7ce33b2bd85e5dad93bea127871b9b952ddb0f8a",
"summary_state": "ready",
- "summary": "Context for walking through the syntax tree during extraction, maintaining state and scope.",
+ "summary": "Defines options for initializing the context graph build, including code extensions and a progress callback.",
"crux": null
},
{
- "id": "src/graph/resolve.ts",
- "name": "resolve.ts",
+ "id": "src/graph/build.ts",
+ "name": "build.ts",
"kind": "file",
- "path": "src/graph/resolve.ts",
- "span": "L1-L101",
+ "path": "src/graph/build.ts",
+ "span": "L1-L147",
"signature": null,
"exported": true,
"origin": "ast",
- "body_hash": "dad41f73d773c45f5237b85e10a36ae45331cd5959df578816ee8ab47622cffe",
+ "body_hash": "b18f5fc18dffd77771f39722eb19963c1188fd298cbb5cfd5d71ef8dc45658c6",
+ "chars": 5027,
"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.",
+ "summary": "This file defines the logic to build a graph representation from source code files in a repository.",
"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"
+ "code": "export async function buildGraph(\n dir: string,\n opts: GraphBuildOptions = {},\n): Promise<GraphBuildResult> {\n const root = resolve(dir);\n const outDir = contextDirFor(root, opts.contextDir);\n const files = listSourceFiles(root, outDir);\n\n const nodes: NodeV1[] = [];\n const rawEdges: RawEdge[] = [];\n const sources = new Map<string, string>();\n const langs = new Set<Language>();",
+ "span": "L57-L68"
}
},
{
- "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",
+ "id": "src/graph/build.ts#buildGraph",
+ "name": "buildGraph",
"kind": "function",
- "path": "src/graph/resolve.ts",
- "span": "L20-L58",
- "signature": "function resolveEdges(nodes: NodeV1[], rawEdges: RawEdge[]): EdgeV1[]",
+ "path": "src/graph/build.ts",
+ "span": "L57-L146",
+ "signature": "async function buildGraph( dir: string, opts: GraphBuildOptions = {}, ): Promise<GraphBuildResult>",
"exported": true,
"origin": "ast",
- "body_hash": "ace9e1eb0f3e9bc400f1341e0c23209b13d3c4f2b004e55a2397ebf4902cb41e",
+ "body_hash": "aa7152b35e0503aee7e9e7fdb56a5354e737f7b2c41313487906817be90776a2",
"summary_state": "ready",
- "summary": "This function processes raw edges and establishes relationships between nodes based on their types and specified relations.",
+ "summary": "This function orchestrates the process of reading source files, extracting nodes and edges, and writing the resulting graph to a file.",
"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"
+ "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 concurrency: opts.concurrency,\n onProgress: ({ index, total, node }) =>\n opts.onProgress?.({ phase: \"enrich\", index, total, file: node }),\n });",
+ "span": "L93-L104"
}
},
{
- "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\"])",
+ "id": "src/graph/build.ts#GraphBuildOptions",
+ "name": "GraphBuildOptions",
+ "kind": "interface",
+ "path": "src/graph/build.ts",
+ "span": "L22-L35",
+ "signature": "interface GraphBuildOptions",
"exported": true,
"origin": "ast",
- "body_hash": "7f8c2ba06670d38fd33b508c463d4c8e08ae614f7559b3571c8b7db1d51fd380",
+ "body_hash": "09dc36c486449d7e17f9fe9ddb0fbed6ba20104b28ff1ab6f38a1de344975ea8",
"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"
- }
+ "summary": "This interface specifies options for customizing the graph build process, including output directory and summarization settings.",
+ "crux": null
},
{
- "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,
+ "id": "src/graph/build.ts#GraphBuildResult",
+ "name": "GraphBuildResult",
+ "kind": "interface",
+ "path": "src/graph/build.ts",
+ "span": "L37-L50",
+ "signature": "interface GraphBuildResult",
+ "exported": true,
"origin": "ast",
- "body_hash": "5dcee73ae49d61baf6cba0f1430bcc799975d19b6d72ac0a6da911e14fafa955",
+ "body_hash": "66898435298552c740219c8ca50f06d430551bf605b2903064a6459db0095ec3",
"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"
- }
+ "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/resolve.ts#resolveName",
- "name": "resolveName",
+ "id": "src/graph/build.ts#listSourceFiles",
+ "name": "listSourceFiles",
"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,
+ "path": "src/graph/build.ts",
+ "span": "L53-L55",
+ "signature": "function listSourceFiles(root: string, outDir: string): string[]",
+ "exported": true,
"origin": "ast",
- "body_hash": "612a086f93eb383b759795d9e5b93d6f429bd4a17c22c9b3e65fcf7d79e0e6f0",
+ "body_hash": "09c58d7bb3b7c55ef5688af18f41e0d4eda5c4cb444a9ffb3290697794834ba0",
"summary_state": "ready",
- "summary": "This function resolves a symbol name to its corresponding node ID, prioritizing local matches and handling ambiguities appropriately.",
+ "summary": "This function retrieves a list of source files from a given directory, excluding the output directory and unsupported languages.",
"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"
+ "code": " return walkDir(root).filter((f) => !f.startsWith(outDir) && languageOf(f) !== null);",
+ "span": "L52-L52"
}
},
{
- "id": "src/graph/types.ts",
- "name": "types.ts",
+ "id": "src/graph/cards.ts",
+ "name": "cards.ts",
"kind": "file",
- "path": "src/graph/types.ts",
- "span": "L1-L82",
+ "path": "src/graph/cards.ts",
+ "span": "L1-L282",
"signature": null,
"exported": true,
"origin": "ast",
- "body_hash": "757b84c059d13cda49e0f29518b31a5473f0d6e243b2ab1f374a7f7ff02492e4",
+ "body_hash": "c45f4bd1be271a9c5ff01c04bae2a2d4fd761eb85bd8d4a302738e6744e636b1",
+ "chars": 10357,
"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"
- }
+ "summary": "This module generates markdown cards that summarize source files and their symbols, facilitating easier navigation and understanding of the codebase.",
+ "crux": null
},
{
- "id": "src/graph/types.ts#Confidence",
- "name": "Confidence",
- "kind": "type",
- "path": "src/graph/types.ts",
- "span": "L25-L25",
- "signature": "type Confidence = \"extracted\" | \"inferred\";",
+ "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": "305d107dc8cea0d8fcf2e42c13eef23345a53cd6a24672d8a017d5c8d393d46c",
+ "body_hash": "bc918882882be5be102c1a9ff1127e100c3fe83f380828d8d62ad1063693d6db",
"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"
- }
+ "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/types.ts#Crux",
- "name": "Crux",
- "kind": "interface",
- "path": "src/graph/types.ts",
- "span": "L32-L35",
- "signature": "interface Crux",
- "exported": true,
+ "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": "157f97611f592b25b78af3bd626d10c866b4aa23344a96823de466eb1ecbe28d",
+ "body_hash": "af75114def2a26067a8f595c3937bb3e8aea6f257205de146b435f804729c1cc",
"summary_state": "ready",
- "summary": "Holds the LLM-chosen business-logic excerpt for a node, providing a source of truth for code interpretation.",
+ "summary": "Constructs the markdown file path for a card by replacing the source file's extension with .md.",
"crux": {
- "code": "export interface Crux {\n code: string;\n span: string; // e.g. \"L189-L196\"\n}",
- "span": "L32-L35"
+ "code": " const md = sourcePath.replace(/\\.[^./]+$/, \"\") + \".md\";\n return join(outDir, md);",
+ "span": "L42-L43"
}
},
{
- "id": "src/graph/types.ts#EdgeV1",
- "name": "EdgeV1",
+ "id": "src/graph/cards.ts#CardStats",
+ "name": "CardStats",
"kind": "interface",
- "path": "src/graph/types.ts",
- "span": "L65-L70",
- "signature": "interface EdgeV1",
+ "path": "src/graph/cards.ts",
+ "span": "L34-L38",
+ "signature": "interface CardStats",
"exported": true,
"origin": "ast",
- "body_hash": "ab2ffb1ba27a286985e517d71d7866d2d389e585d1584647a90fb520b4d92628",
+ "body_hash": "1c3e57e9c5bf329c4248f01c551c6d0a2a9af394980dbe537f026c15c933fe58",
"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"
- }
+ "summary": "Tracks the statistics of card generation, including how many cards were written and pruned.",
+ "crux": null
},
{
- "id": "src/graph/types.ts#GraphV1",
- "name": "GraphV1",
- "kind": "interface",
- "path": "src/graph/types.ts",
- "span": "L72-L81",
- "signature": "interface GraphV1",
- "exported": true,
+ "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": "fa588451b38bfa2c1ea17eeabb5cd4d18769ecbf75ba79fb160d59d2d2666e8e",
+ "body_hash": "ea08d13224b288f66ba9378d392b955657db6661dee7d33b3c68ad04cf5594b1",
"summary_state": "ready",
- "summary": "Encapsulates the entire graph structure, including metadata and collections of nodes and edges.",
+ "summary": "Maps source paths to their corresponding concept node slugs, facilitating the creation of up-links in cards.",
"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"
+ "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/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\";",
+ "id": "src/graph/cards.ts#CoverRef",
+ "name": "CoverRef",
+ "kind": "interface",
+ "path": "src/graph/cards.ts",
+ "span": "L225-L230",
+ "signature": "interface CoverRef",
"exported": true,
"origin": "ast",
- "body_hash": "b233aa721b3c652dd7f3b4de6e3410e0f44a1da079cbb90df6d8e05eb4cc49f0",
+ "body_hash": "b905acf1827c4b1c7b212eee322bfffb6ef0bea196277d5c20e66157c11ada8f",
"summary_state": "ready",
- "summary": "Enumerates the types of symbols that can exist in the code graph, facilitating type identification.",
+ "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": "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"
+ "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/types.ts#NodeV1",
- "name": "NodeV1",
- "kind": "interface",
- "path": "src/graph/types.ts",
- "span": "L37-L55",
- "signature": "interface NodeV1",
- "exported": true,
+ "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": "beaac037e2ce6292f6f5883e10c6a1df41963629d9090bbde0d88ef5b6fd8309",
+ "body_hash": "ba6dde008e5cbd07399e992182055ae60636e68a4acfa2457d3cf8f317b1dc84",
"summary_state": "ready",
- "summary": "Represents a node in the graph with its identity, location, and meaning, essential for graph construction.",
+ "summary": "Recursively traverses directories to find markdown files for existing cards.",
"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"
+ "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/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,
+ "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": "226fd93c673f4bfa583e44e3be8c2ca8e0957bf1b95771f067e4999b1e89d145",
+ "body_hash": "f164d443f9ca9ab5785a61f1cd21b9fee70b0d444dc9161f8f79b26dae28b571",
"summary_state": "ready",
- "summary": "Defines the types of relationships between nodes in the graph, clarifying how symbols interact.",
+ "summary": "Retrieves a concise summary or signature of a node, prioritizing the summary if available.",
"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"
+ "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/types.ts#SummaryState",
- "name": "SummaryState",
- "kind": "type",
- "path": "src/graph/types.ts",
- "span": "L28-L28",
- "signature": "type SummaryState = \"pending\" | \"ready\" | \"stale\";",
- "exported": true,
+ "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": "0689b3a76aa3ee3553bec1bccff2817cac613e747d317688f296748e8c929e0e",
+ "body_hash": "7c58c5eb58948bd353fa0eaf6db614a6f3a66943f10e422352dbb62a67308d46",
"summary_state": "ready",
- "summary": "Indicates whether the meaning-layer has been computed for a node, managing the state of node summaries.",
+ "summary": "Removes empty directories from the output directory, ensuring a clean structure after card generation.",
"crux": {
- "code": "export type SummaryState = \"pending\" | \"ready\" | \"stale\";",
- "span": "L28-L28"
+ "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/write.ts",
- "name": "write.ts",
- "kind": "file",
- "path": "src/graph/write.ts",
- "span": "L1-L55",
- "signature": null,
- "exported": true,
+ "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": "55dd6ea840135ade4db7f49042234bee0db07a9c8c959ab57767deb8bebc6345",
+ "body_hash": "f92031cda975f10bd7b09706f2b6ad09399ac06897c6ed89afd114ccd1032e7e",
"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
+ "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/write.ts#edgeOrder",
- "name": "edgeOrder",
+ "id": "src/graph/cards.ts#renderCard",
+ "name": "renderCard",
"kind": "function",
- "path": "src/graph/write.ts",
- "span": "L48-L54",
- "signature": "function edgeOrder(a: EdgeV1, b: EdgeV1): number",
+ "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": "1c2665c44f094c37f510a0ca5befc63bf67ae59c52d77dfdcbe15611d2e5abbe",
+ "body_hash": "6f1076c555ccd93979599e6ab7a7c3f5e7ec69f8dfc9c12893ed5caf0052cdf3",
"summary_state": "ready",
- "summary": "Defines the sorting order for edges in the wiring graph based on source, relation, and target.",
+ "summary": "Generates the markdown content for a card, including the source file's summary and its symbols.",
"crux": {
- "code": " a.source.localeCompare(b.source) ||\n a.relation.localeCompare(b.relation) ||\n a.target.localeCompare(b.target)",
- "span": "L50-L52"
+ "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/write.ts#readGraph",
- "name": "readGraph",
+ "id": "src/graph/cards.ts#spanStart",
+ "name": "spanStart",
"kind": "function",
- "path": "src/graph/write.ts",
- "span": "L28-L34",
- "signature": "function readGraph(path: string): GraphV1 | null",
- "exported": true,
+ "path": "src/graph/cards.ts",
+ "span": "L47-L50",
+ "signature": "function spanStart(span: string): number",
+ "exported": false,
"origin": "ast",
- "body_hash": "a68ca7cd48652a99a350b76c387a19462cc984c42bbc9b00a30e629af5fda52e",
+ "body_hash": "c556d0ee70964557755678794a12cb22fe0f72f158ec186e32975ff01e8d44eb",
"summary_state": "ready",
- "summary": "Reads and parses an existing wiring graph from a file, returning null if the file is absent or unparseable.",
+ "summary": "Extracts the starting line number from a given span string, returning 0 if the format is unparseable.",
"crux": {
- "code": " return JSON.parse(readFileSync(path, \"utf8\")) as GraphV1;\n } catch {\n return null;",
- "span": "L30-L32"
+ "code": " const m = /^L(\\d+)/.exec(span);\n return m ? Number(m[1]) : 0;",
+ "span": "L48-L49"
}
},
{
- "id": "src/graph/write.ts#wiringPath",
- "name": "wiringPath",
+ "id": "src/graph/cards.ts#writeCards",
+ "name": "writeCards",
"kind": "function",
- "path": "src/graph/write.ts",
- "span": "L20-L22",
- "signature": "function wiringPath(outDir: string): string",
+ "path": "src/graph/cards.ts",
+ "span": "L150-L183",
+ "signature": "function writeCards(graph: GraphV1, outDir: string): CardStats",
"exported": true,
"origin": "ast",
- "body_hash": "4a454f03e0aa7289fbc47e6493079ab7f8b353b6133b4362158857eda98bb544",
+ "body_hash": "ef71834ba8bfb9f009b04afe5a3d63bb0d3a2e44384377cd02045a57c18e28c6",
"summary_state": "ready",
- "summary": "Generates the absolute path for the wiring graph file in a specified output directory.",
+ "summary": "Writes markdown cards for each source file, reflecting the source tree and pruning any outdated cards.",
"crux": {
- "code": " return join(outDir, GRAPH_DIR, GRAPH_FILE);",
- "span": "L21-L21"
+ "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/write.ts#writeGraph",
- "name": "writeGraph",
+ "id": "src/graph/cards.ts#writeCovers",
+ "name": "writeCovers",
"kind": "function",
- "path": "src/graph/write.ts",
- "span": "L36-L46",
- "signature": "function writeGraph(graph: GraphV1, outDir: string): string",
+ "path": "src/graph/cards.ts",
+ "span": "L245-L281",
+ "signature": "function writeCovers(graph: GraphV1, outDir: string): number",
"exported": true,
"origin": "ast",
- "body_hash": "1c7e1c1674a049208f245753f107cf9fb4dceea8ec5c19c8086df2f8af1b7aeb",
+ "body_hash": "09f3d72e14a6ded303111818b4b4d8edce65b6f7e807e521001ca0b6eca973ba",
"summary_state": "ready",
- "summary": "Writes a sorted representation of the wiring graph to a specified output directory, ensuring the directory structure exists.",
+ "summary": "Backfills concept nodes with a list of symbols they cover, enhancing their metadata for better navigation.",
"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"
+ "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/index.ts",
- "name": "index.ts",
- "kind": "file",
- "path": "src/index.ts",
- "span": "L1-L37",
- "signature": null,
+ "id": "src/graph/cards.ts#writeIndex",
+ "name": "writeIndex",
+ "kind": "function",
+ "path": "src/graph/cards.ts",
+ "span": "L189-L222",
+ "signature": "function writeIndex(outDir: string, files: CardFileInfo[]): void",
"exported": true,
"origin": "ast",
- "body_hash": "e56e74612514fd45665b27e3c47b4a685b503a533b38e1674d256344511107fc",
+ "body_hash": "e2e95c9595a5386036af4f9beeda3897fe1b22e53fcb5d79d2c07fa3276481c1",
"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.",
+ "summary": "This function creates an index markdown file that lists concept nodes and per-file cards, providing a quick reference for navigating the 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"
+ "code": " \"# 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\", \"\");\n for (const c of concepts) {",
+ "span": "L191-L202"
}
},
{
- "id": "src/ingest/fs.ts",
- "name": "fs.ts",
+ "id": "src/graph/check.ts",
+ "name": "check.ts",
"kind": "file",
- "path": "src/ingest/fs.ts",
- "span": "L1-L46",
+ "path": "src/graph/check.ts",
+ "span": "L1-L136",
"signature": null,
"exported": true,
"origin": "ast",
- "body_hash": "a8339532da34b44d35eb9ad16e7106adb1262d73d9895b1bd94574337fb2019f",
+ "body_hash": "5358023fe498fb2878e3aa9b6756272c39926dda865c6495d8f33d13c5ceb376",
+ "chars": 4952,
"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
+ "summary": "Ensures that the committed graph.json accurately reflects the current state of the codebase, identifying any discrepancies.",
+ "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/ingest/fs.ts#walkDir",
- "name": "walkDir",
+ "id": "src/graph/check.ts#checkGraph",
+ "name": "checkGraph",
"kind": "function",
- "path": "src/ingest/fs.ts",
- "span": "L27-L45",
- "signature": "function walkDir(dir: string): string[]",
+ "path": "src/graph/check.ts",
+ "span": "L43-L101",
+ "signature": "function checkGraph(dir: string, opts: GraphCheckOptions = {}): GraphCheckResult",
"exported": true,
"origin": "ast",
- "body_hash": "001f6c9f648af0620ed90c55a132464ab87da3ad74b6711df716e9f9493333c4",
+ "body_hash": "992b2d4efeb36d881a5818fd98f1de4be119e1c5597e207578b55bbe40797aca",
"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.",
+ "summary": "This function checks if the current code's graph representation matches the committed graph, identifying any added, removed, or changed nodes.",
"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"
+ "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/util/id.ts",
- "name": "id.ts",
- "kind": "file",
- "path": "src/util/id.ts",
- "span": "L1-L17",
- "signature": null,
+ "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": "5fabc8ddcc3abc907ce69f04ad2ebe51933262cf44aa2dfd40589f71f1926e8a",
+ "body_hash": "a2489371664b6c2729925dffd9852c85aecbd21a019f72549435ce51a4113b86",
"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.",
+ "summary": "Generates a human-readable report summarizing the results of the graph check, indicating any issues found.",
"crux": {
- "code": " return createHash(\"sha256\").update(input).digest(\"hex\");",
- "span": "L10-L10"
+ "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/util/id.ts#newId",
- "name": "newId",
- "kind": "function",
- "path": "src/util/id.ts",
- "span": "L4-L6",
- "signature": "function newId(prefix: string): string",
+ "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": "55062dee898e1edb76d65f7daf785b67e998a57a7dfd6f78c7eb17f39e3e1dc0",
+ "body_hash": "deb14aad6be2a49d6d6d059a64a4eb55a7041a039cbabf92c55222647c2b0679",
"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"
- }
+ "summary": "This interface provides optional parameters for configuring the context directory when performing a graph check.",
+ "crux": null
},
{
- "id": "src/util/id.ts#normalizeName",
- "name": "normalizeName",
- "kind": "function",
- "path": "src/util/id.ts",
- "span": "L14-L16",
- "signature": "function normalizeName(name: string): string",
+ "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": "bac0e298462067a441b2b76566ed29c3787280585b956f84b81d7a766cd7211a",
+ "body_hash": "8b12129196b2a1b6d3c7a45a086708e123527cbc0417ce5db07a710a853719c0",
"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"
- }
+ "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/viz/assemble.ts",
- "name": "assemble.ts",
+ "id": "src/graph/enrich.ts",
+ "name": "enrich.ts",
"kind": "file",
- "path": "src/viz/assemble.ts",
- "span": "L1-L131",
+ "path": "src/graph/enrich.ts",
+ "span": "L1-L213",
"signature": null,
"exported": true,
"origin": "ast",
- "body_hash": "58ad5caed087bd7b929f5b625501a607e79e0476f998636bec241e0296706ece",
+ "body_hash": "c15a0aef99e54d4c24ac748a9b33373512f1511b1f5bcd830f9d2e407ff47917",
+ "chars": 8350,
"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.",
+ "summary": "This file implements a mechanism to enrich graph nodes with summaries and cruxes based on their state and prior computations.",
"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"
+ "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": "L56-L67"
}
},
{
- "id": "src/viz/assemble.ts#assembleContextGraph",
- "name": "assembleContextGraph",
+ "id": "src/graph/enrich.ts#buildCrux",
+ "name": "buildCrux",
"kind": "function",
- "path": "src/viz/assemble.ts",
- "span": "L79-L130",
- "signature": "function assembleContextGraph(contextDir: string): VizGraph",
- "exported": true,
+ "path": "src/graph/enrich.ts",
+ "span": "L188-L203",
+ "signature": "function buildCrux(r: NodeCrux, node: NodeV1, source: string, lineCount: number): Crux | null",
+ "exported": false,
"origin": "ast",
- "body_hash": "8529626bef8abf2e1a326d601cf5a6a4972e0a1b801d6b653ba8227a27b9dbbd",
+ "body_hash": "b8e82b1a1f721cdba2a3ff1a6d46db8b30a0048178d7c7e7df0731e60c059a81",
"summary_state": "ready",
- "summary": "Processes markdown files in a specified directory to create a structured visualization graph, handling errors gracefully.",
+ "summary": "Extracts and formats the crux text from a source file based on the model's provided line range.",
"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"
+ "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/viz/assemble.ts#extractSummary",
- "name": "extractSummary",
+ "id": "src/graph/enrich.ts#collectFileCrux",
+ "name": "collectFileCrux",
"kind": "function",
- "path": "src/viz/assemble.ts",
- "span": "L65-L76",
- "signature": "function extractSummary(body: string): string",
+ "path": "src/graph/enrich.ts",
+ "span": "L161-L181",
+ "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": "1857e477bdb012672fa843cfca8d43eb543e7cfba2cc496692a65ebe8c0fa6c5",
+ "body_hash": "e549b76d14ae5d596c084dd5f655bded2092a36e3505ff6135c054ccf043efda",
"summary_state": "ready",
- "summary": "Extracts and cleans the summary text from a markdown node's content, ensuring it adheres to length constraints.",
+ "summary": "Collects crux information for nodes in a file, handling potential errors and ensuring partial results are returned.",
"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"
+ "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/viz/assemble.ts#normalizeRelation",
- "name": "normalizeRelation",
+ "id": "src/graph/enrich.ts#enrichGraph",
+ "name": "enrichGraph",
"kind": "function",
- "path": "src/viz/assemble.ts",
- "span": "L56-L58",
- "signature": "function normalizeRelation(rel: string): string",
+ "path": "src/graph/enrich.ts",
+ "span": "L48-L136",
+ "signature": "async function enrichGraph( nodes: NodeV1[], prior: Map<string, NodeV1>, sources: Map<string, string>, opts: EnrichOptions = {}, ): Promise<EnrichStats>",
"exported": true,
"origin": "ast",
- "body_hash": "adfaae55d1d21718adbedaa294194517aa7abdddeb95433642fd358137e48909",
+ "body_hash": "f740a8a6957661bd4bedddbe0cbb0c5541e30a3b303cbd01830cf761644e0801",
"summary_state": "ready",
- "summary": "Maps legacy vague verbs to concrete verbs to maintain consistency in the graph's relationships.",
+ "summary": "This function processes graph nodes to update their summaries and cruxes based on their state and prior data, potentially invoking an LLM for new computations.",
"crux": {
- "code": "export function normalizeRelation(rel: string): string {\n return NORMALIZE_RELATION[rel] ?? rel;\n}",
- "span": "L56-L58"
+ "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": "L56-L67"
}
},
{
- "id": "src/viz/assemble.ts#VizEdge",
- "name": "VizEdge",
+ "id": "src/graph/enrich.ts#EnrichOptions",
+ "name": "EnrichOptions",
"kind": "interface",
- "path": "src/viz/assemble.ts",
- "span": "L26-L31",
- "signature": "interface VizEdge",
+ "path": "src/graph/enrich.ts",
+ "span": "L31-L38",
+ "signature": "interface EnrichOptions",
"exported": true,
"origin": "ast",
- "body_hash": "bef3aefe267d463b0d4cf617f379adadd4fffb539e9a0a5e240520be60a191cb",
+ "body_hash": "a721d24d1e8ad1777bd74f54cdc1f4edcc55d3576b065557a0b10b3fe4b4a183",
"summary_state": "ready",
- "summary": "Defines the structure of an edge in the visualization graph, representing relationships between nodes.",
+ "summary": "This interface defines options for enriching graph nodes, including whether to compute new summaries and the level of concurrency for processing.",
"crux": null
},
{
- "id": "src/viz/assemble.ts#VizGraph",
- "name": "VizGraph",
+ "id": "src/graph/enrich.ts#EnrichStats",
+ "name": "EnrichStats",
"kind": "interface",
- "path": "src/viz/assemble.ts",
- "span": "L33-L42",
- "signature": "interface VizGraph",
+ "path": "src/graph/enrich.ts",
+ "span": "L40-L46",
+ "signature": "interface EnrichStats",
"exported": true,
"origin": "ast",
- "body_hash": "7edd9c49c11acc8e90963256a92ee2f27415c50446334924e2e260b715b56427",
+ "body_hash": "63a93dfdf61c8da0d3a05c601b74619ad84942d37425b4391b8da2b01d2d694c",
"summary_state": "ready",
- "summary": "Encapsulates the complete visualization graph, including metadata about nodes and edges.",
+ "summary": "Tracks the statistics of the enrichment process, including counts of cached, computed, stale, and pending nodes.",
"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,
+ "id": "src/graph/enrich.ts#mapWithConcurrency",
+ "name": "mapWithConcurrency",
+ "kind": "function",
+ "path": "src/graph/enrich.ts",
+ "span": "L139-L154",
+ "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": "ec19a79898c594e5afc405cab037fcc0c43144c5766af8a955dccda7df733ba6",
+ "body_hash": "a4c9438ba7cb397b91c5ab695f081e20db5678db9eea0be35a086fda1d9714e5",
"summary_state": "ready",
- "summary": "Defines the structure of a node in the visualization graph, encapsulating its identity and attributes.",
+ "summary": "This function executes a provided asynchronous function over a list of items with a specified limit on concurrent executions, preserving the order of results.",
"crux": null
},
{
- "id": "src/viz/serve.ts",
- "name": "serve.ts",
+ "id": "src/graph/enrich.ts#spanLines",
+ "name": "spanLines",
+ "kind": "function",
+ "path": "src/graph/enrich.ts",
+ "span": "L206-L212",
+ "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/viz/serve.ts",
- "span": "L1-L149",
+ "path": "src/graph/extract.ts",
+ "span": "L1-L299",
"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.",
+ "body_hash": "484f87a70563ab769ac185cd9737cce928ba5a7599cbdae1b7e1b1c6343f32d6",
+ "chars": 9927,
+ "summary_state": "stale",
+ "summary": "This module extracts structured data from source files into a normalized format for further processing.",
"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"
+ "code": " return { nodes, rawEdges };",
+ "span": "L126-L126"
}
},
{
- "id": "src/viz/serve.ts#listen",
- "name": "listen",
+ "id": "src/graph/extract.ts#calleeName",
+ "name": "calleeName",
"kind": "function",
- "path": "src/viz/serve.ts",
- "span": "L43-L55",
- "signature": "function listen(server: Server, port: number): Promise<boolean>",
+ "path": "src/graph/extract.ts",
+ "span": "L245-L261",
+ "signature": "function calleeName( node: Parser.SyntaxNode, lang: Language, ): { name: string; viaMember: boolean } | null",
"exported": false,
"origin": "ast",
- "body_hash": "b43a357dceb98a6eb6676409503021e6e38f13d7d442d44ba819dda0c0ea6246",
+ "body_hash": "06353b6cf0a05cf60bad712082837f52c169e6db9209488f1ee04ea22bef8082",
"summary_state": "ready",
- "summary": "Attempts to bind the server to a specified port, handling errors if the port is in use.",
+ "summary": "Extracts the name of a function or method being called in the syntax tree.",
"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"
+ "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/viz/serve.ts#listen.onError",
- "name": "onError",
+ "id": "src/graph/extract.ts#clean",
+ "name": "clean",
"kind": "function",
- "path": "src/viz/serve.ts",
- "span": "L45-L48",
- "signature": "onError = (err: NodeJS.ErrnoException)",
+ "path": "src/graph/extract.ts",
+ "span": "L281-L288",
+ "signature": "function clean(raw: string): string | null",
"exported": false,
"origin": "ast",
- "body_hash": "6643919e3ea413fc58afe100fe65dc3beccadb7aa66bf5d3247e072c83d9d000",
+ "body_hash": "38343faa35f42e41e98c93d6816454cfe294123505d2bae14f045624cf6d80e1",
"summary_state": "ready",
- "summary": "Handles errors that occur when trying to bind the server to a port.",
- "crux": null
+ "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/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",
+ "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": "a2b33c898c929db2715116f964722f5e438e61a58fdfa4607d21c4365df5da6a",
+ "body_hash": "414875473c4cf1728483558f5354b6f37c279d2bc49393b3b93322a9573a7f00",
"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"
- }
+ "summary": "Describes a definition in the syntax tree, including its name and type.",
+ "crux": null
},
{
- "id": "src/viz/serve.ts#startVizServer",
- "name": "startVizServer",
+ "id": "src/graph/extract.ts#describe",
+ "name": "describe",
"kind": "function",
- "path": "src/viz/serve.ts",
- "span": "L57-L148",
- "signature": "async function startVizServer(opts: VizServerOptions): Promise<VizServer>",
- "exported": true,
+ "path": "src/graph/extract.ts",
+ "span": "L185-L214",
+ "signature": "function describe(node: Parser.SyntaxNode, ctx: WalkCtx): DefDescriptor | null",
+ "exported": false,
"origin": "ast",
- "body_hash": "d652f8a8b5ea738a1ff68592d9644525dee438568c9158e5edffe536b1f1aa16",
+ "body_hash": "9a6919ff2bed807cf790adcea3b0d423db94baa10fc2069514e0c20c1b5f7117",
"summary_state": "ready",
- "summary": "Initializes and starts the visualization server, setting up routes and handling requests.",
+ "summary": "Identifies and describes definitions in the syntax tree based on their node types.",
"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"
+ "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/viz/serve.ts#startVizServer.close",
- "name": "close",
- "kind": "method",
- "path": "src/viz/serve.ts",
- "span": "L140-L146",
- "signature": "close(): Promise<void>",
+ "id": "src/graph/extract.ts#extractFile",
+ "name": "extractFile",
+ "kind": "function",
+ "path": "src/graph/extract.ts",
+ "span": "L94-L128",
+ "signature": "function extractFile(rel: string, source: string, lang: Language): ExtractResult",
"exported": true,
"origin": "ast",
- "body_hash": "69dc0089d8f1d6e843c8add8fabf2e120fd1045505f9c15632ba93bdc58c01d4",
- "summary_state": "ready",
- "summary": "Closes the visualization server and cleans up resources.",
+ "body_hash": "691c4b4b02509177b75788a5a3dea7d46267db90702e092349e43a99bb37d9b4",
+ "summary_state": "stale",
+ "summary": "Extracts nodes and edges from a source file based on its syntax tree.",
"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"
+ "code": " return { nodes, rawEdges };",
+ "span": "L126-L126"
}
},
{
- "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",
+ "id": "src/graph/extract.ts#ExtractResult",
+ "name": "ExtractResult",
"kind": "interface",
- "path": "src/viz/serve.ts",
- "span": "L16-L21",
- "signature": "interface VizServerOptions",
+ "path": "src/graph/extract.ts",
+ "span": "L41-L44",
+ "signature": "interface ExtractResult",
"exported": true,
"origin": "ast",
- "body_hash": "0b439484269a73c19df0d658113fbdc889c2214d1081e08d92bc86ae99e0c795",
+ "body_hash": "7bef2217a3edd0ae64ae3585affe29e5bc0e0f471ca1d7901910fa737e4d01af",
"summary_state": "ready",
- "summary": "Defines the configuration options required to start the visualization server.",
+ "summary": "Holds the result of the extraction process, containing nodes and raw edges.",
"crux": null
},
{
- "id": "test/ask.test.ts",
- "name": "ask.test.ts",
- "kind": "file",
- "path": "test/ask.test.ts",
- "span": "L1-L55",
- "signature": null,
- "exported": true,
+ "id": "src/graph/extract.ts#heritageEdges",
+ "name": "heritageEdges",
+ "kind": "function",
+ "path": "src/graph/extract.ts",
+ "span": "L216-L243",
+ "signature": "function heritageEdges(node: Parser.SyntaxNode, classId: string, ctx: WalkCtx): RawEdge[]",
+ "exported": false,
"origin": "ast",
- "body_hash": "b2d9beeea01fd6faab6225ea3b3a735d5dd808e8358ffe37bb82a2a5f5da3dce",
+ "body_hash": "a73044fd4c3636db388dcd17dc5cebfa2090322501f2674989e892f89f2e1b03",
"summary_state": "ready",
- "summary": "This file contains tests for the `graft ask` functionality, ensuring that the source option correctly inlines code from disk when requested.",
+ "summary": "Generates edges representing class inheritance and implementation relationships.",
"crux": {
- "code": "test(\"ask without source returns pointers but no inlined code\", async () => {\n const dir = makeFixture();\n try {\n await buildGraph(dir); // $0, structure-only — cards + wiring.json\n const r = ask(dir, \"addNumbers\");\n const hit = r.hits.find((h) => h.title.startsWith(\"addNumbers\"));\n assert.ok(hit, \"should locate the addNumbers symbol\");\n assert.match(hit.pointer, /^math\\.ts:L\\d+-L\\d+$/);\n assert.equal(hit.code, undefined, \"no source inlined without the option\");\n } finally {\n rmSync(dir, { recursive: true, force: true });\n }",
- "span": "L26-L37"
+ "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": "test/ask.test.ts#makeFixture",
- "name": "makeFixture",
+ "id": "src/graph/extract.ts#importSpecifier",
+ "name": "importSpecifier",
"kind": "function",
- "path": "test/ask.test.ts",
- "span": "L15-L24",
- "signature": "function makeFixture(): string",
+ "path": "src/graph/extract.ts",
+ "span": "L267-L278",
+ "signature": "function importSpecifier(node: Parser.SyntaxNode, lang: Language): string | null",
"exported": false,
"origin": "ast",
- "body_hash": "2782fc6b3f2efa27b0c0195482a4b138e1ec02bd16da279313966e96a6d807e8",
+ "body_hash": "edf2e115d4815ca2b2c480f6ab6ec254114fdb5fa329439fb1092449c6222ff5",
"summary_state": "ready",
- "summary": "Creates a temporary directory with a sample TypeScript file for testing purposes.",
+ "summary": "Extracts the module name from an import statement in the syntax tree.",
"crux": {
- "code": " const dir = mkdtempSync(join(tmpdir(), \"graft-ask-\"));\n writeFileSync(\n join(dir, \"math.ts\"),\n `export function addNumbers(a: number, b: number): number {\\n` +\n ` return a + b;\\n` +\n `}\\n`,\n );\n return dir;",
- "span": "L16-L23"
+ "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": "test/context.test.ts",
- "name": "context.test.ts",
- "kind": "file",
- "path": "test/context.test.ts",
- "span": "L1-L137",
- "signature": null,
- "exported": true,
+ "id": "src/graph/extract.ts#isImport",
+ "name": "isImport",
+ "kind": "function",
+ "path": "src/graph/extract.ts",
+ "span": "L263-L265",
+ "signature": "function isImport(node: Parser.SyntaxNode): boolean",
+ "exported": false,
"origin": "ast",
- "body_hash": "7c1242872b127117c7cc50404895d7ffcf286a51b611cd23c4ffabd5db8d43f3",
+ "body_hash": "70722311d982f2fa892674266eddfe75b20ad22c62a323448a86a29044a6b7f6",
"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"
- }
+ "summary": "Determines if a node represents an import statement in the syntax tree.",
+ "crux": null
},
{
- "id": "test/context.test.ts#buildOpts",
- "name": "buildOpts",
- "kind": "function",
- "path": "test/context.test.ts",
- "span": "L27-L29",
- "signature": "function buildOpts()",
- "exported": false,
+ "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": "20ec093d8fa9dadc46af8980d9440b6824597f4cdeb74529d4d62ee38d27e52d",
+ "body_hash": "5a7c4ffe69a0058e67f6150fd6d7a941265322ef73669c6fae36bdd9a92af5c6",
"summary_state": "ready",
- "summary": "This function generates options for building the context, including a fake model and providers.",
+ "summary": "Defines the supported programming languages for extraction.",
"crux": null
},
{
- "id": "test/context.test.ts#makeFixture",
- "name": "makeFixture",
+ "id": "src/graph/extract.ts#languageOf",
+ "name": "languageOf",
"kind": "function",
- "path": "test/context.test.ts",
- "span": "L14-L25",
- "signature": "function makeFixture(): string",
- "exported": false,
+ "path": "src/graph/extract.ts",
+ "span": "L19-L25",
+ "signature": "function languageOf(path: string): Language | null",
+ "exported": true,
"origin": "ast",
- "body_hash": "515198ac732683d4da4b920e53a0eb439ea8e0107afb22af65cc29c0e702192c",
+ "body_hash": "d68b32ad7c9702e80d148c718d03ef4d64d44805d4294c2503426ea9143e9e1d",
"summary_state": "ready",
- "summary": "This function creates a temporary directory with mock service files for testing the context building process.",
+ "summary": "Determines the programming language of a given file path.",
"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"
+ "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": "test/covers.test.ts",
- "name": "covers.test.ts",
- "kind": "file",
- "path": "test/covers.test.ts",
- "span": "L1-L77",
- "signature": null,
+ "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": "f5a75f405be1a01ad43fc806588858df3a8988fee62ad4ec024440d3f5e0fc0c",
+ "body_hash": "707c4b43d565711035439d2541197427ac0d4da52241d33cf63dd3fb3ac98754",
"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.",
+ "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": "L291-L298",
+ "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": "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"
+ "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": "test/covers.test.ts#makeFixture",
- "name": "makeFixture",
+ "id": "src/graph/extract.ts#walk",
+ "name": "walk",
"kind": "function",
- "path": "test/covers.test.ts",
- "span": "L16-L24",
- "signature": "function makeFixture(): string",
+ "path": "src/graph/extract.ts",
+ "span": "L130-L182",
+ "signature": "function walk(node: Parser.SyntaxNode, ctx: WalkCtx, out: NodeV1[], edges: RawEdge[]): void",
"exported": false,
"origin": "ast",
- "body_hash": "c50f4905cfffe46da829a42a2bcab6838f96a17497009a9efe7a64a98729540f",
+ "body_hash": "7cd315e50d1665cc130f049e5b655ac09f3e87f406fd7eba2b3fd6a4aca1c749",
"summary_state": "ready",
- "summary": "Creates a temporary directory with a sample TypeScript file for testing the wiring build.",
+ "summary": "Recursively traverses the syntax tree to collect definitions and their relationships.",
"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"
+ "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": "test/helpers.ts",
- "name": "helpers.ts",
- "kind": "file",
- "path": "test/helpers.ts",
- "span": "L1-L55",
- "signature": null,
- "exported": true,
+ "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": "e45af1d38d7c6d4abc804fc74e9ae4c3373cf78769c17b16b185c3ee0e2c3228",
+ "body_hash": "b2e93ec2af59e0078d500a068b620a426b6a588804ba62faba20d7f47f90bb3e",
"summary_state": "ready",
- "summary": "This file provides test doubles for offline, deterministic testing of components without external dependencies.",
+ "summary": "Context for walking through the syntax tree during extraction, maintaining state and scope.",
"crux": null
},
{
- "id": "test/helpers.ts#BracketSynthesizer",
- "name": "BracketSynthesizer",
- "kind": "class",
- "path": "test/helpers.ts",
- "span": "L21-L50",
- "signature": "class BracketSynthesizer implements Synthesizer",
+ "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": "6a30b1293990bb2dce95f1f1f77219dbcdc54eef7e6a01d0db03403f4d344bcc",
+ "body_hash": "dad41f73d773c45f5237b85e10a36ae45331cd5959df578816ee8ab47622cffe",
+ "chars": 4289,
"summary_state": "ready",
- "summary": "This class synthesizes a graph structure from simple markup, enabling tests to define the relationships between nodes explicitly.",
+ "summary": "This file resolves raw edge intents into concrete edges by matching names against a node index, ensuring accurate relationships between nodes.",
"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"
+ "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": "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,
+ "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": "b42a19064389576a02ba334fcab8bfb5d8d985a46f995be864095e770d47e26d",
+ "body_hash": "0f349e9ed1ee9ef1c7695b65c3f3948140eb20a60f36ba9d915a79e92eed7391",
"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"
- }
+ "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": "test/helpers.ts#BracketSynthesizer.synthesize.ensure",
- "name": "ensure",
+ "id": "src/graph/resolve.ts#resolveEdges",
+ "name": "resolveEdges",
"kind": "function",
- "path": "test/helpers.ts",
- "span": "L24-L31",
- "signature": "ensure = (name: string)",
+ "path": "src/graph/resolve.ts",
+ "span": "L20-L58",
+ "signature": "function resolveEdges(nodes: NodeV1[], rawEdges: RawEdge[]): EdgeV1[]",
"exported": true,
"origin": "ast",
- "body_hash": "3b8cc65a6170766e70a5b038f9f27176e60114ce70e0e2dc1463f720ed384c4c",
+ "body_hash": "ace9e1eb0f3e9bc400f1341e0c23209b13d3c4f2b004e55a2397ebf4902cb41e",
"summary_state": "ready",
- "summary": "This function ensures that a node exists in the map, creating it if necessary, to maintain the graph structure.",
+ "summary": "This function processes raw edges and establishes relationships between nodes based on their types and specified relations.",
"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"
+ "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": "test/helpers.ts#fakeProviders",
- "name": "fakeProviders",
+ "id": "src/graph/resolve.ts#resolveEdges.add",
+ "name": "add",
"kind": "function",
- "path": "test/helpers.ts",
- "span": "L52-L54",
- "signature": "function fakeProviders()",
+ "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": "0395bc21ba030a5d0e1fc9e5fdd0d8780c4309c87d899bedbc940f1bdcd2864f",
+ "body_hash": "7f8c2ba06670d38fd33b508c463d4c8e08ae614f7559b3571c8b7db1d51fd380",
"summary_state": "ready",
- "summary": "This function creates and returns instances of the test doubles for summarization and synthesis.",
- "crux": null
+ "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": "test/helpers.ts#PassthroughSummarizer",
- "name": "PassthroughSummarizer",
- "kind": "class",
- "path": "test/helpers.ts",
- "span": "L9-L13",
- "signature": "class PassthroughSummarizer implements Summarizer",
- "exported": true,
+ "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": "43c71f9e449859d657d6cef17b80d2bb650734751530e8401c356fc963f7b012",
+ "body_hash": "5dcee73ae49d61baf6cba0f1430bcc799975d19b6d72ac0a6da911e14fafa955",
"summary_state": "ready",
- "summary": "This class serves as a no-op summarizer that returns the input code unchanged for controlled testing.",
+ "summary": "This function resolves a module specifier to a file node ID if it points within the repository, ensuring correct imports.",
"crux": {
- "code": " async summarize(code: string): Promise<string> {\n return code;\n }",
- "span": "L10-L12"
+ "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": "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,
+ "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": "8836e78c4875dee01aeae5cb976c217cd347554542e387996b7c190b1a73af18",
+ "body_hash": "612a086f93eb383b759795d9e5b93d6f429bd4a17c22c9b3e65fcf7d79e0e6f0",
"summary_state": "ready",
- "summary": "This method returns the input code as-is, allowing tests to control the output precisely.",
+ "summary": "This function resolves a symbol name to its corresponding node ID, prioritizing local matches and handling ambiguities appropriately.",
"crux": {
- "code": " async summarize(code: string): Promise<string> {\n return code;\n }",
- "span": "L10-L12"
+ "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": "test/viz-assemble.test.ts",
- "name": "viz-assemble.test.ts",
+ "id": "src/graph/types.ts",
+ "name": "types.ts",
"kind": "file",
- "path": "test/viz-assemble.test.ts",
- "span": "L1-L106",
+ "path": "src/graph/types.ts",
+ "span": "L1-L84",
"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.",
+ "body_hash": "a7bc780be6180ddf19de4a520a6b83749d6f4503e39df86322990d5fe283d035",
+ "chars": 2692,
+ "summary_state": "stale",
+ "summary": "Defines the schema for a code graph, outlining nodes and edges for code structure representation.",
"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"
+ "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": "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,
+ "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": "4fab7dd2dc5bc7c0b9d575f8396bdca67e8d2d5a9f337aa14ef7740dd87b2119",
+ "body_hash": "305d107dc8cea0d8fcf2e42c13eef23345a53cd6a24672d8a017d5c8d393d46c",
"summary_state": "ready",
- "summary": "This function creates a temporary directory with markdown files to simulate context data for testing the graph assembly.",
+ "summary": "Specifies the confidence levels for the truth of edges in the graph, aiding in the assessment of relationships.",
"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"
+ "code": "export type Confidence = \"extracted\" | \"inferred\";",
+ "span": "L25-L25"
}
},
{
- "id": "test/viz-serve.test.ts",
- "name": "viz-serve.test.ts",
- "kind": "file",
- "path": "test/viz-serve.test.ts",
- "span": "L1-L101",
- "signature": null,
+ "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": "d22168054844e83bc5257271c4cc80a6e3eb1315e600c03b48fe6b54afd5c243",
+ "body_hash": "157f97611f592b25b78af3bd626d10c866b4aa23344a96823de466eb1ecbe28d",
"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.",
+ "summary": "Holds the LLM-chosen business-logic excerpt for a node, providing a source of truth for code interpretation.",
"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"
+ "code": "export interface Crux {\n code: string;\n span: string; // e.g. \"L189-L196\"\n}",
+ "span": "L32-L35"
}
},
{
- "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,
+ "id": "src/graph/types.ts#EdgeV1",
+ "name": "EdgeV1",
+ "kind": "interface",
+ "path": "src/graph/types.ts",
+ "span": "L67-L72",
+ "signature": "interface EdgeV1",
+ "exported": true,
"origin": "ast",
- "body_hash": "cff2ec95e868528eec2623a2907ab4c4e3e4a55224d0551b1fb8a63e8bbc124d",
+ "body_hash": "ab2ffb1ba27a286985e517d71d7866d2d389e585d1584647a90fb520b4d92628",
"summary_state": "ready",
- "summary": "This function creates necessary directory structures and files for testing the viz server.",
+ "summary": "Describes the edges connecting nodes in the graph, detailing the source, target, and relationship type.",
"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"
+ "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": "viewer/data.ts",
- "name": "data.ts",
- "kind": "file",
- "path": "viewer/data.ts",
- "span": "L1-L122",
- "signature": null,
+ "id": "src/graph/types.ts#GraphV1",
+ "name": "GraphV1",
+ "kind": "interface",
+ "path": "src/graph/types.ts",
+ "span": "L74-L83",
+ "signature": "interface GraphV1",
"exported": true,
"origin": "ast",
- "body_hash": "e9c5c89ad933e06004cbeddc1b1d7b60a6057726a463c66f9673ba20a3c61afd",
+ "body_hash": "fa588451b38bfa2c1ea17eeabb5cd4d18769ecbf75ba79fb160d59d2d2666e8e",
"summary_state": "ready",
- "summary": "This file defines data structures and functions for managing and visualizing graph data from a server.",
- "crux": null
+ "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": "viewer/data.ts#chipKey",
- "name": "chipKey",
- "kind": "function",
- "path": "viewer/data.ts",
- "span": "L47-L51",
- "signature": "function chipKey(rel: string): string",
+ "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": "85dd128b9f3bf028efaeac2428474b0d70ac47e8e94bcba80c111d59a6006df9",
+ "body_hash": "b233aa721b3c652dd7f3b4de6e3410e0f44a1da079cbb90df6d8e05eb4cc49f0",
"summary_state": "ready",
- "summary": "Generates a key for chip grouping based on the relation verb, simplifying the visualization of relationships.",
+ "summary": "Enumerates the types of symbols that can exist in the code graph, facilitating type identification.",
"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"
+ "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": "viewer/data.ts#CodeGraphV1",
- "name": "CodeGraphV1",
+ "id": "src/graph/types.ts#NodeV1",
+ "name": "NodeV1",
"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",
+ "path": "src/graph/types.ts",
+ "span": "L37-L57",
+ "signature": "interface NodeV1",
"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.",
+ "body_hash": "ed212ae4313b6fd9d229e646a67253b90a959f0546af1a2e7d7216b5fd9051f4",
+ "summary_state": "stale",
+ "summary": "Represents a node in the graph with its identity, location, and meaning, essential for graph construction.",
"crux": {
- "code": " return m[type] ?? \"--edge\";",
- "span": "L74-L74"
+ "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": "viewer/data.ts#cvar",
- "name": "cvar",
- "kind": "function",
- "path": "viewer/data.ts",
- "span": "L77-L79",
- "signature": "function cvar(name: string): string",
+ "id": "src/graph/types.ts#Relation",
+ "name": "Relation",
+ "kind": "type",
+ "path": "src/graph/types.ts",
+ "span": "L59-L65",
+ "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": "89e6f3b44e0dd358542573894691c925266e88da9160b79be00d043ae17245e8",
+ "body_hash": "226fd93c673f4bfa583e44e3be8c2ca8e0957bf1b95771f067e4999b1e89d145",
"summary_state": "ready",
- "summary": "Retrieves the value of a CSS custom property from the document's root element.",
- "crux": null
+ "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": "viewer/data.ts#Family",
- "name": "Family",
+ "id": "src/graph/types.ts#SummaryState",
+ "name": "SummaryState",
"kind": "type",
- "path": "viewer/data.ts",
- "span": "L29-L29",
- "signature": "type Family = \"structure\" | \"dependency\" | \"contract\" | \"association\";",
+ "path": "src/graph/types.ts",
+ "span": "L28-L28",
+ "signature": "type SummaryState = \"pending\" | \"ready\" | \"stale\";",
"exported": true,
"origin": "ast",
- "body_hash": "324db0cd1c7f2eebbda194734b2a8db880eb835949f0325780ea5ae75308ef05",
+ "body_hash": "0689b3a76aa3ee3553bec1bccff2817cac613e747d317688f296748e8c929e0e",
"summary_state": "ready",
- "summary": "Categorizes relation verbs into families to enforce consistent semantics in graph relationships.",
+ "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",
+ "chars": 1940,
+ "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": "viewer/data.ts#famOf",
- "name": "famOf",
+ "id": "src/graph/write.ts#edgeOrder",
+ "name": "edgeOrder",
"kind": "function",
- "path": "viewer/data.ts",
- "span": "L39-L41",
- "signature": "function famOf(rel: string): Family",
- "exported": true,
+ "path": "src/graph/write.ts",
+ "span": "L48-L54",
+ "signature": "function edgeOrder(a: EdgeV1, b: EdgeV1): number",
+ "exported": false,
"origin": "ast",
- "body_hash": "faed31084ad49496d754f589593081a76a4cd98e714ff10a10c07d5cd476738d",
+ "body_hash": "1c2665c44f094c37f510a0ca5befc63bf67ae59c52d77dfdcbe15611d2e5abbe",
"summary_state": "ready",
- "summary": "Determines the family category of a given relation verb, defaulting to 'association' if unknown.",
+ "summary": "Defines the sorting order for edges in the wiring graph based on source, relation, and target.",
"crux": {
- "code": " return FAMILY[rel] ?? \"association\";",
- "span": "L40-L40"
+ "code": " a.source.localeCompare(b.source) ||\n a.relation.localeCompare(b.relation) ||\n a.target.localeCompare(b.target)",
+ "span": "L50-L52"
}
},
{
- "id": "viewer/data.ts#loadCodeGraph",
- "name": "loadCodeGraph",
+ "id": "src/graph/write.ts#readGraph",
+ "name": "readGraph",
"kind": "function",
- "path": "viewer/data.ts",
- "span": "L96-L113",
- "signature": "async function loadCodeGraph(): Promise<VizGraph | null>",
+ "path": "src/graph/write.ts",
+ "span": "L28-L34",
+ "signature": "function readGraph(path: string): GraphV1 | null",
"exported": true,
"origin": "ast",
- "body_hash": "343a1a01362fa33345082eb6cd5a04cfc1b7a1411de7bc23422c5ac5ebb1fae1",
+ "body_hash": "a68ca7cd48652a99a350b76c387a19462cc984c42bbc9b00a30e629af5fda52e",
"summary_state": "ready",
- "summary": "Loads the code graph from the server, filtering out unresolved edges and returning a structured graph.",
+ "summary": "Reads and parses an existing wiring graph from a file, returning null if the file is absent or unparseable.",
"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"
+ "code": " return JSON.parse(readFileSync(path, \"utf8\")) as GraphV1;\n } catch {\n return null;",
+ "span": "L30-L32"
}
},
{
- "id": "viewer/data.ts#loadContextGraph",
- "name": "loadContextGraph",
+ "id": "src/graph/write.ts#wiringPath",
+ "name": "wiringPath",
"kind": "function",
- "path": "viewer/data.ts",
- "span": "L81-L84",
- "signature": "async function loadContextGraph(): Promise<VizGraph>",
+ "path": "src/graph/write.ts",
+ "span": "L20-L22",
+ "signature": "function wiringPath(outDir: string): string",
"exported": true,
"origin": "ast",
- "body_hash": "c65d9227bea8ceceffd49b4eb8475677aef8ca8820b966d9228a31875a6589e1",
+ "body_hash": "4a454f03e0aa7289fbc47e6493079ab7f8b353b6133b4362158857eda98bb544",
"summary_state": "ready",
- "summary": "Fetches the context graph data from the server and returns it in a structured format.",
+ "summary": "Generates the absolute path for the wiring graph file in a specified output directory.",
"crux": {
- "code": " const res = await fetch(\"/api/context-graph\");\n return (await res.json()) as VizGraph;",
- "span": "L82-L83"
+ "code": " return join(outDir, GRAPH_DIR, GRAPH_FILE);",
+ "span": "L21-L21"
}
},
{
- "id": "viewer/data.ts#onServerChange",
- "name": "onServerChange",
+ "id": "src/graph/write.ts#writeGraph",
+ "name": "writeGraph",
"kind": "function",
- "path": "viewer/data.ts",
- "span": "L116-L121",
- "signature": "function onServerChange(handler: () => void): void",
+ "path": "src/graph/write.ts",
+ "span": "L36-L46",
+ "signature": "function writeGraph(graph: GraphV1, outDir: string): string",
"exported": true,
"origin": "ast",
- "body_hash": "d864a1d7995232ad54351830e5963a2c6fc8c64cc5a941cf9cfea74d688514c9",
+ "body_hash": "1c7e1c1674a049208f245753f107cf9fb4dceea8ec5c19c8086df2f8af1b7aeb",
"summary_state": "ready",
- "summary": "Subscribes to server events to trigger updates in the application when changes occur.",
+ "summary": "Writes a sorted representation of the wiring graph to a specified output directory, ensuring the directory structure exists.",
"crux": {
- "code": " if (ev.data === \"change\") handler();",
- "span": "L119-L119"
+ "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": "viewer/data.ts#VizEdge",
- "name": "VizEdge",
- "kind": "interface",
- "path": "viewer/data.ts",
- "span": "L14-L20",
- "signature": "interface VizEdge",
+ "id": "src/index.ts",
+ "name": "index.ts",
+ "kind": "file",
+ "path": "src/index.ts",
+ "span": "L1-L37",
+ "signature": null,
"exported": true,
"origin": "ast",
- "body_hash": "13baa6c9acc4c78eec36835e02fd49df79e869f836880341a959be134ceaabb1",
+ "body_hash": "e56e74612514fd45665b27e3c47b4a685b503a533b38e1674d256344511107fc",
+ "chars": 1542,
"summary_state": "ready",
- "summary": "Defines the relationship between two nodes in the visualization graph, including its type and description.",
- "crux": null
+ "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": "viewer/data.ts#VizGraph",
- "name": "VizGraph",
- "kind": "interface",
- "path": "viewer/data.ts",
- "span": "L22-L26",
- "signature": "interface VizGraph",
+ "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": "6448a4bb9c71c7932dce92d9d8a452f99a0a100041bd30c5b6759c5784b0f098",
+ "body_hash": "a8339532da34b44d35eb9ad16e7106adb1262d73d9895b1bd94574337fb2019f",
+ "chars": 1218,
"summary_state": "ready",
- "summary": "Encapsulates the entire visualization graph structure, including its nodes and edges.",
+ "summary": "This file provides utilities for walking through a filesystem to identify source files while excluding certain directories and large files.",
"crux": null
},
{
- "id": "viewer/data.ts#VizNode",
- "name": "VizNode",
- "kind": "interface",
- "path": "viewer/data.ts",
- "span": "L6-L12",
- "signature": "interface VizNode",
+ "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": "ec19a79898c594e5afc405cab037fcc0c43144c5766af8a955dccda7df733ba6",
+ "body_hash": "001f6c9f648af0620ed90c55a132464ab87da3ad74b6711df716e9f9493333c4",
"summary_state": "ready",
- "summary": "Represents a node in the visualization graph, encapsulating its identity and metadata.",
- "crux": null
+ "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": "viewer/detail.ts",
- "name": "detail.ts",
+ "id": "src/util/id.ts",
+ "name": "id.ts",
"kind": "file",
- "path": "viewer/detail.ts",
- "span": "L1-L59",
+ "path": "src/util/id.ts",
+ "span": "L1-L17",
"signature": null,
"exported": true,
"origin": "ast",
- "body_hash": "fe8df7c5561f2a8588cf4e1ecb367d19cb6b480fe4855f05e4f96137d8078884",
+ "body_hash": "5fabc8ddcc3abc907ce69f04ad2ebe51933262cf44aa2dfd40589f71f1926e8a",
+ "chars": 626,
"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"
- }
+ "summary": "This file provides utility functions for generating unique identifiers, creating content hashes, and normalizing names for consistent matching.",
+ "crux": null
},
{
- "id": "viewer/detail.ts#esc",
- "name": "esc",
+ "id": "src/util/id.ts#contentHash",
+ "name": "contentHash",
"kind": "function",
- "path": "viewer/detail.ts",
- "span": "L8-L10",
- "signature": "function esc(s: string): string",
- "exported": false,
+ "path": "src/util/id.ts",
+ "span": "L9-L11",
+ "signature": "function contentHash(input: string): string",
+ "exported": true,
"origin": "ast",
- "body_hash": "9fb927f7f1c881ee1fe325c0dc8a25b8c5cdb2c101b08ae935a35bb428f5bbdb",
+ "body_hash": "d83ce720108cb9ea3b0c7b1e7034657603640647ca00283905fcd099ac3fe2ed",
"summary_state": "ready",
- "summary": "This function sanitizes a string for safe HTML rendering by escaping special characters.",
+ "summary": "This function creates a stable hash of the input content, which is essential for deduplication of documents.",
"crux": {
- "code": " return s.replace(/&/g, \"&amp;\").replace(/</g, \"&lt;\");\n}",
- "span": "L9-L10"
+ "code": " return createHash(\"sha256\").update(input).digest(\"hex\");",
+ "span": "L10-L10"
}
},
{
- "id": "viewer/detail.ts#renderDetail",
- "name": "renderDetail",
+ "id": "src/util/id.ts#newId",
+ "name": "newId",
"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",
+ "path": "src/util/id.ts",
+ "span": "L4-L6",
+ "signature": "function newId(prefix: string): string",
"exported": true,
"origin": "ast",
- "body_hash": "bbd0db0a7f39cbfbd9b0ca31f88118c9a2cd037d394ad47bff7203a6f399f5ca",
+ "body_hash": "55062dee898e1edb76d65f7daf785b67e998a57a7dfd6f78c7eb17f39e3e1dc0",
"summary_state": "ready",
- "summary": "This function renders the details of a selected node, including its type, name, summary, sources, and relationships.",
+ "summary": "This function generates a unique identifier with a specified prefix, solving the need for easily identifiable and unique keys.",
"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"
+ "code": " return `${prefix}_${randomUUID().replace(/-/g, \"\").slice(0, 20)}`;",
+ "span": "L5-L5"
}
},
{
- "id": "viewer/detail.ts#renderDetail.linkList",
- "name": "linkList",
+ "id": "src/util/id.ts#normalizeName",
+ "name": "normalizeName",
"kind": "function",
- "path": "viewer/detail.ts",
- "span": "L40-L50",
- "signature": "linkList = (edges: typeof out, dotColor: string, title: string, other: (e: (typeof out)[number]) => string)",
+ "path": "src/util/id.ts",
+ "span": "L14-L16",
+ "signature": "function normalizeName(name: string): string",
"exported": true,
"origin": "ast",
- "body_hash": "f103fe554602f3315706280d7eba1016c647c77fa6af27e9a4ec0442d6cf1d89",
+ "body_hash": "bac0e298462067a441b2b76566ed29c3787280585b956f84b81d7a766cd7211a",
"summary_state": "ready",
- "summary": "This function generates HTML for displaying a list of links related to a node, categorized by their relationship type.",
+ "summary": "This function normalizes names for case- and whitespace-insensitive matching, ensuring consistency in name comparisons.",
"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"
+ "code": " return name.trim().toLowerCase().replace(/\\s+/g, \" \");",
+ "span": "L15-L15"
}
},
{
- "id": "viewer/detail.ts#renderDetail.name",
- "name": "name",
- "kind": "function",
- "path": "viewer/detail.ts",
- "span": "L29-L29",
- "signature": "name = (nid: string)",
+ "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": "617c48812e0f0520b45da770cf91aeea5330b7e690c6d93defd4da77edf11b8a",
+ "body_hash": "58ad5caed087bd7b929f5b625501a607e79e0476f998636bec241e0296706ece",
+ "chars": 4233,
"summary_state": "ready",
- "summary": "This function retrieves the name of a node by its ID, providing a fallback if not found.",
+ "summary": "Assembles a comprehensive graph document from markdown files in a context directory, ensuring that only valid nodes and edges are included.",
"crux": {
- "code": " const name = (nid: string) => graph.nodes.find((n) => n.id === nid)?.name ?? nid;",
- "span": "L29-L29"
+ "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": "viewer/graph.ts",
- "name": "graph.ts",
- "kind": "file",
- "path": "viewer/graph.ts",
- "span": "L1-L335",
- "signature": null,
+ "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": "192a59b16da8327457de6723893fd9207dd9570a35cd664f96534a7b85e73e01",
+ "body_hash": "8529626bef8abf2e1a326d601cf5a6a4972e0a1b801d6b653ba8227a27b9dbbd",
"summary_state": "ready",
- "summary": "This file implements a force-directed graph visualization using D3.js, allowing interactive exploration of nodes and edges.",
+ "summary": "Processes markdown files in a specified directory to create a structured visualization graph, handling errors gracefully.",
"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"
+ "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": "viewer/graph.ts#el",
- "name": "el",
+ "id": "src/viz/assemble.ts#extractSummary",
+ "name": "extractSummary",
"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]",
+ "path": "src/viz/assemble.ts",
+ "span": "L65-L76",
+ "signature": "function extractSummary(body: string): string",
"exported": false,
"origin": "ast",
- "body_hash": "de7f696c06af5d771e8e661f398d9d275ca2cc06d86f4e91458d671480e346b7",
+ "body_hash": "1857e477bdb012672fa843cfca8d43eb543e7cfba2cc496692a65ebe8c0fa6c5",
"summary_state": "ready",
- "summary": "Creates and returns an SVG element with specified attributes, facilitating dynamic SVG generation.",
- "crux": null
+ "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": "viewer/graph.ts#GraphView",
- "name": "GraphView",
- "kind": "class",
- "path": "viewer/graph.ts",
- "span": "L48-L334",
- "signature": "class GraphView",
+ "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": "1405c1f292294538c45794740adf01c59c83d3fd7047b6efa8c04c90a4409310",
+ "body_hash": "adfaae55d1d21718adbedaa294194517aa7abdddeb95433642fd358137e48909",
"summary_state": "ready",
- "summary": "Manages the rendering and interaction of the graph view, including node and edge updates.",
+ "summary": "Maps legacy vague verbs to concrete verbs to maintain consistency in the graph's relationships.",
"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"
+ "code": "export function normalizeRelation(rel: string): string {\n return NORMALIZE_RELATION[rel] ?? rel;\n}",
+ "span": "L56-L58"
}
},
{
- "id": "viewer/graph.ts#GraphView.applyView",
- "name": "applyView",
- "kind": "method",
- "path": "viewer/graph.ts",
- "span": "L268-L270",
- "signature": "private applyView(): void",
+ "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": "2adb54996d6ef9272cd69144b4b6c4bb92236506a3f5bf2d589faffd5218554b",
+ "body_hash": "bef3aefe267d463b0d4cf617f379adadd4fffb539e9a0a5e240520be60a191cb",
"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"
- }
+ "summary": "Defines the structure of an edge in the visualization graph, representing relationships between nodes.",
+ "crux": null
},
{
- "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",
+ "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": "00e851d11e1029516256411b627b60e78d781cdc62ada046a0eb93c55c2dd009",
+ "body_hash": "7edd9c49c11acc8e90963256a92ee2f27415c50446334924e2e260b715b56427",
"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"
- }
+ "summary": "Encapsulates the complete visualization graph, including metadata about nodes and edges.",
+ "crux": null
},
{
- "id": "viewer/graph.ts#GraphView.bindDrag.move",
- "name": "move",
- "kind": "function",
- "path": "viewer/graph.ts",
- "span": "L294-L299",
- "signature": "move = (mv: PointerEvent)",
+ "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": "656f371efff6a0eed7868895a4044e4fdf1dc88840de21376c388ba03149fbd0",
+ "body_hash": "ec19a79898c594e5afc405cab037fcc0c43144c5766af8a955dccda7df733ba6",
"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"
- }
+ "summary": "Defines the structure of a node in the visualization graph, encapsulating its identity and attributes.",
+ "crux": null
},
{
- "id": "viewer/graph.ts#GraphView.bindDrag.up",
- "name": "up",
- "kind": "function",
- "path": "viewer/graph.ts",
- "span": "L300-L305",
- "signature": "up = ()",
+ "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": "a935b15e42eefdf45da528afe3172b559d3e9ee97fe4be67f682dedccaac64c2",
+ "body_hash": "14283762f454c01fc95cfbe9c2b41ef063fc17c4c3e5d120b5dc7f66f541fc1c",
+ "chars": 4909,
"summary_state": "ready",
- "summary": "Finalizes the drag operation by releasing the node's fixed position.",
+ "summary": "This file implements a local server for serving a viewer and handling API requests related to context and code graphs.",
"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"
+ "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": "viewer/graph.ts#GraphView.bindPanZoom",
- "name": "bindPanZoom",
- "kind": "method",
- "path": "viewer/graph.ts",
- "span": "L311-L333",
- "signature": "private bindPanZoom(): void",
- "exported": true,
+ "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": "737e5f69bc32913d3b061a4a878b61245d242e217f451a81d72d21e1d28fae30",
+ "body_hash": "b43a357dceb98a6eb6676409503021e6e38f13d7d442d44ba819dda0c0ea6246",
"summary_state": "ready",
- "summary": "Sets up event listeners for panning and zooming the graph view based on user interactions.",
+ "summary": "Attempts to bind the server to a specified port, handling errors if the port is in use.",
"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"
+ "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": "viewer/graph.ts#GraphView.buildChrome",
- "name": "buildChrome",
- "kind": "method",
- "path": "viewer/graph.ts",
- "span": "L71-L78",
- "signature": "private buildChrome(): void",
- "exported": true,
+ "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": "592cef68d76f99ad8da470cc3c8b4eda64701c02b8740a21e659fdd5e5325def",
+ "body_hash": "6643919e3ea413fc58afe100fe65dc3beccadb7aa66bf5d3247e072c83d9d000",
"summary_state": "ready",
- "summary": "Sets up the initial SVG structure for the graph, including definitions and viewport.",
+ "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": " 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"
+ "code": " res.writeHead(status, { \"content-type\": \"application/json; charset=utf-8\" });\n res.end(JSON.stringify(body));\n}",
+ "span": "L39-L41"
}
},
{
- "id": "viewer/graph.ts#GraphView.buildElements",
- "name": "buildElements",
- "kind": "method",
- "path": "viewer/graph.ts",
- "span": "L138-L164",
- "signature": "private buildElements(): void",
+ "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": "a608a77fab16447bd9ef9c465a192abc0cb7167807f7c1718d961d730d7f055d",
+ "body_hash": "d652f8a8b5ea738a1ff68592d9644525dee438568c9158e5edffe536b1f1aa16",
"summary_state": "ready",
- "summary": "Constructs the SVG elements for nodes and edges based on the current dataset.",
+ "summary": "Initializes and starts the visualization server, setting up routes and handling requests.",
"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"
+ "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": "viewer/graph.ts#GraphView.constructor",
- "name": "constructor",
+ "id": "src/viz/serve.ts#startVizServer.close",
+ "name": "close",
"kind": "method",
- "path": "viewer/graph.ts",
- "span": "L65-L69",
- "signature": "constructor(svg: SVGSVGElement)",
+ "path": "src/viz/serve.ts",
+ "span": "L140-L146",
+ "signature": "close(): Promise<void>",
"exported": true,
"origin": "ast",
- "body_hash": "27abb788d7de0ece37719a0a23d4fed7778c02dda10700bbfb4f110ea8c16984",
+ "body_hash": "69dc0089d8f1d6e843c8add8fabf2e120fd1045505f9c15632ba93bdc58c01d4",
"summary_state": "ready",
- "summary": "Initializes the GraphView instance and sets up the SVG environment for rendering.",
- "crux": null
+ "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": "viewer/graph.ts#GraphView.ensureMarkers",
- "name": "ensureMarkers",
- "kind": "method",
- "path": "viewer/graph.ts",
- "span": "L80-L91",
- "signature": "private ensureMarkers(): void",
+ "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": "9517cfdb2ccb4ce235405356f6ff9b2fb3fcd2f7d687689bde33cf5df9bd6906",
+ "body_hash": "9c56587daccba8982a5f5da3a0ea5f185becea8c4f4927331b15117f5d456214",
"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"
- }
+ "summary": "Represents the visualization server with its URL and a method to close it.",
+ "crux": null
},
{
- "id": "viewer/graph.ts#GraphView.firstMatch",
- "name": "firstMatch",
- "kind": "method",
- "path": "viewer/graph.ts",
- "span": "L263-L266",
- "signature": "firstMatch(): SimNode | undefined",
+ "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": "d43343323ad49732d473f46773ac41a0ee7472f6289d324eb369d739e8cb0352",
+ "body_hash": "0b439484269a73c19df0d658113fbdc889c2214d1081e08d92bc86ae99e0c795",
"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"
- }
+ "summary": "Defines the configuration options required to start the visualization server.",
+ "crux": null
},
{
- "id": "viewer/graph.ts#GraphView.focus",
- "name": "focus",
- "kind": "method",
- "path": "viewer/graph.ts",
- "span": "L252-L261",
- "signature": "focus(id: string): void",
+ "id": "test/ask.test.ts",
+ "name": "ask.test.ts",
+ "kind": "file",
+ "path": "test/ask.test.ts",
+ "span": "L1-L55",
+ "signature": null,
"exported": true,
"origin": "ast",
- "body_hash": "a64691876d1786ccdb2027028d00210b8cb56557c65c1afa81a886b506d7b459",
+ "body_hash": "b2d9beeea01fd6faab6225ea3b3a735d5dd808e8358ffe37bb82a2a5f5da3dce",
+ "chars": 2123,
"summary_state": "ready",
- "summary": "Centers the view on a specified node, enhancing its visibility and selection.",
+ "summary": "This file contains tests for the `graft ask` functionality, ensuring that the source option correctly inlines code from disk when requested.",
"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"
+ "code": "test(\"ask without source returns pointers but no inlined code\", async () => {\n const dir = makeFixture();\n try {\n await buildGraph(dir); // $0, structure-only — cards + wiring.json\n const r = ask(dir, \"addNumbers\");\n const hit = r.hits.find((h) => h.title.startsWith(\"addNumbers\"));\n assert.ok(hit, \"should locate the addNumbers symbol\");\n assert.match(hit.pointer, /^math\\.ts:L\\d+-L\\d+$/);\n assert.equal(hit.code, undefined, \"no source inlined without the option\");\n } finally {\n rmSync(dir, { recursive: true, force: true });\n }",
+ "span": "L26-L37"
}
},
{
- "id": "viewer/graph.ts#GraphView.reheat",
- "name": "reheat",
- "kind": "method",
- "path": "viewer/graph.ts",
- "span": "L286-L288",
- "signature": "reheat(): void",
- "exported": true,
+ "id": "test/ask.test.ts#makeFixture",
+ "name": "makeFixture",
+ "kind": "function",
+ "path": "test/ask.test.ts",
+ "span": "L15-L24",
+ "signature": "function makeFixture(): string",
+ "exported": false,
"origin": "ast",
- "body_hash": "ca57d7cb11e71985bcd27b937b4f6d0a62428a0ae84f5a297cb1147861032a59",
+ "body_hash": "2782fc6b3f2efa27b0c0195482a4b138e1ec02bd16da279313966e96a6d807e8",
"summary_state": "ready",
- "summary": "Restarts the simulation with increased alpha, making the graph more dynamic.",
+ "summary": "Creates a temporary directory with a sample TypeScript file for testing purposes.",
"crux": {
- "code": " reheat(): void {\n this.sim?.alpha(0.6).restart();\n }",
- "span": "L286-L288"
+ "code": " const dir = mkdtempSync(join(tmpdir(), \"graft-ask-\"));\n writeFileSync(\n join(dir, \"math.ts\"),\n `export function addNumbers(a: number, b: number): number {\\n` +\n ` return a + b;\\n` +\n `}\\n`,\n );\n return dir;",
+ "span": "L16-L23"
}
},
{
- "id": "viewer/graph.ts#GraphView.resetView",
- "name": "resetView",
- "kind": "method",
- "path": "viewer/graph.ts",
- "span": "L281-L284",
- "signature": "resetView(): void",
+ "id": "test/claude-format.test.ts",
+ "name": "claude-format.test.ts",
+ "kind": "file",
+ "path": "test/claude-format.test.ts",
+ "span": "L1-L106",
+ "signature": null,
"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"
- }
+ "body_hash": "bbbb252bb379e8a18ae263f277438c5dc31047374fc6d66ddc7dff206d64bb71",
+ "chars": 4810,
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "viewer/graph.ts#GraphView.restyle",
- "name": "restyle",
- "kind": "method",
- "path": "viewer/graph.ts",
- "span": "L185-L243",
- "signature": "restyle(): void",
+ "id": "test/claude-format.test.ts#strip",
+ "name": "strip",
+ "kind": "function",
+ "path": "test/claude-format.test.ts",
+ "span": "L6-L6",
+ "signature": "strip = (s: string)",
+ "exported": false,
+ "origin": "ast",
+ "body_hash": "6381d72b2af2fa01d40d5fa8e463da782c5fe5655ad06caec8a3184ee6546edc",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
+ },
+ {
+ "id": "test/claude-hooks.test.ts",
+ "name": "claude-hooks.test.ts",
+ "kind": "file",
+ "path": "test/claude-hooks.test.ts",
+ "span": "L1-L105",
+ "signature": null,
"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"
- }
+ "body_hash": "2ce3f50d2a9908fa73baa41aea07f7b4e547ff803ae2167f48b4169617296599",
+ "chars": 4933,
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "viewer/graph.ts#GraphView.restyle.nodeShown",
- "name": "nodeShown",
+ "id": "test/claude-hooks.test.ts#fakeBuild",
+ "name": "fakeBuild",
"kind": "function",
- "path": "viewer/graph.ts",
- "span": "L195-L195",
- "signature": "nodeShown = (n: SimNode)",
- "exported": true,
+ "path": "test/claude-hooks.test.ts",
+ "span": "L49-L52",
+ "signature": "fakeBuild = (dir: string)",
+ "exported": false,
"origin": "ast",
- "body_hash": "a598aac16da1955aecc62f39590f30d0c7e780d99429b1657c1bbba7d157ddea",
- "summary_state": "ready",
- "summary": "Determines if a node should be displayed based on its type and visibility settings.",
+ "body_hash": "0eb606c28f6d7ec57d7fe9a9824b87942c0682ddb75d37fd911508366e5ac9e5",
+ "summary_state": "pending",
+ "summary": null,
"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,
+ "id": "test/claude-hooks.test.ts#runWithStdin",
+ "name": "runWithStdin",
+ "kind": "function",
+ "path": "test/claude-hooks.test.ts",
+ "span": "L38-L41",
+ "signature": "async function runWithStdin(text: string, fn: () => Promise<void>): Promise<void>",
+ "exported": false,
"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"
- }
+ "body_hash": "6bf4b171a46fcfcceccaedd45a273ed78fac5a1b4ae47bbd881df4e54c33b912",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "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",
+ "id": "test/claude-state.test.ts",
+ "name": "claude-state.test.ts",
+ "kind": "file",
+ "path": "test/claude-state.test.ts",
+ "span": "L1-L51",
+ "signature": null,
"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"
- }
+ "body_hash": "eb26e78fa237e15f579019a2f9de75ed029e0f081b7175d83ce79367515fb164",
+ "chars": 1969,
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "viewer/graph.ts#GraphView.tick",
- "name": "tick",
- "kind": "method",
- "path": "viewer/graph.ts",
- "span": "L166-L182",
- "signature": "private tick(): void",
+ "id": "test/claude-state.test.ts#fresh",
+ "name": "fresh",
+ "kind": "function",
+ "path": "test/claude-state.test.ts",
+ "span": "L11-L11",
+ "signature": "function fresh(): string",
+ "exported": false,
+ "origin": "ast",
+ "body_hash": "49e9f70f3b52532360521760ee5e0e5c907bdf3f55d1ed2c90bb3c3e48d93cda",
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
+ },
+ {
+ "id": "test/claude-stats.test.ts",
+ "name": "claude-stats.test.ts",
+ "kind": "file",
+ "path": "test/claude-stats.test.ts",
+ "span": "L1-L30",
+ "signature": null,
"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"
- }
+ "body_hash": "f625d026d152a65017699e37e27534043dc0af0f43ba2d3ea778bac8ddab82c3",
+ "chars": 983,
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "viewer/graph.ts#GraphView.zoomBy",
- "name": "zoomBy",
- "kind": "method",
- "path": "viewer/graph.ts",
- "span": "L272-L279",
- "signature": "zoomBy(factor: number): void",
+ "id": "test/claude-statusline.test.ts",
+ "name": "claude-statusline.test.ts",
+ "kind": "file",
+ "path": "test/claude-statusline.test.ts",
+ "span": "L1-L48",
+ "signature": null,
"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"
- }
+ "body_hash": "07128b5b195af3a37c1e170a35c18378e36160d1a6f8e17be362bac315811cac",
+ "chars": 2137,
+ "summary_state": "pending",
+ "summary": null,
+ "crux": null
},
{
- "id": "viewer/graph.ts#SimEdge",
- "name": "SimEdge",
- "kind": "interface",
- "path": "viewer/graph.ts",
- "span": "L32-L38",
- "signature": "interface SimEdge",
+ "id": "test/claude-statusline.test.ts#repo",
+ "name": "repo",
+ "kind": "function",
+ "path": "test/claude-statusline.test.ts",
+ "span": "L9-L9",
+ "signature": "function repo(): string",
"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.",
+ "body_hash": "121eb027efad697b8021b3a994a7f977441a0a34c0e92fd9a1792851368850e5",
+ "summary_state": "pending",
+ "summary": null,
"crux": null
},
{
- "id": "viewer/graph.ts#SimNode",
- "name": "SimNode",
- "kind": "interface",
- "path": "viewer/graph.ts",
- "span": "L22-L30",
- "signature": "interface SimNode extends SimulationNodeDatum",
+ "id": "test/claude-statusline.test.ts#writeWiring",
+ "name": "writeWiring",
+ "kind": "function",
+ "path": "test/claude-statusline.test.ts",
+ "span": "L10-L13",
+ "signature": "function writeWiring(dir: string, obj: unknown): void",
"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.",
+ "body_hash": "2e1f37e4395b142a5e04d343c3d72366ed3c3245acc13afc8eef46df21b1df21",
+ "summary_state": "pending",
+ "summary": null,
"crux": null
},
{
- "id": "viewer/main.ts",
- "name": "main.ts",
+ "id": "test/context.test.ts",
+ "name": "context.test.ts",
"kind": "file",
- "path": "viewer/main.ts",
- "span": "L1-L233",
+ "path": "test/context.test.ts",
+ "span": "L1-L137",
"signature": null,
"exported": true,
"origin": "ast",
- "body_hash": "ab45ce4dfe66aafbe779b71d49d6370b3fe64482307b994e857ce34d3f317325",
+ "body_hash": "7c1242872b127117c7cc50404895d7ffcf286a51b611cd23c4ffabd5db8d43f3",
+ "chars": 4632,
"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.",
+ "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": "const view = new GraphView($(\"graphSvg\") as unknown as SVGSVGElement);",
- "span": "L21-L21"
+ "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": "viewer/main.ts#$",
- "name": "$",
+ "id": "test/context.test.ts#buildOpts",
+ "name": "buildOpts",
"kind": "function",
- "path": "viewer/main.ts",
- "span": "L12-L12",
- "signature": "$ = <T extends HTMLElement>(id: string): T",
+ "path": "test/context.test.ts",
+ "span": "L27-L29",
+ "signature": "function buildOpts()",
"exported": false,
"origin": "ast",
- "body_hash": "e46dd7aa9ed3186876ec11a8520b5af609af327108e045bce175d535aa9ed0e5",
+ "body_hash": "20ec093d8fa9dadc46af8980d9440b6824597f4cdeb74529d4d62ee38d27e52d",
"summary_state": "ready",
- "summary": "Provides a type-safe way to retrieve HTML elements by their ID, enhancing code readability and reducing errors.",
+ "summary": "This function generates options for building the context, including a fake model and providers.",
"crux": null
},
{
- "id": "viewer/main.ts#activeGraph",
- "name": "activeGraph",
+ "id": "test/context.test.ts#makeFixture",
+ "name": "makeFixture",
"kind": "function",
- "path": "viewer/main.ts",
- "span": "L23-L25",
- "signature": "function activeGraph(): VizGraph | null",
+ "path": "test/context.test.ts",
+ "span": "L14-L25",
+ "signature": "function makeFixture(): string",
"exported": false,
"origin": "ast",
- "body_hash": "71591b2a66c0aa4d34f5b96cb2f1293248bdf02f55f6a73c2ee48258f6e2c445",
+ "body_hash": "515198ac732683d4da4b920e53a0eb439ea8e0107afb22af65cc29c0e702192c",
"summary_state": "ready",
- "summary": "Determines which graph is currently active based on the selected tab, facilitating the correct data display.",
+ "summary": "This function creates a temporary directory with mock service files for testing the context building process.",
"crux": {
- "code": " return state.tab === \"context\" ? state.context : state.code;",
- "span": "L24-L24"
+ "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": "viewer/main.ts#glyphFor",
- "name": "glyphFor",
- "kind": "function",
- "path": "viewer/main.ts",
- "span": "L62-L71",
- "signature": "function glyphFor(key: string): string",
- "exported": false,
+ "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": "bd36f5f7c09e4d09ac342de7015c4cbda2ec86e36ab0c22716dd37b006444581",
+ "body_hash": "f5a75f405be1a01ad43fc806588858df3a8988fee62ad4ec024440d3f5e0fc0c",
+ "chars": 3059,
"summary_state": "ready",
- "summary": "Maps edge types to their corresponding visual glyphs, enhancing the graphical representation of relationships.",
+ "summary": "This test suite verifies that the wiring build correctly populates the 'covers' field in concept nodes and maintains stability across builds.",
"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"
+ "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": "viewer/main.ts#graphTab",
- "name": "graphTab",
+ "id": "test/covers.test.ts#makeFixture",
+ "name": "makeFixture",
"kind": "function",
- "path": "viewer/main.ts",
- "span": "L27-L29",
- "signature": "function graphTab(): \"context\" | \"code\"",
+ "path": "test/covers.test.ts",
+ "span": "L16-L24",
+ "signature": "function makeFixture(): string",
"exported": false,
"origin": "ast",
- "body_hash": "8bf89d024fe38470c469c719795eaf902c0e903157cf7ed24fe58a85db40cea4",
+ "body_hash": "c50f4905cfffe46da829a42a2bcab6838f96a17497009a9efe7a64a98729540f",
"summary_state": "ready",
- "summary": "Identifies the current graph tab, ensuring the correct context is used for rendering and interactions.",
+ "summary": "Creates a temporary directory with a sample TypeScript file for testing the wiring build.",
"crux": {
- "code": " return state.tab === \"code\" || state.tab === \"outline\" ? \"code\" : \"context\";",
- "span": "L28-L28"
+ "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": "viewer/main.ts#loadAll",
- "name": "loadAll",
- "kind": "function",
- "path": "viewer/main.ts",
- "span": "L216-L223",
- "signature": "async function loadAll(): Promise<void>",
- "exported": false,
+ "id": "test/helpers.ts",
+ "name": "helpers.ts",
+ "kind": "file",
+ "path": "test/helpers.ts",
+ "span": "L1-L55",
+ "signature": null,
+ "exported": true,
"origin": "ast",
- "body_hash": "c896b70116fce23a9b9846a95ed257835d18d1368d091a56cec01674e36bc480",
+ "body_hash": "e45af1d38d7c6d4abc804fc74e9ae4c3373cf78769c17b16b185c3ee0e2c3228",
+ "chars": 2012,
"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"
- }
+ "summary": "This file provides test doubles for offline, deterministic testing of components without external dependencies.",
+ "crux": null
},
{
- "id": "viewer/main.ts#renderChips",
- "name": "renderChips",
- "kind": "function",
- "path": "viewer/main.ts",
- "span": "L32-L60",
- "signature": "function renderChips(): void",
- "exported": false,
+ "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": "1ef41cd967e509d6342b72755564e0975cb6b87edfcc2911fe79404f906eddcb",
+ "body_hash": "6a30b1293990bb2dce95f1f1f77219dbcdc54eef7e6a01d0db03403f4d344bcc",
"summary_state": "ready",
- "summary": "Generates and displays interactive chips for graph edges, allowing users to filter and manage edge visibility.",
+ "summary": "This class synthesizes a graph structure from simple markup, enabling tests to define the relationships between nodes explicitly.",
"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"
+ "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": "viewer/main.ts#renderChips.rank",
- "name": "rank",
- "kind": "function",
- "path": "viewer/main.ts",
- "span": "L43-L43",
- "signature": "rank = (k: string)",
- "exported": false,
+ "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": "2b14b986fe4648076445602ac03c0f7c788760e8910fa9322617251aa60af5ce",
+ "body_hash": "b42a19064389576a02ba334fcab8bfb5d8d985a46f995be864095e770d47e26d",
"summary_state": "ready",
- "summary": "Establishes a ranking system for edge types to ensure they are displayed in a meaningful order.",
+ "summary": "This method processes file summaries to create a structured representation of nodes and their relationships based on markup.",
"crux": {
- "code": " const rank = (k: string) => (k === \"part of\" ? 0 : k === \"uses\" ? 1 : 2);",
- "span": "L43-L43"
+ "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": "viewer/main.ts#renderLegend",
- "name": "renderLegend",
+ "id": "test/helpers.ts#BracketSynthesizer.synthesize.ensure",
+ "name": "ensure",
"kind": "function",
- "path": "viewer/main.ts",
- "span": "L74-L94",
- "signature": "function renderLegend(): void",
- "exported": false,
+ "path": "test/helpers.ts",
+ "span": "L24-L31",
+ "signature": "ensure = (name: string)",
+ "exported": true,
"origin": "ast",
- "body_hash": "ec1a1aba1d086d035890c60aadf98d7418c018c5488f106100102deaf0eafc01",
+ "body_hash": "3b8cc65a6170766e70a5b038f9f27176e60114ce70e0e2dc1463f720ed384c4c",
"summary_state": "ready",
- "summary": "Creates a legend for node types in the graph, providing users with context about the displayed data.",
+ "summary": "This function ensures that a node exists in the map, creating it if necessary, to maintain the graph structure.",
"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"
+ "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": "viewer/main.ts#setTab",
- "name": "setTab",
+ "id": "test/helpers.ts#fakeProviders",
+ "name": "fakeProviders",
"kind": "function",
- "path": "viewer/main.ts",
- "span": "L129-L167",
- "signature": "function setTab(tab: Tab): void",
- "exported": false,
+ "path": "test/helpers.ts",
+ "span": "L52-L54",
+ "signature": "function fakeProviders()",
+ "exported": true,
"origin": "ast",
- "body_hash": "c269ec25c7011b7343bdcec22729b23b0c65a57255598ac5145a46397809b321",
+ "body_hash": "0395bc21ba030a5d0e1fc9e5fdd0d8780c4309c87d899bedbc940f1bdcd2864f",
"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"
- }
+ "summary": "This function creates and returns instances of the test doubles for summarization and synthesis.",
+ "crux": null
},
{
- "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,
+ "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": "e2b6f6a27ee1e3bac515ec8140678caa7c6cff3baab943cf43f8fdbdd7ab2e62",
+ "body_hash": "43c71f9e449859d657d6cef17b80d2bb650734751530e8401c356fc963f7b012",
"summary_state": "ready",
- "summary": "Displays detailed information about a selected graph element, enhancing user interaction and understanding.",
+ "summary": "This class serves as a no-op summarizer that returns the input code unchanged for controlled testing.",
"crux": {
- "code": " view.focus(next);\n }\n });",
- "span": "L121-L123"
+ "code": " async summarize(code: string): Promise<string> {\n return code;\n }",
+ "span": "L10-L12"
}
},
{
- "id": "viewer/main.ts#showEmpty",
- "name": "showEmpty",
- "kind": "function",
- "path": "viewer/main.ts",
- "span": "L169-L173",
- "signature": "function showEmpty(html: string): void",
- "exported": false,
+ "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": "981ef1b3d68cfcc89b2804a326c87ce023df618bfee612f158fa72291fe7a6d1",
+ "body_hash": "8836e78c4875dee01aeae5cb976c217cd347554542e387996b7c190b1a73af18",
"summary_state": "ready",
- "summary": "Displays a message when no graph data is available, guiding users on how to generate the necessary data.",
+ "summary": "This method returns the input code as-is, allowing tests to control the output precisely.",
"crux": {
- "code": " empty.innerHTML = html;\n empty.hidden = false;",
- "span": "L171-L172"
+ "code": " async summarize(code: string): Promise<string> {\n return code;\n }",
+ "span": "L10-L12"
}
},
{
- "id": "viewer/main.ts#Tab",
- "name": "Tab",
- "kind": "type",
- "path": "viewer/main.ts",
- "span": "L10-L10",
- "signature": "type Tab = \"context\" | \"code\" | \"outline\";",
- "exported": false,
+ "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": "4cd3b4afb6647f09ba09efccca7c53a333edbebe109fb1e24db04aa24df610de",
+ "body_hash": "89a2a9f11f459a8110f9d89b2de780dfd164504f3b4c7dc61953a6c83c5911cb",
+ "chars": 3118,
"summary_state": "ready",
- "summary": "Defines the possible tab types for the viewer, ensuring that only valid tab selections are made.",
- "crux": null
+ "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": "viewer/main.ts#updateCounts",
- "name": "updateCounts",
+ "id": "test/viz-assemble.test.ts#makeContextDir",
+ "name": "makeContextDir",
"kind": "function",
- "path": "viewer/main.ts",
- "span": "L103-L112",
- "signature": "function updateCounts(): void",
+ "path": "test/viz-assemble.test.ts",
+ "span": "L12-L60",
+ "signature": "function makeContextDir(): string",
"exported": false,
"origin": "ast",
- "body_hash": "170a2eec2d377c150839d170cd45a244584ecc9fdbd44ad194e8cac97fdfafb6",
+ "body_hash": "4fab7dd2dc5bc7c0b9d575f8396bdca67e8d2d5a9f337aa14ef7740dd87b2119",
"summary_state": "ready",
- "summary": "Refreshes the displayed counts of nodes and edges based on the active graph, ensuring accurate information is presented.",
+ "summary": "This function creates a temporary directory with markdown files to simulate context data for testing the graph assembly.",
"crux": {
- "code": " el.textContent = graph ? `${graph.meta.nodeCount} nodes · ${graph.meta.edgeCount} links` : \"\";",
- "span": "L110-L110"
+ "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": "viewer/main.ts#updateShownCount",
- "name": "updateShownCount",
- "kind": "function",
- "path": "viewer/main.ts",
- "span": "L96-L101",
- "signature": "function updateShownCount(): void",
+ "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",
+ "chars": 4004,
+ "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": "11ab0ffa5da9e8d010f80cb1f95962900b0649019b7876e2b5213b85605d75ee",
+ "body_hash": "cff2ec95e868528eec2623a2907ab4c4e3e4a55224d0551b1fb8a63e8bbc124d",
"summary_state": "ready",
- "summary": "Updates the displayed count of visible nodes in the graph, helping users understand the current view's scope.",
+ "summary": "This function creates necessary directory structures and files for testing the viz server.",
"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"
+ "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/tree.ts",
- "name": "tree.ts",
+ "id": "viewer/data.ts",
+ "name": "data.ts",
"kind": "file",
- "path": "viewer/tree.ts",
- "span": "L1-L67",
+ "path": "viewer/data.ts",
+ "span": "L1-L122",
"signature": null,
"exported": true,
"origin": "ast",
- "body_hash": "d66e0157f4c2a1525c16505306eb3aabce82565c3d0e56199ea5b7a860290b01",
+ "body_hash": "e9c5c89ad933e06004cbeddc1b1d7b60a6057726a463c66f9673ba20a3c61afd",
+ "chars": 4708,
"summary_state": "ready",
- "summary": "Generates a collapsible tree view of a code graph's hierarchy, allowing users to navigate through files, classes, and methods.",
+ "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": " 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"
+ "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",
+ "chars": 2421,
+ "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/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, \"&amp;\").replace(/</g, \"&lt;\");\n}",
- "span": "L8-L9"
- }
+ "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, \"&amp;\").replace(/</g, \"&lt;\");\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",
+ "chars": 14262,
+ "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",
+ "chars": 8654,
+ "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",
+ "chars": 2750,
+ "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, \"&amp;\").replace(/</g, \"&lt;\");\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/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/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": "bench/token-ab.ts",
+ "target": "bench/token-ab.ts#main",
+ "relation": "calls",
+ "confidence": "extracted"
+ },
+ {
+ "source": "bench/token-ab.ts",
+ "target": "bench/token-ab.ts#cost",
+ "relation": "contains",
+ "confidence": "extracted"
+ },
+ {
+ "source": "bench/token-ab.ts",
+ "target": "bench/token-ab.ts#graftPack",
+ "relation": "contains",
+ "confidence": "extracted"
+ },
+ {
+ "source": "bench/token-ab.ts",
+ "target": "bench/token-ab.ts#main",
+ "relation": "contains",
+ "confidence": "extracted"
+ },
+ {
+ "source": "bench/token-ab.ts",
+ "target": "bench/token-ab.ts#Metrics",
+ "relation": "contains",
+ "confidence": "extracted"
+ },
+ {
+ "source": "bench/token-ab.ts",
+ "target": "bench/token-ab.ts#row",
+ "relation": "contains",
+ "confidence": "extracted"
+ },
+ {
+ "source": "bench/token-ab.ts",
+ "target": "bench/token-ab.ts#runAgent",
+ "relation": "contains",
+ "confidence": "extracted"
+ },
+ {
+ "source": "bench/token-ab.ts",
+ "target": "bench/token-ab.ts#runRead",
+ "relation": "contains",
+ "confidence": "extracted"
+ },
+ {
+ "source": "bench/token-ab.ts",
+ "target": "bench/token-ab.ts#runSearch",
+ "relation": "contains",
+ "confidence": "extracted"
+ },
+ {
+ "source": "bench/token-ab.ts",
+ "target": "dotenv/config",
+ "relation": "imports",
+ "confidence": "extracted"
+ },
+ {
+ "source": "bench/token-ab.ts",
+ "target": "node:child_process",
+ "relation": "imports",
+ "confidence": "extracted"
+ },
+ {
+ "source": "bench/token-ab.ts",
+ "target": "node:fs",
+ "relation": "imports",
+ "confidence": "extracted"
+ },
+ {
+ "source": "bench/token-ab.ts",
+ "target": "node:path",
+ "relation": "imports",
+ "confidence": "extracted"
+ },
+ {
+ "source": "bench/token-ab.ts",
+ "target": "openai",
+ "relation": "imports",
+ "confidence": "extracted"
+ },
+ {
+ "source": "bench/token-ab.ts#main",
+ "target": "bench/token-ab.ts#cost",
+ "relation": "calls",
+ "confidence": "extracted"
+ },
+ {
+ "source": "bench/token-ab.ts#main",
+ "target": "bench/token-ab.ts#graftPack",
+ "relation": "calls",
+ "confidence": "extracted"
+ },
+ {
+ "source": "bench/token-ab.ts#main",
+ "target": "bench/token-ab.ts#main.pct",
+ "relation": "calls",
+ "confidence": "extracted"
+ },
+ {
+ "source": "bench/token-ab.ts#main",
+ "target": "bench/token-ab.ts#row",
+ "relation": "calls",
+ "confidence": "extracted"
+ },
+ {
+ "source": "bench/token-ab.ts#main",
+ "target": "bench/token-ab.ts#runAgent",
+ "relation": "calls",
+ "confidence": "extracted"
+ },
+ {
+ "source": "bench/token-ab.ts#main",
+ "target": "bench/token-ab.ts#main.pct",
+ "relation": "contains",
+ "confidence": "extracted"
+ },
+ {
+ "source": "bench/token-ab.ts#runAgent",
+ "target": "bench/token-ab.ts#runRead",
+ "relation": "calls",
+ "confidence": "extracted"
+ },
+ {
+ "source": "bench/token-ab.ts#runAgent",
+ "target": "bench/token-ab.ts#runSearch",
+ "relation": "calls",
+ "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#baselineFor",
+ "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#hitFiles",
+ "relation": "contains",
+ "confidence": "extracted"
},
{
- "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"
- }
+ "source": "src/ask/ask.ts",
+ "target": "src/ask/ask.ts#inlineSource",
+ "relation": "contains",
+ "confidence": "extracted"
},
{
- "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"
- }
+ "source": "src/ask/ask.ts",
+ "target": "src/ask/ask.ts#lexical",
+ "relation": "contains",
+ "confidence": "extracted"
},
{
- "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"
- }
+ "source": "src/ask/ask.ts",
+ "target": "src/ask/ask.ts#loadCorpus",
+ "relation": "contains",
+ "confidence": "extracted"
},
{
- "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",
+ "source": "src/ask/ask.ts",
+ "target": "src/ask/ask.ts#parseSpan",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/agent.ts",
- "target": "bench/agent.ts#globToRegExp",
+ "source": "src/ask/ask.ts",
+ "target": "src/ask/ask.ts#savingsFooter",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/agent.ts",
- "target": "bench/agent.ts#listFiles",
+ "source": "src/ask/ask.ts",
+ "target": "src/ask/ask.ts#score",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/agent.ts",
- "target": "bench/agent.ts#runAgent",
+ "source": "src/ask/ask.ts",
+ "target": "src/ask/ask.ts#sliceSpan",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/agent.ts",
- "target": "bench/agent.ts#RunAgentOptions",
+ "source": "src/ask/ask.ts",
+ "target": "src/ask/ask.ts#structural",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/agent.ts",
- "target": "bench/agent.ts#runTool",
+ "source": "src/ask/ask.ts",
+ "target": "src/ask/ask.ts#tokenize",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/agent.ts",
- "target": "bench/agent.ts#safePath",
+ "source": "src/ask/ask.ts",
+ "target": "src/ask/ask.ts#toTokens",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/agent.ts",
- "target": "bench/llm.ts",
+ "source": "src/ask/ask.ts",
+ "target": "gray-matter",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "bench/agent.ts",
+ "source": "src/ask/ask.ts",
"target": "node:fs",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "bench/agent.ts",
+ "source": "src/ask/ask.ts",
"target": "node:path",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "bench/agent.ts",
- "target": "openai",
+ "source": "src/ask/ask.ts",
+ "target": "src/context/node-file.ts",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "bench/agent.ts",
- "target": "src/ingest/fs.ts",
+ "source": "src/ask/ask.ts",
+ "target": "src/graph/types.ts",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "bench/agent.ts#listFiles",
- "target": "bench/agent.ts#listFiles.walk",
+ "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#baselineFor",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/agent.ts#listFiles",
- "target": "bench/agent.ts#listFiles.walk",
- "relation": "contains",
+ "source": "src/ask/ask.ts#ask",
+ "target": "src/ask/ask.ts#inlineSource",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/agent.ts#listFiles.walk",
- "target": "bench/agent.ts#listFiles.walk",
+ "source": "src/ask/ask.ts#ask",
+ "target": "src/ask/ask.ts#lexical",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/agent.ts#runAgent",
- "target": "bench/agent.ts#runAgent.slideCacheBreakpoint",
+ "source": "src/ask/ask.ts#ask",
+ "target": "src/ask/ask.ts#loadCorpus",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/agent.ts#runAgent",
- "target": "bench/agent.ts#runTool",
+ "source": "src/ask/ask.ts#ask",
+ "target": "src/ask/ask.ts#structural",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/agent.ts#runAgent",
- "target": "bench/llm.ts#makeClient",
+ "source": "src/ask/ask.ts#ask",
+ "target": "src/context/node-file.ts#contextDirFor",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "bench/agent.ts#runAgent",
- "target": "bench/agent.ts#runAgent.slideCacheBreakpoint",
- "relation": "contains",
+ "source": "src/ask/ask.ts#baselineFor",
+ "target": "src/ask/ask.ts#hitFiles",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/agent.ts#runTool",
- "target": "bench/agent.ts#globToRegExp",
+ "source": "src/ask/ask.ts#formatAsk",
+ "target": "src/ask/ask.ts#savingsFooter",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/agent.ts#runTool",
- "target": "bench/agent.ts#listFiles",
+ "source": "src/ask/ask.ts#hitFiles",
+ "target": "src/ask/ask.ts#parseSpan",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/agent.ts#runTool",
- "target": "bench/agent.ts#safePath",
+ "source": "src/ask/ask.ts#inlineSource",
+ "target": "src/ask/ask.ts#parseSpan",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/judge.ts",
- "target": "bench/judge.ts#extractJson",
- "relation": "contains",
+ "source": "src/ask/ask.ts#inlineSource",
+ "target": "src/ask/ask.ts#sliceSpan",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/judge.ts",
- "target": "bench/judge.ts#judge",
+ "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#savingsFooter",
+ "target": "src/ask/ask.ts#toTokens",
+ "relation": "calls",
+ "confidence": "extracted"
+ },
+ {
+ "source": "src/ask/ask.ts#structural",
+ "target": "src/ask/ask.ts#findSubject",
+ "relation": "calls",
+ "confidence": "extracted"
+ },
+ {
+ "source": "src/claude/format.ts",
+ "target": "src/claude/format.ts#AskJson",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/judge.ts",
- "target": "bench/judge.ts#JudgeInput",
+ "source": "src/claude/format.ts",
+ "target": "src/claude/format.ts#enrichedSegment",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/judge.ts",
- "target": "bench/judge.ts#Verdict",
+ "source": "src/claude/format.ts",
+ "target": "src/claude/format.ts#formatBlastRadius",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/judge.ts",
- "target": "bench/llm.ts",
- "relation": "imports",
+ "source": "src/claude/format.ts",
+ "target": "src/claude/format.ts#formatOrientation",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/judge.ts",
- "target": "openai",
- "relation": "imports",
+ "source": "src/claude/format.ts",
+ "target": "src/claude/format.ts#formatRetrieval",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/judge.ts#judge",
- "target": "bench/judge.ts#extractJson",
- "relation": "calls",
+ "source": "src/claude/format.ts",
+ "target": "src/claude/format.ts#freshnessSegment",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/judge.ts#judge",
- "target": "bench/llm.ts#makeClient",
- "relation": "calls",
- "confidence": "inferred"
+ "source": "src/claude/format.ts",
+ "target": "src/claude/format.ts#incomingEdges",
+ "relation": "contains",
+ "confidence": "extracted"
},
{
- "source": "bench/llm.ts",
- "target": "bench/llm.ts#makeClient",
+ "source": "src/claude/format.ts",
+ "target": "src/claude/format.ts#nodeIdsInFile",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/llm.ts",
- "target": "openai",
- "relation": "imports",
+ "source": "src/claude/format.ts",
+ "target": "src/claude/format.ts#renderStatusline",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/report.ts",
- "target": "bench/report.ts#aggregate",
+ "source": "src/claude/format.ts",
+ "target": "src/claude/format.ts#renderSubagent",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/report.ts",
- "target": "bench/report.ts#ArmAgg",
+ "source": "src/claude/format.ts",
+ "target": "src/claude/format.ts#retrievalBody",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/report.ts",
- "target": "bench/report.ts#buildMarkdown",
+ "source": "src/claude/format.ts",
+ "target": "src/claude/format.ts#retrievalTokensSaved",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/report.ts",
- "target": "bench/report.ts#costOf",
+ "source": "src/claude/format.ts",
+ "target": "src/claude/format.ts#tokensOf",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/report.ts",
- "target": "bench/report.ts#fmt",
- "relation": "contains",
+ "source": "src/claude/format.ts",
+ "target": "node:path",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "bench/report.ts",
- "target": "bench/report.ts#mean",
- "relation": "contains",
+ "source": "src/claude/format.ts",
+ "target": "src/claude/state.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "bench/report.ts",
- "target": "bench/report.ts#pctDelta",
- "relation": "contains",
+ "source": "src/claude/format.ts",
+ "target": "src/graph/types.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "bench/report.ts",
- "target": "bench/report.ts#Row",
- "relation": "contains",
+ "source": "src/claude/format.ts#formatBlastRadius",
+ "target": "src/claude/format.ts#incomingEdges",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/report.ts#aggregate",
- "target": "bench/report.ts#costOf",
+ "source": "src/claude/format.ts#formatRetrieval",
+ "target": "src/claude/format.ts#retrievalBody",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/report.ts#aggregate",
- "target": "bench/report.ts#mean",
+ "source": "src/claude/format.ts#formatRetrieval",
+ "target": "src/claude/format.ts#retrievalTokensSaved",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/report.ts#buildMarkdown",
- "target": "bench/report.ts#aggregate",
+ "source": "src/claude/format.ts#formatRetrieval",
+ "target": "src/claude/format.ts#tokensOf",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/report.ts#buildMarkdown",
- "target": "bench/report.ts#fmt",
+ "source": "src/claude/format.ts#incomingEdges",
+ "target": "src/claude/format.ts#nodeIdsInFile",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/report.ts#buildMarkdown",
- "target": "bench/report.ts#pctDelta",
+ "source": "src/claude/format.ts#renderStatusline",
+ "target": "src/claude/format.ts#enrichedSegment",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/run.ts",
- "target": "bench/run.ts#main",
+ "source": "src/claude/format.ts#renderStatusline",
+ "target": "src/claude/format.ts#freshnessSegment",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/run.ts",
- "target": "bench/run.ts#Args",
- "relation": "contains",
+ "source": "src/claude/format.ts#retrievalTokensSaved",
+ "target": "src/claude/format.ts#retrievalBody",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/run.ts",
- "target": "bench/run.ts#main",
- "relation": "contains",
+ "source": "src/claude/format.ts#retrievalTokensSaved",
+ "target": "src/claude/format.ts#tokensOf",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/run.ts",
- "target": "bench/run.ts#makeDocsWorkdir",
+ "source": "src/claude/hooks.ts",
+ "target": "src/claude/hooks.ts#checkStaleCount",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/run.ts",
- "target": "bench/run.ts#parseArgs",
+ "source": "src/claude/hooks.ts",
+ "target": "src/claude/hooks.ts#emit",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/run.ts",
- "target": "bench/run.ts#pool",
+ "source": "src/claude/hooks.ts",
+ "target": "src/claude/hooks.ts#graftCli",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/run.ts",
- "target": "../src/ingest/pdf.js",
- "relation": "imports",
+ "source": "src/claude/hooks.ts",
+ "target": "src/claude/hooks.ts#graftJson",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/run.ts",
- "target": "bench/agent.ts",
- "relation": "imports",
+ "source": "src/claude/hooks.ts",
+ "target": "src/claude/hooks.ts#main",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/run.ts",
- "target": "bench/judge.ts",
- "relation": "imports",
+ "source": "src/claude/hooks.ts",
+ "target": "src/claude/hooks.ts#projectDir",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/run.ts",
- "target": "bench/llm.ts",
- "relation": "imports",
+ "source": "src/claude/hooks.ts",
+ "target": "src/claude/hooks.ts#readStdin",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/run.ts",
- "target": "bench/report.ts",
- "relation": "imports",
+ "source": "src/claude/hooks.ts",
+ "target": "src/claude/hooks.ts#safeReadFd0",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/run.ts",
- "target": "bench/tasks.ts",
- "relation": "imports",
+ "source": "src/claude/hooks.ts",
+ "target": "src/claude/hooks.ts#underGraft",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/run.ts",
- "target": "dotenv/config",
+ "source": "src/claude/hooks.ts",
+ "target": "node:child_process",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "bench/run.ts",
+ "source": "src/claude/hooks.ts",
"target": "node:fs",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "bench/run.ts",
- "target": "node:os",
+ "source": "src/claude/hooks.ts",
+ "target": "node:path",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "bench/run.ts",
- "target": "node:path",
+ "source": "src/claude/hooks.ts",
+ "target": "src/claude/format.ts",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "bench/run.ts",
- "target": "node:url",
+ "source": "src/claude/hooks.ts",
+ "target": "src/claude/state.ts",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "bench/run.ts",
- "target": "src/index.ts",
+ "source": "src/claude/hooks.ts",
+ "target": "src/claude/stats.ts",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "bench/run.ts",
- "target": "src/ingest/fs.ts",
- "relation": "imports",
+ "source": "src/claude/hooks.ts#checkStaleCount",
+ "target": "src/claude/hooks.ts#graftJson",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/run.ts#main",
- "target": "bench/agent.ts#runAgent",
+ "source": "src/claude/hooks.ts#graftJson",
+ "target": "src/claude/hooks.ts#graftCli",
+ "relation": "calls",
+ "confidence": "extracted"
+ },
+ {
+ "source": "src/claude/hooks.ts#main",
+ "target": "src/claude/format.ts#formatBlastRadius",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "bench/run.ts#main",
- "target": "bench/judge.ts#judge",
+ "source": "src/claude/hooks.ts#main",
+ "target": "src/claude/format.ts#formatOrientation",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "bench/run.ts#main",
- "target": "bench/llm.ts#makeClient",
+ "source": "src/claude/hooks.ts#main",
+ "target": "src/claude/format.ts#formatRetrieval",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "bench/run.ts#main",
- "target": "bench/report.ts#buildMarkdown",
+ "source": "src/claude/hooks.ts#main",
+ "target": "src/claude/format.ts#retrievalTokensSaved",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "bench/run.ts#main",
- "target": "bench/run.ts#makeDocsWorkdir",
+ "source": "src/claude/hooks.ts#main",
+ "target": "src/claude/hooks.ts#checkStaleCount",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/run.ts#main",
- "target": "bench/run.ts#parseArgs",
+ "source": "src/claude/hooks.ts#main",
+ "target": "src/claude/hooks.ts#emit",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/run.ts#main",
- "target": "bench/run.ts#pool",
+ "source": "src/claude/hooks.ts#main",
+ "target": "src/claude/hooks.ts#graftJson",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/run.ts#main",
- "target": "src/viz/serve.ts#startVizServer.close",
+ "source": "src/claude/hooks.ts#main",
+ "target": "src/claude/hooks.ts#projectDir",
+ "relation": "calls",
+ "confidence": "extracted"
+ },
+ {
+ "source": "src/claude/hooks.ts#main",
+ "target": "src/claude/hooks.ts#readStdin",
+ "relation": "calls",
+ "confidence": "extracted"
+ },
+ {
+ "source": "src/claude/hooks.ts#main",
+ "target": "src/claude/hooks.ts#underGraft",
+ "relation": "calls",
+ "confidence": "extracted"
+ },
+ {
+ "source": "src/claude/hooks.ts#main",
+ "target": "src/claude/state.ts#acquireLock",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "bench/run.ts#pool",
- "target": "bench/run.ts#pool.worker",
+ "source": "src/claude/hooks.ts#main",
+ "target": "src/claude/state.ts#patchStats",
+ "relation": "calls",
+ "confidence": "inferred"
+ },
+ {
+ "source": "src/claude/hooks.ts#main",
+ "target": "src/claude/state.ts#readSession",
+ "relation": "calls",
+ "confidence": "inferred"
+ },
+ {
+ "source": "src/claude/hooks.ts#main",
+ "target": "src/claude/state.ts#readStats",
+ "relation": "calls",
+ "confidence": "inferred"
+ },
+ {
+ "source": "src/claude/hooks.ts#main",
+ "target": "src/claude/state.ts#writeSession",
+ "relation": "calls",
+ "confidence": "inferred"
+ },
+ {
+ "source": "src/claude/hooks.ts#main",
+ "target": "src/claude/stats.ts#readWiring",
+ "relation": "calls",
+ "confidence": "inferred"
+ },
+ {
+ "source": "src/claude/hooks.ts#readStdin",
+ "target": "src/claude/hooks.ts#safeReadFd0",
+ "relation": "calls",
+ "confidence": "extracted"
+ },
+ {
+ "source": "src/claude/state.ts",
+ "target": "src/claude/state.ts#acquireLock",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/selfcheck.ts",
- "target": "bench/selfcheck.ts#main",
- "relation": "calls",
+ "source": "src/claude/state.ts",
+ "target": "src/claude/state.ts#cacheDir",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/selfcheck.ts",
- "target": "bench/selfcheck.ts#main",
+ "source": "src/claude/state.ts",
+ "target": "src/claude/state.ts#emptySession",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/selfcheck.ts",
- "target": "bench/selfcheck.ts#makeStubClient",
+ "source": "src/claude/state.ts",
+ "target": "src/claude/state.ts#emptyStats",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/selfcheck.ts",
- "target": "bench/agent.ts",
- "relation": "imports",
+ "source": "src/claude/state.ts",
+ "target": "src/claude/state.ts#lockPath",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/selfcheck.ts",
- "target": "bench/judge.ts",
- "relation": "imports",
+ "source": "src/claude/state.ts",
+ "target": "src/claude/state.ts#patchStats",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/selfcheck.ts",
- "target": "bench/report.ts",
- "relation": "imports",
+ "source": "src/claude/state.ts",
+ "target": "src/claude/state.ts#readJson",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/selfcheck.ts",
- "target": "node:assert/strict",
- "relation": "imports",
+ "source": "src/claude/state.ts",
+ "target": "src/claude/state.ts#readSession",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/selfcheck.ts",
- "target": "node:fs",
- "relation": "imports",
+ "source": "src/claude/state.ts",
+ "target": "src/claude/state.ts#readStats",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "bench/selfcheck.ts",
- "target": "node:os",
+ "source": "src/claude/state.ts",
+ "target": "src/claude/state.ts#releaseLock",
+ "relation": "contains",
+ "confidence": "extracted"
+ },
+ {
+ "source": "src/claude/state.ts",
+ "target": "src/claude/state.ts#sessionPath",
+ "relation": "contains",
+ "confidence": "extracted"
+ },
+ {
+ "source": "src/claude/state.ts",
+ "target": "src/claude/state.ts#SessionState",
+ "relation": "contains",
+ "confidence": "extracted"
+ },
+ {
+ "source": "src/claude/state.ts",
+ "target": "src/claude/state.ts#Stats",
+ "relation": "contains",
+ "confidence": "extracted"
+ },
+ {
+ "source": "src/claude/state.ts",
+ "target": "src/claude/state.ts#statsPath",
+ "relation": "contains",
+ "confidence": "extracted"
+ },
+ {
+ "source": "src/claude/state.ts",
+ "target": "src/claude/state.ts#writeJsonAtomic",
+ "relation": "contains",
+ "confidence": "extracted"
+ },
+ {
+ "source": "src/claude/state.ts",
+ "target": "src/claude/state.ts#writeSession",
+ "relation": "contains",
+ "confidence": "extracted"
+ },
+ {
+ "source": "src/claude/state.ts",
+ "target": "src/claude/state.ts#writeStats",
+ "relation": "contains",
+ "confidence": "extracted"
+ },
+ {
+ "source": "src/claude/state.ts",
+ "target": "node:fs",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "bench/selfcheck.ts",
+ "source": "src/claude/state.ts",
"target": "node:path",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "bench/selfcheck.ts#main",
- "target": "bench/agent.ts#runAgent",
+ "source": "src/claude/state.ts#acquireLock",
+ "target": "src/claude/state.ts#cacheDir",
+ "relation": "calls",
+ "confidence": "extracted"
+ },
+ {
+ "source": "src/claude/state.ts#acquireLock",
+ "target": "src/claude/state.ts#lockPath",
+ "relation": "calls",
+ "confidence": "extracted"
+ },
+ {
+ "source": "src/claude/state.ts#lockPath",
+ "target": "src/claude/state.ts#cacheDir",
+ "relation": "calls",
+ "confidence": "extracted"
+ },
+ {
+ "source": "src/claude/state.ts#patchStats",
+ "target": "src/claude/state.ts#emptyStats",
+ "relation": "calls",
+ "confidence": "extracted"
+ },
+ {
+ "source": "src/claude/state.ts#patchStats",
+ "target": "src/claude/state.ts#readStats",
+ "relation": "calls",
+ "confidence": "extracted"
+ },
+ {
+ "source": "src/claude/state.ts#patchStats",
+ "target": "src/claude/state.ts#writeStats",
+ "relation": "calls",
+ "confidence": "extracted"
+ },
+ {
+ "source": "src/claude/state.ts#readSession",
+ "target": "src/claude/state.ts#emptySession",
+ "relation": "calls",
+ "confidence": "extracted"
+ },
+ {
+ "source": "src/claude/state.ts#readSession",
+ "target": "src/claude/state.ts#readJson",
+ "relation": "calls",
+ "confidence": "extracted"
+ },
+ {
+ "source": "src/claude/state.ts#readSession",
+ "target": "src/claude/state.ts#sessionPath",
+ "relation": "calls",
+ "confidence": "extracted"
+ },
+ {
+ "source": "src/claude/state.ts#readStats",
+ "target": "src/claude/state.ts#readJson",
"relation": "calls",
- "confidence": "inferred"
+ "confidence": "extracted"
},
{
- "source": "bench/selfcheck.ts#main",
- "target": "bench/judge.ts#judge",
+ "source": "src/claude/state.ts#readStats",
+ "target": "src/claude/state.ts#statsPath",
"relation": "calls",
- "confidence": "inferred"
+ "confidence": "extracted"
},
{
- "source": "bench/selfcheck.ts#main",
- "target": "bench/report.ts#buildMarkdown",
+ "source": "src/claude/state.ts#releaseLock",
+ "target": "src/claude/state.ts#lockPath",
"relation": "calls",
- "confidence": "inferred"
+ "confidence": "extracted"
},
{
- "source": "bench/selfcheck.ts#main",
- "target": "bench/selfcheck.ts#makeStubClient",
+ "source": "src/claude/state.ts#sessionPath",
+ "target": "src/claude/state.ts#cacheDir",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/tasks.ts",
- "target": "bench/tasks.ts#repoPath",
+ "source": "src/claude/state.ts#statsPath",
+ "target": "src/claude/state.ts#cacheDir",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/tasks.ts",
- "target": "bench/tasks.ts#Corpus",
- "relation": "contains",
+ "source": "src/claude/state.ts#writeSession",
+ "target": "src/claude/state.ts#sessionPath",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/tasks.ts",
- "target": "bench/tasks.ts#repoPath",
- "relation": "contains",
+ "source": "src/claude/state.ts#writeSession",
+ "target": "src/claude/state.ts#writeJsonAtomic",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/tasks.ts",
- "target": "bench/tasks.ts#Task",
- "relation": "contains",
+ "source": "src/claude/state.ts#writeStats",
+ "target": "src/claude/state.ts#statsPath",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/tasks.ts",
- "target": "node:path",
- "relation": "imports",
+ "source": "src/claude/state.ts#writeStats",
+ "target": "src/claude/state.ts#writeJsonAtomic",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "bench/tasks.ts",
- "target": "node:url",
- "relation": "imports",
+ "source": "src/claude/stats.ts",
+ "target": "src/claude/stats.ts#computeStats",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "scripts/build-viewer.mjs",
- "target": "esbuild",
- "relation": "imports",
+ "source": "src/claude/stats.ts",
+ "target": "src/claude/stats.ts#readWiring",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "scripts/build-viewer.mjs",
+ "source": "src/claude/stats.ts",
"target": "node:fs",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "scripts/build-viewer.mjs",
+ "source": "src/claude/stats.ts",
"target": "node:path",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "scripts/build-viewer.mjs",
- "target": "node:url",
+ "source": "src/claude/stats.ts",
+ "target": "src/claude/state.ts",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/ai/crux.ts",
- "target": "src/ai/crux.ts#CruxSummarizer",
- "relation": "contains",
+ "source": "src/claude/stats.ts",
+ "target": "src/graph/types.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/ai/crux.ts",
- "target": "src/ai/crux.ts#FileCruxInput",
+ "source": "src/claude/statusline.ts",
+ "target": "src/claude/statusline.ts#main",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/ai/crux.ts",
- "target": "src/ai/crux.ts#NodeCrux",
+ "source": "src/claude/statusline.ts",
+ "target": "src/claude/statusline.ts#resolveStats",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/ai/crux.ts",
- "target": "src/ai/crux.ts#NodeRef",
- "relation": "contains",
+ "source": "src/claude/statusline.ts",
+ "target": "node:fs",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/ai/crux.ts",
- "target": "src/ai/crux.ts#numberLines",
- "relation": "contains",
+ "source": "src/claude/statusline.ts",
+ "target": "src/claude/format.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/ai/crux.ts",
- "target": "src/ai/crux.ts#OpenRouterCruxSummarizer",
- "relation": "contains",
+ "source": "src/claude/statusline.ts",
+ "target": "src/claude/state.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/ai/crux.ts",
- "target": "src/ai/crux.ts#parseResults",
- "relation": "contains",
+ "source": "src/claude/statusline.ts",
+ "target": "src/claude/stats.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/ai/crux.ts",
- "target": "src/ai/crux.ts#userContent",
- "relation": "contains",
- "confidence": "extracted"
+ "source": "src/claude/statusline.ts#main",
+ "target": "src/claude/format.ts#renderStatusline",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/ai/crux.ts",
- "target": "openai",
- "relation": "imports",
- "confidence": "extracted"
+ "source": "src/claude/statusline.ts#main",
+ "target": "src/claude/format.ts#renderSubagent",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/ai/crux.ts",
- "target": "src/graph/types.ts",
- "relation": "imports",
- "confidence": "extracted"
+ "source": "src/claude/statusline.ts#main",
+ "target": "src/claude/state.ts#readSession",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/ai/crux.ts#OpenRouterCruxSummarizer",
- "target": "src/ai/crux.ts#OpenRouterCruxSummarizer.constructor",
- "relation": "contains",
+ "source": "src/claude/statusline.ts#main",
+ "target": "src/claude/statusline.ts#resolveStats",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/ai/crux.ts#OpenRouterCruxSummarizer",
- "target": "src/ai/crux.ts#OpenRouterCruxSummarizer.describeFile",
- "relation": "contains",
- "confidence": "extracted"
+ "source": "src/claude/statusline.ts#resolveStats",
+ "target": "src/claude/state.ts#emptyStats",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/ai/crux.ts#OpenRouterCruxSummarizer",
- "target": "src/ai/crux.ts#CruxSummarizer",
- "relation": "implements",
- "confidence": "extracted"
+ "source": "src/claude/statusline.ts#resolveStats",
+ "target": "src/claude/state.ts#readStats",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/ai/crux.ts#OpenRouterCruxSummarizer.describeFile",
- "target": "src/ai/crux.ts#parseResults",
+ "source": "src/claude/statusline.ts#resolveStats",
+ "target": "src/claude/stats.ts#computeStats",
"relation": "calls",
- "confidence": "extracted"
+ "confidence": "inferred"
},
{
- "source": "src/ai/crux.ts#OpenRouterCruxSummarizer.describeFile",
- "target": "src/ai/crux.ts#userContent",
+ "source": "src/claude/statusline.ts#resolveStats",
+ "target": "src/claude/stats.ts#readWiring",
"relation": "calls",
- "confidence": "extracted"
+ "confidence": "inferred"
},
{
- "source": "src/ai/crux.ts#parseResults",
- "target": "src/ai/crux.ts#parseResults.num",
+ "source": "src/claude/sync-run.ts",
+ "target": "src/claude/sync-run.ts#main",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/ai/crux.ts#parseResults",
- "target": "src/ai/crux.ts#parseResults.num",
+ "source": "src/claude/sync-run.ts",
+ "target": "src/claude/sync-run.ts#main",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/ai/crux.ts#userContent",
- "target": "src/ai/crux.ts#numberLines",
- "relation": "calls",
+ "source": "src/claude/sync-run.ts",
+ "target": "src/claude/sync-run.ts#realBuild",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/ai/providers.ts",
- "target": "src/ai/providers.ts#EngineConfig",
+ "source": "src/claude/sync-run.ts",
+ "target": "src/claude/sync-run.ts#runSync",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/ai/providers.ts",
- "target": "src/ai/providers.ts#resolveConfig",
- "relation": "contains",
+ "source": "src/claude/sync-run.ts",
+ "target": "node:child_process",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/ai/providers.ts",
- "target": "src/ai/providers.ts#ResolvedConfig",
- "relation": "contains",
+ "source": "src/claude/sync-run.ts",
+ "target": "node:path",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/ai/providers.ts",
- "target": "src/ai/summarize.ts",
+ "source": "src/claude/sync-run.ts",
+ "target": "node:url",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/ai/providers.ts",
- "target": "src/ai/synthesize.ts",
+ "source": "src/claude/sync-run.ts",
+ "target": "src/claude/state.ts",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/ai/summarize.ts",
- "target": "src/ai/summarize.ts#OpenRouterSummarizer",
- "relation": "contains",
+ "source": "src/claude/sync-run.ts",
+ "target": "src/claude/stats.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/ai/summarize.ts",
- "target": "src/ai/summarize.ts#Summarizer",
- "relation": "contains",
+ "source": "src/claude/sync-run.ts#main",
+ "target": "src/claude/sync-run.ts#runSync",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/ai/summarize.ts",
- "target": "src/ai/summarize.ts#userContent",
- "relation": "contains",
- "confidence": "extracted"
+ "source": "src/claude/sync-run.ts#runSync",
+ "target": "src/claude/state.ts#patchStats",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/ai/summarize.ts",
- "target": "openai",
- "relation": "imports",
- "confidence": "extracted"
+ "source": "src/claude/sync-run.ts#runSync",
+ "target": "src/claude/state.ts#releaseLock",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/ai/summarize.ts#OpenRouterSummarizer",
- "target": "src/ai/summarize.ts#OpenRouterSummarizer.constructor",
- "relation": "contains",
- "confidence": "extracted"
+ "source": "src/claude/sync-run.ts#runSync",
+ "target": "src/claude/stats.ts#computeStats",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/ai/summarize.ts#OpenRouterSummarizer",
- "target": "src/ai/summarize.ts#OpenRouterSummarizer.summarize",
- "relation": "contains",
- "confidence": "extracted"
+ "source": "src/claude/sync-run.ts#runSync",
+ "target": "src/claude/stats.ts#readWiring",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/ai/summarize.ts#OpenRouterSummarizer",
- "target": "src/ai/summarize.ts#Summarizer",
- "relation": "implements",
- "confidence": "extracted"
+ "source": "src/cli.ts",
+ "target": "src/ai/providers.ts#resolveConfig",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/ai/summarize.ts#OpenRouterSummarizer.summarize",
- "target": "src/ai/summarize.ts#userContent",
+ "source": "src/cli.ts",
+ "target": "src/ask/ask.ts#formatAsk",
"relation": "calls",
- "confidence": "extracted"
+ "confidence": "inferred"
},
{
- "source": "src/ai/synthesize.ts",
- "target": "src/ai/synthesize.ts#clean",
- "relation": "contains",
+ "source": "src/cli.ts",
+ "target": "src/cli.ts#engineFrom",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/ai/synthesize.ts",
- "target": "src/ai/synthesize.ts#FileSummary",
- "relation": "contains",
+ "source": "src/cli.ts",
+ "target": "src/cli.ts#fmt",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/ai/synthesize.ts",
- "target": "src/ai/synthesize.ts#OpenRouterSynthesizer",
- "relation": "contains",
- "confidence": "extracted"
+ "source": "src/cli.ts",
+ "target": "src/context/check.ts#formatCheckReport",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/ai/synthesize.ts",
- "target": "src/ai/synthesize.ts#Synthesizer",
- "relation": "contains",
- "confidence": "extracted"
+ "source": "src/cli.ts",
+ "target": "src/context/node-file.ts#contextDirFor",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/ai/synthesize.ts",
- "target": "src/ai/synthesize.ts#SynthLink",
- "relation": "contains",
- "confidence": "extracted"
+ "source": "src/cli.ts",
+ "target": "src/engine.ts#Graft.ask",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/ai/synthesize.ts",
- "target": "src/ai/synthesize.ts#SynthNode",
+ "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/ai/synthesize.ts",
- "target": "src/ai/synthesize.ts#userContent",
+ "source": "src/cli.ts",
+ "target": "src/cli.ts#fmt",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/ai/synthesize.ts",
- "target": "openai",
+ "source": "src/cli.ts",
+ "target": "commander",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/ai/synthesize.ts#OpenRouterSynthesizer",
- "target": "src/ai/synthesize.ts#OpenRouterSynthesizer.constructor",
- "relation": "contains",
+ "source": "src/cli.ts",
+ "target": "dotenv/config",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/ai/synthesize.ts#OpenRouterSynthesizer",
- "target": "src/ai/synthesize.ts#OpenRouterSynthesizer.synthesize",
- "relation": "contains",
+ "source": "src/cli.ts",
+ "target": "node:path",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/ai/synthesize.ts#OpenRouterSynthesizer",
- "target": "src/ai/synthesize.ts#Synthesizer",
- "relation": "implements",
+ "source": "src/cli.ts",
+ "target": "src/ai/providers.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/ai/synthesize.ts#OpenRouterSynthesizer.synthesize",
- "target": "src/ai/synthesize.ts#clean",
- "relation": "calls",
+ "source": "src/cli.ts",
+ "target": "src/context/check.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/ai/synthesize.ts#OpenRouterSynthesizer.synthesize",
- "target": "src/ai/synthesize.ts#userContent",
- "relation": "calls",
+ "source": "src/cli.ts",
+ "target": "src/engine.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts",
- "target": "src/ask/ask.ts#ask",
- "relation": "contains",
+ "source": "src/cli.ts",
+ "target": "src/graph/check.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts",
- "target": "src/ask/ask.ts#AskHit",
+ "source": "src/context/build.ts",
+ "target": "src/context/build.ts#batchBySize",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts",
- "target": "src/ask/ask.ts#AskOptions",
+ "source": "src/context/build.ts",
+ "target": "src/context/build.ts#batchKey",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts",
- "target": "src/ask/ask.ts#AskResult",
+ "source": "src/context/build.ts",
+ "target": "src/context/build.ts#BuildCache",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts",
- "target": "src/ask/ask.ts#Corpus",
+ "source": "src/context/build.ts",
+ "target": "src/context/build.ts#buildContext",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts",
- "target": "src/ask/ask.ts#counts",
+ "source": "src/context/build.ts",
+ "target": "src/context/build.ts#BuildOptions",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts",
- "target": "src/ask/ask.ts#findSubject",
+ "source": "src/context/build.ts",
+ "target": "src/context/build.ts#BuildProgress",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts",
- "target": "src/ask/ask.ts#firstProse",
+ "source": "src/context/build.ts",
+ "target": "src/context/build.ts#BuildResult",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts",
- "target": "src/ask/ask.ts#formatAsk",
+ "source": "src/context/build.ts",
+ "target": "src/context/build.ts#cachePath",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts",
- "target": "src/ask/ask.ts#inlineSource",
+ "source": "src/context/build.ts",
+ "target": "src/context/build.ts#errMsg",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts",
- "target": "src/ask/ask.ts#lexical",
+ "source": "src/context/build.ts",
+ "target": "src/context/build.ts#FileWork",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts",
- "target": "src/ask/ask.ts#loadCorpus",
+ "source": "src/context/build.ts",
+ "target": "src/context/build.ts#loadCache",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts",
- "target": "src/ask/ask.ts#parseSpan",
+ "source": "src/context/build.ts",
+ "target": "src/context/build.ts#mapWithConcurrency",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts",
- "target": "src/ask/ask.ts#score",
+ "source": "src/context/build.ts",
+ "target": "src/context/build.ts#NodeDraft",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts",
- "target": "src/ask/ask.ts#sliceSpan",
+ "source": "src/context/build.ts",
+ "target": "src/context/build.ts#registerName",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts",
- "target": "src/ask/ask.ts#structural",
+ "source": "src/context/build.ts",
+ "target": "src/context/build.ts#resolveSlug",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts",
- "target": "src/ask/ask.ts#tokenize",
+ "source": "src/context/build.ts",
+ "target": "src/context/build.ts#saveCache",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts",
- "target": "gray-matter",
- "relation": "imports",
- "confidence": "extracted"
- },
- {
- "source": "src/ask/ask.ts",
+ "source": "src/context/build.ts",
"target": "node:fs",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts",
+ "source": "src/context/build.ts",
"target": "node:path",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts",
- "target": "src/context/node-file.ts",
+ "source": "src/context/build.ts",
+ "target": "src/ai/summarize.ts",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts",
- "target": "src/graph/types.ts",
+ "source": "src/context/build.ts",
+ "target": "src/ai/synthesize.ts",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts",
- "target": "src/graph/write.ts",
+ "source": "src/context/build.ts",
+ "target": "src/context/node-file.ts",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts#ask",
- "target": "src/ask/ask.ts#inlineSource",
- "relation": "calls",
+ "source": "src/context/build.ts",
+ "target": "src/ingest/fs.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts#ask",
- "target": "src/ask/ask.ts#lexical",
- "relation": "calls",
+ "source": "src/context/build.ts",
+ "target": "src/util/id.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts#ask",
- "target": "src/ask/ask.ts#loadCorpus",
+ "source": "src/context/build.ts#batchKey",
+ "target": "src/util/id.ts#contentHash",
"relation": "calls",
- "confidence": "extracted"
+ "confidence": "inferred"
},
{
- "source": "src/ask/ask.ts#ask",
- "target": "src/ask/ask.ts#structural",
+ "source": "src/context/build.ts#buildContext",
+ "target": "src/context/build.ts#batchBySize",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts#ask",
- "target": "src/context/node-file.ts#contextDirFor",
+ "source": "src/context/build.ts#buildContext",
+ "target": "src/context/build.ts#batchKey",
"relation": "calls",
- "confidence": "inferred"
+ "confidence": "extracted"
},
{
- "source": "src/ask/ask.ts#inlineSource",
- "target": "src/ask/ask.ts#parseSpan",
+ "source": "src/context/build.ts#buildContext",
+ "target": "src/context/build.ts#errMsg",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts#inlineSource",
- "target": "src/ask/ask.ts#sliceSpan",
+ "source": "src/context/build.ts#buildContext",
+ "target": "src/context/build.ts#loadCache",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts#lexical",
- "target": "src/ask/ask.ts#counts",
+ "source": "src/context/build.ts#buildContext",
+ "target": "src/context/build.ts#mapWithConcurrency",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts#lexical",
- "target": "src/ask/ask.ts#score",
+ "source": "src/context/build.ts#buildContext",
+ "target": "src/context/build.ts#registerName",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts#lexical",
- "target": "src/ask/ask.ts#tokenize",
+ "source": "src/context/build.ts#buildContext",
+ "target": "src/context/build.ts#resolveSlug",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts#loadCorpus",
- "target": "src/ask/ask.ts#firstProse",
+ "source": "src/context/build.ts#buildContext",
+ "target": "src/context/build.ts#saveCache",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/ask/ask.ts#loadCorpus",
- "target": "src/graph/write.ts#readGraph",
+ "source": "src/context/build.ts#buildContext",
+ "target": "src/context/node-file.ts#contextDirFor",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "src/ask/ask.ts#loadCorpus",
- "target": "src/graph/write.ts#wiringPath",
+ "source": "src/context/build.ts#buildContext",
+ "target": "src/context/node-file.ts#deleteNode",
"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/ai/providers.ts#resolveConfig",
+ "source": "src/context/build.ts#buildContext",
+ "target": "src/context/node-file.ts#digestSources",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "src/cli.ts",
- "target": "src/ask/ask.ts#formatAsk",
+ "source": "src/context/build.ts#buildContext",
+ "target": "src/context/node-file.ts#existingNodeSlugs",
"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",
+ "source": "src/context/build.ts#buildContext",
+ "target": "src/context/node-file.ts#slugify",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "src/cli.ts",
- "target": "src/context/node-file.ts#contextDirFor",
+ "source": "src/context/build.ts#buildContext",
+ "target": "src/context/node-file.ts#writeManifest",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "src/cli.ts",
- "target": "src/engine.ts#Graft.ask",
+ "source": "src/context/build.ts#buildContext",
+ "target": "src/context/node-file.ts#writeNode",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "src/cli.ts",
- "target": "src/engine.ts#Graft.check",
+ "source": "src/context/build.ts#buildContext",
+ "target": "src/ingest/fs.ts#walkDir",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "src/cli.ts",
- "target": "src/engine.ts#Graft.checkGraph",
+ "source": "src/context/build.ts#buildContext",
+ "target": "src/util/id.ts#contentHash",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "src/cli.ts",
- "target": "src/engine.ts#Graft.graph",
+ "source": "src/context/build.ts#loadCache",
+ "target": "src/context/build.ts#cachePath",
"relation": "calls",
- "confidence": "inferred"
+ "confidence": "extracted"
},
{
- "source": "src/cli.ts",
- "target": "src/engine.ts#Graft.init",
+ "source": "src/context/build.ts#saveCache",
+ "target": "src/context/build.ts#cachePath",
"relation": "calls",
- "confidence": "inferred"
+ "confidence": "extracted"
},
- {
- "source": "src/cli.ts",
- "target": "src/graph/check.ts#formatGraphCheckReport",
- "relation": "calls",
- "confidence": "inferred"
+ {
+ "source": "src/context/check.ts",
+ "target": "src/context/check.ts#checkContext",
+ "relation": "contains",
+ "confidence": "extracted"
},
{
- "source": "src/cli.ts",
- "target": "src/viz/serve.ts#startVizServer",
- "relation": "calls",
- "confidence": "inferred"
+ "source": "src/context/check.ts",
+ "target": "src/context/check.ts#CheckOptions",
+ "relation": "contains",
+ "confidence": "extracted"
},
{
- "source": "src/cli.ts",
- "target": "src/cli.ts#engineFrom",
+ "source": "src/context/check.ts",
+ "target": "src/context/check.ts#CheckResult",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/cli.ts",
- "target": "src/cli.ts#fmt",
+ "source": "src/context/check.ts",
+ "target": "src/context/check.ts#formatCheckReport",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/cli.ts",
- "target": "commander",
- "relation": "imports",
+ "source": "src/context/check.ts",
+ "target": "src/context/check.ts#short",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/cli.ts",
- "target": "dotenv/config",
+ "source": "src/context/check.ts",
+ "target": "node:fs",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/cli.ts",
+ "source": "src/context/check.ts",
"target": "node:path",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/cli.ts",
- "target": "src/ai/providers.ts",
+ "source": "src/context/check.ts",
+ "target": "src/context/build.ts",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/cli.ts",
- "target": "src/context/check.ts",
+ "source": "src/context/check.ts",
+ "target": "src/context/node-file.ts",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/cli.ts",
- "target": "src/engine.ts",
+ "source": "src/context/check.ts",
+ "target": "src/ingest/fs.ts",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/cli.ts",
- "target": "src/graph/check.ts",
+ "source": "src/context/check.ts",
+ "target": "src/util/id.ts",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts",
- "target": "src/context/build.ts#batchBySize",
- "relation": "contains",
+ "source": "src/context/check.ts#checkContext",
+ "target": "src/context/check.ts#short",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts",
- "target": "src/context/build.ts#batchKey",
+ "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/build.ts",
- "target": "src/context/build.ts#BuildCache",
+ "source": "src/context/node-file.ts",
+ "target": "src/context/node-file.ts#ContextNode",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts",
- "target": "src/context/build.ts#buildContext",
+ "source": "src/context/node-file.ts",
+ "target": "src/context/node-file.ts#defaultHuman",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts",
- "target": "src/context/build.ts#BuildOptions",
+ "source": "src/context/node-file.ts",
+ "target": "src/context/node-file.ts#deleteNode",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts",
- "target": "src/context/build.ts#BuildProgress",
+ "source": "src/context/node-file.ts",
+ "target": "src/context/node-file.ts#digestSources",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts",
- "target": "src/context/build.ts#BuildResult",
+ "source": "src/context/node-file.ts",
+ "target": "src/context/node-file.ts#existingNodeSlugs",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts",
- "target": "src/context/build.ts#cachePath",
+ "source": "src/context/node-file.ts",
+ "target": "src/context/node-file.ts#Manifest",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts",
- "target": "src/context/build.ts#errMsg",
+ "source": "src/context/node-file.ts",
+ "target": "src/context/node-file.ts#NodeLink",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts",
- "target": "src/context/build.ts#FileWork",
+ "source": "src/context/node-file.ts",
+ "target": "src/context/node-file.ts#ParsedNode",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts",
- "target": "src/context/build.ts#loadCache",
+ "source": "src/context/node-file.ts",
+ "target": "src/context/node-file.ts#preserveHuman",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts",
- "target": "src/context/build.ts#mapWithConcurrency",
+ "source": "src/context/node-file.ts",
+ "target": "src/context/node-file.ts#readManifest",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts",
- "target": "src/context/build.ts#NodeDraft",
+ "source": "src/context/node-file.ts",
+ "target": "src/context/node-file.ts#readNodes",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts",
- "target": "src/context/build.ts#registerName",
+ "source": "src/context/node-file.ts",
+ "target": "src/context/node-file.ts#renderGenerated",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts",
- "target": "src/context/build.ts#resolveSlug",
+ "source": "src/context/node-file.ts",
+ "target": "src/context/node-file.ts#renderNodeFile",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts",
- "target": "src/context/build.ts#saveCache",
+ "source": "src/context/node-file.ts",
+ "target": "src/context/node-file.ts#slugify",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts",
- "target": "node:fs",
- "relation": "imports",
+ "source": "src/context/node-file.ts",
+ "target": "src/context/node-file.ts#SourceRef",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts",
- "target": "node:path",
- "relation": "imports",
+ "source": "src/context/node-file.ts",
+ "target": "src/context/node-file.ts#writeManifest",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts",
- "target": "src/ai/summarize.ts",
- "relation": "imports",
+ "source": "src/context/node-file.ts",
+ "target": "src/context/node-file.ts#writeNode",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts",
- "target": "src/ai/synthesize.ts",
+ "source": "src/context/node-file.ts",
+ "target": "gray-matter",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts",
- "target": "src/context/node-file.ts",
+ "source": "src/context/node-file.ts",
+ "target": "node:fs",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts",
- "target": "src/ingest/fs.ts",
+ "source": "src/context/node-file.ts",
+ "target": "node:path",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts",
+ "source": "src/context/node-file.ts",
"target": "src/util/id.ts",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts#batchKey",
+ "source": "src/context/node-file.ts#digestSources",
"target": "src/util/id.ts#contentHash",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "src/context/build.ts#buildContext",
- "target": "src/context/build.ts#batchBySize",
+ "source": "src/context/node-file.ts#preserveHuman",
+ "target": "src/context/node-file.ts#defaultHuman",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts#buildContext",
- "target": "src/context/build.ts#batchKey",
+ "source": "src/context/node-file.ts#renderNodeFile",
+ "target": "src/context/node-file.ts#renderGenerated",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts#buildContext",
- "target": "src/context/build.ts#errMsg",
+ "source": "src/context/node-file.ts#slugify",
+ "target": "src/util/id.ts#normalizeName",
"relation": "calls",
- "confidence": "extracted"
+ "confidence": "inferred"
},
{
- "source": "src/context/build.ts#buildContext",
- "target": "src/context/build.ts#loadCache",
+ "source": "src/context/node-file.ts#writeNode",
+ "target": "src/context/node-file.ts#defaultHuman",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts#buildContext",
- "target": "src/context/build.ts#mapWithConcurrency",
+ "source": "src/context/node-file.ts#writeNode",
+ "target": "src/context/node-file.ts#preserveHuman",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts#buildContext",
- "target": "src/context/build.ts#registerName",
+ "source": "src/context/node-file.ts#writeNode",
+ "target": "src/context/node-file.ts#renderNodeFile",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts#buildContext",
- "target": "src/context/build.ts#resolveSlug",
- "relation": "calls",
+ "source": "src/engine.ts",
+ "target": "src/engine.ts#CheckRunOptions",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts#buildContext",
- "target": "src/context/build.ts#saveCache",
- "relation": "calls",
+ "source": "src/engine.ts",
+ "target": "src/engine.ts#Graft",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts#buildContext",
- "target": "src/context/node-file.ts#contextDirFor",
- "relation": "calls",
- "confidence": "inferred"
+ "source": "src/engine.ts",
+ "target": "src/engine.ts#GraphRunOptions",
+ "relation": "contains",
+ "confidence": "extracted"
},
{
- "source": "src/context/build.ts#buildContext",
- "target": "src/context/node-file.ts#deleteNode",
- "relation": "calls",
- "confidence": "inferred"
+ "source": "src/engine.ts",
+ "target": "src/engine.ts#InitOptions",
+ "relation": "contains",
+ "confidence": "extracted"
},
{
- "source": "src/context/build.ts#buildContext",
- "target": "src/context/node-file.ts#digestSources",
- "relation": "calls",
- "confidence": "inferred"
+ "source": "src/engine.ts",
+ "target": "src/ai/crux.ts",
+ "relation": "imports",
+ "confidence": "extracted"
},
{
- "source": "src/context/build.ts#buildContext",
- "target": "src/context/node-file.ts#existingNodeSlugs",
- "relation": "calls",
- "confidence": "inferred"
+ "source": "src/engine.ts",
+ "target": "src/ai/providers.ts",
+ "relation": "imports",
+ "confidence": "extracted"
},
{
- "source": "src/context/build.ts#buildContext",
- "target": "src/context/node-file.ts#slugify",
- "relation": "calls",
- "confidence": "inferred"
+ "source": "src/engine.ts",
+ "target": "src/ai/summarize.ts",
+ "relation": "imports",
+ "confidence": "extracted"
},
{
- "source": "src/context/build.ts#buildContext",
- "target": "src/context/node-file.ts#writeManifest",
- "relation": "calls",
- "confidence": "inferred"
+ "source": "src/engine.ts",
+ "target": "src/ai/synthesize.ts",
+ "relation": "imports",
+ "confidence": "extracted"
},
{
- "source": "src/context/build.ts#buildContext",
- "target": "src/context/node-file.ts#writeNode",
- "relation": "calls",
- "confidence": "inferred"
+ "source": "src/engine.ts",
+ "target": "src/ask/ask.ts",
+ "relation": "imports",
+ "confidence": "extracted"
},
{
- "source": "src/context/build.ts#buildContext",
- "target": "src/ingest/fs.ts#walkDir",
- "relation": "calls",
- "confidence": "inferred"
+ "source": "src/engine.ts",
+ "target": "src/context/build.ts",
+ "relation": "imports",
+ "confidence": "extracted"
},
{
- "source": "src/context/build.ts#buildContext",
- "target": "src/util/id.ts#contentHash",
- "relation": "calls",
- "confidence": "inferred"
+ "source": "src/engine.ts",
+ "target": "src/context/check.ts",
+ "relation": "imports",
+ "confidence": "extracted"
},
{
- "source": "src/context/build.ts#loadCache",
- "target": "src/context/build.ts#cachePath",
- "relation": "calls",
+ "source": "src/engine.ts",
+ "target": "src/graph/build.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/context/build.ts#saveCache",
- "target": "src/context/build.ts#cachePath",
- "relation": "calls",
+ "source": "src/engine.ts",
+ "target": "src/graph/check.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/context/check.ts",
- "target": "src/context/check.ts#checkContext",
+ "source": "src/engine.ts#Graft",
+ "target": "src/engine.ts#Graft.ask",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/check.ts",
- "target": "src/context/check.ts#CheckOptions",
+ "source": "src/engine.ts#Graft",
+ "target": "src/engine.ts#Graft.check",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/check.ts",
- "target": "src/context/check.ts#CheckResult",
+ "source": "src/engine.ts#Graft",
+ "target": "src/engine.ts#Graft.checkGraph",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/check.ts",
- "target": "src/context/check.ts#formatCheckReport",
+ "source": "src/engine.ts#Graft",
+ "target": "src/engine.ts#Graft.constructor",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/check.ts",
- "target": "src/context/check.ts#short",
+ "source": "src/engine.ts#Graft",
+ "target": "src/engine.ts#Graft.cruxSummarizer",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/check.ts",
- "target": "node:fs",
- "relation": "imports",
+ "source": "src/engine.ts#Graft",
+ "target": "src/engine.ts#Graft.graph",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/check.ts",
- "target": "node:path",
- "relation": "imports",
+ "source": "src/engine.ts#Graft",
+ "target": "src/engine.ts#Graft.init",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/check.ts",
- "target": "src/context/build.ts",
- "relation": "imports",
+ "source": "src/engine.ts#Graft",
+ "target": "src/engine.ts#Graft.modelLabel",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/check.ts",
- "target": "src/context/node-file.ts",
- "relation": "imports",
+ "source": "src/engine.ts#Graft",
+ "target": "src/engine.ts#Graft.requireKey",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/check.ts",
- "target": "src/ingest/fs.ts",
- "relation": "imports",
+ "source": "src/engine.ts#Graft",
+ "target": "src/engine.ts#Graft.summarizer",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/check.ts",
- "target": "src/util/id.ts",
- "relation": "imports",
+ "source": "src/engine.ts#Graft",
+ "target": "src/engine.ts#Graft.synthesizer",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/check.ts#checkContext",
- "target": "src/context/check.ts#short",
+ "source": "src/engine.ts#Graft.ask",
+ "target": "src/ask/ask.ts#ask",
"relation": "calls",
- "confidence": "extracted"
+ "confidence": "inferred"
},
{
- "source": "src/context/check.ts#checkContext",
- "target": "src/context/node-file.ts#contextDirFor",
+ "source": "src/engine.ts#Graft.check",
+ "target": "src/context/check.ts#checkContext",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "src/context/check.ts#checkContext",
- "target": "src/context/node-file.ts#readManifest",
+ "source": "src/engine.ts#Graft.checkGraph",
+ "target": "src/graph/check.ts#checkGraph",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "src/context/check.ts#checkContext",
- "target": "src/context/node-file.ts#readNodes",
+ "source": "src/engine.ts#Graft.constructor",
+ "target": "src/ai/providers.ts#resolveConfig",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "src/context/check.ts#checkContext",
- "target": "src/ingest/fs.ts#walkDir",
+ "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/context/check.ts#checkContext",
- "target": "src/util/id.ts#contentHash",
+ "source": "src/engine.ts#Graft.init",
+ "target": "src/context/build.ts#buildContext",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "src/context/node-file.ts",
- "target": "src/context/node-file.ts#contextDirFor",
- "relation": "contains",
+ "source": "src/engine.ts#Graft.init",
+ "target": "src/engine.ts#Graft.modelLabel",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/context/node-file.ts",
- "target": "src/context/node-file.ts#ContextNode",
- "relation": "contains",
+ "source": "src/engine.ts#Graft.init",
+ "target": "src/engine.ts#Graft.summarizer",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/context/node-file.ts",
- "target": "src/context/node-file.ts#defaultHuman",
- "relation": "contains",
+ "source": "src/engine.ts#Graft.init",
+ "target": "src/engine.ts#Graft.synthesizer",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/context/node-file.ts",
- "target": "src/context/node-file.ts#deleteNode",
- "relation": "contains",
+ "source": "src/engine.ts#Graft.summarizer",
+ "target": "src/engine.ts#Graft.requireKey",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/context/node-file.ts",
- "target": "src/context/node-file.ts#digestSources",
- "relation": "contains",
+ "source": "src/engine.ts#Graft.synthesizer",
+ "target": "src/engine.ts#Graft.requireKey",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/context/node-file.ts",
- "target": "src/context/node-file.ts#existingNodeSlugs",
+ "source": "src/graph/build.ts",
+ "target": "src/graph/build.ts#buildGraph",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/node-file.ts",
- "target": "src/context/node-file.ts#Manifest",
+ "source": "src/graph/build.ts",
+ "target": "src/graph/build.ts#GraphBuildOptions",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/node-file.ts",
- "target": "src/context/node-file.ts#NodeLink",
+ "source": "src/graph/build.ts",
+ "target": "src/graph/build.ts#GraphBuildResult",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/node-file.ts",
- "target": "src/context/node-file.ts#ParsedNode",
+ "source": "src/graph/build.ts",
+ "target": "src/graph/build.ts#listSourceFiles",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/context/node-file.ts",
- "target": "src/context/node-file.ts#preserveHuman",
- "relation": "contains",
+ "source": "src/graph/build.ts",
+ "target": "node:fs",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/context/node-file.ts",
- "target": "src/context/node-file.ts#readManifest",
- "relation": "contains",
+ "source": "src/graph/build.ts",
+ "target": "node:path",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/context/node-file.ts",
- "target": "src/context/node-file.ts#readNodes",
- "relation": "contains",
+ "source": "src/graph/build.ts",
+ "target": "src/ai/crux.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/context/node-file.ts",
- "target": "src/context/node-file.ts#renderGenerated",
- "relation": "contains",
+ "source": "src/graph/build.ts",
+ "target": "src/context/node-file.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/context/node-file.ts",
- "target": "src/context/node-file.ts#renderNodeFile",
- "relation": "contains",
+ "source": "src/graph/build.ts",
+ "target": "src/graph/cards.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/context/node-file.ts",
- "target": "src/context/node-file.ts#slugify",
- "relation": "contains",
+ "source": "src/graph/build.ts",
+ "target": "src/graph/enrich.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/context/node-file.ts",
- "target": "src/context/node-file.ts#SourceRef",
- "relation": "contains",
+ "source": "src/graph/build.ts",
+ "target": "src/graph/extract.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/context/node-file.ts",
- "target": "src/context/node-file.ts#writeManifest",
- "relation": "contains",
+ "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/context/node-file.ts",
- "target": "src/context/node-file.ts#writeNode",
- "relation": "contains",
+ "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/context/node-file.ts",
- "target": "gray-matter",
- "relation": "imports",
- "confidence": "extracted"
+ "source": "src/graph/build.ts#buildGraph",
+ "target": "src/graph/cards.ts#writeCards",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/context/node-file.ts",
- "target": "node:fs",
- "relation": "imports",
- "confidence": "extracted"
+ "source": "src/graph/build.ts#buildGraph",
+ "target": "src/graph/cards.ts#writeCovers",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/context/node-file.ts",
- "target": "node:path",
- "relation": "imports",
- "confidence": "extracted"
+ "source": "src/graph/build.ts#buildGraph",
+ "target": "src/graph/cards.ts#writeIndex",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/context/node-file.ts",
- "target": "src/util/id.ts",
- "relation": "imports",
- "confidence": "extracted"
+ "source": "src/graph/build.ts#buildGraph",
+ "target": "src/graph/enrich.ts#enrichGraph",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/context/node-file.ts#digestSources",
- "target": "src/util/id.ts#contentHash",
+ "source": "src/graph/build.ts#buildGraph",
+ "target": "src/graph/extract.ts#extractFile",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "src/context/node-file.ts#preserveHuman",
- "target": "src/context/node-file.ts#defaultHuman",
+ "source": "src/graph/build.ts#buildGraph",
+ "target": "src/graph/extract.ts#languageOf",
"relation": "calls",
- "confidence": "extracted"
+ "confidence": "inferred"
},
{
- "source": "src/context/node-file.ts#renderNodeFile",
- "target": "src/context/node-file.ts#renderGenerated",
+ "source": "src/graph/build.ts#buildGraph",
+ "target": "src/graph/resolve.ts#resolveEdges",
"relation": "calls",
- "confidence": "extracted"
+ "confidence": "inferred"
},
{
- "source": "src/context/node-file.ts#slugify",
- "target": "src/util/id.ts#normalizeName",
+ "source": "src/graph/build.ts#buildGraph",
+ "target": "src/graph/write.ts#readGraph",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "src/context/node-file.ts#writeNode",
- "target": "src/context/node-file.ts#defaultHuman",
+ "source": "src/graph/build.ts#buildGraph",
+ "target": "src/graph/write.ts#wiringPath",
"relation": "calls",
- "confidence": "extracted"
+ "confidence": "inferred"
},
{
- "source": "src/context/node-file.ts#writeNode",
- "target": "src/context/node-file.ts#preserveHuman",
+ "source": "src/graph/build.ts#buildGraph",
+ "target": "src/graph/write.ts#writeGraph",
"relation": "calls",
- "confidence": "extracted"
+ "confidence": "inferred"
},
{
- "source": "src/context/node-file.ts#writeNode",
- "target": "src/context/node-file.ts#renderNodeFile",
+ "source": "src/graph/build.ts#listSourceFiles",
+ "target": "src/graph/extract.ts#languageOf",
"relation": "calls",
- "confidence": "extracted"
+ "confidence": "inferred"
},
{
- "source": "src/engine.ts",
- "target": "src/engine.ts#CheckRunOptions",
- "relation": "contains",
- "confidence": "extracted"
+ "source": "src/graph/build.ts#listSourceFiles",
+ "target": "src/ingest/fs.ts#walkDir",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/engine.ts",
- "target": "src/engine.ts#Graft",
+ "source": "src/graph/cards.ts",
+ "target": "src/graph/cards.ts#CardFileInfo",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/engine.ts",
- "target": "src/engine.ts#GraphRunOptions",
+ "source": "src/graph/cards.ts",
+ "target": "src/graph/cards.ts#cardPathFor",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/engine.ts",
- "target": "src/engine.ts#InitOptions",
+ "source": "src/graph/cards.ts",
+ "target": "src/graph/cards.ts#CardStats",
"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",
+ "source": "src/graph/cards.ts",
+ "target": "src/graph/cards.ts#conceptsByPath",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/engine.ts",
- "target": "src/ai/summarize.ts",
- "relation": "imports",
+ "source": "src/graph/cards.ts",
+ "target": "src/graph/cards.ts#CoverRef",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/engine.ts",
- "target": "src/ai/synthesize.ts",
- "relation": "imports",
+ "source": "src/graph/cards.ts",
+ "target": "src/graph/cards.ts#listExistingCards",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/engine.ts",
- "target": "src/ask/ask.ts",
- "relation": "imports",
+ "source": "src/graph/cards.ts",
+ "target": "src/graph/cards.ts#oneLiner",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/engine.ts",
- "target": "src/context/build.ts",
- "relation": "imports",
+ "source": "src/graph/cards.ts",
+ "target": "src/graph/cards.ts#pruneEmptyDirs",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/engine.ts",
- "target": "src/context/check.ts",
- "relation": "imports",
+ "source": "src/graph/cards.ts",
+ "target": "src/graph/cards.ts#renderCard",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/engine.ts",
- "target": "src/graph/build.ts",
- "relation": "imports",
+ "source": "src/graph/cards.ts",
+ "target": "src/graph/cards.ts#spanStart",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/engine.ts",
- "target": "src/graph/check.ts",
- "relation": "imports",
+ "source": "src/graph/cards.ts",
+ "target": "src/graph/cards.ts#writeCards",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/engine.ts#Graft",
- "target": "src/engine.ts#Graft.ask",
+ "source": "src/graph/cards.ts",
+ "target": "src/graph/cards.ts#writeCovers",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/engine.ts#Graft",
- "target": "src/engine.ts#Graft.check",
+ "source": "src/graph/cards.ts",
+ "target": "src/graph/cards.ts#writeIndex",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/engine.ts#Graft",
- "target": "src/engine.ts#Graft.checkGraph",
- "relation": "contains",
+ "source": "src/graph/cards.ts",
+ "target": "gray-matter",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/engine.ts#Graft",
- "target": "src/engine.ts#Graft.constructor",
- "relation": "contains",
+ "source": "src/graph/cards.ts",
+ "target": "node:fs",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/engine.ts#Graft",
- "target": "src/engine.ts#Graft.cruxSummarizer",
- "relation": "contains",
+ "source": "src/graph/cards.ts",
+ "target": "node:path",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/engine.ts#Graft",
- "target": "src/engine.ts#Graft.graph",
- "relation": "contains",
+ "source": "src/graph/cards.ts",
+ "target": "src/context/node-file.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/engine.ts#Graft",
- "target": "src/engine.ts#Graft.init",
- "relation": "contains",
+ "source": "src/graph/cards.ts",
+ "target": "src/graph/types.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/engine.ts#Graft",
- "target": "src/engine.ts#Graft.modelLabel",
- "relation": "contains",
+ "source": "src/graph/cards.ts",
+ "target": "src/graph/write.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/engine.ts#Graft",
- "target": "src/engine.ts#Graft.requireKey",
- "relation": "contains",
- "confidence": "extracted"
+ "source": "src/graph/cards.ts#conceptsByPath",
+ "target": "src/context/node-file.ts#readNodes",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/engine.ts#Graft",
- "target": "src/engine.ts#Graft.summarizer",
- "relation": "contains",
+ "source": "src/graph/cards.ts#listExistingCards",
+ "target": "src/graph/cards.ts#listExistingCards.walk",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/engine.ts#Graft",
- "target": "src/engine.ts#Graft.synthesizer",
+ "source": "src/graph/cards.ts#listExistingCards",
+ "target": "src/graph/cards.ts#listExistingCards.walk",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/engine.ts#Graft.ask",
- "target": "src/ask/ask.ts#ask",
+ "source": "src/graph/cards.ts#listExistingCards.walk",
+ "target": "src/graph/cards.ts#listExistingCards.walk",
"relation": "calls",
- "confidence": "inferred"
+ "confidence": "extracted"
},
{
- "source": "src/engine.ts#Graft.check",
- "target": "src/context/check.ts#checkContext",
+ "source": "src/graph/cards.ts#pruneEmptyDirs",
+ "target": "src/graph/cards.ts#pruneEmptyDirs.visit",
"relation": "calls",
- "confidence": "inferred"
+ "confidence": "extracted"
},
{
- "source": "src/engine.ts#Graft.checkGraph",
- "target": "src/graph/check.ts#checkGraph",
- "relation": "calls",
- "confidence": "inferred"
+ "source": "src/graph/cards.ts#pruneEmptyDirs",
+ "target": "src/graph/cards.ts#pruneEmptyDirs.visit",
+ "relation": "contains",
+ "confidence": "extracted"
},
{
- "source": "src/engine.ts#Graft.constructor",
- "target": "src/ai/providers.ts#resolveConfig",
+ "source": "src/graph/cards.ts#pruneEmptyDirs.visit",
+ "target": "src/graph/cards.ts#pruneEmptyDirs.visit",
"relation": "calls",
- "confidence": "inferred"
+ "confidence": "extracted"
},
{
- "source": "src/engine.ts#Graft.cruxSummarizer",
- "target": "src/engine.ts#Graft.requireKey",
+ "source": "src/graph/cards.ts#renderCard",
+ "target": "src/graph/cards.ts#oneLiner",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/engine.ts#Graft.graph",
- "target": "src/engine.ts#Graft.cruxSummarizer",
+ "source": "src/graph/cards.ts#renderCard",
+ "target": "src/graph/cards.ts#spanStart",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/engine.ts#Graft.graph",
- "target": "src/graph/build.ts#buildGraph",
+ "source": "src/graph/cards.ts#writeCards",
+ "target": "src/graph/cards.ts#cardPathFor",
"relation": "calls",
- "confidence": "inferred"
+ "confidence": "extracted"
},
{
- "source": "src/engine.ts#Graft.init",
- "target": "src/context/build.ts#buildContext",
+ "source": "src/graph/cards.ts#writeCards",
+ "target": "src/graph/cards.ts#conceptsByPath",
"relation": "calls",
- "confidence": "inferred"
+ "confidence": "extracted"
},
{
- "source": "src/engine.ts#Graft.init",
- "target": "src/engine.ts#Graft.modelLabel",
+ "source": "src/graph/cards.ts#writeCards",
+ "target": "src/graph/cards.ts#listExistingCards",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/engine.ts#Graft.init",
- "target": "src/engine.ts#Graft.summarizer",
+ "source": "src/graph/cards.ts#writeCards",
+ "target": "src/graph/cards.ts#pruneEmptyDirs",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/engine.ts#Graft.init",
- "target": "src/engine.ts#Graft.synthesizer",
+ "source": "src/graph/cards.ts#writeCards",
+ "target": "src/graph/cards.ts#renderCard",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/engine.ts#Graft.summarizer",
- "target": "src/engine.ts#Graft.requireKey",
+ "source": "src/graph/cards.ts#writeCovers",
+ "target": "src/graph/cards.ts#spanStart",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/engine.ts#Graft.synthesizer",
- "target": "src/engine.ts#Graft.requireKey",
+ "source": "src/graph/cards.ts#writeIndex",
+ "target": "src/context/node-file.ts#readNodes",
"relation": "calls",
- "confidence": "extracted"
+ "confidence": "inferred"
},
{
- "source": "src/graph/build.ts",
- "target": "src/graph/build.ts#buildGraph",
+ "source": "src/graph/check.ts",
+ "target": "src/graph/check.ts#checkGraph",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/build.ts",
- "target": "src/graph/build.ts#GraphBuildOptions",
+ "source": "src/graph/check.ts",
+ "target": "src/graph/check.ts#formatGraphCheckReport",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/build.ts",
- "target": "src/graph/build.ts#GraphBuildResult",
+ "source": "src/graph/check.ts",
+ "target": "src/graph/check.ts#GraphCheckOptions",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/build.ts",
- "target": "src/graph/build.ts#listSourceFiles",
+ "source": "src/graph/check.ts",
+ "target": "src/graph/check.ts#GraphCheckResult",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/build.ts",
+ "source": "src/graph/check.ts",
"target": "node:fs",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/build.ts",
+ "source": "src/graph/check.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",
+ "source": "src/graph/check.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",
+ "source": "src/graph/check.ts",
+ "target": "src/graph/build.ts",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/build.ts",
+ "source": "src/graph/check.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",
+ "source": "src/graph/check.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",
+ "source": "src/graph/check.ts#checkGraph",
"target": "src/context/node-file.ts#contextDirFor",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "src/graph/build.ts#buildGraph",
+ "source": "src/graph/check.ts#checkGraph",
"target": "src/graph/build.ts#listSourceFiles",
"relation": "calls",
- "confidence": "extracted"
+ "confidence": "inferred"
},
{
- "source": "src/graph/build.ts#buildGraph",
- "target": "src/graph/cards.ts#writeCards",
+ "source": "src/graph/check.ts#checkGraph",
+ "target": "src/graph/extract.ts#extractFile",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "src/graph/build.ts#buildGraph",
- "target": "src/graph/cards.ts#writeCovers",
+ "source": "src/graph/check.ts#checkGraph",
+ "target": "src/graph/extract.ts#languageOf",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "src/graph/build.ts#buildGraph",
- "target": "src/graph/cards.ts#writeIndex",
+ "source": "src/graph/check.ts#checkGraph",
+ "target": "src/graph/write.ts#readGraph",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "src/graph/build.ts#buildGraph",
- "target": "src/graph/enrich.ts#enrichGraph",
+ "source": "src/graph/check.ts#checkGraph",
+ "target": "src/graph/write.ts#wiringPath",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "src/graph/build.ts#buildGraph",
- "target": "src/graph/extract.ts#extractFile",
- "relation": "calls",
- "confidence": "inferred"
+ "source": "src/graph/enrich.ts",
+ "target": "src/graph/enrich.ts#buildCrux",
+ "relation": "contains",
+ "confidence": "extracted"
},
{
- "source": "src/graph/build.ts#buildGraph",
- "target": "src/graph/extract.ts#languageOf",
- "relation": "calls",
- "confidence": "inferred"
+ "source": "src/graph/enrich.ts",
+ "target": "src/graph/enrich.ts#collectFileCrux",
+ "relation": "contains",
+ "confidence": "extracted"
},
{
- "source": "src/graph/build.ts#buildGraph",
- "target": "src/graph/resolve.ts#resolveEdges",
+ "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#mapWithConcurrency",
+ "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": "inferred"
+ "confidence": "extracted"
},
{
- "source": "src/graph/build.ts#buildGraph",
- "target": "src/graph/write.ts#readGraph",
+ "source": "src/graph/enrich.ts#collectFileCrux",
+ "target": "src/ai/crux.ts#OpenRouterCruxSummarizer.describeFile",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "src/graph/build.ts#buildGraph",
- "target": "src/graph/write.ts#wiringPath",
+ "source": "src/graph/enrich.ts#enrichGraph",
+ "target": "src/graph/enrich.ts#buildCrux",
"relation": "calls",
- "confidence": "inferred"
+ "confidence": "extracted"
},
{
- "source": "src/graph/build.ts#buildGraph",
- "target": "src/graph/write.ts#writeGraph",
+ "source": "src/graph/enrich.ts#enrichGraph",
+ "target": "src/graph/enrich.ts#collectFileCrux",
"relation": "calls",
- "confidence": "inferred"
+ "confidence": "extracted"
},
{
- "source": "src/graph/build.ts#listSourceFiles",
- "target": "src/graph/extract.ts#languageOf",
+ "source": "src/graph/enrich.ts#enrichGraph",
+ "target": "src/graph/enrich.ts#mapWithConcurrency",
"relation": "calls",
- "confidence": "inferred"
+ "confidence": "extracted"
},
{
- "source": "src/graph/build.ts#listSourceFiles",
- "target": "src/ingest/fs.ts#walkDir",
+ "source": "src/graph/enrich.ts#enrichGraph",
+ "target": "src/graph/enrich.ts#spanLines",
"relation": "calls",
- "confidence": "inferred"
+ "confidence": "extracted"
},
{
- "source": "src/graph/cards.ts",
- "target": "src/graph/cards.ts#CardFileInfo",
+ "source": "src/graph/extract.ts",
+ "target": "src/graph/extract.ts#calleeName",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts",
- "target": "src/graph/cards.ts#cardPathFor",
+ "source": "src/graph/extract.ts",
+ "target": "src/graph/extract.ts#clean",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts",
- "target": "src/graph/cards.ts#CardStats",
+ "source": "src/graph/extract.ts",
+ "target": "src/graph/extract.ts#DefDescriptor",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts",
- "target": "src/graph/cards.ts#conceptsByPath",
+ "source": "src/graph/extract.ts",
+ "target": "src/graph/extract.ts#describe",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts",
- "target": "src/graph/cards.ts#CoverRef",
+ "source": "src/graph/extract.ts",
+ "target": "src/graph/extract.ts#extractFile",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts",
- "target": "src/graph/cards.ts#listExistingCards",
+ "source": "src/graph/extract.ts",
+ "target": "src/graph/extract.ts#ExtractResult",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts",
- "target": "src/graph/cards.ts#oneLiner",
+ "source": "src/graph/extract.ts",
+ "target": "src/graph/extract.ts#heritageEdges",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts",
- "target": "src/graph/cards.ts#pruneEmptyDirs",
+ "source": "src/graph/extract.ts",
+ "target": "src/graph/extract.ts#importSpecifier",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts",
- "target": "src/graph/cards.ts#renderCard",
+ "source": "src/graph/extract.ts",
+ "target": "src/graph/extract.ts#isImport",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts",
- "target": "src/graph/cards.ts#spanStart",
+ "source": "src/graph/extract.ts",
+ "target": "src/graph/extract.ts#Language",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts",
- "target": "src/graph/cards.ts#writeCards",
+ "source": "src/graph/extract.ts",
+ "target": "src/graph/extract.ts#languageOf",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts",
- "target": "src/graph/cards.ts#writeCovers",
+ "source": "src/graph/extract.ts",
+ "target": "src/graph/extract.ts#RawEdge",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts",
- "target": "src/graph/cards.ts#writeIndex",
+ "source": "src/graph/extract.ts",
+ "target": "src/graph/extract.ts#tsExported",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts",
- "target": "gray-matter",
- "relation": "imports",
+ "source": "src/graph/extract.ts",
+ "target": "src/graph/extract.ts#walk",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts",
- "target": "node:fs",
- "relation": "imports",
+ "source": "src/graph/extract.ts",
+ "target": "src/graph/extract.ts#WalkCtx",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts",
+ "source": "src/graph/extract.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",
+ "source": "src/graph/extract.ts",
"target": "src/graph/types.ts",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts",
- "target": "src/graph/write.ts",
+ "source": "src/graph/extract.ts",
+ "target": "src/util/id.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",
+ "source": "src/graph/extract.ts",
+ "target": "tree-sitter",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts#listExistingCards",
- "target": "src/graph/cards.ts#listExistingCards.walk",
- "relation": "contains",
+ "source": "src/graph/extract.ts",
+ "target": "tree-sitter-python",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts#listExistingCards.walk",
- "target": "src/graph/cards.ts#listExistingCards.walk",
- "relation": "calls",
+ "source": "src/graph/extract.ts",
+ "target": "tree-sitter-typescript",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts#pruneEmptyDirs",
- "target": "src/graph/cards.ts#pruneEmptyDirs.visit",
+ "source": "src/graph/extract.ts#extractFile",
+ "target": "src/graph/extract.ts#walk",
"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",
+ "source": "src/graph/extract.ts#extractFile",
+ "target": "src/util/id.ts#contentHash",
"relation": "calls",
- "confidence": "extracted"
+ "confidence": "inferred"
},
{
- "source": "src/graph/cards.ts#renderCard",
- "target": "src/graph/cards.ts#oneLiner",
+ "source": "src/graph/extract.ts#walk",
+ "target": "src/graph/extract.ts#calleeName",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts#renderCard",
- "target": "src/graph/cards.ts#spanStart",
+ "source": "src/graph/extract.ts#walk",
+ "target": "src/graph/extract.ts#clean",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts#writeCards",
- "target": "src/graph/cards.ts#cardPathFor",
+ "source": "src/graph/extract.ts#walk",
+ "target": "src/graph/extract.ts#describe",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts#writeCards",
- "target": "src/graph/cards.ts#conceptsByPath",
+ "source": "src/graph/extract.ts#walk",
+ "target": "src/graph/extract.ts#heritageEdges",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts#writeCards",
- "target": "src/graph/cards.ts#listExistingCards",
+ "source": "src/graph/extract.ts#walk",
+ "target": "src/graph/extract.ts#importSpecifier",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts#writeCards",
- "target": "src/graph/cards.ts#pruneEmptyDirs",
+ "source": "src/graph/extract.ts#walk",
+ "target": "src/graph/extract.ts#isImport",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts#writeCards",
- "target": "src/graph/cards.ts#renderCard",
+ "source": "src/graph/extract.ts#walk",
+ "target": "src/graph/extract.ts#tsExported",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts#writeCovers",
- "target": "src/graph/cards.ts#spanStart",
+ "source": "src/graph/extract.ts#walk",
+ "target": "src/graph/extract.ts#walk",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/graph/cards.ts#writeIndex",
- "target": "src/context/node-file.ts#readNodes",
+ "source": "src/graph/extract.ts#walk",
+ "target": "src/util/id.ts#contentHash",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "src/graph/check.ts",
- "target": "src/graph/check.ts#checkGraph",
+ "source": "src/graph/resolve.ts",
+ "target": "src/graph/resolve.ts#push",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/check.ts",
- "target": "src/graph/check.ts#formatGraphCheckReport",
+ "source": "src/graph/resolve.ts",
+ "target": "src/graph/resolve.ts#resolveEdges",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/check.ts",
- "target": "src/graph/check.ts#GraphCheckOptions",
+ "source": "src/graph/resolve.ts",
+ "target": "src/graph/resolve.ts#resolveImport",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/check.ts",
- "target": "src/graph/check.ts#GraphCheckResult",
+ "source": "src/graph/resolve.ts",
+ "target": "src/graph/resolve.ts#resolveName",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/check.ts",
- "target": "node:fs",
+ "source": "src/graph/resolve.ts",
+ "target": "node:path",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/check.ts",
- "target": "node:path",
+ "source": "src/graph/resolve.ts",
+ "target": "src/graph/extract.ts",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/check.ts",
- "target": "src/context/node-file.ts",
+ "source": "src/graph/resolve.ts",
+ "target": "src/graph/types.ts",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/check.ts",
- "target": "src/graph/build.ts",
- "relation": "imports",
+ "source": "src/graph/resolve.ts#resolveEdges",
+ "target": "src/graph/resolve.ts#push",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/graph/check.ts",
- "target": "src/graph/extract.ts",
- "relation": "imports",
+ "source": "src/graph/resolve.ts#resolveEdges",
+ "target": "src/graph/resolve.ts#resolveEdges.add",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/graph/check.ts",
- "target": "src/graph/write.ts",
- "relation": "imports",
+ "source": "src/graph/resolve.ts#resolveEdges",
+ "target": "src/graph/resolve.ts#resolveImport",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/graph/check.ts#checkGraph",
- "target": "src/context/node-file.ts#contextDirFor",
+ "source": "src/graph/resolve.ts#resolveEdges",
+ "target": "src/graph/resolve.ts#resolveName",
"relation": "calls",
- "confidence": "inferred"
+ "confidence": "extracted"
},
{
- "source": "src/graph/check.ts#checkGraph",
- "target": "src/graph/build.ts#listSourceFiles",
- "relation": "calls",
- "confidence": "inferred"
+ "source": "src/graph/resolve.ts#resolveEdges",
+ "target": "src/graph/resolve.ts#resolveEdges.add",
+ "relation": "contains",
+ "confidence": "extracted"
},
{
- "source": "src/graph/check.ts#checkGraph",
- "target": "src/graph/extract.ts#extractFile",
- "relation": "calls",
- "confidence": "inferred"
+ "source": "src/graph/types.ts",
+ "target": "src/graph/types.ts#Confidence",
+ "relation": "contains",
+ "confidence": "extracted"
},
{
- "source": "src/graph/check.ts#checkGraph",
- "target": "src/graph/extract.ts#languageOf",
- "relation": "calls",
- "confidence": "inferred"
+ "source": "src/graph/types.ts",
+ "target": "src/graph/types.ts#Crux",
+ "relation": "contains",
+ "confidence": "extracted"
},
{
- "source": "src/graph/check.ts#checkGraph",
- "target": "src/graph/write.ts#readGraph",
- "relation": "calls",
- "confidence": "inferred"
+ "source": "src/graph/types.ts",
+ "target": "src/graph/types.ts#EdgeV1",
+ "relation": "contains",
+ "confidence": "extracted"
},
{
- "source": "src/graph/check.ts#checkGraph",
- "target": "src/graph/write.ts#wiringPath",
- "relation": "calls",
- "confidence": "inferred"
+ "source": "src/graph/types.ts",
+ "target": "src/graph/types.ts#GraphV1",
+ "relation": "contains",
+ "confidence": "extracted"
},
{
- "source": "src/graph/enrich.ts",
- "target": "src/graph/enrich.ts#buildCrux",
+ "source": "src/graph/types.ts",
+ "target": "src/graph/types.ts#Kind",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/enrich.ts",
- "target": "src/graph/enrich.ts#collectFileCrux",
+ "source": "src/graph/types.ts",
+ "target": "src/graph/types.ts#NodeV1",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/enrich.ts",
- "target": "src/graph/enrich.ts#enrichGraph",
+ "source": "src/graph/types.ts",
+ "target": "src/graph/types.ts#Relation",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/enrich.ts",
- "target": "src/graph/enrich.ts#EnrichOptions",
+ "source": "src/graph/types.ts",
+ "target": "src/graph/types.ts#SummaryState",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/enrich.ts",
- "target": "src/graph/enrich.ts#EnrichStats",
+ "source": "src/graph/write.ts",
+ "target": "src/graph/write.ts#edgeOrder",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/enrich.ts",
- "target": "src/graph/enrich.ts#mapWithConcurrency",
+ "source": "src/graph/write.ts",
+ "target": "src/graph/write.ts#readGraph",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/enrich.ts",
- "target": "src/graph/enrich.ts#spanLines",
+ "source": "src/graph/write.ts",
+ "target": "src/graph/write.ts#wiringPath",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/enrich.ts",
- "target": "src/ai/crux.ts",
+ "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/enrich.ts",
+ "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/enrich.ts#buildCrux",
- "target": "src/graph/enrich.ts#spanLines",
+ "source": "src/graph/write.ts#writeGraph",
+ "target": "src/graph/write.ts#wiringPath",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/graph/enrich.ts#collectFileCrux",
- "target": "src/ai/crux.ts#OpenRouterCruxSummarizer.describeFile",
+ "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": "inferred"
+ "confidence": "extracted"
},
{
- "source": "src/graph/enrich.ts#enrichGraph",
- "target": "src/graph/enrich.ts#buildCrux",
- "relation": "calls",
+ "source": "src/util/id.ts",
+ "target": "src/util/id.ts#contentHash",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/enrich.ts#enrichGraph",
- "target": "src/graph/enrich.ts#collectFileCrux",
- "relation": "calls",
+ "source": "src/util/id.ts",
+ "target": "src/util/id.ts#newId",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/enrich.ts#enrichGraph",
- "target": "src/graph/enrich.ts#mapWithConcurrency",
- "relation": "calls",
+ "source": "src/util/id.ts",
+ "target": "src/util/id.ts#normalizeName",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/enrich.ts#enrichGraph",
- "target": "src/graph/enrich.ts#spanLines",
- "relation": "calls",
+ "source": "src/util/id.ts",
+ "target": "node:crypto",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts",
- "target": "src/graph/extract.ts#calleeName",
+ "source": "src/viz/assemble.ts",
+ "target": "src/viz/assemble.ts#assembleContextGraph",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts",
- "target": "src/graph/extract.ts#clean",
+ "source": "src/viz/assemble.ts",
+ "target": "src/viz/assemble.ts#extractSummary",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts",
- "target": "src/graph/extract.ts#DefDescriptor",
+ "source": "src/viz/assemble.ts",
+ "target": "src/viz/assemble.ts#normalizeRelation",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts",
- "target": "src/graph/extract.ts#describe",
+ "source": "src/viz/assemble.ts",
+ "target": "src/viz/assemble.ts#VizEdge",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts",
- "target": "src/graph/extract.ts#extractFile",
+ "source": "src/viz/assemble.ts",
+ "target": "src/viz/assemble.ts#VizGraph",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts",
- "target": "src/graph/extract.ts#ExtractResult",
+ "source": "src/viz/assemble.ts",
+ "target": "src/viz/assemble.ts#VizNode",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts",
- "target": "src/graph/extract.ts#heritageEdges",
- "relation": "contains",
+ "source": "src/viz/assemble.ts",
+ "target": "gray-matter",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts",
- "target": "src/graph/extract.ts#importSpecifier",
- "relation": "contains",
+ "source": "src/viz/assemble.ts",
+ "target": "node:fs",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts",
- "target": "src/graph/extract.ts#isImport",
- "relation": "contains",
+ "source": "src/viz/assemble.ts",
+ "target": "node:path",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts",
- "target": "src/graph/extract.ts#Language",
- "relation": "contains",
+ "source": "src/viz/assemble.ts",
+ "target": "src/context/node-file.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts",
- "target": "src/graph/extract.ts#languageOf",
- "relation": "contains",
+ "source": "src/viz/assemble.ts#assembleContextGraph",
+ "target": "src/viz/assemble.ts#extractSummary",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts",
- "target": "src/graph/extract.ts#RawEdge",
- "relation": "contains",
+ "source": "src/viz/assemble.ts#assembleContextGraph",
+ "target": "src/viz/assemble.ts#normalizeRelation",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts",
- "target": "src/graph/extract.ts#tsExported",
+ "source": "src/viz/serve.ts",
+ "target": "src/viz/serve.ts#listen",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts",
- "target": "src/graph/extract.ts#walk",
+ "source": "src/viz/serve.ts",
+ "target": "src/viz/serve.ts#sendJson",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts",
- "target": "src/graph/extract.ts#WalkCtx",
+ "source": "src/viz/serve.ts",
+ "target": "src/viz/serve.ts#startVizServer",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts",
- "target": "node:path",
- "relation": "imports",
+ "source": "src/viz/serve.ts",
+ "target": "src/viz/serve.ts#VizServer",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts",
- "target": "src/graph/types.ts",
- "relation": "imports",
+ "source": "src/viz/serve.ts",
+ "target": "src/viz/serve.ts#VizServerOptions",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts",
- "target": "src/util/id.ts",
+ "source": "src/viz/serve.ts",
+ "target": "node:fs",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts",
- "target": "tree-sitter",
+ "source": "src/viz/serve.ts",
+ "target": "node:http",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts",
- "target": "tree-sitter-python",
+ "source": "src/viz/serve.ts",
+ "target": "node:path",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts",
- "target": "tree-sitter-typescript",
+ "source": "src/viz/serve.ts",
+ "target": "src/viz/assemble.ts",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts#extractFile",
- "target": "src/graph/extract.ts#walk",
- "relation": "calls",
+ "source": "src/viz/serve.ts#listen",
+ "target": "src/viz/serve.ts#listen.onError",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts#extractFile",
- "target": "src/util/id.ts#contentHash",
+ "source": "src/viz/serve.ts#startVizServer",
+ "target": "src/viz/assemble.ts#assembleContextGraph",
"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",
+ "source": "src/viz/serve.ts#startVizServer",
+ "target": "src/viz/serve.ts#listen",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts#walk",
- "target": "src/graph/extract.ts#heritageEdges",
+ "source": "src/viz/serve.ts#startVizServer",
+ "target": "src/viz/serve.ts#sendJson",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts#walk",
- "target": "src/graph/extract.ts#importSpecifier",
- "relation": "calls",
+ "source": "src/viz/serve.ts#startVizServer",
+ "target": "src/viz/serve.ts#startVizServer.close",
+ "relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts#walk",
- "target": "src/graph/extract.ts#isImport",
+ "source": "src/viz/serve.ts#startVizServer.close",
+ "target": "src/viz/serve.ts#startVizServer.close",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/graph/extract.ts#walk",
- "target": "src/graph/extract.ts#tsExported",
+ "source": "test/ask.test.ts",
+ "target": "src/ask/ask.ts#ask",
"relation": "calls",
- "confidence": "extracted"
+ "confidence": "inferred"
},
{
- "source": "src/graph/extract.ts#walk",
- "target": "src/graph/extract.ts#walk",
+ "source": "test/ask.test.ts",
+ "target": "src/ask/ask.ts#formatAsk",
"relation": "calls",
- "confidence": "extracted"
+ "confidence": "inferred"
},
{
- "source": "src/graph/extract.ts#walk",
- "target": "src/util/id.ts#contentHash",
+ "source": "test/ask.test.ts",
+ "target": "src/graph/build.ts#buildGraph",
"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",
+ "source": "test/ask.test.ts",
+ "target": "test/ask.test.ts#makeFixture",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/graph/resolve.ts",
- "target": "src/graph/resolve.ts#resolveName",
+ "source": "test/ask.test.ts",
+ "target": "test/ask.test.ts#makeFixture",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/resolve.ts",
- "target": "node:path",
+ "source": "test/ask.test.ts",
+ "target": "node:assert/strict",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/resolve.ts",
- "target": "src/graph/extract.ts",
+ "source": "test/ask.test.ts",
+ "target": "node:fs",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/resolve.ts",
- "target": "src/graph/types.ts",
+ "source": "test/ask.test.ts",
+ "target": "node:os",
"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",
+ "source": "test/ask.test.ts",
+ "target": "node:path",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/resolve.ts#resolveEdges",
- "target": "src/graph/resolve.ts#resolveEdges.add",
- "relation": "contains",
+ "source": "test/ask.test.ts",
+ "target": "node:test",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/types.ts",
- "target": "src/graph/types.ts#Confidence",
- "relation": "contains",
+ "source": "test/ask.test.ts",
+ "target": "src/ask/ask.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/types.ts",
- "target": "src/graph/types.ts#Crux",
- "relation": "contains",
+ "source": "test/ask.test.ts",
+ "target": "src/graph/build.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/types.ts",
- "target": "src/graph/types.ts#EdgeV1",
- "relation": "contains",
- "confidence": "extracted"
+ "source": "test/claude-format.test.ts",
+ "target": "src/claude/format.ts#enrichedSegment",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/graph/types.ts",
- "target": "src/graph/types.ts#GraphV1",
- "relation": "contains",
- "confidence": "extracted"
+ "source": "test/claude-format.test.ts",
+ "target": "src/claude/format.ts#formatBlastRadius",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/graph/types.ts",
- "target": "src/graph/types.ts#Kind",
- "relation": "contains",
- "confidence": "extracted"
+ "source": "test/claude-format.test.ts",
+ "target": "src/claude/format.ts#formatOrientation",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/graph/types.ts",
- "target": "src/graph/types.ts#NodeV1",
- "relation": "contains",
- "confidence": "extracted"
+ "source": "test/claude-format.test.ts",
+ "target": "src/claude/format.ts#formatRetrieval",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/graph/types.ts",
- "target": "src/graph/types.ts#Relation",
- "relation": "contains",
- "confidence": "extracted"
+ "source": "test/claude-format.test.ts",
+ "target": "src/claude/format.ts#incomingEdges",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/graph/types.ts",
- "target": "src/graph/types.ts#SummaryState",
- "relation": "contains",
- "confidence": "extracted"
+ "source": "test/claude-format.test.ts",
+ "target": "src/claude/format.ts#renderStatusline",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/graph/write.ts",
- "target": "src/graph/write.ts#edgeOrder",
- "relation": "contains",
- "confidence": "extracted"
+ "source": "test/claude-format.test.ts",
+ "target": "src/claude/format.ts#renderSubagent",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/graph/write.ts",
- "target": "src/graph/write.ts#readGraph",
- "relation": "contains",
+ "source": "test/claude-format.test.ts",
+ "target": "src/claude/state.ts#emptyStats",
+ "relation": "calls",
+ "confidence": "inferred"
+ },
+ {
+ "source": "test/claude-format.test.ts",
+ "target": "test/claude-format.test.ts#strip",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/graph/write.ts",
- "target": "src/graph/write.ts#wiringPath",
+ "source": "test/claude-format.test.ts",
+ "target": "test/claude-format.test.ts#strip",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/graph/write.ts",
- "target": "src/graph/write.ts#writeGraph",
- "relation": "contains",
+ "source": "test/claude-format.test.ts",
+ "target": "node:assert/strict",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/write.ts",
- "target": "node:fs",
+ "source": "test/claude-format.test.ts",
+ "target": "node:test",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/write.ts",
- "target": "node:path",
+ "source": "test/claude-format.test.ts",
+ "target": "src/claude/format.ts",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/write.ts",
- "target": "src/graph/types.ts",
+ "source": "test/claude-format.test.ts",
+ "target": "src/claude/state.ts",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/graph/write.ts#writeGraph",
- "target": "src/graph/write.ts#wiringPath",
+ "source": "test/claude-hooks.test.ts",
+ "target": "src/claude/hooks.ts#underGraft",
"relation": "calls",
- "confidence": "extracted"
+ "confidence": "inferred"
},
{
- "source": "src/ingest/fs.ts",
- "target": "src/ingest/fs.ts#walkDir",
- "relation": "contains",
- "confidence": "extracted"
+ "source": "test/claude-hooks.test.ts",
+ "target": "src/claude/state.ts#acquireLock",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/ingest/fs.ts",
- "target": "node:fs",
- "relation": "imports",
- "confidence": "extracted"
+ "source": "test/claude-hooks.test.ts",
+ "target": "src/claude/state.ts#emptyStats",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/ingest/fs.ts",
- "target": "node:path",
- "relation": "imports",
- "confidence": "extracted"
+ "source": "test/claude-hooks.test.ts",
+ "target": "src/claude/state.ts#readStats",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/ingest/fs.ts#walkDir",
- "target": "src/ingest/fs.ts#walkDir",
+ "source": "test/claude-hooks.test.ts",
+ "target": "src/claude/state.ts#writeStats",
"relation": "calls",
- "confidence": "extracted"
+ "confidence": "inferred"
},
{
- "source": "src/util/id.ts",
- "target": "src/util/id.ts#contentHash",
- "relation": "contains",
+ "source": "test/claude-hooks.test.ts",
+ "target": "src/claude/sync-run.ts#runSync",
+ "relation": "calls",
+ "confidence": "inferred"
+ },
+ {
+ "source": "test/claude-hooks.test.ts",
+ "target": "test/claude-hooks.test.ts#runWithStdin",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/util/id.ts",
- "target": "src/util/id.ts#newId",
+ "source": "test/claude-hooks.test.ts",
+ "target": "test/claude-hooks.test.ts#fakeBuild",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/util/id.ts",
- "target": "src/util/id.ts#normalizeName",
+ "source": "test/claude-hooks.test.ts",
+ "target": "test/claude-hooks.test.ts#runWithStdin",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/util/id.ts",
- "target": "node:crypto",
+ "source": "test/claude-hooks.test.ts",
+ "target": "node:assert/strict",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/viz/assemble.ts",
- "target": "src/viz/assemble.ts#assembleContextGraph",
- "relation": "contains",
+ "source": "test/claude-hooks.test.ts",
+ "target": "node:fs",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/viz/assemble.ts",
- "target": "src/viz/assemble.ts#extractSummary",
- "relation": "contains",
+ "source": "test/claude-hooks.test.ts",
+ "target": "node:os",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/viz/assemble.ts",
- "target": "src/viz/assemble.ts#normalizeRelation",
- "relation": "contains",
+ "source": "test/claude-hooks.test.ts",
+ "target": "node:path",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/viz/assemble.ts",
- "target": "src/viz/assemble.ts#VizEdge",
- "relation": "contains",
+ "source": "test/claude-hooks.test.ts",
+ "target": "node:test",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/viz/assemble.ts",
- "target": "src/viz/assemble.ts#VizGraph",
- "relation": "contains",
+ "source": "test/claude-hooks.test.ts",
+ "target": "src/claude/hooks.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/viz/assemble.ts",
- "target": "src/viz/assemble.ts#VizNode",
- "relation": "contains",
+ "source": "test/claude-hooks.test.ts",
+ "target": "src/claude/state.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/viz/assemble.ts",
- "target": "gray-matter",
+ "source": "test/claude-hooks.test.ts",
+ "target": "src/claude/sync-run.ts",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/viz/assemble.ts",
- "target": "node:fs",
- "relation": "imports",
- "confidence": "extracted"
+ "source": "test/claude-state.test.ts",
+ "target": "src/claude/state.ts#acquireLock",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/viz/assemble.ts",
- "target": "node:path",
- "relation": "imports",
- "confidence": "extracted"
+ "source": "test/claude-state.test.ts",
+ "target": "src/claude/state.ts#cacheDir",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/viz/assemble.ts",
- "target": "src/context/node-file.ts",
- "relation": "imports",
- "confidence": "extracted"
+ "source": "test/claude-state.test.ts",
+ "target": "src/claude/state.ts#emptyStats",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/viz/assemble.ts#assembleContextGraph",
- "target": "src/viz/assemble.ts#extractSummary",
+ "source": "test/claude-state.test.ts",
+ "target": "src/claude/state.ts#patchStats",
"relation": "calls",
- "confidence": "extracted"
+ "confidence": "inferred"
},
{
- "source": "src/viz/assemble.ts#assembleContextGraph",
- "target": "src/viz/assemble.ts#normalizeRelation",
+ "source": "test/claude-state.test.ts",
+ "target": "src/claude/state.ts#readSession",
"relation": "calls",
- "confidence": "extracted"
+ "confidence": "inferred"
},
{
- "source": "src/viz/serve.ts",
- "target": "src/viz/serve.ts#listen",
- "relation": "contains",
- "confidence": "extracted"
+ "source": "test/claude-state.test.ts",
+ "target": "src/claude/state.ts#readStats",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/viz/serve.ts",
- "target": "src/viz/serve.ts#sendJson",
- "relation": "contains",
- "confidence": "extracted"
+ "source": "test/claude-state.test.ts",
+ "target": "src/claude/state.ts#releaseLock",
+ "relation": "calls",
+ "confidence": "inferred"
},
{
- "source": "src/viz/serve.ts",
- "target": "src/viz/serve.ts#startVizServer",
- "relation": "contains",
+ "source": "test/claude-state.test.ts",
+ "target": "src/claude/state.ts#writeSession",
+ "relation": "calls",
+ "confidence": "inferred"
+ },
+ {
+ "source": "test/claude-state.test.ts",
+ "target": "src/claude/state.ts#writeStats",
+ "relation": "calls",
+ "confidence": "inferred"
+ },
+ {
+ "source": "test/claude-state.test.ts",
+ "target": "test/claude-state.test.ts#fresh",
+ "relation": "calls",
"confidence": "extracted"
},
{
- "source": "src/viz/serve.ts",
- "target": "src/viz/serve.ts#VizServer",
+ "source": "test/claude-state.test.ts",
+ "target": "test/claude-state.test.ts#fresh",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "src/viz/serve.ts",
- "target": "src/viz/serve.ts#VizServerOptions",
- "relation": "contains",
+ "source": "test/claude-state.test.ts",
+ "target": "node:assert/strict",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/viz/serve.ts",
+ "source": "test/claude-state.test.ts",
"target": "node:fs",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/viz/serve.ts",
- "target": "node:http",
+ "source": "test/claude-state.test.ts",
+ "target": "node:os",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/viz/serve.ts",
+ "source": "test/claude-state.test.ts",
"target": "node:path",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/viz/serve.ts",
- "target": "src/viz/assemble.ts",
+ "source": "test/claude-state.test.ts",
+ "target": "node:test",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/viz/serve.ts#listen",
- "target": "src/viz/serve.ts#listen.onError",
- "relation": "contains",
+ "source": "test/claude-state.test.ts",
+ "target": "src/claude/state.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/viz/serve.ts#startVizServer",
- "target": "src/viz/assemble.ts#assembleContextGraph",
+ "source": "test/claude-stats.test.ts",
+ "target": "src/claude/stats.ts#computeStats",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "src/viz/serve.ts#startVizServer",
- "target": "src/viz/serve.ts#listen",
- "relation": "calls",
+ "source": "test/claude-stats.test.ts",
+ "target": "node:assert/strict",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/viz/serve.ts#startVizServer",
- "target": "src/viz/serve.ts#sendJson",
- "relation": "calls",
+ "source": "test/claude-stats.test.ts",
+ "target": "node:test",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/viz/serve.ts#startVizServer",
- "target": "src/viz/serve.ts#startVizServer.close",
- "relation": "contains",
+ "source": "test/claude-stats.test.ts",
+ "target": "src/claude/stats.ts",
+ "relation": "imports",
"confidence": "extracted"
},
{
- "source": "src/viz/serve.ts#startVizServer.close",
- "target": "src/viz/serve.ts#startVizServer.close",
+ "source": "test/claude-statusline.test.ts",
+ "target": "src/claude/state.ts#emptyStats",
"relation": "calls",
- "confidence": "extracted"
+ "confidence": "inferred"
},
{
- "source": "test/ask.test.ts",
- "target": "src/ask/ask.ts#ask",
+ "source": "test/claude-statusline.test.ts",
+ "target": "src/claude/state.ts#writeStats",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "test/ask.test.ts",
- "target": "src/ask/ask.ts#formatAsk",
+ "source": "test/claude-statusline.test.ts",
+ "target": "src/claude/statusline.ts#resolveStats",
"relation": "calls",
"confidence": "inferred"
},
{
- "source": "test/ask.test.ts",
- "target": "src/graph/build.ts#buildGraph",
+ "source": "test/claude-statusline.test.ts",
+ "target": "test/claude-statusline.test.ts#repo",
"relation": "calls",
- "confidence": "inferred"
+ "confidence": "extracted"
},
{
- "source": "test/ask.test.ts",
- "target": "test/ask.test.ts#makeFixture",
+ "source": "test/claude-statusline.test.ts",
+ "target": "test/claude-statusline.test.ts#writeWiring",
"relation": "calls",
"confidence": "extracted"
},
{
- "source": "test/ask.test.ts",
- "target": "test/ask.test.ts#makeFixture",
+ "source": "test/claude-statusline.test.ts",
+ "target": "test/claude-statusline.test.ts#repo",
"relation": "contains",
"confidence": "extracted"
},
{
- "source": "test/ask.test.ts",
+ "source": "test/claude-statusline.test.ts",
+ "target": "test/claude-statusline.test.ts#writeWiring",
+ "relation": "contains",
+ "confidence": "extracted"
+ },
+ {
+ "source": "test/claude-statusline.test.ts",
"target": "node:assert/strict",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "test/ask.test.ts",
+ "source": "test/claude-statusline.test.ts",
"target": "node:fs",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "test/ask.test.ts",
+ "source": "test/claude-statusline.test.ts",
"target": "node:os",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "test/ask.test.ts",
+ "source": "test/claude-statusline.test.ts",
"target": "node:path",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "test/ask.test.ts",
+ "source": "test/claude-statusline.test.ts",
"target": "node:test",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "test/ask.test.ts",
- "target": "src/ask/ask.ts",
+ "source": "test/claude-statusline.test.ts",
+ "target": "src/claude/state.ts",
"relation": "imports",
"confidence": "extracted"
},
{
- "source": "test/ask.test.ts",
- "target": "src/graph/build.ts",
+ "source": "test/claude-statusline.test.ts",
+ "target": "src/claude/statusline.ts",
"relation": "imports",
"confidence": "extracted"
},
diff --git a/graft/INDEX.md b/graft/INDEX.md
index 4f02a79a..758eb640 100644
--- a/graft/INDEX.md
+++ b/graft/INDEX.md
@@ -21,5 +21,5 @@ filename here, or run `graft ask "<task>"`. Each node carries prose plus exact
## Files
-42 per-file wiring cards mirror the source tree under `graft/` (40 carry extracted symbols). They are deliberately not enumerated here —
+54 per-file wiring cards mirror the source tree under `graft/` (51 carry extracted symbols). They are deliberately not enumerated here —
`grep` a symbol or `find`/`ls` a filename under `graft/` to land on the card for that file.
diff --git a/graft/bench/token-ab.md b/graft/bench/token-ab.md
new file mode 100644
index 00000000..3b5d7d07
--- /dev/null
+++ b/graft/bench/token-ab.md
@@ -0,0 +1,11 @@
+# bench/token-ab.ts
+
+- Metrics · interface · L59-L68 — interface Metrics
+- runSearch · function · L108-L138 — function runSearch(pattern: string): string
+- runRead · function · L140-L157 — function runRead(path: string, start?: number, end?: number): { text: string; resolved: string }
+- runAgent · function · L160-L226 — async function runAgent(arm: string, extraContext: string | null): Promise<Metrics>
+- graftPack · function · L229-L240 — function graftPack(): { pack: string; ms: number }
+- cost · function · L242-L246 — function cost(m: Metrics): string
+- row · function · L248-L250 — function row(label: string, a: string | number, b: string | number): string
+- main · function · L252-L292 — async function main()
+- pct · function · L272-L272 — pct = (a: number, b: number)
diff --git a/graft/src/ask/ask.md b/graft/src/ask/ask.md
index 8e6f7efd..265748aa 100644
--- a/graft/src/ask/ask.md
+++ b/graft/src/ask/ask.md
@@ -3,19 +3,23 @@
This file implements a query tool that routes natural language queries to relevant code symbols and returns structured context information.
- AskHit · interface · L23-L36 — Represents a hit in the query results, encapsulating details about a code symbol and its context.
-- AskResult · interface · L42-L49 — Encapsulates the result of a query, including the query string, mode of operation, and the hits found.
-- tokenize · function · L58-L64 — Transforms a string of text into an array of lowercased subword tokens, filtering out common stop words.
-- counts · function · L67-L71 — Creates a frequency count map of tokens, allowing for analysis of term occurrences in a document.
-- firstProse · function · L74-L81 — Extracts the first meaningful prose line from a body of text, ignoring headings and blank lines.
-- Corpus · interface · L83-L86 — Defines the structure for a corpus containing concepts and a graph, used for processing queries.
-- loadCorpus · function · L88-L113 — Loads a corpus from a specified directory, extracting concepts and building a graph for query processing.
-- score · function · L116-L123 — Calculates a score for a document's token counts against a query, facilitating relevance ranking.
-- findSubject · function · L133-L151 — Identifies the most relevant symbols in the graph that match the query, prioritizing exact name matches.
-- structural · function · L153-L194 — Processes a structural query to find and return relevant callers or callees from the graph based on the query.
-- lexical · function · L198-L242 — Ranks concepts and symbols based on lexical matching with the query, returning the most relevant results.
-- AskOptions · interface · L244-L250 — Defines options for customizing the behavior of the ask function, such as context directory and result limits.
-- parseSpan · function · L254-L258 — Parses a string pointer into its file path and line range components, facilitating source code navigation.
-- sliceSpan · function · L262-L277 — Reads a specified range of lines from a source file, allowing for inlined code snippets in query results.
-- inlineSource · function · L280-L287 — Attaches inlined source code to query hits, enhancing the context provided to the user.
-- ask · function · L290-L305 — Processes a query against a code graph, returning structured results based on the query type and context.
-- formatAsk · function · L308-L331 — Formats the results of a query into a markdown context pack for easy readability and presentation.
+- AskResult · interface · L42-L53 — Encapsulates the result of a query, including the query string, mode of operation, and the hits found.
+- tokenize · function · L62-L68 — Transforms a string of text into an array of lowercased subword tokens, filtering out common stop words.
+- counts · function · L71-L75 — Creates a frequency count map of tokens, allowing for analysis of term occurrences in a document.
+- firstProse · function · L78-L85 — Extracts the first meaningful prose line from a body of text, ignoring headings and blank lines.
+- Corpus · interface · L87-L90 — Defines the structure for a corpus containing concepts and a graph, used for processing queries.
+- loadCorpus · function · L92-L117 — Loads a corpus from a specified directory, extracting concepts and building a graph for query processing.
+- score · function · L120-L127 — Calculates a score for a document's token counts against a query, facilitating relevance ranking.
+- findSubject · function · L137-L155 — Identifies the most relevant symbols in the graph that match the query, prioritizing exact name matches.
+- structural · function · L157-L198 — Processes a structural query to find and return relevant callers or callees from the graph based on the query.
+- lexical · function · L202-L246 — Ranks concepts and symbols based on lexical matching with the query, returning the most relevant results.
+- AskOptions · interface · L248-L254 — Defines options for customizing the behavior of the ask function, such as context directory and result limits.
+- parseSpan · function · L258-L262 — Parses a string pointer into its file path and line range components, facilitating source code navigation.
+- sliceSpan · function · L266-L281 — Reads a specified range of lines from a source file, allowing for inlined code snippets in query results.
+- inlineSource · function · L284-L291 — Attaches inlined source code to query hits, enhancing the context provided to the user.
+- hitFiles · function · L295-L304 — function hitFiles(hits: AskHit[]): Set<string>
+- baselineFor · function · L309-L324 — function baselineFor(hits: AskHit[], graph: GraphV1 | null): AskResult["saved"] | undefined
+- ask · function · L327-L347 — Processes a query against a code graph, returning structured results based on the query type and context.
+- toTokens · function · L350-L352 — function toTokens(chars: number): number
+- formatAsk · function · L355-L379 — Formats the results of a query into a markdown context pack for easy readability and presentation.
+- savingsFooter · function · L384-L396 — function savingsFooter(r: AskResult, body: string): string
diff --git a/graft/src/claude/format.md b/graft/src/claude/format.md
new file mode 100644
index 00000000..030b3e99
--- /dev/null
+++ b/graft/src/claude/format.md
@@ -0,0 +1,15 @@
+# src/claude/format.ts
+
+- enrichedSegment · function · L13-L17 — function enrichedSegment(s: Stats): string | null
+- freshnessSegment · function · L19-L24 — function freshnessSegment(s: Stats): string
+- renderStatusline · function · L26-L48 — function renderStatusline( stats: Stats | null, session: SessionState | null, ctx: { ctxPct: number | null }, ): string[]
+- nodeIdsInFile · function · L50-L56 — function nodeIdsInFile(w: GraphV1, filePath: string): Set<string>
+- incomingEdges · function · L58-L62 — function incomingEdges(w: GraphV1, filePath: string): EdgeV1[]
+- formatBlastRadius · function · L64-L75 — function formatBlastRadius(w: GraphV1, filePath: string, cap = 8): string | null
+- AskJson · interface · L77-L82 — interface AskJson
+- tokensOf · function · L84-L84 — function tokensOf(chars: number): number
+- retrievalBody · function · L89-L99 — function retrievalBody(hits: AskJson['hits']): string
+- retrievalTokensSaved · function · L102-L108 — function retrievalTokensSaved(ask: AskJson, cap = 5): number
+- formatRetrieval · function · L110-L123 — function formatRetrieval(ask: AskJson, cap = 5): string | null
+- formatOrientation · function · L125-L127 — function formatOrientation(indexMd: string, budgetBytes = 1500): string
+- renderSubagent · function · L129-L133 — function renderSubagent(agentName: string, session: SessionState | null): string
diff --git a/graft/src/claude/hooks.md b/graft/src/claude/hooks.md
new file mode 100644
index 00000000..3a3b783f
--- /dev/null
+++ b/graft/src/claude/hooks.md
@@ -0,0 +1,11 @@
+# src/claude/hooks.ts
+
+- readStdin · function · L8-L12 — function readStdin(): any
+- safeReadFd0 · function · L13-L13 — function safeReadFd0(): string
+- projectDir · function · L15-L17 — function projectDir(input: any): string
+- underGraft · function · L18-L21 — function underGraft(dir: string, file: string): boolean
+- graftCli · function · L24-L27 — function graftCli(dir: string): { cmd: string; pre: string[] }
+- graftJson · function · L28-L42 — function graftJson(dir: string, args: string[]): any | null
+- checkStaleCount · function · L43-L47 — function checkStaleCount(dir: string): number
+- emit · function · L48-L50 — function emit(eventName: string, additionalContext: string): void
+- main · function · L52-L110 — async function main(event: string): Promise<void>
diff --git a/graft/src/claude/state.md b/graft/src/claude/state.md
new file mode 100644
index 00000000..8ee9e904
--- /dev/null
+++ b/graft/src/claude/state.md
@@ -0,0 +1,19 @@
+# src/claude/state.ts
+
+- Stats · interface · L4-L9 — interface Stats
+- SessionState · interface · L10-L16 — interface SessionState
+- emptyStats · function · L20-L23 — function emptyStats(): Stats
+- emptySession · function · L24-L26 — function emptySession(): SessionState
+- cacheDir · function · L28-L28 — function cacheDir(projectDir: string): string
+- statsPath · function · L29-L29 — function statsPath(d: string): string
+- sessionPath · function · L30-L30 — function sessionPath(d: string, id: string): string
+- lockPath · function · L31-L31 — function lockPath(d: string): string
+- readJson · function · L33-L35 — function readJson<T>(p: string): T | null
+- writeJsonAtomic · function · L36-L41 — function writeJsonAtomic(p: string, value: unknown): void
+- readStats · function · L43-L43 — function readStats(d: string): Stats | null
+- writeStats · function · L44-L44 — function writeStats(d: string, s: Stats): void
+- patchStats · function · L47-L51 — function patchStats(d: string, patch: Partial<Stats>): Stats
+- readSession · function · L52-L54 — function readSession(d: string, id: string): SessionState
+- writeSession · function · L55-L57 — function writeSession(d: string, id: string, s: SessionState): void
+- acquireLock · function · L59-L75 — function acquireLock(d: string): boolean
+- releaseLock · function · L76-L76 — function releaseLock(d: string): void
diff --git a/graft/src/claude/stats.md b/graft/src/claude/stats.md
new file mode 100644
index 00000000..4fb546f6
--- /dev/null
+++ b/graft/src/claude/stats.md
@@ -0,0 +1,4 @@
+# src/claude/stats.ts
+
+- readWiring · function · L6-L10 — function readWiring(projectDir: string): GraphV1 | null
+- computeStats · function · L12-L25 — function computeStats( w: GraphV1, ): Pick<Stats, 'nodeCount' | 'edgeCount' | 'languages' | 'totalCount' | 'readyCount'>
diff --git a/graft/src/claude/statusline.md b/graft/src/claude/statusline.md
new file mode 100644
index 00000000..8163bac4
--- /dev/null
+++ b/graft/src/claude/statusline.md
@@ -0,0 +1,4 @@
+# src/claude/statusline.ts
+
+- resolveStats · function · L14-L20 — function resolveStats(dir: string): Stats | null
+- main · function · L22-L33 — function main(): void
diff --git a/graft/src/claude/sync-run.md b/graft/src/claude/sync-run.md
new file mode 100644
index 00000000..5f04883d
--- /dev/null
+++ b/graft/src/claude/sync-run.md
@@ -0,0 +1,5 @@
+# src/claude/sync-run.ts
+
+- realBuild · function · L8-L11 — function realBuild(dir: string): void
+- runSync · function · L13-L27 — function runSync(dir: string, build: (d: string) => void = realBuild): void
+- main · function · L29-L32 — function main(): void
diff --git a/graft/src/graph/extract.md b/graft/src/graph/extract.md
index 8c6be021..98ada92f 100644
--- a/graft/src/graph/extract.md
+++ b/graft/src/graph/extract.md
@@ -8,12 +8,12 @@ This module extracts structured data from source files into a normalized format
- 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.
+- extractFile · function · L94-L128 — Extracts nodes and edges from a source file based on its syntax tree.
+- walk · function · L130-L182 — Recursively traverses the syntax tree to collect definitions and their relationships.
+- describe · function · L185-L214 — Identifies and describes definitions in the syntax tree based on their node types.
+- heritageEdges · function · L216-L243 — Generates edges representing class inheritance and implementation relationships.
+- calleeName · function · L245-L261 — Extracts the name of a function or method being called in the syntax tree.
+- isImport · function · L263-L265 — Determines if a node represents an import statement in the syntax tree.
+- importSpecifier · function · L267-L278 — Extracts the module name from an import statement in the syntax tree.
+- clean · function · L281-L288 — Cleans and normalizes a function signature by removing unnecessary whitespace and punctuation.
+- tsExported · function · L291-L298 — Checks if a node is exported based on its ancestor nodes in the syntax tree.
diff --git a/graft/src/graph/types.md b/graft/src/graph/types.md
index aafe8465..bced4b25 100644
--- a/graft/src/graph/types.md
+++ b/graft/src/graph/types.md
@@ -6,7 +6,7 @@ Defines the schema for a code graph, outlining nodes and edges for code structur
- 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.
+- NodeV1 · interface · L37-L57 — Represents a node in the graph with its identity, location, and meaning, essential for graph construction.
+- Relation · type · L59-L65 — Defines the types of relationships between nodes in the graph, clarifying how symbols interact.
+- EdgeV1 · interface · L67-L72 — Describes the edges connecting nodes in the graph, detailing the source, target, and relationship type.
+- GraphV1 · interface · L74-L83 — Encapsulates the entire graph structure, including metadata and collections of nodes and edges.
diff --git a/graft/test/claude-format.test.md b/graft/test/claude-format.test.md
new file mode 100644
index 00000000..be26263e
--- /dev/null
+++ b/graft/test/claude-format.test.md
@@ -0,0 +1,3 @@
+# test/claude-format.test.ts
+
+- strip · function · L6-L6 — strip = (s: string)
diff --git a/graft/test/claude-hooks.test.md b/graft/test/claude-hooks.test.md
new file mode 100644
index 00000000..939c280a
--- /dev/null
+++ b/graft/test/claude-hooks.test.md
@@ -0,0 +1,4 @@
+# test/claude-hooks.test.ts
+
+- runWithStdin · function · L38-L41 — async function runWithStdin(text: string, fn: () => Promise<void>): Promise<void>
+- fakeBuild · function · L49-L52 — fakeBuild = (dir: string)
diff --git a/graft/test/claude-state.test.md b/graft/test/claude-state.test.md
new file mode 100644
index 00000000..ddce7768
--- /dev/null
+++ b/graft/test/claude-state.test.md
@@ -0,0 +1,3 @@
+# test/claude-state.test.ts
+
+- fresh · function · L11-L11 — function fresh(): string
diff --git a/graft/test/claude-stats.test.md b/graft/test/claude-stats.test.md
new file mode 100644
index 00000000..d89e0a0a
--- /dev/null
+++ b/graft/test/claude-stats.test.md
@@ -0,0 +1,3 @@
+# test/claude-stats.test.ts
+
+_No extracted symbols in this file._
diff --git a/graft/test/claude-statusline.test.md b/graft/test/claude-statusline.test.md
new file mode 100644
index 00000000..4d39e3d6
--- /dev/null
+++ b/graft/test/claude-statusline.test.md
@@ -0,0 +1,4 @@
+# test/claude-statusline.test.ts
+
+- repo · function · L9-L9 — function repo(): string
+- writeWiring · function · L10-L13 — function writeWiring(dir: string, obj: unknown): void