Not a fez-wearing cat in a track suit.
There are many code2prompt tools around, but this one is mine πͺ
Cafeznik is an interactive CLI (levereging the beautiful fzf) to ease the selection and copying of code files - local or remote (GitHub) - to your clipboard.
Why? You know why - so I can feed it into LLMs like the lazy, lazy script kiddie vibe programmer I am. Itβs streamlined, efficient, and dangerously habit-forming.
Install it directly via RubyGems (requires Ruby 3.3 and the other dependencies listed below):
gem install cafeznikcafeznik # or cafeznik --repo owner/repouse tab to select multiple files, enter to copy them to your clipboard, and ctrl-c/esc to exit. Selecting a directory will copy all files within it, and selecting ./ will copy everything in sight (respecting your --excludes and --greps ).
Local mode:
Or remote with grep and exclude:

Cafeznik relies on a few external tools to work its magic:
fzfβ Essential for interactive file selection (absolutely required)fdβ Powers local file discovery (required for local mode)ripgrepβ Enables efficient grep functionality (required when using--grep)bat(&tree) β Provide pretty previews (optional but highly recommended)ghβ Simplifies GitHub authentication (optional; you can alternatively set the GITHUB_TOKEN environment variable)
A homebrew line to install all the dependencies on macOS:
brew install fzf fd ripgrep bat tree ghor if you're on Linux, you can use your package manager of choice:
sudo apt install fzf fd-find ripgrep bat tree gh(notice that on Linux, fd is often aliased to fdfind)
Quickly select and copy files from your current directory:
cafeznikFilter your selection to include only files that contain specific text:
cafeznik --grep "def initialize"Easily exclude unwanted files or directories:
cafeznik --exclude "*.log" --exclude "tmp/"Fetch and copy code directly from any GitHub repository:
cafeznik --repo owner/repoIt also supports full URLs:
cafeznik --repo https://github.com/owner/repo--repo, -r Specify a GitHub repository to fetch files from
--grep, -g Only select files containing specific text patterns (works locally and remotely)
--exclude, -e Exclude files or directories matching provided patterns (also works locally and remotely)
--with-tree, -t Include a detailed file tree structure in your output (Guess what? Works locally and remotely)
--no-header Omit file headers from the copied content for a cleaner paste
--verbose Activate detailed logging output for debugging and transparency
Or, you know:
cafeznik --help- History of copied files - so you can easily re-copy them. Rinse, repeat.
- Optional minification of copied files
- Binary files support for multi-modal models? Might be a stretch
- Token counting. Everyone loves token counting.
- Branch diff & git tree compare, to get the files you've been working on
- PR diff, to get the files you need to be reviewing
- gitingest - Fellow Ruby that works much better on bigger repos, and packs it all nicely in a prompt file
- onefilellm - Does so much more, expect it's a completely different thing
- your-source-to-prompt.html - If you wanna leave your console for a browser, you'll get plenty of nice features for your code2prompt needs
Cafeznik is open-source software, licensed under the MIT License.
Please! Feel free, this over-engineered tool welcomes all interested parties and fiestas.
Enjoy your freshly copied code! πͺ