CLI tool for preparing project data for LLM context
Project description
LLM Tree
Docs: 🇺🇸 English | 🇷🇺 Русский | 🇩🇪 Deutsch | 🇯🇵 日本語 | 🇨🇳 中文
A CLI tool for preparing project data to be used in LLM context. It generates a markdown file with the project structure and source file contents.
Installation
pip install -e .
Or for global installation:
pip install llmtree
Quick Start
# Process the current directory
llmtree .
# Process a specific folder
llmtree /path/to/project
# Use a specific profile
llmtree . -p python
# Configure profiles
llmtree --config
Key Features
Profiles
- default – a universal profile suitable for most projects
- python – optimized for Python projects
- Create custom profiles via an interactive menu
Interactive Usage
When running llmtree .:
- Enter – generates the
4llm.mdfile - Space – opens the settings menu
Profile Settings
- File inclusion patterns
- Exclusion patterns
- Include tree structure
- Max file size
- Line numbering
- Custom header and footer
Configuration Structure
Settings are stored in ~/.llmtree/config.json:
{
"default": {
"name": "default",
"include_patterns": ["*.py", "*.js", "*.md"],
"exclude_patterns": ["node_modules/*", ".git/*"],
"include_tree": true,
"max_file_size": 100000,
"encoding": "utf-8",
"add_line_numbers": false,
"include_hidden": false,
"tree_depth": 3,
"custom_header": "",
"custom_footer": ""
}
}
Usage Examples
Creating a Profile for Frontend
llmtree --config
# Select "Create new profile"
# Name: frontend
# Include patterns: *.js,*.jsx,*.ts,*.tsx,*.vue,*.css,*.scss,package.json
# Exclude patterns: node_modules/*,dist/*,build/*
Profile for Documentation
llmtree --config
# Create a profile named "docs"
# Include patterns: *.md,*.rst,*.txt
# Tree: Yes
# Add line numbers: No
Command Line
usage: llmtree [-h] [-p PROFILE] [-o OUTPUT] [--config] [path]
positional arguments:
path Target directory path (default: current directory)
optional arguments:
-h, --help Show this help message and exit
-p, --profile PROFILE Profile to use (default: default)
-o, --output OUTPUT Output file name (default: 4llm.md)
--config Run interactive configuration
Output Format
The generated 4llm.md includes:
- Custom header (if specified)
- Project structure (tree)
- Source file contents with syntax highlighting
- Custom footer (if specified)
Example output:
## Project Structure
. ├── src/ │ ├── main.py │ └── utils.py ├── tests/ │ └── test_main.py └── README.md
## Source Files
### src/main.py
```python
def main():
print("Hello, World!")
README.md
# My Project
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llmtree-1.0.1.tar.gz.
File metadata
- Download URL: llmtree-1.0.1.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fd3d795ae0c2345fa996d8cc608443028f232141b5afbe297616a3170d21d71
|
|
| MD5 |
320d02533e5a340871bc352775ed8947
|
|
| BLAKE2b-256 |
dd3a5cc32db0b76bb18c560002f67459189baa47b1b4a4d7b7d1f4ce8fa3e9d8
|
File details
Details for the file llmtree-1.0.1-py3-none-any.whl.
File metadata
- Download URL: llmtree-1.0.1-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79bb541028003f0ba3a4719ce88439078ff5ccf4f3316a25ceac7fd182604251
|
|
| MD5 |
c8ee95cadae8e3e472e0576721b7e753
|
|
| BLAKE2b-256 |
33c50436717332f50bb3f23813a4e4cf1fdcb7ebbdc573e678169d95e9cadd6b
|