CLI Commands Reference
CLI commands are provided by *-cli extension packages. Each registers commands in CliCommandsPool and requires the CLI driver (@modularityjs/cli-commander).
Module System
Package: @modularityjs/modularity-cli
| Command | Description |
|---|---|
module:list | List all registered modules with their dependencies |
module:preference:list | Show preference override chains |
module:pool:list | Show pool entries grouped by pool token |
Assets
Package: @modularityjs/assets-cli
| Command | Description |
|---|---|
assets:collect [outputDir] | Walk StaticAssetsPool and invoke the active AssetCollector. Writes content-hashed files + assets-manifest.json. The optional outputDir argument overrides the configured destination |
Auth
Package: @modularityjs/auth-cli
| Command | Description |
|---|---|
auth:resolve <token> | Resolve a token through the AuthResolversPool and print the identity JSON, or report that no resolver accepted it |
Authz
Package: @modularityjs/authz-cli
| Command | Description |
|---|---|
authz:check <identityId> <permission> | Check whether an identity has a permission according to registered checkers |
authz:permissions <identityId> | List all permissions granted to an identity by registered checkers |
Options for both authz:check and authz:permissions:
| Option | Description |
|---|---|
--attributes <json> | Identity attributes as a JSON object (e.g. '{"roles":["admin"]}') |
Database
Package: @modularityjs/database-cli
| Command | Description |
|---|---|
database:status | Show database connection status |
database:migration:list | List all database migrations with their status |
database:migration:run | Run all pending database migrations |
database:migration:rollback | Rollback the last executed database migration |
database:migration:generate <name> | Generate a new database migration from schema changes |
HTTP
Package: @modularityjs/http-cli
| Command | Description |
|---|---|
http:route:list | List all registered HTTP routes |
OpenAPI
Package: @modularityjs/openapi-cli
| Command | Description |
|---|---|
openapi:export | Emit the OpenAPI document to stdout (or to a file via --output) |
Options for openapi:export:
| Option | Description |
|---|---|
--output <path> | Write the document to this file instead of stdout |
--minify | Emit single-line JSON instead of pretty-printed (smaller file, harder diff) |
Status messages (e.g. openapi:export → wrote openapi.json) go to stderr so stdout stays clean for piping. Requires a concrete OpenApiBuilder — load OpenApiModule plus HttpOpenApiModule (or another builder) alongside OpenApiCliModule.
Events
Package: @modularityjs/events-cli
| Command | Description |
|---|---|
event:list | List all registered event handlers |
Health
Package: @modularityjs/health-cli
| Command | Description |
|---|---|
health:status | Run all health indicators and display aggregated status |
Queue
Package: @modularityjs/queue-cli
| Command | Description |
|---|---|
queue:list | List all registered queue consumers |
queue:dead-letter:list [topic] | List dead-lettered messages |
Options for queue:dead-letter:list:
| Option | Description |
|---|---|
--purge | Purge dead-lettered messages after listing |
Outbox
Package: @modularityjs/outbox-cli
| Command | Description |
|---|---|
outbox:list | List rows from the outbox (read-only — does not claim) |
outbox:dispatch | Drain pending outbox rows by publishing them now |
outbox:retry <id> | Requeue an outbox row — clears dispatched/dead/claim state and resets attempts |
outbox:stats | Print pending/dispatched/dead counts for the outbox |
Options for outbox:list:
| Option | Description |
|---|---|
--state <state> | Filter by state (one of: pending, dispatched, dead) |
--limit <n> | Maximum rows to display (default 20) |
Options for outbox:dispatch:
| Option | Description |
|---|---|
--limit <n> | Maximum number of rows to fetch in this run |
--loop | Keep dispatching while pending rows exist (single-shot otherwise) |
Cache
Package: @modularityjs/cache-cli
| Command | Description |
|---|---|
cache:delete <key> | Delete a cached value by key |
cache:invalidate-tag <tag> | Invalidate all cached values with a tag |
Lock
Package: @modularityjs/lock-cli
| Command | Description |
|---|---|
lock:release <key> | Release a distributed lock using its owner token |
Options for lock:release:
| Option | Description |
|---|---|
--token <token> | Owner token returned by acquire (required at runtime — the command exits non-zero if omitted) |
Scheduler
Package: @modularityjs/scheduler-cli
| Command | Description |
|---|---|
scheduler:list | List all registered scheduled jobs |
scheduler:run <name> | Manually trigger a scheduled job by name |
Storage
Package: @modularityjs/storage-cli
| Command | Description |
|---|---|
storage:list [prefix] | List stored objects |
Webhook
Package: @modularityjs/webhook-cli
| Command | Description |
|---|---|
webhook:list | List all registered webhook subscriptions |
webhook:send <event> [data] | Dispatch a test event to all matching subscribers |
data is a JSON string (default {}). Output shows per-subscriber delivery results with OK/FAIL status.
Rate Limit
Package: @modularityjs/rate-limit-cli
| Command | Description |
|---|---|
rate-limit:get <key> | Inspect the current state of a rate-limit key (remaining, total, resetAt) |
rate-limit:reset <key> | Reset a rate-limit key (manual unblock during an incident) |
WebSocket
Package: @modularityjs/ws-cli
| Command | Description |
|---|---|
ws:list | List all connected WebSocket clients by id |
ws:broadcast <type> | Broadcast a JSON message to all connected WebSocket clients |
Options for ws:broadcast:
| Option | Description |
|---|---|
--data <json> | Message payload as JSON (default: null) |
Plugins
Package: @modularityjs/plugins-cli
| Command | Description |
|---|---|
plugin:list | List all registered plugins with their targets and types |
Setup
Include the CLI facade in your app to get all commands:
import { CliModule } from '@modularityjs/cli';
import { CliCommanderModule } from '@modularityjs/cli-commander';
// Option 1: Import individual CLI packages
import { DatabaseCliModule } from '@modularityjs/database-cli';
import { HttpCliModule } from '@modularityjs/http-cli';
// Option 2: Import every CLI extension
import { AssetsCliModule } from '@modularityjs/assets-cli';
import { AuthCliModule } from '@modularityjs/auth-cli';
import { AuthzCliModule } from '@modularityjs/authz-cli';
import { CacheCliModule } from '@modularityjs/cache-cli';
import { EventsCliModule } from '@modularityjs/events-cli';
import { HealthCliModule } from '@modularityjs/health-cli';
import { HttpCliModule } from '@modularityjs/http-cli';
import { LockCliModule } from '@modularityjs/lock-cli';
import { ModularityCliModule } from '@modularityjs/modularity-cli';
import { OpenApiCliModule } from '@modularityjs/openapi-cli';
import { OutboxCliModule } from '@modularityjs/outbox-cli';
import { PluginsCliModule } from '@modularityjs/plugins-cli';
import { QueueCliModule } from '@modularityjs/queue-cli';
import { RateLimitCliModule } from '@modularityjs/rate-limit-cli';
import { SchedulerCliModule } from '@modularityjs/scheduler-cli';
import { StorageCliModule } from '@modularityjs/storage-cli';
import { WebhookCliModule } from '@modularityjs/webhook-cli';
import { WsCliModule } from '@modularityjs/ws-cli';