Skip to content

Commit d33df8b

Browse files
authored
Merge pull request #1 from VapiAI/vitali/push-and-pull-commands
Push and pull commands
2 parents 97e7a98 + 3b66efb commit d33df8b

10 files changed

Lines changed: 1062 additions & 174 deletions

File tree

README.md

Lines changed: 41 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,45 @@ Manage Vapi resources (Assistants, Structured Outputs, and Tools) via Git using
3737

3838
### Prerequisites
3939

40-
- [Bun](https://bun.sh) installed
40+
- Node.js installed
4141
- Vapi API token
4242

4343
### Installation
4444

4545
```bash
46-
cd gitops
47-
bun install
46+
cd vapi-gitops
47+
npm install
4848
```
4949

50+
This installs all dependencies including Bun locally (no global install needed).
51+
5052
### Setup Environment
5153

5254
```bash
5355
# Create your .env file with your Vapi token
5456
echo "VAPI_TOKEN=your-token-here" > .env.dev
57+
```
58+
59+
### Commands
60+
61+
| Command | Description |
62+
|---------|-------------|
63+
| `npm run build` | Type-check the codebase |
64+
| `npm run pull:dev` | Pull resources from Vapi to local YAML files |
65+
| `npm run pull:prod` | Pull resources from prod |
66+
| `npm run apply:dev` | Push local YAML files to Vapi (dev) |
67+
| `npm run apply:prod` | Push local YAML files to Vapi (prod) |
68+
69+
### Basic Workflow
70+
71+
```bash
72+
# Pull existing resources from Vapi
73+
npm run pull:dev
74+
75+
# Make changes to YAML files...
5576

56-
# Run the apply script
57-
bun run apply:dev
77+
# Push changes back to Vapi
78+
npm run apply:dev
5879
```
5980

6081
---
@@ -92,7 +113,7 @@ server:
92113
**Step 3:** Apply the changes
93114
94115
```bash
95-
bun run apply:dev
116+
npm run apply:dev
96117
```
97118

98119
The tool will be created and its UUID saved to `.vapi-state.dev.json`.
@@ -127,7 +148,7 @@ firstMessage: Hello! How can I help you?
127148
**Step 3:** Apply the changes
128149
129150
```bash
130-
bun run apply:dev
151+
npm run apply:dev
131152
```
132153

133154
The apply engine will:
@@ -184,7 +205,7 @@ artifactPlan:
184205
**Step 3:** Apply
185206
186207
```bash
187-
bun run apply:dev
208+
npm run apply:dev
188209
```
189210

190211
---
@@ -217,7 +238,7 @@ rm resources/tools/my-tool-to-delete.yml
217238
**Step 3:** Apply
218239

219240
```bash
220-
bun run apply:dev
241+
npm run apply:dev
221242
```
222243

223244
The apply engine will:
@@ -255,7 +276,7 @@ mv resources/tools/old-tool-name.yml resources/tools/new-tool-name.yml
255276
**Step 3:** Apply
256277

257278
```bash
258-
bun run apply:dev
279+
npm run apply:dev
259280
```
260281

261282
This will:
@@ -270,13 +291,13 @@ This will:
270291
**Step 1:** Test in dev first
271292

272293
```bash
273-
bun run apply:dev
294+
npm run apply:dev
274295
```
275296

276297
**Step 2:** Verify everything works, then apply to prod
277298

278299
```bash
279-
bun run apply:prod
300+
npm run apply:prod
280301
```
281302

282303
Each environment has its own:
@@ -306,9 +327,9 @@ Edit `package.json`:
306327
```json
307328
{
308329
"scripts": {
309-
"apply:dev": "bun run apply.ts dev",
310-
"apply:staging": "bun run apply.ts staging",
311-
"apply:prod": "bun run apply.ts prod"
330+
"apply:dev": "tsx src/apply.ts dev",
331+
"apply:staging": "tsx src/apply.ts staging",
332+
"apply:prod": "tsx src/apply.ts prod"
312333
}
313334
}
314335
```
@@ -328,7 +349,7 @@ echo '{"assistants":{},"structuredOutputs":{},"tools":{}}' > .vapi-state.staging
328349
**Step 5:** Apply to the new environment
329350

330351
```bash
331-
bun run apply:staging
352+
npm run apply:staging
332353
```
333354

334355
This creates all resources in the staging Vapi account and populates `.vapi-state.staging.json` with the new UUIDs.
@@ -392,7 +413,7 @@ assistant_ids:
392413
**Step 4:** Apply
393414

394415
```bash
395-
bun run apply:dev
416+
npm run apply:dev
396417
```
397418

398419
The state file will track both:
@@ -435,16 +456,16 @@ The apply engine strips everything after `##` when resolving references.
435456
## Project Structure
436457

437458
```
438-
/gitops
439-
├── apply.ts # Main entry point
459+
vapi-gitops/
440460
├── src/
461+
│ ├── apply.ts # Apply entry point & functions
462+
│ ├── pull.ts # Pull entry point & functions
441463
│ ├── types.ts # TypeScript interfaces
442464
│ ├── config.ts # Environment & configuration
443465
│ ├── api.ts # Vapi HTTP client
444466
│ ├── state.ts # State file management
445467
│ ├── resources.ts # Resource loading
446468
│ ├── resolver.ts # Reference resolution
447-
│ ├── apply.ts # Apply functions
448469
│ └── delete.ts # Deletion & orphan checks
449470
├── resources/
450471
│ ├── assistants/ # Assistant YAML files

apply.ts

Lines changed: 0 additions & 101 deletions
This file was deleted.

bun.lock

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)