CLI reference¶
Every command is implemented with Cobra and mirrors the kubectl UX wherever possible. Use babyctl <command> --help for the
authoritative flag list. This page summarises the intent and primary flags for each command.
Global flags¶
--server– Override the API server to talk to (useful withbabyctl api-server).--kubeconfig– Provide a kubeconfig file when leveraging kubectl discovery.-o,--output– Select table, yaml, json, or hcl output where supported.--source– Limit discovery tokubectlorterraformerwhen runningapi-resources.
Command catalog¶
api-resources¶
Lists all resources that babyctl can discover from kubectl and Terraformer.
babyctl api-resources [--source kubectl|terraformer]
api-server¶
Starts a lightweight discovery server that exposes /api, /apis, and /apis/<group>/<version> so that kubectl (or other
clients) can discover the combined API surface. Pair with the kubectl integration guide.
babyctl api-server --port 8080
# With CORS enabled for frontend applications
babyctl api-server --cors-allowed-origins="http://localhost:3000,https://example.com"
CORS Support¶
CORS (Cross-Origin Resource Sharing) can be enabled to allow frontend applications running on different origins to access the API server:
--cors-allowed-origins– Comma-separated list of allowed origins (e.g.,http://localhost:3000,https://example.com). Use*to allow all origins.--cors-allowed-methods– Comma-separated list of allowed HTTP methods (default:GET, POST, PUT, DELETE, OPTIONS)--cors-allowed-headers– Comma-separated list of allowed headers (default:Content-Type, Authorization)--cors-allow-credentials– Allow credentials (cookies, authorization headers) in CORS requests
Example:
# Allow local development server
babyctl api-server --cors-allowed-origins="http://localhost:3000"
# Allow multiple domains with credentials
babyctl api-server \
--cors-allowed-origins="https://app.example.com,https://dashboard.example.com" \
--cors-allow-credentials
api-versions¶
Displays the API versions served by the local discovery cache.
babyctl api-versions
apply¶
Applies a manifest to the target infrastructure, mirroring kubectl apply semantics.
babyctl apply -f infra.yaml
babyctl apply -f- < manifest.yaml
Important flags:
-f, --filename– File, directory, or-for stdin.--dry-run– Validate manifests without persisting changes.--force-conflicts– Adopt resources even when the live state differs.
convert¶
Translates between file formats to enable round-trips with Terraform.
babyctl convert -f terraform.tf -oyaml
Use -oyaml, -ojson, or -ohcl to choose the destination format.
define¶
Interactively scaffold a new API definition under your local api-definitions tree. The command writes an
APIResourceList entry and controller stubs for bash or awscli backed resources so they are immediately discoverable
by babyctl get, describe, and explain.
babyctl define gadgets --path examples/api-definitions/apis
login¶
Authenticates to AWS SSO-backed profiles discovered from your ~/.aws/config (or AWS_CONFIG_FILE). The command shells out to
aws sso login, skipping the AWS CLI invocation entirely when cached credentials are already valid for the chosen profile.
babyctl login
When multiple SSO profiles exist, babyctl shows an interactive arrow-key selector (with a numbered fallback for non-interactive terminals) so you can pick the profile to refresh.
delete¶
Deletes the specified resources.
babyctl delete -f infra.yaml
babyctl delete deployment/my-app
diff¶
Shows the delta between live resources and the manifests that would be applied.
babyctl diff -f infra.yaml
edit¶
Fetches a live resource, opens it in $BABYCTL_EDITOR, $KUBE_EDITOR, $VISUAL, or $EDITOR (in that order, falling back to vi), and applies the diff when you save and exit—just like kubectl edit.
Note
The first implementation targets the bundled babyctl.dev/v1alpha1 Widget resource when you run against the local API definitions (--path). Additional controllers will gain edit support as their REST interfaces are wired up.
# Edit the sample widget live
BABYCTL_EDITOR="vim" babyctl edit --path examples/api-definitions/apis widget cli-demo
explain¶
Prints schema information for a resource type.
babyctl explain terraformer.aws.vpc
get¶
Retrieves resources in table or structured formats. Use babyctl get all to print every discoverable resource in table output.
babyctl get deployments
babyctl get deployment/my-app -oyaml
babyctl get all
version¶
Displays the client version and, when applicable, the API server version.
babyctl version