Skip to content

feat: Code-aware tree indexer — TypeScript/Python AST extraction #134

@VictorGjn

Description

@VictorGjn

Problem

The tree indexer only parses markdown headings. For a "context engineering IDE", not understanding code is a gaping hole. The existing codeIndexer.ts does basic regex but misses: modules, exports, classes, function signatures, type definitions, and import relationships.

Success criteria

A .ts or .py file indexed produces a hierarchical TreeNode with: modules → exports → classes → methods/functions → parameters + types. Import/export relations extracted accurately. False positive calls edges reduced by 5x.

Non-goals

No Tree-sitter/full AST. Regex + heuristics but much more precise. Optional LLM summary in pass 2.

Implementation

  1. Enrich src/utils/codeIndexer.ts: TS/JS parser (import, export, class, function, interface, type, const), Python parser (import, from, class, def, decorators)
  2. Enrich src/graph/extractors/code.ts: extract real imports, filter false positives via scope analysis
  3. Extend COMMON_IDENTIFIERS with top 50 JS/TS built-in names

Test plan

Unit test: index 5 known files from the repo itself. Measure calls edge count before/after (target: < 200 vs ~1000+).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions