gato remove deletes a kit module’s files (except its seed files), drops the npm dependencies no other module declares, removes the module from .wa/kit.json and regenerates the wiring. It needs neither the kit nor the network: everything it uses (files, hashes, manifest, dependencies) is in the project’s .wa/kit.json.
Options
Order of checks
Every check runs before anything is deleted.1
Read .wa/kit.json
As in
gato add.2
Refusals
core:Cannot remove core.- A project module:
Module <x> belongs to the project; remove only handles kit modules. Delete its files and its projectModules entry by hand. - Not installed:
Module <x> is not installed. - Required by another kit module or a project module:
Module <x> is required by: <list>.
3
Paths outside the project
Any recorded file path that, after resolving symlinks, points outside the project gives
Path outside the project: <path>.4
Changed files
The CLI hashes every existing module file and compares it with the hash in
.wa/kit.json. If any differs, the command stops without --force and lists them. A file that no longer exists does not block the command.5
package.json
Must parse as JSON, otherwise a raw parser error stops the command before deleting files.
--force.
What it deletes
- The module’s recorded files, except seed files, and the empty directories above them, up to the first non-empty one. Directory cleanup does not follow symlinks and never removes the project root. A module file that is itself a symlink is removed as a link; its target stays.
- From
package.json, the module’s dependencies that no remaining kit module or project module declares in the same section. This applies even if the project had the dependency beforeaddor changed its version. - The module’s entry in
.wa/kit.json. Thengato generateclears the module from the registry and thewa:*regions. npm install(unless--no-install). Then, when the module had seed files that still exist, the list of them, and the hintnpx prisma migrate dev --name remove-<module>.
Seed files stay
Seed files (recorded asseed in .wa/kit.json) belong to the project, so gato remove never deletes them. Since gato-cli 0.16.0 it lists the ones it left behind:
--force.
gato add api-keys followed by gato remove api-keys leaves the project byte for byte as it was before add, unless package.json already had one of the module’s dependencies: the rule above removes it too. For a module with seed files, such as legal, the seed files stay.
What stays, and which migration to create
gato remove changes project files only. It does not touch the database, file storage or .env.
Rollback and its limits
gato remove has no rollback. “All or nothing” applies to the checks: a failed check changes nothing. A failure while deleting (for example a permission error) leaves a partial state: some files gone, the module still in .wa/kit.json. Fix the cause and run gato remove again; missing files do not block it.
A failed npm install at the end gives Module removed, but npm install failed. Run: npm install. The module is already gone from the state and the disk.
Safety
gato removetrusts.wa/kit.json: it deletes every recorded file whose hash matches, and with--forceevery recorded file. Review a.wa/kit.jsonfrom an untrusted source (someone else’s pull request, an archive) before running it.- It only deletes files inside the project after resolving symlinks.
- It is not safe against another process changing the project directory at the same time; there is no lock between check and delete.