Skip to main content
The GatoJS repository is two things at once: a working reference application with the core and every kit module installed, and the source of every project the CLI assembles. This page is for changes to the kit itself: the CLI, module manifests, kit workflows and releases. For how projects consume the kit, see Working with the kit.

Kit-only files

Most files are copied into projects. The ones that are not are listed as patterns in kitOnly in kit/kit.json: App tooling skips kit/: ESLint, Vitest, TypeScript and the Docker image ignore it. The reverse is not true: core workflows (ci.yml, e2e.yml, mutation.yml, the security workflows) belong to core, so they reach projects and also run in the kit, on the reference app with every module.

Module manifests

Every kit module has kit/modules/<name>.json. Its name must equal the file name, otherwise reading the manifests fails with kit/modules/<file>: name "<name>" nie zgadza się z nazwą pliku. Manifests are read core first, then alphabetically. The schema is the same as in a project’s .wa/kit.json; every field is documented in the module manifest reference.

File patterns

Patterns know **/, ** and *; everything else is literal and braces are not supported. They are matched against the git index (git ls-files), minus kitOnly and generatedFiles, but file content is read from the working tree. Two consequences when you work on the kit:
  • an uncommitted edit to a tracked file goes into a project assembled from your checkout;
  • a new file is invisible to create and the ownership test until you git add it.
The CI assemble job builds from a commit checkout, so there both match.

Docker and CI files of a module

compose and ciSteps point at files the generator reads from the project, so they must belong to the same module’s files. Keep them as docker/<name>.compose.yml (service definitions without the services: key, indented by two spaces on insertion) and ci/<name>.integration-steps.yml (a list of job steps, indented by six). The ownership test checks only the compose file; a ciSteps file outside the module passes the test and then breaks create with ENOENT.

Kit sync

The kit repository has its own .wa/kit.json. Never edit it by hand; rewrite it with:
kit sync builds the state from kit/kit.json and the manifests: kitVersion and kitRepo from version and repo, project from the placeholders, locales always ["pl", "en"], every manifest under modules with empty files, and projectModules kept from the existing file. It prints Zaktualizowano .wa/kit.json (updated) or Bez zmian (no changes). Outside the kit it fails with Brak kit/kit.json w <dir> — to nie jest repozytorium wa-kit. kit sync does not run the generator, so run both after every change to kit/modules/*.json or kit/kit.json and commit the result. The cli job in kit.yml runs the same two commands and fails if the result differs from what you committed.

File and dependency ownership

Every kit file that can reach a project has exactly one owner: the module whose files pattern covers it. Without that, create would skip a file or copy it twice, and remove could delete a file another module needs. Every npm dependency in the kit’s package.json must be declared by a manifest, in the same section, at the same version. The ownership test enforces this on the real repository:
Limits: the test sees only the git index (run it after git add), does not count dependency owners (the same dependency in two manifests passes), does not check ciSteps, and does not ship to projects. Updating a dependency in the kit is always two edits: package.json (with the lockfile) and the owning manifest.

File hashes

create, add and update record a value per copied file under modules.<name>.files in the project’s .wa/kit.json, computed after placeholder replacement: REGION_FILES comes from regionTargets in packages/gato-cli/src/generate/targets.ts, so a new region in a new file is a CLI change, not a manifest change. All files with regions belong to core. Generated files are not copied and have no hash. In the kit’s own .wa/kit.json, files is empty.

Placeholders

The kit is a working app named “WA App”. When a file listed in placeholderFiles is copied, the CLI replaces its names with the project’s, as plain string replacement in this order:
  • A file that contains the project name, slug or database name goes into placeholderFiles, otherwise projects inherit wa_app (and, for example, share the test database wa_app_test).
  • Do not use those strings with another meaning in a listed file.
  • Do not add tests to the list (a convention; nothing enforces it).
  • placeholderFiles holds exact paths, not patterns.
The assemble job greps an assembled project for the three strings (outside tests, package-lock.json and .wa/bin/**) and fails if any remain. Separately, the generator replaces {{projectSlug}} and {{projectName}} in manifest env examples on every run.

The CLI bundle

The CLI source lives in packages/gato-cli/src. One esbuild run produces two bundles that differ only in the command name they print:
  • .wa/bin/wa.mjs, committed, owned by core, so every project gets it byte for byte and runs npm run wa -- <command> without building anything;
  • packages/gato-cli/dist/gato.mjs, not committed, published to npm as gato-cli.
Both embed the version from packages/gato-cli/package.json. After every change in packages/gato-cli/src:
and commit .wa/bin/wa.mjs together with the change. The build is reproducible when dependencies come from npm ci in the repository root. In CI, the cli job’s “Kit state and generated files are up to date” step (git diff --exit-code after verify, which rebuilds the bundle) stops a pull request with a stale bundle.

CLI tests and the mutation gate

The CLI is the packages/gato-cli workspace; its dependencies are in the root package-lock.json. Install with npm ci in the root and add dependencies with npx -y npm@11.21.1 install <package> --workspace gato-cli. Mutation testing works as in the app (Testing): tests are written before the implementation and a test reviewer runs Stryker and the gate. CLI specifics:
  • The critical directories are src/generate/, src/manifest/, src/assemble/, src/commands/ and src/kit/; allowed entries in packages/gato-cli/mutation-gate.json are added by a human.
  • Stryker mutates src/**/*.ts except tests and src/bin.ts, with concurrency: "50%", timeoutFactor: 5 and vitest.related: false. The CLI’s command tests assemble projects with git and are slow under parallel load; these settings keep timeouts stable. Inside Stryker workers, test files run smallest first in a fixed order.
  • Never run two Stryker runs at once, including one in the app and one in the CLI.
  • Before the first full run after a config change, pass --force or delete reports/stryker-incremental.json; test:mutation:task always uses --force.
