CLI Reference
clifi destroy
Tear down resources created by a CliFi workflow. Use with caution.
Synopsis
clifi destroy [target...] [flags]Description
The destroy command reverses the effects of a deployment by executing the teardown tasks defined in your workflow. It is the inverse of clifi deploy and is designed to safely remove provisioned resources, containers, or cloud infrastructure.
By default, CliFi requires interactive confirmation before destroying resources in non-local environments. Pass --yes to skip confirmation in automated contexts.
The command reads the state file from the last successful deployment to determine which resources to destroy. If the state file is missing or corrupted, CliFi aborts with an error unless --force is passed.
Flags
| Flag | Shorthand | Default | Description |
|---|---|---|---|
--env | -e | local | Target environment |
--yes | -y | false | Skip confirmation prompts |
--force | -f | false | Destroy even if state file is missing |
--dry-run | -n | false | Preview what would be destroyed |
--timeout | 300 | Timeout in seconds for teardown |
Examples
Destroy with confirmation
clifi destroy --env stagingDestroy without confirmation
clifi destroy --env staging --yesPreview destruction
clifi destroy --env production --dry-runForce destroy without state
clifi destroy --env dev --force --yesSafety guardrails
CliFi implements several safety mechanisms to prevent accidental destruction:
- Confirmation prompts for all non-local environments
- State file validation before teardown
- Dependency-aware destruction order (reverse of deployment)
- Graceful handling of partially destroyed resources
- Audit logging of all destroy operations
See also
- clifi deploy - Deploy a service
- clifi status - Check resource status