CodeContext is an app for Mac & Windows to provide code context to Language Learning Models (LLMs). It scans project directories, generates a structured representation of the project, and extracts relevant file contents while intelligently filtering out unnecessary files and directories.
Update: a more comprehensive tool is code2prompt.
I found that CodeContext is more user friendly, faster, and automatically includes only user code (based on both extension and file contents), but you may have better luck.
- Generates a hierarchical project structure
- Extracts contents of relevant files
- Intelligent file and directory filtering
- Git-aware: respects .gitignore rules
- Handles binary files and large files
- Excludes generated code
- Customizable ignored extensions, directories, and files
- .NET 6.0 or later
-
Install .NET SDK if you haven't already: brew install --cask dotnet-sdk
-
Clone the repository: git clone https://github.com/yourusername/CodeContext.git
-
Navigate to the project directory: cd CodeContext
-
Build the project: dotnet build
-
Clone the repository: git clone https://github.com/DavidVeksler/CodeContext/CodeContext.git
-
Navigate to the project directory: cd CodeContext
-
Build the project: dotnet build
Run the application with: dotnet run [path_to_index] [output_file]
path_to_index
: The directory to analyze (optional, will prompt if not provided)output_file
: The file to write the output (optional, defaults tocontext.txt
in the parent directory of the indexed path)
If no arguments are provided, the application will prompt for input.
Customize ignored files, directories, and extensions by modifying the FileChecker
class:
IgnoredExtensions
: File extensions to ignoreIgnoredDirectories
: Directories to ignoreIgnoredFiles
: Specific files to ignoreMaxFileSizeBytes
: Maximum file size to process (default: 100KB)
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE.txt file for details.