Skip to content

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

CommandDescription
module:listList all registered modules with their dependencies
module:preference:listShow preference override chains
module:pool:listShow pool entries grouped by pool token

Assets

Package: @modularityjs/assets-cli

CommandDescription
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

CommandDescription
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

CommandDescription
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:

OptionDescription
--attributes <json>Identity attributes as a JSON object (e.g. '{"roles":["admin"]}')

Database

Package: @modularityjs/database-cli

CommandDescription
database:statusShow database connection status
database:migration:listList all database migrations with their status
database:migration:runRun all pending database migrations
database:migration:rollbackRollback the last executed database migration
database:migration:generate <name>Generate a new database migration from schema changes

HTTP

Package: @modularityjs/http-cli

CommandDescription
http:route:listList all registered HTTP routes

OpenAPI

Package: @modularityjs/openapi-cli

CommandDescription
openapi:exportEmit the OpenAPI document to stdout (or to a file via --output)

Options for openapi:export:

OptionDescription
--output <path>Write the document to this file instead of stdout
--minifyEmit 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

CommandDescription
event:listList all registered event handlers

Health

Package: @modularityjs/health-cli

CommandDescription
health:statusRun all health indicators and display aggregated status

Queue

Package: @modularityjs/queue-cli

CommandDescription
queue:listList all registered queue consumers
queue:dead-letter:list [topic]List dead-lettered messages

Options for queue:dead-letter:list:

OptionDescription
--purgePurge dead-lettered messages after listing

Outbox

Package: @modularityjs/outbox-cli

CommandDescription
outbox:listList rows from the outbox (read-only — does not claim)
outbox:dispatchDrain pending outbox rows by publishing them now
outbox:retry <id>Requeue an outbox row — clears dispatched/dead/claim state and resets attempts
outbox:statsPrint pending/dispatched/dead counts for the outbox

Options for outbox:list:

OptionDescription
--state <state>Filter by state (one of: pending, dispatched, dead)
--limit <n>Maximum rows to display (default 20)

Options for outbox:dispatch:

OptionDescription
--limit <n>Maximum number of rows to fetch in this run
--loopKeep dispatching while pending rows exist (single-shot otherwise)

Cache

Package: @modularityjs/cache-cli

CommandDescription
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

CommandDescription
lock:release <key>Release a distributed lock using its owner token

Options for lock:release:

OptionDescription
--token <token>Owner token returned by acquire (required at runtime — the command exits non-zero if omitted)

Scheduler

Package: @modularityjs/scheduler-cli

CommandDescription
scheduler:listList all registered scheduled jobs
scheduler:run <name>Manually trigger a scheduled job by name

Storage

Package: @modularityjs/storage-cli

CommandDescription
storage:list [prefix]List stored objects

Webhook

Package: @modularityjs/webhook-cli

CommandDescription
webhook:listList 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

CommandDescription
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

CommandDescription
ws:listList all connected WebSocket clients by id
ws:broadcast <type>Broadcast a JSON message to all connected WebSocket clients

Options for ws:broadcast:

OptionDescription
--data <json>Message payload as JSON (default: null)

Plugins

Package: @modularityjs/plugins-cli

CommandDescription
plugin:listList all registered plugins with their targets and types

Setup

Include the CLI facade in your app to get all commands:

typescript
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';