Skip to main content

CLI

The catladder CLI provides commands for managing environments, deployments, secrets, and DevOps workflows.

Usage​

catladder <command> [options]

Global options​

OptionDescription
-y, --yesSkip all confirmation prompts
-V, --versionShow version
-h, --helpShow help

Non-interactive mode​

Every command input can be passed as a CLI flag to skip interactive prompts:

# Interactive: prompts for pod, local port, remote port
catladder project port-forward dev:web

# Non-interactive: all inputs provided
catladder project port-forward dev:web --pod-name=web-abc --local-port=3000 --remote-port=3000

You can also pass inputs as JSON:

catladder project port-forward dev:web --inputs='{"podName":"web-abc","localPort":3000,"remotePort":3000}'

Shell completions​

Install zsh completions:

catladder completion install

This adds an eval line to your ~/.zshrc. Restart your shell or run source ~/.zshrc.

To remove:

catladder completion uninstall

You can also manually add completions to your .zshrc:

eval "$(catladder completion zsh)"

Completions work for command names, flags, and dynamic values (like environment:component pairs).

Command reference​

The complete list of commands, their inputs and flags is generated from the command definitions: catladder command reference.

catladder --help and catladder <group> --help print the same information for the installed version.

Programmatic usage​

Commands can be called from code:

import { commandPortForward } from "@catladder/cli/commands";
import { runCommand } from "@catladder/cli/core";

await runCommand(commandPortForward, {
inputs: {
envComponent: "dev:web",
podName: "web-abc",
localPort: 3000,
remotePort: 3000,
},
});

Defining commands​

note

This section is for people working on catladder itself — see development.

Commands are defined with defineCommand:

import { defineCommand } from "@catladder/cli/core";

export const myCommand = defineCommand({
name: "my-command",
description: "Does something useful",
group: "project",
inputs: {
envComponent: {
type: "string",
message: "environment:component",
positional: true,
choices: async () => getAvailableEnvComponents(),
},
podName: {
type: "string",
message: "Which pod?",
choices: async (ctx) => getPodNames(await ctx.get("envComponent")),
},
localPort: {
type: "number",
message: "Local port:",
default: 3000,
},
},
execute: async (ctx) => {
const env = await ctx.get("envComponent");
const pod = await ctx.get("podName");
const port = await ctx.get("localPort");

ctx.log(`Connecting to ${pod} on port ${port}...`);

if (await ctx.confirm("Are you sure?")) {
// do the work
}
},
});

Input types​

TypeDescriptionInteractive UI
"string"Text valueText input, or list selection if choices is provided
"string[]"Array of stringsComma-separated input, or checkboxes if choices is provided
"number"Numeric valueNumber input
"boolean"True/falseConfirm (yes/no)

Input options​

OptionDescription
typeValue type ("string", "number", "boolean", "string[]")
messagePrompt message shown in interactive mode
positionalIf true, can be passed as a positional argument
defaultDefault value when not provided
choicesAsync function returning available choices. Receives ctx so it can depend on other inputs.

Context methods​

MethodDescription
ctx.get(name)Get an input value. Prompts interactively if not provided.
ctx.log(message)Output a message
ctx.confirm(message)Ask for confirmation. Skipped with --yes.