Interactive CLI tool to collect and format multiple code files for sharing with LLMs. Select files with a fuzzy finder, get perfectly formatted output copied to your clipboard.
When working with LLMs on coding tasks, you often need to share multiple files for context. Code Collect makes this effortless by:
- 🎯 Interactive selection - Pick exactly the files you need with fuzzy search
- 📋 Perfect formatting - Files formatted with paths and syntax highlighting
- 🚀 One command - From selection to clipboard in seconds
- 🧠 Smart filtering - Ignores binaries, build files, and common junk
$ code-collect
Scanning /Users/you/project...
Found 34 eligible files.
# Interactive fzf interface opens
Processing 6 files...
✅ Copied 6 files to clipboard!Output format (without rendering):
// src/components/Button.tsx
```typescript
export const Button = () => {
return "Click me"
}
```// src/utils/helpers.py
```python
def format_data(data):
return data.strip()
```
- Python 3.6+
- fzf -
brew install fzf(macOS) orapt install fzf(Ubuntu)
curl -sSL https://raw.githubusercontent.com/amadsalman/code-collect/main/install.sh | bash# Clone the repository
git clone https://github.com/amadsalman/code-collect.git
cd code-collect
# Run the install script
./install.sh# Download the script directly
curl -o code-collect https://raw.githubusercontent.com/amadsalman/code-collect/main/code-collect
chmod +x code-collect
# Make it globally available
sudo mv code-collect /usr/local/bin/# Interactive selection from all files
code-collect
# Auto-collect all git modified files (staged + unstaged)
code-collect --changed
# Auto-collect only git staged files
code-collect --staged
# Auto-collect all files (respects .gitignore)
code-collect --all
# Auto-collect all files under specific subpath
code-collect --all src/
# Scan specific directory
code-collect /path/to/project
# Auto-collect modified files from specific directory
code-collect --changed /path/to/project--changed- Automatically collects all modified files (staged + unstaged), skips interactive selection--staged- Automatically collects only staged files, perfect for pre-commit reviews--all- Automatically collects all eligible files while respecting.gitignore, skips interactive selection- Default - Interactive fuzzy finder selection from all eligible files
- Arrow keys - Navigate files
- Tab - Multi-select files
- Enter - Confirm selection
- Esc - Cancel
- Git integration - Auto-collect modified or staged files with
--changedand--staged - Interactive selection - Fuzzy finder with preview for precise file picking
- Smart file detection - Only shows text files, skips binaries
- Gitignore integration - Respects your project's
.gitignorepatterns - Intelligent filtering - Ignores common build/cache directories
- Size limits - Skips files over 1MB
- Syntax highlighting - Proper language detection for 30+ file types
- Cross-platform - Works on macOS, Linux, Windows (with WSL)
- Everything in your
.gitignorefile - Binary files and executables
- Common build/cache directories (
.git,node_modules,dist,build, etc.) - IDE files (
.vscode,.idea) - Large files (>1MB)
Issues and PRs welcome! This tool was built to scratch a specific itch - making LLM context sharing effortless.
python3 test_code_collect.pyThe test suite covers:
- File detection and filtering
- Gitignore pattern matching
- Git integration (modified/staged files)
- Content formatting
- Error handling