DocuAI
AI-Powered Code Documentation & Analysis

Generate comprehensive documentation and analyze code quality for Python, JavaScript, TypeScript, and React projects using GPT-5.
Installation • Quick Start • Features • Documentation
🚀 Features
- 🤖 AI-Powered - Uses OpenAI's GPT-5 for intelligent documentation generation
- ⚡ Multi-Language - Supports Python, JavaScript, TypeScript, JSX, and TSX
- 📝 Auto-Save - All reports automatically saved to
.md files
- 🔍 Code Analysis - Identifies code smells, security issues, and architectural problems
- 🌐 GitHub Integration - Analyze repositories directly from URLs
- 📂 Recursive Traversal - Processes entire projects including subdirectories
- 🎯 Repo-Level Insights - Generates comprehensive project-wide documentation
📦 Installation
pip install docuai
Requirements
- Python 3.9 or higher
- OpenAI API key
⚙️ Configuration
DocuAI requires an OpenAI API key. Set it using one of these methods:
Option 1: Environment Variable (Recommended)
export OPENAI_API_KEY='your-api-key-here'
Add to your shell profile for persistence:
echo "export OPENAI_API_KEY='your-key'" >> ~/.bashrc
Option 2: .env File
Create a .env file in your project directory:
OPENAI_API_KEY=your-api-key-here
Option 3: Per-Command
OPENAI_API_KEY='your-key' docuai generate script.py
🎯 Quick Start
Generate Documentation
docuai generate app.py
docuai generate .
docuai generate https://github.com/username/repo --output docs.md
Analyze Code Quality
docuai analyze app.py
docuai analyze .
docuai analyze . --output analysis.md
📚 Usage Examples
Python Project
docuai generate my_project/
Output: Comprehensive documentation including:
- Project overview and architecture
- Class and function documentation
- Usage examples
- Best practices
React/TypeScript Application
docuai analyze src/
Output: Code quality report with:
- Code smells and anti-patterns
- Security vulnerabilities
- Performance issues
- Refactoring suggestions
Full-Stack Project Analysis
docuai generate . --output PROJECT_DOCS.md
🛠️ Commands
generate
Generate comprehensive documentation for code files, directories, or repositories.
Syntax:
docuai generate <input_path> [--output OUTPUT]
Arguments:
input_path - File path, directory path, or GitHub URL
--output - Optional custom output filename
Examples:
docuai generate app.py
docuai generate .
docuai generate /path/to/project
docuai generate https://github.com/user/repo
analyze
Analyze code for quality issues, smells, and improvements.
Syntax:
docuai analyze <input_path> [--output OUTPUT]
Examples:
docuai analyze app.py
docuai analyze .
docuai analyze https://github.com/user/repo --output report.md
🌍 Supported Languages
| Python | .py | AST |
| JavaScript | .js, .jsx | Esprima |
| TypeScript | .ts, .tsx | Esprima |
📖 Documentation
Directory Traversal
DocuAI recursively processes all supported files in directories and subdirectories.
Automatically Ignored:
.git, .venv, venv
node_modules
__pycache__, dist, build
.idea, .vscode
GitHub Integration
Analyze any public GitHub repository:
docuai generate https://github.com/username/repo
How it works:
- Clones repository to temporary directory
- Processes all supported files
- Generates documentation
- Cleans up temporary files
For private repositories:
git clone https://github.com/username/private-repo
cd private-repo
docuai generate .
Output Files
All commands automatically save results to .md files:
docuai generate file.py | file_docs.md |
docuai analyze file.py | file_analysis.md |
docuai generate . | dirname_documentation.md |
docuai analyze . | dirname_analysis.md |
Use --output to specify custom filenames.
🔧 Troubleshooting
API Key Not Found
ValueError: OpenAI API key not found
Solution: Set your API key using one of the methods in Configuration
Unsupported File Type
ValueError: Unsupported file type
Solution: DocuAI only supports .py, .js, .jsx, .ts, .tsx files
No Files Found
No supported files found
Solution: Ensure your directory contains supported file types and isn't in the ignore list
💡 Tips
- Large Projects: Use
--output to save results to a specific file
- API Costs: DocuAI uses GPT-5, which costs ~$0.01 per file analyzed
- Best Results: Ensure your code has clear function/class names and comments
- Performance: Processing large repositories may take a few minutes
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature)
- Commit your changes (
git commit -m 'Add some AmazingFeature')
- Push to the branch (
git push origin feature/AmazingFeature)
- Open a Pull Request
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
🔗 Links
🙏 Acknowledgments
Made with ❤️ by Ayush Jaiswal
If you find DocuAI useful, please consider giving it a ⭐ on GitHub!