Skip to main content

AI-powered code documentation generator

Project description

DocuAI

AI-Powered Code Documentation & Analysis

PyPI version Python 3.9+ License: MIT

Generate comprehensive documentation and analyze code quality for Python, JavaScript, TypeScript, and React projects using GPT-5.

InstallationQuick StartFeaturesDocumentation


🚀 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  # 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, 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:

  1. Clones repository to temporary directory
  2. Processes all supported files
  3. Generates documentation
  4. 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 --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.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. 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!

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

docuai-0.2.1.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

docuai-0.2.1-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file docuai-0.2.1.tar.gz.

File metadata

  • Download URL: docuai-0.2.1.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for docuai-0.2.1.tar.gz
Algorithm Hash digest
SHA256 c17e6496b0a00637da9cc61ee65ae1b41ab81b692fec9180f18face433457c13
MD5 fbe29f4c700ebd7b33bca52a24f35d9a
BLAKE2b-256 8f5911e1c0427cfc37f1771ae3be50cd74b469a42584c397b6bde9b34720b4ae

See more details on using hashes here.

File details

Details for the file docuai-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: docuai-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for docuai-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1ab6eba1bb667cb405d85350dc98893c5008a77087b7facb703aa0de1dfc85aa
MD5 ff03af016ecd8be30c69cbf45d1fc93f
BLAKE2b-256 a6ef75a46a51e48bc5655121303f49c8c4ef7a7b36ce00a9708b95c6f886b3f2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page