Skip to content

Project lifecycle: apply-diff, upgrade, deploy

Three vgai verbs cover a project’s life after scaffolding (for scaffolding itself, see Scaffold a project).

apply-diff validates the scene, the patch, the result, and every introduced asset reference before writing; upgrade reports, re-syncs, and re-pins against the scaffold baseline and blocks pin-ahead; deploy discovers, runs the walls, builds, stages, and pushes to Cloudflare Pages
The three lifecycle verbs — validated edits, engine re-sync, and shipping.

vgai apply-diff — the blessed scene-edit primitive

Section titled “vgai apply-diff — the blessed scene-edit primitive”

Applies a JSON diff to a .vscn.json with validation before write — the sanctioned way for scripts and agents to edit scenes without hand-rolling JSON surgery. The scene, the patch, and the result are all schema-validated, and every asset reference the diff introduces is dereferenced: the file must exist under the project’s asset root, and JSON asset formats (.mat.json, referenced prefabs) must parse through their own schemas — other referenced files (GLTF meshes, textures, audio) are existence-checked. A failing diff is rejected with the issues named and nothing is written. (Pre-existing broken references don’t block unrelated repairs — npm run validate-scenes is the whole-project gate.)

Terminal window
npm run vgai -- apply-diff public/scenes/level.vscn.json my-edit.json # validate, then write back
npm run vgai -- apply-diff public/scenes/level.vscn.json my-edit.json --report # validate + summarize only — never writes

vgai upgrade — re-sync a project against the engine checkout

Section titled “vgai upgrade — re-sync a project against the engine checkout”

Reports, re-syncs, and re-pins a scaffolded project against the engine checkout it lives beside, using the scaffold baseline (.vgai/scaffold-baseline.json) for three-way comparison — your local edits to template files are surfaced as diffs, never clobbered.

Terminal window
npm run vgai -- upgrade # report + re-sync + re-pin
npm run vgai -- upgrade --report # report only, never writes

Discovers the project, runs the pre-flight walls, builds, stages, and pushes the static bundle to Cloudflare Pages with wrangler:

Terminal window
npm run vgai -- deploy # full pipeline
npm run vgai -- deploy --report # stop after staging — zero remote calls
npm run vgai -- deploy --project my-game # explicit Pages project name

The default Pages project name is vgai-<slug of the manifest name>.