Atlas CLI
$ atlas Official Med RiskAtlas CLI by Ariga manages database schemas declaratively in HCL or SQL across PostgreSQL, MySQL, SQLite, and more. Offers atlas schema inspect, atlas migrate diff, and atlas migrate apply --dry-run so agents can plan and verify DDL safely.
brew install ariga/tap/atlas atlas computes deterministic SQL diffs, renders ER/JSON schemas, and previews migrations via --dry-run natively without needing an MCP server.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Supports Go template --format '{{ json . }}' output, --dry-run, non-interactive flags, and declarative atlas.hcl configs.
- Supports
--format '{{ json . }}'andmigrate apply --dry-run
--dry-run on migrate apply and schema apply plus --dev-url sandboxing protect target databases from blind DDL.
- Explicit
--dry-runplanning and isolated--dev-urldiff calculation
Single static Go binary via Homebrew, npm wrapper, Docker, or direct curl across macOS, Linux, and Windows.
- Static Go binary distributed via
ariga/tap/atlasand@ariga/atlas
Replaces fragile hand-written SQL migration diffs with automated schema-as-code planning.
- Declarative schema inspection, diffing, and migration execution
Actively maintained by Ariga (ariga/atlas), though standard binary bundles proprietary Pro extensions.
- Official
ariga/atlasrepo; split Community vs Pro licensing
Extensive CLI reference and database-specific guides at atlasgo.io.
- Official CLI reference at atlasgo.io/cli-reference
Security, Auth & Guardrails
Local DB URLs passed via --url or atlas.hcl; optional Atlas Cloud token via atlas login or ATLAS_TOKEN.
Community features are free/Apache-2.0; advanced Pro drivers, migrate lint cloud policies, and enterprise features require paid Atlas Pro.
# Atlas CLI Agent Rules - Always run `atlas migrate apply --dry-run` before applying migrations. - Use `atlas schema inspect` first to capture current schema state cleanly. - NEVER run `atlas schema clean` or apply destructive `DROP` migrations without human review.
Agent-Ready Command Recipes
Safe Read-Only Queries
atlas schema inspect --url "$DB_URL" --format '{{ json . }}' Reads current database tables, indexes, and foreign keys as structured JSON without modifying anything.
--dry-run atlas migrate apply --dir file://migrations --url "$DB_URL" --dry-run
Prints exact SQL statements that would execute without applying them.
Controlled Writes & Previews
atlas migrate diff add_orders --dir file://migrations --to file://schema.hcl --dev-url "docker://postgres/16/dev"
Computes and writes a versioned migration file locally for review.
Strengths for Agents
- +
migrate apply --dry-runandschema apply --dry-runmake DDL planning transparent for agents. - +
schema inspect --format '{{ json . }}'outputs full normalized schema graphs as JSON. - + Works consistently across PostgreSQL, MySQL, MariaDB, and SQLite.
Caveats & Pitfalls
- ! Advanced features like
migrate lintand certain enterprise drivers requireatlas login/ Pro licensing. - !
atlas migrate diffneeds an ephemeral--dev-url(often Docker) to normalize SQL cleanly.