CodePrinter is designed as a simple local tool for selecting, packaging, and formatting code files to share with Large Language Models (LLMs).
To run CodePrinter:
- Clone this repository:
git clone https://github.com/ChristianCasazza/codeprinter
- Start the application using
uv:uv run app.py
Thanks to uv, no virtual environment (venv) setup is required because the package dependencies are already included within the script.
If you don't already have uv installed, you can add it via pip:
pip install uvFor more details, refer to the uv documentation.
-
Enter a Repository Source
- For GitHub: Enter a repository URL (e.g., https://github.com/username/repo)
- For local: Enter a directory path (e.g., /path/to/your/project)
-
Select Files
- Use the directory tree to check specific files
- Use extension filters to select files by type
- Search for specific files
-
Generate Output
- Click "Selected Files" for only checked files
- Click "Full Project" for all files with selected ones highlighted
-
Use the Output
- Copy to clipboard
- Download as a file
- Toggle syntax highlighting for better readability
Ctrl + F: Focus search boxCtrl + E: Expand all foldersCtrl + C: Collapse all foldersCtrl + G: Generate selected filesCtrl + Shift + G: Generate full projectEscape: Close modals/fullscreen
Within the app.py, you'll find the skip_dirs variable, which lists directories to exclude from the UI. By default, it includes:
.venvnode_modules.git.vscode.evidencetarget
Edit this list as needed to customize which folders are skipped.
CodePrinter now includes a dynamic file format management system:
- Click the "Manage" button next to the file extension filters
- Add, edit, or delete file formats through the Format Manager
- Customize:
- File extensions (e.g.,
.js,.py) - Display colors
- Syntax highlighting language
- Enable/disable specific formats
- File extensions (e.g.,
Changes take effect immediately without editing code. The formats are stored in the database for persistence between sessions.
Passing public GitHub repo links works in GitHub mode the same way as local mode.
However, especially large repos might be rate limited by GitHub and fail. This can be mitigated by providing a GitHub access token.
GitHub mode also works with your own personal private repos. Create a GitHub Personal Access Token (PAT) with the repo permissions to access private repositories.
For private GitHub repositories, you'll need a personal access token:
- Go to GitHub Token Settings
- Generate a new token with the "repo" scope
- Enter the token in the application
- Alternatively, set it as the
GITHUB_TOKENenvironment variable
Feel free to submit issues or feature requests via the GitHub repository.
Best place to contact me is sending me a DM on X at @CasazzaNY
This was made possible thanks to Abin Thomas open-sourcing repo2txt as a base to build on, so I am open-sourcing this to pass it forward. Thank you, Abin! My main change was converting the app to be a uv flask executable app, and making local mode work by just passing a local path instead of a zip file.
Happy coding!