Skip to content

features repository indexing

Bryan edited this page Jun 13, 2026 · 1 revision

Repository indexing

Active contributors: Bryan

Repository indexing is the first step for every Lode workflow. It scans supported source files, creates graph facts, writes them to SQLite, removes stale facts, and resolves cross-file relationships.

Purpose

The feature answers "what code exists here?" by turning files into nodes and edges. It is implemented mainly in src/lode/indexer.py with persistence in src/lode/storage.py.

Directory layout

src/lode/indexer.py # scanners and parsers
src/lode/storage.py # fact persistence
src/lode/model.py   # node and edge records

How it works

  1. index_repo() in src/lode/indexer.py resolves the root path and creates a repository record.
  2. iter_source_files() filters source files and skips generated/cache paths.
  3. parse_file() dispatches to Python, TS/JS, Markdown, or config parsers.
  4. replace_file_index() in src/lode/storage.py replaces file-local facts.
  5. resolve_graph() in src/lode/graph.py adds cross-file resolved edges.

Key source files

File Purpose
src/lode/indexer.py File discovery and parsing.
src/lode/storage.py File-index persistence.
src/lode/model.py Fact dataclasses.
tests/test_lode.py Repository indexing tests.

Entry points for modification

Extend parsing in src/lode/indexer.py and test the result with temporary repositories in tests/test_lode.py. If the new facts affect traversal, add resolver tests in tests/test_graph.py.

Related pages

Clone this wiki locally