Tired of Cmd+C'ing your way though files to feed your LLMs code context? Use cmdc instead to browse, grab, and format your code with style. Stop the manual copy-paste madness.
- Flexible Output: Copies to clipboard by default, supports console, and file output
- Directory Browser: Visual tree structure for easy directory navigation
- File Search: Fast file search and selection with fuzzy matching
- LLM-Ready Format: Structured output with XML-style tags
- Token Counting: Built-in token counter for LLM context awareness
- Smart Ignore Rules: Automatic parsing of project's .gitignore files
- Customizable: Configurable ignore patterns and file filters
Install using pip:
pip install pycmdc- Navigate to your project directory:
cd your-project- Run cmdc:
cmdcThis will open an interactive file browser where you can:
- Navigate using arrow keys (↑/↓)
- Toggle selection using arrow keys (←/→)
- Search files by typing
- Select all files using Ctrl+A
- Toggle all selections using Ctrl+D
- Confirm selection with Enter
- Selected files will be structured and copied to your clipboard
# Browse current directory
cmdc
# Browse specific directory
cmdc /path/to/directory
# Configure cmdc
cmdc --config
# Show help
cmdc --help# Filter by file extensions
cmdc --filters .py .js .ts
# Ignore specific patterns (combines with .gitignore rules)
cmdc --ignore "node_modules" "*.pyc"
# Disable .gitignore parsing
cmdc --no-gitignore
# Recursive directory traversal
cmdc --recursive
# Set maximum directory depth
cmdc --depth 2
# Save output to file
cmdc --output output.txt
# Non-interactive mode (select all matching files)
cmdc --non-interactiveRun the configuration wizard:
cmdc --configShow current configuration:
cmdc --config-showList ignore patterns:
cmdc --list-ignoreAdd new ignore patterns:
cmdc --add-ignore "*.log" "temp/*"cmdc generates structured output in an XML-like format:
<summary>
<selected_files>
file1.py
file2.js
</selected_files>
<directory_structure>
your-project/
├── file1.py
├── file2.js
└── src/
└── other.py
</directory_structure>
</summary>
<open_file>
file1.py
<contents>
# Content of file1.py
</contents>
</open_file>
<open_file>
file2.js
<contents>
// Content of file2.js
</contents>
</open_file>The configuration file is stored in:
- Linux/macOS:
~/.config/cmdc/config.toml - Windows:
%APPDATA%\cmdc\config.toml
Example configuration:
[cmdc]
recursive = false
depth = 3
copy_to_clipboard = true
print_to_console = false
use_gitignore = true
ignore_patterns = [ ".git", "node_modules", "__pycache__", "*.pyc", "venv", ".venv", "env", ".env", ".idea", ".vscode", ".pytest_cache", ".ruff_cache", ".mypy_cache", ".cache", ".DS_Store"]
filters = [".py", ".md"]
tiktoken_model = "o200k_base"You can override configuration using environment variables:
CMDC_FILTERS: Comma-separated list of file extensionsCMDC_IGNORE: Comma-separated list of ignore patternsCMDC_RECURSIVE: Set to "true" for recursive modeCMDC_COPY_CLIPBOARD: Set to "true" to enable clipboard copyCMDC_USE_GITIGNORE: Set to "true" to use .gitignore patterns
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.