CLI Reference
The knot command-line interface provides tools for managing servers, connecting to spaces, and automating workflows.
Server Commands
knot server
Start the knot server.
knot server --config knot.tomlOptions:
--config: Path to configuration file--validate: Validate configuration without starting server
knot scaffold
Generate configuration file templates.
# Generate server configuration
knot scaffold --server > knot.toml
# Generate agent configuration
knot scaffold --agent > agent.tomlknot genkey
Generate encryption key for configuration.
knot genkeyUse the output in the server.encrypt or server.cluster.key configuration fields.
Client Commands
knot connect
Connect to a knot server and authenticate.
knot connect https://knot.example.com:3000Credentials are stored in ~/.config/knot/knot.yml for subsequent commands.
Options:
--server-name: Name for this server connection (for managing multiple servers)
knot forward
Forward connections between local machine and spaces.
SSH Forwarding
knot forward ssh SPACE_NAMEUse with SSH ProxyCommand:
ssh -o ProxyCommand='knot forward ssh %h' user@spacenamePort Forwarding
knot forward port LOCAL_ADDR SPACE_NAME REMOTE_PORTExample:
knot forward port 127.0.0.1:8080 myspace 80knot tunnel
Create tunnels to expose services publicly.
knot tunnel PROTOCOL PORT TUNNEL_NAMEProtocols: http, https
Example:
knot tunnel http 8080 myappCreates tunnel at username-myapp.tunnel.example.com.
knot ssh-config
Manage SSH configuration entries for spaces.
# Add entries for all spaces
knot ssh-config update
# Remove all entries
knot ssh-config removeAutomatically updates ~/.ssh/config with ProxyCommand entries.
knot run
Execute commands in a space.
knot run SPACE_NAME COMMAND [ARGS...]Example:
knot run myspace ls -la /homeknot cp
Copy files between local machine and space.
# Copy to space
knot cp LOCAL_FILE SPACE_NAME:REMOTE_PATH
# Copy from space
knot cp SPACE_NAME:REMOTE_PATH LOCAL_FILEExamples:
knot cp config.json myspace:/etc/app/
knot cp myspace:/var/log/app.log ./logs/Agent Commands
These commands run inside a space.
knot agent
Start the knot agent inside a container.
knot agent --config agent.tomlUsually started automatically by container entrypoint.
knot agent shutdown
Request space shutdown from inside the space.
knot agent shutdownknot agent restart
Request space restart from inside the space.
knot agent restartknot agent set-note
Set space note from inside the space.
knot agent set-note "Deployment completed"Space Management
List Spaces
knot spaces listStart Space
knot spaces start SPACE_NAMEStop Space
knot spaces stop SPACE_NAMEDelete Space
knot spaces delete SPACE_NAMEGlobal Options
Available for most commands:
--help: Show command help--version: Show version information--server-name: Select server connection (when managing multiple servers)
Configuration File
Client configuration is stored in ~/.config/knot/knot.yml:
servers:
default:
url: https://knot.example.com:3000
token: <auth-token>
production:
url: https://knot-prod.example.com:3000
token: <auth-token>Switch between servers using --server-name flag.
Environment Variables
KNOT_SERVER: Override server URLKNOT_TOKEN: Override authentication tokenKNOT_CONFIG: Override config file path
Exit Codes
0: Success1: General error2: Authentication error3: Connection error4: Not found error