stem_cli

pub package Dart License Buy Me A Coffee

Command-line tooling for the Stem runtime. The CLI depends on the core package plus adapter plug-ins (stem_redis, stem_postgres).

Install

dart pub global activate stem_cli

Ensure the activation directory is on your PATH:

export PATH="$HOME/.pub-cache/bin:$PATH"
stem --help

Adapter Support

Out of the box the CLI knows how to talk to the Redis and Postgres adapters provided by stem_redis and stem_postgres. Custom adapters can be supported by wrapping the CLI context builders (see src/cli/utilities.dart).

Task Registry Introspection

List tasks that the current CLI context knows about:

stem tasks ls
# or JSON
stem tasks ls --json | jq

The command relies on the active CliContext exposing a TaskRegistry (CliContext.registry). When you run the CLI alongside your application, pass a custom contextBuilder that wires in the registry you use to boot workers so the CLI can display descriptions, tags, and idempotency markers.

Workflow Introspection

Inspect suspended workflows and cancellation policies:

stem wf waiters --topic user.updated
# JSON output
stem wf waiters --topic user.updated --json | jq

# Display detailed metadata for a specific run
stem wf show <runId> --json | jq

# Start a run with automatic cancellation limits
stem wf start reports.generate --max-run 30m --max-suspend 2m

Local Integration Stack

The package includes the docker compose stack used by integration suites. Start Redis/Postgres plus TTL CA certificates with:

docker compose -f docker/testing/docker-compose.yml up -d postgres redis

or source the helper script to export integration environment variables:

source ./_init_test_env

Tests

Run the CLI unit tests with:

dart test

Integration suites auto-skip when the docker services are unavailable. Set STEM_CLI_RUN_MULTI=true to enable the worker multi command smoke test.

Libraries

stem_cli