@pix3/cli 1.6.4 → 2.0.0-alpha.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 (168) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +722 -788
  3. package/dist/index.js +557 -421
  4. package/dist/runtime-types.json +1 -1
  5. package/dist/smoke/prebuilt/{build-7MIXIMSZ.mjs → build-7REMSA2S.mjs} +52 -52
  6. package/dist/smoke/prebuilt/chunk-4DGG2BKR.mjs +2 -0
  7. package/dist/smoke/prebuilt/chunk-YLBMUJ2H.mjs +238 -0
  8. package/dist/smoke/prebuilt/runtime.mjs +1 -1
  9. package/dist/smoke/prebuilt/smoke-worker.mjs +211 -2
  10. package/dist/smoke/prebuilt/tree-defaults.mjs +1 -1
  11. package/dist/validate/prebuilt/{build-AUGKXER3.js → build-ADF5EEE2.js} +52 -52
  12. package/dist/validate/prebuilt/bundle-main.js +223 -18
  13. package/dist/validate/prebuilt/chunk-VIHIF4G2.js +238 -0
  14. package/dist/validate/prebuilt/runtime.js +1 -1
  15. package/kit/files/.claude/skills/pix3-editor/SKILL.md +200 -0
  16. package/kit/files/.claude/skills/pix3-nodes/SKILL.md +13 -15
  17. package/kit/files/.claude/skills/pix3-nodes/reference.md +77 -71
  18. package/kit/files/.claude/skills/pix3-scene-format/SKILL.md +38 -41
  19. package/kit/files/.claude/skills/pix3-scene-format/pix3anim.md +185 -0
  20. package/kit/files/.claude/skills/pix3-scene-format/project-files.md +244 -0
  21. package/kit/files/.claude/skills/pix3-scene-format/reference.md +28 -16
  22. package/kit/files/.claude/skills/pix3-scripts/SKILL.md +34 -24
  23. package/kit/files/.claude/skills/pix3-scripts/reference.md +68 -141
  24. package/kit/files/.claude/skills/pix3-verify/SKILL.md +65 -326
  25. package/kit/files/.claude/skills/pix3-verify/reference.md +2 -14
  26. package/kit/files/AGENTS.md +76 -84
  27. package/kit/files/design/tests/bots/pix3-test-bot.d.ts +89 -0
  28. package/kit/kit.json +8 -5
  29. package/package.json +62 -54
  30. package/templates/2d/files/scenes/main.pix3scene +31 -0
  31. package/templates/2d/template.yaml +11 -0
  32. package/templates/3d/files/scenes/main.pix3scene +50 -0
  33. package/templates/3d/template.yaml +11 -0
  34. package/templates/base/files/README.md +39 -0
  35. package/templates/base/files/gitignore +11 -0
  36. package/templates/base/files/index.html +23 -0
  37. package/templates/base/files/package.json +28 -0
  38. package/templates/base/files/src/main.ts +3 -0
  39. package/templates/base/files/tsconfig.json +17 -0
  40. package/templates/base/files/vite.config.ts +10 -0
  41. package/dist/smoke/prebuilt/chunk-CBFYKDS7.mjs +0 -2
  42. package/dist/smoke/prebuilt/chunk-VJHJ5BCO.mjs +0 -239
  43. package/dist/validate/prebuilt/chunk-CFQFEI52.js +0 -239
  44. package/templates/empty-2d/files/README.md +0 -20
  45. package/templates/empty-2d/files/scenes/main.pix3scene +0 -68
  46. package/templates/empty-2d/files/sprites/pix3-logo.png +0 -0
  47. package/templates/empty-2d/template.yaml +0 -7
  48. package/templates/empty-3d/files/README.md +0 -20
  49. package/templates/empty-3d/files/scenes/main.pix3scene +0 -108
  50. package/templates/empty-3d/files/sprites/pix3-logo.png +0 -0
  51. package/templates/empty-3d/template.yaml +0 -7
  52. package/templates/idea-blank/files/README.md +0 -22
  53. package/templates/idea-blank/files/scenes/main.pix3scene +0 -37
  54. package/templates/idea-blank/template.yaml +0 -10
  55. package/templates/minigame-2d/files/README.md +0 -44
  56. package/templates/minigame-2d/files/design/tests/reachability.json +0 -1
  57. package/templates/minigame-2d/files/design/tests/routines/mute-music.json +0 -44
  58. package/templates/minigame-2d/files/scenes/main.pix3scene +0 -84
  59. package/templates/minigame-2d/files/scenes/menu.pix3scene +0 -118
  60. package/templates/minigame-2d/files/scenes/ui/settings-window.pix3scene +0 -138
  61. package/templates/minigame-2d/files/scripts/GameFlow.ts +0 -133
  62. package/templates/minigame-2d/files/scripts/MenuFlow.ts +0 -217
  63. package/templates/minigame-2d/files/scripts/SettingsWindow.ts +0 -198
  64. package/templates/minigame-2d/template.yaml +0 -10
  65. package/templates/playable-2d/files/README.md +0 -30
  66. package/templates/playable-2d/files/design/recipe.md +0 -83
  67. package/templates/playable-2d/files/design/tests/reachability.json +0 -4
  68. package/templates/playable-2d/files/design/tests/routines/intro-to-cta.json +0 -32
  69. package/templates/playable-2d/files/scenes/main.pix3scene +0 -111
  70. package/templates/playable-2d/files/scenes/ui/end-screen.pix3scene +0 -91
  71. package/templates/playable-2d/files/scenes/ui/intro.pix3scene +0 -65
  72. package/templates/playable-2d/files/scripts/CtaButton.ts +0 -55
  73. package/templates/playable-2d/files/scripts/GameFlow.ts +0 -256
  74. package/templates/playable-2d/files/sprites/pix3-logo.png +0 -0
  75. package/templates/playable-2d/template.yaml +0 -9
  76. package/templates/playable-3d/files/README.md +0 -32
  77. package/templates/playable-3d/files/design/recipe.md +0 -127
  78. package/templates/playable-3d/files/design/tests/reachability.json +0 -4
  79. package/templates/playable-3d/files/design/tests/routines/intro-to-cta.json +0 -32
  80. package/templates/playable-3d/files/scenes/main.pix3scene +0 -230
  81. package/templates/playable-3d/files/scenes/ui/end-screen.pix3scene +0 -91
  82. package/templates/playable-3d/files/scenes/ui/intro.pix3scene +0 -65
  83. package/templates/playable-3d/files/scripts/CtaButton.ts +0 -55
  84. package/templates/playable-3d/files/scripts/GameFlow.ts +0 -309
  85. package/templates/playable-3d/files/scripts/GameRules.ts +0 -290
  86. package/templates/playable-3d/files/scripts/ScoreHud.ts +0 -113
  87. package/templates/playable-3d/template.yaml +0 -9
  88. package/templates/recipe-arena-2d/files/README.md +0 -48
  89. package/templates/recipe-arena-2d/files/design/recipe.md +0 -127
  90. package/templates/recipe-arena-2d/files/design/tests/reachability.json +0 -4
  91. package/templates/recipe-arena-2d/files/design/tests/routines/terminal-retry.json +0 -23
  92. package/templates/recipe-arena-2d/files/scenes/main.pix3scene +0 -292
  93. package/templates/recipe-arena-2d/files/scenes/menu.pix3scene +0 -100
  94. package/templates/recipe-arena-2d/files/scenes/prefabs/hazard.pix3scene +0 -42
  95. package/templates/recipe-arena-2d/files/scenes/prefabs/pickup.pix3scene +0 -45
  96. package/templates/recipe-arena-2d/files/scenes/ui/result.pix3scene +0 -85
  97. package/templates/recipe-arena-2d/files/scripts/GameRules.ts +0 -368
  98. package/templates/recipe-arena-2d/files/scripts/MenuFlow.ts +0 -106
  99. package/templates/recipe-arena-2d/files/scripts/PlayerController.ts +0 -151
  100. package/templates/recipe-arena-2d/files/scripts/ScoreHud.ts +0 -94
  101. package/templates/recipe-arena-2d/files/scripts/Spawner.ts +0 -214
  102. package/templates/recipe-arena-2d/files/scripts/TouchRules.ts +0 -174
  103. package/templates/recipe-arena-2d/files/sprites/ph-avatar.png +0 -0
  104. package/templates/recipe-arena-2d/files/sprites/ph-hazard.png +0 -0
  105. package/templates/recipe-arena-2d/files/sprites/ph-pickup.png +0 -0
  106. package/templates/recipe-arena-2d/template.yaml +0 -10
  107. package/templates/recipe-blank-2d/files/README.md +0 -61
  108. package/templates/recipe-blank-2d/files/design/recipe.md +0 -148
  109. package/templates/recipe-blank-2d/files/design/tests/reachability.json +0 -4
  110. package/templates/recipe-blank-2d/files/design/tests/routines/restart.json +0 -27
  111. package/templates/recipe-blank-2d/files/design/tests/routines/terminal-retry.json +0 -23
  112. package/templates/recipe-blank-2d/files/scenes/main.pix3scene +0 -224
  113. package/templates/recipe-blank-2d/files/scenes/ui/result.pix3scene +0 -85
  114. package/templates/recipe-blank-2d/files/scripts/GameRules.ts +0 -350
  115. package/templates/recipe-blank-2d/files/scripts/ScoreHud.ts +0 -110
  116. package/templates/recipe-blank-2d/files/sprites/ph-bg.png +0 -0
  117. package/templates/recipe-blank-2d/files/sprites/ph-capsule.png +0 -0
  118. package/templates/recipe-blank-2d/files/sprites/ph-circle.png +0 -0
  119. package/templates/recipe-blank-2d/files/sprites/ph-orb.png +0 -0
  120. package/templates/recipe-blank-2d/files/sprites/ph-ring.png +0 -0
  121. package/templates/recipe-blank-2d/files/sprites/ph-star.png +0 -0
  122. package/templates/recipe-blank-2d/template.yaml +0 -10
  123. package/templates/recipe-bouncer-2d/files/README.md +0 -81
  124. package/templates/recipe-bouncer-2d/files/design/recipe.md +0 -146
  125. package/templates/recipe-bouncer-2d/files/design/tests/reachability.json +0 -4
  126. package/templates/recipe-bouncer-2d/files/design/tests/routines/terminal-retry.json +0 -23
  127. package/templates/recipe-bouncer-2d/files/scenes/main.pix3scene +0 -615
  128. package/templates/recipe-bouncer-2d/files/scenes/menu.pix3scene +0 -191
  129. package/templates/recipe-bouncer-2d/files/scenes/ui/result.pix3scene +0 -87
  130. package/templates/recipe-bouncer-2d/files/scripts/BallBody.ts +0 -298
  131. package/templates/recipe-bouncer-2d/files/scripts/GameRules.ts +0 -377
  132. package/templates/recipe-bouncer-2d/files/scripts/MenuFlow.ts +0 -109
  133. package/templates/recipe-bouncer-2d/files/scripts/PaddleController.ts +0 -112
  134. package/templates/recipe-bouncer-2d/files/scripts/ScoreHud.ts +0 -94
  135. package/templates/recipe-bouncer-2d/files/scripts/TouchRules.ts +0 -263
  136. package/templates/recipe-bouncer-2d/files/scripts/ball-collision.ts +0 -307
  137. package/templates/recipe-bouncer-2d/files/sprites/ph-ball.png +0 -0
  138. package/templates/recipe-bouncer-2d/files/sprites/ph-bg.png +0 -0
  139. package/templates/recipe-bouncer-2d/files/sprites/ph-bumper.png +0 -0
  140. package/templates/recipe-bouncer-2d/files/sprites/ph-paddle.png +0 -0
  141. package/templates/recipe-bouncer-2d/template.yaml +0 -10
  142. package/templates/recipe-grid-3d/files/README.md +0 -22
  143. package/templates/recipe-grid-3d/files/design/recipe.md +0 -110
  144. package/templates/recipe-grid-3d/files/scenes/main.pix3scene +0 -169
  145. package/templates/recipe-grid-3d/files/scenes/menu.pix3scene +0 -100
  146. package/templates/recipe-grid-3d/files/scenes/ui/result.pix3scene +0 -105
  147. package/templates/recipe-grid-3d/files/scripts/GridBoard.ts +0 -319
  148. package/templates/recipe-grid-3d/files/scripts/GridRules.ts +0 -278
  149. package/templates/recipe-grid-3d/files/scripts/MenuFlow.ts +0 -106
  150. package/templates/recipe-grid-3d/files/scripts/ScoreHud.ts +0 -94
  151. package/templates/recipe-grid-3d/template.yaml +0 -10
  152. package/templates/recipe-tapper-2d/files/README.md +0 -39
  153. package/templates/recipe-tapper-2d/files/design/recipe.md +0 -132
  154. package/templates/recipe-tapper-2d/files/design/tests/reachability.json +0 -4
  155. package/templates/recipe-tapper-2d/files/design/tests/routines/terminal-retry.json +0 -23
  156. package/templates/recipe-tapper-2d/files/scenes/main.pix3scene +0 -269
  157. package/templates/recipe-tapper-2d/files/scenes/menu.pix3scene +0 -100
  158. package/templates/recipe-tapper-2d/files/scenes/prefabs/hazard.pix3scene +0 -42
  159. package/templates/recipe-tapper-2d/files/scenes/prefabs/target.pix3scene +0 -45
  160. package/templates/recipe-tapper-2d/files/scenes/ui/result.pix3scene +0 -85
  161. package/templates/recipe-tapper-2d/files/scripts/GameRules.ts +0 -368
  162. package/templates/recipe-tapper-2d/files/scripts/MenuFlow.ts +0 -106
  163. package/templates/recipe-tapper-2d/files/scripts/ScoreHud.ts +0 -94
  164. package/templates/recipe-tapper-2d/files/scripts/Spawner.ts +0 -214
  165. package/templates/recipe-tapper-2d/files/scripts/TouchRules.ts +0 -192
  166. package/templates/recipe-tapper-2d/files/sprites/ph-hazard.png +0 -0
  167. package/templates/recipe-tapper-2d/files/sprites/ph-target.png +0 -0
  168. package/templates/recipe-tapper-2d/template.yaml +0 -10
