Skip to content

fix(setup): pull simulations by their single-type alias in the wizard - #92

Merged
scott-lowe-vapi merged 1 commit into
mainfrom
fix/setup-wizard-simulations-type
Nov 6, 2026
Merged

scott-lowe-vapi merged 1 commit into
mainfrom
fix/setup-wizard-simulations-type

Conversation

@scott-lowe-vapi

@scott-lowe-vapi scott-lowe-vapi commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Value

V.A.L.U.E. tier: micro. It restores intended behavior in about 50 changed lines across 4 files, and a deterministic test proves it.

  • Problem: in the interactive npm run setup wizard, choosing simulations fails with "Single-resource pull requires exactly one resource type". Setup stops before simulations, suites and evals are downloaded, and the org folder is left half set up. It happens to anyone whose org has simulations and who picks "All".
  • Who it affects: new users connecting an org through the wizard, including everyone who runs npx create-vapi-app, which hands off to it. Non-interactive setup (npm run setup -- <org>) does one full pull and was never affected.

How it works

The wizard pulls what you pick one type at a time: pull.ts <org> --force --type <type> --id …. It passed the internal type name. But simulations is also the --type group alias for personalities, scenarios, simulations and simulationSuites, and a pull by --id refuses more than one type.

  • src/resource-type-args.ts (new, config-free): the group and path alias maps and resolveResourceTypes move here from config.ts unchanged, so tests can import them. config.ts parses argv and exits on import, so tests couldn't. A new typeArgFor(type) returns the --type spelling that resolves to exactly that type; for simulations that's simulations/tests.
  • src/setup.ts: the wizard's per-type pull passes typeArgFor(typeKey).
  • tests/resource-type-args.test.ts: checks that every resource type comes back as exactly itself through typeArgFor, so a future type that collides with a group alias fails CI. It also checks that --type simulations still selects all four types for apply.

Verification

Before: on main, run the exact command the wizard builds against an org with simulations:

tsx src/pull.ts <org> --force --skip-bindings --type simulations --id <sim-id>
❌ Pull failed: Single-resource pull requires exactly one resource type.

After: run it with typeArgFor("simulations"), which gives --type simulations/tests:

Found 2 matching simulations in Vapi (requested 2)
✨ … -> resources/<org>/simulations/tests/….yml
simulations: 2 new, 0 updated

The wizard's per-type pulls for simulationSuites and evals also completed, scoped to the requested ids. Your run had never reached them. These were read-only pulls against a real org, into a throwaway copy of the repo.

npm run build passes, and npm test passes 584/584.

Not in this PR

Each per-type pull in the wizard prints the --force warning ("run npm run pull (no flag) first…") and waits 2 seconds. For an org with all 9 types, that's 9 warnings and about 18 seconds of waiting, for advice aimed at hand-run --force pulls. It could be a follow-up to suppress the warning for the wizard's own pulls.

🤖 Generated with Claude Code

The wizard downloads the resources you pick one type at a time with
pull.ts --type <type> --id ..., and a pull by --id accepts exactly one type.
It passed the internal type name, but "simulations" is also the --type
group alias for all four simulation types, so picking simulations failed
with "Single-resource pull requires exactly one resource type" and stopped
setup before simulations, suites and evals were downloaded. Non-interactive
setup (npm run setup -- <org>) does one full pull and was unaffected.

Move the --type alias maps and resolveResourceTypes out of config.ts into a
config-free resource-type-args.ts, and add typeArgFor(), which spells a
type so it resolves to exactly that type (simulations -> simulations/tests).
The wizard's per-type pull uses it. A test pins that every resource type
round-trips to itself, so a future collision with a group alias fails CI.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@scott-lowe-vapi
scott-lowe-vapi marked this pull request as ready for review November 6, 2026 20:20
@scott-lowe-vapi
scott-lowe-vapi merged commit 34cb5a3 into main Nov 6, 2026
7 checks passed

Copy link
Copy Markdown
Contributor Author

Merge activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants