feat(elixir): add Phoenix framework resolver and Elixir import resolution#1229
Open
waseigo wants to merge 9 commits into
Open
feat(elixir): add Phoenix framework resolver and Elixir import resolution#1229waseigo wants to merge 9 commits into
waseigo wants to merge 9 commits into
Conversation
- The Elixir grammar treats ALL constructs as generic `call` nodes — no distinct node types for def/module/import - Uses `visitNode` hook with keyword-set dispatch (DEF_CALLS, MODULE_CALLS, IMPORT_CALLS, SKIP_CALLS) - Supports: def/defp, defguard/defguardp, defdelegate, defmacro/defmacrop, defmodule, defprotocol/defimpl, alias/import/require/use - Multi-clause def merging (same pattern as `erlang.ts`) - Pipe `|>` excluded from call edges (data flow) - `extractFunctionInfo` handles: simple def, guarded def (when), no-parens def, defdelegate - `extractBareCall` for function body call edges - Uses `findChildByType(node, type)` helper — Elixir grammar uses type-identified named children, not field-named children - Also wire `.ex` and `.exs` extensions to `elixir` language, register in WASM grammars and display names
- HEEx grammar built from source (phoenixframework/tree-sitter-heex v0.9.0, ABI 15)
- Vendored WASM at `src/extraction/wasm/tree-sitter-heex.wasm` (33KB)
- HEEx is NOT in tree-sitter-wasms (not on npm) — must be built manually
- Extractor handles: `<.component_name>` tags, `<PascalCase>` components → `component` nodes
- `{expr}` expressions and `<%= directive %>` tags → call edges
- `.heex` extension wired to `heex` language in grammars.ts EXTENSION_MAP, WASM_GRAMMAR_FILES
- Implements `AgentTarget` interface modeled on `codex.ts` (both use TOML MCP config) - Supports global `~/.grok/config.toml` with `$GROK_HOME` override, and local `.grok/config.toml` - Uses existing `toml.ts` helpers: `buildTomlTable`, `upsertTomlTable`, `removeTomlTable` - Cross-platform detection: `command -v` (POSIX), `where` (Windows), file existence fallback - No permissions concept (like Codex target)
- 12 Elixir extraction tests: defmodule, def/defp, alias imports, calls, pipe skip, defguard, defdelegate, defstruct skip, defprotocol, defimpl, defmacro
- 4 HEEx extraction tests: <.modal> component, <MyComponent> component, {expr} calls, <%= directive %> calls
- All use `extractFromSource()` in-memory helper (standard pattern for all languages)
- Unique file paths per test to avoid multi-clause merge state interference
- README: Elixir in feature bullet (30+ Languages), Supported Languages table row, Grok Build in Supported Agents list (badge + subtitle + installer + quick start + restart + footer) - CHANGELOG: Entries under `## [Unreleased]` for Elixir language support and Grok Build agent support
- 3 repos: elixir-lang/gen_stage (small, 23 files), phoenixframework/phoenix (medium, 177 files), plausible/analytics (large, 1,186 files) - Each repo has a cross-file architecture question
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Elixir
alias/import/require/usedirectives now resolve to the actual files they pull in, so cross-module callers and impact queries work on real Elixir codebases instead of stopping at the import site.Phoenix router files (
router.ex) are now parsed: route definitions link to their controller actions, so "what URL pattern calls this controller method" shows up in callers and flow traces.Elixir standard library and OTP modules (Kernel, Enum, Map, GenServer, and friends) are now marked as external, so they don't clutter the graph or inflate impact results.