gato update moves a project from the kit version in kitVersion (.wa/kit.json) to the tag v<version>. It applies the kit’s changes between the two versions to your project and keeps your local edits, with a three-way merge per file. It updates the core and every installed kit module together; you cannot update one module on its own. You review the result with git diff and commit it yourself.
Options
Target kit version without
v: three numbers without leading zeros, optionally with a prerelease suffix (0.9.0-rc.1). There is no “latest” default. It must be higher than the project’s kitVersion (semver comparison, so 0.10.0 is newer than 0.9.0).Kit source, as for
add and list. Unlike those, update clones a local path too, so the content always comes from the tags v<kitVersion> and v<version>, never from a working tree.Print the plan and exit with
0 without changing the project, even when the plan has conflicts. Does not need a clean git tree, but still clones both kit versions.--force: a conflict is a place to merge by hand, not an error to bypass.
Before you start
- The project must be a git repository with a clean tree (
git status --porcelainempty; ignored files do not count, untracked ones do). The clean tree is your safety net:git restore . && git clean -fdbrings back the state from before the update. - Both tags,
v<kitVersion>andv<version>, must exist in the kit source. - Run
--dry-runfirst to see which files will change and where conflicts will be.
Who computes the update
The plan depends on the rules of the target version: which files have regions, the schemas, howpackage.json is assembled, the generator. An older CLI could compute it wrongly. So the CLI you run does only the first checks, clones the target tag and hands the work to the CLI bundled with that tag (.wa/bin/wa.mjs in the clone), running in your project directory with its output in your terminal. If that process fails, the outer command exits with 1 without a message of its own; the inner one has already printed the error.
A project whose bundled CLI predates the
update command prints the usage and exits with 1. Run the target version’s bundle from a clone in the project directory once: KIT_DIR=$(mktemp -d) && git clone --depth 1 --branch v<version> https://github.com/webamigos/gatojs.git "$KIT_DIR" && node "$KIT_DIR/.wa/bin/wa.mjs" update <version>. The bundle in a kit clone checks that the clone’s version equals <version>. After the update the project carries the new bundle.Order of checks
Every check and the whole merge happen in memory, before the first write.1
Options and version
No version:
Specify the kit version. Bad format, for example v0.9.0: Invalid version: v0.9.0; use a version like 0.2.0.2
Read .wa/kit.json
As in every project command, including the kit format check.
3
Target version
Equal to
kitVersion: prints Project is already on GatoJS <version> and exits with 0, even on a dirty tree and offline. Lower: Project has GatoJS <x>, newer than <version>; update does not downgrade.4
Clean git tree
Skipped with
--dry-run. Dirty tree: Uncommitted changes in the project; commit or stash them before updating. Not a repository: <dir> is not a git repository; update needs git so changes can be undone. No git command: git command not found; install git to run update.5
Kit source
A rejected source gives
Invalid kit source: <source> (Kit source).6
Bundle version
Only when you run the bundle from a kit clone: the clone’s version must equal
<version>, otherwise The bundle comes from GatoJS <x>, but the update targets <version>.7
Fetch both versions
git clone --branch v<version> (with --depth 1 for URLs) into a temporary directory, removed afterwards, also after an error. A missing tag gives Could not fetch GatoJS v<version> from <source>. … with git’s message above it. A tag whose kit/kit.json has another version gives Kit in <clone> has version <x>, expected <version>. The target’s own CLI then repeats checks 2 to 5 and clones the base version v<kitVersion>.8
Read both versions
Every kit module in
.wa/kit.json must exist in both: Module <x> does not exist in GatoJS <version>. A module removed or renamed in the kit needs a manual decision.9
Requirements
Every
requires of the installed modules at the target version must be installed: Module <x> in GatoJS <version> requires modules that are not installed: <list>. update never adds modules. Project modules are left as they are.10
Plan every file
Including the merges. A path that resolves outside the project gives
Path outside the project: <path>; a git merge-file failure gives git merge-file: <git message>.11
Dry run
With
--dry-run, print the plan and exit with 0.12
Write
Before the first write, no target (planned files,
.wa/kit.json, generated files, files with regions) may have a symlink anywhere in its path inside the project: Symbolic link on a write path: <path>, with nothing changed. Then files are written, then .wa/kit.json. A write failure is rolled back.13
Finish
Without conflicts:
gato generate, hints, and npm install unless --no-install. With conflicts: all three are skipped.The plan for each file
The plan covers the files of the installed kit modules in both versions (except kit-only files, generated files andpackage-lock.json) plus package.json. Each path has three sides:
- base: the file from tag
v<kitVersion>, with your project names in place of the placeholders; - kit: the same for tag
v<version>; - project: the file on your disk.
package.json, base and kit are assembled from the manifests of your installed modules at each version, so a dependency or script change in the kit merges with your own scripts and dependencies.
Details:
- Equality is computed like the hashes in
.wa/kit.json: files withwa:*regions are compared without the region contents, all other files byte for byte. - Base that does not match the recorded hash. A project may have been created from a kit working tree rather than a tag. “Project same as base” therefore needs both the file to equal the tagged base and the recorded hash to equal the base’s hash. Otherwise the file is treated as changed in the project, so it is merged or marked for a decision, never overwritten or deleted. The CLI counts such files in a
Warning: <n> files differ from the v<kitVersion> tag; …warning. - Merging uses
git merge-file -p --diff3with the labelsproject,v<kitVersion>andv<version>. - Files with regions have their region contents cleared on all three sides before the merge, so region differences never conflict.
gato generaterefills them. - Binary files (a NUL byte on any side) are not merged: changes on both sides give a conflict and the project’s version stays.
- Permission bits of an updated, added, merged or conflicted file come from the target kit version.
- Seed files (recorded as
seed, such asREADME.mdandsrc/theme.css) belong to the project and are never planned: not updated, merged, removed or reported, whatever the kit changed. A path in the target version’sseedFilescounts as a seed file even when.wa/kit.jsonrecorded a content hash for it, as projects created beforeseedFilesexisted did forREADME.md. A seed file new in the target version is added only when the project doesn’t have it. - Ejected files (
gato eject) are planned like any other file, so local changes are merged three ways.
Output
The header and one line per planned file, grouped in the order updated, merged, added, removed, conflict, needs decision, alphabetically within each group:--dry-runstarts withUpdate plan for GatoJS <x> → <version> (project not changed).- When the kit changed none of your files, the header is followed by
no file changes;.wa/kit.jsonstill gets the new version. - Without
--dry-run, the plan is printed only after a successful write. - Above it you see one line of git output per clone. They are not errors.
Conflicts and files that need a decision
A text conflict leavesdiff3-style markers with the base in the middle:
.wa/kit.jsonis written even with conflicts: once you resolve the markers, the project is at the target version. Runningupdate <version>again only says the project already has it, so a second run does not resolve conflicts.- With conflicts,
gato generateandnpm installdo not run, because markers can break regions andpackage.json. Until you rungenerate, generated files and regions may not match your modules. There are no migration or variable hints either: checkgit diff -- prisma/schema .env.exampleyourself. - Files that need a decision have no markers, so generate and install do run, but the exit code is still
1: scripts and agents get the same “needs a human” signal as for a conflict. Such a file has no entry in the module’sfilesin.wa/kit.json. - A file you deleted does not come back. A project file on the path of a new kit file is not overwritten; copy the kit file by hand from a clone of tag
v<version>(files listed inplaceholderFilesstill carry the kit’s placeholder names there, such aswa-app).
1
Resolve
Resolve the markers in every
conflict file and decide on every needs decision file: delete it, keep it as project code, or carry the changes over.2
Regenerate and install
npx gato generate, then npm install.3
Migration and variables
As in After the update.
4
Commit
To undo everything before committing:
git restore . && git clean -fd, then npm install so node_modules matches the restored lockfile. git clean -fd keeps files ignored by .gitignore; git status --ignored shows them. To undo one file: git restore <file>.What it writes
- Files according to the plan: added, updated, merged, with conflict markers, deleted (with empty directories above them). A binary conflict and a conflict on a new kit file’s path leave the project file unchanged.
package.jsonaccording to the plan..wa/kit.json:kitVersionandkitFormatset to the target, and for each kit module the targetversionandmanifestandfileshashes of the kit’s content (not the merged content).package.jsonandpackage-lock.jsonkeepmanaged. Files that need a decision and files absent from the target have no entry.kitRepo,project,locales,projectModulesandejectedstay as they are. Seed files, including every path in the target version’sseedFiles, are recorded asseed. Because the hashes come from the kit, a merged file with local changes still counts as changed forgato remove, and the next update has the right base.
update does not change .env or package-lock.json. The lockfile changes only with npm install, so with --no-install or after conflicts it stays old until the first install.
After the update
Without conflicts, aftergato generate, the CLI prints hints:
Then:
- Migration: run the printed command with the database up and commit the migration. The kit ships no migrations (Database and migrations).
.env: copy new variables from thewa:modulesregion of.env.exampleand set values.- With
--no-install, runnpm install, which also updatespackage-lock.json. - Review:
git diff,npm run verify, commit (withpackage-lock.json).
Rollback and its limits
- A failure before writing (checks 1 to 11) changes nothing: every file, merges included, is built in memory.
- A write failure (for example a full disk, or a file where a directory should be) is rolled back: the original content and permission bits of changed and deleted files are restored, added files and directories the command created are removed, and
.wa/kit.jsonis restored. A cleanup step that fails printsCould not clean up: <path> (<code>); the original error comes last, with a second lineCheck git status; to undo everything: git restore . && git clean -fd. - A
gato generatefailure is not rolled back: files and.wa/kit.jsonare already at the new version. The command exits with1andUpdated to GatoJS <version>, but generate failed. Run: npm run wa -- generate. Hints and install do not run. Fix the cause, rungenerate, thennpm install. - An
npm installfailure is not rolled back:Updated to GatoJS <version>, but npm install failed. Run: npm install, exit1. Hints are printed before it. - A conflict is not a write failure and rolls nothing back.
Project modules
update leaves your project modules and their entries untouched. A kit file you edited is merged like any local change. See Working with the kit for how kit changes reach projects.