This project has been archived by its maintainers, and is no longer receiving any updates.
cmake2chat
Lost in a huge CMake project? Wish an LLM could just "see" the codebase structure and all build rules? Now they can!
What's This?
cmake2chat scans your CMake project directory, builds a tree view of the codebase, and exports the tree view, the paths of all CMakeLists.txt files along with their contents to an OpenAI Chat Completions-compatible JSON.
Typical Use Cases
- Instant overview: Give an LLM a complete picture of your project's structure (files, folders) plus CMake build logic at every level.
- Build-system-powered Q&A: Ask questions like "What libraries does this project build?", "Where is the executable defined?", or "What targets/flags are set in this module?" and get relevant, context-based answers!
- AI onboarding: Drop into a new CMake project and let an LLM guide you using actual high-level structure and build scripts, not just guesses.
- No manual plumbing: Skip hours of clicking/repeating
find ., opening dozens of files, or pasting snippets piecemeal. Feed the AI the whole map and let it answer or advise precisely.
Install
pip install cmake2chat
Example
Suppose you have the following CMake project directory structure:
- my_project/
- CMakeLists.txt
- src/
- CMakeLists.txt
- main.cpp
- lib/
- CMakeLists.txt
To generate an OpenAI Chat Completions-compatible JSON describing your project, simply run:
python -m cmake2chat my_project -o my_project.json
An example of the beginning of the output might look like:
[
{
"role": "user",
"content": "- my_project/\n - CMakeLists.txt\n - src/\n - CMakeLists.txt\n - main.cpp\n - lib/\n - CMakeLists.txt"
},
{
"role": "user",
"content": "CMakeLists.txt"
},
{
"role": "user",
"content": "# Top-level build logic goes here\ncmake_minimum_required(VERSION 3.10)\nproject(MyProject)\n..."
},
{
"role": "user",
"content": "src/CMakeLists.txt"
},
{
"role": "user",
"content": "# Build logic for src directory\nadd_executable(main main.cpp)\n..."
}
]
You can now use this JSON directly as input to an LLM API for a powerful, context-aware understanding of your CMake project!
How it works
- Scan: Recursively walks your project directory.
- Map: Extracts the structure (files & folders) as a tree.
- Collect: For each
CMakeLists.txt, grabs its path and full content. - Export: Outputs everything as an OpenAI Chat Completions-compatible JSON.
Contributing
Contributions are welcome! Please submit pull requests or open issues on the GitHub repository.
License
This project is licensed under the MIT License.
Release files for cmake2chat 0.1.0a0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cmake2chat-0.1.0a0.tar.gz | 4.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cmake2chat-0.1.0a0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 8.7 kB
Release files / cmake2chat-0.1.0a0.tar.gz
| Download URL | cmake2chat-0.1.0a0.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bee32108f26327d96ed4481aeea0a4914e6098872c2afbd2ea7fdd7cff1dd9aa
|
|
BLAKE2b-256 checksum How to use checksums |
e5c4cc0d53300348380b70074585e9d9285071cf5776ada6478c3cf6819bf0e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / cmake2chat-0.1.0a0-py2.py3-none-any.whl
| Download URL | cmake2chat-0.1.0a0-py2.py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
36ce13b8d44bdc5e06e2965a4b87b2d0a9fef5337719131e57de3d9f69ea0af5
|
|
BLAKE2b-256 checksum How to use checksums |
5b0f4405fcbf71a9538b73ec5d049e6969259b2d55066d3df10e897f981ca244
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|