CLI (lfc)
Install and use the Lifecycle CLI to examine Environments, manage Services, stream logs, and validate configuration.
lfc is the command-line interface for Lifecycle. Use it to view and manage
preview Environments (Builds), redeploy Services, stream logs, host static
sites, and validate configuration. Use --json for machine-readable results.
lfc init selects the Lifecycle deployment before first use.
These examples use generic placeholder hosts such as
https://lifecycle.example.com and myorg/myrepo. Your commands must use your
deployment values.
Overview
Node ≥ 20 is necessary.
--helpfor all commands.lfc <command> --helpworks on all commands and subcommands and lists all flags.--jsonfor automation. Add--json, or setLFC_JSON=1.--quietwhen scripting. Add--quietto suppress informational output while preserving command results and errors.- Humans and agents. Interactive prompts show only on a TTY. Without one,
commands fail fast and name the missing flag or argument. This behavior keeps
scripts and agents deterministic. Run
lfc llmsto print agent-oriented instructions.
Profiles and output
Each profile selects one Lifecycle deployment. Use separate profiles for deployments such as production and staging.
Commands use these exit codes:
| Code | Meaning |
|---|---|
0 | Success |
1 | API error, failed build, or invalid schema |
2 | Watch timeout or lfc doctor warning |
3 | Not found, missing config, or unresolved lfc doctor --fix error |
4 | Authentication error |
If the exit code is 4, use one login command:
lfc loginlfc login --deviceon a headless machine
Retry the failed command. Make sure of your identity:
lfc whoami
Configuration
Point the CLI at your deployment. Interactively:
Or non-interactively (for scripts, dotfiles, onboarding docs):
init validates the URL format and tries to reach the API. If the API is not
reachable, init shows a warning and saves the profile. When authentication is
on, it starts the SSO login. These flags are useful:
--ui-urlenableslfc builds open.--no-loginskips the login step.--deviceuses device-code login.--name <profile>names the profile.--forceoverwrites an existing profile.
Manage profiles
Environment variables
| Variable | Effect |
|---|---|
LIFECYCLE_API_URL | Override the API base URL. |
LFC_PROFILE | Select the active profile by name. |
LFC_JSON=1 | Force JSON output globally. |
LFC_CONFIG_DIR | Override the config directory location. |
One-off usage with no saved config (auth-less deployments only):
Commands
Authentication
Builds (preview Environments)
When you know the pull request or branch but do not know the Environment ID,
use lfc builds find. A full pull request URL identifies the repository. A
pull request number or branch name also needs --repo.
When you use --json, a successful result contains found, build, and
matches.
Exit code 3 means that no build exists. Exit code 1 means that the scan
stopped before it could give a conclusive result.
Use lfc builds list --search <text> to search by Environment ID, namespace,
pull request title, repository, or author. By default, list excludes
torn_down and pending. Use --all or add --exclude to change that filter.
Per-build environment-variable overrides:
Services in a build
Pods & runtime logs
On an interactive terminal, run the command without pod-name to select a pod
and container. In automation, specify the pod and container.
Schema validation
Exit code 0 means valid. Exit code 1 means invalid and prints errors for
each field. Exit code 3 means that the CLI did not find a configuration file.
Offline validation uses the schema in your installed CLI. If results differ,
use --repo and --branch. The server result controls that deployment.
Static sites
Diagnostics & agent instructions
All commands support --help. For automation, send --json results to a
JSON processor. For example, use
lfc builds get <uuid> --json | jq '.deploys[] | {name: .deployable.name, url: .publicUrl}'.