Skip to content

wada-qualia/llmtree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

CLI tool for preparing project data for LLM context

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages