A simple CLI tool that converts any documentation page into a clean, structured README file using AI.
Takes a documentation URL and generates a complete README with:
- Introduction and key features
- Installation steps
- Code examples
- Supports Arabic and English output
- Smart Content Processing: Fetches, cleans, and structures any documentation page
- Intelligent Chunking: Automatically splits long content while preserving headings and context
- Dynamic Filenames: Extracts meaningful filenames from URLs (e.g.,
machine-learning.md) - Bilingual Support: Generate documentation in English or Arabic
- Auto-Merge: Seamlessly combines multiple chunks into one coherent document
- Metadata Injection: Adds source URL, language, and timestamp to every output
- Error Handling: Validates URLs and handles errors gracefully
- Progress Tracking: Shows real-time progress for each processing step
URL → Fetch Content → Clean → Split into Chunks → AI Processing → Generate README
- You provide a documentation URL
- Tool fetches and cleans the content
- Splits content into chunks (if too long)
- Sends to AI (Groq) to generate README
- Saves output to
output/folder
- Python 3.8+
- Groq API key
- Clone the repository
git clone https://github.com/RayidAlshammari/docgen-cli.git
cd docgen-cli- Install uv (if you don't have it)
curl -LsSf https://astral.sh/uv/install.sh | sh- Create
.envfile
cp .env.example .env- Add your API key to
.env
GROQ_API_KEY=your_api_key_here
Run with uv:
uv run docgen/cli.pyFollow the prompts:
- Enter documentation URL (e.g.,
https://example.com/docs) - Choose language:
1for English,2for Arabic - Wait for processing
- Find your README in
output/folder
$ uv run docgen/cli.py
Welcome to DocGen CLI!
Enter the documentation URL: https://www.geeksforgeeks.org/machine-learning/
Select explanation language:
1️⃣ English
2️⃣ Arabic
Enter 1 or 2: 2
Processing chunk 1/1...
✅ README has been saved in output/ directory!Output: output/machine-learning.md
docgen-cli/
├── docgen/
│ ├── cli.py # Main entry point
│ ├── fetcher.py # Fetches URL content
│ ├── cleaner.py # Cleans HTML content
│ ├── chunker.py # Splits long content
│ ├── llm.py # AI integration
│ ├── prompt.py # Prompt templates
│ ├── renderer.py # Saves output
│ └── validator.py # Input validation
├── prompts/
│ ├── en.txt # English prompt
│ └── ar.txt # Arabic prompt
├── output/ # Generated READMEs
├── .env.example # API key template
└── README.md
- Free Groq API has rate limits
- Large documentation may take a few minutes
- Output is saved with timestamp and language info
MIT