Skip to content

CLI Reference

Workspace Manager publishes a command-line client that can be used to script or automate various features.

  • Node.js 18 or later
  • NPM 8 or later

There are two ways to run the WSM CLI: install it globally with npm or run it with npx.

Terminal window
npm install --global @ordinlabs/wsm-cli

After installation, you can run the CLI as wsm-cli:

Terminal window
wsm-cli --help
Terminal window
npx @ordinlabs/wsm-cli --help

These options are available for all commands:

OptionDescriptionDefault
-c, --config <path>Set config path~/.wsm/credentials.yaml
-p, --profile <name>Set profile name to use from configdefault
-v, --verboseEnable verbose logging-
-V, --versionOutput the version number-
-h, --helpDisplay help for command-
Terminal window
wsm-cli [options] [command]
Commands:
login Log into WSM CLI
project Project management commands
workspace Workspace management commands
ssh SSH management commands
config Edit config values of the CLI
help Display help for command

Log into WSM CLI and generate an API token.

Terminal window
wsm-cli login [options]

Options:

OptionDescriptionDefault
-u, --base-url <baseurl>Set base URL of the WSM-
-f, --forceForce replacement of credentials-

Examples:

Terminal window
# Interactive login
wsm-cli login
# Login with specific base URL
wsm-cli login --base-url https://wsm.example.com
# Force regenerate token
wsm-cli login --force

