Ditch the copy-paste madness - browse, select, and format code for LLMs, keyboard-only.
Project description
pycmdc
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.
Features
- 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
Installation
Install using pip:
pip install pycmdc
Quick Start
- Navigate to your project directory:
cd your-project
- Run cmdc:
cmdc
This 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
Usage
Basic Commands
# Browse current directory
cmdc
# Browse specific directory
cmdc /path/to/directory
# Configure cmdc
cmdc --config
# Show help
cmdc --help
Advanced Options
# 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-interactive
Configuration
Run the configuration wizard:
cmdc --config
Show current configuration:
cmdc --config-show
List ignore patterns:
cmdc --list-ignore
Add new ignore patterns:
cmdc --add-ignore "*.log" "temp/*"
Output Format
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>
Configuration 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"
Environment Variables
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
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pycmdc-1.3.0.tar.gz.
File metadata
- Download URL: pycmdc-1.3.0.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5386bda94397db96623b12842adb504202cf91b9c362e890b860136a4f6d03f5
|
|
| MD5 |
cf623b57517f2ce7cbb66e254f43bf3d
|
|
| BLAKE2b-256 |
80a98dc19344e4398c5d01ec0017f02f029c76ac826a51c7bab2456fe868d8bc
|
Provenance
The following attestation bundles were made for pycmdc-1.3.0.tar.gz:
Publisher:
release.yml on 0xmrwn/pycmdc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycmdc-1.3.0.tar.gz -
Subject digest:
5386bda94397db96623b12842adb504202cf91b9c362e890b860136a4f6d03f5 - Sigstore transparency entry: 273055377
- Sigstore integration time:
-
Permalink:
0xmrwn/pycmdc@9ea539469e0abda0d380a662aa69d2f531e1ebbb -
Branch / Tag:
refs/heads/main - Owner: https://github.com/0xmrwn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9ea539469e0abda0d380a662aa69d2f531e1ebbb -
Trigger Event:
push
-
Statement type:
File details
Details for the file pycmdc-1.3.0-py3-none-any.whl.
File metadata
- Download URL: pycmdc-1.3.0-py3-none-any.whl
- Upload date:
- Size: 19.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b20f60a59bee523ff48bd3bd0e9038d7154d02a098ca3ada688615ba7b99cba4
|
|
| MD5 |
df6e1b364b66b4de2fa0b7d3c2b2e052
|
|
| BLAKE2b-256 |
ed6301d3258ade31a95275f7f9d1a06374f7fb16f6799b09829ca285706825ee
|
Provenance
The following attestation bundles were made for pycmdc-1.3.0-py3-none-any.whl:
Publisher:
release.yml on 0xmrwn/pycmdc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycmdc-1.3.0-py3-none-any.whl -
Subject digest:
b20f60a59bee523ff48bd3bd0e9038d7154d02a098ca3ada688615ba7b99cba4 - Sigstore transparency entry: 273055378
- Sigstore integration time:
-
Permalink:
0xmrwn/pycmdc@9ea539469e0abda0d380a662aa69d2f531e1ebbb -
Branch / Tag:
refs/heads/main - Owner: https://github.com/0xmrwn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9ea539469e0abda0d380a662aa69d2f531e1ebbb -
Trigger Event:
push
-
Statement type: