CLI v0.2.0

@devsync/cli Command Reference

Complete command-line interface documentation for scanning schema drift, dry-run migration generation, and platform synchronization.

Overview

The @devsync/cli is a developer-first tool designed to extract local codebase schemas (Prisma, Drizzle, TypeORM, Kysely), connect to target database environments read-only, and generate deterministic migration previews without modifying your database.

bash
npm install -g @devsync/cli
dev-sync --help

Primary Commands

1. dev-sync scan

Scans local ORM files against your target database to detect structural mismatches, missing columns, type differences, or unindexed foreign keys.

bash
dev-sync scan \
  --schema ./prisma/schema.prisma \
  --db "postgresql://user:pass@localhost:5432/mydb" \
  --check
Command Flags:
--schema <path> Path to local ORM schema file
--db <url> Target database connection string
--check Exit code 1 if drift is detected (Ideal for CI/CD)
--json Output structured JSON scan report

2. dev-sync fix

Generates DDL SQL migration statements and rollback strategies for all detected schema mismatches.

bash
dev-sync fix --preview

3. dev-sync init

Initializes a local project configuration file (.devsync/config.json).

bash
dev-sync init

4. dev-sync login

Authenticates your CLI session with your Dev-Sync.dev cloud workspace.

bash
dev-sync login --key <your-api-token>