clilyruntime-aware CLI docs
Concepts

Runtime boundary

Override argv, env, cwd, output, debug, and exit behavior to embed clily or make tests deterministic.

The runtime option is one of the most important parts of clily.

Instead of assuming a single process shape forever, clily allows you to override the execution boundary.

Runtime surface

ClilyRuntime includes:

  • argv
  • env
  • cwd()
  • stdout(message)
  • debug(message, payload?)
  • error(message)
  • exit(request)

Use cases

  • test without mutating process.argv
  • capture output in memory
  • intercept exits instead of terminating the current process
  • simulate Deno-style invocation while still running inside Node
  • embed commands inside a larger application shell

Environment detection

clily also exports getExecutionEnvironment(), which reports data such as:

  • inferred shell
  • runtime name
  • whether TTY is available
  • CI/debug/color support

That environment metadata is used by completion shell resolution and debug defaults.

On this page