jsdoc-gen

Verified·Scanned 2/18/2026

Adds JSDoc/TSDoc comments to source files by sending file contents to OpenAI and optionally writing changes back to the filesystem. It reads/writes files matching **/*.{ts,tsx,js,jsx} and requires OPENAI_API_KEY to call OpenAI via openai.chat.completions.create.

from clawhub.ai·vdbb100a·56.1 KB·0 installs
Scanned from 1.0.0 at dbb100a · Transparency log ↗
$ vett add clawhub.ai/lxgicstudios/jsdoc-gen

ai-docs

Adds JSDoc or TSDoc comments to your code. Point it at files or a directory and it'll document your exported functions, classes, and interfaces without touching any logic.

Install

npm install -g ai-docs

Setup

export OPENAI_API_KEY=sk-your-key-here

Usage

# Preview docs for a directory (prints to stdout)
npx ai-docs src/ --style jsdoc

# TSDoc style
npx ai-docs src/ --style tsdoc

# Actually write the changes back to the files
npx ai-docs src/ --style jsdoc --write

# Single file
npx ai-docs src/utils.ts --style jsdoc

# Glob patterns work too
npx ai-docs "src/**/*.ts" --style tsdoc

What it does

Reads each file, sends it to OpenAI, gets back the same file with doc comments added to all the exported stuff. It won't change your code. It just adds comments above functions, classes, interfaces, and types.

Tips

  • Run without --write first to preview what it'll do
  • It skips files over 20KB (they'd blow the context window anyway)
  • Automatically ignores node_modules and dist folders