/massu-doc-gen
An automated documentation generation command that analyzes your source code and produces JSDoc comments, README sections, and API reference documentation. It targets undocumented exports and public APIs, preserving existing documentation while filling gaps.
What It Does
The doc-gen command runs in three phases:
- Coverage analysis -- Scans all exported functions, classes, types, and constants. Identifies which are missing JSDoc comments or have incomplete documentation (missing
@param,@returns, or@throws). - Documentation generation -- For each undocumented item, generates JSDoc comments by analyzing the function signature, body logic, and usage patterns across the codebase.
- README and API doc updates -- Optionally generates or updates a
README.mdsection and anAPI.mdfile with the full exported API surface.
Generated documentation is written directly to the source files. All changes are staged for review before committing.
Usage
Generate JSDoc for all undocumented exports:
/massu-doc-genTarget a specific module:
/massu-doc-gen src/lib/analytics.tsGenerate README and API docs in addition to JSDoc:
/massu-doc-gen --readme --api-docsReport coverage gaps without writing:
/massu-doc-gen --dry-runOutput
## Documentation Generation Report
### Coverage Before
- 142 exported symbols
- 38 documented (27%)
- 104 undocumented
### JSDoc Generated (104 symbols)
- src/lib/analytics.ts: 6 functions documented
- src/server/routers/orders.ts: 12 procedures documented
- src/components/ui/Button.tsx: 4 props interfaces documented
...
### Coverage After
- 142 exported symbols
- 142 documented (100%)
### Files Updated: 23
### README.md: Updated (--readme flag)
### API.md: Created (--api-docs flag)Tips
- Use
--dry-runto see coverage gaps before committing to changes - Generated JSDoc is a starting point -- review and refine descriptions for accuracy
- Run
/massu-doc-genas part of your release workflow to ensure API documentation stays current - Combine with
/massu-reviewto catch documentation that is technically present but misleading - The
--api-docsflag generates a Markdown API reference suitable for publishing to a documentation site