Copy all .py files from any subdirectory to LLM context using llm-context
Project description
lc-dir
Instantly copy all relevant Python files from any folder in your project to your clipboard—perfect for use with AI code assistants and LLMs.
Why use lc-dir?
When working with LLMs (like ChatGPT, Claude, or Copilot), you often need to share only part of your codebase—a single directory, a feature, or a component, not the whole repo.
lc-dir lets you do exactly that.
- No more zipping folders or hand-pasting dozens of files.
- No more sending the entire project when only one area matters.
- Get context for refactoring, debugging, or reviewing code fast.
Key Features
- Easy: Instantly copies all
.pyfiles under any directory (recursively) to your clipboard, ready for LLMs. - Flexible: Works from any subfolder, or specify any target directory.
- Search: Give it a folder name; it’ll find the match for you.
- Integrated: Uses your llm-context workflow for formatting and clipboard.
Installation
pipx install lc-dir
(or use pip install --user lc-dir if you prefer)
Requirements:
- Python 3.7+
- The llm-context CLI, initialized in your project (run
lc-initonce per repo).
How to Use
Example: Copy all
.pyfiles from the current directory and below:
lc-dir
Example: Copy all
.pyfiles from a specific subdirectory (recursively):
lc-dir path/to/subdir
Example: Search for a folder by name, even if you’re not sure where it is:
lc-dir common
If more than one match is found, you’ll be prompted to choose.
Typical Workflow
-
Navigate anywhere in your project directory tree.
-
Run
lc-dir [optional-subfolder] -
Paste in your LLM interface.
- The clipboard will contain all relevant code, formatted for LLMs, just as if you ran
llm-contextbut limited to your chosen scope.
- The clipboard will contain all relevant code, formatted for LLMs, just as if you ran
Use Cases
- LLM-powered code review: Share just the area you want help with.
- Refactoring: Provide only the module or feature you’re working on.
- Bug fixing: Send just the files around the problem.
- Onboarding: Give teammates or LLMs a focused view of part of the repo.
Troubleshooting
- If the clipboard isn’t updated, ensure you’ve initialized your repo with
lc-init. - If you see “ModuleNotFoundError”, re-install with
pipx install lc-dirand check your Python version. - You must have llm-context CLI installed in the project for this to work.
License
MIT
Contributions and issues welcome!
---
## **What to include in your repo:**
- This `README.md`
- `pyproject.toml` with `[project.scripts] lc-dir = "lc_dir.cli:main"`
- `lc_dir/cli.py` and `lc_dir/__init__.py`
- Standard `LICENSE` and `.gitignore`
---
### **Ready for PyPI**
With this setup, you can publish to PyPI and anyone can do:
```sh
pipx install lc-dir
And then:
cd my/project/subdir
lc-dir
Project details
Release history Release notifications | RSS feed
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 lc_dir-0.1.0.tar.gz.
File metadata
- Download URL: lc_dir-0.1.0.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.12.8 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d90e6d774454a935a266a58e1e4b5c13bff7b332fba8fc6d9945bf3bb30f40c
|
|
| MD5 |
cb04e39bd05a4a4cef4f94aaec9d64d2
|
|
| BLAKE2b-256 |
69f37ef988b97021457648a2c5eb198473352abb370279815a2b13f21aa3f2dc
|
File details
Details for the file lc_dir-0.1.0-py3-none-any.whl.
File metadata
- Download URL: lc_dir-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.12.8 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
317360180ddb41727bb696869628d52a41d5a4c23b4e40a9ec97dfc6953a6e15
|
|
| MD5 |
69e90a7786dae2126abd392288feeaa6
|
|
| BLAKE2b-256 |
5594e989c31673bf42b509db1acf9fcec7e129d0b1bedf33f1a9f3a9e53f8205
|