Solve documentation hell for good.
Docgen is a lightweight, C++ CLI tool that automates software documentation using Large Language Models (LLMs). It treats documentation generation as a build step, tracking your source code and incrementally updating documentation only when files change.
Because you no longer have to bother writing docs yourself, just run docgen update and you are good to go.
- Docs-as-Code: Generates Markdown documentation that lives right next to your source code.
- Smart Incremental Builds: Uses content hashing to only regenerate docs for modified files, saving time and API credits.
- Context-Aware (RAG): Automatically analyzes dependencies to provide relevant context to the AI, ensuring accurate documentation for complex projects.
- Flexible Backend:
- Cloud: Supports OpenAI, Google Gemini, and compatible APIs.
- Local: Works fully offline with Ollama (default).
- Zero Dependencies: Compiled as a single static binary.
irm https://raw.githubusercontent.com/alonsovm44/docgen/master/installer.ps1 | iexcurl -fsSL https://raw.githubusercontent.com/alonsovm44/docgen/master/installer.sh | bashAfter installation run
docgen initThis creates your Docfile and your .docgen repo. Using the Docfile is easy.
Run docgen track <path> this adds the file/directory to your Docfile.
Then run docgen update to generate your tracked files documentation. Once generated only files with changes will be updated.
You can also run docgen ignore to indicate to Docgen which files or directories to ignore.
Example Docfile
Track:
# This is a comment
main.cpp
src/
Ignore:
src/secret.cpp
Style:
# these get passed to the AI as parameters when making docs
-dont use emojis
-be professional
-be concise
Check which files have changed since the last update.
docgen statusGenerate a SUMMARY.md file with a high-level overview of your project.
docgen summaryGenerate a dependency graph in DOT format (Graphviz) at .docgen/graph.dot.
docgen graphRemove documentation for files that are no longer tracked.
docgen cleanVerify if documentation is up-to-date (useful for CI/CD).
docgen validateUpdate docgen to the latest version.
docgen upgradeRun this command to reset your documentation repository (asks for confirmation)
docgen rebootDocgen comes with a config.json file within your ./docgen folder. In it you can configure A.I parameters
You can also run
$ docgen config
Usage: docgen config <key> <value>
Keys: mode, protocol, key, modelTo verify if Docgen can connect to the configured AI provider:
docgen config checkDocgen supports two modes: local (default, uses Ollama) and cloud (uses external APIs).
1. Local Mode (Ollama) This is the default. It requires Ollama running locally.
# Set mode to local
docgen config mode local
# Set the model (e.g., qwen2.5-coder:7b, llama3, mistral)
docgen config model qwen2.5-coder:7b2. Cloud Mode (OpenAI, Google, etc.) Use this to connect to OpenAI, Google Gemini, or compatible APIs.
# Set mode to cloud
docgen config mode cloud
# Set your API key
docgen config key sk-your-api-key-here
# Set the model ID (e.g., gpt-4o, gemini-1.5-flash)
docgen config model gpt-4o
# Set the protocol (openai, google, or simple)
# 'openai' is standard for most providers including DeepSeek, Groq, etc.
docgen config protocol openai| Key | Description | Values |
|---|---|---|
mode |
Determines the backend to use. | local, cloud |
key |
API Key for cloud providers. | Your API Key |
model |
The model identifier to use. | e.g., gpt-4o, llama3 |
protocol |
The API format to use. | openai, google, simple |