CLI

Read this page in the documentation

CLI The package installs a single binary, available under two names: It covers two things: local project work (scaffolding, model generation from a live database, migrations, seeders, diagrams) and cloud/account work (logging in, pulling credentials, managing databases, buckets, secrets and teams). Both are served by dist/cli.js. orm-cli with no arguments, or --help, prints the full flag reference. Local project commands Command | Does | --- | --- | init [--directory <path>] | Scaffold config/, models/ and migrations/ with a zero-config SQLite setup. | model:create --dialect <d> --database <db> [--table <t>] [--out-dir ./models] | Generate model files by introspecting a live database. | migration:create -- --name <name> | New migration file. | migration:run [-- --name <migration>] | Apply pending migrations. | migration:revert [-- --name <m> \| --steps <n>] | Roll back. | migration:status | What has run and what has not. | seeder:create -- --name <name> | New seeder file. | db:seed / db:seed:undo / db:seed:status | Run, undo and inspect seeders. | db:create / db:drop | Create or drop the configured database. | diagram:model --file ./User.json --out ./diagrams/User.svg | Render a model diagram. | diagram:er --file ./schema.json --out ./diagrams/er.svg | Render an ER diagram. | diagram:migration --file ./migration.json | Render a migration diagram. | init Defaults to SQLite — matching Prorm's own default — and reads DBDIALECT plus the other DB environment variables to target something else. model:create Connects to the database, reads its tables through showTables() / describeTable(), maps each SQL column type onto a DataTypes factory, and writes one <ModelName>.ts per table plus an index.ts barrel. Add --table to generate a single model. This is the fastest way onto an existing schema: generate, read what came out, then hand-edit the associations and validations the database cannot tell you about. Migrations and seeders The -- separator matters: flags after it go to the command rather than to npm/npx. See Migrations for the file format and the QueryInterface you write against. Cloud commands The second half of the CLI talks to the prorm cloud service — provisioned databases, object buckets, secrets and teams. Commands are namespaced and grouped in --help. Group | Commands | --- | --- | Auth | auth login, auth logout, auth status, auth whoami, auth token, auth refresh | Pull | pull creds, pull db, pull env, pull bucket, pull secrets | Databases | db add, db list, db use, db test, db remove, db buy | Storage | bucket add, bucket list, store push, store pull, store list, store rm | Secrets | secrets set, secrets get, secrets list, secrets rm | Teams | team create, team list, team switch, team current, team invite, team members, team remove-member | API keys | key create, key list, key revoke | Code | code push, code pull, code list, code rm | Runners | run, runs list, runs get, run logs, run stop | Scaffold | new, add | Billing | billing status, billing plan, billing usage, billing buy, billing portal | Config | config get, config set, config list, config unset, config path | User | user get, user update, user avatar | System | version, upgrade, completion, status, ping, search, open | Logging in The token is stored in the OS keychain where one is available, falling back to the config file otherwise. auth token prints it for scripting; auth status says whether you are logged in without printing anything secret. Pulling credentials into a project This writes real credentials to disk. .env belongs in .gitignore, and stdout exists so a CI job can pipe them into a secret store rather than leave a file behind. Output formats Most read commands take --json (and the framework supports table, json, csv, tsv), so they compose with jq and friends: team <slug> scopes a command to a team; team switch sets the default so you can stop passing it. Shell completion How the commands are organised Local commands live in src/cli.ts as a direct dispatch. Cloud commands are modules under src/cli/commands/, each exporting a commands: Command[] array registered with the small framework in src/cli/framework.ts. An unknown command falls through from the local dispatcher into that registry, and an unrecognised name gets a "did you mean" suggestion. A Command declares its name (which may be namespaced with a space, like db add), description, group, aliases, positionals, flags — with types, choices, defaults and required — examples, and a run function. Adding a command means writing that object and listing its module in src/cli/commands/index.ts; there is no central switch to edit. Related reading cli — how the CLI was consolidated Migrations Diagrams Defining models