Skip to content

Packmatic/codegraph

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodeGraph

CLI tool for analyzing TypeScript/NestJS codebases and generating documentation with drift detection.

Install

npm install
npm run build

Commands

analyze - Generate documentation

node dist/cli.js analyze -i ./src -d <domain> -o ./docs --tsconfig ./tsconfig.json

Options:

  • -i, --input - Source directory (required)
  • -o, --output - Output directory (required)
  • -d, --domain - Domain to analyze
  • --tsconfig - Path to tsconfig.json

diff - Check for drift

Compares current code against a committed snapshot. Use in CI to enforce documentation freshness.

node dist/cli.js diff -i ./src -d <domain> -s ./docs/<domain>-docs.json --tsconfig ./tsconfig.json

Options:

  • -i, --input - Source directory (required)
  • -s, --snapshot - Path to snapshot JSON file (required)
  • -d, --domain - Domain to analyze
  • --tsconfig - Path to tsconfig.json
  • --json - Output as JSON

Exit codes:

  • 0 - No drift detected
  • 1 - Drift detected
  • 2 - Error

Example output:

  ❌ Drift detected in MyDomain domain

  📦 Entities:
     🔄 UserRow (modified)
        ➕ new_field: string
        ➖ removed_field

  🔗 Dependencies:
     ➕ UserRow → RoleRow via role_id

  ──────────────────────────────────────────────────

  💡 To fix:
     1. Run codegraph analyze to update snapshot
     2. Review documentation
     3. Commit updated snapshot

check - Legacy check command

node dist/cli.js check -i ./src -d <domain> -a ./docs --tsconfig ./tsconfig.json

Output Files

  • <domain>-docs.json - Raw graph data (use as snapshot for diff)
  • <domain>-docs.mmd - Mermaid diagram source
  • <domain>-docs.html - Embeddable HTML documentation

CI Integration

- run: |
    node codegraph/dist/cli.js diff \
      -i ./src \
      -d <domain> \
      -s ./docs/<domain>-docs.json \
      --tsconfig ./tsconfig.json

About

CLI tool for analyzing TypeScript/NestJS codebases and generating documentation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 56.5%
  • JavaScript 27.4%
  • Handlebars 16.1%