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
Metadata
Release files for llmtree 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| llmtree-1.0.1.tar.gz | 11.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llmtree-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.4 kB
Release files / llmtree-1.0.1.tar.gz
| Download URL | llmtree-1.0.1.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5fd3d795ae0c2345fa996d8cc608443028f232141b5afbe297616a3170d21d71
|
|
BLAKE2b-256 checksum How to use checksums |
dd3a5cc32db0b76bb18c560002f67459189baa47b1b4a4d7b7d1f4ce8fa3e9d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.22
|
Release files / llmtree-1.0.1-py3-none-any.whl
| Download URL | llmtree-1.0.1-py3-none-any.whl |
|---|---|
| Size | 10.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
79bb541028003f0ba3a4719ce88439078ff5ccf4f3316a25ceac7fd182604251
|
|
BLAKE2b-256 checksum How to use checksums |
33c50436717332f50bb3f23813a4e4cf1fdcb7ebbdc573e678169d95e9cadd6b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.22
|