pixifact-cli 0.11.2 → 0.13.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.
package/README.md CHANGED
@@ -18,6 +18,7 @@ AI 修改 `.scene` 时优先只记这条路径:
18
18
  pixifact summary
19
19
  pixifact scene inspect --scene src/scenes/Hud.scene
20
20
  pixifact scene validate --scene src/scenes/Hud.scene
21
+ pixifact scene screenshot --scene src/scenes/Hud.scene --output /tmp/hud.png
21
22
  pixifact compile-scenes
22
23
  ```
23
24
 
@@ -29,6 +30,8 @@ pixifact scene validate --all
29
30
 
30
31
  默认使用当前工作目录作为项目根目录;不在项目根目录运行时再加 `--project-root <path>`。
31
32
 
33
+ `scene screenshot` 在目标 Scene 校验通过后,从磁盘读取指定 `.scene`、配对脚本接口和资源,用 Authoring Preview 输出设计尺寸 PNG。它不要求 Editor 启动,不会切换 Editor 当前 Scene,也不执行项目 TypeScript;本机需要安装 Google Chrome。成功返回 Scene 路径、revision、宽高、字节数和输出绝对路径;失败时不创建输出文件。游戏脚本产生的动态画面应使用 `runtime screenshot`。
34
+
32
35
  新建空 Scene 文件对使用:
33
36
 
34
37
  ```bash
@@ -56,7 +59,9 @@ pixifact runtime input key Space
56
59
 
57
60
  `runtime tree` 默认将节点树输出到终端;传入 `--output <json-path>` 时,改为保存运行时快照 JSON,终端只返回路径和采集元数据。快照包含 `schemaVersion`、`capturedAt`、当前 `runtimeId` 和 `root` 节点树,适合 Agent 使用文本搜索或 JSON 工具分析。快照中的 `runtimeId` 和 PixiJS `uid` 只对本次运行有效,不应写回项目源文件。
58
61
 
59
- `runtime screenshot` 默认将当前 PixiJS Canvas 的 PNG 截图写入项目根下的 `.pixifact/runtime/frame.png`,也可用 `--output <png-path>` 指定路径。截图使用当前 `app.screen` 逻辑尺寸和 renderer 背景色,只包含 `app.stage` 的 PixiJS 渲染内容,不包含浏览器 UI、HTML/CSS 或 DOM overlay;多个页面时添加 `--runtime <runtime-id>`。
62
+ 编译自 `.scene` 的节点在 `runtime tree` 和 `runtime node` 中带有项目相对 `source.scenePath` 与 `source.locator`;子 Scene 实例根节点还带有父 Scene 的 `instanceSource`。这些字段用于从运行画面定位源文件,脚本动态创建的节点不会附带。
63
+
64
+ `runtime screenshot` 默认将当前 PixiJS Canvas 的 PNG 截图写入项目根下的 `.pixifact/runtime/frame.png`,也可用 `--output <png-path>` 指定路径。截图使用当前 `app.screen` 逻辑尺寸和 renderer 背景色,保留 `app.stage` 的视口平移与缩放;只包含 PixiJS 渲染内容,不包含浏览器 UI、HTML/CSS 或 DOM overlay。多个页面时添加 `--runtime <runtime-id>`。
60
65
 
61
66
  ## 浏览器 Editor
62
67
 
@@ -66,7 +71,7 @@ pixifact runtime input key Space
66
71
  pixifact editor
67
72
  ```
68
73
 
69
- CLI 会启动只绑定 `127.0.0.1` 的本地 Bun 服务并打开系统浏览器。Editor 从项目内现有 `.scene` 建立层级、Pixi 预览和 Inspector;属性输入实时更新预览,失焦或 Enter 后自动保存,Undo / Redo 也会写回文件。Scene 写入携带当前文件版本,版本不一致时返回冲突而不是覆盖外部 Agent 的修改。
74
+ CLI 会启动只绑定 `127.0.0.1` 的本地 Bun 服务并打开系统浏览器。Editor 从项目内现有 `.scene` 建立层级、Pixi 预览和 Inspector。画布左上角可切换拖动画布、移动节点和调整大小工具;属性输入实时更新预览。默认手动保存,点击“保存”或按 Ctrl/Cmd+S 写入文件,也可在左下角设置中开启自动保存。多个 Scene 可在同一 Editor 的标签中切换,各自保留未保存修改。Scene 写入携带当前文件版本,版本不一致时提示比较草稿与磁盘版本,不会静默覆盖外部 Agent 的修改。
70
75
 
71
76
  同一项目重复运行 `pixifact editor` 会复用现有 Host;多个浏览器标签页中同时只有一个活动 Editor。Scene 已同步且预览 ready 时可以使用:
72
77
 
@@ -0,0 +1 @@
1
+ import{C as e,E as t,T as n,b as r,w as i,x as a,y as o}from"./captureCompilerScenePreview-CksQqv9T.js";import"./init-Cun-jBBV.js";t.add(i),t.mixin(n,e),t.add(a),t.add(r),t.mixin(n,o);
@@ -0,0 +1 @@
1
+ import{O as e,S as t,a as n,c as r,n as i,r as a,s as o,t as s}from"./captureCompilerScenePreview-CksQqv9T.js";window.capturePixifactScene=async c=>{let[l,u]=await Promise.all([o(),r(c)]),d=await i({document:{template:e(u.source),sceneInterfaces:{}},projectTree:n(l),scenePath:c}),f=new t,p=!1;try{return await f.init({width:d.width,height:d.height,backgroundAlpha:0,antialias:!0,autoStart:!1,resolution:1}),p=!0,f.stage.addChild(d.root),{scenePath:u.path,revision:u.version,width:d.width,height:d.height,dataUrl:await s(f,d)}}finally{p&&(f.stage.removeChild(d.root),f.destroy({removeView:!0},{children:!1})),a(d)}};