CLI Reference
Workspace Manager Command-Line Client
Section titled “Workspace Manager Command-Line Client”Workspace Manager publishes a command-line client that can be used to script or automate various features.
Prerequisites
Section titled “Prerequisites”- Node.js 18 or later
- NPM 8 or later
Installation
Section titled “Installation”There are two ways to run the WSM CLI: install it globally with npm or run it with npx.
Option 1: Global Installation with npm
Section titled “Option 1: Global Installation with npm”npm install --global @ordinlabs/wsm-cliAfter installation, you can run the CLI as wsm-cli:
wsm-cli --helpOption 2: Run with npx (No Installation)
Section titled “Option 2: Run with npx (No Installation)”npx @ordinlabs/wsm-cli --helpGlobal Options
Section titled “Global Options”These options are available for all commands:
| Option | Description | Default |
|---|---|---|
-c, --config <path> | Set config path | ~/.wsm/credentials.yaml |
-p, --profile <name> | Set profile name to use from config | default |
-v, --verbose | Enable verbose logging | - |
-V, --version | Output the version number | - |
-h, --help | Display help for command | - |
Commands Overview
Section titled “Commands Overview”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 commandAuthentication
Section titled “Authentication”Log into WSM CLI and generate an API token.
wsm-cli login [options]Options:
| Option | Description | Default |
|---|---|---|
-u, --base-url <baseurl> | Set base URL of the WSM | - |
-f, --force | Force replacement of credentials | - |
Examples:
# Interactive loginwsm-cli login
# Login with specific base URLwsm-cli login --base-url https://wsm.example.com
# Force regenerate tokenwsm-cli login --forceThe 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.
Project Management
Section titled “Project Management”project list
Section titled “project list”List all projects you have access to.
wsm-cli project list [options]Options:
| Option | Description |
|---|---|
-o, --output <format> | Output format (table, json, csv) |
Examples:
# List all projectswsm-cli project list
# List projects as JSONwsm-cli project list --output jsonproject inspect
Section titled “project inspect”Inspect details of a specific project.
wsm-cli project inspect [options] <projectId>Arguments:
<projectId>- The ID of the project to inspect
Options:
| Option | Description |
|---|---|
-o, --output <format> | Output format (table, json, yaml) |
Examples:
# Inspect a projectwsm-cli project inspect proj_abc123
# Get project details as JSONwsm-cli project inspect proj_abc123 --output jsonproject delete
Section titled “project delete”Delete a project.
wsm-cli project delete [options] <projectId>Arguments:
<projectId>- The ID of the project to delete
Options:
| Option | Description |
|---|---|
-f, --force | Skip confirmation prompt |
Examples:
# Delete a project (with confirmation)wsm-cli project delete proj_abc123
# Delete without confirmationwsm-cli project delete proj_abc123 --forceWorkspace Management
Section titled “Workspace Management”workspace list
Section titled “workspace list”List all available workspaces.
wsm-cli workspace list [options]Options:
| Option | Description |
|---|---|
-o, --output <format> | Output format (table, json, csv) |
-p, --project <projectId> | Filter by project ID |
Examples:
# List all workspaceswsm-cli workspace list
# List workspaces in a specific projectwsm-cli workspace list --project proj_abc123
# List workspaces as JSONwsm-cli workspace list --output jsonworkspace inspect
Section titled “workspace inspect”Display the status and details of a workspace.
wsm-cli workspace inspect [options] <workspaceId>Arguments:
<workspaceId>- The ID of the workspace to inspect
Options:
| Option | Description |
|---|---|
-o, --output <format> | Output format (table, json, yaml) |
Examples:
# Inspect a workspacewsm-cli workspace inspect ws_xyz789
# Get workspace details as JSONwsm-cli workspace inspect ws_xyz789 --output jsonworkspace start
Section titled “workspace start”Start a workspace if it isn’t currently running.
wsm-cli workspace start [options] <workspaceId>Arguments:
<workspaceId>- The ID of the workspace to start
Options:
| Option | Description |
|---|---|
-w, --wait | Wait for workspace to be fully started |
--timeout <seconds> | Timeout for wait operation |
Examples:
# Start a workspacewsm-cli workspace start ws_xyz789
# Start and wait for it to be readywsm-cli workspace start ws_xyz789 --wait
# Start with custom timeoutwsm-cli workspace start ws_xyz789 --wait --timeout 300workspace stop
Section titled “workspace stop”Stop a running workspace.
wsm-cli workspace stop [options] <workspaceId>Arguments:
<workspaceId>- The ID of the workspace to stop
Options:
| Option | Description |
|---|---|
-w, --wait | Wait for workspace to be fully stopped |
--timeout <seconds> | Timeout for wait operation |
Examples:
# Stop a workspacewsm-cli workspace stop ws_xyz789
# Stop and wait for confirmationwsm-cli workspace stop ws_xyz789 --waitworkspace delete
Section titled “workspace delete”Delete a workspace.
wsm-cli workspace delete [options] <workspaceId>Arguments:
<workspaceId>- The ID of the workspace to delete
Options:
| Option | Description |
|---|---|
-f, --force | Skip confirmation prompt |
Examples:
# Delete a workspace (with confirmation)wsm-cli workspace delete ws_xyz789
# Delete without confirmationwsm-cli workspace delete ws_xyz789 --forceSSH Management
Section titled “SSH Management”ssh config-update
Section titled “ssh config-update”Download and update your SSH configuration from WSM.
wsm-cli ssh config-update [options]Options:
| Option | Description |
|---|---|
--dry-run | Show what would be updated without making changes |
Examples:
# Update SSH configwsm-cli ssh config-update
# Preview changes without applyingwsm-cli ssh config-update --dry-runThis command will:
- Download your personalized SSH configuration
- Save it to
~/.ssh/config.d/wsm-config - Update your
~/.ssh/configto include the WSM configuration
ssh autocomplete setup
Section titled “ssh autocomplete setup”Set up SSH autocomplete for your shell.
wsm-cli ssh autocomplete setupThis command will provide instructions for setting up autocomplete in your shell (Bash, Zsh, Fish, or PowerShell).
Examples:
# Set up autocompletewsm-cli ssh autocomplete setupFollow the on-screen instructions to add the autocomplete script to your shell configuration.
ssh autocomplete generate
Section titled “ssh autocomplete generate”Generate autocomplete suggestions (used internally by shell completion).
wsm-cli ssh autocomplete generate [options]Options:
| Option | Description |
|---|---|
--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.
Configuration Management
Section titled “Configuration Management”config show
Section titled “config show”Display current CLI configuration.
wsm-cli config show [options]Options:
| Option | Description |
|---|---|
-o, --output <format> | Output format (yaml, json) |
Examples:
# Show configwsm-cli config show
# Show config as JSONwsm-cli config show --output jsonconfig set
Section titled “config set”Set a configuration value.
wsm-cli config set <key> <value>Arguments:
<key>- Configuration key to set<value>- Value to set
Examples:
# Set base URLwsm-cli config set baseUrl https://wsm.example.com
# Set default profilewsm-cli config set defaultProfile productionConfiguration File
Section titled “Configuration File”The CLI stores configuration in ~/.wsm/credentials.yaml by default.
File Structure
Section titled “File Structure”default: baseUrl: https://wsm.example.com token: your-api-token-here
production: baseUrl: https://wsm-prod.example.com token: prod-token-hereUsing Profiles
Section titled “Using Profiles”You can maintain multiple profiles for different environments:
# Use default profilewsm-cli workspace list
# Use production profilewsm-cli --profile production workspace list
# Use custom config filewsm-cli --config ~/my-wsm-config.yaml workspace listOutput Formats
Section titled “Output Formats”Most commands support multiple output formats:
Table (Default)
Section titled “Table (Default)”Human-readable table format:
wsm-cli workspace listMachine-readable JSON format:
wsm-cli workspace list --output jsonComma-separated values for spreadsheets:
wsm-cli workspace list --output csvYAML format for configuration:
wsm-cli project inspect proj_abc123 --output yamlScripting Examples
Section titled “Scripting Examples”Start All Stopped Workspaces
Section titled “Start All Stopped Workspaces”#!/bin/bash
# Get all workspaces as JSONworkspaces=$(wsm-cli workspace list --output json)
# Parse and start each stopped workspaceecho "$workspaces" | jq -r '.[] | select(.status == "stopped") | .id' | while read ws_id; do echo "Starting workspace: $ws_id" wsm-cli workspace start "$ws_id"doneDaily Workspace Report
Section titled “Daily Workspace Report”#!/bin/bash
# Generate daily reportecho "Workspace Status Report - $(date)"echo "================================"echo ""
# List all workspaceswsm-cli workspace list --output table
# Count by statusecho ""echo "Summary:"wsm-cli workspace list --output json | jq -r 'group_by(.status) | .[] | "\(.[0].status): \(length)"'Cleanup Old Workspaces
Section titled “Cleanup Old Workspaces”#!/bin/bash
# Delete workspaces older than 30 dayswsm-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 doneError Handling
Section titled “Error Handling”The CLI uses standard exit codes:
| Exit Code | Meaning |
|---|---|
0 | Success |
1 | General error |
2 | Authentication error |
3 | Not found |
4 | Validation error |
Example Error Handling
Section titled “Example Error Handling”#!/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_codefiTroubleshooting
Section titled “Troubleshooting”Authentication Issues
Section titled “Authentication Issues”# Verify configurationwsm-cli config show
# Re-authenticatewsm-cli login --force
# Test connectionwsm-cli workspace listVerbose Logging
Section titled “Verbose Logging”Enable verbose logging to debug issues:
wsm-cli --verbose workspace listConnection Timeouts
Section titled “Connection Timeouts”If commands are timing out:
# Increase timeout for start/stop operationswsm-cli workspace start ws_xyz789 --wait --timeout 600Configuration Issues
Section titled “Configuration Issues”If you’re having config issues:
# Check current configwsm-cli config show
# Use a different config filewsm-cli --config ~/debug-config.yaml workspace list
# Use a different profilewsm-cli --profile staging workspace listAPI Token Management
Section titled “API Token Management”Creating Tokens
Section titled “Creating Tokens”- Log into your WSM admin dashboard
- Navigate to your profile page
- In the API Keys section, click Generate new access key
- Provide a description and expiration date
- Copy the token (it will only be shown once)
Using Tokens
Section titled “Using Tokens”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-hereRevoking Tokens
Section titled “Revoking Tokens”- Log into your WSM admin dashboard
- Navigate to your profile page
- In the API Keys section, find the key and click Revoke
Best Practices
Section titled “Best Practices”- Use profiles for different environments (dev, staging, production)
- Store tokens securely - never commit config files to Git
- Use
--output jsonfor scripting and automation - Enable verbose logging when debugging issues
- Use
--forcecarefully - it skips confirmation prompts - Set up autocomplete for faster command entry
- Keep CLI updated -
npm update -g @ordinlabs/wsm-cli
Getting Help
Section titled “Getting Help”Command Help
Section titled “Command Help”# General helpwsm-cli --help
# Command-specific helpwsm-cli workspace --helpwsm-cli workspace start --helpSupport
Section titled “Support”- Email: info@ordinlabs.com
- Documentation: Getting Started
- SSH Setup: SSH Configuration
Next Steps
Section titled “Next Steps”- SSH Configuration - Set up SSH access to workspaces
- Getting Started - General setup guide
- Contact Support - Get help with the CLI