Skip to main content

Crate cordis_cli

Crate cordis_cli 

Source
Expand description

Command-line runner for the cordis-rs plugin framework: cordis run <config.yml>.

The process model follows upstream Cordis’ NodeLoader: cordis run supervises a worker subprocess running the loader. The worker exits with code 51 to request a hot restart (respawned with a doubling, capped backoff), 52 to quit, and 53 when the loader never came up. The daemon exits 0 on clean shutdown, 1 when the worker never booted or died abnormally, and otherwise propagates the worker’s code — deployment pipelines always see the real outcome. SIGINT / SIGTERM dispose the root context gracefully and exit 52 (daemon 0). .env and .env.local are loaded (without overriding existing variables) before the worker boots, and the entry file is watched for hot reload.

--plugin-dir <dir> (repeatable) additionally resolves entries from dynamic-library plugins compiled against the same toolchain; a change to a library in those directories hot-restarts the worker so the new build is loaded by a fresh process.

Plugins reach the process controls through the worker service (worker::WorkerHandle): restart() maps to a full worker reload, and shutdown() stops the whole application.

Modules§

dotenv
Minimal .env loading — KEY=VALUE lines, no interpolation.
worker
Worker runtime: boot the loader, watch the config, exit on signals.

Structs§

Options
Parsed command line.

Enums§

Action
What the supervisor does after a worker exits.

Functions§

daemon_exit_code
The daemon’s own exit code after the worker stopped.
parse_args
Parse cordis arguments (after the binary name).
run
Entry point used by the cordis binary: parse arguments, load dotenv, then supervise or run as the worker.
supervisor_action
Decide whether to restart the worker after it exited with exit_code.