Skip to main content
gato add copies a kit module, and any module it requires that the project does not have yet, into the project. It adds the module’s npm dependencies to package.json, records the files in .wa/kit.json, regenerates the wiring and installs dependencies. It never overwrites a file that already exists.

Options

string
required
Name of a kit module, as printed by gato list.
path | url
Where to read the kit from. Default: GATO_KIT_SOURCE, then kitRepo at tag v<kitVersion>. See Kit source.
boolean
Skip npm install at the end.

Order of checks

1

Read .wa/kit.json

A missing file gives Brak .wa/kit.json w <dir> — to nie jest projekt wa-kit (“no .wa/kit.json, not a GatoJS project”). An invalid file gives a JSON or schema error, and invalid project modules stop the command too.
2

Fetch the kit

From the kit source. This happens before the refusals in the next step: gato add uploads --kit /missing in a project that already has uploads reports the source error, and with the default kitRepo even a refusal needs network access.
3

Refusals

Moduł <x> jest już zainstalowany (“module is already installed”, also for core). Moduł <x> jest modułem projektu; zmień jego nazwę albo usuń wpis z projectModules (“the name belongs to a project module; rename it or remove its projectModules entry”).
4

Validate the kit

kit/kit.json and every manifest in kit/modules/ are checked against the schema. A broken manifest is reported only now.
5

Resolve modules

The module plus every module in its requires that the project does not have. An unknown name gives Nieznany moduł: <name>. Dostępne: <list>.
6

List kit files

With git ls-files. A local kit without .git fails here with <path> nie jest repozytorium git (“is not a git repository”); without git on PATH with spawn git ENOENT.
7

Check for collisions

If anything (file, directory or symlink, even a dangling one) exists at the path of any file to copy, the command stops with Pliki już istnieją, przerwano bez zmian: (“files already exist, aborted without changes”) and an alphabetical list of paths. Nothing changes.
8

Copy and record

Files are copied with your project names in place of the kit placeholders, their hashes are recorded, npm dependencies are added to package.json and .wa/kit.json is written.
9

Regenerate and install

gato generate, then npm install unless --no-install.
10

Migration hint

The last line is npx prisma migrate dev --name add-<module>, named after the argument even when required modules were added too.

npm dependencies

A dependency the project already has in the same section (dependencies or devDependencies) at a different version keeps the project’s version. The CLI prints a warning and continues:
It means “the project has version A, the module wants B; the project’s version stays”. Check yourself that the module works with it. A dependency the project has in the other section is not a conflict: it is added to the module’s section too, without a warning.

After gato add

1

Fill in .env

gato add does not touch .env. The module’s variables are added only to the wa:modules region of .env.example. Copy them to .env and set real values. A module with a required variable, such as api-keys and its API_KEY_PEPPER, stops the app at startup until it is set (Environment variables).
2

Create the migration

With the database running, run the printed npx prisma migrate dev --name add-<module> and commit the migration (Database and migrations).
3

Start services, if any

A module with Docker services adds them to docker-compose.yml. The uploads services (minio, minio-init) have the Compose profile s3: start them with docker compose --profile s3 up -d only when STORAGE_PROVIDER=s3.
4

Install, if skipped

With --no-install, run npm install yourself.

Rollback and its limits

  • A failure before copying (checks 1 to 7) changes nothing.
  • A failure while copying or writing state (step 8, for example a full disk, a read-only file, or a file where a module directory should be) is rolled back: the module’s files are deleted, directories the command created are removed if empty, and package.json and .wa/kit.json are restored if they changed. The original error is usually a raw Node message such as ENOTDIR: not a directory, mkdir '…'.
  • Each cleanup step runs on its own. A step that fails is printed as Nie udało się posprzątać: <path> (<code>) (“could not clean up”) and the rest continue; the original error comes last. A typical case is a directory the command created that now holds a foreign file.
  • A failure in gato generate or npm install (step 9) is not rolled back: the files are copied and .wa/kit.json describes them. Fix the cause and run npx gato generate or npm install. A failed install reports Moduł dodany, ale npm install się nie powiódł. Uruchom: npm install (“module added, but npm install failed”).

Example

Changed files: the new module files (prisma/schema/api-keys.prisma, src/features/api-keys/**, src/app/api/v1/organization/**, src/app/[locale]/(app)/api-keys/**), plus .wa/kit.json, .env.example (wa:modules), prisma/schema/auth.prisma and prisma/schema/organizations.prisma (wa:relations) and the generated registry files. package.json stays the same because api-keys has no npm dependencies. Review the result with git diff and commit it together with the migration.