gptree  by travisvn

CLI tool for LLM code context

Created 8 months ago
255 stars

Top 98.8% on SourcePulse

GitHubView on GitHub
Project Summary

A CLI tool to provide LLM context for coding projects by combining project files into a single text file with a directory tree structure. It helps developers by simplifying the process of feeding relevant code context to Large Language Models (LLMs) for tasks like code completion or debugging. The tool offers flexible file selection, filtering, and configuration options, making it adaptable to various project needs.

How It Works

The tool traverses a project directory, respecting .gitignore rules and common exclusion patterns (like .git, __pycache__). It allows users to include or exclude files based on simple file extensions or advanced glob patterns. The content of the selected files is then combined into a single output, optionally with a directory tree structure and line numbers. Users can interactively select files, save configurations globally (~/.gptreerc) or per-project (.gptree_config), and override settings via CLI arguments.

Quick Start & Requirements

  • Installation: Recommended via pipx install gptree-cli. Alternatives include Homebrew (brew install travisvn/tap/gptree) or pip (pip install gptree-cli).
  • Prerequisites: Python 3.x.
  • Links: gptree.dev for GUI and downloads.

Highlighted Details

  • Supports interactive file selection with keyboard navigation and toggling.
  • Offers both simple file type filtering (e.g., .py,.js) and advanced glob pattern matching.
  • Includes a "Safe Mode" to prevent overly large outputs by limiting file count and total size.
  • Features clipboard support for easy pasting into LLM prompts.
  • Provides a GUI version available at gptree.dev.

Maintenance & Community

  • The project is open source and welcomes contributions via pull requests.
  • Further community interaction details (e.g., Discord/Slack) are not specified in the README.

Licensing & Compatibility

  • License: GNU General Public License v3.0 (GPL-3.0).
  • Compatibility: As a GPL-3.0 licensed project, it may have implications for use within closed-source commercial applications due to its copyleft nature.

Limitations & Caveats

The tool's "Safe Mode" has default limits on file count and combined size, which can be disabled but may lead to very large outputs. The README does not detail specific performance benchmarks or known bugs.

Health Check
Last Commit

1 month ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
72 stars in the last 30 days

Explore Similar Projects

Starred by David Cournapeau David Cournapeau(Author of scikit-learn), Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), and
7 more.

repomix by yamadashy

0.7%
19k
CLI tool to pack codebases into AI-friendly formats for LLMs
Created 1 year ago
Updated 1 day ago
Feedback? Help us improve.