fjall undo restores the most recent backup of an application’s infrastructure.ts. Every command that edits that file (fjall add, fjall modify, fjall remove, and fjall history --restore) writes a sibling .bak before changing the source, so undo reverses whichever of them ran last.
undo rewrites one local file. It never touches AWS. Run fjall deploy <app> afterwards to apply the restored infrastructure.
Prerequisites
Prerequisites
- An application created with
fjall create app, so afjall/<app>/infrastructure.tsfile exists. - A prior edit to that file (
fjall add,fjall modify,fjall remove, orfjall history --restore). The.baksidecar is written by that edit, so there must be one to restore. - Node 22.3 or later.
Restore the last change
api application:
undo opens a confirmation screen before it writes anything. The screen shows:
Below that sits a
Yes / No selector. Arrow keys or y/n change the answer, enter confirms. It starts on No, so pressing enter cancels.
Skip the confirmation screen with --yes:
--yes governs the terminal confirmation only. In CI, in a piped shell, or with --non-interactive or --agent, there is no prompt to skip and the flag has no effect.What Happens
undo reads the .bak sidecar next to the application’s infrastructure.ts and writes its contents back over the source file.
Plain output looks like this:
One step back, not a stack
The.bak file holds a single prior version, and restoring it leaves the .bak unchanged. Running fjall undo twice restores the same content the second time rather than stepping one edit further back, and there is no redo. To step through older states, use the timestamped snapshots in the application’s .fjall/history directory with fjall history.
When there is no backup
If no.bak file exists, undo prints Not found: <path>.bak, exits with code 12, and leaves infrastructure.ts untouched. A brand-new application that has never been edited has nothing to undo.
Agent mode
With--agent, undo emits a structured result for AI-agent and scripted callers instead of human-readable text. The record carries action, target (the application name), path (the restored file), and restoredFrom (the .bak path), plus a follow-up suggestion.
Options
Agent flags
These flags shape output for AI-agent and scripted callers.Next Steps
fjall history
Step further back through timestamped
infrastructure.ts snapshots.fjall list
Confirm which resources the restored infrastructure declares.
fjall add
Re-add a resource you undid.
fjall deploy
Deploy the restored infrastructure to AWS.