CLI tools
Deploy JavaScript projects, view logs, manage instances and storage, and connect your computer or server from the terminal.
runtime-cli is the command-line tool for Runtime. Deploy a local project, start and stop cloud instances, view logs, and manage storage. Start its daemon when cloud tasks also need access to your computer or server.
Project code runs in the cloud. Deployment and resource management do not require a local daemon.
Download and install
Choose your platform in Clients, download the archive, and extract it. Each archive contains the executable and a README.
| System | Package | Executable |
|---|---|---|
| Windows x64 | Windows x64 | runtime-cli.exe |
| macOS Intel / Apple Silicon | macOS Universal | runtime-cli |
| Linux x64 | Linux x64 | runtime-cli |
Open a terminal in the extracted directory containing the executable. On macOS / Linux:
chmod +x ./runtime-cli
./runtime-cli version
export PATH="$PWD:$PATH"In Windows PowerShell:
.\runtime-cli.exe version
$env:Path = "$PWD;$env:Path"These PATH settings apply to the current terminal. You can then use the runtime-cli commands below from other directories. For continued use, add the executable's directory to your system PATH.
Configure the connection
Get your own API key and its project ID from API Keys. The API address for this site is https://api.lexmount.cn.
On macOS / Linux:
export LEXMOUNT_API_KEY='<your-api-key>'
export LEXMOUNT_PROJECT_ID='<your-project-id>'
export LEXMOUNT_BASE_URL='https://api.lexmount.cn'In Windows PowerShell:
$env:LEXMOUNT_API_KEY = '<your-api-key>'
$env:LEXMOUNT_PROJECT_ID = '<your-project-id>'
$env:LEXMOUNT_BASE_URL = 'https://api.lexmount.cn'To reuse the settings in new terminals, create lexmount.env in your user home directory with the following contents:
LEXMOUNT_API_KEY='<your-api-key>'
LEXMOUNT_PROJECT_ID='<your-project-id>'
LEXMOUNT_BASE_URL='https://api.lexmount.cn'Each variable uses its first nonempty value, in this order: process environment → env beside the executable → .env beside the executable → lexmount.env in your home directory → .lexmount.env in your home directory. The CLI does not search the current project or its parents for connection settings. Supply the API key and project ID, and explicitly set the API address as shown above.
Connection credentials authenticate the CLI and are stored separately from the project's .runtime.config. Keep files containing API keys out of source control.
Deploy your first project
runtime-cli init ./my-project --name my-app
cd my-project
runtime-cli deploy
runtime-cli loginit requires a new or empty directory. It creates a stopped cloud instance and generates a minimal HTTP service, main.js, and .runtime.config locally. deploy then uploads the files and runs the project. Edit main.js and run deploy again to publish changes.
Submitted means the cloud accepted the execution request. Check logs or Instances for the result. Once the generated HTTP service is running, the instance list shows its public URL.
| Command | Behavior |
|---|---|
runtime-cli deploy | Upload files, synchronize configuration, and submit a new execution, replacing any current execution |
runtime-cli start | Synchronize configuration and start the last deployed cloud files; keep an execution that is already running or starting |
runtime-cli stop | Stop the instance and wait for cleanup, preserving code and history |
runtime-cli log | Print retained logs and follow new output; Ctrl+C only ends log viewing |
runtime-cli log --no-follow | Print existing logs and exit |
runtime-cli inspect | Print the running instance's CDP WebSocket debugging address |
These project commands read .runtime.config from the current directory, without searching parent directories. Use deploy after local code changes. start does not upload local files and requires an initial deployment.
Use the address from inspect with DevTools or another CDP tool; see Debug an instance. Anyone holding the address can connect to the debugger, so keep it private.
Project configuration and files
The .runtime.config generated by init is JSON. Keep the actual generated instance_id and adjust the other fields as needed:
{
"instance_id": "11111111-1111-4111-8111-111111111111",
"name": "my-app",
"entry": "main.js",
"max_runtime_ms": 0,
"env": { "GREETING": "Hello" },
"storage": {
"db": [],
"kv": [],
"oss": []
},
"ignore": [".git/", "node_modules/"]
}entryis the project's JS/MJS entry file.max_runtime_msis in milliseconds;0means unlimited.envcontains the cloud script's environment variables, read throughlexmount:env. An empty object clears the instance's saved environment variables.storagecontains the exact names of resources in the current project, grouped by type. It does not create resources. An empty array or omitted type removes all associations of that type. Stop the instance and wait for cleanup before changing associations.deployandstartsynchronize these settings to the cloud. Saving uses multiple requests; if one fails, earlier changes may already be saved. Correct the problem and retry.
Uploads follow .gitignore files inside the project, with the configuration's ignore rules taking precedence. The generated configuration ignores .git/ and node_modules/; .runtime.config is always excluded. Other hidden files follow the ignore rules, so add files containing credentials to those rules as well.
Each file and the complete project must fit within 8 MiB of original bytes. JS/MJS files must be UTF-8; other files are uploaded as binary assets. Runtime uses Web APIs and does not provide Node.js built-ins, npm dependency resolution, or TypeScript / JSX compilation. See Execution environment and Multiple files and images.
Manage instances by ID
These commands work from any directory and operate directly on cloud instances, without reading or changing local project configuration. Replace the placeholders with full instance UUIDs:
runtime-cli instance list
runtime-cli instance start '<instance-id>'
runtime-cli instance stop '<instance-id>'
runtime-cli instance log '<instance-id>' --no-followlist shows all instances accessible to the account, including their states and HTTP service URLs. Starting by ID uses the code and configuration already saved in the cloud. Omit --no-follow to follow logs continuously.
Deleting an instance first stops and cleans up its execution, then permanently removes the instance, code, and execution history. Associated storage and its data remain. The instance ID in any local project configuration becomes invalid:
runtime-cli instance delete '<instance-id>'Manage storage and associations
Storage belongs to the project associated with the current API key. db means databases, kv means key/value storage, and oss means object storage. These commands do not require a project directory:
runtime-cli storage db list
runtime-cli storage kv list
runtime-cli storage oss list
runtime-cli storage db create my-database
runtime-cli storage kv create my-cache
runtime-cli storage oss create my-filesAfter creation, associate resources by name in .runtime.config, then run deploy or start while the instance is stopped:
{
"storage": {
"db": ["my-database"],
"kv": ["my-cache"],
"oss": ["my-files"]
}
}You can also add or remove one association by UUID. Stop the instance first:
runtime-cli instance stop '<instance-id>'
runtime-cli instance link '<instance-id>' db '<storage-id>'
runtime-cli instance unlink '<instance-id>' db '<storage-id>'The type argument also accepts kv or oss. Manual associations do not update local configuration. The next project deploy / start reapplies the configuration's name lists.
Use runtime-cli storage db delete '<storage-id>' to permanently delete a resource, replacing db with kv or oss for other types. Remove all instance associations before deleting the resource and its data. The CLI manages resources; read and write their contents through the storage APIs.
Connect your computer or server
Start the background daemon when a cloud script needs local files, command execution, or access to your machine's network:
runtime-cli daemon start
runtime-cli daemon liststart does not require a project directory. The daemon keeps running after you close the terminal, with one daemon per operating-system user. Confirm that it is online and reachable in Clients, then use its full client ID in the remote examples. Run runtime-cli daemon stop to stop the local daemon and wait for cleanup.
Operations run as the operating-system user who started the daemon. File reads, command execution, TCP, and HTTP services are enabled by default; file API writes are disabled. Disabling file writes does not prevent shell commands from modifying files. Adjust client permissions in the console or with:
runtime-cli daemon list --all
runtime-cli daemon config '<client-id>'list --all includes offline and unreachable clients. config prompts for each permission; Enter keeps the current value, and changes are saved only after final confirmation. Offline changes apply on reconnection. Clients belong to the account and are shared across that user's projects; a project ID does not isolate clients.
runtime-cli daemon delete '<client-id>' disconnects the client and permanently revokes its ID. It does not stop or uninstall the local service. Use daemon stop to stop the local daemon.
Configure automatic startup
A temporary daemon does not start automatically after a system restart. To enable automatic startup, run these commands in your regular user terminal:
runtime-cli daemon stop
runtime-cli daemon install
runtime-cli daemon startinstall registers a service without starting it immediately. Startup behavior depends on the platform:
| System | Automatic startup |
|---|---|
| macOS | Current-user LaunchAgent, after GUI login; no sudo required |
| Windows | Current-user scheduled login task; starts after login and ends on logout |
| Linux | Starts after user login, preferring a systemd user service, then an OpenRC user service; follow the sudo prompt for the OpenRC system-service fallback, which starts at boot |
Installation saves the current connection settings, executable path, and working directory. After changing credentials or moving the executable, run daemon stop and install again. Changing environment variables alone does not update an installed service.
runtime-cli daemon uninstall stops the service and removes its automatic-startup configuration, preserving the client identity. The start command prints the daemon log location; runtime-cli log reads cloud project logs.
Version and updates
runtime-cli version
runtime-cli update --checkChecking for updates requires no API key or project ID and does not download or replace the executable. Stop the local daemon before applying an update:
runtime-cli daemon stop
runtime-cli updateUpdates select the corresponding site's release manifest using LEXMOUNT_BASE_URL. The CLI verifies the archive hash, architecture, and version before replacing the executable, preserving connection settings, project files, and the client identity. An equal or newer local version is not downgraded. If you need the daemon, restart it afterward with runtime-cli daemon start.
Help and troubleshooting
- Command options: run
runtime-cli help,runtime-cli help deploy, orruntime-cli help daemon install. Help does not require connection credentials. - Command not found: add the executable directory to the current terminal's PATH, or use
./runtime-clior.\runtime-cli.exefrom the extracted directory. - Authentication failure: check that the API key, project ID, and API address use the same site. Check whether higher-priority environment variables override your configuration file.
- Project configuration not found: enter the directory containing
.runtime.configbefore running project commands. Managing resources by ID does not require a project directory. - Local changes missing after start:
startuses deployed cloud files. Rundeployto upload local changes. - Storage association failed: check the resource type and exact name, stop the instance, and wait for cleanup. Use UUIDs when linking by ID.
For console operations, see Quickstart. For script APIs, see API Reference and Examples.
