CLI Commands
This section is the practical reference for kl.
Use it when you want to answer questions like:
- What does this command actually do?
- When should I use
kl planvskl apply? - Is
--targetsafe here? - Which environment variables affect CLI behavior?
- What is the shortest meaningful example for this command?
Command map
Daily operator path
- Plan builds a KiloLock plan spec from a Terraform configuration.
- Apply applies that spec, or builds one implicitly from files or targets.
- Status, history, and diff show what is happening now and what changed.
- Rollback and state are the operator escape hatches when you need repair.
Inspection and analysis
- Query runs read-only SQL or backend-native resource/history lookups.
- Quota previews hard and soft quota outcomes before apply.
- Refresh talks to providers directly and writes a new state version when drift is observed.
State management and metadata
- Import, export, and list move states in and out of KiloLock and enumerate what is stored.
- Provider stores provider configuration blocks for provider-driven workflows.
- Tags, operator, and version cover named version pointers, bootstrap helpers, and build info.
Configuration
- Environment and config explains CLI precedence, supported env vars, and project-local config.
The common workflow
For most teams, the meaningful path looks like this:
kl plan -f slow_a.tf -o slow-a.plan.json
kl apply --plan-spec slow-a.plan.json --confirm-scope
kl status big-state
kl history big-state --limit 5
For a plain full-state workflow:
kl plan
kl apply
For investigation without mutation:
kl query "SELECT type, COUNT(*) FROM resources GROUP BY type ORDER BY 2 DESC"
kl diff big-state --from=@1 --to=current --summary
kl status big-state
Safety model
kl planis where KiloLock predicts write scope, read scope, and reservation impact.kl applyis dry-run capable, but mutating scoped workflows require explicit acknowledgements.kl rollbackis dry-run by default.kl state rmandkl state mvare preview-first in state-engine mode.kl quotaexists to catch limit failures before the final state write.
If you are introducing KiloLock to a team, start with:
kl plankl apply --dry-runkl statuskl historykl query