pixifact-cli 0.2.0 → 0.2.2

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
@@ -10,39 +10,34 @@ Pixifact Scene 自动化命令行工具。
10
10
  bun add -d pixifact-cli
11
11
  ```
12
12
 
13
- ## 命令
13
+ ## AI 主路径
14
14
 
15
- 查看 Scene:
15
+ AI 修改 `.scene` 时优先只记这条路径:
16
16
 
17
17
  ```bash
18
- pixifact scene inspect --project-root . --scene src/scenes/Hud.scene
18
+ pixifact summary
19
+ pixifact scene inspect --scene src/scenes/Hud.scene
20
+ pixifact scene validate --scene src/scenes/Hud.scene
21
+ pixifact compile-scenes
19
22
  ```
20
23
 
21
- 校验单个 Scene:
24
+ 如果多个 Scene 可能变化,把单文件校验换成:
22
25
 
23
26
  ```bash
24
- pixifact scene validate --project-root . --scene src/scenes/Hud.scene
27
+ pixifact scene validate --all
25
28
  ```
26
29
 
27
- 校验所有 compiler Scene:
30
+ 默认使用当前工作目录作为项目根目录;不在项目根目录运行时再加 `--project-root <path>`。
28
31
 
29
- ```bash
30
- pixifact scene validate --project-root . --all
31
- ```
32
-
33
- 编译生成 Scene runtime 文件:
34
-
35
- ```bash
36
- pixifact compile-scenes --project-root .
37
- ```
32
+ 其他命令是辅助入口:`scene create` 用于新建 Scene,`node inspect` 用于已知 locator 的节点详情,`live ...` 只在 Editor 运行时读取上下文。不要使用 `scene get`,file mode 只保留 `scene inspect`。
38
33
 
39
34
  ## Agent 工作流
40
35
 
41
36
  Codex、Claude Code 和其他 coding agent 应直接编辑 `.scene` 文件,然后运行:
42
37
 
43
38
  ```bash
44
- pixifact scene validate --project-root . --all
45
- pixifact compile-scenes --project-root .
39
+ pixifact scene validate --all
40
+ pixifact compile-scenes
46
41
  bun run build
47
42
  ```
48
43
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixifact-cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Pixifact Scene 自动化 CLI。",
5
5
  "packageManager": "bun@1.3.13",
6
6
  "type": "module",
@@ -31,6 +31,6 @@
31
31
  "start": "bun src/pixifact-cli.ts"
32
32
  },
33
33
  "dependencies": {
34
- "pixifact": "^0.2.0"
34
+ "pixifact": "^0.2.2"
35
35
  }
36
36
  }
@@ -67,6 +67,14 @@ function requireFlag(flags: Record<string, string | true>, name: string) {
67
67
  return value;
68
68
  }
69
69
 
70
+ function projectRootFlag(flags: Record<string, string | true>) {
71
+ const value = flags['project-root'];
72
+ if (value === undefined) {
73
+ return process.cwd();
74
+ }
75
+ return requireFlag(flags, 'project-root');
76
+ }
77
+
70
78
  function jsonLine(value: unknown) {
71
79
  return `${JSON.stringify(value, null, 2)}\n`;
72
80
  }
@@ -199,9 +207,9 @@ function sourcePositionFromMessage(source: string, message: string) {
199
207
 
200
208
  async function executeFileCommand(positionals: string[], flags: Record<string, string | true>, automation: Automation) {
201
209
  const [area, action] = positionals;
210
+ const projectRoot = projectRootFlag(flags);
202
211
 
203
212
  if (area === 'compile-scenes' && action === undefined) {
204
- const projectRoot = typeof flags['project-root'] === 'string' ? flags['project-root'] : process.cwd();
205
213
  try {
206
214
  await compileScenes({ projectRoot });
207
215
  } catch (error) {
@@ -215,20 +223,13 @@ async function executeFileCommand(positionals: string[], flags: Record<string, s
215
223
 
216
224
  if (area === 'summary' && action === undefined) {
217
225
  return automation.getProjectSummary({
218
- projectRoot: requireFlag(flags, 'project-root'),
219
- });
220
- }
221
-
222
- if (area === 'scene' && action === 'get') {
223
- return automation.inspectCompilerScene({
224
- projectRoot: requireFlag(flags, 'project-root'),
225
- scenePath: requireFlag(flags, 'scene'),
226
+ projectRoot,
226
227
  });
227
228
  }
228
229
 
229
230
  if (area === 'scene' && action === 'create') {
230
231
  return automation.createScene({
231
- projectRoot: requireFlag(flags, 'project-root'),
232
+ projectRoot,
232
233
  scenePath: requireFlag(flags, 'scene'),
233
234
  name: requireFlag(flags, 'name'),
234
235
  });
@@ -236,7 +237,7 @@ async function executeFileCommand(positionals: string[], flags: Record<string, s
236
237
 
237
238
  if (area === 'scene' && action === 'inspect') {
238
239
  return automation.inspectCompilerScene({
239
- projectRoot: requireFlag(flags, 'project-root'),
240
+ projectRoot,
240
241
  scenePath: requireFlag(flags, 'scene'),
241
242
  });
242
243
  }
@@ -247,18 +248,18 @@ async function executeFileCommand(positionals: string[], flags: Record<string, s
247
248
  throw new Error('Use either --all or --scene, not both.');
248
249
  }
249
250
  return automation.validateAllCompilerScenes({
250
- projectRoot: requireFlag(flags, 'project-root'),
251
+ projectRoot,
251
252
  });
252
253
  }
253
254
  return automation.validateCompilerScene({
254
- projectRoot: requireFlag(flags, 'project-root'),
255
+ projectRoot,
255
256
  scenePath: requireFlag(flags, 'scene'),
256
257
  });
257
258
  }
258
259
 
259
260
  if (area === 'node' && action === 'inspect') {
260
261
  return automation.inspectNode({
261
- projectRoot: requireFlag(flags, 'project-root'),
262
+ projectRoot,
262
263
  scenePath: requireFlag(flags, 'scene'),
263
264
  node: requireFlag(flags, 'node'),
264
265
  });
@@ -299,19 +300,27 @@ export async function executePixifactCli(argv: string[], options: CliOptions = {
299
300
  return {
300
301
  exitCode: 0,
301
302
  stdout: jsonLine({
302
- commands: [
303
- 'compile-scenes',
303
+ aiPrimaryCommands: [
304
304
  'summary',
305
- 'scene create',
306
- 'scene get',
307
- 'scene inspect',
308
- 'scene validate',
305
+ 'scene inspect --scene <scene-path>',
306
+ 'scene validate --scene <scene-path>',
307
+ 'compile-scenes',
308
+ ],
309
+ aiValidationAlternatives: [
309
310
  'scene validate --all',
310
- 'node inspect',
311
+ ],
312
+ auxiliaryCommands: [
313
+ 'scene create --scene <scene-path> --name <SceneName>',
314
+ 'node inspect --scene <scene-path> --node <locator>',
315
+ ],
316
+ liveContextCommands: [
311
317
  'live summary',
312
318
  'live scene get',
313
- 'live node inspect',
319
+ 'live node inspect --node <locator>',
314
320
  ],
321
+ defaults: {
322
+ projectRoot: 'current working directory',
323
+ },
315
324
  }),
316
325
  stderr: '',
317
326
  };