For Release 0.1, I created ContextWeaver, a command-line tool that packages the content of a local Git repository into a single text file optimized for Large Language Models (LLMs). The goal is to make it easier to share full project context with ChatGPT or other tools without manually copy-pasting many files.
Setup
I started by creating a new GitHub repository with a clear name, adding a README.md and LICENSE file. The README explains what the tool does, how to install it, and examples of usage.
Implemented Features
-CLI Interface: --help, --version, accepts file/directory paths
-File Discovery: can analyze current directory, specific directories, or specific files
-Output Format: includes absolute repo path, Git commit info, project structure, file contents, and summary stats
-Standard Streams: outputs to stdout, errors to stderr
-Error Handling: skips unreadable files and reports them
-Output to File: -o flag saves the context into a .txt or .md file
-Token Counting: --tokens flag gives an estimated token count
Example Usage
-Analyze current directory
python main.py .
-Save output to file
python main.py . -o output.txt
-Estimate token count
python main.py . --tokens
Sample run: main.py generates repo structure, file contents, and metadata in one output.
Reflection
While building this release, I learned:
-How to parse command-line arguments with argparse
-How to use Git commands to pull commit info
-How to walk through directories, skip hidden files, and include file contents
-How to handle large files by truncating output at 16KB
One challenge was deciding what to include vs skip for very large files. I solved this by limiting the file size and adding a truncation note.
This project gave me practice with CLI design, file system operations, and Git integration, while also teaching me the importance of clear documentation.
Links
Repo: https://github.com/kkrishnan10/ContextWeaver
Main script:
https://github.com/kkrishnan10/ContextWeaver/blob/main/src/main.py
README: https://github.com/kkrishnan10/ContextWeaver/blob/main/README.md
Top comments (0)