The kl CLI is a command-line tool for managing Kloudlite workspaces from within your Dev Container. It provides commands to manage workspace configuration, packages, environment connections, and service interception.
Example: Common Commands
# Show workspace status
kl status
# Add packages
kl pkg add git vim curl
# Connect to environment
kl env connect my-env
# Intercept a service
kl intercept start api-server
Interactive Mode
Many commands support interactive mode using fuzzy-find (fzf) when run without arguments, making it easy to select packages, environments, or services.
Display comprehensive workspace information including metadata, resource usage, access URLs, and timing information.
kl status
Displays:
Show version information for the kl CLI tool.
kl version
Manage Nix packages in your workspace using the kl pkg command (aliases: package, p).
Search for available Nix packages using the Devbox package registry.
kl pkg search nodejs
kl p s python
Add packages to your workspace. When run without arguments, enters interactive mode with fuzzy search and version selection. When run with package names, automatically installs the latest version.
kl pkg add # Interactive mode
kl pkg add git vim curl # Add multiple packages
kl p a nodejs python # Using aliases
Timeout: Package installation waits up to 5 minutes for completion.
Install a specific Nix package with optional version, channel, or commit specification.
Flags:
--version - Semantic version (e.g., 24.0.0)--channel - Nixpkgs channel (e.g., nixos-24.05)--commit - Exact nixpkgs commit hashkl pkg install nodejs
kl pkg install nodejs --version 20.0.0
kl pkg install vim --channel nixos-24.05
kl p i git --channel unstable
Remove a package from your workspace.
kl pkg uninstall git
kl p rm vim
Display all packages in the workspace spec and their installation status.
kl pkg list
kl p ls
Output includes:
Manage workspace environment connections using the kl env command (aliases: e, environment). When connected to an environment, services can be accessed using short DNS names.
Connect workspace to an environment for simplified service access. If no environment name is provided, an interactive list will be shown.
kl env connect # Interactive selection
kl env connect my-env # Connect to specific env
kl e c my-env # Using aliases
After Connecting
Access services using short names like postgres:5432 instead of full qualified names.
Disconnect workspace from the connected environment. This removes all active intercepts for that environment.
kl env disconnect
kl e d
Show the current environment connection status and available services.
kl env status
kl e st
Displays:
Manage service interception using the kl intercept command (aliases: i, int). Service interception redirects traffic from a service to your workspace.
Prerequisite
You must connect to an environment using kl env connect before you can intercept services.
Start intercepting a service to redirect its traffic to your workspace. If no service name is provided, an interactive list will be shown with port mapping options.
kl intercept start # Interactive selection
kl intercept start api-server # Intercept specific service
kl i s api-server # Using aliases
Stop intercepting a service and restore normal traffic routing. If no service name is provided, an interactive list of active intercepts will be shown.
kl intercept stop # Interactive selection
kl intercept stop api-server # Stop specific intercept
kl i sp api-server # Using aliases
List all active service intercepts in the connected environment.
kl intercept list
kl i ls
Output includes:
Show detailed status of service intercept(s). Can show all intercepts or a specific service intercept.
kl intercept status # Show all intercepts
kl intercept status api-server # Show specific service
kl i st api-server # Using aliases
Displays: