CLI, SDK & scaffolding
Scaffolding new projects
Section titled “Scaffolding new projects”create-vgai-project (packages/create-vgai-project/src/index.ts) generates a project from
the full template (the example project): it copies the template, rewrites package.json,
tsconfig.json, vite.config.ts, and project.json for your name, and runs npm install.
It takes a project name and an optional target directory.
npx create-vgai-project my-game [target-dir]The vgai CLI’s create command additionally offers a template choice via --template:
starter (the full example project) or empty (a minimal scene + src/main.ts +
config):
vgai create my-game --template emptyDriving the editor: the CLI
Section titled “Driving the editor: the CLI”The vgai CLI (packages/vgai-cli/src/index.ts) controls a running editor — useful for
scripting and automation:
| Area | Commands |
|---|---|
| Project | create, edit, open, project, projects |
| Scene | scene <path>, open-asset <path> <kind> |
| Play | play, stop, pause, resume, step |
| Navigate | select <id> | --all, focus [id], view <top|front|right|perspective> |
| Panels/display | show <viewport|inspector|console|build>, grid, helpers, stats, shading |
| State | status |
Under the hood it talks to the editor’s /__editor/* routes (REST + SSE), defaulting to
http://localhost:5173 (override with VGAI_EDITOR_URL).
The editor SDK
Section titled “The editor SDK”@vgai/editor-sdk (packages/editor-sdk/src/) is the TypeScript client the CLI uses —
EditorClient with methods like openScene, play/stop/pause/resume/step,
select, focusEntity, viewPreset, panel toggles, getState, and waitForState. Use it
to build custom tooling.
See also
Section titled “See also”- HMR, storage & builds — hot reload and publishing.
- Get Started: install — first scaffold.