Skip to content

feat(graph): add Gleam support - #408

Open
nichecode wants to merge 1 commit into
trailhq:mainfrom
agenticera:feat/gleam-support
Open

nichecode wants to merge 1 commit into
trailhq:mainfrom
agenticera:feat/gleam-support

Conversation

@nichecode

Copy link
Copy Markdown

Summary

Adds Gleam to Graft's generic tree-sitter graph tier.

  • Indexes .gleam files in context and structural graph builds
  • Extracts functions, constants, types, constructors, calls, and type references
  • Resolves in-repo imports through Gleam module paths
  • Avoids false call edges for stdlib and dependency symbols
  • Updates the supported-language count and adds regression coverage

Validation

  • npm run build
  • npm test
  • Built the current gleam-lang/gleam repository: 227 Gleam files, 936 Gleam symbols, and 388 Gleam-related edges extracted without parser errors

@trailhq-graft

trailhq-graft Bot commented Sep 16, 2026

Copy link
Copy Markdown

🌱 graft blast radius

2 areas changed → 6 areas can be affected. 14 dependent symbols, depth 2.
Tests: 1 area updated its tests.
Tag: @anirudhkumar-nanonets — 7 of 8 areas · @shhdwi — 5 of 8 areas · @Frankie-Xu — Context Build, Graph Analysis

flowchart TB
  A0(("Workspace Graph<br/>5 symbols"))
  A1(("CLI Engine<br/>4 symbols"))
  A2(("Pull Request Review<br/>2 symbols"))
  A3(("Context Check<br/>1 symbol"))
  A4(("Claude Hooks<br/>1 symbol"))
  AX(("1 smaller area<br/>1 symbol"))
  classDef reached fill:#D9EDF3,stroke:#3AA7C9,stroke-width:1.5px,color:#0E313C;
  class A0,A1,A2,A3,A4 reached;
  classDef tail fill:#EEF2F3,stroke:#9AA4A9,stroke-width:1px,color:#3A4247;
  class AX tail;
Loading
Can be affected Symbols Nearest hop Reached from
Workspace Graph 5 src/graph/build.ts:L151-L410 buildGraph — calls, depth 1 Context Build, Graph Analysis
CLI Engine 4 src/engine.ts:L1-L161 engine.ts — imports, depth 1 Context Build, Graph Analysis
Pull Request Review 2 src/app/brain-build.ts:L251-L358 readRepository — calls, depth 2 Graph Analysis
Context Check 1 src/context/check.ts:L1-L185 check.ts — imports, depth 1 Context Build
Claude Hooks 1 src/claude/hooks.ts:L1-L463 hooks.ts — imports, depth 2 Context Build
MCP Tools 1 src/mcp/tools.ts:L1-L330 tools.ts — imports, depth 2 Context Build
Who knows this code — 4 people across 8 areas
Area Who knows it
Context Build · changed @anirudhkumar-nanonets — 4 commits, last 27d ago · @Frankie-Xu — 2 commits, last 16d ago
Graph Analysis · changed @shhdwi — 13 commits, last 1mo ago · @Frankie-Xu — 8 commits, last 20d ago
Workspace Graph · affected @anirudhkumar-nanonets — 21 commits, last 20d ago · @shhdwi — 12 commits, last 1mo ago
CLI Engine · affected @anirudhkumar-nanonets — 41 commits, last 6d ago · @shhdwi — 24 commits, last 1mo ago
Pull Request Review · affected @anirudhkumar-nanonets — 9 commits, last 6d ago
Context Check · affected @anirudhkumar-nanonets — 3 commits, last 1mo ago · @qoole — 2 commits, last 2mo ago
Claude Hooks · affected @shhdwi — 10 commits, last 1mo ago · @anirudhkumar-nanonets — 9 commits, last 14d ago
MCP Tools · affected @shhdwi — 14 commits, last 1mo ago · @anirudhkumar-nanonets — 7 commits, last 14d ago

