Skip to content

The CLI at a glance

The microlab CLI offers from the terminal everything a user can do in the desktop app: manage the catalog (micros, scenarios, mocks, settings), start and stop scenarios, observe status and logs, and import/export. UI and CLI share the same engine through the operations registry, so they don’t diverge.

The CLI needs the compiled engine (npm run build:electron).

Ventana de terminal
node bin/microlab.js <command> # direct
npm run cli -- <command> # via npm (note the -- separator)
microlab <command> # if you registered the global with npm link
FlagEffect
--jsonJSON output on one line, for scripts. Errors go to stderr as {"error": "..."}.
-p, --project <path>MicroLab project root (the folder with .microlab/).
-V, --versionVersion.
-h, --helpHelp (all subcommands have it).
CodeMeaning
0Success.
1Execution error (the operation failed).
2Usage error (invalid command/flags).
3The command requires a live engine and there is none.
4Timeout (for example waiting for the micros to be healthy).
5Requires a paid plan the account doesn’t have.

If the project configures login, the CLI (capability cli), the MCP (mcp) and the copilot (chat) are paid and independent. The entitlement is obtained by signing in to the app at least once. In projects without login, the CLI has no restrictions. See Capabilities.

The micros are child processes of the engine, so something must stay alive after microlab start. The CLI resolves each command like this:

  1. If there is a live engine (the app open or the headless daemon the CLI itself launches), the command runs against it over HTTP: the CLI sees and governs the same state as the UI.
  2. If there isn’t, the stateless operations (catalog, mocks on disk, settings, bundles) run in-proc over .microlab/. Those requiring live state fail with exit 3.

microlab start launches the daemon automatically if needed; microlab daemon stop shuts it down.