Skip to main content

CLI tool to print directory structure and file contents for LLM context generation

Project description

llmprint

llmprint is a CLI tool that prints directory structures and file contents in a clean, LLM-friendly format. It's perfect for generating context when pasting into a chatbot or code assistant.


🚀 Features

  • 📂 Recursively includes multiple folders
  • ✂️ Skips common clutter using .gitignore-style rules
  • 🔍 Include/exclude specific folders and files
  • 🧠 Great for LLM prompt preparation, code understanding, or debugging
  • 📋 Cross-platform clipboard support
  • 🌟 Clean, structured output format

📦 Installation

Option 1: Install from source

git clone https://github.com/rsh3khar/llmprint.git
cd llmprint
pip install .

Option 2: Install from pip

pip install llmprint

⚡️ Usage

Print Directory Structure

# Print structure of current directory
llmprint -s

# Print structure of specific directories
llmprint -s -i src/ tests/

Print File Contents Recursively

# Print contents of specific directories
llmprint -i src/ tests/

# Print all files in current directory
llmprint .

Exclude Specific Folders or Files

# Exclude directories while printing contents
llmprint -i . -e node_modules __pycache__

# Exclude files by pattern (use quotes to prevent shell expansion)
llmprint -i . -e "*.pyc" "*.log"

Copy to Clipboard

# Copy tree structure to clipboard
llmprint -s -c

# Copy file contents to clipboard
llmprint -i src/ -c

# Copy and also print to screen
llmprint -s -c -p

🧠 Why use this?

When prompting an LLM with questions like:

"Can you explain this repo to me?"
"What's the purpose of this function?"
"Can you refactor this?"

You often need to include file structure and contents. llmprint formats this perfectly for large-context pasting — clean, readable, and structured.


🛠 Options

Option Description
-s / --structure Print directory structure only
-i / --include Specify folders or files to include
-e / --exclude Specify folders or files to exclude (use quotes for patterns, e.g., "*.pyc")
-c / --copy Copy output to clipboard (suppresses stdout)
-p / --print Print to stdout when using --copy

If no flag is provided, it defaults to printing the directory structure.


🔧 Requirements

  • Python 3.6 or higher
  • pyperclip for clipboard operations

📄 License

MIT License


✨ Author

Raj Shekhar
GitHub: @rsh3khar

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

llmprint-0.1.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

llmprint-0.1.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file llmprint-0.1.0.tar.gz.

File metadata

  • Download URL: llmprint-0.1.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.8

File hashes

Hashes for llmprint-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2f447f5a8d3363a52a8448c05a75246b2962b89aee4ffbe6c506c568c30b8319
MD5 df30710ddb2644aa4e365d2cfee3f1e9
BLAKE2b-256 2a7ade12d61d8739da0cc5067a125164b78e067ca8d40aab56da129f0dc8fd9d

See more details on using hashes here.

File details

Details for the file llmprint-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: llmprint-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.8

File hashes

Hashes for llmprint-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0796b93141f69d0c3a1a969ba4d42f199c3e4ab6fecfa0cc4c6f497bcc85dd42
MD5 0bd6fe7eb27548e168ae2326fc5cbdf1
BLAKE2b-256 c8b8c6c577b1a6cc1c5286bf70b2549ad55402b6524813e7a16a2779a6b126a6

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