Skip to main content

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.md file
  • 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:

  1. Custom header (if specified)
  2. Project structure (tree)
  3. Source file contents with syntax highlighting
  4. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llmtree-1.0.0.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llmtree-1.0.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file llmtree-1.0.0.tar.gz.

File metadata

  • Download URL: llmtree-1.0.0.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for llmtree-1.0.0.tar.gz
Algorithm Hash digest
SHA256 fdc2338ffb26af9add4341a77e24f8e6b9c4ab6ad45cb57403ab09cc58998059
MD5 12fe8ecb3d9719834f8742e8b278afc9
BLAKE2b-256 ed693823bdc804293a8ca25806b1ef88715dc46f2d4a13badf8747f033a70ebb

See more details on using hashes here.

File details

Details for the file llmtree-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: llmtree-1.0.0-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

Hashes for llmtree-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c0b1f783bf18736c262deb1633e0a414ba6a420d8119fd4a046ec06ca66882ee
MD5 e43b2159c19c7f8f3f6453d673f021f4
BLAKE2b-256 1a007ac28c24094ca6a97b8bb6afd02d342fc80ef1b35581e2000d0ed9593a5d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page