Socket
Book a DemoInstallSign in
Socket

docuai

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

docuai

AI-powered code documentation generator

pipPyPI
Version
0.3.1
Maintainers
1

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:

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

LanguageFile ExtensionsParser
Python.pyAST
JavaScript.js, .jsxEsprima
TypeScript.ts, .tsxEsprima

📖 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:

CommandDefault Output
docuai generate file.pyfile_docs.md
docuai analyze file.pyfile_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.

🙏 Acknowledgments

Made with ❤️ by Ayush Jaiswal

If you find DocuAI useful, please consider giving it a ⭐ on GitHub!

Keywords

documentation

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts