Skip to content

feat(graph): index Bash scripts with the bundled grammar - #354

Closed
cookerpapa wants to merge 1 commit into
trailhq:mainfrom
cookerpapa:feat/bash-language
Closed

cookerpapa wants to merge 1 commit into
trailhq:mainfrom
cookerpapa:feat/bash-language

Conversation

@cookerpapa

Copy link
Copy Markdown
Contributor

Closes #353.

Bash's WASM grammar already ships with Graft, but the generic language registry does not include it. As a result, shell scripts are skipped during graph builds.

This registers Bash for .sh and .bash, allowing the existing generic extractor to index function symbols without adding a dependency. It also documents the supported scope and adds regression coverage for grammar loading, extension validation, both Bash function declaration forms, graph construction, and the graph sync check.

Validation on Node 24.19.0:

  • Both new regression tests fail before the registry change and pass after it.
  • 33 tests pass across graph-bash, generic-extract, graph-languages, graph-cross-language, and the Node 24 WASM regression suite.
  • All build stages pass: the main and viewer TypeScript builds, followed by scripts/build-viewer.mjs.
  • A compiled CLI smoke test indexes two Bash files and three functions without an unsupported-parser warning.

This covers extension-based function indexing. Bash call edges and extensionless shebang detection remain outside this change.

@trailhq-graft

trailhq-graft Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

🌱 graft blast radius

1 area changed → 6 areas can be affected. 15 dependent symbols, depth 2.
Tag: @anirudhkumar-nanonets — 5 of 7 areas · @shhdwi — 5 of 7 areas · @Frankie-Xu — Context Building

flowchart TB
  A0(("Dependency Graph<br/>8 symbols"))
  A1(("Build Analysis<br/>2 symbols"))
  A2(("CLI Engine<br/>2 symbols"))
  A3(("Context Building<br/>1 symbol"))
  A4(("LSP Enrichment<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
Dependency Graph 8 src/graph/build.ts:L1-L411 build.ts — imports, depth 1 Generic Graph
Build Analysis 2 src/app/brain-build.ts:L1-L428 brain-build.ts — imports, depth 2 Generic Graph
CLI Engine 2 src/cli.ts:L1-L1407 cli.ts — imports, depth 2 Generic Graph
Context Building 1 src/context/build.ts:L1-L468 build.ts — imports, depth 2 Generic Graph
LSP Enrichment 1 src/graph/lsp/enrich.ts:L1-L141 enrich.ts — imports, depth 1 Generic Graph
MCP Tools 1 src/mcp/tools.ts:L1-L330 tools.ts — imports, depth 2 Generic Graph
Who knows this code — 3 people across 7 areas
Area Who knows it
Generic Graph · changed @shhdwi — 7 commits, last 29d ago
Dependency Graph · affected @anirudhkumar-nanonets — 24 commits, last 15d ago · @shhdwi — 21 commits, last 29d ago
Build Analysis · affected @anirudhkumar-nanonets — 9 commits, last today
CLI Engine · affected @anirudhkumar-nanonets — 41 commits, last yesterday · @shhdwi — 24 commits, last 29d ago
Context Building · affected @anirudhkumar-nanonets — 4 commits, last 22d ago · @Frankie-Xu — 2 commits, last 11d ago
LSP Enrichment · affected @shhdwi — 2 commits, last 30d ago
MCP Tools · affected @shhdwi — 14 commits, last 30d ago · @anirudhkumar-nanonets — 7 commits, last 9d 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 15 dependent symbols, grouped by area

Dependency Graph — 8 symbols in 8 files

  • src/graph/build.ts:L1-L411 — build.ts (imports, depth 1)
    21: import { extractGeneric, genericLangOf, warmGenericGrammars } from "./generic.js";
  • src/graph/check.ts:L1-L221 — check.ts (imports, depth 1)
    24: import { extractGeneric, genericLangOf, warmGenericGrammars } from "./generic.js";
  • src/graph/container.ts:L1-L209 — container.ts (imports, depth 1)
    25: import { loadWasmLanguage, parseWasm, type TsNode } from "./generic.js";
  • src/graph/resolve.ts:L1-L658 — resolve.ts (imports, depth 1)
    19: import { genericLangOf } from "./generic.js";
  • src/graph/source-files.ts:L1-L121 — source-files.ts (imports, depth 1)
    15: import { genericLangOf, genericExtensions } from "./generic.js";
  • src/graph/fingerprint.ts:L1-L197 — fingerprint.ts (imports, depth 2)
  • src/graph/refresh.ts:L1-L274 — refresh.ts (imports, depth 2)
  • src/graph/workspace.ts:L1-L725 — workspace.ts (imports, depth 2)

Build Analysis — 2 symbols in 2 files

  • src/app/brain-build.ts:L1-L428 — brain-build.ts (imports, depth 2)
  • src/app/review.ts:L1-L174 — review.ts (imports, depth 2)

CLI Engine — 2 symbols in 2 files

  • src/cli.ts:L1-L1407 — cli.ts (imports, depth 2)
  • src/engine.ts:L1-L161 — engine.ts (imports, depth 2)

Context Building — 1 symbol in 1 file

  • src/context/build.ts:L1-L468 — build.ts (imports, depth 2)

LSP Enrichment — 1 symbol in 1 file

  • src/graph/lsp/enrich.ts:L1-L141 — enrich.ts (imports, depth 1)
    17: import { genericLangOf } from "../generic.js";

MCP Tools — 1 symbol in 1 file

  • src/mcp/tools.ts:L1-L330 — tools.ts (imports, depth 2)
Test signal per changed area — 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.

  • – Generic Graph — 1 test file changed here: test/graph-bash.test.ts
39 test suites also reference this code

39 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-only-dir.test.ts
  • test/context.test.ts
  • test/covers.test.ts
  • test/generic-extract.test.ts
  • test/generic-node24-probe.ts
  • test/graph-cross-language.test.ts
  • test/graph-enrich-pending.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
  • …19 more

⚠️ 1 changed file not in the graph (README.md) — no parser claims the extension, or the index predates the file.

graft blast · origin/main...HEAD · depth 2 · 3 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 11, 2026
shhdwi pushed a commit that referenced this pull request Nov 9, 2026
Re-landed from #354 with the conflicts against main resolved; the contributor's fork couldn't take the merge commit.

Co-Authored-By: Shrish Dwivedi <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
shhdwi pushed a commit that referenced this pull request Nov 9, 2026
Re-landed from #354 with the conflicts against main resolved; the contributor's fork couldn't take the merge commit.

Co-Authored-By: Shrish Dwivedi <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
shhdwi pushed a commit that referenced this pull request Nov 9, 2026
Re-landed from #354 with the conflicts against main resolved; the contributor's fork couldn't take the merge commit.

Co-Authored-By: Shrish Dwivedi <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@shhdwi shhdwi closed this in #793 Nov 9, 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.

Register bash: tree-sitter-bash.wasm already ships but has no entry in the language table

1 participant