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:
Podaj wersję kitu (“give the kit version”). Bad format, for example v0.9.0: Nieprawidłowa wersja: v0.9.0; podaj na przykład 0.2.0 (“invalid version”).2
Read .wa/kit.json
As in every project command.
3
Target version
Equal to
kitVersion: prints Projekt ma już wa-kit <version> (“the project already has this version”) and exits with 0, even on a dirty tree and offline. Lower: Projekt ma wa-kit <x>, nowszą niż <version>; wa update nie obniża wersji (“update does not downgrade”).4
Clean git tree
Skipped with
--dry-run. Dirty tree: Niezacommitowane zmiany w projekcie; zrób commit albo stash przed wa update (“commit or stash first”). Not a repository: <dir> nie jest repozytorium git; wa update wymaga gita, żeby dało się cofnąć zmiany. No git command: Nie znaleziono polecenia git; zainstaluj git, żeby uruchomić wa update.5
Kit source
A rejected source gives
Nieprawidłowe źródło wa-kit: <source> (Kit source).6
Bundle version
Only when you run the bundle from a kit clone: the clone’s version must equal
<version>, otherwise Bundel pochodzi z wa-kit <x>, a aktualizacja prowadzi do <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 Nie udało się pobrać wa-kit v<version> z <source>. … with git’s message above it. A tag whose kit/kit.json has another version gives Kit w <clone> ma wersję <x>, oczekiwano <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: Moduł <x> nie istnieje w wa-kit <version> (“does not exist in that kit 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: Moduł <x> w wa-kit <version> wymaga niezainstalowanych modułów: <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
Ścieżka poza projektem: <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: Dowiązanie symboliczne na ścieżce zapisu: <path> (“symlink on a write 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
Uwaga: <n> plików różni się od v<kitVersion> z tagu; …warning. - Merging uses
git merge-file -p --diff3with the labelsprojekt,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.
Output
The header and one line per planned file, grouped in the order updated, merged, added, deleted, conflict, needs a decision, alphabetically within each group:--dry-runstarts withPlan aktualizacji wa-kit <x> → <version> (bez zmian w projekcie)(“plan, no changes to the project”).- When the kit changed none of your files, the header is followed by
bez zmian w plikach(“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:
The last two lines mean “resolve the conflicts, then run generate and npm install” and “to undo the whole update:
git restore . && git clean -fd”.
.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
konflikt file and decide on every do decyzji 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:kitVersionset 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,localesandprojectModulesstay as they are. 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 printsNie udało się posprzątać: <path> (<code>); the original error comes last, with a second lineSprawdź git status; całość cofa: git restore . && git clean -fd(“check git status; this undoes everything”). - A
gato generatefailure is not rolled back: files and.wa/kit.jsonare already at the new version. The command exits with1andZaktualizowano do wa-kit <version>, ale wa generate się nie powiódł. Uruchom: npm run wa -- generate. Hints and install do not run. Fix the cause, rungenerate, thennpm install. - An
npm installfailure is not rolled back:Zaktualizowano do wa-kit <version>, ale npm install się nie powiódł. Uruchom: 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.