AI-powered code documentation generator supporting Gemini, ChatGPT, and Claude
npm install gendocs-aibash
npm install -g gendocs-ai
`
$3
`bash
npx gendocs-ai init
`
$3
`bash
npm install gendocs-ai --save-dev
`
Quick Start
1. Initialize Configuration
`bash
gendocs-ai init
`
This will prompt you to:
- Select your AI provider (Gemini, OpenAI, or Claude)
- Enter your API key
- Optionally specify a model
2. Generate Documentation
`bash
Generate full documentation
gendocs-ai generate
Generate only README
gendocs-ai readme
Add JSDoc comments
gendocs-ai jsdoc
`
API 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
$3
#### init
Initialize configuration with interactive prompts:
`bash
gendocs-ai init
`
#### generate
Generate comprehensive documentation (README + API docs):
`bash
gendocs-ai generate [options]
Options:
-d, --dir Target directory to scan (default: ".")
-o, --output Output directory for docs (default: "./docs")
`
Example:
`bash
gendocs-ai generate --dir ./src --output ./documentation
`
#### readme
Generate only README.md:
`bash
gendocs-ai readme [options]
Options:
-d, --dir Target directory to scan (default: ".")
`
#### jsdoc
Add JSDoc comments to your code:
`bash
gendocs-ai jsdoc [options]
Options:
-d, --dir Target directory to scan (default: ".")
-f, --file Specific file to process
`
Example:
`bash
Process all files in src/
gendocs-ai jsdoc --dir ./src
Process a specific file
gendocs-ai jsdoc --file ./src/utils/helper.js
`
#### config
Show current configuration:
`bash
gendocs-ai config
`
Configuration
Configuration is stored in .gendocs-ai.json in your project root:
`json
{
"provider": "gemini",
"apiKey": "your-api-key",
"model": "gemini-pro"
}
`
$3
- 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_modules
- dist
- build
- .git
- coverage
- .next
- out
Examples
$3
`bash
Navigate to your project
cd my-react-app
Initialize
gendocs-ai init
Generate all documentation
gendocs-ai generate --dir ./src --output ./docs
`
$3
`bash
Add JSDoc comments to all files
gendocs-ai jsdoc --dir ./lib
Add JSDoc to a specific file
gendocs-ai jsdoc --file ./lib/database.js
`
$3
`bash
gendocs-ai readme --dir ./routes
``