7000pctAUTO de36111b6d
Some checks failed
CI / test (push) Has been cancelled
fix: resolve CI linting violations
- Fixed import sorting in cli.py, __main__.py, detectors/__init__.py, base.py, python.py, rust.py, openapi.py, models/__init__.py
- Removed unused imports (sys, asyncio, Observer, Text, Parameter, ParameterIn, HTTPMethod, DocConfig, List, Optional)
- Removed trailing whitespace from blank lines
- Split lines exceeding 100 characters
- Added missing __init__ docstrings in generators and static/templates packages
2026-01-31 17:26:23 +00:00
2026-01-31 17:26:23 +00:00
2026-01-31 17:09:20 +00:00
2026-01-31 17:09:21 +00:00
2026-01-31 17:09:21 +00:00

DocGen-CLI

A CLI tool that automatically scans codebases, detects API endpoints and function signatures, and generates beautiful interactive self-hosted API documentation with zero configuration. Works offline with no cloud dependencies.

Features

  • Multi-language endpoint detection - Auto-detects endpoints in Python, JavaScript, Go, and Rust codebases
  • Stripe-like interactive HTML docs - Beautiful documentation with expandable endpoint details
  • Markdown output format - Clean documentation suitable for GitHub Wiki
  • Live reload development server - Watch source files and regenerate docs automatically
  • Zero configuration - Auto-detects framework and scanning options
  • Beautiful terminal output - Colored progress, endpoint counts, and summary information

Installation

Install via pip:

pip install docgen-cli

Or install from source:

git clone https://7000pct.gitea.bloupla.net/7000pctAUTO/docgen-cli.git
cd docgen-cli
pip install -e .

Quick Start

Scan your project and generate documentation:

docgen generate

Start a live-reload development server:

docgen serve

Detect endpoints without generating docs:

docgen detect

Usage

Generate Documentation

docgen generate [INPUT_DIR] [OPTIONS]

Options:

  • -o, --output DIRECTORY - Output directory (default: docs)
  • -F, --format FORMAT - Output format: html, markdown, openapi (default: html)
  • -t, --theme THEME - Theme for HTML output (default: default)
  • -f, --framework FRAMEWORK - Specific framework to use
  • --title TITLE - Documentation title
  • -d, --description TEXT - Documentation description
  • -v, --version VERSION - API version
  • --verbose - Enable verbose output

Serve Documentation

docgen serve [DOCS_DIR] [OPTIONS]

Options:

  • -h, --host HOST - Host to bind to (default: 127.0.0.1)
  • -p, --port PORT - Port to bind to (default: 8000)
  • --no-reload - Disable auto-reload on changes

Detect Endpoints

docgen detect [INPUT_DIR] [OPTIONS]

Options:

  • -f, --framework FRAMEWORK - Specific framework to use
  • --no-recursive - Disable recursive scanning

Initialize Configuration

docgen init --output .

Configuration

Create a docgen.toml file to customize behavior:

[tool.docgen]
input-dir = "."
output-dir = "docs"
format = "html"
theme = "default"
title = "My API"
version = "1.0.0"

Environment Variables

Variable Default Description
DOCGEN_OUTPUT docs Output directory
DOCGEN_FORMAT html Output format
DOCGEN_THEME default Theme name
DOCGEN_VERBOSE false Enable verbose output

Supported Frameworks

Python

  • FastAPI
  • Flask
  • Django

JavaScript/TypeScript

  • Express
  • Fastify

Go

  • Gin
  • chi

Rust

  • Actix-web

Output Formats

HTML

Interactive documentation with:

  • Expandable endpoint details
  • Method badges with color coding
  • Interactive cURL generator
  • Sidebar navigation with search
  • Responsive design

Markdown

Clean Markdown documentation with:

  • Endpoint tables
  • Parameter documentation
  • Response examples
  • GitHub-compatible formatting

OpenAPI

Standard OpenAPI 3.0 specification:

  • JSON output
  • Compatible with Swagger UI
  • Full schema support
  • Security definitions

Examples

Basic FastAPI Documentation

from fastapi import FastAPI

app = FastAPI()

@app.get("/users", tags=["users"])
async def list_users():
    """List all users"""
    return {"users": []}

@app.post("/users", tags=["users"])
async def create_user(name: str):
    """Create a new user"""
    return {"id": 1, "name": name}

Generate docs:

docgen generate --title "User API" --format html

Express.js Documentation

const express = require('express');
const router = express.Router();

router.get('/items', (req, res) => {
    res.json({ items: [] });
});

router.post('/items', (req, res) => {
    res.status(201).json({ id: 1 });
});

Generate docs:

docgen generate --framework javascript --format markdown

License

MIT License - see LICENSE file for details.

Description
A CLI tool that automatically scans codebases, detects API endpoints and function signatures, and generates beautiful interactive self-hosted API documentation with zero configuration.
Readme MIT 146 KiB
2026-01-31 17:15:26 +00:00
Languages
Python 72.8%
CSS 13.1%
Jinja 9.7%
JavaScript 4.4%