A change to the kit passes both gates before a pull request: npm run verify and npm run verify --prefix packages/gato-cli.

Kit CI

.github/workflows/kit.yml runs on pushes and pull requests to main: kit-mutation.yml runs the full CLI Stryker run and gate on demand. packages.yml verifies create-gato-app and smoke-tests the packed tarballs of both tool packages. Notes for people who change CI or the CLI contract:
  • The assemble job starts MinIO with its own steps, which repeat ci/uploads.integration-steps.yml. Changing the MinIO or aws-cli image means changing both and docker/uploads.compose.yml.
  • Changing the projectModules contract requires updating the fixture packages/gato-cli/src/__tests__/fixtures/project-module/ and the manifest object written in the registration step.

Workspace packages

Code that needs its own package lives in packages/, in two kinds:
  • Tool packages (packages/gato-cli, packages/create-gato-app): unscoped npm names, their own build to dist/, their own TypeScript, ESLint, Vitest and Stryker setup, published to npm from tags (Releases). They are in kitOnly, so a project never gets them; it installs gato-cli from npm.
  • Project packages (@gatojs/<name>, private: true, for example packages/env and packages/observability): copied into projects like any kit file and owned by a manifest through files. No build step: exports point at TypeScript sources, consumed through transpilePackages. A project package declares its npm dependencies in its own package.json.
There is one lockfile. gato create copies it without the tool packages’ entries and links. The deps stage of the Dockerfile has a wa:workspaces region that generate fills with a COPY packages/<name>/package.json line per package. A new tool package also goes into TOOL_PACKAGES (scripts/lib/architecture/workspaces.ts), kitOnly, the root ignores (tsconfig.json, eslint.config.mjs, vitest.config.ts, stryker.config.json) and, if it has its own ESLint config, .lintstagedrc.json.

Kit configuration

kit/kit.json configures the kit. All fields are required. A missing file gives Brak kit/kit.json w <dir> — to nie jest repozytorium wa-kit; a wrong shape gives a Zod error.

Commands for kit work