This guide explains how to install and get started with CommandMate via npm.
- Prerequisites
- Installation
- Initial Setup
- Starting and Stopping the Server
- CLI Command Reference
- Troubleshooting
- Upgrading
- Uninstalling
The following tools are required to use CommandMate.
| Tool | Version | Required | Check Command |
|---|---|---|---|
| Node.js | v22+ | Yes | node -v |
| npm | - | Yes | npm -v |
| Git | - | Yes | git --version |
| tmux | - | Yes | tmux -V |
| Claude CLI | - | Optional | claude --version |
| gh CLI | - | Optional | gh --version |
# Check all dependencies
node -v && npm -v && git --version && tmux -V# Using Homebrew
brew install node git tmuxsudo apt update
sudo apt install nodejs npm git tmuxNote: Native Windows is not supported because CommandMate depends on tmux. On Windows, run CommandMate inside WSL2 — see the WSL2 Setup Guide.
Install globally using npm.
npm install -g commandmateVerify the installation:
commandmate --versioncommandmate initThe interactive setup configures:
- Worktree root directory
- Server port (default: 3000)
- External access permission (for mobile access)
- Authentication token (auto-generated when external access is enabled)
To set up with default values:
commandmate init --defaultsTo overwrite existing settings:
commandmate init --forcecommandmate start --daemoncommandmate startcommandmate start --devcommandmate start --port 3001commandmate status # Main server status
commandmate status --all # All servers (main + worktrees)
commandmate status --issue 135 # Worktree server for Issue #135commandmate stop # Stop the main server
commandmate stop --issue 135 # Stop the worktree server for Issue #135commandmate stop --forceAfter starting the server, open your browser at:
http://localhost:3000
Port change: Use the port specified with the
--portoption.
Display the version.
commandmate --versionPerform initial setup.
commandmate init [options]| Option | Description |
|---|---|
--defaults |
Set up non-interactively with default values |
--force |
Overwrite existing settings |
Start the server.
commandmate start [options]| Option | Description |
|---|---|
--daemon |
Start in background |
--dev |
Start in development mode |
-p, --port <number> |
Specify port (default: 3000) |
-i, --issue <number> |
Start a server for a specific issue worktree (Issue #136) |
--auto-port |
Automatically allocate a port for the worktree server (Issue #136) |
--auth |
Enable token authentication (Issue #331) |
--auth-expire <duration> |
Token expiration (e.g., 24h, 7d, 90m) |
--https |
Enable HTTPS |
--cert <path> |
Path to TLS certificate file |
--key <path> |
Path to TLS private key file |
--allow-http |
Suppress the HTTPS warning when using --auth without certificates |
--allowed-ips <cidrs> |
Allowed IP addresses/CIDR ranges (comma-separated, Issue #331) |
--trust-proxy |
Trust the X-Forwarded-For header from a reverse proxy |
Run an independent server per worktree.
commandmate start --issue 135 --auto-port # Start a server for Issue #135 (auto port)
commandmate start --issue 135 --port 3135 # Start on a specific portcommandmate start --auth --auth-expire 24h # Token auth (24h expiry)
commandmate start --auth --allowed-ips 192.168.1.0/24 # With IP restriction
commandmate start --https --cert ./cert.pem --key ./key.pem # HTTPSStop the server.
commandmate stop [options]| Option | Description |
|---|---|
-f, --force |
Force stop (SIGKILL) |
-i, --issue <number> |
Stop the server for a specific issue worktree (Issue #136) |
Display server status.
commandmate status [options]| Option | Description |
|---|---|
-i, --issue <number> |
Show status for a specific issue worktree (Issue #136) |
-a, --all |
Show status for all servers (main + worktrees) |
Update CommandMate to the latest version (stop -> npm install -g commandmate@latest -> restart).
commandmate update [options]| Option | Description |
|---|---|
--check |
Only check for updates (no install, stop or restart) |
-y, --yes |
Skip the confirmation prompt (required for non-interactive use) |
See Upgrading for details and caveats.
GitHub Issue management command (requires gh CLI).
commandmate issue create [options]
commandmate issue search <query>
commandmate issue list| Subcommand | Description |
|---|---|
create |
Create a new Issue |
search <query> |
Search Issues |
list |
List Issues |
| Option | Description |
|---|---|
--title <title> |
Issue title |
--body <body> |
Issue body |
--bug |
Use Bug Report template |
--feature |
Use Feature Request template |
--question |
Use Question template |
--labels <labels> |
Labels (comma-separated) |
Display CommandMate documentation.
commandmate docs [options]| Option | Description |
|---|---|
--section <name> |
Display specified section content |
--search <query> |
Search within documentation |
--all |
List all available sections |
If you see commandmate: command not found:
# Check npm global bin path
npm config get prefix
# Add to PATH (bash/zsh)
export PATH="$(npm config get prefix)/bin:$PATH"
# Persist (~/.bashrc or ~/.zshrc)
echo 'export PATH="$(npm config get prefix)/bin:$PATH"' >> ~/.zshrc
source ~/.zshrcIf you get a permission error with npm install -g:
mkdir -p ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
# Persist
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.zshrc
source ~/.zshrc
# Reinstall
npm install -g commandmatesudo npm install -g commandmateIf you see Error: Port 3000 is already in use:
# Start on a different port
commandmate start --port 3001
# Or check and stop the process using the port
lsof -ti:3000 | xargs kill -9# Check status
commandmate status
# Force stop and restart
commandmate stop --force
commandmate start --daemon
# Check logs (in config directory)
tail -f ~/.commandmate/logs/server.log# tmux not found
brew install tmux # macOS
sudo apt install tmux # Ubuntu/Debian
# Node.js version too old
node -v # v22+ required# Reset database (data will be deleted)
rm -rf ~/.commandmate/data
commandmate init --forceIf CommandMate is installed globally (npm install -g commandmate), a single commandmate update upgrades it.
commandmate updateIn a global install, it runs the following steps:
- Query the npm registry for the latest version and compare it with the current one
- Only when an update exists, print the caveats and ask for confirmation (defaults to no)
- Stop the server if it is running
- Run
npm install -g commandmate@latest - Verify that the installed version matches the latest version
- Restart the server it stopped and wait for it to respond (up to 30 seconds)
If the server was not running beforehand, it is not started for you. If you are already up to date, if your local version is newer, or if either version is a prerelease, the update is skipped.
--check prints the versions and changes nothing.
commandmate update --checkCurrent: v0.9.0
Latest: v0.10.0
Update available: yes
Use --yes to skip the confirmation prompt.
commandmate update --yesWithout --yes in an environment that has no TTY (CI, scripts), nothing is updated and the command exits with code 2.
- Startup options are not restored: after the restart the server only uses the settings in
.env. If you started it with--auth,--auth-expire,--cert,--key,--allow-http,--allowed-ips,--trust-proxy,--portor--dev, start it again manually after the update (--authgenerates a new token on every start, so existing tokens are invalidated). - Worktree servers (
--issue) are not stopped or restarted for you:npm install -greplaces the package directory (dist/,.next/), so a running worktree server may crash. Stop them before updating withcommandmate stop --issue <number>and restart them afterwards withcommandmate start --issue <number>. The command warns you when it detects running worktree servers. - Permission errors (EACCES): do not re-run with
sudo. Fix the npm global directory permissions as described in Permission Error (EACCES), then runcommandmate updateagain. - When authentication is enabled: the post-restart check degrades to "the server responds" and finishes with a warning instead of a strict readiness check. Set
CM_AUTH_TOKENfor the strict check (IP restrictions and self-signed certificates degrade it the same way). - If the update fails: the command prints a rollback command for the version you had before (
npm install -g commandmate@<previous-version>). If the server cannot be stopped, the update aborts without changing anything.
If you cannot use commandmate update, upgrade manually as before.
commandmate stop
npm install -g commandmate@latest
commandmate start --daemonIn a git clone (development) environment, commandmate update does not update anything; it prints these steps and exits.
git pull
npm install
npm run build:all
commandmate stop && commandmate start --daemon # or: npm startRun
npm run build:all, notnpm run build. The latter only builds Next.js and leaves the server (dist/server) and the CLI (dist/cli) stale.
After upgrading, verify the version:
commandmate --versioncommandmate stopnpm uninstall -g commandmate# Completely remove configuration and data
rm -rf ~/.commandmate- Web App Guide - Basic browser operations
- Quick Start Guide - Using Claude Code commands
- Deployment Guide - Production environment deployment
- README - Project overview
- Architecture - System design
- Trust & Safety - Security and permissions