Skip to main content
gato eject records that your project changes a GatoJS file on purpose, and why. gato eject --undo restores a GatoJS file from the kit and removes the record. A GatoJS file is a path with a content hash in .wa/kit.json; see GatoJS files and project files. Before you eject a file, check whether the change can live in a project file instead, such as src/gato.config.ts or src/theme.css. If GatoJS is missing a way to make the change without editing its files, open an issue in webamigos/gatojs.

Eject a file

The command adds an entry to ejected in .wa/kit.json. It does not change the file:
.wa/kit.json
  • reason is required and trimmed. A missing or blank reason fails with Specify why the file is ejected: --reason "<why>".
  • ejectedAt is today’s date in UTC.
  • The path is relative to the project root. ./src/a.ts and an absolute path inside the project both become src/a.ts.
An ejected file is still updated by gato update: changes on both sides are merged three ways, like any file you changed. The entry keeps the reason next to the file, keeps gato doctor --files from reporting it, and lets the protect-gato-files hook allow agent edits to it. To change the reason of an ejected file, edit it in .wa/kit.json.

Undo

--undo writes the file’s content and permission bits from the kit at the project’s version (kitVersion) and removes its ejected entry, if there is one. It also works for a changed GatoJS file that was never ejected, which is why gato doctor --files suggests it to revert a change. After restoring a file with wa:* regions it runs gato generate. The kit source is resolved as for gato list: --kit, then GATO_KIT_SOURCE or WA_KIT_SOURCE, then kitRepo at tag v<kitVersion> (Kit source). If the last commit still has the kit’s version of the file, git checkout HEAD -- <file> restores it without the network. It also discards staged changes to the file, and it leaves the ejected entry.

Options

string
Why the project changes the file. Required without --undo; not allowed with it.
boolean
Restore the file from the kit and remove its ejected entry.
path | url
Kit source for --undo. Not allowed without --undo.

Errors

The checks below run before anything is written, in this order: All of them exit with 1. When a later step of --undo fails (writing the permission bits, writing .wa/kit.json or running generate), the CLI restores the file’s previous content and permission bits (or deletes the file if it didn’t exist before) and the previous .wa/kit.json, then exits with the original error. Kit source errors are listed in Exit codes.