You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 720effd
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+17-10Lines changed: 17 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -137,11 +137,11 @@ org can keep using `VAPI_PRIVATE_API_KEY`.
137
137
| Option | Default | Meaning |
138
138
| --- | --- | --- |
139
139
|`--region us\|eu`|`VAPI_BASE_URL` if set, else auto-detect (US, then EU) | Which Vapi API to use |
140
-
|`--resources all\|none`|`all`|`all` downloads every resource into `resources/<org>/`; `none` only seeds `.vapi-state.<org>.json` (use when you'll author from scratch) |
140
+
|`--resources all\|none`|`all`|`all` downloads every resource into `resources/<org>/`; `none` only seeds `state/<org>/state.json` (use when you'll author from scratch) |
141
141
142
142
The private API key is never accepted as a command-line flag (it would leak into shell history and
143
143
agent transcripts). Non-interactive setup also refuses to run if `resources/<org>/` or
144
-
`.vapi-state.<org>.json` already exists — use `npm run pull -- <org>` to refresh an existing org.
144
+
`state/<org>/state.json` already exists — use `npm run pull -- <org>` to refresh an existing org.
145
145
146
146
### 4. Make a change and deploy
147
147
@@ -153,7 +153,7 @@ npm run validate -- my-org # schema check, no network
153
153
npm run apply -- my-org # pull the latest, merge, push
154
154
```
155
155
156
-
Commit the changed files and `.vapi-state.my-org.json` so your team shares the
156
+
Commit the changed files and `state/my-org/state.json` so your team shares the
157
157
same name → UUID mappings. Every pull request runs the same validator for
158
158
every org in CI (the **Validate resources** check), so a config `apply` would
159
159
refuse fails before it merges.
@@ -176,14 +176,14 @@ To test every pull request automatically, set up [PR checks](docs/guides/pr-chec
176
176
-**Resources refer to each other by ID.** A resource's ID is its path under
177
177
the type folder, without the extension: `tools/lookup-patient.yml` is
178
178
`lookup-patient`. Never paste UUIDs into resource files.
179
-
-**The state file maps IDs to UUIDs.**`.vapi-state.<org>.json` records which
179
+
-**The state file maps IDs to UUIDs.**`state/<org>/state.json` records which
180
180
platform resource each file is, per org. It is committed and holds no
181
181
secrets.
182
182
-**Secrets stay out of git.** API keys live in `.env.<org>` (gitignored) or
183
183
CI secrets. Credentials are referenced by name and bound to each org's own
184
184
credentials.
185
185
-**Each folder is pinned to its org.** The first command that can see which
186
-
org a key belongs to records it in `resources/<org>/.vapi-org.json`. After
186
+
org a key belongs to records it in `state/<org>/org.json`. After
187
187
that, every command checks the key against it before any request, and stops
188
188
if the key belongs to a different org, so a wrong key can't pull another
189
189
org's resources into the folder or push the folder into another org.
@@ -193,11 +193,15 @@ To test every pull request automatically, set up [PR checks](docs/guides/pr-chec
193
193
194
194
| Path | Committed? | What it is |
195
195
| --- | --- | --- |
196
-
|`resources/<org>/`| Yes | Your resources, and `.vapi-org.json`, the org the folder belongs to |
197
-
|`.vapi-state.<org>.json`| Yes | Name → UUID mappings for the org |
196
+
|`resources/<org>/`| Yes | Your resources. Hand-written: this is what you edit |
197
+
|`state/<org>/state.json`| Yes | Name → UUID mappings for the org |
198
+
|`state/<org>/org.json`| Yes | The Vapi org the folder belongs to |
199
+
|`state/<org>/local/`| No | This machine's baselines for detecting dashboard edits, and pre-deploy snapshots for `npm run rollback`|
198
200
|`.env.<org>`|**No**| API key and generated binding IDs |
199
-
|`.vapi-state-hash/`| No | Your local baseline for detecting dashboard edits |
200
-
|`.vapi-state.<org>.snapshots/`| No | Pre-deploy snapshots for `npm run rollback`|
201
+
202
+
Everything under `state/` is written by the engine. Don't edit or delete it by
203
+
hand: without `state.json` the next push creates every resource again as a
204
+
duplicate. [state/README.md](state/README.md) says what each file is.
201
205
202
206
More detail: [How the engine works](docs/guides/how-it-works.md).
203
207
@@ -275,7 +279,7 @@ object. API references: [Assistants](https://docs.vapi.ai/api-reference/assistan
275
279
## Staying up to date
276
280
277
281
The engine (`src/`, `tests/`, `.github/workflows/`, `package*.json`) comes from
278
-
upstream. Your configuration (`resources/`, `.vapi-state.*.json`,
282
+
upstream. Your configuration (`resources/`, `state/`,
279
283
`promotion.yml`, `vapi-checks.yml`) is yours; upstream only ships `*.example`
280
284
files there. Avoid editing engine files, so updates merge cleanly.
281
285
@@ -289,6 +293,9 @@ If you started from **Use this template**, add the remote first with
289
293
`git remote add upstream https://github.com/VapiAI/gitops.git`; the first merge
290
294
also needs `--allow-unrelated-histories`, and you'll resolve conflicts once.
291
295
296
+
If your repository still has `.vapi-state.<org>.json` files at its root, see
297
+
[Upgrading from an older version](docs/guides/commands.md#upgrading-from-an-older-version).
298
+
292
299
## Security
293
300
294
301
Never commit API keys: `.env.*` files are gitignored, and the CLI never accepts
Copy file name to clipboardExpand all lines: docs/guides/commands.md
+40-7Lines changed: 40 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ The other commands are direct only.
14
14
|`npm run apply`|`npm run apply -- <org> [types or paths]`|**The default deploy:** pull, merge, then push. See [workflows](workflows.md). |
15
15
|`npm run pull`|`npm run pull -- <org> [--force] [--bootstrap]`| Sync platform changes down; never overwrites local edits unless `--force`. |
16
16
|`npm run push`|`npm run push -- <org> [--dry-run] [--strict]`| Push without pulling first. Prefer `apply`. `--strict` aborts before any API call if validation finds an error. |
17
-
|`npm run rollback`|`npm run rollback -- <org> --list` or `--to <ISO>`| Restore a pre-deploy snapshot from `.vapi-state.<org>.snapshots/`. |
17
+
|`npm run rollback`|`npm run rollback -- <org> --list` or `--to <ISO>`| Restore a pre-deploy snapshot from `state/<org>/local/snapshots/`. |
18
18
|`npm run cleanup`|`npm run cleanup -- <org> [--force --confirm <org>]`| List platform resources with no file; delete them only with both flags. |
19
19
|`npm run audit`|`npm run audit -- <org> [--type <type>]`| Report drift between files, state and the platform. Exits 1 on any finding, so it can run in CI. |
20
20
|`npm run call`|`npm run call -- <org> -a <assistant>` or `-s <squad>`| Talk to an assistant or squad from your terminal. |
@@ -109,14 +109,47 @@ The test-call CLI cleans its terminal output for the developer loop:
109
109
110
110
## Upgrading from an older version
111
111
112
-
Repositories created before the state-file format changed need a one-time
113
-
migration. `pull`, `push`and `apply` refuse to run until it's done:
112
+
`npm run migrate` brings an older repository up to date. It needs no org and
113
+
no API key, and it's safe to run more than once:
114
114
115
115
```bash
116
116
npm run migrate
117
+
git add -A -- state ':(glob).vapi-state.*.json' resources
118
+
git commit -m "chore: move engine state into state/"
117
119
```
118
120
119
-
It rewrites every org's `.vapi-state.<org>.json` to the current
120
-
`{ "name": { "uuid": … } }` format and seeds your local
121
-
`.vapi-state-hash/` drift baseline from the old file. It's safe to run more
122
-
than once. Commit the rewritten state files.
121
+
It does two things.
122
+
123
+
**Moves engine files into `state/<org>/`.** They used to sit under dot-names
124
+
in three places. Nothing changes inside the files.
Copy file name to clipboardExpand all lines: docs/guides/configuration.md
+8-1Lines changed: 8 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,9 +49,16 @@ Set these in GitHub under **Settings → Secrets and variables → Actions**.
49
49
| --- | --- |
50
50
|`promotion.yml`| Promotion pipelines between orgs. Start from `promotion.example.yml`. |
51
51
|`vapi-checks.yml`| PR checks. Start from `vapi-checks.example.yml`. |
52
-
|`resources/<org>/.vapi-org.json`| The Vapi org ID the folder belongs to. Written by the first command that can see the key's org, then checked by every command before any request: a key for another org stops the command. If a folder genuinely moves to another org, delete the file in a reviewed commit. |
53
52
|`resources/<org>/.vapi-ignore`| Platform resources this repo shouldn't manage, as glob patterns. See `resources/.vapi-ignore.example` and [YAML conventions](../learnings/yaml-conventions.md). |
54
53
54
+
These are hand-written. The files the engine writes live apart from them, in
55
+
`state/<org>/`, and are not configuration: don't edit them.
56
+
57
+
| File | Purpose |
58
+
| --- | --- |
59
+
|`state/<org>/state.json`| Which platform resource (UUID) each file under `resources/<org>/` is. |
60
+
|`state/<org>/org.json`| The Vapi org ID the folder belongs to. Written by the first command that can see the key's org, then checked by every command before any request: a key for another org stops the command. If a folder genuinely moves to another org, delete the file in a reviewed commit. |
-`org.json` — the Vapi org the folder is pinned to (committed)
12
+
-`local/baselines/<uuid>` — last-seen platform content hash per resource, used for drift detection (per-developer, gitignored)
13
+
-`local/snapshots/` — pre-deploy snapshots for `npm run rollback` (per-developer, gitignored)
11
14
12
15
```
13
16
vapi-gitops/
14
17
├── .env.my-org # Private API key for my-org
15
18
├── .env.production # Private API key for production
16
-
├── .vapi-state.my-org.json # State file for my-org
17
-
├── .vapi-state.production.json # State file for production
19
+
├── state/ # Written by the engine; don't edit by hand
20
+
│ ├── my-org/
21
+
│ │ ├── state.json # Name → UUID mappings for my-org
22
+
│ │ ├── org.json # The Vapi org my-org is pinned to
23
+
│ │ └── local/ # This machine only (gitignored)
24
+
│ └── production/
25
+
│ └── (same structure)
18
26
├── resources/
19
27
│ ├── my-org/ # Dev/test org resources
20
28
│ │ ├── assistants/
@@ -48,7 +56,7 @@ files
48
56
49
57
Conflict handling is **per resource, never umbrella**: apply defaults to `--resolve=defer`, so the pull stage preserves local files and the drift baselines for genuinely conflicted resources, and the push stage then asks one interactive question per conflicted resource (push mine / keep dashboard / save a `.bkp` copy for manual merge). Clean and one-sided changes flow silently in their obvious direction. The full scenario matrix lives in `docs/learnings/sync-behavior.md`. Explicit `--resolve=ours|theirs|fail` keep non-interactive (CI) semantics.
50
58
51
-
Before updating a resource, push GETs its current dashboard payload, hashes it, and compares against the stored baseline (`.vapi-state-hash/<org>/<uuid>`):
59
+
Before updating a resource, push GETs its current dashboard payload, hashes it, and compares against the stored baseline (`state/<org>/local/baselines/<uuid>`):
52
60
53
61
-**Hashes match** → your local edit is the natural next step in the change chain → pushed silently, and the baseline is refreshed from the PATCH **response** (what the platform actually stored).
54
62
-**Hashes differ** → someone else published changes since your last sync. In a terminal, push asks **for that resource only**: ① push my local version (take ownership) ② keep the dashboard version (skip, local untouched) ③ save the dashboard version as `<name>.<TIMESTAMP>.bkp.<ext>` beside your file and skip, for a manual merge. In CI / piped runs the resource is blocked instead (use `--overwrite` to push unconditionally).
@@ -168,7 +176,7 @@ requests themselves; there is no separate telemetry.
168
176
| Path | What it is |
169
177
| --- | --- |
170
178
| `resources/<org>/` | Your resources, one folder per org |
171
-
| `.vapi-state.<org>.json` | Name → UUID mappings per org (committed) |
179
+
| `state/<org>/` | What the engine generates and tracks: name → UUID mappings and the org pin (committed), plus `local/` (gitignored). Not edited by hand |
172
180
| `.env.<org>` | API key and generated binding IDs (gitignored) |
173
181
| `promotion.yml`, `vapi-checks.yml` | Promotion pipelines and PR checks (copy from the `*.example.yml` files) |
174
182
| `resources/<org>/.vapi-ignore` | Platform resources this repo shouldn't manage (see `resources/.vapi-ignore.example`) |
0 commit comments