Skip to main content

A simple directory tree generator for llm

Project description

llmdirtree

A directory tree generator and codebase context provider designed specifically for enhancing LLM interactions with your code.

Purpose

llmdirtree helps you work more effectively with Large Language Models (LLMs) by:

  • Generating visual directory trees for structural understanding
  • Creating contextual summaries of your codebase that respect privacy settings
  • Optimizing code information for LLM follow-up questions

Installation

pip install llmdirtree

Key Features

Directory Tree Visualization

  • Clean, standardized visualization of project structure
  • Unicode box-drawing characters for optimal parsing
  • Intelligent filtering of non-essential directories

LLM Context Generation

  • AI-powered analysis of your codebase using OpenAI API
  • Security-focused with automatic .gitignore pattern recognition
  • File-by-file summaries optimized for follow-up questions
  • Project overview that captures your codebase's essence

Security and Privacy

  • Respects .gitignore patterns to avoid exposing sensitive information
  • Zero dependencies approach (uses system curl instead of libraries)
  • Efficient token usage for minimal data exposure

Usage Examples

Basic Directory Tree

# Generate a simple directory tree
llmdirtree --root /path/to/project --output project_structure.txt

With LLM Context Generation

# Generate both directory tree AND code context
llmdirtree --root /path/to/project --llm-context --openai-key YOUR_API_KEY

This creates two files:

  • directory_tree.txt - Visual structure
  • llmcontext.txt - AI-generated project overview and file summaries

Additional Options

# Exclude specific directories
llmdirtree --exclude node_modules .git venv dist

# Customize output locations
llmdirtree --output custom_tree.txt --context-output custom_context.txt

# Control file selection for context generation
llmdirtree --max-files 150 --llm-context

# Override gitignore protection (not recommended)
llmdirtree --ignore-gitignore --llm-context

Example Output

Directory Tree

Directory Tree for: /project
Excluding: .git, node_modules, __pycache__, venv
--------------------------------------------------
project/
├── src/
│   ├── main.py
│   └── utils/
│       └── helpers.py
├── tests/
│   └── test_main.py
└── README.md

LLM Context File

# project-name

> A React web application for tracking personal fitness goals with a Node.js backend and MongoDB database.

## src/components/

- **Dashboard.jsx**: Main dashboard component that displays user fitness stats, recent activities, and goal progress.
- **WorkoutForm.jsx**: Form for creating and editing workout entries with validation and submission handling.

## src/utils/

- **api.js**: Contains functions for making API calls to the backend, handling authentication and data fetching.
- **formatters.js**: Utility functions for formatting dates, weights, and other fitness metrics consistently.

Benefits for LLM Workflows

  • Comprehensive context without uploading your entire codebase
  • More accurate responses with both structural and semantic understanding
  • Security first approach that protects sensitive information
  • Time savings from clearer communication with AI assistants

Technical Details

  • No external dependencies required for core functionality
  • Progress bar available with optional tqdm installation
  • Automatically respects .gitignore patterns for security
  • Uses system curl instead of Python libraries for API calls

License

MIT

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

llmdirtree-0.1.2.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.

llmdirtree-0.1.2-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file llmdirtree-0.1.2.tar.gz.

File metadata

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

File hashes

Hashes for llmdirtree-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f80e8dccf3c96a808993d381bbaca320607f43f0878105e4b23005742d9ae09d
MD5 83c0a2cd41b848a19551cb5843b46eb2
BLAKE2b-256 5c7a01668569766bcdd4af1707b1d7575b5435c8c9e7c55e22e523ad8487c284

See more details on using hashes here.

File details

Details for the file llmdirtree-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: llmdirtree-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.19

File hashes

Hashes for llmdirtree-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2dff48ba81f02095ea6bd8f48d53e0bfdc38f4a7a19c3fabdc1bed913490a029
MD5 c3f44810895a34dc7bbb450d91b41c69
BLAKE2b-256 f62180ffdd08f8b31309ea054c374008dc751533c7b3c6a1c6135e0227f079ff

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