The Executor CLI (executor) is a cross-platform, single-file binary built with Bun that serves as a headless host for the Executor SDK. It manages a background daemon, provides a rich command-line interface for tool discovery and invocation, and bridges the local executor to AI agents via the Model Context Protocol (MCP).
The CLI is implemented using effect/unstable/cli and acts as a wrapper around the @executor-js/local server and the @executor-js/api layer.
The CLI exposes several primary command groups:
install / uninstall: Manages the OS-native background service (launchd, systemd, Task Scheduler) apps/cli/src/service.ts76-94web: Launches the local server and opens the embedded React console in the default browser apps/cli/src/main.ts96-102daemon: Low-level management of the background process, including run (foreground) and start/stop (background) apps/cli/src/daemon.ts112-137tools: Inspects the tool catalog, searches by intent, and describes tool schemas apps/cli/src/tooling.ts49-105call: Invokes a tool by its hierarchical path (e.g., github.issues.create) apps/cli/src/tooling.ts149-190mcp: Acts as an MCP stdio bridge for agents like Claude Code or Cursor apps/cli/src/main.ts73-75The following diagram maps CLI user actions to the internal functions and classes that handle them.
CLI Command Mapping
Sources: apps/cli/src/main.ts64-176 apps/cli/src/tooling.ts49-151 apps/cli/src/service.ts76-94
The CLI uses a "daemon" model to ensure a local API server is always available without requiring the user to manually manage processes.
When a command requiring the API is run (like call or tools), the CLI checks if a daemon is already reachable apps/cli/src/daemon.ts88-98 If not, it attempts to start one:
acquireDaemonStartLock to prevent race conditions where multiple CLI instances try to spawn a daemon simultaneously apps/cli/src/daemon-state.ts118-1244788 or 4789 apps/cli/src/daemon.ts106-110daemon run --foreground arguments apps/cli/src/daemon.ts112-137For permanent backgrounding, executor install registers the binary with the host OS:
launchd plist in ~/Library/LaunchAgents apps/cli/src/service.ts15-18systemd --user unit file apps/cli/src/service.ts15-18schtasks.exe to create a Task Scheduler entry and a .vbs launcher to hide the console window apps/cli/src/service.ts24-27Sources: apps/cli/src/daemon.ts104-166 apps/cli/src/daemon-state.ts118-130 apps/cli/src/service.ts1-28
The CLI provides a hierarchical "path-based" interface to the flat tool catalog.
Tools are addressed using dot-notation (e.g., stripe.customers.list). The inspectToolPath function allows the CLI to provide "help" at any level of the hierarchy:
When executor call <path> <json> is executed:
resolveToolInvocation splits the path and identifies if the last argument is inline JSON or a file path (prefixed with @) apps/cli/src/tooling.ts149-189buildInvokeToolCode) that will be executed by the kernel's execution engine apps/cli/src/tooling.ts161-166/api/executions endpoint.Tool Invocation Flow
Sources: apps/cli/src/tooling.ts15-116 apps/cli/src/tooling.ts149-190 apps/cli/src/main.ts160-176
The CLI supports a "Device Code" flow for authenticating with Executor Cloud without requiring the user to manually copy-paste long-lived tokens.
requestDeviceCode calls the cloud's /oauth/device/code endpoint apps/cli/src/device-login.ts93-94openBrowser apps/cli/src/device-login.ts90pollForDeviceTokens, checking the cloud's token endpoint until the user completes the login apps/cli/src/device-login.ts91@napi-rs/keyring apps/cli/src/main.ts1-3Sources: apps/cli/src/device-login.ts88-94 apps/cli/src/main.ts1-3
The CLI is distributed as a self-contained binary for multiple platforms.
Because Bun's bun build --compile does not bundle native .node files, the build script apps/cli/src/build.ts explicitly:
@napi-rs/keyring and @libsql/client for the target platform apps/cli/src/build.ts135-173dist directory alongside the compiled binary apps/cli/src/build.ts181-200apps/cli/src/native-bindings.ts (imported first in main.ts) sets environment variables like NAPI_RS_NATIVE_LIBRARY_PATH so the loaders find these colocated files apps/cli/src/main.ts1-3The build process embeds the QuickJS WASM module and the 1Password SDK WASM directly into the binary so that the CLI has no external dependencies apps/cli/src/build.ts15-34 The local web UI is also baked into the binary as a generated asset apps/cli/src/main.ts178-179
Sources: apps/cli/src/build.ts1-200 apps/cli/src/main.ts1-43
Refresh this wiki