clilyruntime-aware CLI docs
Examples

Runtime injection patterns

Compare the Deno-style and captured-runtime examples to understand how clily decouples command logic from process globals.

Two examples are especially useful when evaluating the runtime model.

Deno-style injected runtime

The ArkType workspace simulates a Deno-style entrypoint by overriding:

  • argv
  • env
  • cwd()
  • stdout()

That shows you can keep clily's execution model while changing the surrounding runtime assumptions.

Captured stdout and exit interception

The fish runtime example overrides:

  • stdout() to collect emitted messages
  • exit() to record exit requests instead of terminating
  • onExit() to observe the final exit reason

This is the pattern to reach for when you want deterministic integration tests or when a host application needs to remain in control of process shutdown.

On this page