state
alchemy state <subcommand> [file] [options]Inspect and manage the state store — the record of which resources
alchemy thinks exist for each stack/stage. Reads from whatever state
layer the stack file configures (e.g. Cloudflare.state(...)), or
from the on-disk .alchemy/state directory with --local. See
State Store.
The stack file is imported only to resolve its configured state layer
— pass it via the standard [file] positional (defaults to
alchemy.run.ts). There is no deploy-style --stage here: state
commands address what they inspect explicitly, so --stack,
--stage, and --fqn are addressing flags that appear only on the
subcommands that need them.
All six subcommands share these options:
| Option | Description |
|---|---|
--local | Read from local .alchemy/state instead of the stack’s configured state store — e.g. to inspect orphaned local state after a partially-failed bootstrap |
--profile <name> | Auth profile to use (defaults to default or $ALCHEMY_PROFILE) |
--env-file <path> | Load environment variables from a file |
state stacks
Section titled “state stacks”alchemy state stacks [file] [options]List every stack name present in the state store.
state stages
Section titled “state stages”alchemy state stages --stack <stack> [file] [options]List every stage that has state recorded under --stack.
state resources
Section titled “state resources”alchemy state resources --stack <stack> --stage <stage> [file] [options]List the fully-qualified resource names (FQNs) tracked under a given stack/stage.
state get
Section titled “state get”alchemy state get --stack <stack> --stage <stage> --fqn <fqn>Print a single resource’s persisted state as JSON. Output uses the
same encoding the store persists: redacted secrets are unwrapped into
{ __redacted__: ... } and Resources are flattened. If no entry
exists, it prints (not found: <stack>/<stage>/<fqn>).
# get the FQN from `state resources`, then:alchemy state get --stack MyApp --stage prod --fqn Bucketstate tree
Section titled “state tree”alchemy state tree [file] [options]Render the entire state store as a tree of stacks → stages → resources. See Inspecting State for a worked example.
state clear
Section titled “state clear”alchemy state clear [--stack <stack>] [--stage <stage>] [file] [options]Delete state entries from the store.
- Omit
--stackto clear all stacks in the store. - Pass
--stackto clear every stage under that stack. - Pass
--stackand--stageto clear a single stage. --stagewithout--stackis an error.
A confirmation prompt lists the exact scope before anything is deleted.
| Option | Description |
|---|---|
--yes | Skip the confirmation prompt |
Where next
Section titled “Where next”- Inspecting State — debugging and recovery workflows
- Adopting Resources — how deploy reclaims existing infrastructure
- State Store — where resource state lives