gendocs-ai
v1.0.4
Published
AI-powered code documentation generator supporting Gemini, ChatGPT, and Claude
Maintainers
Readme
GenDocs AI
AI-powered documentation generator that automatically creates comprehensive documentation for your codebase using Google Gemini, OpenAI (ChatGPT), or Anthropic (Claude).
Features
- Multiple AI Providers: Support for Google Gemini, OpenAI, and Claude
- Automatic README Generation: Create professional README.md files
- API Documentation: Generate detailed API documentation from your code
- JSDoc Comments: Automatically add JSDoc comments to functions
- Code Analysis: Parse and analyze JavaScript/TypeScript codebases
- Fast & Easy: Simple CLI interface with interactive setup
- Beautiful Output: Color-coded terminal output with progress indicators
Installation
Global Installation
npm install -g gendocs-aiUse with npx (No Installation Required)
npx gendocs-ai initLocal Installation
npm install gendocs-ai --save-devQuick Start
- Initialize Configuration
gendocs-ai initThis will prompt you to:
- Select your AI provider (Gemini, OpenAI, or Claude)
- Enter your API key
- Optionally specify a model
- Generate Documentation
# Generate full documentation
gendocs-ai generate
# Generate only README
gendocs-ai readme
# Add JSDoc comments
gendocs-ai jsdocAPI Keys
You'll need an API key from one of these providers:
- Google Gemini: Get your key at Google AI Studio
- OpenAI: Get your key at OpenAI Platform
- Anthropic Claude: Get your key at Anthropic Console
Usage
Commands
init
Initialize configuration with interactive prompts:
gendocs-ai initgenerate
Generate comprehensive documentation (README + API docs):
gendocs-ai generate [options]
Options:
-d, --dir <directory> Target directory to scan (default: ".")
-o, --output <directory> Output directory for docs (default: "./docs")Example:
gendocs-ai generate --dir ./src --output ./documentationreadme
Generate only README.md:
gendocs-ai readme [options]
Options:
-d, --dir <directory> Target directory to scan (default: ".")jsdoc
Add JSDoc comments to your code:
gendocs-ai jsdoc [options]
Options:
-d, --dir <directory> Target directory to scan (default: ".")
-f, --file <file> Specific file to processExample:
# Process all files in src/
gendocs-ai jsdoc --dir ./src
# Process a specific file
gendocs-ai jsdoc --file ./src/utils/helper.jsconfig
Show current configuration:
gendocs-ai configConfiguration
Configuration is stored in .gendocs-ai.json in your project root:
{
"provider": "gemini",
"apiKey": "your-api-key",
"model": "gemini-pro"
}Default Models
- Gemini:
gemini-2.5-flash - OpenAI:
gpt-4o - Claude:
claude-3-sonnet
Supported File Types
.js- JavaScript.ts- TypeScript.jsx- React JSX.tsx- TypeScript JSX.mjs- ES Modules.cjs- CommonJS
Ignored Directories
The following directories are automatically ignored:
node_modulesdistbuild.gitcoverage.nextout
Examples
Generate Documentation for a React Project
# Navigate to your project
cd my-react-app
# Initialize
gendocs-ai init
# Generate all documentation
gendocs-ai generate --dir ./src --output ./docsAdd JSDoc to a Node.js Project
# Add JSDoc comments to all files
gendocs-ai jsdoc --dir ./lib
# Add JSDoc to a specific file
gendocs-ai jsdoc --file ./lib/database.jsGenerate README for an Express API
gendocs-ai readme --dir ./routesOutput Examples
README.md
Generated with project overview, features, installation instructions, usage examples, and API documentation.
API.md
Comprehensive API documentation including:
- Function signatures
- Parameters and return types
- Class methods and properties
- Import/export information
api.json
Machine-readable JSON export of your entire codebase structure.
License
MIT © Pratham Darji
Acknowledgments
- Built with Commander.js for CLI
- Powered by Babel for code parsing
- AI providers: Google Gemini, OpenAI, Anthropic Claude
Support
- 📧 Email: [email protected]
- 🐛 Issues: GitHub Issues
- 💬 Discussions: GitHub Discussions
Made with ❤️ by Pratham Darji
