CLI
Inspect and cancel workflow runs from the terminal with `durable inspect` and `durable cancel`.
@dudousxd/nestjs-durable-cli gives you durable inspect and durable cancel — a quick look at
runs and their step timelines, and a way to stop one, without opening the
dashboard.
pnpm add -D @dudousxd/nestjs-durable-cliPoint it at your store
The CLI reads from a durable.config.{mjs,js,cjs} in your project. Export your already-configured
store as store, or as the default export:
import { MikroOrmStateStore } from '@dudousxd/nestjs-durable-store-mikro-orm';
import { buildOrm } from './src/orm';
export const store = new MikroOrmStateStore(await buildOrm());A default export works too — either the store itself, or an object with a store property (e.g.
export default { store }). The CLI checks store, then default.store, then default, in that
order, and errors if none of them is a StateStore.
Use it
durable inspect # list recent runs
durable inspect wrun_8Kb2 # show one run's step timeline
durable inspect --status failed # filter the listRUN WORKFLOW STATUS UPDATED
wrun_8Kb2 checkout running 3s ago
wrun_Qz71 onboarding failed 2m agocheckout [completed] v1
wrun_8Kb2
0 reserveStock (local) completed 150ms
1 payments.charge-card (remote @payments) completed 750ms ×2
2 sleep (sleep) completed 3.0s
3 shipping.dispatch (remote @logistics) completed 800msReading the output:
×2after a step's duration is an attempt count — it only shows up once a step has retried (attempts > 1); a step that succeeded on its first try has no suffix.@payments/@logisticsis the worker group the step ran on, shown only for steps that recorded one.- Timestamps in the runs list (
UPDATED) are relative — seconds/minutes/hours/days ago, rounded to the coarsest unit that fits (3s ago,2m ago,4h ago,1d ago).
| Option | Description |
|---|---|
--status <status> | running / suspended / completed / failed / cancelled |
--limit <n> | max runs to list (default 50) |
--config <path> | path to the config (default: ./durable.config.{mjs,js,cjs}) |
Cancel a run
durable cancel wrun_8Kb2This marks the run cancelled in the store — a suspended run won't resume, and the recovery/timer
poller skips it going forward. --config applies here too, same as inspect.
It's a soft cancel, not a hard kill: if a step is already in flight on some worker, that worker
finishes its current attempt before it next checks the run's status, so cancellation is observed at
the next checkpoint rather than interrupting execution mid-step. Cancelling a run that's already
completed, failed, or cancelled is a no-op — the CLI tells you it's already terminal and
leaves it alone.
Usage and exit codes
Running durable with no subcommand, or an unrecognized one, prints the usage text instead of
doing anything:
durable # prints usage, exits 0
durable frobnicate # prints usage, exits 1 (unknown subcommand)Testing
Unit-test workflows with an in-memory engine harness, crash/flaky-step injection, and replay assertions — no Postgres, no Redis, no real time.
API reference
Every public member of WorkflowCtx, the authoring decorators, WorkflowService, the WorkflowEngine's selected surface, DurableModuleOptions, the thrown error classes, and the run/checkpoint status enums — one line each, distilled from source.