Skip to main content
gato generate rewrites the files that connect modules to the core: the module registry, the list of locales and the wa:* regions in shared files such as the Prisma schema, .env.example and docker-compose.yml. It reads .wa/kit.json and the feature directories on disk. It takes no options; extra arguments are ignored. How the registry is used at runtime is explained in Module registry.
gato create, gato add, gato remove and gato update (without conflicts) run it themselves at the end.

When to run it

Run it, and commit the result together with the change that triggered it, after you:
  • change .wa/kit.json, including locales and entries in projectModules;
  • add or remove module.ts, env.ts, auth.ts, auth-client.ts, audit-sink.ts or i18n/<locale>.json in a feature;
  • add, remove or rename a feature directory;
  • change the content of a file a manifest points to in compose or ciSteps;
  • resolve the conflicts of a gato update;
  • in the kit repository, run gato kit sync.

Output

Bez zmian (“no changes”), or one line zmieniono <file> (“changed”) per written file. A second run without changes prints Bez zmian and touches nothing, which is what the CI check relies on.

What it writes

The generator computes every file first and writes only at the end, so an error at any stage stops it before any file changes. It writes only files whose content differs. The three generated files start with a header telling you not to edit them by hand. Regions have no header: the generator replaces everything between the wa:<marker>:start and wa:<marker>:end lines and keeps the marker lines. In env examples, {{projectSlug}} and {{projectName}} are replaced with the values from project in .wa/kit.json, so the uploads bucket becomes S3_BUCKET=<slug>-uploads.

How features are found

The generator walks the modules in registry order (core, the other kit modules by name, then project modules alphabetically) and their files patterns. A pattern that starts with src/features/<name>/, where <name> contains no / or *, makes <name> a candidate. A candidate is registered when its directory contains at least one of module.ts, env.ts, auth.ts, auth-client.ts, audit-sink.ts or i18n/<locale>.json for a configured locale. Otherwise it is skipped silently. A feature that no pattern covers gets no menu entry, requireModuleAccess with its key returns 404 and its translations do not load.

Region rules

  • A file must contain exactly one start line and one end line for a marker, with the end below the start. A region’s content must not contain its own marker. If the file uses CRLF line endings anywhere, the whole result uses CRLF.
  • A target file that does not exist is skipped.
  • A target file without markers is skipped when the region would be empty. When some module has content for it, the generator stops with <file>: brak regionu wa:<marker>; … (“no region; add the start and end marker lines”) and nothing changes.
  • A missing file referenced by compose or ciSteps stops the generator with ENOENT, as long as the region’s target file exists.
  • Relations to models other than User and Organization, unknown manifest fields and env[].required are ignored without a warning. Review the region diff after running it.

Checking it in CI

The project’s CI runs the generator and fails if tracked files changed:
A hand edit of a generated file or region, or a feature change committed without regenerating, fails this step. Run npx gato generate and commit. See CI.

Errors

All of them exit with 1.