Reference CLI Commands - osama1998H/Moca GitHub Wiki

CLI Commands Reference

All 24 command groups, global flags, and context resolution.

Global Flags

Flag Description
--site Target site name
--format Output format: text, json, table
--verbose Verbose output
--quiet Suppress non-essential output

Context Resolution

The CLI automatically detects context:

  1. --site flag (highest priority)
  2. MOCA_SITE environment variable
  3. .moca/current_site file
  4. Single-site projects auto-select

Command Groups

api

API management

Command Description
moca api docs Generate OpenAPI/Swagger spec
moca api keys Manage API keys
moca api list List all registered API endpoints
moca api test Test an API endpoint
moca api webhooks Manage webhooks

moca api docs flags

Flag Type Default Description
--format string json Output format: json or yaml
--output string `` Output file path (default: stdout)
--port int 8002 Swagger UI server port (used with --serve)
--serve bool false Start a Swagger UI server
--site string `` Target site

moca api list flags

Flag Type Default Description
--doctype string `` Filter by DocType
--json bool false Output as JSON
--method string `` Filter by HTTP method (GET, POST, PUT, DELETE)
--site string `` Target site

moca api test flags

Flag Type Default Description
--api-key string `` Authenticate with API key (key_id:secret)
--data string `` Request body (JSON)
--json bool false Output as JSON
--method string GET HTTP method
--repeat int 0 Repeat N times and show timing stats
--site string `` Target site
--user string Administrator Authenticate as user
--verbose bool false Show full request/response headers

app

Application management

Command Description
moca app diff Show changes since last install
moca app get Download and install an app
moca app info Show app manifest details
moca app install Install an app on a site
moca app list List apps (project or site level)
moca app new Scaffold a new Moca app
moca app pin Pin app to exact version/commit
moca app publish Publish app to registry
moca app remove Remove an app from project
moca app resolve Resolve and lock dependency versions
moca app uninstall Uninstall an app from a site
moca app update Update apps (all or specific)

moca app diff flags

Flag Type Default Description
--hooks bool false Show only hook changes
--migrations bool false Show only pending migrations
--schema bool false Show only schema/MetaType changes

moca app get flags

Flag Type Default Description
--branch string `` Git branch to clone
--depth int 1 Git clone depth (0 for full history)
--no-resolve bool false Skip dependency resolution
--ref string `` Exact git ref (commit/tag)
--version string `` Version constraint (semver range)

moca app install flags

Flag Type Default Description
--all-sites bool false Install on all sites

moca app list flags

Flag Type Default Description
--project bool false Show apps in the project (default when no --site)

moca app new flags

Flag Type Default Description
--desk bool false Include desk/ directory with desk-manifest.json for UI extensions
--doctype string `` Create an initial DocType with the app
--license string MIT License identifier
--module string `` Initial module name (default: derived from app name)
--publisher string `` Publisher/organization name
--template string standard App template: "standard", "minimal", "api-only"
--title string `` Human-readable app title

moca app resolve flags

Flag Type Default Description
--dry-run bool false Show resolution without writing lockfile
--strict bool false Fail if any constraint cannot be satisfied
--update bool false Allow updating locked versions within constraints

moca app uninstall flags

Flag Type Default Description
--dry-run bool false Show what would be removed without executing
--force bool false Skip confirmation
--keep-data bool false Remove app registration but keep database tables

moca app update flags

Flag Type Default Description
--all bool false Update all apps
--dry-run bool false Show what would be updated
--force bool false Force update even with local modifications

backup

Backup operations

Command Description
moca backup create Backup a site (or all sites)
moca backup download Download backup from remote storage
moca backup list List available backups
moca backup prune Delete old backups per retention policy
moca backup restore Restore a site from backup
moca backup schedule Configure automated backups
moca backup upload Upload backup to remote storage
moca backup verify Verify backup integrity

moca backup create flags

Flag Type Default Description
--compress bool true Compress backup with gzip
--encrypt bool false Encrypt backup with AES-256
--encryption-key string `` 64-char hex encryption key (overrides config/env)
--site string `` Target site name

moca backup download flags

Flag Type Default Description
--output string `` Local download path (default: site backup dir)
--site string `` Target site name
--source string `` Override remote storage source

moca backup list flags

