Skip to main content

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.

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cmake2chat-0.1.0a0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cmake2chat-0.1.0a0-py2.py3-none-any.whl (4.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file cmake2chat-0.1.0a0.tar.gz.

File metadata

  • Download URL: cmake2chat-0.1.0a0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for cmake2chat-0.1.0a0.tar.gz
Algorithm Hash digest
SHA256 bee32108f26327d96ed4481aeea0a4914e6098872c2afbd2ea7fdd7cff1dd9aa
MD5 25c00d3c4556cb97ab9c37325a9a0b6d
BLAKE2b-256 e5c4cc0d53300348380b70074585e9d9285071cf5776ada6478c3cf6819bf0e6

See more details on using hashes here.

File details

Details for the file cmake2chat-0.1.0a0-py2.py3-none-any.whl.

File metadata

  • Download URL: cmake2chat-0.1.0a0-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for cmake2chat-0.1.0a0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 36ce13b8d44bdc5e06e2965a4b87b2d0a9fef5337719131e57de3d9f69ea0af5
MD5 b43920b9b778f7f7d4fd637e3bc50741
BLAKE2b-256 5b0f4405fcbf71a9538b73ec5d049e6969259b2d55066d3df10e897f981ca244

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page