Skip to main content
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.
  • An application created with fjall create app, so a fjall/<app>/infrastructure.ts file exists.
  • A prior edit to that file (fjall add, fjall modify, fjall remove, or fjall history --restore). The .bak sidecar is written by that edit, so there must be one to restore.
  • Node 22.3 or later.

Restore the last change

Undo the last change to the api application:
In a terminal, 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.
undo records no snapshot of the file it overwrites. The state you are undoing is discarded, not archived, so a resource you added and then undid has to be added again with fjall add.

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.