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.
pip install -e .Or for global installation:
pip install llmtree# Process the current directory
llmtree .
# Process a specific folder
llmtree /path/to/project
# Use a specific profile
llmtree . -p python
# Configure profiles
llmtree --config- default – a universal profile suitable for most projects
- python – optimized for Python projects
- Create custom profiles via an interactive menu
When running llmtree .:
- Enter – generates the
4llm.mdfile - Space – opens the settings menu
- File inclusion patterns
- Exclusion patterns
- Include tree structure
- Max file size
- Line numbering
- Custom header and footer
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": ""
}
}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/*llmtree --config
# Create a profile named "docs"
# Include patterns: *.md,*.rst,*.txt
# Tree: Yes
# Add line numbers: Nousage: 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
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!")
# My ProjectMIT License