Skip to main content
gato generate rewrites the files that connect modules to the core: the module registries, the list of locales, the extension point catalog, the wa:* regions in shared files such as the Prisma schema, .env.example and docker-compose.yml, and the scripts that modules declare in package.json. It also links the agent skills (see Skill links). 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, events.ts, subscribers.ts, command-hooks.ts, setup.ts, slots.ts, client-slots.ts, components.ts, jobs.ts, job-runtime.ts or i18n/<locale>.json in a feature;
  • add, remove or rename a feature directory;
  • add, change or remove a feature’s extension-points.json;
  • change the content of a file a manifest points to in compose, selfhostCompose or ciSteps, or a manifest’s scripts or verify;
  • create or delete src/gato.config.ts;
  • resolve the conflicts of a gato update;
  • in the kit repository, run gato kit sync.

Output

No changes, or one line changed <file> per written file, followed by one line per skill link it created, replaced or removed. A second run without changes prints No changes 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 registry files import src/gato.config.ts when it exists, and an empty configuration otherwise, so creating or deleting that file changes them (Project configuration). Since gato-cli 0.8.0 the client file always imports the configuration and ends with gatoBranding, the checked branding section. Since gato-cli 0.9.0 the server file always has moduleEvents and moduleSubscribers right after auditSinks (Domain events). Names come from the feature folder: my-feature gives myFeatureEvents and myFeatureSubscribers, like myFeatureModule. The generated files start with a header telling you not to edit them by hand (an HTML comment in EXTENSION_POINTS.md). Since gato-cli 0.19.0 (kit format 12) the server registry is split into src/modules.data.generated.ts, src/server-registry.generated.ts and src/modules.generated.ts, the generator finds jobs.ts and job-runtime.ts, it writes the module scripts, and the server registry exports gatoConfig. Since gato-cli 0.14.0 (kit format 11) the generator also reads src/features/<name>/extension-points.json of every feature and src/shared/lib/modules/extension-points.json, and writes the catalog from them; a feature with a module.ts gets a catalog row even without the JSON file. 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.

Module scripts

A module manifest can declare scripts and verify (kit.json reference). The generator applies them to package.json, and only that file:
  • it adds every declared script the project does not have yet, and leaves a script that already has the declared command alone;
  • it writes the script verify:modules: the verify commands of all modules in registry order (core first), joined with &&, or removes the script when no module has a verify. The project’s npm run verify runs verify:modules when it exists.
It stops, before writing anything, when a script of package.json has a declared name but another command (package.json script <name> is owned by module <module>), or when two modules declare one name with different commands (script <name> is declared by modules <a> and <b>). gato remove removes the scripts of the removed module that no other module declares. After the files are written, the generator runs the same step as gato skills link: it links every .agents/skills/<name> folder into .claude/skills/<name> for Claude Code, replaces a link that points elsewhere, and removes a link to a skill that no longer exists. It never overwrites a real folder with files; it prints a warning on stderr instead. A project without .agents/skills is untouched. The .claude/skills/ folder is git-ignored, so these links never show up in git diff and do not affect the CI check below.

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, events.ts, subscribers.ts, command-hooks.ts, setup.ts, slots.ts, client-slots.ts, components.ts, jobs.ts, job-runtime.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>: missing region wa:<marker>; … and nothing changes.
  • A missing file referenced by compose, selfhostCompose 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.