Skip to content

feat!: granular node types, GitNexus comparison, PreToolUse hooks#14

Merged
carlos-alm merged 1 commit intomainfrom
feat/granular-node-types
Feb 22, 2026
Merged

feat!: granular node types, GitNexus comparison, PreToolUse hooks#14
carlos-alm merged 1 commit intomainfrom
feat/granular-node-types

Conversation

@carlos-alm
Copy link
Contributor

Summary

  • Granular node types: Go structs to struct, Rust structs/enums/traits to struct/enum/trait, Java enums to enum, C# structs/records/enums to struct/record/enum, PHP traits/enums to trait/enum, Ruby modules to module — in both WASM and native Rust extractors
  • Query layer: Added SYMBOL_KINDS constant, extended kindIcon(), updated all kind IN SQL filters across queries, builder, export, embedder, cycles, watcher, and MCP
  • README: Added GitNexus column to comparison table, updated --kind flag docs
  • ROADMAP: Added Phase 2.5 Multi-Repo MCP
  • PreToolUse hooks: Read/Grep context enrichment via codegraph deps
  • CLAUDE.md: Documented node kinds design decision

Test plan

  • npm run lint — clean (46 files)
  • npm test — 296 passed, 0 failures
  • Manual: build a project with Go/Rust/Java code, verify codegraph query <struct> returns kind: struct

BREAKING CHANGE: Node kinds changed for structs, enums, traits, records, and modules. Users must rebuild with codegraph build --no-incremental.

…, multi-repo MCP roadmap

- Node types: Go struct→struct, Rust struct/enum/trait, Java enum,
  C# struct/record/enum, PHP trait/enum, Ruby module — in both WASM
  and native Rust extractors
- Add SYMBOL_KINDS constant and update all kind IN filters across
  queries, builder, export, embedder, cycles, watcher, and MCP
- Add GitNexus column to README comparison table
- Add Phase 2.5 Multi-Repo MCP to ROADMAP
- Add PreToolUse hooks for Read/Grep context enrichment via codegraph deps
- Update CLAUDE.md and README with new node kind documentation

BREAKING CHANGE: Node kinds changed for structs, enums, traits, records,
and modules. Rebuild with `codegraph build --no-incremental`.
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 22, 2026

Greptile Summary

This PR introduces granular node type classification across all language parsers, replacing generic class/interface mappings with language-native kinds (struct, enum, trait, record, module). Both native Rust and WASM extractors updated consistently for Go, Rust, Java, C#, PHP, and Ruby. All SQL query filters across cycles.js, export.js, mcp.js, and watcher.js extended to include the new node kinds.

Key changes:

  • Native Rust extractors (6 files) and WASM JS extractors (parser.js) updated to use granular kinds
  • Query layer comprehensively updated with new kind IN filters across all modules
  • All parser tests updated with new expectations (296 tests passing)
  • PreToolUse hooks added for Read/Grep context enrichment via codegraph deps
  • Documentation updated: README comparison table includes GitNexus, --kind flag docs updated, CLAUDE.md documents design decision, ROADMAP adds Phase 2.5

Issue found:

  • kindIcon() function in queries.js missing cases for new kinds (struct, enum, trait, record, module) — they will display as - instead of meaningful icons

Confidence Score: 4/5

  • Safe to merge with one minor display issue in kindIcon()
  • Comprehensive implementation with consistent changes across native/WASM extractors and all query layers. Tests pass (296/296). The missing kindIcon() cases is a minor display issue that doesn't affect functionality — new node kinds will render with default - icon instead of specific ones. All breaking changes properly documented.
  • Pay attention to src/queries.js — missing icon mappings for new node kinds

Important Files Changed

Filename Overview
crates/codegraph-core/src/extractors/rust_lang.rs Updated Rust extractors: structs → struct, enums → enum, traits → trait
crates/codegraph-core/src/extractors/csharp.rs Updated C# extractors: structs → struct, records → record, enums → enum
src/parser.js Updated WASM extractors to match native Rust changes for all language-specific node kinds
src/queries.js kindIcon() function missing cases for new node kinds (struct, enum, trait, record, module)
.claude/hooks/enrich-context.sh New PreToolUse hook that enriches Read/Grep with codegraph dependency context
README.md Added GitNexus to comparison table, updated --kind flag docs with new node kinds

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Language Source Code] --> B{Parser Engine}
    B -->|Native Rust| C[Rust Extractors]
    B -->|WASM Fallback| D[JS Extractors]
    
    C --> E[go.rs<br/>struct → struct]
    C --> F[rust_lang.rs<br/>struct/enum/trait]
    C --> G[java.rs<br/>enum → enum]
    C --> H[csharp.rs<br/>struct/record/enum]
    C --> I[php.rs<br/>trait/enum]
    C --> J[ruby.rs<br/>module → module]
    
    D --> K[extractGoSymbols<br/>struct → struct]
    D --> L[extractRustSymbols<br/>struct/enum/trait]
    D --> M[extractJavaSymbols<br/>enum → enum]
    D --> N[extractCSharpSymbols<br/>struct/record/enum]
    D --> O[extractPHPSymbols<br/>trait/enum]
    D --> P[extractRubySymbols<br/>module → module]
    
    E & F & G & H & I & J --> Q[SQLite DB<br/>nodes table]
    K & L & M & N & O & P --> Q
    
    Q --> R[Query Layer]
    R --> S[cycles.js<br/>kind IN filter]
    R --> T[export.js<br/>DOT/Mermaid]
    R --> U[mcp.js<br/>list_functions]
    R --> V[watcher.js<br/>incremental]
    R --> W[queries.js<br/>kindIcon ⚠️]
    
    W -.missing icons.-> X[struct/enum/trait<br/>record/module]
Loading

Last reviewed commit: 72535fb

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

22 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 22, 2026

Additional Comments (1)

src/queries.js
kindIcon() is missing cases for the new node kinds: struct, enum, trait, record, module. They will all fall through to the default - icon.

function kindIcon(kind) {
  switch (kind) {
    case 'function':
      return 'f';
    case 'class':
      return '*';
    case 'method':
      return 'o';
    case 'file':
      return '#';
    case 'interface':
      return 'I';
    case 'type':
      return 'T';
    case 'struct':
      return 'S';
    case 'enum':
      return 'E';
    case 'trait':
      return 'R';
    case 'record':
      return 'C';
    case 'module':
      return 'M';
    default:
      return '-';
  }
}

@carlos-alm carlos-alm merged commit 72535fb into main Feb 22, 2026
18 checks passed
@carlos-alm carlos-alm deleted the feat/granular-node-types branch February 22, 2026 07:31
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