Locify is a library designed to help LLM-based agents navigate and analyze large codebases efficiently. It leverages parsing techniques to provide insights into code structure and relationships.
On a Git-based repository, Locify offers:
-
Codebase Skeleton Mapping:
FullMapStrategy
: Generates a skeleton map of the entire codebase or a directory only.RepoMapStrategy
: Focuses on the reference relationships, using graph theory to rank and analyze code elements.
-
Tree-sitter Integration: Utilizes Tree-sitter for precise parsing of source code, supporting multiple programming languages.
-
Command-Line Interface: Provides a user-friendly CLI for executing different mapping strategies.
Locify can be installed via pip:
pip install locify
Locify offers a CLI to execute mapping strategies:
python -m locify.cli <strategy> get_map_with_token_count [options]
<strategy>
: Choose betweenfullmap
andrepomap
.[options]
: Additional options for customizing the mapping process, e.g. file's depth, or specific directories only.
-
To generate a full map of a codebase:
python -m locify.cli fullmap get_map_with_token_count --root /path/to/gitrepo
-
To generate a full map of the
locify
directory only, with maximum depth of 3:python -m locify.cli fullmap get_map_with_token_count 3 locify
locify/
: Main source code directory.cli.py
: Command-line interface implementation.indexing/
: Contains strategies for code mapping.full_map/
: Implementation ofFullMapStrategy
.repo_map/
: Implementation ofRepoMapStrategy
.
tree_sitter/
: Tree-sitter integration for parsing.parser.py
: Tree-sitter parser implementation.queries/
: Schema query files for different languages.
utils/
: Utility functions and classes.
Tests are located in the tests
directory. Run tests using:
poetry run pytest
This project was inspired by the aider's RepoMap implementation.
This project is licensed under the terms of the MIT license. See the LICENSE file for details.