Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

TypeORM CLI

$ typeorm Official Med Risk
TypeORM · Database & Data · MIT · macos / linux / windows

TypeORM CLI (typeorm) inspects TypeScript/JavaScript entities against a database DataSource to list migrations (migration:show), generate diffed migration classes (migration:generate), preview pending schema SQL (schema:log), and run migrations (migration:run).

FCRS-1.0 Score
73 /100
Usable w/ Caveats
Medium Confidence
Zero-Friction Install
npm install -D typeorm
CLI vs MCP Decision CLI Preferred vs MCP

typeorm compiles and diffs local TypeScript @Entity classes via -d data-source directly inside the repo.

Agent-Readiness Checklist

— JSON Output
— Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 17 / 25

Predictable subcommands (migration:show, schema:log), though TypeScript projects often need typeorm-ts-node-commonjs / typeorm-ts-node-esm wrappers and output lacks --json.

  • Non-interactive migration:show and schema:log
  • Requires -d DataSource path and lacks --json
Trust & Safety 18 / 25

schema:log and migration:generate allow inspection before execution, but migration:run lacks --dry-run and schema:sync/schema:drop are dangerous if run blindly.

  • schema:log previews DDL without applying; no --dry-run on migration:run
Setup & Portability 12 / 15

Standard npm CLI, though running against .ts DataSource files requires ts-node or pre-compiled JS output.

  • Requires Node.js, ts-node (for TS), and project DB driver packages
Utility & Efficiency 11 / 15

Automatically diffs TypeScript @Entity metadata against live DB schemas to scaffold up/down migrations.

  • Automates entity-to-SQL migration generation
Maintenance & Lineage 8 / 10

Official typeorm/typeorm project under MIT license with large TypeScript ecosystem usage.

  • Official typeorm/typeorm repository under MIT
Docs & Verifiability 7 / 10

Documented CLI commands at typeorm.io/using-cli, though TS/ESM loader setup often trips users up.

  • CLI reference at typeorm.io/using-cli

Security, Auth & Guardrails

Auth Modes
Config File Env API Key
Credential Storage

Reads connection settings from the -d <data-source> file (commonly backed by DATABASE_URL or DB_* env vars).

Side Effects
Read-Only Local Write Remote Write Destructive
Cost & Quotas

MIT open-source npm package; free to use.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# TypeORM CLI Agent Rules
- Always pass `-d <path-to-data-source>` and inspect `schema:log` or generated migration SQL before running `migration:run`.
- NEVER run `schema:drop` or `schema:sync` against shared/production databases.

Agent-Ready Command Recipes

Safe Read-Only Queries

List applied and pending migrations
npx typeorm-ts-node-commonjs migration:show -d src/data-source.ts

Prints [X] for executed migrations and [ ] for pending migrations without mutating the DB.

Preview schema sync SQL without executing
npx typeorm-ts-node-commonjs schema:log -d src/data-source.ts

Outputs the exact SQL statements schema:sync would run so agents can inspect entity drift safely.

Controlled Writes & Previews

Generate a timestamped migration file from entity diffs
npx typeorm-ts-node-commonjs migration:generate src/migrations/UpdateSchema -d src/data-source.ts

Writes a reviewable up/down TypeScript migration file locally without applying it to the database.

Strengths for Agents

  • + schema:log prints exact pending DDL SQL without touching the database.
  • + migration:generate creates inspectable TypeScript up/down files from entity diffs.
  • + migration:show clearly marks executed vs pending migrations.

Caveats & Pitfalls

  • ! No --json output and no --dry-run flag on migration:run.
  • ! TypeScript projects must invoke typeorm-ts-node-commonjs or typeorm-ts-node-esm (or compile first).

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI