A CLI tool for gathering text context of a directory, similar to gitingest web app, with a fuzzy finder for including/excluding files and several other configuration options.
- Smart Output: Markdown output with syntax highlighting. Automatically copies to clipboard when you export. Optionally saves to a file.
- Interactive Fuzzy Finder: Browse and search through files with a responsive TUI
- Hierarchical Selection: Including/excluding directories affects all children
- Color-coded Feedback:
- 🟢 Green: Included files/directories
- 🔴 Red: Excluded files/directories
- 🟡 Yellow: Partially included (mixed children states)
- Two Modes: Interactive mode with fuzzy finder or direct mode with pattern matching
- Smart File Detection: Automatically identifies text files vs binary files
- Configurable: Control file size limits, clipboard limits, gitignore behavior, and hidden file visibility
- Two-Tier Configuration: Global config (
~/.config/.gthr.toml
) with project-specific overrides (.gthr.toml
) - Pattern Matching: Supports glob patterns for include/exclude (e.g.,
*.rs
,**/*
) - Vim-like Controls: Vim-like navigation (
Ctrl+J
/Ctrl-K
) alongside arrow keys
brew install adarsh-roy/gthr/gthr
NOTE: You must have cargo
installed.
cargo install --git https://github.com/Adarsh-Roy/gthr --locked
# Interactive mode (default)
gthr
# Interactive mode with all files pre-included
gthr -I
# Direct mode - include only Rust files
gthr -i "*.rs" direct
# Show hidden files
gthr -H true
# Ignore .gitignore files
gthr -g false
For all available options, use:
gthr --help
Search
- Type any character - Adds to search
Backspace
- Delete search characterEsc
- Clear search (or quit if search is empty)
Navigation
↑/↓
or←/→
- Move through filesCtrl+J/Ctrl+K
- Vim-like navigation
Selection
Enter
- Toggle selection (✓/✗)
Actions
Ctrl+E
- Export and quitCtrl+H
- Show helpEsc
- Clear search or quit
- Default: Copies to clipboard (up to clipboard limit)
- Large output: Shows save dialog if total size exceeds clipboard limit
- Manual save: Use
-o filename.md
flag
gthr supports a two-tier configuration system with global defaults and per-project overrides.
- Global Config:
~/.config/.gthr.toml
(applies to all projects) - Project Config:
.gthr.toml
in project root (overrides global)
Settings are resolved in order (highest to lowest priority):
- Command-line flags
- Project configuration (
.gthr.toml
) - Global configuration (
~/.config/.gthr.toml
) - Built-in defaults
# Maximum file size to include when traversing directories (in bytes)
# Default: 2097152 (2MB)
max_file_size = 2097152
# Maximum size for clipboard operations (in bytes)
# Default: 2097152 (2MB)
max_clipboard_size = 2097152
# Whether to respect .gitignore files by default
# Default: true
respect_gitignore = true
# Whether to show hidden files and directories (starting with .)
# Default: false
show_hidden = false
A complete sample is available in .gthr.toml
.
Commands:
interactive Run the interactive fuzzy finder interface (default)
direct Generate text ingest directly without interaction
Options:
-r, --root <ROOT> Root directory [default: .]
-I, --include-all Pre-include all files
-E, --exclude-all Pre-exclude all files (default)
-i, --include <PATTERN> Include pattern (glob)
-e, --exclude <PATTERN> Exclude pattern (glob)
-o, --output <OUTPUT> Output file path
-g, --respect-gitignore <BOOL> Respect .gitignore [default: true]
-H, --show-hidden <BOOL> Show hidden files [default: false]
--max-file-size <SIZE> Max file size in bytes [default: 2097152]
-h, --help Print help
-V, --version Print version
# Include everything, show hidden files, ignore .gitignore
gthr -I -H true -g false
# Direct mode - only Rust and TOML files
gthr -i "*.rs" -i "*.toml" direct
# Exclude build artifacts
gthr -I -e "target/*" -e "node_modules/*" direct
# Custom file size limit
gthr --max-file-size 5242880
# Save to file
gthr -o output.md
Contributions are welcome! Please submit issues, feature requests, or pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
- gitingest - Web-based repository ingestion
- gthr adds interactive TUI with fuzzy matching
- gthr supports clipboard output for quick pasting
- Regex support in search bar in interactive mode
- Keyboard shortcuts for settings in interactive mode
- Performance optimizations for large directories
- Gather text context directly from github repository link