Flag Type Default Description
--limit int 20 Maximum number of backups to show
--site string `` Target site name

moca backup prune flags

Flag Type Default Description
--dry-run bool false Show what would be deleted
--force bool false Skip confirmation prompt
--site string `` Target site name

moca backup restore flags

Flag Type Default Description
--encryption-key string `` 64-char hex encryption key (overrides config/env)
--force bool false Skip confirmation prompt
--site string `` Target site name

moca backup schedule flags

Flag Type Default Description
--cron string `` Cron expression (e.g., "0 2 * * *")
--disable bool false Disable automated backups
--enable bool false Enable automated backups
--show bool false Show current backup schedule

moca backup upload flags

Flag Type Default Description
--delete-local bool false Delete local copy after successful upload
--destination string `` Override remote storage destination (s3://bucket/prefix)
--site string `` Target site name

moca backup verify flags

Flag Type Default Description
--deep bool false Perform deep verification (decompress and count SQL objects)

build

Build operations

Command Description
moca build app Verify an app's Go code compiles
moca build assets Build all static assets
moca build desk Build React Desk frontend
moca build portal Build portal/website assets
moca build server Compile server binary with all installed apps

moca build app flags

Flag Type Default Description
--race bool false Enable race detector
--verbose bool false Show compiler output

moca build desk flags

Flag Type Default Description
--verbose bool false Show Vite build output

moca build server flags

Flag Type Default Description
--ldflags string `` Additional linker flags
--output string `` Output binary path (default: bin/moca-server)
--race bool false Enable race detector
--verbose bool false Show compiler output

cache

Cache management

Command Description
moca cache clear Clear caches for a site
moca cache warm Pre-warm caches (metadata)

moca cache clear flags

Flag Type Default Description
--site string `` Target site name
--type string all Cache type to clear: meta, doc, config, perm, session, schema, all

moca cache warm flags

Flag Type Default Description
--site string `` Target site name

completion

Generate shell completion scripts

config

Configuration management

Command Description
moca config diff Compare config between two sites
moca config edit Open config in $EDITOR
moca config export Export full config as YAML/JSON
moca config get Get a config value
moca config import Import config from file
moca config list List all effective config (merged)
moca config remove Remove a config key
moca config set Set a config value

moca config edit flags

Flag Type Default Description
--common bool false Edit common_site_config.yaml
--site string `` Edit site config

moca config export flags

Flag Type Default Description
--format string yaml Output format: "yaml", "json", "env"
--output string `` Output file path (default: stdout)
--secrets bool false Include secret values (default: masked)
--site string `` Export for a specific site

moca config get flags

Flag Type Default Description
--resolved bool false Show effective value after merging all layers
--runtime bool false Query live config from database
--site string `` Get site-level config

moca config import flags

Flag Type Default Description
--common bool false Import into common_site_config.yaml
--dry-run bool false Show what would change without saving
--overwrite bool false Overwrite conflicting keys (default: skip conflicts)
--site string `` Import into site config

moca config list flags

Flag Type Default Description
--filter string `` Filter keys by glob pattern (e.g., "database.*")
--format string table Output format: "table", "yaml", "json"
--site string `` Show resolved config for a site

moca config remove flags

Flag Type Default Description
--common bool false Remove from common_site_config.yaml
--site string `` Remove from site config

moca config set flags

Flag Type Default Description
--common bool false Set in common_site_config.yaml
--site string `` Set in site config
--type string `` Value type hint: "string", "int", "bool", "json" (auto-detected)

db

Database operations

Command Description
moca db console Open interactive psql session
moca db diff Show schema diff (meta vs actual DB)
moca db export-fixtures Export data as fixture files
moca db migrate Run pending schema migrations
moca db reset Drop and recreate site schema
moca db rollback Rollback last migration batch
moca db seed Load seed/fixture data
moca db snapshot Save current schema as snapshot
moca db trim-database Remove orphaned tables
moca db trim-tables Remove orphaned columns

moca db console flags

Flag Type Default Description
--readonly bool false Open in read-only mode
--site string `` Target site name
--system bool false Connect to the moca_system schema instead

moca db diff flags

Flag Type Default Description
--doctype string `` Check a specific DocType (required)
--output string text Output format: text, sql, json

moca db export-fixtures flags

Flag Type Default Description
--app string `` Target app to save fixtures into (required)
--doctype string `` Export a specific DocType only
--filters string `` JSON filter object to limit exported records
--site string `` Target site name

moca db migrate flags

Flag Type Default Description
--dry-run bool false Show SQL that would be executed without running it
--skip string `` Skip a specific migration by app:version
--step int 0 Run only N migrations (0 = all)

moca db reset flags

Flag Type Default Description
--force bool false Skip confirmation prompt
--no-backup bool false Skip automatic backup before reset
--site string `` Target site name

moca db rollback flags

Flag Type Default Description
--dry-run bool false Show what would be rolled back without executing
--step int 1 Number of batches to rollback

moca db seed flags

Flag Type Default Description
--app string `` Seed data from a specific app only
--file string `` Seed from a specific fixture file
--force bool false Overwrite existing data (upsert)
--site string `` Target site name

moca db snapshot flags

Flag Type Default Description
--include-data bool false Include row data (not just schema)
--site string `` Target site name

moca db trim-database flags

Flag Type Default Description
--dry-run bool true Show what would be removed (default: true)
--execute bool false Actually drop orphaned tables
--site string `` Target site name

moca db trim-tables flags

Flag Type Default Description
--doctype string `` Target a specific DocType
--dry-run bool true Show what would be removed (default: true)
--execute bool false Actually drop orphaned columns
--site string `` Target site name

deploy

Deployment operations

Command Description
moca deploy history Show deployment history
moca deploy promote Promote one environment to another
moca deploy rollback Rollback to a previous deployment
moca deploy setup One-command production setup
moca deploy status Show deployment status
moca deploy update Production update (backup, build, migrate, restart)

moca deploy history flags

Flag Type Default Description
--limit int 20 Maximum entries to display

moca deploy promote flags

Flag Type Default Description
--dry-run bool false Show environment diff without executing
--skip-backup bool false Skip backup of target environment

moca deploy rollback flags

Flag Type Default Description
--force bool false Skip confirmation prompt
--no-backup bool false Skip pre-rollback backup of current state
--step int 0 Rollback N deployments back (default: 1)

moca deploy setup flags

Flag Type Default Description
--background int 2 Number of background workers
--domain string `` Production domain (required)
--dry-run bool false Print all steps without executing
--email string `` Admin email for TLS certificate registration
--fail2ban bool false Configure fail2ban intrusion detection
--firewall bool false Configure UFW firewall rules
--logrotate bool true Configure log rotation
--process string systemd Process manager: "systemd" or "docker"
--proxy string caddy Reverse proxy engine: "caddy" or "nginx"
--tls string acme TLS mode: "acme", "custom", or "none"
--tls-cert string `` Custom TLS certificate path (--tls=custom)
--tls-key string `` Custom TLS key path (--tls=custom)
--workers string `` Number of HTTP worker processes
--yes bool false Skip confirmation prompts

moca deploy update flags

Flag Type Default Description
--apps stringSlice [] Update specific apps only (comma-separated)
--dry-run bool false Show update plan without executing
--no-backup bool false Skip pre-update database backup
--no-build bool false Skip frontend asset build
--no-migrate bool false Skip database migrations
--no-restart bool false Skip process restart
--parallel int 2 Number of parallel site migrations

desk

Desk frontend management

Command Description
moca desk dev Start Vite dev server for desk development
moca desk install Install desk npm dependencies
moca desk update Update @osama1998h/desk to latest compatible version

moca desk dev flags

Flag Type Default Description
--port int 0 Dev server port (default: from config or 3000)

moca desk install flags

Flag Type Default Description
--verbose bool false Show npm output

moca desk update flags

Flag Type Default Description
--verbose bool false Show npm output

dev

Developer tools

Command Description
moca dev bench Run microbenchmarks on queries/operations
moca dev console Interactive Go REPL with framework loaded
moca dev execute Run a one-off Go function/expression
moca dev playground Start interactive API playground
moca dev profile Profile a request or operation
moca dev request Make an HTTP request as a user
moca dev shell Open a shell with Moca env vars set
moca dev watch Watch and rebuild assets on change

moca dev bench flags

Flag Type Default Description
--concurrent int 10 Number of concurrent goroutines
--iterations int 1000 Number of iterations per operation
--json bool false Output in JSON format
--operation string all Operation to benchmark: read, write, query, cache, all
--site string `` Target site (required)

moca dev execute flags

Flag Type Default Description
--site string `` Target site

moca dev profile flags

Flag Type Default Description
--duration string 30s Profile duration (for cpu/block)
--output string profile.svg Output file path
--port int 0 Server port (defaults to development.port from config)
--raw bool false Output raw pprof binary instead of SVG
--type string cpu Profile type: cpu, mem, goroutine, block, mutex

moca dev request flags

Flag Type Default Description
--data string `` Request body (JSON)
--headers stringSlice [] Extra headers (key:value)
--json bool false Output response as structured JSON
--site string `` Target site
--user string Administrator Request as user
--verbose bool false Show full request/response headers

doctor

Diagnose system health

moca doctor flags

Flag Type Default Description
--fix bool false Auto-remediate fixable issues
--json bool false Output results as JSON
--site string `` Run per-site checks for a specific site
--verbose bool false Show response times and details

events

Kafka event management

Command Description
moca events consumer-status Show consumer group lag
moca events list-topics List all Kafka topics
moca events publish Publish a test event
moca events replay Replay events from a time offset
moca events tail Tail events from a topic in real-time

moca events consumer-status flags

Flag Type Default Description
--group string `` Filter by consumer group name

moca events publish flags

Flag Type Default Description
--doctype string `` Set or override the event doctype field
--event string `` Set or override the event_type field (e.g. doc.created)
--file string `` Read payload from a JSON file
--payload string `` JSON event payload (inline)
--site string `` Set or override the event site field

moca events replay flags

Flag Type Default Description
--consumer string `` Target consumer group for offset reset
--dry-run bool false Show events without replaying
--force bool false Skip confirmation prompt
--since string `` Start time as duration (e.g. 2h, 7d) — required
--until string `` End time as duration (default: now)

moca events tail flags

Flag Type Default Description
--doctype string `` Filter events by doctype
--event string `` Filter events by event type (e.g. doc.created)
--format string short Output format: short or json
--since string `` Start from offset (e.g. 1h, 30m) — Kafka only
--site string `` Filter events by site

generate

Infrastructure config generation

Command Description
moca generate caddy Generate Caddy reverse proxy config
moca generate docker Generate Docker Compose files
moca generate env Generate .env file from moca.yaml
moca generate k8s Generate Kubernetes manifests (aliases: kubernetes)
moca generate nginx Generate NGINX config
moca generate supervisor Generate supervisor config
moca generate systemd Generate systemd unit files

moca generate caddy flags

Flag Type Default Description
--multitenant bool false Generate wildcard config for subdomain multitenancy
--output string `` Output path (default: config/caddy/Caddyfile)
--reload bool false Reload Caddy after generating

moca generate docker flags

Flag Type Default Description
--include stringSlice [] Extra services: "kafka", "meilisearch", "minio"
--output string `` Output directory (default: config/docker/)
--profile string development "development" or "production"

moca generate env flags

Flag Type Default Description
--format string dotenv Output format: "dotenv", "docker", "systemd"
--output string `` Output path (default: .env)

moca generate k8s flags

Flag Type Default Description
--helm bool false Generate as Helm chart (planned for future release)
--namespace string moca Kubernetes namespace
--output string `` Output directory (default: config/k8s/)
--replicas int 3 Server replicas

moca generate nginx flags

Flag Type Default Description
--multitenant bool false Subdomain-based multitenancy config
--output string `` Output path (default: config/nginx/moca.conf)
--reload bool false Reload NGINX after generating

moca generate supervisor flags

Flag Type Default Description
--output string `` Output path (default: config/supervisor/supervisord.conf)
--user string `` System user to run as (default: moca)

moca generate systemd flags

Flag Type Default Description
--install bool false Install units to /etc/systemd/system/
--output string `` Output directory (default: config/systemd/)
--user string `` System user to run as (default: moca)

help

Help about any command

init

Initialize a new Moca project

moca init flags

Flag Type Default Description
--apps stringSlice [] Apps to pre-install
--db-host string localhost PostgreSQL host
--db-password string `` PostgreSQL password
--db-port int 5432 PostgreSQL port
--db-user string postgres PostgreSQL user
--kafka bool true Enable Kafka integration
--minimal bool false Minimal setup (PostgreSQL + Redis only)
--name string `` Project name (default: directory name)
--no-kafka bool false Disable Kafka (Redis pub/sub fallback)
--redis-host string localhost Redis host
--redis-port int 6379 Redis port
--skip-assets bool false Skip building frontend assets
--skip-desk bool false Skip scaffolding desk/ frontend (headless API-only project)
--template string standard Project template: standard, minimal, enterprise

log

Log viewing

Command Description
moca log export Export logs for a time range
moca log search Search through log files
moca log tail Tail logs in real-time (with filters)

moca log export flags

Flag Type Default Description
--compress bool false Compress output with gzip
--format string json Output format: "json", "text"
--output string `` Output file path (default: stdout)
--process string `` Filter by process: "server", "worker", "scheduler"
--since string `` Start time (required). Duration (e.g. "1h", "7d") or absolute (RFC3339, date)
--site string `` Filter by site
--until string `` End time (default: now)

moca log search flags

Flag Type Default Description
--level string `` Minimum level
--limit int 100 Max results
--process string `` Filter by process: "server", "worker", "scheduler", "all"
--request-id string `` Find logs for a specific request
--since string `` Time filter (e.g., "1h", "2d", "2024-01-01")
--site string `` Filter by site

moca log tail flags

Flag Type Default Description
--follow bool true Follow log output continuously
--level string `` Minimum level: "debug", "info", "warn", "error"
--no-color bool false Disable color output
--process string all Filter by process: "server", "worker", "scheduler", "all"
--request-id string `` Follow a specific request
--site string `` Filter by site

monitor

Monitoring

Command Description
moca monitor audit Query audit log
moca monitor live Live dashboard showing requests, workers, queues
moca monitor metrics Dump current Prometheus metrics

moca monitor audit flags

Flag Type Default Description
--action string `` Filter by action (Create, Update, Submit, etc.)
--doctype string `` Filter by DocType
--limit int 50 Max results
--since string `` Time filter: duration (e.g., "1h", "2d") or timestamp (e.g., "2026-01-01")
--site string `` Target site (required)
--user string `` Filter by user

moca monitor metrics flags

Flag Type Default Description
--port int 8000 Server port to query

notify

Notification management

Command Description
moca notify config Show or update notification provider settings
moca notify test-email Send a test email to verify SMTP configuration

moca notify config flags

Flag Type Default Description
--json bool false Output current config as JSON
--set stringArray [] Set a notification config value (KEY=VALUE)
--site string `` Target site

moca notify test-email flags

Flag Type Default Description
--provider string `` Email provider: "smtp" (default), "ses"
--site string `` Target site
--to string `` Recipient email address (required)

queue

Queue management

Command Description
moca queue dead-letter Manage dead letter queue
moca queue inspect Inspect a specific job's payload/history
moca queue list List pending/active/failed jobs
moca queue purge Purge all pending jobs
moca queue retry Retry a failed job
moca queue status Show queue depths and worker status

moca queue inspect flags

Flag Type Default Description
--site string `` Limit search to a specific site

moca queue list flags

Flag Type Default Description
--limit int64 50 Max results
--queue string all Queue name: "default", "long", "critical", "scheduler", "all"
--site string `` Filter by site

moca queue purge flags

Flag Type Default Description
--all bool false Purge all queues
--force bool false Skip confirmation
--queue string `` Queue to purge (default/long/critical/scheduler)
--site string `` Target site

moca queue retry flags

Flag Type Default Description
--all-failed bool false Retry all failed jobs
--force bool false Skip confirmation
--queue string `` Queue for --all-failed (default/long/critical/scheduler)
--site string `` Target site

moca queue status flags

Flag Type Default Description
--site string `` Filter by site (default: all active sites)
--watch bool false Refresh continuously (every 2 seconds)

restart

Restart all running Moca processes

moca restart flags

Flag Type Default Description
--graceful bool true Wait for in-flight requests before stopping
--host string 0.0.0.0 HTTP server bind address
--no-scheduler bool false Disable cron scheduler
--no-watch bool false Disable file watcher for hot reload
--no-workers bool false Disable background workers
--port int 8000 HTTP server port
--profile bool false Enable pprof profiling endpoints
--workers int 2 Number of background worker goroutines

scheduler

Scheduler management

Command Description
moca scheduler disable Disable scheduler for a site
moca scheduler enable Enable scheduler for a site
moca scheduler list-jobs List registered scheduled jobs
moca scheduler purge-jobs Purge pending jobs from scheduler queue
moca scheduler start Start the scheduler process
moca scheduler status Show scheduler status
moca scheduler stop Stop the scheduler
moca scheduler trigger Manually trigger a scheduled event

moca scheduler disable flags

Flag Type Default Description
--site string `` Site to disable (required)

moca scheduler enable flags

Flag Type Default Description
--site string `` Site to enable (required)

moca scheduler list-jobs flags

Flag Type Default Description
--app string `` Filter by app name
--site string `` Site to list jobs for (required)

moca scheduler purge-jobs flags

Flag Type Default Description
--all bool false Purge scheduler queues for all active sites
--event string `` Filter by event/job type
--force bool false Skip confirmation prompt
--site string `` Site to purge (required unless --all)

moca scheduler start flags

Flag Type Default Description
--foreground bool false Run in the foreground (attached to terminal)

moca scheduler status flags

Flag Type Default Description
--site string `` Filter by site

moca scheduler trigger flags

Flag Type Default Description
--all-sites bool false Trigger for all active sites
--site string `` Target site (required unless --all-sites)

search

Search index management

Command Description
moca search query Query search index from CLI
moca search rebuild Rebuild search index for a site/doctype
moca search status Show search index status

moca search query flags

Flag Type Default Description
--doctype string `` Search within a specific DocType (required)
--limit int 10 Max results
--site string `` Target site (required)

moca search rebuild flags

Flag Type Default Description
--all-sites bool false Rebuild for all active sites
--batch-size int 1000 Batch size for indexing
--doctype string `` Rebuild for a specific DocType only
--site string `` Target site name

moca search status flags

Flag Type Default Description
--site string `` Filter by site

serve

Start the development server

moca serve flags

Flag Type Default Description
--host string 0.0.0.0 HTTP server bind address
--no-scheduler bool false Disable cron scheduler
--no-watch bool false Disable file watcher for hot reload
--no-workers bool false Disable background workers
--port int 8000 HTTP server port
--profile bool false Enable pprof profiling endpoints
--workers int 2 Number of background worker goroutines

site

Site management

Command Description
moca site browse Open site in browser
moca site clone Clone a site (schema + data)
moca site create Create a new site
moca site disable Disable a site (maintenance mode)
moca site drop Delete a site
moca site enable Enable a disabled site
moca site info Show site details
moca site list List all sites
moca site migrate Run pending migrations
moca site reinstall Reset site to fresh state
moca site rename Rename a site
moca site use Set active site

moca site browse flags

Flag Type Default Description
--print-url bool false Print the URL instead of opening browser
--site string `` Target site name
--user string `` Login as a specific user (dev mode only)

moca site clone flags

Flag Type Default Description
--anonymize bool false Anonymize PII data in the clone (for staging/testing)
--data-only bool false Only copy data, not files/attachments
--exclude stringSlice [] DocTypes to exclude from clone

moca site create flags

Flag Type Default Description
--admin-email string `` Administrator email (default: admin@SITE_NAME)
--admin-password string `` Administrator password (prompted if not provided)
--currency string USD Default currency
--install-apps stringSlice [] Apps to install after site creation
--language string en Default language
--no-cache-warmup bool false Skip initial cache warming
--timezone string UTC Site timezone

moca site disable flags

Flag Type Default Description
--allow stringSlice [] IP addresses to allow through during maintenance
--message string `` Custom maintenance message
--site string `` Target site name

moca site drop flags

Flag Type Default Description
--force bool false Skip confirmation prompt
--keep-database bool false Don't drop the database schema
--no-backup bool false Skip automatic backup before dropping

moca site enable flags

Flag Type Default Description
--site string `` Target site name

moca site list flags

Flag Type Default Description
--status string `` Filter by status (active, disabled)

moca site reinstall flags

Flag Type Default Description
--admin-password string `` New admin password (prompted if not provided)
--force bool false Skip confirmation prompt
--no-backup bool false Skip automatic backup before reinstall
--site string `` Target site name

moca site rename flags

Flag Type Default Description
--no-proxy-reload bool false Skip reloading the reverse proxy

status

Show project/site/service status

stop

Stop all running Moca processes

moca stop flags

Flag Type Default Description
--force bool false Force kill immediately (SIGKILL)
--graceful bool true Wait for in-flight requests to complete
--timeout duration 30s Graceful shutdown timeout

test

Testing

Command Description
moca test coverage Generate test coverage report
moca test factory Generate test data from MetaType definitions
moca test fixtures Load test fixture data
moca test run Run tests (Go tests + framework tests)
moca test run-ui Run frontend/Playwright tests

moca test coverage flags

Flag Type Default Description
--app string `` Coverage for specific app
--output string text Output format: text, html, json
--packages string ./pkg/... Comma-separated package patterns
--threshold float64 0 Minimum coverage % (exit error if below)

moca test factory flags

Flag Type Default Description
--batch-size int 50 Insert batch size
--dry-run bool false Print generated data as JSON without inserting
--seed int64 0 Random seed for reproducibility (default: time-based)
--site string `` Target site (required)
--with-children bool true Generate child table data

moca test run flags

Flag Type Default Description
--app string `` Test a specific app only
--coverage bool false Generate coverage report alongside
--doctype string `` Test a specific DocType's tests
--failfast bool false Stop on first failure
--filter string `` Run tests matching pattern
--keep-site bool false Don't cleanup test site after run
--module string `` Test a specific module
--parallel int 0 Parallel test execution (default: GOMAXPROCS)
--site string `` Test site name (auto-created if not specified)
--verbose bool false Verbose test output

translate

Translation management

Command Description
moca translate compile Compile translations to binary format
moca translate export Export translatable strings
moca translate import Import translations
moca translate status Show translation coverage

moca translate compile flags

Flag Type Default Description
--app string `` Compile for a specific app only
--language string `` Compile a specific language only
--site string `` Target site name

moca translate export flags

Flag Type Default Description
--app string `` Export from specific app only
--format string po Output format: "po", "csv", or "json"
--output string `` Output file path (default: stdout)
--site string `` Target site name

moca translate import flags

Flag Type Default Description
--app string `` Target app name
--language string `` Target language code (e.g., ar, fr, de)
--overwrite bool false Overwrite existing translations
--site string `` Target site name

moca translate status flags

Flag Type Default Description
--app string `` Filter by app
--json bool false Output as JSON
--language string `` Filter by language
--site string `` Target site name

user

User management

Command Description
moca user add Create a new user on a site
moca user add-role Assign a role to a user
moca user disable Disable a user account
moca user enable Enable a user account
moca user impersonate Generate login URL as any user (dev only)
moca user list List all users on a site
moca user remove Remove a user from a site
moca user remove-role Remove a role from a user
moca user set-admin-password Set Administrator password
moca user set-password Set user password

moca user add flags

Flag Type Default Description
--first-name string `` First name
--last-name string `` Last name
--password string `` Password (prompted if not provided)
--roles stringSlice [] Roles to assign (comma-separated)
--site string `` Target site

moca user add-role flags

Flag Type Default Description
--site string `` Target site

moca user disable flags

Flag Type Default Description
--site string `` Target site

moca user enable flags

Flag Type Default Description
--site string `` Target site

moca user impersonate flags

Flag Type Default Description
--site string `` Target site
--ttl string 5m URL validity duration

moca user list flags

Flag Type Default Description
--role string `` Filter by role
--site string `` Target site
--status string active Filter: "active", "disabled", "all"

moca user remove flags

Flag Type Default Description
--force bool false Skip confirmation
--site string `` Target site

moca user remove-role flags

Flag Type Default Description
--site string `` Target site

moca user set-admin-password flags

Flag Type Default Description
--password string `` New password (prompted securely if not provided)
--site string `` Target site

moca user set-password flags

Flag Type Default Description
--password string `` New password (prompted securely if not provided)
--site string `` Target site

version

Print MOCA CLI version information

worker

Background worker management

Command Description
moca worker scale Adjust worker pool size at runtime
moca worker start Start background workers
moca worker status Show worker pool status
moca worker stop Stop background workers

moca worker start flags

Flag Type Default Description
--foreground bool false Run in the foreground (attached to terminal)

moca worker status flags

Flag Type Default Description
--site string `` Filter by site (default: all active sites)

Related