ts-doc-extract
v0.1.1
Published
Extract AST documentation from TypeScript/JavaScript for spec-driver
Maintainers
Readme
ts-doc-extract
AST-based documentation extractor for TypeScript and JavaScript using ts-morph.
Usage
npx ts-doc-extract <file.ts> [--variant=public|internal]Outputs JSON to stdout with complete AST information including:
- All exports (functions, classes, types, interfaces, enums, constants)
- Full type signatures
- All comment types (JSDoc, block, single-line) preserved exactly
- Parameter information
- Return types
Variants
public(default): Only public exported symbolsinternal: All symbols including private/protected
Requirements
- Node.js 18+
- TypeScript/JavaScript project
Example
# Extract public API from a TypeScript file
npx ts-doc-extract src/index.ts --variant=public
# Extract all symbols including private/protected
npx ts-doc-extract src/index.ts --variant=internalOutput Format
JSON structure with deterministic ordering:
{
"functions": [...],
"classes": [...],
"interfaces": [...],
"types": [...],
"enums": [...],
"constants": [...]
}Used by
Part of the spec-driver toolchain for generating deterministic code documentation.
