CLI reference
The binary is the CLI. In development run commands from source with go run ./cmd/app <command>;
a built binary runs them as ims <command>. Global flags work with every command.
To add your own command, see CLI commands.
Global flags
| Flag | Default | Description |
|---|---|---|
--env-file |
— | path to the env file (default: APP_ENV_FILE or .env) |
--verbose |
— | enable debug logging |
Commands
| Command | Description |
|---|---|
activity:prune |
Delete activity-log entries older than a number of days |
backup:clean |
Apply the retention policy to stored backups |
backup:list |
List recent backup runs |
backup:monitor |
Check backup freshness and storage usage |
backup:run |
Create a database backup archive |
billing:expire-subscriptions |
Mark overdue subscriptions as expired |
billing:send-renewal-reminders |
Log renewal reminders for subscriptions expiring within 7/3/1 days |
cache:clear |
Clear the configured cache store |
config:show |
Print the effective configuration |
data-processing:cleanup-completed |
Delete completed processing-job records older than the retention window |
db:seed |
Seed permissions, tenant/roles/admin, settings groups/globals and feature flags |
delivery:prune |
Delete delivery-log rows older than a number of days |
delivery:test |
Send a test message by mail, SMS or push through the configured driver |
dev-dashboard:prune |
Delete developer dashboard telemetry past its retention window |
down |
Put the application into maintenance mode |
feature-flags:sync |
Insert missing global feature flags with their catalog defaults |
gen docs |
Generate the reference pages of the documentation site |
gen module |
Scaffold a CRUD module from a declarative field spec |
gen openapi |
Refresh the generated regions of api/openapi.yaml |
health:check |
Run application health checks |
key:generate |
Generate the application encryption key (APP_KEY) |
maintenance:status |
Show whether the application is in maintenance mode |
migrate |
Apply all pending database migrations |
migrate:rollback |
Roll back the most recent migrations |
migrate:status |
Show migration status |
oauth:client:create |
Register an OAuth client for the MCP connector |
oauth:client:delete |
Delete an OAuth client and revoke every connection made with it |
oauth:client:list |
List the OAuth clients registered for the MCP connector |
oauth:client:rotate |
Give a confidential OAuth client a new secret (the old one works for MCP_OAUTH_SECRET_GRACE) |
openapi:check |
Validate the OpenAPI document and check for route drift |
permission:sync |
Sync the permission catalog into the database |
privacy:coverage |
Show which module erases each user-reference column |
privacy:erase |
Erase a user’s personal data now |
privacy:export |
Export a user’s personal data to a zip file |
privacy:ledger |
List the users erased since a date (save it before a restore) |
privacy:replay |
Erase again the users a backup restore brought back |
queue:stats |
Show queue depths and failed counts |
queue:work |
Start a queue worker (River) |
route:list |
List every HTTP route with its permission and handler |
schedule |
Run the scheduler daemon (one process per deployment) |
schedule:list |
List registered scheduled tasks |
schedule:run |
Run a scheduled task once, immediately |
serve |
Start the HTTP API server |
settings:sync |
Upsert settings groups and insert missing global settings |
two-factor:reset |
Turn off a user’s two-factor authentication |
up |
Bring the application out of maintenance mode |
version |
Print the build version |
activity:prune
Delete activity-log entries older than —days (default ACTIVITY_RETENTION_DAYS, at least 30).
ims activity:prune [flags]Examples:
ims activity:prune --days=90| Flag | Default | Description |
|---|---|---|
--days |
0 |
delete entries older than this many days (default: ACTIVITY_RETENTION_DAYS, at least 30) |
backup:clean
Apply the retention policy to stored backups.
ims backup:clean [flags]| Flag | Default | Description |
|---|---|---|
--dry-run |
— | report what would be deleted without deleting |
backup:list
List recent backup runs.
ims backup:list [flags]| Flag | Default | Description |
|---|---|---|
--limit |
20 |
maximum runs to list |
backup:monitor
Check backup freshness and storage usage.
ims backup:monitorbackup:run
Create a database backup archive.
ims backup:run [flags]| Flag | Default | Description |
|---|---|---|
--destinations |
— | comma-separated destinations (local is always included) |
--filename |
— | archive filename override |
--with-files |
— | include BACKUP_FILES_PATHS in the archive |
billing:expire-subscriptions
Mark overdue subscriptions as expired.
ims billing:expire-subscriptionsbilling:send-renewal-reminders
Log renewal reminders for subscriptions expiring within 7/3/1 days.
ims billing:send-renewal-reminderscache:clear
Clear the configured cache store.
ims cache:clear [flags]| Flag | Default | Description |
|---|---|---|
--store |
— | override the cache driver (memory|file|redis|database) |
config:show
Print the effective configuration.
ims config:showdata-processing:cleanup-completed
Delete completed processing-job records older than the retention window.
ims data-processing:cleanup-completed [flags]| Flag | Default | Description |
|---|---|---|
--days |
0 |
retention window in days (default: data_processing_job.cleanup_days setting) |
--dry-run |
— | report how many jobs would be deleted |
db:seed
Seed permissions, tenant/roles/admin, settings groups/globals and feature flags.
ims db:seed [flags]| Flag | Default | Description |
|---|---|---|
--force |
— | Allow seeding in production (with safeguards) |
delivery:prune
Delete delivery-log rows older than a number of days.
ims delivery:prune [flags]Examples:
ims delivery:prune --days=14| Flag | Default | Description |
|---|---|---|
--days |
0 |
delete rows older than this many days (default: DELIVERY_RETENTION_DAYS) |
delivery:test
Send one message now (not queued) to —to: an e-mail address for mail, a phone number (E.164) for sms, a user id for push. Without —template a plain test message is sent; with one, the template is rendered with its sample data.
ims delivery:test [flags]Examples:
ims delivery:test --to=you@example.comims delivery:test --to=you@example.com --template=password-reset --locale=bnims delivery:test --channel=sms --to=+8801712345678 --template=otp-code| Flag | Default | Description |
|---|---|---|
--channel |
mail |
mail | sms | push |
--locale |
— | template locale, e.g. bn (default: APP_FALLBACK_LOCALE) |
--template |
— | template to render with its sample data (default: a plain test message) |
--to |
— | recipient: e-mail (mail), E.164 phone (sms) or user id (push) |
dev-dashboard:prune
Delete developer dashboard telemetry past its retention window.
ims dev-dashboard:prunedown
Put the application into maintenance mode: every API process answers 503 MAINTENANCE_MODE within MAINTENANCE_CHECK_INTERVAL. /up, /api/health, /metrics, /dev and /docs keep working; a client sending the bypass secret in the X-Maintenance-Bypass header passes.
ims down [flags]Examples:
ims down --message="Upgrading the database" --retry=120 --with-secret| Flag | Default | Description |
|---|---|---|
--message |
— | message shown to API clients (default: “The service is down for maintenance. Please try again shortly.”) |
--retry |
60 |
Retry-After hint in seconds |
--secret |
— | bypass secret clients may send in the X-Maintenance-Bypass header |
--with-secret |
— | generate a bypass secret and print it once |
feature-flags:sync
Insert missing global feature flags with their catalog defaults.
ims feature-flags:syncgen docs
Render docs/reference/{cli,configuration,permissions,make}.md from the code: the command tree, .env.example, the permission catalog and the Makefile. With —check nothing is written and the command fails when a committed page is stale (CI).
ims gen docs [flags]Examples:
ims gen docsims gen docs --check| Flag | Default | Description |
|---|---|---|
--check |
— | fail when a generated page is stale instead of writing it |
--root |
. |
repository root |
gen module
Generate a goose migration, sqlc queries and a feature-first module package from a field spec. Non-interactive and CI-friendly.
ims gen module [flags]Examples:
ims gen module --name=product --fields="name:string,price:decimal,is_active:bool"ims gen module --name=product --fields="name:string,notes:text?" --dry-run| Flag | Default | Description |
|---|---|---|
--dry-run |
— | print the files without writing them |
--fields |
— | comma-separated name:type spec, e.g. name:string,notes:text? |
--force |
— | overwrite existing files |
--module |
— | go module path (default: read from go.mod) |
--name |
— | module name, lower_snake, singular (required) |
--no-openapi |
— | skip refreshing the generated OpenAPI regions |
--no-sqlc |
— | skip the automatic sqlc generate step |
--package |
— | go package name (default: —name) |
--root |
. |
repository root |
--table |
— | table name (default: naive plural of —name) |
gen openapi
Insert or update the generated paths and schemas for one module (—module), every module in the index (—all), or insert the empty marker regions (—init). Managed regions are owned by the tool; everything outside the markers is hand-written and never touched.
ims gen openapi [flags]Examples:
ims gen openapi --initims gen openapi --module=productims gen openapi --all --checkims gen openapi --all --dry-run| Flag | Default | Description |
|---|---|---|
--all |
— | refresh every module listed in the generated-region index |
--check |
— | exit non-zero when the committed regions are stale |
--dry-run |
— | print the regenerated regions without writing |
--init |
— | insert the empty managed regions (one-time) |
--module |
— | refresh a single module (lower_snake name) |
--root |
. |
repository root |
health:check
Run application health checks.
ims health:checkkey:generate
Generate a random APP_KEY and write it to the .env file. APP_KEY encrypts values the app must read back (two-factor secrets, sensitive job payloads). Replacing a key that is in use makes those values unreadable: move the old key to APP_PREVIOUS_KEYS first.
ims key:generate [flags]Examples:
ims key:generateims key:generate --show| Flag | Default | Description |
|---|---|---|
--force |
— | replace an existing APP_KEY |
--show |
— | print the key instead of writing it |
maintenance:status
Show whether the application is in maintenance mode.
ims maintenance:statusmigrate
Apply all pending database migrations.
ims migratemigrate:rollback
Roll back the most recent migrations.
ims migrate:rollback [flags]| Flag | Default | Description |
|---|---|---|
--steps |
1 |
number of migrations to roll back |
migrate:status
Show migration status.
ims migrate:statusoauth:client:create
Register an OAuth client for the MCP connector.
ims oauth:client:create [flags]Examples:
ims oauth:client:create --name "Ops agent" --redirect https://agent.example.com/callback --confidentialims oauth:client:create --name "Local tool" --redirect http://localhost/callback| Flag | Default | Description |
|---|---|---|
--confidential |
— | give the client a secret (server-side clients) |
--name |
— | name shown on the consent page (required) |
--read-only |
— | never grant mcp:write |
--redirect |
— | redirect URI (repeat for more; https, or http on localhost) |
--tenant |
0 |
only this tenant’s users may connect |
oauth:client:delete
Delete an OAuth client and revoke every connection made with it.
ims oauth:client:delete <id>oauth:client:list
List the OAuth clients registered for the MCP connector.
ims oauth:client:listoauth:client:rotate
Give a confidential OAuth client a new secret (the old one works for MCP_OAUTH_SECRET_GRACE).
ims oauth:client:rotate <id>openapi:check
Validate the embedded OpenAPI document (api/openapi.yaml) and compare it against the live router. Requires database connectivity (the route table is built from the full dependency graph), like health:check.
ims openapi:checkpermission:sync
Sync the permission catalog into the database.
ims permission:syncprivacy:coverage
List every database column that may point at a user, the module whose privacy contributor handles it or the reason it is exempt. Exits with an error when a column is not covered.
ims privacy:coverageprivacy:erase
Erase a user’s personal data in every module and keep the users row as a tombstone (docs/design/account-deletion-and-export.md). It cannot be undone, so it needs —force. The super admin and a live tenant’s last active Admin are refused.
ims privacy:erase [flags]Examples:
ims privacy:erase --user=42 --force| Flag | Default | Description |
|---|---|---|
--force |
— | confirm the erasure (it cannot be undone) |
--user |
0 |
id of the user to erase |
privacy:export
Write every module’s data about a user (JSON per module, stored files, manifest.json) to a zip file. Secrets are never included.
ims privacy:export [flags]Examples:
ims privacy:export --user=42 --out=user-42.zip| Flag | Default | Description |
|---|---|---|
--out |
— | zip file to create (default: user- |
--user |
0 |
id of the user to export |
privacy:ledger
Write the ids of users erased since —since (RFC 3339 date or date-time), one per line, to stdout or —out. Run it on the live database before restoring a backup, then ims privacy:replay --from=<file> after the restore.
ims privacy:ledger [flags]Examples:
ims privacy:ledger --since=2026-11-01 --out=erased.txt| Flag | Default | Description |
|---|---|---|
--out |
— | file to write (default: stdout) |
--since |
— | erasures completed at or after this date (RFC 3339; required) |
privacy:replay
Read user ids (one per line, from ims privacy:ledger) and erase every one that is not erased in this database. Users still erased or no longer present are skipped; the guards do not apply, since the erasure was already decided.
ims privacy:replay [flags]Examples:
ims privacy:replay --from=erased.txt| Flag | Default | Description |
|---|---|---|
--from |
— | file of user ids written by privacy:ledger (required) |
queue:stats
Show queue depths and failed counts.
ims queue:statsqueue:work
Start a queue worker (River).
ims queue:work [flags]| Flag | Default | Description |
|---|---|---|
--max-workers |
0 |
max workers per queue (default: QUEUE_WORKER_CONCURRENCY) |
--once |
— | process due jobs and exit |
--once-timeout |
30s |
how long —once waits for a job |
--queues |
— | comma-separated queues to process (default: critical,default,heavy) |
route:list
List every HTTP route the API registers with this configuration: method, path, the permission it requires (empty: none) and the handler. —middleware adds each route’s own middleware (after the global stack, printed at the end); —json prints the full table for tools and AI agents. Builds the full dependency graph, like openapi:check.
ims route:list [flags]Examples:
ims route:list --path=/api/v1/branchims route:list --method=DELETE --middlewareims route:list --except-path=/dev --json| Flag | Default | Description |
|---|---|---|
--except-path |
— | leave out routes whose path contains this text |
--json |
— | print the table as JSON (method, path, handler, permissions, middleware) |
--method |
— | only routes with this HTTP method (e.g. GET) |
--middleware |
— | add each route’s middleware |
--path |
— | only routes whose path contains this text |
schedule
Run the scheduler daemon (one process per deployment).
ims scheduleschedule:list
List registered scheduled tasks.
ims schedule:listschedule:run
Run a scheduled task once, immediately.
ims schedule:run <task-id>serve
Start the HTTP API server.
ims servesettings:sync
Upsert settings groups and insert missing global settings.
ims settings:synctwo-factor:reset
Turn off two-factor authentication for the user with —email (mailed and recorded as user.two_factor_reset). Check who is asking before you run it.
ims two-factor:reset [flags]Examples:
ims two-factor:reset --email=developer@ims.com| Flag | Default | Description |
|---|---|---|
--email |
— | the user’s e-mail address |
up
Bring the application out of maintenance mode.
ims upversion
Print the build version.
ims version