The login command will prompt you for the base URL of your WSM admin (e.g., https://wsm.example.com) and open a browser for authentication.


List all projects you have access to.

Terminal window
wsm-cli project list [options]

Options:

OptionDescription
-o, --output <format>Output format (table, json, csv)

Examples:

Terminal window
# List all projects
wsm-cli project list
# List projects as JSON
wsm-cli project list --output json

Inspect details of a specific project.

Terminal window
wsm-cli project inspect [options] <projectId>

Arguments:

  • <projectId> - The ID of the project to inspect

Options:

OptionDescription
-o, --output <format>Output format (table, json, yaml)

Examples:

Terminal window
# Inspect a project
wsm-cli project inspect proj_abc123
# Get project details as JSON
wsm-cli project inspect proj_abc123 --output json

Delete a project.

Terminal window
wsm-cli project delete [options] <projectId>

Arguments:

  • <projectId> - The ID of the project to delete

Options:

OptionDescription
-f, --forceSkip confirmation prompt

Examples:

Terminal window
# Delete a project (with confirmation)
wsm-cli project delete proj_abc123
# Delete without confirmation
wsm-cli project delete proj_abc123 --force

List all available workspaces.

Terminal window
wsm-cli workspace list [options]

Options:

OptionDescription
-o, --output <format>Output format (table, json, csv)
-p, --project <projectId>Filter by project ID

Examples:

Terminal window
# List all workspaces
wsm-cli workspace list
# List workspaces in a specific project
wsm-cli workspace list --project proj_abc123
# List workspaces as JSON
wsm-cli workspace list --output json

Display the status and details of a workspace.

Terminal window
wsm-cli workspace inspect [options] <workspaceId>

Arguments:

  • <workspaceId> - The ID of the workspace to inspect

Options:

OptionDescription
-o, --output <format>Output format (table, json, yaml)

Examples:

Terminal window
# Inspect a workspace
wsm-cli workspace inspect ws_xyz789
# Get workspace details as JSON
wsm-cli workspace inspect ws_xyz789 --output json

Start a workspace if it isn’t currently running.

Terminal window
wsm-cli workspace start [options] <workspaceId>

Arguments:

  • <workspaceId> - The ID of the workspace to start

Options:

OptionDescription
-w, --waitWait for workspace to be fully started
--timeout <seconds>Timeout for wait operation

Examples:

Terminal window
# Start a workspace
wsm-cli workspace start ws_xyz789
# Start and wait for it to be ready
wsm-cli workspace start ws_xyz789 --wait
# Start with custom timeout
wsm-cli workspace start ws_xyz789 --wait --timeout 300

Stop a running workspace.

Terminal window
wsm-cli workspace stop [options] <workspaceId>

Arguments:

  • <workspaceId> - The ID of the workspace to stop

Options:

OptionDescription
-w, --waitWait for workspace to be fully stopped
--timeout <seconds>Timeout for wait operation

Examples:

Terminal window
# Stop a workspace
wsm-cli workspace stop ws_xyz789
# Stop and wait for confirmation
wsm-cli workspace stop ws_xyz789 --wait

Delete a workspace.

Terminal window
wsm-cli workspace delete [options] <workspaceId>

Arguments:

  • <workspaceId> - The ID of the workspace to delete

Options:

OptionDescription
-f, --forceSkip confirmation prompt

Examples:

Terminal window
# Delete a workspace (with confirmation)
wsm-cli workspace delete ws_xyz789
# Delete without confirmation
wsm-cli workspace delete ws_xyz789 --force

Download and update your SSH configuration from WSM.

Terminal window
wsm-cli ssh config-update [options]

Options:

OptionDescription
--dry-runShow what would be updated without making changes

Examples:

Terminal window
# Update SSH config
wsm-cli ssh config-update
# Preview changes without applying
wsm-cli ssh config-update --dry-run

This command will:

  1. Download your personalized SSH configuration
  2. Save it to ~/.ssh/config.d/wsm-config
  3. Update your ~/.ssh/config to include the WSM configuration

Set up SSH autocomplete for your shell.

Terminal window
wsm-cli ssh autocomplete setup

This command will provide instructions for setting up autocomplete in your shell (Bash, Zsh, Fish, or PowerShell).

Examples:

Terminal window
# Set up autocomplete
wsm-cli ssh autocomplete setup

Follow the on-screen instructions to add the autocomplete script to your shell configuration.

Generate autocomplete suggestions (used internally by shell completion).

Terminal window
wsm-cli ssh autocomplete generate [options]

Options:

OptionDescription
--current <word>Current word being completed
--previous <word>Previous word in command line

This command is typically called by your shell’s completion system and not used directly.


Display current CLI configuration.

Terminal window
wsm-cli config show [options]

Options:

OptionDescription
-o, --output <format>Output format (yaml, json)

Examples:

Terminal window
# Show config
wsm-cli config show
# Show config as JSON
wsm-cli config show --output json

Set a configuration value.

Terminal window
wsm-cli config set <key> <value>

Arguments:

  • <key> - Configuration key to set
  • <value> - Value to set

Examples:

Terminal window
# Set base URL
wsm-cli config set baseUrl https://wsm.example.com
# Set default profile
wsm-cli config set defaultProfile production

The CLI stores configuration in ~/.wsm/credentials.yaml by default.

default:
baseUrl: https://wsm.example.com
token: your-api-token-here
production:
baseUrl: https://wsm-prod.example.com
token: prod-token-here

You can maintain multiple profiles for different environments:

Terminal window
# Use default profile
wsm-cli workspace list
# Use production profile
wsm-cli --profile production workspace list
# Use custom config file
wsm-cli --config ~/my-wsm-config.yaml workspace list

Most commands support multiple output formats:

Human-readable table format:

Terminal window
wsm-cli workspace list

Machine-readable JSON format:

Terminal window
wsm-cli workspace list --output json

Comma-separated values for spreadsheets:

Terminal window
wsm-cli workspace list --output csv

YAML format for configuration:

Terminal window
wsm-cli project inspect proj_abc123 --output yaml

#!/bin/bash
# Get all workspaces as JSON
workspaces=$(wsm-cli workspace list --output json)
# Parse and start each stopped workspace
echo "$workspaces" | jq -r '.[] | select(.status == "stopped") | .id' | while read ws_id; do
echo "Starting workspace: $ws_id"
wsm-cli workspace start "$ws_id"
done
#!/bin/bash
# Generate daily report
echo "Workspace Status Report - $(date)"
echo "================================"
echo ""
# List all workspaces
wsm-cli workspace list --output table
# Count by status
echo ""
echo "Summary:"
wsm-cli workspace list --output json | jq -r 'group_by(.status) | .[] | "\(.[0].status): \(length)"'
#!/bin/bash
# Delete workspaces older than 30 days
wsm-cli workspace list --output json | \
jq -r '.[] | select(.lastUsed < (now - 2592000)) | .id' | \
while read ws_id; do
echo "Deleting old workspace: $ws_id"
wsm-cli workspace delete "$ws_id" --force
done

The CLI uses standard exit codes:

Exit CodeMeaning
0Success
1General error
2Authentication error
3Not found
4Validation error
#!/bin/bash
if wsm-cli workspace start ws_xyz789; then
echo "Workspace started successfully"
else
exit_code=$?
echo "Failed to start workspace (exit code: $exit_code)"
exit $exit_code
fi

Terminal window
# Verify configuration
wsm-cli config show
# Re-authenticate
wsm-cli login --force
# Test connection
wsm-cli workspace list

Enable verbose logging to debug issues:

Terminal window
wsm-cli --verbose workspace list

If commands are timing out:

Terminal window
# Increase timeout for start/stop operations
wsm-cli workspace start ws_xyz789 --wait --timeout 600

If you’re having config issues:

Terminal window
# Check current config
wsm-cli config show
# Use a different config file
wsm-cli --config ~/debug-config.yaml workspace list
# Use a different profile
wsm-cli --profile staging workspace list

  1. Log into your WSM admin dashboard
  2. Navigate to your profile page
  3. In the API Keys section, click Generate new access key
  4. Provide a description and expiration date
  5. Copy the token (it will only be shown once)

Tokens are automatically managed by the login command, but you can also manually add them to your config file:

default:
baseUrl: https://wsm.example.com
token: your-api-token-here
  1. Log into your WSM admin dashboard
  2. Navigate to your profile page
  3. In the API Keys section, find the key and click Revoke

  • Use profiles for different environments (dev, staging, production)
  • Store tokens securely - never commit config files to Git
  • Use --output json for scripting and automation
  • Enable verbose logging when debugging issues
  • Use --force carefully - it skips confirmation prompts
  • Set up autocomplete for faster command entry
  • Keep CLI updated - npm update -g @ordinlabs/wsm-cli

Terminal window
# General help
wsm-cli --help
# Command-specific help
wsm-cli workspace --help
wsm-cli workspace start --help