CLI Reference
Every `os` command, what it does, and the most useful flags.
The @objectstack/cli package installs a single binary, os (also
available as objectstack). All examples below use the shorter os.
npm i -g @objectstack/cli
os --helpServer commands
os start — zero-config boot
Auto-detects 4 escalating modes:
- Empty boot — no artifact, no config in cwd → boots a bare kernel with the UI + marketplace.
- Project boot —
objectstack.config.tsin cwd → auto-compiles to./dist/objectstack.jsonand boots from it. - Artifact boot —
dist/objectstack.jsonreachable → boots from it directly. - Explicit overrides —
--artifact,--database,--portwin.
os start # default port 3000
os start --port 8080
os start --artifact ./build/myapp.json
os start --artifact https://cdn.example.com/app.json
os start --database file:./data/prod.db
os start --database postgres://user:pass@host:5432/mydb
os start --database libsql://my-db.turso.io --database-auth-token $TURSO
os start --auth-secret "$(openssl rand -hex 32)"
os start --home /var/lib/objectos # persistent home dir
os start --no-ui # API only (no UI/Account portals)HOME directory default:
- with a project config in cwd →
<cwd>/.objectstack(project-local) - without →
~/.objectstack(global, shared across invocations)
os serve — production server
Reads objectstack.config.ts if present, otherwise falls back to
dist/objectstack.json. Use this in production containers when you want
strict behavior.
To boot a published artifact instead, name it with OS_ARTIFACT_URL — an
absolute https://, http:// or file:// URL, with an optional #sha256=
integrity pin in the fragment. It is resolved before any configuration is
read. The older OS_ARTIFACT_PATH spelling is retired: on the ObjectOS
runtime image a non-default value refuses the boot and names the
replacement. See
Environment Variables.
os serve # port 3000
os serve --port 4000 --no-uios dev — development with hot-reload
Watches objectstack.config.ts and src/. Recompiles + reloads on
save. Used as the npm dev script in scaffolded projects.
os dev # port 3000 by default
os dev -p 4000Note os dev asks for the same port os start uses (3000). If that port
is taken it binds the next free one and says so:
↪ server bound to port 3001 (requested 3000).
Project commands
os init — scaffold a new project
os init my-app # interactive
os init my-app -t app --install # auto-install with default pnpm
os init my-app -t app --install -p npm
os init my-app -t plugin # plugin scaffold
os init my-app -t empty # bare minimumTemplates:
| Template | What it gives you |
|---|---|
app | Full app — objects, views, actions, ready to extend |
plugin | Plugin scaffold for distributing reusable capabilities |
empty | Manifest + tsconfig only |
os create — scaffold a kernel code plugin
os create plugin my-pluginos create plugin writes a TypeScript package implementing the kernel's
Plugin contract, which os init does not. os create example was retired
in ObjectStack 17.4: it wrote a subset of what os init writes, and it now
exits with an error that names os init.
Build / validate commands
| Command | Purpose |
|---|---|
os compile (os build) | Compile objectstack.config.ts → dist/objectstack.json |
os validate | Validate config against the protocol schema |
os lint | Style and convention checks (recommended in CI) |
os diff <old> <new> | Compare two configs, detect breaking changes |
os info | Print metadata summary of a config or artifact |
os explain <object> | Human-readable explanation of an object schema |
os doctor | Health check: detects circular deps, broken refs, env issues |
os generate (os g) | Generate TypeScript types / metadata files |
os db clean | One-time SQLite VACUUM + enable incremental auto-vacuum; reports reclaimed bytes (14.5+) |
os doctor is the first thing to run when something feels off — it
catches misconfigurations the runtime would only surface as a runtime
warning.
Since ObjectStack 13, os compile also gates the build on
security posture: validateSecurityPosture errors (unset/aliased
sharing models, high-privilege anchor bindings, leftover role
vocabulary, unqualified field-permission keys, …) fail the build, and
os lint reports them earlier in the loop. If you commit an
access-matrix.json snapshot, any permission-capability drift fails
os compile until re-snapshotted with --update-access-matrix —
every capability change becomes reviewable.
Data commands
Operate on records from the terminal — useful for seeding, migrations, and CI smoke tests.
os data create <object> --data '{"subject": "Hello"}'
os data get <object> <id>
os data query <object> --filter 'status:active' --limit 10
os data update <object> <id> --data '{"done": true}'
os data delete <object> <id>Metadata commands
Read/write metadata records (objects, views, permission sets, …) at runtime.
os meta list <kind>
os meta get <kind> <id>
os meta register <file>
os meta delete <kind> <id>Database migrations — os migrate
os migrate brings a deployment's database in line with its metadata, and
runs the one-off data migrations a release asks for. Every subcommand works
on the database --database-url names, which defaults to $OS_DATABASE_URL
and then to the project's own database — so name the deployment's database
explicitly. Each one boots the app to read its metadata. Back the database up
first. Which commands a given upgrade needs is on
Upgrade and Rollback.
Schema
| Command | What it does |
|---|---|
os migrate plan | Shows how the database has drifted from the metadata, as safe, needs-confirm and destructive changes. Writes nothing |
os migrate apply | Applies the non-destructive changes, after a prompt (--yes skips it). --allow-destructive also drops orphaned columns, tightens NOT NULL and narrows types |
os migrate multi-value-columns | Moves a stale text column to JSON where a field declares multiple: true, the one type change apply never makes. A dry run until --apply |
os migrate unmapped-columns --object NAME | Reads the values left in a retired field's columns, keyed by record id. Read-only. Since 17.7 no runtime door returns those columns, so this is how a conversion reads them before apply --allow-destructive drops them |
os migrate duplicates | Reports identifiers already issued twice and the rows that block a unique index, as JSON. Read-only |
os migrate plan # what would change; writes nothing
os migrate apply --allow-destructive --yes # also drop and tighten (CI / scripts)
os migrate unmapped-columns --object contact --json > contact-unmapped.jsonData migrations
Each of these rewrites rows rather than schema, and is a fact about your
database, not about the version you installed: the runtime does not run them
for you. Unless its row says otherwise, each is a dry run until you pass
--apply.
| Command | What it does |
|---|---|
os migrate files-to-references | (17.0) Converts file-field values stored inline to sys_file references. --apply records the flag that turns on strict media values for this deployment |
os migrate value-shapes | (17.0) Scans reference and structured JSON values against their contract. --apply records its flag once a scan finds nothing |
os migrate meta --from 17 | Replays the metadata conversion chain over an app's sources and lists the edits it makes; --out FILE writes the converted stack. An authoring step: it does not touch the database |
os migrate meta --stored | The same conversion over this deployment's stored metadata; --apply rewrites the rows |
os migrate account-issuer | (17.5) Checks that the sys_account.issuer column can be dropped. Read-only; exits non-zero while two accounts would collide |
os migrate audit-metadata-bodies | (17.6) Rewrites the copies of metadata bodies the audit trail and activity stream hold, removing credentials and stored content hashes |
os migrate summary-nulls | Fills roll-up count / sum columns still stored as NULL on older parent rows |
os migrate recorded-by | Rewrites the legacy 'system' marker in metadata history to NULL |
os migrate resume | Lists migration runs that were interrupted. Read-only until --run ID, which resumes or unwinds one |
os migrate account-issuer # read-only pre-flight
os migrate audit-metadata-bodies # dry run: what it would rewrite
os migrate audit-metadata-bodies --apply # rewriteSecrets and stored files
| Command | What it does |
|---|---|
os secret rewrap | Re-seals older sys_secret ciphertext in the 17.7 format. A dry run until --apply; it must be told whether the host declares datasources in code (--declared-datasources FILE or --no-declared-datasources). ⚠️ A release before 17.7 cannot open what it writes |
os secret orphans | Reports sys_secret rows nothing refers to any more. Deletes only with --delete |
os storage orphans | Reports stored files nothing holds and no retention policy will ever reclaim. Writes nothing |
i18n commands
os i18n extract # extract translation keys from source
os i18n check # find missing keys across configured localesCloud commands
For users of ObjectOS Cloud (the optional hosted control plane).
os login # interactive
os logout
os whoami
os register # create an account
os cloud login | logout | whoamiPublish / package commands
os package publish # publish artifact as a versioned package
os package install <id|file> # install into a RUNNING runtime: catalog id
# (com.acme.crm) or a compiled artifact JSON
# (air-gapped, inline). --runtime / --email /
# --password identify the runtime to install intoEnvironment commands
For deployments using multiple environments per project (dev, staging, prod) backed by a control plane.
os environments list
os environments show <id>
os environments create <name>
os environments switch <id>
os environments bind # bind local artifact to an environmentTest command
os test # run Quality Protocol scenarios against a running serverCommon flag conventions
| Flag | Meaning |
|---|---|
-p, --port | HTTP port |
-a, --artifact | Path or URL to compiled artifact |
-d, --database | Database URL |
--home | Persistent state directory |
-v, --verbose | Verbose output |
--no-ui | Disable the UI and Account portals |
Run any command with --help for the full flag list:
os start --help
os data query --helpWhere the CLI fits
- Operator / first run →
os start - Developer building an app →
os init→os dev→os compile - CI / release pipeline →
os lint && os validate && os compile && os test - Production runtime →
os serve(typically inside the Docker image'sCMD) - Upgrading a deployment → the
os migratesteps the upgrade page lists for your versions - Diagnostics →
os doctor,os info,os explain
skills CLI
The npx command that installs the ObjectStack skills into your coding agent — where ObjectOS uses it, a few examples, and the full skill reference on objectstack.ai.
Environment Variables
The environment contract of a self-managed ObjectOS deployment, Community or Enterprise — what each variable decides, which edition reads it, which combinations fail at startup, and which names are retired.