> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gatojs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Kit source

> Where gato add, list and update find the GatoJS kit: the --kit flag, GATO_KIT_SOURCE, or kitRepo cloned at the project's version tag.

A project does not contain the kit. When `gato add`, `gato list` and `gato update` need kit manifests or files, they fetch the kit at the version the project is on. `gato remove` and `gato generate` never need it: everything they use is in [`.wa/kit.json`](https://docs.gatojs.com/cli/kit-json).

`gato create` is different: it takes a local checkout through `--kit` only and ignores the rules on this page. See [`gato create`](https://docs.gatojs.com/cli/create).

## Resolution order

The CLI picks the first source that is set:

1. the `--kit <source>` flag;
2. the `GATO_KIT_SOURCE` environment variable (the older name `WA_KIT_SOURCE` still works; an empty value counts as unset);
3. `kitRepo` from `.wa/kit.json`, which `gato create` sets to `https://github.com/webamigos/gatojs.git`.

```bash theme={null}
npx gato add api-keys --kit ~/gatojs
GATO_KIT_SOURCE=~/gatojs npx gato list
```

## Allowed source forms

| Form | Example | How it is used |
| - | - | - |
| HTTPS URL | `https://github.com/webamigos/gatojs.git` | Cloned |
| SSH URL | `ssh://git@github.com/webamigos/gatojs.git` | Cloned |
| scp-style SSH | `git@github.com:webamigos/gatojs.git` | Cloned |
| File URL | `file:///home/me/gatojs` | Cloned |
| Local path | `~/gatojs`, `../gatojs` | `add` and `list` read it in place; `update` clones it |

A value that starts with `-` (so it cannot turn into a git option), or that contains `://` or `::` without one of the four URL prefixes (for example `ext::sh`), is rejected before anything runs:

```text theme={null}
Nieprawidłowe źródło wa-kit: <source>
```

It means "invalid kit source".

## Remote sources

`add` and `list` clone a URL source into a temporary directory, which is removed when the command ends, also after an error:

```bash theme={null}
git -c advice.detachedHead=false clone --depth 1 --branch v<kitVersion> --quiet -- <source> <tmp>
```

Each command clones the tag `v<kitVersion>`, so every `add` and `list` with the default `kitRepo` needs network access to GitHub. The kit repository is public, so no token is needed. A failed clone (no access, no network, a missing tag) prints git's own error first, then:

```text theme={null}
Nie udało się pobrać wa-kit v<version> z <source>. Sprawdź dostęp (gh auth status) albo podaj --kit <ścieżka>
```

It means "could not fetch kit `v<version>` from `<source>`; check access or pass `--kit <path>`".

> [!NOTE]
>
> Git may print a one-line warning such as `warning: refs/tags/v0.1.0 <sha> is not a commit!` above the result. It appears for tags with an annotation and is not an error: the clone gets the right commit.

## Local checkouts

A local path is the way to work offline or against a kit you are changing. For `add` and `list`:

* The directory must contain `kit/kit.json`, otherwise `Brak kit/kit.json w <path> — to nie jest repozytorium wa-kit` ("no `kit/kit.json`, not a kit repository").
* Its `version` in `kit/kit.json` must equal the project's `kitVersion`, otherwise `Kit w <path> ma wersję <x>, projekt używa <y>` ("the kit has version x, the project uses y").
* Only the version is compared, not the tag or commit. A checkout of `main` that still carries the same version is accepted.
* `add` needs the checkout to be a git repository, because it lists files with `git ls-files`. The file list comes from the git index, the content from the working tree: an uncommitted edit to a tracked file is copied, a new file is not until you `git add` it. `list` reads only manifests, so it works without `.git`.

For `update`, a local path is cloned like a URL (without `--depth`), at both tags. Its content always comes from the tags `v<kitVersion>` and `v<version>`, never from the working tree, so the checkout must have both tags.

## Why the versions must match

A project holds the code of exactly one kit version. A module from a newer kit would copy files that expect a newer core. To use modules from a newer kit, first move the project there with [`gato update`](https://docs.gatojs.com/cli/update), then run `gato add`.

## Per command

| Command | Uses the source for | Version fetched |
| - | - | - |
| [`add`](https://docs.gatojs.com/cli/add) | Manifests and module files | `v<kitVersion>` |
| [`list`](https://docs.gatojs.com/cli/list) | Manifests, for the "available" section | `v<kitVersion>` |
| [`update`](https://docs.gatojs.com/cli/update) | Both versions of every installed module | `v<kitVersion>` and `v<version>` |
| [`create`](https://docs.gatojs.com/cli/create) | Not used; `--kit <path>` only | The checkout's working tree |
| [`remove`](https://docs.gatojs.com/cli/remove), [`generate`](https://docs.gatojs.com/cli/generate) | Not used | — |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.