@@ -0,0 +1,39 @@
1
+ # {{PROJECT_NAME}}
2
+
3
+ A Pix3 game: a Vite + TypeScript project with `@pix3/runtime` and the Pix3 editor
4
+ (`@pix3/vite-plugin`).
5
+
6
+ ```bash
7
+ npm install
8
+ npm run dev # the game at http://localhost:5173/, the editor at http://localhost:5173/__pix3/ (*)
9
+ npm run editor # pix3 editor: the dev server (started if needed) + the editor in Chrome for a coding agent
10
+ npm run build # dist/index.html — one self-contained playable
11
+ npm run preview # serve dist/ to try the build
12
+ npm run check # pix3 check: scenes, res:// paths, components, a type-check of the scripts
13
+ npm run smoke # pix3 smoke: run the game headless for 2 s and report what threw
14
+ ```
15
+
16
+ (*) 5173 is Vite's first choice, not a promise: when it is taken Vite uses 5174, 5175, … The
17
+ address in use is what `npm run dev` / `npm run editor` prints, and `.pix3/dev.json`
18
+ (`editorUrl`) while the server runs.
19
+
20
+ **Pix3 2.0.0-alpha is not on npm yet**, so `npm install` fails until it is published. Until
21
+ then, link a pix3-core checkout instead: build it once (`npm install && npm run build -w
22
+ packages/editor-core && npm run build -w packages/vite-plugin` in the checkout), then in this
23
+ project `rm -rf node_modules && ln -s <pix3-core>/node_modules node_modules` — the checkout's
24
+ workspaces provide `@pix3/*`, Vite and the rest. The `pix3` scripts (`editor`, `check`, `smoke`)
25
+ need the CLI's bin, which the checkout links only once its CLI is built (prepack steps in its
26
+ `packages/cli`); until then run `node <pix3-core>/packages/cli/src/index.ts editor` (or `check`,
27
+ `smoke`) from this folder.
28
+
29
+ ## Layout
30
+
31
+ - `scenes/` — scenes (`.pix3scene`, YAML); `scenes/main.pix3scene` is the entry scene
32
+ (`defaultExportScenePath` in `pix3project.yaml`)
33
+ - `scripts/` — script components (`export class X extends Script`, used as `user:X`)
34
+ - `sprites/`, `audio/` — assets, referenced as `res://sprites/x.png`
35
+ - `design/` — design notes and references
36
+ - `src/main.ts` — boots the entry scene (`startGame` from `@pix3/vite-plugin/player`)
37
+ - `pix3project.yaml` — the project manifest (viewport, quality, entry scene)
38
+ - `AGENTS.md`, `CLAUDE.md`, `.claude/skills/`, `design/tests/bots/` — the agent kit: rules, skills
39
+ and bot-policy types for coding agents (`pix3 kit --update` refreshes it)
@@ -0,0 +1,11 @@
1
+ node_modules/
2
+ dist/
3
+ # Pix3 editor + CLI bookkeeping (dev server, version journal, keys fallback, gaps) — ignored, except
4
+ # the kit's record of the files it wrote (pix3 kit --update) and the template the project came from
5
+ .pix3/*
6
+ !.pix3/kit-manifest.json
7
+ !.pix3/template.json
8
+ # pix3 agent-setup: the MCP config names a file in this machine's home (~/.pix3/cdp-mcp.json);
9
+ # an older one carried the CDP token itself
10
+ .mcp.json
11
+ .codex/config.toml
@@ -0,0 +1,23 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
6
+ <title>{{PROJECT_NAME}}</title>
7
+ <style>
8
+ html,
9
+ body,
10
+ #app {
11
+ margin: 0;
12
+ width: 100%;
13
+ height: 100%;
14
+ overflow: hidden;
15
+ background: #000;
16
+ }
17
+ </style>
18
+ </head>
19
+ <body>
20
+ <div id="app"></div>
21
+ <script type="module" src="/src/main.ts"></script>
22
+ </body>
23
+ </html>
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "{{PACKAGE_NAME}}",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "editor": "pix3 editor",
9
+ "build": "vite build",
10
+ "preview": "vite preview",
11
+ "check": "pix3 check",
12
+ "smoke": "pix3 smoke"
13
+ },
14
+ "dependencies": {
15
+ "@pix3/runtime": "{{PIX3_VERSION}}",
16
+ "lit": "^3.3.1",
17
+ "postprocessing": "^6.39.2",
18
+ "three": "~0.183.2"
19
+ },
20
+ "devDependencies": {
21
+ "@pix3/cli": "{{PIX3_VERSION}}",
22
+ "@pix3/editor-core": "{{PIX3_VERSION}}",
23
+ "@pix3/vite-plugin": "{{PIX3_VERSION}}",
24
+ "@types/three": "^0.183.1",
25
+ "typescript": "~5.8.3",
26
+ "vite": "^8.3.3"
27
+ }
28
+ }
@@ -0,0 +1,3 @@
1
+ import { startGame } from '@pix3/vite-plugin/player';
2
+
3
+ void startGame('#app');
@@ -0,0 +1,17 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "useDefineForClassFields": true,
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
8
+ "types": ["vite/client"],
9
+ "allowImportingTsExtensions": true,
10
+ "resolveJsonModule": true,
11
+ "isolatedModules": true,
12
+ "noEmit": true,
13
+ "skipLibCheck": true,
14
+ "strict": true
15
+ },
16
+ "include": ["src", "scripts", "design/tests", "vite.config.ts"]
17
+ }
@@ -0,0 +1,10 @@
1
+ import { defineConfig } from 'vite';
2
+ import { pix3 } from '@pix3/vite-plugin';
3
+
4
+ // `npm run dev`: the game at /, the Pix3 editor at /__pix3/.
5
+ // `npm run build`: dist/index.html, one self-contained file, plus dist/index.report.json (what it
6
+ // weighs and why). pix3({ compress: true }) gzips the bundle into the page (about two thirds
7
+ // off); pix3({ build: 'zip' }) makes a zip to host (not for file://).
8
+ export default defineConfig({
9
+ plugins: [pix3()],
10
+ });
@@ -1,2 +0,0 @@
1
- import { createRequire as __pix3CreateRequire } from 'node:module'; const require = __pix3CreateRequire(import.meta.url);
2
- import{a as l,oa as d}from"./chunk-VJHJ5BCO.mjs";import{pd as u}from"./chunk-P2CBRXPJ.mjs";var g=()=>{let n={addColorStop:()=>{}};return new Proxy({},{get(e,t){return t==="measureText"?r=>({width:r.length*10,actualBoundingBoxAscent:10,actualBoundingBoxDescent:3,actualBoundingBoxLeft:0,actualBoundingBoxRight:r.length*10}):t==="getImageData"?()=>({data:new Uint8ClampedArray(4),width:1,height:1}):typeof t=="string"&&t.startsWith("create")?()=>n:()=>{}},set:()=>!0})},x=()=>({style:{},src:"",crossOrigin:null,complete:!1,width:0,height:0,addEventListener:()=>{},removeEventListener:()=>{}}),m=()=>({createElement(n){if(n!=="canvas")throw new Error(`canvas-only document shim: createElement('${n}') is not provided`);return{width:1,height:1,style:{},getContext:e=>e==="2d"?g():null,addEventListener:()=>{},removeEventListener:()=>{}}},createElementNS(n,e){if(e!=="img")throw new Error(`canvas-only document shim: createElementNS('${e}') is not provided`);return x()}}),y=()=>typeof Reflect.get(globalThis,"document")<"u"?()=>{}:(Reflect.set(globalThis,"document",m()),()=>{Reflect.deleteProperty(globalThis,"document")});import{existsSync as h,readFileSync as p,statSync as w}from"node:fs";import{isAbsolute as v,join as R,relative as D,resolve as f}from"node:path";var i=class extends l{projectDir;transformText;constructor(e,t={}){super("/"),this.projectDir=f(e),this.transformText=t.transformText}pathOf(e){let t=this.normalize(e).replace(/^\/+/,"");return this.containedPath(t)}isProjectResource(e){let t=this.getScheme(e);return t===""||t==="res"}exists(e){let t=this.pathOf(e);if(!t||!h(t))return!1;try{return w(t).isFile()}catch{return!1}}async fetchText(e){let t=this.requirePath(e),r=p(t,"utf8");return this.transformText?this.transformText(r,t):r}async fetchBlob(e){return new Blob([new Uint8Array(p(this.requirePath(e)))])}containedPath(e){let t=decodeURIComponent(e.replace(/^\/+/,"")),r=f(R(this.projectDir,t)),c=D(this.projectDir,r);return c.startsWith("..")||v(c)?null:r}requirePath(e){let t=`res://${e.replace(/^\/+/,"")}`,r=this.containedPath(e);if(!r)throw new s(t,"resolves outside the project folder");if(!h(r))throw new s(t);return r}},s=class extends Error{resource;constructor(e,t="file not found"){super(`Missing resource ${e} (${t})`),this.name="MissingResourceError",this.resource=e}},o=class extends Error{resource;constructor(e){super(`Resource ${e} exists but is not decoded outside the browser`),this.name="ResourceNotDecodedError",this.resource=e}},a=class extends d{missingSet=new Set;disk;constructor(e){super(e),this.disk=e}get missing(){return[...this.missingSet]}async loadTexture(e,t){return this.require(e),new u}async loadAsset(e){throw this.require(e),new o(e)}async loadSpineAsset(e){throw this.require(e.skeletonPath),this.require(e.atlasPath),e.texturePath&&this.require(e.texturePath),new o(e.skeletonPath)}require(e){if(this.disk.isProjectResource(e)&&!this.disk.exists(e))throw this.missingSet.add(e),new s(e)}};export{g as a,y as b,i as c,s as d,o as e,a as f};