Skip to content

ajitzote/auto-documentor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

auto-documentor

Auto-documentor is a TypeScript CLI that scans a codebase and generates a structured NEW_README.md using OpenAI.

What It Does

  • Crawls source files using fast-glob
  • Respects .gitignore, plus node_modules and .git
  • Builds a project-level analysis prompt from:
    • package.json
    • README.md (if present)
    • discovered entry points
    • key source files
  • Calls OpenAI to synthesize:
    • Mission
    • Architecture
    • Features
    • API Reference
  • Writes output to NEW_README.md in the target repository

Requirements

  • Node.js 20+
  • npm
  • OpenAI API key

Installation

npm install

Build

npm run build

Usage

1. Set your API key

PowerShell:

$env:OPENAI_API_KEY="your_api_key_here"

macOS/Linux:

export OPENAI_API_KEY="your_api_key_here"

2. Run against a target repo

From this project root:

npm run dev -- --path "/absolute/path/to/target-repo"

Or using built output:

node dist/index.js --path "/absolute/path/to/target-repo"

You can also pass API key directly:

node dist/index.js --path "/absolute/path/to/target-repo" --api-key "your_api_key_here"

Use As a Global Local CLI

After building, link it locally:

npm run build
npm link

Then run from anywhere:

auto-documentor --path "/absolute/path/to/target-repo"

CLI Options

  • --path <path>: required, path to repository to analyze
  • --api-key <key>: optional, overrides OPENAI_API_KEY

Output

  • Generates: NEW_README.md
  • Location: inside the target repo passed via --path

Scripts

  • npm run dev: run CLI with tsx (no build step needed)
  • npm run build: compile TypeScript to dist/
  • npm run start: run compiled CLI from dist/index.js
  • npm run typecheck: TypeScript checks only

Example

npm run dev -- --path "D:/work/my-service"

Expected console output:

Scanned <N> files.
Root nodes in tree: <M>
Generated README: <target>/NEW_README.md

Troubleshooting

OPENAI_API_KEY missing

If you see:

Missing OpenAI API key. Set OPENAI_API_KEY or pass --api-key.

Set OPENAI_API_KEY in your shell or use --api-key.

Command not found: auto-documentor

Run:

npm run build
npm link

Then open a new terminal and retry.

Roadmap

  • Add --output <file> to customize the generated file path/name.
  • Add --dry-run mode to preview analysis without writing files.
  • Improve API reference extraction with lightweight static analysis.
  • Add tests for scanner, analyzer prompt-building, and README rendering.
  • Add CI checks for typecheck/lint/test on pull requests.

Contributing

Contributions are welcome.

  1. Fork the repo and create a feature branch.
  2. Install dependencies: npm install
  3. Run checks: npm run typecheck
  4. Validate behavior locally: npm run dev -- --path .
  5. Open a pull request with a clear summary of changes.

Please keep changes focused and include updates to docs when behavior changes.

Tech Stack

  • TypeScript
  • Commander
  • fast-glob
  • OpenAI Node SDK

About

`AI-powered TypeScript CLI that scans any codebase and auto-generates a structured README (mission, architecture, features, and API reference).`

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors