leta - LSP Enabled Tools for Agents
leta is a command-line LSP client for semantic code navigation. It provides fast symbol search, reference finding, call hierarchy analysis, and refactoring operations by leveraging language server protocols across multiple programming languages.
$ leta grep "Handler$" -k class
src/handlers/auth.py:15 [Class] AuthHandler
src/handlers/user.py:22 [Class] UserHandler
src/handlers/admin.py:8 [Class] AdminHandler
$ leta show UserHandler
src/handlers/user.py:22-67
class UserHandler:
def __init__(self, db: Database):
self.db = db
def get_user(self, user_id: int) -> User:
return self.db.query(User).get(user_id)
...
Table of contents
- Installation
- Quick start
- AI agent skill
- Commands
- Symbol formats
- Daemon management
- Workspace management
- Configuration
- Supported languages
- Development
- License
Installation
Using Homebrew (macOS)
Using Cargo
From source
Language servers
Ensure you have language servers installed for your target languages:
# Python
# TypeScript/JavaScript
# Go
# Rust
# Ruby
# C/C++
Quick start
Initialize a workspace before using leta:
Search for symbols:
Show symbol definitions:
Find references:
AI agent skill
leta includes a skill file that teaches AI coding agents (like Claude Code or
OpenCode) how to use leta effectively. The skill instructs agents to prefer
leta show over reading files, leta refs over grepping for usages, etc.
OpenCode
Copy the skill to your OpenCode skills directory:
Then load the skill with /skill leta or configure it to load automatically.
Claude Code
Copy the skill to your Claude Code skills directory:
# Personal (available across all your projects):
# Project-specific (commit to version control):
Commands
grep
Search for symbols by regex pattern. Unlike text search tools, leta grep
searches symbol names semantically—it finds function definitions, class
declarations, method names, etc.
)
)
)
The optional PATH argument filters files by matching a regex against the relative file path. This is simpler and more powerful than glob patterns.
Examples:
# Find all classes ending with "Handler"
# Find functions in Python files only
# Find symbols in a specific directory
# Find symbols in test files
# Search with documentation
# Exclude test files
When to use leta grep vs ripgrep:
- Use
leta grepfor: finding symbol definitions, filtering by kind, getting semantic matches - Use ripgrep for: searching file contents, string literals, comments, multi-word phrases
files
Show source file tree with line counts.
)
)
)
Example output:
src
├── handlers
│ ├── auth.py (2.3KB, 89 lines, 1 class, 5 methods)
│ └── user.py (3.1KB, 112 lines, 2 classes, 8 methods)
├── models
│ └── user.py (1.8KB, 67 lines, 1 class, 4 methods)
└── main.py (845B, 32 lines, 2 functions)
4 files, 8.0KB, 300 lines
show
Print the full definition of a symbol.
)
Examples:
refs
Find all references to a symbol.
)
Examples:
calls
Show call hierarchy for a symbol.
)
)
)
At least one of --from or --to is required. Use both to find a path.
Examples:
# What does main() call?
# What calls validate_email()?
# Find call path from main to save
implementations
Find implementations of an interface or abstract method.
)
Examples:
supertypes / subtypes
Navigate type hierarchies.
)
declaration
Find the declaration of a symbol (useful for languages that separate declaration from definition).
)
rename
Rename a symbol across the entire workspace.
Examples:
mv
Move/rename a file and update all imports.
Supported by: TypeScript, Rust, Python (via basedpyright).
Examples:
Symbol formats
Most commands accept symbols in these formats:
| Format | Description |
|---|---|
SymbolName |
Find symbol by name |
Parent.Symbol |
Qualified name (Class.method, module.function) |
path:Symbol |
Filter by file path pattern |
path:Parent.Symbol |
Combine path filter with qualified name |
path:line:Symbol |
Exact file + line number (for edge cases) |
Examples:
Daemon management
leta runs a background daemon that manages LSP server connections. The daemon starts automatically on first command and persists to make subsequent commands fast.
Workspace management
Workspaces must be explicitly added before using leta:
Configuration
Configuration is stored in ~/.config/leta/config.toml:
[]
= "info"
= 30
= 268435456 # 256MB
= 268435456 # 256MB
[]
= ["/home/user/projects/myapp"]
= ["json", "yaml", "html"]
[]
= 4
= true
[]
= "basedpyright"
View configuration:
Logs are stored in ~/.cache/leta/log/.
Supported languages
| Language | Server | Install |
|---|---|---|
| Python | basedpyright | pip install basedpyright |
| TypeScript/JavaScript | typescript-language-server | npm install -g typescript-language-server typescript |
| Go | gopls | go install golang.org/x/tools/gopls@latest |
| Rust | rust-analyzer | rustup component add rust-analyzer |
| Java | jdtls | brew install jdtls |
| Ruby | ruby-lsp | gem install ruby-lsp |
| C/C++ | clangd | brew install llvm |
| PHP | intelephense | npm install -g intelephense |
| Lua | lua-language-server | brew install lua-language-server |
| OCaml | ocamllsp | opam install ocaml-lsp-server |
| Zig | zls | brew install zls |
Development
# Run unit tests
# Run corpus tests
# Run linter
# Format code
License
MIT