https://github.com/franklinkemta/codeindexer
A lightweight CLI tool for indexing codebases to provide context for LLMs.
https://github.com/franklinkemta/codeindexer
chatgpt claude code codebase copilot copy-paste cursor deepseek gemini groq indexing llama llm llms open-source productivity prompt prompt-engineering
Last synced: 11 months ago
JSON representation
A lightweight CLI tool for indexing codebases to provide context for LLMs.
- Host: GitHub
- URL: https://github.com/franklinkemta/codeindexer
- Owner: franklinkemta
- License: mit
- Created: 2025-03-07T18:23:53.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-03-07T19:28:21.000Z (11 months ago)
- Last Synced: 2025-03-07T19:28:45.273Z (11 months ago)
- Topics: chatgpt, claude, code, codebase, copilot, copy-paste, cursor, deepseek, gemini, groq, indexing, llama, llm, llms, open-source, productivity, prompt, prompt-engineering
- Language: Python
- Homepage:
- Size: 10.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING
- License: LICENSE
Awesome Lists containing this project
README
# CodeIndexer
[](https://badge.fury.io/py/codeindexer)
A lightweight CLI tool for indexing codebases to provide context for LLMs.
## Why ?
Still doing some finger-hurting typing or copy-pasting just to update your LLM about code changes or set up context in new chats (the old way π
, without copilots)?
I run this tool to generate a structured prompt with my project files, so all I have to do is copy, paste, and the model is ready to go! ββ±οΈβ¨
## Installation βΉοΈ
```bash
pip install codeindexer
# Basic usage
codeindexer --index ./my_repo --format md index_file.md
# Filter by file extensions (create a txt prompt file index_file.txt)
codeindexer --index ./my_repo --only .py,.js,.md --format txt index_file.txt
# Skip specific directories or files (create a json prompt file index_file.json)
codeindexer --index ./my_repo --skip node_modules/,venv/,*.log --format json index_file.json
# Explicitly include files/paths (even if ignored by .gitignore)
codeindexer --index ./my_repo --include important.log,temp/config.json --format md index_file.md
# Add a custom prompt at the end
codeindexer --index ./my_repo --prompt "Analyze and suggest improvements." --format md index_file.md
# Disable .gitignore parsing
codeindexer --index ./my_repo --no-gitignore --format md index_file.md
# Split the prompt into multiple parts e.g 1000 lines max (place prompt parts in the index_file/... folder)
codeindexer --index ./my_repo --format md index_file.md --split 1000
````
Example of indexed output file (index_file.md) π
```tree
# Repo: my_repo
# Folder structure:
my_repo/
βββ src/
β βββ main.py
β βββ utils.py
βββ tests/
β βββ test_main.py
βββ README.md
βββ requirements.txt
# Files
# my_repo/requirements.txt
{contents of my_repo/requirements.txt}
# my_repo/README.md
{contents of my_repo/README.md}
# my_repo/src/main.py
{contents of my_repo/src/main.py}
...
________________________________________
Acknowledge the project's description and files, do no provide additional explanation, wait for instructions
```
## Options π§
- `--index`: Directory to index (required)
- `--only`: Comma-separated list of file extensions to include (e.g., .py,.js,.md)
- `--skip`: Comma-separated list of patterns to skip (e.g., node_modules/,venv/,*.log)
- `--include`: Comma-separated list of patterns to explicitly include even if in .gitignore
- `--format`: Output format (md, txt, json) - default is md
- `--prompt`: Custom prompt to add at the end of the index
- `--no-skip-env`: Include .env files (by default they are skipped)
- `--no-gitignore`: Disable automatic parsing of .gitignore files (enabled by default)
- `--split`: Split output into chunks with specified max lines per file (default: 1000)
## Features β¨
- β
Generate a single file with your repoβs structure and files
- β
Automatically respects .gitignore rules π
- β
Filters files by extension and skips binaries π
- β
Multiple output formats: Markdown, text, JSON π
- β
Add a custom prompt for LLM context π€
- β
Split output files into small parts
## Contributing π€
Contributions are welcome! Please check out our [Contributing Guide](CONTRIBUTING.md) for details on how to get started.
## License
MIT