Ownership is git history over each area's own files, weighted towards recent work (120-day half-life). Merge commits and bots are dropped, and you are dropped from your own PR. A name with no @ has no GitHub handle in its commit email — tag them by hand, or add a .mailmap entry. A suggestion from history, not a CODEOWNERS rule.

All 14 dependent symbols, grouped by area

Workspace Graph — 5 symbols in 5 files

  • src/graph/build.ts:L151-L410 — buildGraph (calls, depth 1)
    170: const rawEdges: RawEdge[] = [];
  • src/graph/check.ts:L58-L164 — checkGraph (calls, depth 1)
    123: ? extractGeneric(rel, source, generic.name)
  • src/graph/refresh.ts:L150-L227 — ensureFreshGraph (calls, depth 2)
  • src/graph/workspace-cli.ts:L1-L145 — workspace-cli.ts (imports, depth 2)
  • src/graph/workspace.ts:L630-L655 — federateCheck (calls, depth 2)

CLI Engine — 4 symbols in 2 files

  • src/engine.ts:L1-L161 — engine.ts (imports, depth 1)
    19: import { buildContext, CODE_EXTENSIONS, type BuildProgress, type BuildResult } from "./context/build.js";
  • src/cli.ts:L1-L1407 — cli.ts (imports, depth 2)
    322: .command("build")
  • src/engine.ts:L91-L101 — graph (calls, depth 2)
  • src/engine.ts:L82-L84 — checkGraph (calls, depth 2)

Pull Request Review — 2 symbols in 2 files

  • src/app/brain-build.ts:L251-L358 — readRepository (calls, depth 2)
  • src/app/review.ts:L45-L99 — reviewPullRequest (calls, depth 2)

Context Check — 1 symbol in 1 file

  • src/context/check.ts:L1-L185 — check.ts (imports, depth 1)
    20: import { CODE_EXTENSIONS, listContextFiles } from "./build.js";

Claude Hooks — 1 symbol in 1 file

  • src/claude/hooks.ts:L1-L463 — hooks.ts (imports, depth 2)
    39: /** Headroom left for the hook's own work (read stdin, score, write session, emit)

MCP Tools — 1 symbol in 1 file

  • src/mcp/tools.ts:L1-L330 — tools.ts (imports, depth 2)
    36: const NO_GRAPH = 'no graph found — run `graft build` first';
Test signal per changed area — 1 ✓ · 1 –

Reached = a node under a test path has a resolved edge into the changed symbol. It undercounts anything called indirectly — through a CLI, a spawned process or a dynamic import — so read a low ratio as “look here”, never as a coverage gate.

  • Context Build — 1 test file changed here: test/context.test.ts
  • Graph Analysis — 2 of 8 reached · 1 test file changed here: test/generic-extract.test.ts
    • not reached: enclosingDef, emit, visit, tagsExtract, narrowGleamByKind, resolveGleamImport
35 test suites also reference this code

38 symbols, kept out of the diagram and the table so they cannot crowd out the areas a reviewer has to look at.

  • test/ask-index.test.ts
  • test/ask.test.ts
  • test/container-extract.test.ts
  • test/context-checkpoint.test.ts
  • test/context-only-dir.test.ts
  • test/covers.test.ts
  • test/generic-node24-probe.ts
  • test/graph-cross-language.test.ts
  • test/graph-go.test.ts
  • test/graph-incremental.test.ts
  • test/graph-invariants.test.ts
  • test/graph-java.test.ts
  • test/graph-languages.test.ts
  • test/graph-php.test.ts
  • test/graph-posix-paths.test.ts
  • test/graph-python.test.ts
  • test/graph-r-classes.test.ts
  • test/graph-r-phase3.test.ts
  • test/graph-r-phase4.test.ts
  • test/graph-r-phase5.test.ts
  • …15 more

⚠️ 2 changed files not in the graph (README.md, src/graph/queries/gleam.scm) — no parser claims the extension, or the index predates the file.

graft blast · origin/main...HEAD · depth 2 · 9 changed files

Open the interactive graph → — click an area to see its dependent symbols at file:line.

github-actions Bot added a commit that referenced this pull request Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant