@playcraft/cli 0.0.55 → 0.0.56

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 (167) hide show
  1. package/README.md +21 -0
  2. package/REMIX.md +103 -19
  3. package/dist/atom-tree/fusion-hints.js +8 -3
  4. package/dist/atom-tree/fusion-intent.js +62 -0
  5. package/dist/atom-tree/selection.js +3 -1
  6. package/dist/commands/create.js +299 -85
  7. package/dist/commands/image.js +79 -69
  8. package/dist/commands/levels.js +29 -0
  9. package/dist/commands/patterns.js +75 -0
  10. package/dist/commands/remix.js +47 -0
  11. package/dist/commands/skills.js +48 -17
  12. package/dist/index.js +9 -5
  13. package/dist/remix/clone-source.js +208 -0
  14. package/dist/remix/clone.js +255 -0
  15. package/dist/scaffold/templates.js +1 -1
  16. package/dist/utils/agent-api-client.js +10 -3
  17. package/dist/utils/remix-image-attachments.js +4 -32
  18. package/dist/utils/sandbox-path.js +20 -0
  19. package/package.json +3 -3
  20. package/project-template/.claude/agents/creative-director.md +114 -0
  21. package/project-template/.claude/agents/developer.md +5 -2
  22. package/project-template/.claude/agents/game-designer.md +41 -20
  23. package/project-template/.claude/agents/refs/README.md +8 -0
  24. package/project-template/.claude/agents/refs/creative-director-guide.md +35 -0
  25. package/project-template/.claude/agents/refs/creative-director-kickoff-guide.md +52 -0
  26. package/project-template/.claude/agents/refs/creative-discovery-guide.md +76 -0
  27. package/project-template/.claude/agents/refs/creative-north-star-examples.md +82 -0
  28. package/project-template/.claude/agents/refs/developer-dev-handoff.md +1 -1
  29. package/project-template/.claude/agents/refs/game-designer-fusion-depth-playbook.md +28 -0
  30. package/project-template/.claude/agents/refs/game-designer-gameplay-sufficiency.md +4 -4
  31. package/project-template/.claude/agents/reviewer.md +11 -0
  32. package/project-template/.claude/hooks/README.md +12 -12
  33. package/project-template/.claude/hooks/block-developer-preflight.mjs +49 -13
  34. package/project-template/.claude/hooks/block-ring1-tasklist.mjs +1 -1
  35. package/project-template/.claude/hooks/user-prompt.mjs +3 -13
  36. package/project-template/.claude/hooks/validate-workflow-stop.mjs +209 -12
  37. package/project-template/.claude/settings.json +2 -2
  38. package/project-template/.claude/skills/playcraft-playable-optimization/SKILL.md +20 -20
  39. package/project-template/.claude/skills/session-analyzer/scripts/resolve-session.mjs +0 -1
  40. package/project-template/.claude/snapshot.mjs +0 -1
  41. package/project-template/.codebuddy/settings.json +1 -1
  42. package/project-template/.cursor/rules/playcraft-orchestrator.mdc +1 -1
  43. package/project-template/CLAUDE.md +9 -9
  44. package/project-template/docs/project-state.md +1 -1
  45. package/project-template/docs/team/agent-conduct.md +18 -18
  46. package/project-template/docs/team/collaboration.md +19 -7
  47. package/project-template/docs/team/workflow-changelog.md +15 -0
  48. package/project-template/fusion-patterns/catalog.json +77 -0
  49. package/project-template/package.json +2 -0
  50. package/project-template/skills/_shared/scripts/create-playable.mjs +31 -11
  51. package/project-template/skills/_shared/scripts/dev-start.mjs +3 -3
  52. package/project-template/skills/_shared/scripts/disclosure-config.mjs +65 -39
  53. package/project-template/skills/_shared/scripts/harness-smoke.mjs +3 -1
  54. package/project-template/skills/_shared/scripts/lib/fusion-intent.mjs +88 -0
  55. package/project-template/skills/_shared/scripts/lib/skill-fidelity.mjs +185 -0
  56. package/project-template/skills/_shared/scripts/slice-set.mjs +29 -2
  57. package/project-template/skills/_shared/scripts/state-get.mjs +124 -7
  58. package/project-template/skills/_shared/scripts/state-store.mjs +25 -2
  59. package/project-template/skills/_shared/scripts/validate-level-sketch.mjs +444 -0
  60. package/project-template/skills/_shared/scripts/verify-design-consistency.mjs +728 -0
  61. package/project-template/skills/playable-record/scripts/lib/dev-server.mjs +46 -11
  62. package/project-template/skills/playable-record/scripts/record-playable.mjs +2 -1
  63. package/project-template/skills/playable-record/scripts/verify-contract.mjs +4 -4
  64. package/project-template/skills/playable-record/scripts/verify-firstwin.mjs +3 -3
  65. package/project-template/skills/playable-record/scripts/verify-fusion.mjs +37 -2
  66. package/project-template/skills/playable-record/scripts/verify-slice.mjs +2 -2
  67. package/project-template/templates/design-brief.template.md +34 -0
  68. package/project-template/templates/design-methodology.md +1 -2
  69. package/project-template/templates/design.template.md +65 -0
  70. package/project-template/templates/developer-log.template.md +12 -1
  71. package/project-template/templates/five-axis-framework.md +12 -0
  72. package/project-template/templates/game-designer-creative-process.template.md +99 -0
  73. package/project-template/templates/level-sketch.template.json +56 -0
  74. package/project-template/templates/north-star.template.md +43 -0
  75. package/project-template/templates/project-state.template.md +1 -1
  76. package/project-template/vite.config.ts +4 -5
  77. package/project-templates/phaser/.claude/agents/creative-director.md +114 -0
  78. package/project-templates/phaser/.claude/agents/game-designer.md +41 -20
  79. package/project-templates/phaser/.claude/agents/refs/creative-director-guide.md +35 -0
  80. package/project-templates/phaser/.claude/agents/refs/creative-director-kickoff-guide.md +52 -0
  81. package/project-templates/phaser/.claude/agents/refs/creative-discovery-guide.md +76 -0
  82. package/project-templates/phaser/.claude/agents/refs/creative-north-star-examples.md +82 -0
  83. package/project-templates/phaser/.claude/agents/refs/developer-dev-handoff.md +1 -1
  84. package/project-templates/phaser/.claude/agents/refs/game-designer-fusion-depth-playbook.md +28 -0
  85. package/project-templates/phaser/.claude/agents/reviewer.md +11 -0
  86. package/project-templates/phaser/.claude/hooks/block-ring1-tasklist.mjs +2 -2
  87. package/project-templates/phaser/.claude/hooks/user-prompt.mjs +17 -18
  88. package/project-templates/phaser/.claude/hooks/validate-workflow-stop.mjs +209 -12
  89. package/project-templates/phaser/.claude/skills/playcraft-playable-optimization/SKILL.md +20 -20
  90. package/project-templates/phaser/.cursor/rules/playcraft-orchestrator.mdc +1 -1
  91. package/project-templates/phaser/CLAUDE.md +88 -54
  92. package/project-templates/phaser/docs/DESIGN.md +25 -0
  93. package/project-templates/phaser/docs/project-state.md +1 -1
  94. package/project-templates/phaser/docs/team/collaboration.md +19 -7
  95. package/project-templates/phaser/docs/team/workflow-changelog.md +14 -0
  96. package/project-templates/phaser/fusion-patterns/catalog.json +77 -0
  97. package/project-templates/phaser/package.json +3 -1
  98. package/project-templates/phaser/skills/_shared/scripts/dev-start.mjs +3 -3
  99. package/project-templates/phaser/skills/_shared/scripts/disclosure-config.mjs +65 -39
  100. package/project-templates/phaser/skills/_shared/scripts/harness-smoke.mjs +3 -1
  101. package/project-templates/phaser/skills/_shared/scripts/lib/fusion-intent.mjs +88 -0
  102. package/project-templates/phaser/skills/_shared/scripts/lib/skill-fidelity.mjs +185 -0
  103. package/project-templates/phaser/skills/_shared/scripts/state-get.mjs +124 -7
  104. package/project-templates/phaser/skills/_shared/scripts/state-store.mjs +25 -2
  105. package/project-templates/phaser/skills/_shared/scripts/validate-level-sketch.mjs +444 -0
  106. package/project-templates/phaser/skills/_shared/scripts/verify-design-consistency.mjs +728 -0
  107. package/project-templates/phaser/skills/playable-record/scripts/lib/dev-server.mjs +46 -11
  108. package/project-templates/phaser/skills/playable-record/scripts/record-playable.mjs +2 -1
  109. package/project-templates/phaser/skills/playable-record/scripts/verify-contract.mjs +4 -4
  110. package/project-templates/phaser/skills/playable-record/scripts/verify-firstwin.mjs +3 -3
  111. package/project-templates/phaser/skills/playable-record/scripts/verify-fusion.mjs +37 -2
  112. package/project-templates/phaser/skills/playable-record/scripts/verify-slice.mjs +2 -2
  113. package/project-templates/phaser/templates/design-brief.template.md +42 -11
  114. package/project-templates/phaser/templates/design-methodology.md +1 -2
  115. package/project-templates/phaser/templates/design.template.md +77 -0
  116. package/project-templates/phaser/templates/five-axis-framework.md +50 -1
  117. package/project-templates/phaser/templates/game-designer-creative-process.template.md +99 -0
  118. package/project-templates/phaser/templates/level-sketch.template.json +56 -0
  119. package/project-templates/phaser/templates/north-star.template.md +43 -0
  120. package/project-templates/phaser/templates/project-state.template.md +1 -1
  121. package/project-templates/phaser/vite.config.ts +4 -5
  122. package/project-templates/threejs/.claude/agents/creative-director.md +114 -0
  123. package/project-templates/threejs/.claude/agents/game-designer.md +41 -20
  124. package/project-templates/threejs/.claude/agents/refs/creative-director-guide.md +35 -0
  125. package/project-templates/threejs/.claude/agents/refs/creative-director-kickoff-guide.md +52 -0
  126. package/project-templates/threejs/.claude/agents/refs/creative-discovery-guide.md +76 -0
  127. package/project-templates/threejs/.claude/agents/refs/creative-north-star-examples.md +82 -0
  128. package/project-templates/threejs/.claude/agents/refs/developer-dev-handoff.md +1 -1
  129. package/project-templates/threejs/.claude/agents/refs/game-designer-fusion-depth-playbook.md +28 -0
  130. package/project-templates/threejs/.claude/agents/reviewer.md +11 -0
  131. package/project-templates/threejs/.claude/hooks/block-ring1-tasklist.mjs +2 -2
  132. package/project-templates/threejs/.claude/hooks/user-prompt.mjs +17 -18
  133. package/project-templates/threejs/.claude/hooks/validate-workflow-stop.mjs +209 -12
  134. package/project-templates/threejs/.claude/skills/playcraft-playable-optimization/SKILL.md +20 -20
  135. package/project-templates/threejs/.cursor/rules/playcraft-orchestrator.mdc +1 -1
  136. package/project-templates/threejs/CLAUDE.md +88 -54
  137. package/project-templates/threejs/docs/DESIGN.md +25 -0
  138. package/project-templates/threejs/docs/project-state.md +1 -1
  139. package/project-templates/threejs/docs/team/collaboration.md +19 -7
  140. package/project-templates/threejs/docs/team/workflow-changelog.md +14 -0
  141. package/project-templates/threejs/fusion-patterns/catalog.json +77 -0
  142. package/project-templates/threejs/package.json +3 -1
  143. package/project-templates/threejs/skills/_shared/scripts/dev-start.mjs +3 -3
  144. package/project-templates/threejs/skills/_shared/scripts/disclosure-config.mjs +65 -39
  145. package/project-templates/threejs/skills/_shared/scripts/harness-smoke.mjs +3 -1
  146. package/project-templates/threejs/skills/_shared/scripts/lib/fusion-intent.mjs +88 -0
  147. package/project-templates/threejs/skills/_shared/scripts/lib/skill-fidelity.mjs +185 -0
  148. package/project-templates/threejs/skills/_shared/scripts/state-get.mjs +124 -7
  149. package/project-templates/threejs/skills/_shared/scripts/state-store.mjs +25 -2
  150. package/project-templates/threejs/skills/_shared/scripts/validate-level-sketch.mjs +444 -0
  151. package/project-templates/threejs/skills/_shared/scripts/verify-design-consistency.mjs +728 -0
  152. package/project-templates/threejs/skills/playable-record/scripts/lib/dev-server.mjs +46 -11
  153. package/project-templates/threejs/skills/playable-record/scripts/record-playable.mjs +2 -1
  154. package/project-templates/threejs/skills/playable-record/scripts/verify-contract.mjs +4 -4
  155. package/project-templates/threejs/skills/playable-record/scripts/verify-firstwin.mjs +3 -3
  156. package/project-templates/threejs/skills/playable-record/scripts/verify-fusion.mjs +37 -2
  157. package/project-templates/threejs/skills/playable-record/scripts/verify-slice.mjs +2 -2
  158. package/project-templates/threejs/templates/design-brief.template.md +42 -11
  159. package/project-templates/threejs/templates/design-methodology.md +1 -2
  160. package/project-templates/threejs/templates/design.template.md +77 -0
  161. package/project-templates/threejs/templates/five-axis-framework.md +50 -1
  162. package/project-templates/threejs/templates/game-designer-creative-process.template.md +99 -0
  163. package/project-templates/threejs/templates/level-sketch.template.json +56 -0
  164. package/project-templates/threejs/templates/north-star.template.md +43 -0
  165. package/project-templates/threejs/templates/project-state.template.md +1 -1
  166. package/project-templates/threejs/vite.config.ts +4 -5
  167. package/project-template/docs/DESIGN.md +0 -65
package/README.md CHANGED
@@ -91,6 +91,27 @@ playcraft remix start \
91
91
  --open
92
92
  ```
93
93
 
94
+ ### 6. 将 Remix 源码 clone 到本地
95
+
96
+ ```bash
97
+ playcraft login
98
+ # 本地开发建议直连 backend,避免经前端代理缓冲 Git pack
99
+ export PLAYCRAFT_API_URL=http://localhost:3001
100
+
101
+ # 推荐:粘贴 Remix 详情页 / Editor / 工蜂分支页 URL
102
+ playcraft remix clone '<remix-detail-or-editor-or-gongfeng-url>' --install
103
+
104
+ # 兼容:显式 project + branch
105
+ playcraft remix clone \
106
+ --project-id <project-id> \
107
+ --branch remix/your-branch \
108
+ --install
109
+
110
+ cd <cloned-dir>
111
+ npm run dev # external 引擎
112
+ git push # 经 PlayCraft Git 代理写回 Remix 分支(禁止推 main)
113
+ ```
114
+
94
115
  完整的 Remix 子命令、参数、图片传输、自动化输出及故障处理说明见:
95
116
 
96
117
  - [PlayCraft CLI Remix 完整命令参考](./REMIX.md)
package/REMIX.md CHANGED
@@ -11,6 +11,7 @@ CLI (Command-Line Interface, 命令行界面) 的 Remix 工作流用于:
11
11
  - 向当前沙箱的 Agent 会话发送文本需求和参考图片。
12
12
  - 在交互式终端或自动化脚本中完成端到端创建流程。
13
13
  - 在本地项目中应用 Phaser 或 Three.js 引擎脚手架。
14
+ - **经 PlayCraft Git 代理将 Remix 源码 clone 到本地、本地开发后 push 回 Remix 分支。**
14
15
 
15
16
  ## 1. 命令总览
16
17
 
@@ -22,18 +23,21 @@ playcraft remix create
22
23
  playcraft remix start
23
24
  playcraft remix prompt
24
25
  playcraft remix run
25
- ```
26
-
27
- | 想完成的操作 | 推荐命令 |
28
- | ---------------------------- | --------------------------------------------------------------------- |
29
- | 查看当前账号所属团队 | `playcraft remix teams` |
30
- | 查看团队内可作为模板的项目 | `playcraft remix templates --team-id <team-id>` |
31
- | 只创建 Remix,不启动沙箱 | `playcraft remix create` 或交互式 `playcraft remix run` 后留空 Prompt |
32
- | 启动已有 Remix 并打开 Editor | `playcraft remix start --project-id <id> --branch <branch> --open` |
33
- | 向已有 Remix 发送需求 | `playcraft remix prompt` |
34
- | 创建 Remix 并立即运行 Agent | `playcraft remix run` |
35
- | 查询已有 Remix 列表 | `playcraft tools list-remixes`;当前没有 `playcraft remix list` |
36
- | 给本地项目应用引擎模板 | `playcraft remix init-template` |
26
+ playcraft remix clone
27
+ playcraft git-credential
28
+ ```
29
+
30
+ | 想完成的操作 | 推荐命令 |
31
+ | ---------------------------- | ------------------------------------------------------------------------------- |
32
+ | 查看当前账号所属团队 | `playcraft remix teams` |
33
+ | 查看团队内可作为模板的项目 | `playcraft remix templates --team-id <team-id>` |
34
+ | 只创建 Remix,不启动沙箱 | `playcraft remix create` 或交互式 `playcraft remix run` 后留空 Prompt |
35
+ | 启动已有 Remix 并打开 Editor | `playcraft remix start --project-id <id> --branch <branch> --open` |
36
+ | 向已有 Remix 发送需求 | `playcraft remix prompt` |
37
+ | 创建 Remix 并立即运行 Agent | `playcraft remix run` |
38
+ | **Clone Remix 源码到本地** | `playcraft remix clone <详情页/Editor/工蜂 URL>` 或 `--project-id` + `--branch` |
39
+ | 查询已有 Remix 列表 | `playcraft tools list-remixes`;当前没有 `playcraft remix list` |
40
+ | 给本地项目应用引擎模板 | `playcraft remix init-template` |
37
41
 
38
42
  查看当前版本的帮助:
39
43
 
@@ -717,27 +721,107 @@ playcraft remix start --project-id <project-id> --branch <remix-branch> --open
717
721
 
718
722
  可以。`remix prompt` 会自动启动或复用沙箱。
719
723
 
720
- ### 14.3 为什么 `prompt` 必须同时提供项目 ID 和分支?
724
+ ## 14. 本地 Clone / Push(Git 代理)
725
+
726
+ 登录后可将 Remix 源码经 **PlayCraft Backend Git Smart HTTP 代理**克隆到本机,无需工蜂凭据。平台服务账号 Token 不会下发到 CLI。
727
+
728
+ ### 14.1 Clone
729
+
730
+ ```bash
731
+ playcraft login --url https://test-playcraft.aix.intlgame.com
732
+
733
+ # 建议本地开发时 API 直连 backend(避免经前端 Next rewrite)
734
+ export PLAYCRAFT_API_URL=http://localhost:3001
735
+
736
+ # 推荐:直接粘贴 Remix 详情页或 Editor 地址
737
+ playcraft remix clone \
738
+ 'https://playcraft.aix.intlgame.com/projects/<uuid>/remixes/remix%2Fyour-branch' \
739
+ --install
740
+
741
+ playcraft remix clone \
742
+ 'https://playcraft.aix.intlgame.com/editor/remix/<uuid>?branch=remix%2Fyour-branch' \
743
+ --install
744
+
745
+ # 也可粘贴详情页上的工蜂分支页(git.woa.com / git.tencent.com 互认);仍走 PlayCraft 代理
746
+ playcraft remix clone \
747
+ 'https://git.woa.com/<group>/<repo>/tree/remix%2Fyour-branch' \
748
+ --install
749
+
750
+ playcraft remix clone \
751
+ 'https://git.tencent.com/<group>/<repo>/tree/remix%2Fyour-branch' \
752
+ --install
753
+
754
+ # 兼容旧写法
755
+ playcraft remix clone \
756
+ --project-id <project-id> \
757
+ --branch remix/your-branch \
758
+ --install
759
+ ```
760
+
761
+ 行为说明:
762
+
763
+ - Clone URL 形如:`<api>/api/git/projects/<projectId>/branches/<urlencode(branch)>.git`
764
+ - 固定浅克隆:`--single-branch --depth 1`
765
+ - 鉴权使用已登录 PAT(`Authorization: Bearer`),remote URL **不含** Token
766
+ - 仅 advertise / 允许操作 **URL 中指定的那条 Remix 分支**(不能拉同项目其它私有分支)
767
+ - 克隆后写入 `.playcraft.json`(projectId / branch / cloneUrl),并配置 `credential.helper=!playcraft git-credential`
768
+ - 工蜂地址会先调用 `GET /api/git/resolve-repo` 映射到 PlayCraft 项目,再经代理 clone(不会直连工蜂)
769
+
770
+ ### 14.2 本地运行
771
+
772
+ - **external(Phaser / Three.js)**:`npm install && npm run dev`(可用 `--install` / `--dev`)
773
+ - **PlayCanvas**:使用 `playcraft start --project <id>`,不是 Vite
774
+
775
+ ### 14.3 Push 回 Remix
776
+
777
+ 在克隆目录内:
778
+
779
+ ```bash
780
+ git add -A
781
+ git commit -m "local changes"
782
+ git push
783
+ ```
784
+
785
+ 服务端强制:
786
+
787
+ - 只能 push 到 URL 对应的 Remix 分支
788
+ - 禁止 push `main` / `master` / 项目默认分支
789
+ - 禁止新建 / 删除分支、推 tag
790
+ - Gallery 只读用户可以 clone,**不能** push(需 editor/owner 或该分支创建者)
791
+
792
+ ### 14.4 与云端沙箱同时写
793
+
794
+ 同一 Remix 分支若已在沙箱打开并 Save,本机 `git push` 与沙箱 push 会互相覆盖。请避免两边同时写同一分支;push 成功后 backend 会 `BareRepoCache.invalidate`。
795
+
796
+ ### 14.5 `playcraft git-credential`
797
+
798
+ 供本机 `git pull` / `git push` 使用的 credential helper,从 `~/.playcraft/config.json` 读取 PAT。clone 后会自动写入仓库 `credential.helper`。
799
+
800
+ ---
801
+
802
+ ## 15. 常见问题
803
+
804
+ ### 15.1 为什么 `prompt` 必须同时提供项目 ID 和分支?
721
805
 
722
806
  项目中可能存在多个 Remix 分支。显式指定二者可以避免需求落到 `main` 或其他 Remix。
723
807
 
724
- ### 14.4 `--open` 与 URL 输出有什么区别?
808
+ ### 15.2 `--open` 与 URL 输出有什么区别?
725
809
 
726
810
  `--open` 会调用系统浏览器。没有 `--open` 时命令仍会返回或打印 Editor URL,适合远程终端和自动化环境。
727
811
 
728
- ### 14.5 图片上传失败后是否仍会发送纯文本?
812
+ ### 15.3 图片上传失败后是否仍会发送纯文本?
729
813
 
730
814
  不会。附件校验或上传失败时,整个 Prompt 请求失败,避免 Agent 在缺少参考图的情况下继续执行。
731
815
 
732
- ### 14.6 `--no-wait` 是否会取消 Agent?
816
+ ### 15.4 `--no-wait` 是否会取消 Agent?
733
817
 
734
818
  不会。它只让 CLI 在 Agent 接收请求后立即返回,远端任务继续运行。
735
819
 
736
- ### 14.7 超时后 Agent 是否会停止?
820
+ ### 15.5 超时后 Agent 是否会停止?
737
821
 
738
822
  不保证。`--timeout` 限制 CLI 等待时间;当前命令不会因为本地等待超时而自动中止远端 Agent。
739
823
 
740
- ### 14.8 如何避免测试环境和生产环境 Token 混用?
824
+ ### 15.6 如何避免测试环境和生产环境 Token 混用?
741
825
 
742
826
  登录时显式传入环境地址:
743
827
 
@@ -747,7 +831,7 @@ playcraft login --url https://test-playcraft.aix.intlgame.com
747
831
 
748
832
  CLI 只会在保存 Token 的环境与目标环境一致时复用它;浏览器重新授权会创建新 Token 并替换旧值。
749
833
 
750
- ## 15. 版本与帮助
834
+ ## 16. 版本与帮助
751
835
 
752
836
  本文档描述当前源码中的命令。安装版本可能落后于仓库源码,排查参数差异时先检查:
753
837
 
@@ -21,9 +21,14 @@ const EMBEDDED_FUSION_EDGES = [
21
21
  label: 'C-Sequential, high risk → prefer pseudo-fusion',
22
22
  },
23
23
  {
24
- from: 'match3_core.aigameplay',
25
- to: 'arrow_escape_core.aigameplay',
26
- label: 'C-Sequential, medium-high risk → prefer pseudo-fusion',
24
+ from: 'path_elimination_rules.aigameplay',
25
+ to: 'pick_and_match_rules.aigameplay',
26
+ label: 'B2-Active, low risk → prefer arrow_pick_match composite',
27
+ },
28
+ {
29
+ from: 'path_elimination_rules.aigameplay',
30
+ to: 'arrow_pick_match_rules.aigameplay',
31
+ label: 'B2-Active composite — use instead of stitching parents',
27
32
  },
28
33
  ];
29
34
  function fusionEdges() {
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Fusion intent detection and composite-skill helpers for skills match routing.
3
+ */
4
+ const FUSION_KEYWORDS = [
5
+ '融合',
6
+ 'fusion',
7
+ 'hybrid',
8
+ 'combine',
9
+ '组合',
10
+ 'mix',
11
+ 'mixed',
12
+ 'plus',
13
+ '+',
14
+ '和',
15
+ '与',
16
+ '加',
17
+ ];
18
+ const ELIMINATION_KEYWORDS = ['消除', 'elimination', 'eliminate', 'match-3', 'match3', '三消', 'match'];
19
+ const ARROW_PATH_KEYWORDS = ['箭头', 'arrow', 'path', '路径', 'slide-out', 'slide'];
20
+ /** True when user intent suggests combining multiple gameplay mechanics. */
21
+ export function detectFusionIntent(intentTags, rawIntent = '') {
22
+ const blob = `${rawIntent} ${intentTags.join(' ')}`.toLowerCase();
23
+ if (FUSION_KEYWORDS.some((k) => blob.includes(k.toLowerCase())))
24
+ return true;
25
+ const hasElim = ELIMINATION_KEYWORDS.some((k) => blob.includes(k.toLowerCase()));
26
+ const hasArrow = ARROW_PATH_KEYWORDS.some((k) => blob.includes(k.toLowerCase()));
27
+ return hasElim && hasArrow;
28
+ }
29
+ /** Composite fusion skill: manifest declares ≥2 parent gameplay types. */
30
+ export function isFusionCompositeManifest(manifest) {
31
+ const parents = manifest.pgs?.parentTypes;
32
+ if (Array.isArray(parents) && parents.length >= 2)
33
+ return true;
34
+ if (manifest.pgs?.fusionDescription)
35
+ return true;
36
+ const id = manifest.atomId ?? '';
37
+ if (id.includes('_pick_') || id.includes('_match_')) {
38
+ return id.includes('arrow') || id.includes('path');
39
+ }
40
+ return false;
41
+ }
42
+ export function getManifestParentTypes(manifest) {
43
+ return manifest.pgs?.parentTypes ?? [];
44
+ }
45
+ /** Bonus score when fusion intent matches a composite skill. */
46
+ export function fusionCompositeScoreBoost(manifest, intentTags, rawIntent = '') {
47
+ if (!detectFusionIntent(intentTags, rawIntent))
48
+ return 0;
49
+ if (!isFusionCompositeManifest(manifest))
50
+ return 0;
51
+ return 25;
52
+ }
53
+ /** Penalize single-mechanic gameplay seeds when fusion intent is explicit. */
54
+ export function fusionSingleMechanicPenalty(manifest, intentTags, rawIntent = '') {
55
+ if (!detectFusionIntent(intentTags, rawIntent))
56
+ return 0;
57
+ if (manifest.category !== 'gameplay' && manifest.bundleType !== 'aigameplay')
58
+ return 0;
59
+ if (isFusionCompositeManifest(manifest))
60
+ return 0;
61
+ return -8;
62
+ }
@@ -327,7 +327,9 @@ export function collectPinnedDependencies(atomId, manifestIndex, engine, visited
327
327
  if (!imp.pinAtomId || visited.has(imp.pinAtomId))
328
328
  continue;
329
329
  deps.push(imp.pinAtomId);
330
- deps.push(...collectPinnedDependencies(imp.pinAtomId, manifestIndex, engine, visited, depth + 1));
330
+ if (imp.edgeKind === 'requires') {
331
+ deps.push(...collectPinnedDependencies(imp.pinAtomId, manifestIndex, engine, visited, depth + 1));
332
+ }
331
333
  }
332
334
  return deps;
333
335
  }