AI-powered code documentation generator
Project description
DocuAI
AI-Powered Code Documentation & Analysis
Generate comprehensive documentation and analyze code quality for Python, JavaScript, TypeScript, and React projects using GPT-5.
🚀 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
.mdfiles - 🔍 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 # or ~/.zshrc
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
# Single file (saves to filename_docs.md)
docuai generate app.py
# Entire project (saves to dirname_documentation.md)
docuai generate .
# GitHub repository
docuai generate https://github.com/username/repo --output docs.md
Analyze Code Quality
# Single file (saves to filename_analysis.md)
docuai analyze app.py
# Entire project (saves to dirname_analysis.md)
docuai analyze .
# Custom output
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
# Analyze entire codebase
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 # Single file
docuai generate . # Current directory
docuai generate /path/to/project # Specific directory
docuai generate https://github.com/user/repo # GitHub repo
analyze
Analyze code for quality issues, smells, and improvements.
Syntax:
docuai analyze <input_path> [--output OUTPUT]
Examples:
docuai analyze app.py # Single file
docuai analyze . # Current directory
docuai analyze https://github.com/user/repo --output report.md
🌍 Supported Languages
| Language | File Extensions | Parser |
|---|---|---|
| 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,venvnode_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:
| Command | Default Output |
|---|---|
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
--outputto 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
- PyPI: https://pypi.org/project/docuai/
- GitHub: https://github.com/AyushJaiswal18/DocuAI
- Issues: https://github.com/AyushJaiswal18/DocuAI/issues
🙏 Acknowledgments
- Built with LangChain
- Powered by OpenAI GPT-5
- CLI built with Typer
Made with ❤️ by Ayush Jaiswal
If you find DocuAI useful, please consider giving it a ⭐ on GitHub!
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file docuai-0.3.1.tar.gz.
File metadata
- Download URL: docuai-0.3.1.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b2958bbe8f5b99a6d6d4dff41703f3f39ec2c3c052dd4e33372d721e2724575
|
|
| MD5 |
8c98f980b04d0d9c94157d0bac2c40f9
|
|
| BLAKE2b-256 |
ee3cfa0a59d8059d7c932f975d6782a3b28add15d3b28fb44795a0b092099d3a
|
File details
Details for the file docuai-0.3.1-py3-none-any.whl.
File metadata
- Download URL: docuai-0.3.1-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f8165d10b033b22706db9d9c5416a714560cbba746bafa873ca4fe8a8abcdfd
|
|
| MD5 |
aad533484424345c742369729343f8c3
|
|
| BLAKE2b-256 |
9efd07a619164fa0c83da845deeac89776bc8540e1a9b58f095bc521c78e59bd
|