How To Quickly Copy File Content into ChatGPT
Ever needed a quick snapshot of your codebase to feed into ChatGPT or any LLM? Glimpse is a powerful CLI tool written in Rust that can almost instantly copy an entire directory of files into your clipboard.
Glimpse not only copies file contents, but provides headers and a neatly formatted directory tree. This allows any LLM or AI Chat tool to understand the structure of your project and provide accurate output.
What is Glimpse?
Often, you are working on some code, maybe even using an AI tool, but you don't know exactly what code to provide. Maybe you've been using one Code assistant tool, but it's not doing quite what you want, and you just want to ask ChatGPT or a locally-running LLM about the problem. But what files to include?
How about all of them?
Glimpse is a fast, lightweight command-line tool designed to help you quickly inspect and share the structure of your codebases. You can get the contents of all of your files, formatted with headers so the LLM can distinguish files, a directory tree to share the structure of your project, or both.
Installation
If using cargo
or otherwise doing Rust development, it's easy to install.
bash cargo install glimpse
Otherwise, if you're just using MacOS:
brew tap seatedro/glimpse
brew install glimpse
Using the Tool
Navigate to your project directory and run:
glimpse .
Your clipboard is now loaded with the contents of the directory. It could be a lot!
Want to see the directory tree, and maybe print to standard output?
❯ glimpse -o tree -p
Scanning files... Directory Structure:
└── README.md
└── current.md
└── freshy.zsh-theme
└── install_software.sh
├── macos_quick_actions/
├── Switch_to_Chrome.workflow/
└── Contents/
└── Info.plist
├── Switch_to_Ghostty.workflow/
├── Switch_to_VSCode.workflow/
├── Switch_to_kitty.workflow/
└── setup_homedir.sh
Summary:
Total files: 9
Total size: 10965 bytes
Token Count Summary:
Total tokens: 3177
Breakdown by file:
freshy.zsh-theme: 812
install_software.sh: 736
setup_homedir.sh: 490
README.md: 256
macos_quick_actions/Switch_to_Ghostty.workflow/Contents/Info.plist: 198
macos_quick_actions/Switch_to_VSCode.workflow/Contents/Info.plist: 198
macos_quick_actions/Switch_to_Chrome.workflow/Contents/Info.plist: 197
macos_quick_actions/Switch_to_kitty.workflow/Contents/Info.plist: 197
current.md: 93
Need to see only specific files or exclude certain patterns? Glimpse has you covered:
glimpse -i "*.rs,*.go" -e "target/*,dist/*" .
Final Thoughts
Glimpse makes exploring and sharing your codebase effortless. With its fast processing, customizable options, and built-in token counting, you can easily prepare your project for analysis by your favorite LLM. Try Glimpse today and streamline your development workflow!