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 54b9b30
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,7 +176,7 @@ 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
@@ -194,7 +194,7 @@ To test every pull request automatically, set up [PR checks](docs/guides/pr-chec
194
194
resource; an unlinked file otherwise creates a new one. `apply` uses the same
195
195
folder behavior in its push phase.
196
196
-**Each folder is pinned to its org.** The first command that can see which
197
-
org a key belongs to records it in `resources/<org>/.vapi-org.json`. After
197
+
org a key belongs to records it in `state/<org>/org.json`. After
198
198
that, every command checks the key against it before any request, and stops
199
199
if the key belongs to a different org, so a wrong key can't pull another
200
200
org's resources into the folder or push the folder into another org.
@@ -204,11 +204,15 @@ To test every pull request automatically, set up [PR checks](docs/guides/pr-chec
204
204
205
205
| Path | Committed? | What it is |
206
206
| --- | --- | --- |
207
-
|`resources/<org>/`| Yes | Your resources, and `.vapi-org.json`, the org the folder belongs to |
208
-
|`.vapi-state.<org>.json`| Yes | Name → UUID mappings for the org |
207
+
|`resources/<org>/`| Yes | Your resources. Hand-written: this is what you edit |
208
+
|`state/<org>/state.json`| Yes | Name → UUID mappings for the org |
209
+
|`state/<org>/org.json`| Yes | The Vapi org the folder belongs to |
210
+
|`state/<org>/local/`| No | This machine's baselines for detecting dashboard edits, and pre-deploy snapshots for `npm run rollback`|
209
211
|`.env.<org>`|**No**| API key and generated binding IDs |
210
-
|`.vapi-state-hash/`| No | Your local baseline for detecting dashboard edits |
211
-
|`.vapi-state.<org>.snapshots/`| No | Pre-deploy snapshots for `npm run rollback`|
212
+
213
+
Everything under `state/` is written by the engine. Don't edit or delete it by
214
+
hand: without `state.json` the next push creates every resource again as a
215
+
duplicate. [state/README.md](state/README.md) says what each file is.
212
216
213
217
More detail: [How the engine works](docs/guides/how-it-works.md).
214
218
@@ -286,7 +290,7 @@ object. API references: [Assistants](https://docs.vapi.ai/api-reference/assistan
286
290
## Staying up to date
287
291
288
292
The engine (`src/`, `tests/`, `.github/workflows/`, `package*.json`) comes from
289
-
upstream. Your configuration (`resources/`, `.vapi-state.*.json`,
293
+
upstream. Your configuration (`resources/`, `state/`,
290
294
`promotion.yml`, `vapi-checks.yml`) is yours; upstream only ships `*.example`
291
295
files there. Avoid editing engine files, so updates merge cleanly.
292
296
@@ -300,6 +304,9 @@ If you started from **Use this template**, add the remote first with
300
304
`git remote add upstream https://github.com/VapiAI/gitops.git`; the first merge
301
305
also needs `--allow-unrelated-histories`, and you'll resolve conflicts once.
302
306
307
+
If your repository still has `.vapi-state.<org>.json` files at its root, see
308
+
[Upgrading from an older version](docs/guides/commands.md#upgrading-from-an-older-version).
309
+
303
310
## Security
304
311
305
312
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] [--adopt <id>[=<uuid>]]`|**The default deploy:** pull, merge, then push. The push preflight below runs before remote writes. 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] [--json] [--strict] [--adopt <id>[=<uuid>]]`| Push without pulling first. Prefer `apply`. Preflight blocks validation errors and unresolved credential names in the write plan (selected resources plus auto-applied dependencies) before any remote mutation, including deletions. `--dry-run` uses the same gate. `--strict` additionally blocks error-severity findings outside the plan; warnings remain advisory. Bootstrap reads may run before preflight. |
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. |
@@ -193,14 +193,47 @@ The test-call CLI cleans its terminal output for the developer loop:
193
193
194
194
## Upgrading from an older version
195
195
196
-
Repositories created before the state-file format changed need a one-time
197
-
migration. `pull`, `push`and `apply` refuse to run until it's done:
196
+
`npm run migrate` brings an older repository up to date. It needs no org and
197
+
no API key, and it's safe to run more than once:
198
198
199
199
```bash
200
200
npm run migrate
201
+
git add -A -- state ':(glob).vapi-state.*.json' resources
202
+
git commit -m "chore: move engine state into state/"
201
203
```
202
204
203
-
It rewrites every org's `.vapi-state.<org>.json` to the current
204
-
`{ "name": { "uuid": … } }` format and seeds your local
205
-
`.vapi-state-hash/` drift baseline from the old file. It's safe to run more
206
-
than once. Commit the rewritten state files.
205
+
It does two things.
206
+
207
+
**Moves engine files into `state/<org>/`.** They used to sit under dot-names
208
+
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. |
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.
95
103
96
-
Before updating a resource, push GETs its current dashboard payload, hashes it, and compares against the stored baseline (`.vapi-state-hash/<org>/<uuid>`):
104
+
Before updating a resource, push GETs its current dashboard payload, hashes it, and compares against the stored baseline (`state/<org>/local/baselines/<uuid>`):
97
105
98
106
-**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).
99
107
-**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).
@@ -215,7 +223,7 @@ requests themselves; there is no separate telemetry.
215
223
| Path | What it is |
216
224
| --- | --- |
217
225
| `resources/<org>/` | Your resources, one folder per org |
218
-
| `.vapi-state.<org>.json` | Name → UUID mappings per org (committed) |
226
+
| `state/<org>/` | What the engine generates and tracks: name → UUID mappings and the org pin (committed), plus `local/` (gitignored). Not edited by hand |
219
227
| `.env.<org>` | API key and generated binding IDs (gitignored) |
220
228
| `promotion.yml`, `vapi-checks.yml` | Promotion pipelines and PR checks (copy from the `*.example.yml` files) |
221
229
| `resources/<org>/.vapi-ignore` | Platform resources this repo shouldn't manage (see `resources/.vapi-ignore.example`) |
0 commit comments