@vgai/cli 0.4.1 → 0.5.0-canary.20260719.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +65 -27
  2. package/dist/index.js +37348 -14921
  3. package/package.json +18 -8
package/README.md CHANGED
@@ -5,34 +5,47 @@ running editor from the terminal (or from an AI agent — this is the CLI the
5
5
  template's `/editor` skill uses).
6
6
 
7
7
  It talks to the editor dev server's HTTP/SSE control API via
8
- [`@vgai/editor-sdk`](../editor-sdk/).
8
+ [`@vgai/editor-sdk`](https://www.npmjs.com/package/@vgai/editor-sdk).
9
9
 
10
- ## Install
10
+ ## Create a game—no global install
11
11
 
12
12
  ```bash
13
- cd packages/vgai-cli && npm run build
14
- npm link # puts a global `vgai` on your PATH
15
- # or, without a global install, invoke the built file directly:
16
- # node /path/to/vgai-engine/packages/vgai-cli/dist/index.js <command>
13
+ npx @vgai/cli@latest create my-game
17
14
  ```
18
15
 
19
- > `npm link` works: the entry-point guard realpath-resolves `process.argv[1]`
20
- > before comparing it against `import.meta.url`, so a symlinked `vgai` bin runs
21
- > correctly. Direct `node dist/index.js` invocation is equally supported.
16
+ This creates a standalone registry-backed project, installs it, opens its
17
+ visual editor, and prints the actual editor URL. Node.js 22 or newer is
18
+ required.
22
19
 
23
- `npm run build` bundles `src/index.ts` (esbuild, `--bundle --platform=node`) to
24
- `dist/index.js`, inlining the workspace-source dependencies it imports
25
- (`@vgai/editor-sdk`, `create-vgai-project` — neither ships a build step, so a
26
- plain `tsc` compile of the CLI alone would leave unresolvable `.ts` imports at
27
- runtime). The `bin` field points at that built file, so plain Node runs it —
28
- no bun required. The CLI resolves the engine root from its own file location,
29
- so it only works from inside a checkout of this monorepo.
20
+ To keep `vgai` available globally:
21
+
22
+ ```bash
23
+ npm install --global @vgai/cli
24
+ vgai create my-game
25
+ ```
26
+
27
+ An installed CLI defaults to versioned registry dependencies. A CLI built
28
+ inside the VGAI source checkout defaults to contributor-oriented `file:`
29
+ links; `--registry` and `--link` override that choice explicitly.
30
+
31
+ To remix a shipped reference project instead of starting blank:
32
+
33
+ ```bash
34
+ npx @vgai/cli@latest create my-game --example hp-hud
35
+ ```
36
+
37
+ Examples are copied into standalone projects; editing the copy never changes
38
+ the packaged reference or this repository.
30
39
 
31
40
  ## Commands
32
41
 
33
42
  ```
34
- vgai create <name> [location] [--template starter|empty] [--example <id>] scaffold a project
43
+ vgai create <name> [location] [--template default|2d|react] [--example <id>]
44
+ [--registry|--link] [--no-edit]
45
+ vgai examples [--json] list reference projects available to --example
35
46
  vgai edit [project-path] launch the editor for a project (default: cwd)
47
+ vgai inspect [folder] [--json] read-only Three.js/R3F/PixiJS/React detection
48
+ vgai adapt <folder> [--write] preview by default; explicitly add only vgai.game.json
36
49
  vgai open <path> switch project in a running editor
37
50
  vgai project | projects show current / list recent projects
38
51
  vgai scene <path> open a scene file
@@ -44,6 +57,8 @@ vgai show <viewport scene|game / inspector / console / build>
44
57
  vgai open-asset <path> <kind>
45
58
  vgai grid|helpers|stats <on|off> | shading <solid|unlit|wireframe|normals|overdraw>
46
59
  vgai status print full editor state as JSON
60
+ vgai mcp [folder] standard stdio tools/resources/prompts for Codex,
61
+ Claude Code, Cursor, and other MCP clients
47
62
 
48
63
  vgai apply-diff <scene> <patch> [--report] apply a SceneDiff patch to a scene
49
64
  file, schema-validating the scene, the patch,
@@ -65,6 +80,23 @@ vgai deploy [folder] build a first-party game folder and direct-uploa
65
80
  --port <n> / VGAI_EDITOR_PORT overrides vgai.game.json.editorPort
66
81
  ```
67
82
 
83
+ Scaffolded projects include this ready-to-use `.mcp.json`:
84
+
85
+ ```json
86
+ {
87
+ "mcpServers": {
88
+ "vgai": {
89
+ "command": "npm",
90
+ "args": ["run", "vgai", "--", "mcp", "."]
91
+ }
92
+ }
93
+ }
94
+ ```
95
+
96
+ The same server can be launched manually with `vgai mcp .`. It binds file and
97
+ editor operations to that exact project; if its editor is not running, live
98
+ tools fail instead of falling through to another project's session.
99
+
68
100
  `vgai play` is verification, not fire-and-forget: it waits for
69
101
  `playState === 'playing'`, then polls log entries until at least one frame has
70
102
  actually run, and prints any first-frame errors.
@@ -75,15 +107,21 @@ starts a separate editor on the scaffold-generated preference stored in
75
107
  opens the printed URL in your browser. Projects without that optional field
76
108
  use 5173 as their preference.
77
109
 
78
- ## Limitations
110
+ ## Source-checkout development
111
+
112
+ Contributors can build and link the current checkout:
113
+
114
+ ```bash
115
+ npm run build -w @vgai/cli
116
+ (cd packages/vgai-cli && npm link)
117
+ vgai create my-game --link
118
+ ```
119
+
120
+ The bundle inlines the shared private scaffolder, so the public CLI and the
121
+ editor's New Project route use the same `scaffoldProject` implementation.
122
+ Registry projects remain portable without the checkout; link projects are
123
+ deliberately tied to it.
79
124
 
80
- - Monorepo-checkout only (engine root resolved relative to the CLI source).
81
- - Scaffolded projects reference the engine by a relative `file:` path — this is
82
- the deliberate source-vendored model (the engine is meant to be read and
83
- edited, not consumed as a black-box package), but it means projects are not
84
- portable off the machine without the checkout.
125
+ Learn and manual: https://vgai-learn.pages.dev
85
126
 
86
- `vgai create` scaffolds via the shared `scaffoldProject` library in
87
- [`create-vgai-project`](../create-vgai-project/) — the same implementation
88
- `npx create-vgai-project` and the editor dev-server's create-project route
89
- use (see that package's README for what scaffolding does).
127
+ Hosted editor: https://vgai-editor.pages.dev