@playcraft/cli 0.1.38-beta → 0.1.39-prod

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 (367) hide show
  1. package/README.md +3 -58
  2. package/dist/agent/local-backend.js +1 -1
  3. package/dist/cli-root-help.js +0 -2
  4. package/dist/commands/build-all.js +19 -5
  5. package/dist/commands/build.js +28 -15
  6. package/dist/commands/create.js +33 -26
  7. package/dist/commands/image.js +6 -2
  8. package/dist/commands/login.js +42 -84
  9. package/dist/commands/skills.js +0 -4
  10. package/dist/commands/tools-3d.js +0 -11
  11. package/dist/commands/tools-generation.js +126 -68
  12. package/dist/commands/tools-image-context.js +23 -0
  13. package/dist/commands/tools.js +2 -2
  14. package/dist/config.js +4 -59
  15. package/dist/index.js +3 -40
  16. package/dist/remix/clone.js +0 -2
  17. package/dist/remix/init-template.js +0 -2
  18. package/dist/remix/pull.js +0 -2
  19. package/dist/remix/push.js +1 -21
  20. package/dist/utils/agent-api-client.js +30 -185
  21. package/dist/utils/image-asset-context.js +106 -0
  22. package/dist/utils/playcraft-http-client.js +4 -6
  23. package/package.json +3 -13
  24. package/project-template/.claude/agents/refs/ta-image-generation-detail.md +67 -123
  25. package/project-template/.claude/skills/playcraft-image-generation/SKILL.md +135 -63
  26. package/project-template/.claude/skills/playcraft-image-generation/reference/gen-batch-sprite.template.mjs +42 -33
  27. package/project-template/.claude/skills/playcraft-image-generation/reference/gen-batch.template.mjs +18 -20
  28. package/project-template/.claude/skills/playcraft-image-generation/reference/process-batch.template.mjs +6 -7
  29. package/project-template/.claude/skills/playcraft-image-generation/reference/prompt-cookbook.md +39 -39
  30. package/project-templates/phaser/.claude/agents/refs/ta-image-generation-detail.md +59 -59
  31. package/project-templates/phaser/.claude/skills/playcraft-image-generation/SKILL.md +135 -63
  32. package/project-templates/phaser/.claude/skills/playcraft-image-generation/reference/gen-batch-sprite.template.mjs +42 -33
  33. package/project-templates/phaser/.claude/skills/playcraft-image-generation/reference/gen-batch.template.mjs +18 -20
  34. package/project-templates/phaser/.claude/skills/playcraft-image-generation/reference/process-batch.template.mjs +6 -7
  35. package/project-templates/phaser/.claude/skills/playcraft-image-generation/reference/prompt-cookbook.md +39 -39
  36. package/project-templates/threejs/.claude/agents/refs/ta-image-generation-detail.md +59 -59
  37. package/project-templates/threejs/.claude/skills/playcraft-image-generation/SKILL.md +135 -63
  38. package/project-templates/threejs/.claude/skills/playcraft-image-generation/reference/gen-batch-sprite.template.mjs +42 -33
  39. package/project-templates/threejs/.claude/skills/playcraft-image-generation/reference/gen-batch.template.mjs +18 -20
  40. package/project-templates/threejs/.claude/skills/playcraft-image-generation/reference/process-batch.template.mjs +6 -7
  41. package/project-templates/threejs/.claude/skills/playcraft-image-generation/reference/prompt-cookbook.md +39 -39
  42. package/SKILLS_REGISTRY.md +0 -149
  43. package/dist/auth/account-activation.js +0 -157
  44. package/dist/auth/messages.js +0 -30
  45. package/dist/commands/build-temp.js +0 -26
  46. package/dist/commands/platform-skills.generated.js +0 -19
  47. package/dist/commands/playable.js +0 -53
  48. package/dist/commands/tools-batch.js +0 -87
  49. package/dist/commands/video.js +0 -111
  50. package/dist/commands/workspace-runtime.js +0 -54
  51. package/dist/commands/workspace.js +0 -35
  52. package/dist/project-skills/builtin-import.js +0 -225
  53. package/dist/project-skills/commands.js +0 -77
  54. package/dist/project-skills/lifecycle.js +0 -28
  55. package/dist/project-skills/local-run.js +0 -112
  56. package/dist/project-skills/local-store.js +0 -221
  57. package/dist/project-skills/messages.js +0 -80
  58. package/dist/project-skills/reconcile.js +0 -62
  59. package/dist/project-skills/remote-cache.js +0 -51
  60. package/dist/project-skills/validation.js +0 -19
  61. package/dist/recording/messages.js +0 -40
  62. package/dist/recording/project-digest.js +0 -85
  63. package/dist/recording/recorder.js +0 -293
  64. package/dist/recording/scenario.js +0 -50
  65. package/dist/skill-registry/client.js +0 -345
  66. package/dist/skill-registry/commands.js +0 -180
  67. package/dist/skill-registry/evaluation-client.js +0 -156
  68. package/dist/skill-registry/evaluation-commands.js +0 -174
  69. package/dist/skill-registry/messages.js +0 -177
  70. package/dist/skill-registry/package.js +0 -275
  71. package/dist/skill-registry/platform-package.js +0 -100
  72. package/dist/utils/environment-endpoints.js +0 -17
  73. package/dist/utils/tool-operation-journal.js +0 -124
  74. package/dist/utils/video-evidence-git.js +0 -81
  75. package/dist/video-replication/client.js +0 -222
  76. package/dist/video-replication/comparison-evidence.js +0 -149
  77. package/dist/video-replication/comparison-files.js +0 -57
  78. package/dist/video-replication/comparison-log.js +0 -72
  79. package/dist/video-replication/comparison-messages.js +0 -104
  80. package/dist/video-replication/comparison-output.js +0 -63
  81. package/dist/video-replication/comparison-preflight.js +0 -66
  82. package/dist/video-replication/comparison.js +0 -216
  83. package/dist/video-replication/evidence.js +0 -165
  84. package/dist/video-replication/media.js +0 -111
  85. package/dist/video-replication/messages.js +0 -89
  86. package/dist/workspace/messages.js +0 -35
  87. package/dist/workspace/transfer-client.js +0 -174
  88. package/dist/workspace-runtime/codex/app-server.js +0 -1040
  89. package/dist/workspace-runtime/codex/compact.js +0 -46
  90. package/dist/workspace-runtime/codex/config-toml.js +0 -107
  91. package/dist/workspace-runtime/codex/jsonrpc-stdio.js +0 -145
  92. package/dist/workspace-runtime/codex/launcher-client.js +0 -177
  93. package/dist/workspace-runtime/codex/loopback.js +0 -146
  94. package/dist/workspace-runtime/codex/mcp-config.js +0 -39
  95. package/dist/workspace-runtime/codex/model-broker.js +0 -263
  96. package/dist/workspace-runtime/codex/native-adapter.js +0 -9
  97. package/dist/workspace-runtime/codex/permissions.js +0 -70
  98. package/dist/workspace-runtime/codex/thread-image.js +0 -38
  99. package/dist/workspace-runtime/codex/ui-instructions.js +0 -4
  100. package/dist/workspace-runtime/codex/ui-tools.js +0 -183
  101. package/dist/workspace-runtime/codex/work-mode.js +0 -15
  102. package/dist/workspace-runtime/main.js +0 -10
  103. package/dist/workspace-runtime/persistence/journal.js +0 -365
  104. package/dist/workspace-runtime/persistence/native-subagents.js +0 -162
  105. package/dist/workspace-runtime/persistence/sqlite-client.js +0 -77
  106. package/dist/workspace-runtime/persistence/sqlite-worker.js +0 -1161
  107. package/dist/workspace-runtime/persistence/stopped-execution.js +0 -77
  108. package/dist/workspace-runtime/previews/output.js +0 -36
  109. package/dist/workspace-runtime/previews/publish.js +0 -262
  110. package/dist/workspace-runtime/previews/single-file.js +0 -43
  111. package/dist/workspace-runtime/processes/managed-writes.js +0 -69
  112. package/dist/workspace-runtime/production/content-changes.js +0 -36
  113. package/dist/workspace-runtime/production/contracts.js +0 -19
  114. package/dist/workspace-runtime/production/controller.js +0 -218
  115. package/dist/workspace-runtime/production/dependencies.js +0 -60
  116. package/dist/workspace-runtime/production/native.js +0 -212
  117. package/dist/workspace-runtime/production/processes.js +0 -102
  118. package/dist/workspace-runtime/production/save-command.js +0 -35
  119. package/dist/workspace-runtime/production/source-archive.js +0 -137
  120. package/dist/workspace-runtime/production/source-copy.js +0 -91
  121. package/dist/workspace-runtime/production/stages.js +0 -334
  122. package/dist/workspace-runtime/production/storage.js +0 -75
  123. package/dist/workspace-runtime/serve.js +0 -214
  124. package/dist/workspace-runtime/server/auth.js +0 -21
  125. package/dist/workspace-runtime/server/connectivity.js +0 -201
  126. package/dist/workspace-runtime/server/desktop-host.js +0 -429
  127. package/dist/workspace-runtime/server/desktop-preview-config.js +0 -81
  128. package/dist/workspace-runtime/server/desktop-preview-service.js +0 -157
  129. package/dist/workspace-runtime/server/desktop-preview-static.js +0 -53
  130. package/dist/workspace-runtime/server/desktop-preview.js +0 -189
  131. package/dist/workspace-runtime/server/dispatch.js +0 -1217
  132. package/dist/workspace-runtime/server/endpoints.js +0 -21
  133. package/dist/workspace-runtime/server/execution-group.js +0 -90
  134. package/dist/workspace-runtime/server/http.js +0 -1243
  135. package/dist/workspace-runtime/server/lock.js +0 -53
  136. package/dist/workspace-runtime/server/rfb-watch-gate.js +0 -168
  137. package/dist/workspace-runtime/server/source-uploader.js +0 -138
  138. package/dist/workspace-runtime/server/terminal-host.js +0 -366
  139. package/dist/workspace-runtime/server/types.js +0 -1
  140. package/dist/workspace-runtime/server/workspace-transfer.js +0 -99
  141. package/dist/workspace-runtime/workspaces/archive.js +0 -207
  142. package/dist/workspace-runtime/workspaces/artifact-events.js +0 -55
  143. package/dist/workspace-runtime/workspaces/artifact-files.js +0 -197
  144. package/dist/workspace-runtime/workspaces/artifact-receipts.js +0 -89
  145. package/dist/workspace-runtime/workspaces/artifacts.js +0 -282
  146. package/dist/workspace-runtime/workspaces/attachment-content.js +0 -123
  147. package/dist/workspace-runtime/workspaces/attachments.js +0 -185
  148. package/dist/workspace-runtime/workspaces/batch-commit.js +0 -142
  149. package/dist/workspace-runtime/workspaces/cli-context.js +0 -23
  150. package/dist/workspace-runtime/workspaces/cli-credentials.js +0 -111
  151. package/dist/workspace-runtime/workspaces/composer-context.js +0 -147
  152. package/dist/workspace-runtime/workspaces/context-error.js +0 -2
  153. package/dist/workspace-runtime/workspaces/dependencies.js +0 -264
  154. package/dist/workspace-runtime/workspaces/developer-command.js +0 -64
  155. package/dist/workspace-runtime/workspaces/directories.js +0 -133
  156. package/dist/workspace-runtime/workspaces/directory-access.js +0 -37
  157. package/dist/workspace-runtime/workspaces/directory-attachments.js +0 -245
  158. package/dist/workspace-runtime/workspaces/directory-maintenance.js +0 -111
  159. package/dist/workspace-runtime/workspaces/directory-stats.js +0 -49
  160. package/dist/workspace-runtime/workspaces/disk-snapshot.js +0 -31
  161. package/dist/workspace-runtime/workspaces/empty-template.js +0 -42
  162. package/dist/workspace-runtime/workspaces/files-search.js +0 -116
  163. package/dist/workspace-runtime/workspaces/files.js +0 -120
  164. package/dist/workspace-runtime/workspaces/git-credential-broker.js +0 -312
  165. package/dist/workspace-runtime/workspaces/git-credential-helper.js +0 -68
  166. package/dist/workspace-runtime/workspaces/git-direct-store.js +0 -155
  167. package/dist/workspace-runtime/workspaces/git.js +0 -670
  168. package/dist/workspace-runtime/workspaces/instructions.js +0 -56
  169. package/dist/workspace-runtime/workspaces/json5-edit.js +0 -170
  170. package/dist/workspace-runtime/workspaces/library-attachments.js +0 -268
  171. package/dist/workspace-runtime/workspaces/optional-platform-skills.js +0 -14
  172. package/dist/workspace-runtime/workspaces/parameters.js +0 -272
  173. package/dist/workspace-runtime/workspaces/prepare.js +0 -278
  174. package/dist/workspace-runtime/workspaces/registry.js +0 -251
  175. package/dist/workspace-runtime/workspaces/remix-references.js +0 -301
  176. package/dist/workspace-runtime/workspaces/revisions.js +0 -31
  177. package/dist/workspace-runtime/workspaces/session-image.js +0 -104
  178. package/dist/workspace-runtime/workspaces/shared-git.js +0 -40
  179. package/dist/workspace-runtime/workspaces/skill-artifact-loader.js +0 -95
  180. package/dist/workspace-runtime/workspaces/skills.js +0 -191
  181. package/dist/workspace-runtime/workspaces/transfer.js +0 -288
  182. package/dist/workspace-runtime/workspaces/turn-changes.js +0 -75
  183. package/dist/workspace-runtime/workspaces/video-attachments.js +0 -49
  184. package/project-template/.claude/skills/playcraft-replica-validation/SKILL.md +0 -25
  185. package/project-template/.claude/skills/playcraft-replica-validation/references/contracts.md +0 -79
  186. package/project-template/.claude/skills/playcraft-video-understanding/SKILL.md +0 -29
  187. package/project-template/.claude/skills/playcraft-video-understanding/references/contracts.md +0 -37
  188. package/project-template-v2/.claude/agents/artist.md +0 -82
  189. package/project-template-v2/.claude/agents/developer.md +0 -153
  190. package/project-template-v2/.claude/agents/game-designer.md +0 -264
  191. package/project-template-v2/.claude/agents/refs/artist-art-style-catalog.md +0 -533
  192. package/project-template-v2/.claude/agents/refs/artist-color-audio-recipes.md +0 -153
  193. package/project-template-v2/.claude/agents/refs/artist-dimension-axis.md +0 -27
  194. package/project-template-v2/.claude/agents/refs/artist-master-composite-recipes.md +0 -208
  195. package/project-template-v2/.claude/agents/refs/atom-skill-library.md +0 -81
  196. package/project-template-v2/.claude/agents/refs/developer-impl-cookbook.md +0 -432
  197. package/project-template-v2/.claude/agents/refs/framework-5-component-filter.md +0 -252
  198. package/project-template-v2/.claude/agents/refs/framework-game-feel-juice.md +0 -266
  199. package/project-template-v2/.claude/agents/refs/framework-mda.md +0 -147
  200. package/project-template-v2/.claude/agents/refs/game-designer-gameplay-sufficiency.md +0 -123
  201. package/project-template-v2/.claude/agents/refs/ta-3d-flip-recipe.md +0 -88
  202. package/project-template-v2/.claude/agents/refs/ta-atlas-deliverable-standard.md +0 -67
  203. package/project-template-v2/.claude/agents/refs/ta-batch-pipeline-recipes.md +0 -120
  204. package/project-template-v2/.claude/agents/refs/ta-image-generation-detail.md +0 -300
  205. package/project-template-v2/.claude/agents/refs/ta-image-ops-reference.md +0 -495
  206. package/project-template-v2/.claude/agents/refs/ta-pipeline-cookbook.md +0 -1141
  207. package/project-template-v2/.claude/agents/refs/ta-tools-reference.md +0 -111
  208. package/project-template-v2/.claude/agents/refs/ta-vfx-preset-catalog.md +0 -365
  209. package/project-template-v2/.claude/agents/refs/threejs-cannon-pitfalls.md +0 -412
  210. package/project-template-v2/.claude/agents/reviewer.md +0 -75
  211. package/project-template-v2/.claude/agents/technical-artist.md +0 -86
  212. package/project-template-v2/.claude/hooks/snapshot-milestone.mjs +0 -243
  213. package/project-template-v2/.claude/hooks/user-prompt.mjs +0 -133
  214. package/project-template-v2/.claude/settings.json +0 -33
  215. package/project-template-v2/.claude/skills/brainstorming/SKILL.md +0 -161
  216. package/project-template-v2/.claude/skills/brainstorming/scripts/frame-template.html +0 -270
  217. package/project-template-v2/.claude/skills/brainstorming/scripts/helper.js +0 -177
  218. package/project-template-v2/.claude/skills/brainstorming/scripts/server.cjs +0 -354
  219. package/project-template-v2/.claude/skills/brainstorming/scripts/start-server.sh +0 -148
  220. package/project-template-v2/.claude/skills/brainstorming/scripts/stop-server.sh +0 -56
  221. package/project-template-v2/.claude/skills/brainstorming/scripts/wait-for-selection.sh +0 -62
  222. package/project-template-v2/.claude/skills/brainstorming/spec-document-reviewer-prompt.md +0 -49
  223. package/project-template-v2/.claude/skills/brainstorming/visual-companion.md +0 -309
  224. package/project-template-v2/.claude/skills/playcraft-ad-psychology/SKILL.md +0 -182
  225. package/project-template-v2/.claude/skills/playcraft-art-style-guide/SKILL.md +0 -123
  226. package/project-template-v2/.claude/skills/playcraft-asset-state-sheet/SKILL.md +0 -205
  227. package/project-template-v2/.claude/skills/playcraft-audio-generation/SKILL.md +0 -280
  228. package/project-template-v2/.claude/skills/playcraft-batch-pipeline/SKILL.md +0 -184
  229. package/project-template-v2/.claude/skills/playcraft-build-optimizer/SKILL.md +0 -306
  230. package/project-template-v2/.claude/skills/playcraft-image-generation/SKILL.md +0 -298
  231. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/build-sprite-sheet.template.mjs +0 -123
  232. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/compare-style.template.mjs +0 -254
  233. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/gen-batch-sprite.template.mjs +0 -324
  234. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/gen-batch.template.mjs +0 -97
  235. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/gen-edit-variants.template.mjs +0 -118
  236. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/process-batch.template.mjs +0 -137
  237. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/prompt-cookbook.md +0 -397
  238. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/validate-sprite-sheet.template.mjs +0 -296
  239. package/project-template-v2/.claude/skills/playcraft-image-ops/SKILL.md +0 -122
  240. package/project-template-v2/.claude/skills/playcraft-image-processing/SKILL.md +0 -219
  241. package/project-template-v2/.claude/skills/playcraft-masking/SKILL.md +0 -373
  242. package/project-template-v2/.claude/skills/playcraft-playable-optimization/SKILL.md +0 -161
  243. package/project-template-v2/.claude/skills/playcraft-research/SKILL.md +0 -215
  244. package/project-template-v2/.claude/skills/playcraft-skill-recommender/SKILL.md +0 -382
  245. package/project-template-v2/.claude/skills/playcraft-sprite-generation/SKILL.md +0 -423
  246. package/project-template-v2/.claude/skills/playcraft-sprite-remix/SKILL.md +0 -158
  247. package/project-template-v2/.claude/skills/playcraft-sprite-sheet/SKILL.md +0 -100
  248. package/project-template-v2/.claude/skills/playcraft-storyboard/SKILL.md +0 -167
  249. package/project-template-v2/.claude/skills/playcraft-style-qa/SKILL.md +0 -270
  250. package/project-template-v2/.claude/skills/playcraft-text-rendering/SKILL.md +0 -236
  251. package/project-template-v2/.claude/skills/playcraft-vfx-animation/SKILL.md +0 -130
  252. package/project-template-v2/.claude/skills/playwright-cli/SKILL.md +0 -390
  253. package/project-template-v2/.claude/skills/playwright-cli/references/element-attributes.md +0 -23
  254. package/project-template-v2/.claude/skills/playwright-cli/references/playwright-tests.md +0 -39
  255. package/project-template-v2/.claude/skills/playwright-cli/references/request-mocking.md +0 -87
  256. package/project-template-v2/.claude/skills/playwright-cli/references/running-code.md +0 -240
  257. package/project-template-v2/.claude/skills/playwright-cli/references/session-management.md +0 -226
  258. package/project-template-v2/.claude/skills/playwright-cli/references/spec-driven-testing.md +0 -308
  259. package/project-template-v2/.claude/skills/playwright-cli/references/storage-state.md +0 -275
  260. package/project-template-v2/.claude/skills/playwright-cli/references/test-generation.md +0 -134
  261. package/project-template-v2/.claude/skills/playwright-cli/references/tracing.md +0 -142
  262. package/project-template-v2/.claude/skills/playwright-cli/references/video-recording.md +0 -153
  263. package/project-template-v2/.claude/skills/session-analyzer/SKILL.md +0 -386
  264. package/project-template-v2/.claude/skills/session-analyzer/scripts/execution-breakdown.mjs +0 -182
  265. package/project-template-v2/.claude/skills/session-analyzer/scripts/find-turns.mjs +0 -72
  266. package/project-template-v2/.claude/skills/session-analyzer/scripts/heavy-output.mjs +0 -121
  267. package/project-template-v2/.claude/skills/session-analyzer/scripts/resolve-session.mjs +0 -102
  268. package/project-template-v2/.claude/skills/session-analyzer/scripts/subagent-stats.mjs +0 -127
  269. package/project-template-v2/.claude/skills/session-analyzer/scripts/subagent-tool-timeline.mjs +0 -106
  270. package/project-template-v2/.claude/skills/session-analyzer/scripts/time-gaps.mjs +0 -128
  271. package/project-template-v2/.claude/skills/session-analyzer/scripts/turn-timeline.mjs +0 -67
  272. package/project-template-v2/.claude/snapshot.mjs +0 -263
  273. package/project-template-v2/.playcraft/skills.lock.json +0 -152
  274. package/project-template-v2/CLAUDE.md +0 -146
  275. package/project-template-v2/assets/audio/bgm/.gitkeep +0 -0
  276. package/project-template-v2/assets/audio/sfx/.gitkeep +0 -0
  277. package/project-template-v2/assets/bundles/.gitkeep +0 -0
  278. package/project-template-v2/assets/images/bg/.gitkeep +0 -0
  279. package/project-template-v2/assets/images/reference/.gitkeep +0 -0
  280. package/project-template-v2/assets/images/storyboard/.gitkeep +0 -0
  281. package/project-template-v2/assets/images/tiles/.gitkeep +0 -0
  282. package/project-template-v2/assets/images/ui/.gitkeep +0 -0
  283. package/project-template-v2/assets/images/vfx/.gitkeep +0 -0
  284. package/project-template-v2/assets/models/.gitkeep +0 -0
  285. package/project-template-v2/docs/harness/iteration-1/context-flow.md +0 -254
  286. package/project-template-v2/docs/harness/iteration-1/generate-flow.md +0 -91
  287. package/project-template-v2/docs/harness/iteration-1/ideate-flow.md +0 -214
  288. package/project-template-v2/docs/harness/iteration-1/optimize-flow.md +0 -75
  289. package/project-template-v2/docs/harness/iteration-1/wrapup-flow.md +0 -63
  290. package/project-template-v2/docs/harness/iteration-2/context-flow.md +0 -223
  291. package/project-template-v2/docs/harness/iteration-2/generate-flow.md +0 -129
  292. package/project-template-v2/docs/harness/iteration-2/ideate-flow.md +0 -267
  293. package/project-template-v2/docs/harness/iteration-2/optimize-flow.md +0 -164
  294. package/project-template-v2/docs/harness/iteration-2/wrapup-flow.md +0 -115
  295. package/project-template-v2/docs/harness/orchestrator-flow.md +0 -364
  296. package/project-template-v2/docs/project-state.json +0 -60
  297. package/project-template-v2/docs/project-state.md +0 -72
  298. package/project-template-v2/docs/standards/README.md +0 -225
  299. package/project-template-v2/docs/standards/agent-behavior-standards.md +0 -174
  300. package/project-template-v2/docs/standards/artifacts/design-brief.md +0 -19
  301. package/project-template-v2/docs/standards/artifacts/design.md +0 -22
  302. package/project-template-v2/docs/standards/artifacts/game-code.md +0 -41
  303. package/project-template-v2/docs/standards/artifacts/todo-list.md +0 -41
  304. package/project-template-v2/docs/standards/iter1-agent-behavior-standards.md +0 -343
  305. package/project-template-v2/game/index.ts +0 -18
  306. package/project-template-v2/globals.d.ts +0 -51
  307. package/project-template-v2/index.css +0 -34
  308. package/project-template-v2/index.html +0 -18
  309. package/project-template-v2/main.ts +0 -9
  310. package/project-template-v2/package.json +0 -46
  311. package/project-template-v2/skills/_shared/scripts/dispatch-clear.mjs +0 -31
  312. package/project-template-v2/skills/_shared/scripts/dispatch-set.mjs +0 -86
  313. package/project-template-v2/skills/_shared/scripts/dod-check.mjs +0 -153
  314. package/project-template-v2/skills/_shared/scripts/handoff-append.mjs +0 -70
  315. package/project-template-v2/skills/_shared/scripts/lib/validator-artifacts.mjs +0 -91
  316. package/project-template-v2/skills/_shared/scripts/pipeline/dod-config.mjs +0 -131
  317. package/project-template-v2/skills/_shared/scripts/pipeline/index.mjs +0 -80
  318. package/project-template-v2/skills/_shared/scripts/pipeline/iteration-1-core.mjs +0 -90
  319. package/project-template-v2/skills/_shared/scripts/pipeline/iteration-2-wrap.mjs +0 -93
  320. package/project-template-v2/skills/_shared/scripts/pipeline/iteration-3-visual.mjs +0 -23
  321. package/project-template-v2/skills/_shared/scripts/render-project-state.mjs +0 -230
  322. package/project-template-v2/skills/_shared/scripts/state-advance-stage.mjs +0 -58
  323. package/project-template-v2/skills/_shared/scripts/state-get.mjs +0 -339
  324. package/project-template-v2/skills/_shared/scripts/state-handoff.mjs +0 -39
  325. package/project-template-v2/skills/_shared/scripts/state-set.mjs +0 -94
  326. package/project-template-v2/skills/_shared/scripts/state-store.mjs +0 -783
  327. package/project-template-v2/skills/_shared/scripts/todo-add.mjs +0 -88
  328. package/project-template-v2/skills/_shared/scripts/todo-get.mjs +0 -130
  329. package/project-template-v2/skills/_shared/scripts/todo-remove.mjs +0 -33
  330. package/project-template-v2/skills/_shared/scripts/todo-set.mjs +0 -47
  331. package/project-template-v2/skills/_shared/scripts/verify-asset-code-sync.mjs +0 -268
  332. package/project-template-v2/skills/_shared/scripts/verify-env.mjs +0 -285
  333. package/project-template-v2/skills/_shared/scripts/verify-placeholders.mjs +0 -161
  334. package/project-template-v2/skills/playable-autoplay/SKILL.md +0 -176
  335. package/project-template-v2/skills/playable-autoplay/agents/openai.yaml +0 -4
  336. package/project-template-v2/skills/playable-debug/SKILL.md +0 -116
  337. package/project-template-v2/skills/playable-debug/agents/openai.yaml +0 -4
  338. package/project-template-v2/skills/playable-debug/references/debug-config.md +0 -40
  339. package/project-template-v2/skills/playable-record/SKILL.md +0 -140
  340. package/project-template-v2/skills/playable-record/scripts/lib/dev-server.mjs +0 -104
  341. package/project-template-v2/skills/playable-record/scripts/lib/record-audio-bridge.js +0 -141
  342. package/project-template-v2/skills/playable-record/scripts/record-playable.mjs +0 -425
  343. package/project-template-v2/skills/playable-record/scripts/verify-contract.mjs +0 -261
  344. package/project-template-v2/skills/playable-record/scripts/verify-firstwin.mjs +0 -398
  345. package/project-template-v2/skills/playable-record/scripts/verify-fusion.mjs +0 -322
  346. package/project-template-v2/skills/playable-record/scripts/verify-lifecycle.mjs +0 -105
  347. package/project-template-v2/skills/playable-record/scripts/verify-vlm-video.mjs +0 -230
  348. package/project-template-v2/skills/playable-validate/SKILL.md +0 -61
  349. package/project-template-v2/skills/playable-validate/validation-rules.md +0 -14
  350. package/project-template-v2/skills/playable-verify-ui/SKILL.md +0 -63
  351. package/project-template-v2/skills/playable-verify-ui/scripts/lib/__init__.py +0 -1
  352. package/project-template-v2/skills/playable-verify-ui/scripts/lib/config_expr.js +0 -218
  353. package/project-template-v2/skills/playable-verify-ui/scripts/lib/node_utils.js +0 -51
  354. package/project-template-v2/skills/playable-verify-ui/scripts/lib/profile_loader.py +0 -59
  355. package/project-template-v2/skills/playable-verify-ui/scripts/lib/report.py +0 -106
  356. package/project-template-v2/skills/playable-verify-ui/scripts/lib/runtime_contract.js +0 -116
  357. package/project-template-v2/skills/playable-verify-ui/scripts/verify_fetch_antipatterns.py +0 -59
  358. package/project-template-v2/skills/playable-verify-ui/scripts/verify_hardcoded_layout.js +0 -64
  359. package/project-template-v2/skills/playable-verify-ui/scripts/verify_runtime_contract.js +0 -58
  360. package/project-template-v2/skills/playable-verify-ui/scripts/verify_text_overlap.py +0 -333
  361. package/project-template-v2/ta-workspace/scripts/.gitkeep +0 -0
  362. package/project-template-v2/tsconfig.json +0 -20
  363. package/project-template-v2/vite.config.ts +0 -27
  364. package/project-templates/batch-locks/phaser.yaml +0 -922
  365. package/project-templates/batch-locks/threejs.yaml +0 -978
  366. package/project-templates/empty/AGENTS.md +0 -41
  367. package/project-templates/empty/gitignore +0 -33
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: playcraft-image-generation
3
- description: PlayCraft AI 图片生成核心决策指南。涵盖模型选择决策树、核心命令模板、背景处理决策树(绿幕策略)、脚本决策规则。精灵图直出/Edit 模型/错误恢复/批量实践等进阶内容见 refs/ta-image-generation-detail.md。
3
+ description: PlayCraft AI (Artificial Intelligence, 人工智能) 图片生成与素材替换指南。默认使用可用的 Image 2.5;替换素材时读取参考图,全新素材可无参考文生图;验证背景要求、目标尺寸和最终文件。
4
4
  triggers: 生成图片,generate image,选模型,model selection,reference image,参考图,风格一致,图生图,文生图,AI生图,图片质量,模型选择,500错误,模型失败,generate-image,list-image-models,ta-workspace,batch,批量,脚本,nodejs,edit模型,变体,绿幕,去背景,透明PNG,prompt,提示词,prompt套路,提示词技巧
5
5
  ---
6
6
 
@@ -8,7 +8,13 @@ triggers: 生成图片,generate image,选模型,model selection,reference image,
8
8
 
9
9
  ## 0. 开始前必读
10
10
 
11
- 生图前**必须先运行模型发现命令**:
11
+ 替换现有素材时先读取目标字段的 schema 配置(resolution、ratio、prompt、remove_background、reference_image)及当前素材。全新素材按用户需求确定尺寸、格式和输出路径,不假定所有素材都是透明 PNG (Portable Network Graphics, 便携式网络图形)。
12
+
13
+ 项目没有素材 schema 时,从目标素材的尺寸、格式和用户需求确定交付规格;参考图只提供内容和风格,不改变目标画布。不要套用其他游戏的字段、路径或尺寸。
14
+
15
+ 替换现有素材时传 `targetAssetPath`(命令行为 `--target-asset`):工具在生成前自动读取字段的 reference_image、当前素材、尺寸、格式、fit_mode、remove_background 与 padding_color。字段没有参考图时使用当前素材;读取失败立即停止,不丢弃参考图后继续生成。显式 referenceImagePath / --reference-image 可以覆盖默认参考图;用户明确要求无参考生成时才设 useTargetReference=false / --no-target-reference,交付约束仍保留。查看图片或在对话中选中素材不等于传入参考图。仅调整风格时保留原有文字、构图和用途;用户要求重新命名或重做构图时再改变。
16
+
17
+ 生图前运行模型发现命令,核实当前账号可用的模型与透明输出能力:
12
18
 
13
19
  ```bash
14
20
  playcraft tools list-image-models
@@ -18,7 +24,8 @@ playcraft tools list-image-models
18
24
 
19
25
  ```
20
26
  MODEL CAPABILITY ALPHA PROVIDERS
21
- gpt-image-2 text+image no 3 (iegg-litellm, mulerouter, 302)
27
+ gpt-image-2.5-sunburst text+image yes iegg-litellm
28
+ gpt-image-2.5-flare text+image yes iegg-litellm
22
29
  gemini-3.1-flash-image-preview text+image no 2 (google, iegg-litellm)
23
30
  hy-image-v3.0 text+image no 1 (tencent-cloud)
24
31
  flux-kontext-pro text+image no 1 (302)
@@ -29,7 +36,7 @@ qwen-image-edit-max image→image no 1 (mulerouter
29
36
  **列说明**:
30
37
 
31
38
  - `CAPABILITY`:`text→image` 仅文生图 / `image→image` 仅图生图 / `text+image` 两者均支持
32
- - `ALPHA`:`yes` = 原生透明 PNG;`no` = 需使用绿幕策略(见第 3 节)
39
+ - `ALPHA`:`yes` = 支持原生透明输出;`no` = 透明素材才需要另行去背(见第 3 节)
33
40
  - `PROVIDERS`:支持该模型的 provider 数量,多个 provider 时后端按优先级自动 fallback(顺序尝试,首个成功即返回)
34
41
 
35
42
  **Prompt 套路速查**:[reference/prompt-cookbook.md](reference/prompt-cookbook.md)
@@ -40,8 +47,11 @@ qwen-image-edit-max image→image no 1 (mulerouter
40
47
 
41
48
  ```
42
49
  需要生图?
43
- ├─ 追求最高质量(概念图、精品单图)?
44
- │ └─ gpt-image-2(3 个 provider 自动 fallback:iegg-litellm → mulerouter → 302)
50
+ ├─ 用户指定了模型,或制作流程已锁定模型?
51
+ │ └─ 使用指定模型;失败时报告原因,不静默更换
52
+ │
53
+ ├─ 普通图片生成 / 现有素材替换 / 含文字 Logo?
54
+ │ └─ 优先 iegg-litellm/gpt-image-2.5-sunburst;不可用时选择清单中的 Image 2.5 并报告实际模型
45
55
  │
46
56
  ├─ 需要 --reference-image(风格一致性批量生产)?
47
57
  │ └─ 必须选 CAPABILITY = text+image 或 image→image 的模型
@@ -53,29 +63,30 @@ qwen-image-edit-max image→image no 1 (mulerouter
53
63
  │ └─ Edit 模型工作流(见进阶参考)
54
64
  │
55
65
  └─ 不确定?
56
- └─ 先试 gpt-image-2,失败换 gemini-3.1-flash-image-preview
66
+ └─ 使用平台默认模型;透明素材优先清单中 ALPHA=yes 的模型
57
67
  ```
58
68
 
59
69
  ### 主要模型特性
60
70
 
61
- | 模型 | 特点与优势 | 最佳场景 | 速度 | 注意事项 |
62
- | ---------------------------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------- | ------------------------------- | --------------------------------------------------------------- |
63
- | **gpt-image-2** | 细节最丰富、光影最真实、网格/布局理解力最强、中文字符准确率最高、3 provider fallback 容错高 | 概念图、精灵图直出、含文字素材、写实/半写实风格 | 慢(7-8min/张),**不设 timeout** | 慢是正常的;只有 `API 500` / `fetch failed` 才切换下一 provider |
64
- | **gemini-3.1-flash-image-preview** | 速度快、色彩鲜艳、构图清晰、最稳定不易报错、reference-image 理解好 | 快速迭代、扁平卡通、明亮休闲风、超时回退 | 快(<30s) | 精细细节和文字不如 gpt-image-2 |
65
- | **hy-image-v3.0** | 亚洲审美偏向、角色设计好、Q版/IP风格擅长 | 中国风、Q版角色、IP 形象 | 中等 | 西方写实风格表现一般 |
66
- | **flux-kontext-pro** | 艺术感强、风格独特、手绘质感好 | 艺术插画、手绘风、独特画风探索 | 中等 | 网格理解弱,不适合精灵图 |
67
- | **nano-banana-2** | 最快、适合简单图形探索 | 简洁图标、平面设计、快速草稿 | 极快 | 中文字符不可靠、细节少 |
68
- | **qwen-image-edit-max** | 图生图编辑能力强、局部修改精确 | 换花色/换数字/换颜色等结构相似变体 | 中等 | CAPABILITY=image→image,必须传 reference-image |
69
- | **wan2.6-image** | 风格迁移能力好 | 将参考图风格应用到新内容 | 中等 | CAPABILITY=image→image,必须传 reference-image |
71
+ | 模型 | 特点与优势 | 最佳场景 | 速度 | 注意事项 |
72
+ | ---------------------------------- | ------------------------------------------------------------------ | ---------------------------------------- | -------------- | ----------------------------------------------------------------- |
73
+ | **gpt-image-2.5-sunburst / flare** | 当前普通生图与素材替换的优先模型,支持参考图及原生透明输出 | Logo、角色、图标、透明素材替换 | 以实际调用为准 | 使用模型清单中的 provider/model;检查返回的实际模型和透明验证结果 |
74
+ | **gpt-image-2** | 兼容已有项目和明确指定 provider 的制作流程 | 已锁定模型的概念图、故事板、精灵图 | 以实际调用为准 | 普通素材默认优先 Image 2.5;能力和可用 provider 以模型清单为准 |
75
+ | **gemini-3.1-flash-image-preview** | 速度快、色彩鲜艳、构图清晰、最稳定不易报错、reference-image 理解好 | 快速迭代、扁平卡通、明亮休闲风、超时回退 | 快(<30s) | 精细细节和文字不如 gpt-image-2 |
76
+ | **hy-image-v3.0** | 亚洲审美偏向、角色设计好、Q版/IP风格擅长 | 中国风、Q版角色、IP 形象 | 中等 | 西方写实风格表现一般 |
77
+ | **flux-kontext-pro** | 艺术感强、风格独特、手绘质感好 | 艺术插画、手绘风、独特画风探索 | 中等 | 网格理解弱,不适合精灵图 |
78
+ | **nano-banana-2** | 最快、适合简单图形探索 | 简洁图标、平面设计、快速草稿 | 极快 | 中文字符不可靠、细节少 |
79
+ | **qwen-image-edit-max** | 图生图编辑能力强、局部修改精确 | 换花色/换数字/换颜色等结构相似变体 | 中等 | CAPABILITY=image→image,必须传 reference-image |
80
+ | **wan2.6-image** | 风格迁移能力好 | 将参考图风格应用到新内容 | 中等 | CAPABILITY=image→image,必须传 reference-image |
70
81
 
71
82
  ### 选型口诀
72
83
 
73
- - 追求质量 / 含文字 / 网格图 → `gpt-image-2`
74
- - 快速迭代 / 扁平风格 / 回退备选 → `gemini-3.1-flash-image-preview`
84
+ - 普通素材 / 含文字 / 透明元素 → 可用的 `gpt-image-2.5-sunburst`,其次 Image 2.5 系列
85
+ - 已锁定的故事板或制作流程 → 沿用该流程指定模型,见下方 MC 专用规则
75
86
  - 中国风 / Q版 / 亚洲审美 → `hy-image-v3.0`
76
87
  - 艺术/手绘探索 → `flux-kontext-pro`
77
88
  - 纯 edit 变体 → `qwen-image-edit-max`
78
- - 一切都失败 → `gemini-3.1-flash-image-preview`(最稳定)
89
+ - 模型失败 → 先检查返回错误;不要把原生透明失败自动改成 Gemini 白底生成
79
90
 
80
91
  ### 为什么精灵图直出是首选批量策略?
81
92
 
@@ -91,15 +102,72 @@ qwen-image-edit-max image→image no 1 (mulerouter
91
102
 
92
103
  ## 2. 核心命令
93
104
 
105
+ ### 沙箱对话中的直接工具
106
+
107
+ 当前对话注册了 `playcraft-generate-image` 时,直接调用它。根据本次目标素材填写参数,不固定游戏名、素材类别、参考路径、尺寸或比例:
108
+
109
+ | 参数 | 本次取值 |
110
+ | ------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
111
+ | `prompt` | 目标字段与用户要求的主体、风格、文字、构图或状态;完整场景可描述背景内容,透明交付通过背景开关表达 |
112
+ | `targetAssetPath` | 被替换的现有素材路径;自动加载该字段参考图和全部交付约束,避免与素材弹窗行为不一致 |
113
+ | `imageModelRef` | 普通生图可省略,由后端优先选择可用 Image 2.5;用户明确指定、字段配置或制作流程已锁定时传指定模型 |
114
+ | `referenceImagePath` | 已确认可读的项目相对参考路径;优先字段 `reference_image`,其次当前素材,新素材无参考时可省略 |
115
+ | `additionalReferenceImagePaths` | 确有多个参考时传入其他可读路径,顺序与用途明确 |
116
+ | `aspectRatio` | 新素材的构图比例;现有素材由 targetAssetPath 读取字段比例和尺寸 |
117
+ | `width` / `height` | 新素材的成对像素尺寸;有 targetAssetPath 时字段尺寸优先 |
118
+ | `outputFormat` / `fitMode` / `paddingColor` | 新素材的格式、适配方式和补边颜色;有 targetAssetPath 时读取目标约束 |
119
+ | `background` | **必填**。根据完整对话上下文和字段配置选择;仅用户或字段明确要求背景时选择 `opaque`,其余选择 `transparent`,不能仅按素材用途决定;Remix 未明确要求时选择 `transparent` |
120
+ | `outputPath` | 后端完成交付处理后的最终预览文件路径,沿用项目工作目录约定,视觉验收后写回实际主题引用 |
121
+
122
+ 背景、角色、道具、按钮、文字、发光状态、序列帧等各自遵守项目字段配置。成组状态或动画帧还需保持对象、风格、锚点与尺寸一致,不把单张静态图当成完整序列帧替换。
123
+
124
+ `background: transparent` 表示需要通过验证的透明素材,不表示必须执行一次本地去背。背景优先级为字段明确规则 → 对话模型的结构化选择。每次调用前由当前 Agent 结合完整对话判断,不依赖生图提示词关键词或旧图片的不透明状态;“不需要背景”“不要保留背景”选择 `transparent`。后端直接执行选择并校验成品,只有旧调用省略背景选择时才沿用提示词推断兼容路径,不额外请求一次对话模型。保存实际 provider/model、参考图数量、请求编号、尝试次数与透明验证结论;模型清单里的默认星号不能证明本次实际使用的模型。
125
+
126
+ 常规生图工具的透明交付通过必填 `background: transparent`(命令行为 `--background transparent`)表达;保留背景选择 `opaque`。字段配置仍为最高约束。`prompt` 保留主体、文字、风格、构图及透明玻璃、水泡等材质;源图背景按实际模型处理:
127
+
128
+ | 模型 / 流程 | 源图背景说明 |
129
+ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
130
+ | Image 2.5 | 后端组装原生透明指令及必要的恢复请求,交付顺序见下文。调用方不追加透明、白底或色幕后缀。 |
131
+ | 明确选用的其他模型 | 后端首次请求保留调用方提示词,不会自动补白底。要求透明交付时,追加单一 `on a uniform solid pure white background for subsequent background removal`,同时传透明交付开关;不要混入透明或色幕要求。 |
132
+ | 独立色幕制作 | 仅在第 3 节的适用条件下使用;保留色幕中间图,切分后独立去背,最终仍需透明验收。 |
133
+
134
+ Image 2.5 的透明文生图无需参考图。生成全新素材时省略 targetAssetPath;没有参考图时直接文生图,用户提供参考图时显式传入,按用户要求传背景开关。替换现有素材时传目标路径以读取参考图和交付规格。要求透明输出时使用 PNG 或 WebP;没有格式配置的旧 .jpg 素材生成透明预览时改用 PNG。
135
+
136
+ 透明交付由后端完成,有参考图与无参考图采用相同规则,按入口区分:
137
+
138
+ - **Remix 项目对话**:先直接生成透明图;透明验证不合格时只生成一张干净纯色原图,再把它交给支持透明编辑的模型去底;模型编辑报错或结果不合格,才对同一张纯色原图执行本地去背。模型不支持透明编辑时直接进入本地兜底。不使用失败的编辑结果做本地输入,不为本地兜底重新生成纯色图,也不在 Agent 层额外重复去背。
139
+ - **其他生图入口**:保留原生透明优先、必要时本地去背及最终验收的原有行为,不套用 Remix 的额外模型编辑步骤。
140
+
141
+ 首次生成阶段最多尝试两次供应商请求;Remix 仅在收到不合格图片后保留恢复次数:一次纯色源图生成,每张源图一次模型编辑。单图正常最多三次模型请求,若首次供应商请求失败则最多四次;批量恢复最多为首次阶段两次加一次纯色源图批量请求、每张一次编辑。本地后处理不增加模型请求数。其他 Agent 生图入口的模型、供应商与重新生成合计仍最多尝试两次;命令行默认没有额外重试。
142
+
143
+ 返回 `transparencySource=native`、`model-edit` 或 `background-removal`,分别表示原生透明、模型去底或本地去背。对话中的 `Image preview:` 地址保存的是后端最终成品,并独立于可编辑的沙箱文件;不要把恢复过程中的纯色原图展示为最终成品。自动检查只能判断透明通道、非空前景及画入的棋盘格等问题,不能代替文字、主体完整性、孔洞及深浅背景下的视觉验收。最终仍失败时报告请求编号与失败阶段并停止,不自行换模型、关闭透明要求或把透明补边当作成功。
144
+
145
+ 未注册直接工具时使用下方 CLI (Command-Line Interface, 命令行工具) 入口。若返回 `Business tool protocol unavailable (501); no operation was sent`,本次没有发出生图请求:修复入口或使用已注册的直接工具,不要通过换模型反复重试。
146
+
147
+ ### 现有素材替换
148
+
149
+ 先用 `playcraft tools image-context --asset-path <现有素材路径>` 查看本地解析结果;新命令不存在时更新已固定版本的命令行工具,不能跳过上下文继续生成。
150
+
151
+ ```bash
152
+ playcraft tools generate-image \
153
+ --target-asset "$TARGET_ASSET_PATH" \
154
+ --prompt "$IMAGE_PROMPT" \
155
+ --background "$BACKGROUND_MODE" \
156
+ --output "$PREVIEW_OUTPUT_PATH"
157
+ ```
158
+
159
+ 变量填写本次素材路径、用户生成要求与工作目录中的预览路径;`BACKGROUND_MODE` 由当前对话 Agent 明确选择 `transparent` 或 `opaque`,每次生图都传入。此入口自动传递该素材的参考图和交付约束;验证通过后再应用到目标主题。新素材没有目标文件时才手动传 `--width` / `--height`、`--output-format`、`--fit-mode`、`--padding-color`。旧脚本的 `--remove-background` / `--no-remove-background` 继续兼容,新 Agent 调用统一使用 `--background`。
160
+
94
161
  ### 文生图(text-to-image)
95
162
 
96
163
  ```bash
97
164
  playcraft tools generate-image \
98
165
  --prompt "A golden sword icon, flat 2D vector style, centered composition" \
166
+ --background transparent \
99
167
  --output assets/images/sword.png \
100
168
  --aspect-ratio 1:1 \
101
169
  --image-size 4K \
102
- --image-model gpt-image-2
170
+ --image-model iegg-litellm/gpt-image-2.5-sunburst
103
171
  ```
104
172
 
105
173
  ### 图生图(image-to-image / reference-image)
@@ -107,17 +175,19 @@ playcraft tools generate-image \
107
175
  ```bash
108
176
  playcraft tools generate-image \
109
177
  --prompt "A similar style silver shield icon, same art direction" \
178
+ --background transparent \
110
179
  --output assets/images/shield.png \
111
180
  --reference-image assets/images/sword.png \
112
181
  --aspect-ratio 1:1 \
113
182
  --image-size 4K \
114
- --image-model gpt-image-2
183
+ --image-model iegg-litellm/gpt-image-2.5-sunburst
115
184
  ```
116
185
 
117
186
  ### 参数说明
118
187
 
119
188
  | 参数 | 值 | 说明 |
120
189
  | ---------------------- | ----------------------------------------- | ------------------------------------------------------- |
190
+ | `--background` | `transparent` / `opaque` | Agent 调用必填,由完整对话上下文决定;字段约束优先 |
121
191
  | `--aspect-ratio` | `1:1` / **`45:16`** / `16:9` / `9:16` / … | **Master Composite(5×9:16 横排)用 `45:16`** |
122
192
  | `--width` / `--height` | 像素整数(成对) | MC 推荐 **`3600×1280`** 或 **`4096×1455`** |
123
193
  | `--image-size` | `1K` / `2K` / `4K` | 控制分辨率级别。实际像素取决于模型+比例的组合(见下表) |
@@ -183,39 +253,38 @@ playcraft image sprite-sheet \
183
253
 
184
254
  ## 3. 背景处理决策树
185
255
 
186
- > **核心原则**:先确定素材类型,再决定是否需要去背景,再按素材主色调选择色幕颜色,最后做去背景 + 深色背景验证。
256
+ > **核心原则**:先读取字段明确约束,再结合完整对话判断用户是否明确要求背景;没有明确要求时默认透明,不能按素材类别推断为不透明。常规工具按第 2 节的模型规则准备源图并由后端验收,独立色幕流程才选择色幕颜色,交付后做深浅背景验证。
187
257
 
188
258
  ```
189
- 生成的素材需要做什么?
259
+ 最终素材的背景要求是什么?
190
260
  │
191
- ├─ 需要透明背景的独立元素(角色、道具、图标、文字图片、HUD、VFX)?
192
- │ ├─ 检查模型 ALPHA 列(playcraft tools list-image-models)
193
- │ ├─ ALPHA = yes → prompt 加 "transparent background, PNG with alpha"
194
- │ └─ ALPHA = no → 色幕策略(按素材主色调选择):
195
- │ ├─ 素材为金色/黄色/橙色/绿色 → 蓝幕 #0000FF
196
- │ │ ├─ prompt 末尾加 "on solid bright blue #0000FF background, isolated, centered"
197
- │ │ └─ 后处理:remove-background(tolerance 25)→ 深色背景验证
198
- │ ├─ 素材为蓝色/紫色/靛蓝 → 绿幕 #00FF00
199
- │ │ ├─ prompt 末尾加 "on solid bright green #00FF00 background, isolated, centered"
200
- │ │ └─ 后处理:remove-background(tolerance 25)→ 深色背景验证
201
- │ └─ 其他颜色 → 绿幕 #00FF00(默认)
202
- │ ├─ prompt 末尾加 "on solid bright green #00FF00 background, isolated, centered"
203
- │ └─ 后处理:remove-background(tolerance 25)→ 深色背景验证
261
+ ├─ 字段有明确背景约束?
262
+ │ └─ 严格遵守字段要求:remove_background=true → transparent;false → opaque
204
263
  │
205
- ├─ 卡牌/棋盘格子/UI 面板(本身就是矩形有边框)?
206
- │ ├─ 不要去背景!白色牌面就是牌的一部分
207
- │ ├─ prompt 加 "flat 2D, no drop shadow, no 3D effect, clean edges"
208
- │ └─ 后处理:直接 resize(skipRemoveBg = true)
264
+ ├─ 字段无明确约束,且用户明确要求保留背景/完整场景?
265
+ │ ├─ background=opaque / --background opaque,交付整张不透明图片
266
+ │ └─ 满幅场景 prompt 加 "full bleed, edge to edge, no vignette, no fade"
209
267
  │
210
- └─ 场景背景(天空、地面、全屏图)?
211
- ├─ 不做背景处理,直接 resize
212
- └─ ⚠️ prompt 必须加 "full bleed, edge to edge, no vignette, no fade"
213
- → 后处理验证:四角四边颜色一致,无褪色/白色
268
+ └─ 字段无明确约束,且用户未明确要求背景?
269
+ └─ background=transparent / --background transparent(包括卡牌、棋子和面板)
270
+ ├─ 白色牌面、边框与文字属于前景,必须保留,只移除本体外的画布背景
271
+ ├─ 常规工具 → 按模型准备源图背景(第 2 节)→ 原生透明或去背 → 最终透明验收
272
+ └─ 已明确选择独立色幕制作流程?
273
+ └─ 中间图 background=opaque → 单一色幕 → 切分后独立去背 → 深浅背景验证
214
274
  ```
215
275
 
216
276
  ### 为什么需要色幕策略?
217
277
 
218
- **当前所有已接入模型均不支持原生透明 PNG(ALPHA = no)**。白色背景 + 白色物体 = floodfill 无法区分边界。纯色背景 + 非撞色游戏素材 = 抠图几乎完美。与影视 chroma-key 原理相同。
278
+ 只有用户或已锁定的制作流程明确选择独立色幕制作,且所选模型不支持原生透明时才采用该流程;仅指定其他模型并不等于选择色幕。下方色幕矩阵和后缀表仅用于该流程与 ASR (Asset State Reference, 资产状态参考板),不能用作 Image 2.5 失败后的自动回退。原生透明图验证通过后直接处理尺寸,不再重复去背;发光、半透明边缘和白色前景应保留。白色背景与白色物体会让 floodfill 混淆边界。`playcraft image remove-background` 默认使用本地 floodfill,不应描述为必然调用后端去背模型。
279
+
280
+ 色幕**中间图**使用 `background: opaque` / `--background opaque`,让生成工具保留指定色幕,再独立去背;这不改变最终素材的透明交付要求。替换现有透明字段时,先用 `image-context` 读取参考图和交付规格,生成中间图时省略 `targetAssetPath` / `--target-asset`,显式传入已读取的参考图、尺寸与格式。字段的 `remove_background=true` 优先于调用开关,绑定该字段会提前触发自动去背;`--no-target-reference` 也不会解除字段约束。色幕去背及最终验收通过后再应用到目标字段。
281
+
282
+ ### 最终文件验证
283
+
284
+ - 按字段 resolution 处理尺寸,透明前景用 `--fit contain`,确认执行的工具使用透明补边;旧版工具可能补入不透明黑色。验证不通过时更新工具或显式使用透明背景缩放。
285
+ - 按实际资源扩展名编码,不把 PNG 内容写进其他格式的文件,也不擅自改变主题引用。
286
+ - 去背、缩放、转格式后都检查透明通道与边缘,并分别在深色和浅色背景上预览。允许素材自身的黑色描边,拒绝额外黑色矩形补边或误删的发光效果。
287
+ - 达到项目的文件大小限制后再覆盖目标文件。同一 Logo 的多个尺寸从同一张母图导出,避免重复生成导致风格漂移。
219
288
 
220
289
  ### 色幕选型矩阵(Color Conflict Avoidance)
221
290
 
@@ -231,15 +300,17 @@ playcraft image sprite-sheet \
231
300
 
232
301
  ### Prompt 后缀速查表
233
302
 
234
- | 素材类型 | prompt 建议后缀 | 后处理 | skipRemoveBg |
235
- | -------------------------- | ------------------------------------------------------------------- | ------------------------------------------- | ------------ |
236
- | 独立元素(需透明,非金色) | `"on solid bright green #00FF00 background, isolated, centered"` | remove-background (tolerance 25) → 深色验证 | `false` |
237
- | 独立元素(金/黄/橙/绿色) | `"on solid bright blue #0000FF background, isolated, centered"` | remove-background (tolerance 25) → 深色验证 | `false` |
238
- | 独立元素(多色/彩虹) | `"on solid bright magenta #FF00FF background, isolated, centered"` | remove-background (tolerance 20) → 深色验证 | `false` |
239
- | VFX 特效(发光/粒子) | `"on solid bright blue #0000FF background, isolated, centered"` | remove-background (tolerance 25) → 逐帧验证 | `false` |
240
- | 卡牌/棋子(矩形本体) | `"flat 2D, no shadow, no 3D effect, clean edges, white background"` | 只做 resize | `true` |
241
- | UI 按钮/面板 | `"flat UI element, no shadow, clean edges"` | trim + resize | `true` |
242
- | 场景背景 | `"full scene, full bleed, edge to edge, no vignette, no fade"` | resize → 四角全覆盖检查 | `true` |
303
+ 下表的色幕后缀只用于已明确选择的独立色幕流程。卡牌、面板等最终交付仍按上方决策树选择;`skipRemoveBg` 只表示是否跳过独立去背步骤,不能据此把最终交付改为不透明。
304
+
305
+ | 素材类型 | prompt 建议后缀 | 后处理 | skipRemoveBg |
306
+ | --------------------------- | ------------------------------------------------------------------ | ------------------------------------------- | ----------------------- |
307
+ | 独立元素(需透明,非金色) | `"on solid bright green #00FF00 background, isolated, centered"` | remove-background (tolerance 25) → 深色验证 | `false` |
308
+ | 独立元素(金/黄/橙/绿色) | `"on solid bright blue #0000FF background, isolated, centered"` | remove-background (tolerance 25) → 深色验证 | `false` |
309
+ | 独立元素(多色/彩虹) | `"on solid bright magenta #FF00FF background, isolated, centered"` | remove-background (tolerance 20) → 深色验证 | `false` |
310
+ | VFX 特效(发光/粒子) | `"on solid bright blue #0000FF background, isolated, centered"` | remove-background (tolerance 25) → 逐帧验证 | `false` |
311
+ | 卡牌/棋子(矩形本体) | `"flat 2D, white card face, no shadow, clean edges"` | 默认透明画布,保留牌面;透明已验收后 resize | 仅透明已验收后为 `true` |
312
+ | UI 按钮/面板 | `"flat UI element, no shadow, clean edges"` | 默认透明画布;透明已验收后 trim + resize | 仅透明已验收后为 `true` |
313
+ | 用户/字段明确要求的场景背景 | `"full scene, full bleed, edge to edge, no vignette, no fade"` | 不透明交付 → resize → 四角全覆盖检查 | `true` |
243
314
 
244
315
  ### 去背景后必做:深色背景渲证
245
316
 
@@ -271,6 +342,7 @@ playcraft image overlay \
271
342
  **Artist ASR prompt 要点**:
272
343
 
273
344
  1. Sheet canvas:`solid flat #808080` 或整板统一绿幕(非渐变)
345
+ 生成整板时传 `--background opaque`,保留格子布局和色幕供后续裁切。
274
346
  2. 每格:`ONE isolated element, centered, NO white box, NO scene, NO ground shadow`
275
347
  3. 金/橙/黄/绿元素格 → cell 背景 `#0000FF`;蓝/紫 → `#00FF00`
276
348
  4. 生成后**目视**格内可抠性 — 不要求 `channels=4`(那是 TA 后处理产物)
@@ -280,7 +352,7 @@ playcraft image overlay \
280
352
  ## 4. 脚本决策
281
353
 
282
354
  - **<=5 个文件** → 直接使用 CLI 命令
283
- - **>5 个文件** → 编写 Node.js 脚本放入 `ta-workspace/scripts/`。脚本模板见 `reference/` 目录。
355
+ - **>5 个文件** → 编写 Node.js 脚本放入 `ta-workspace/scripts/`。脚本模板见 `reference/` 目录;使用本次选定的模型与参考图,不直接沿用脚本中旧的默认模型。
284
356
 
285
357
  ---
286
358
 
@@ -288,11 +360,11 @@ playcraft image overlay \
288
360
 
289
361
  需要以下进阶内容时,查阅 [`refs/ta-image-generation-detail.md`](../../agents/refs/ta-image-generation-detail.md):
290
362
 
291
- | 主题 | 说明 |
292
- | --------------------- | ------------------------------------------------------------------- |
293
- | 精灵图直出策略 | gpt-image-2 网格图生成 + sprite-split 切分,白底/绿幕示例,分批策略 |
294
- | Edit 模型工作流 | 基图 → edit 变体(换花色/换数字/换颜色),prompt 写法 |
295
- | 错误恢复表 | 各类错误现象、原因、立即行动;模型回退顺序 |
296
- | Provider 回退链 | gpt-image-2 三 provider 互为回退 + 非 gpt-image-2 稳定回退 |
297
- | 批量生成最佳实践 | 单张验证、Node.js 脚本推荐、脚本模板使用 |
298
- | ta-workspace 脚本驱动 | 为什么用 Node.js、目录约定、脚本模板一览表 |
363
+ | 主题 | 说明 |
364
+ | --------------------- | ---------------------------------------------------------------- |
365
+ | 精灵图直出策略 | 按选定模型生成网格图 + sprite-split 切分;自动透明与独立色幕示例 |
366
+ | Edit 模型工作流 | 基图 → edit 变体(换花色/换数字/换颜色),prompt 写法 |
367
+ | 错误恢复表 | 各类错误现象、原因、立即行动;模型回退顺序 |
368
+ | Provider 回退链 | gpt-image-2 三 provider 互为回退 + 非 gpt-image-2 稳定回退 |
369
+ | 批量生成最佳实践 | 单张验证、Node.js 脚本推荐、脚本模板使用 |
370
+ | ta-workspace 脚本驱动 | 为什么用 Node.js、目录约定、脚本模板一览表 |
@@ -1,7 +1,7 @@
1
1
  // ============================================================
2
- // gen-batch-sprite.template.mjs — gpt-image-2 精灵图直出脚本模板
2
+ // gen-batch-sprite.template.mjs — 精灵图直出脚本模板
3
3
  //
4
- // 核心原则:让 gpt-image-2 一次 API 调用直接生成包含多个元素的
4
+ // 核心原则:一次 API (Application Programming Interface, 应用程序编程接口) 调用生成包含多个元素的
5
5
  // 网格精灵图,然后用 sprite-split 切分。比逐个生成效率高 N 倍。
6
6
  //
7
7
  // 适用场景:
@@ -34,11 +34,11 @@ function playcraft(args, { capture = false, timeout } = {}) {
34
34
  // ============ CONFIG — 修改这里 ============
35
35
  const CONFIG = {
36
36
  /**
37
- * 精灵图直出模型:永远用 gpt-image-2(图像理解 + 布局能力最强)
38
- * mulerouter 质量更高(建议作为主模型),iegg 更快(备用)
39
- * 注意:精灵图生成比单图慢,通常需要 90-150s,timeout 设 240 以上
37
+ * 使用 list-image-models 核实本次模型;默认示例为 Image 2.5。
38
+ * 用户或制作流程锁定其他模型时填写实际 provider/model。
39
+ * 请求使用命令行默认等待时间,不在脚本中提前杀死仍在运行的请求。
40
40
  */
41
- model: 'mulerouter/gpt-image-2',
41
+ model: 'iegg-litellm/gpt-image-2.5-sunburst',
42
42
 
43
43
  /**
44
44
  * 每批精灵图的列数
@@ -64,21 +64,20 @@ const CONFIG = {
64
64
  /**
65
65
  * 通用风格描述(追加到每个批次 prompt 末尾)
66
66
  *
67
- * 元素需要透明背景(独立元素:角色/车/道具/图标)→ 绿幕策略:
68
- * style: 'flat 2D illustration, isolated on solid bright green #00FF00 background, centered, no shadow'
69
- * removeBg: true (切分后逐帧去背景)
70
- *
71
- * 元素本身就是矩形(卡牌/棋子/UI 面板)→ 白底策略:
72
- * style: 'flat 2D, white background, no shadow, no drop shadow, clean edges'
73
- * removeBg: false
67
+ * 只填写主体风格与构图,源图背景由下方流程选择。
68
+ * 卡牌白色牌面属于主体,应在 items.desc 中描述并设 removeBg=false。
74
69
  */
75
- style: 'flat 2D illustration, isolated on solid bright green #00FF00 background, centered, no shadow',
70
+ style: 'flat 2D illustration, isolated subjects, centered, no shadow',
76
71
  /**
77
- * 切分后是否对每帧执行 remove-background(绿幕去背景)
78
- * true → 独立元素(需透明通道):remove-background --tolerance 25
79
- * false → 卡牌/UI 面板等矩形元素:直接 resize,不去背景
72
+ * 最终是否需要透明:true 为独立元素,false 为不透明牌面/场景。
73
+ * automatic:整板由工具交付透明,切分后保留,不重复去背。
74
+ * chroma:保留色幕中间图,切分后逐格去背;仅限主文第 3 节明确选择的流程。
80
75
  */
81
76
  removeBg: true,
77
+ backgroundMode: 'automatic',
78
+ /** 独立色幕才使用;按主体颜色选择,金/黄/橙/绿用蓝幕,蓝/紫用绿幕。 */
79
+ chromaColor: '#00FF00',
80
+ chromaTolerance: 25,
82
81
 
83
82
  /**
84
83
  * 切分单元尺寸(像素)。留空(null)= 自动按精灵图实际像素尺寸 ÷ 网格推导(推荐)。
@@ -119,7 +118,7 @@ const BATCHES = [
119
118
  // ============ 精灵图 Prompt 构建器 ============
120
119
  /**
121
120
  * 根据 items 列表构建精灵图网格 prompt
122
- * 关键词组合让 gpt-image-2 理解"网格布局"意图
121
+ * 描述网格布局,避免重绘边框或格子标签。
123
122
  */
124
123
  /**
125
124
  * 读取精灵图实际像素尺寸(用于自动推导切分单元尺寸)。
@@ -138,7 +137,7 @@ function readSheetDims(sheetPath) {
138
137
  return null;
139
138
  }
140
139
 
141
- function buildSpriteSheetPrompt(items, columns, style, removeBg) {
140
+ function buildSpriteSheetPrompt(items, columns, config) {
142
141
  const actualRows = Math.ceil(items.length / columns);
143
142
  const cellDescs = items.map((item, i) => {
144
143
  const col = (i % columns) + 1;
@@ -146,10 +145,13 @@ function buildSpriteSheetPrompt(items, columns, style, removeBg) {
146
145
  return `[Row${row},Col${col}]: ${item.desc}`;
147
146
  }).join('; ');
148
147
 
149
- // 绿幕模式强制在 prompt 里明确背景色,避免模型用白底
150
- const bgInstruction = removeBg
151
- ? 'Each element isolated on solid bright green #00FF00 background, no shadow, no gradient background.'
152
- : 'Each element on clean white background.';
148
+ // Image 2.5 由后端组装背景;其他模型首次请求需明确单一干净底色。
149
+ const modelId = config.model.trim().split('/').at(-1);
150
+ const nativeBackground = /^gpt-image-2\.5(?:$|-)/.test(modelId);
151
+ const bgInstruction = !config.removeBg ? '' : config.backgroundMode === 'chroma'
152
+ ? `Each element isolated on a uniform solid ${config.chromaColor} background, no shadow, no gradient background.`
153
+ : nativeBackground ? ''
154
+ : 'Render all foreground elements on a uniform solid pure white background for subsequent background removal. Preserve all elements, text, white details, colors and style.';
153
155
 
154
156
  return [
155
157
  `Sprite sheet grid layout, ${columns} columns × ${actualRows} rows.`,
@@ -157,13 +159,19 @@ function buildSpriteSheetPrompt(items, columns, style, removeBg) {
157
159
  bgInstruction,
158
160
  `Grid layout, uniform cell size, equal spacing, elements perfectly centered in each cell.`,
159
161
  `No borders between cells, no labels, no numbers on cells.`,
160
- style,
161
- ].join(' ');
162
+ config.style,
163
+ ].filter(Boolean).join(' ');
162
164
  }
163
165
 
164
166
  // ============ LOGIC — 通常不需要修改 ============
165
167
 
166
168
  const LOG_FILE = 'ta-workspace/logs/gen-batch-sprite.log';
169
+ if (!['automatic', 'chroma'].includes(CONFIG.backgroundMode)) {
170
+ throw new Error('backgroundMode must be automatic or chroma.');
171
+ }
172
+ if (CONFIG.backgroundMode === 'chroma' && !/^#[\da-f]{6}$/i.test(CONFIG.chromaColor)) {
173
+ throw new Error('chromaColor must be one six-digit hex color.');
174
+ }
167
175
  mkdirSync(CONFIG.sheetDir, { recursive: true });
168
176
  mkdirSync(CONFIG.outputDir, { recursive: true });
169
177
  mkdirSync('ta-workspace/logs', { recursive: true });
@@ -190,7 +198,7 @@ for (let bi = 0; bi < BATCHES.length; bi++) {
190
198
  log(`[SKIP-SHEET] (${bi + 1}/${BATCHES.length}) ${batch.sheetName} already exists`);
191
199
  } else {
192
200
  log(`[GEN-SHEET ] (${bi + 1}/${BATCHES.length}) Generating ${batch.sheetName} (${batch.items.length} elements)`);
193
- const prompt = buildSpriteSheetPrompt(batch.items, CONFIG.columns, CONFIG.style, CONFIG.removeBg);
201
+ const prompt = buildSpriteSheetPrompt(batch.items, CONFIG.columns, CONFIG);
194
202
 
195
203
  try {
196
204
  playcraft(
@@ -200,9 +208,9 @@ for (let bi = 0; bi < BATCHES.length; bi++) {
200
208
  '--output', sheetPath,
201
209
  '--aspect-ratio', CONFIG.aspectRatio,
202
210
  '--image-model', CONFIG.model,
203
- '--timeout', '240',
211
+ CONFIG.removeBg && CONFIG.backgroundMode === 'automatic'
212
+ ? '--remove-background' : '--no-remove-background',
204
213
  ],
205
- { timeout: 300_000 },
206
214
  );
207
215
  log(`[OK-SHEET ] ${batch.sheetName}`);
208
216
  } catch (e) {
@@ -269,10 +277,11 @@ for (let bi = 0; bi < BATCHES.length; bi++) {
269
277
  continue;
270
278
  }
271
279
 
272
- // ── Step 3: 重命名(+可选绿幕去背景)切分结果到最终位置 ─────────
280
+ // ── Step 3: 保留自动透明结果;独立色幕才逐格去背 ────────────────
273
281
  // 任何缺帧 / 处理失败都视为该批次失败(FAIL,不是 WARN):一个不完整的
274
282
  // 批次绝不能被报成 OK-BATCH,否则下游会拿到缺图的资产集。
275
- log(`[RENAME ] Renaming ${batch.items.length} cells${CONFIG.removeBg ? ' + remove-background' : ''}`);
283
+ const removeCellBackground = CONFIG.removeBg && CONFIG.backgroundMode === 'chroma';
284
+ log(`[RENAME ] Renaming ${batch.items.length} cells${removeCellBackground ? ' + remove-background' : ''}`);
276
285
  let processedOk = 0;
277
286
  let batchFailed = false;
278
287
  for (let j = 0; j < batch.items.length; j++) {
@@ -289,13 +298,13 @@ for (let bi = 0; bi < BATCHES.length; bi++) {
289
298
  continue;
290
299
  }
291
300
  try {
292
- if (CONFIG.removeBg) {
293
- // 绿幕去背景(tolerance 25 适合纯绿色 #00FF00 背景)
301
+ if (removeCellBackground) {
302
+ // 只处理独立色幕,保留常规工具已经交付的透明边缘。
294
303
  playcraft([
295
304
  'image', 'remove-background',
296
305
  '--input', srcPath,
297
306
  '--output', dstPath,
298
- '--tolerance', '25',
307
+ '--tolerance', String(CONFIG.chromaTolerance),
299
308
  ]);
300
309
  } else {
301
310
  copyFileSync(srcPath, dstPath);
@@ -1,5 +1,5 @@
1
1
  // ============================================================
2
- // gen-batch.template.mjs — 批量 AI 生图脚本模板
2
+ // gen-batch.template.mjs — 批量 AI (Artificial Intelligence, 人工智能) 生图脚本模板
3
3
  // 用途:从零批量生成一组风格一致的素材(reference-image 模式)
4
4
  //
5
5
  // 使用方式:
@@ -8,22 +8,18 @@
8
8
  // 3. node ta-workspace/scripts/gen-<name>.mjs
9
9
  // ============================================================
10
10
 
11
- import { execSync } from 'child_process';
11
+ import { execFileSync } from 'child_process';
12
12
  import { existsSync, mkdirSync, appendFileSync } from 'fs';
13
13
 
14
14
  // ============ CONFIG — 修改这里 ============
15
15
  const CONFIG = {
16
16
  /**
17
17
  * 生图模型。
18
- * - Phase 1 概念图(追求质量):用 gpt-image-2
19
- * model: 'iegg-litellm/gpt-image-2'
20
- * - Phase 2 批量(reference-image 一致性):用 google/,更稳定
21
- * model: 'google/gemini-3.1-flash-image-preview'
22
- *
23
- * 后端按优先级自动 fallback 多个 provider,无需手动指定 provider。
24
- * text+image CAPABILITY 的模型才支持 --reference-image
18
+ * 先 list-image-models,再填写本次实际模型;普通素材优先 Image 2.5。
19
+ * 用户或制作流程锁定其他模型时保留其选择。
20
+ * 参考图要求模型支持 text+image 或 image→image。
25
21
  */
26
- model: 'google/gemini-3.1-flash-image-preview',
22
+ model: 'iegg-litellm/gpt-image-2.5-sunburst',
27
23
  /** 概念图路径(确认过风格的样本,所有后续图的参考来源) */
28
24
  referenceImage: 'assets/images/concept/approved_sample.png',
29
25
  /** 输出目录 */
@@ -32,9 +28,11 @@ const CONFIG = {
32
28
  aspectRatio: '1:1',
33
29
  /**
34
30
  * 统一风格描述(从 design-brief.md 复制,粘贴到每个 prompt 末尾)
35
- * 示例:"flat 2D icon, vibrant colors, clean edges, white background, no shadow"
31
+ * 示例:"flat 2D icon, vibrant colors, clean edges, no shadow"
36
32
  */
37
33
  style: '<从 design-brief 复制的统一风格描述>',
34
+ /** 最终透明设 true;完整场景或不透明牌面设 false。独立色幕使用精灵图模板。 */
35
+ removeBackground: true,
38
36
  };
39
37
  // ============ DATA — 定义要生成的素材列表 ============
40
38
  const ITEMS = [
@@ -72,17 +70,17 @@ for (let i = 0; i < ITEMS.length; i++) {
72
70
 
73
71
  log(`[GEN ] (${i + 1}/${ITEMS.length}) ${item.name}`);
74
72
 
75
- const promptEscaped = `${item.desc}. ${CONFIG.style}`.replace(/"/g, '\\"');
76
- const cmd =
77
- `playcraft tools generate-image` +
78
- ` --prompt "${promptEscaped}"` +
79
- ` --output "${outPath}"` +
80
- ` --aspect-ratio ${CONFIG.aspectRatio}` +
81
- ` --reference-image "${CONFIG.referenceImage}"` +
82
- ` --image-model "${CONFIG.model}"`;
73
+ const nativeBackground = /^gpt-image-2\.5(?:$|-)/.test(CONFIG.model.trim().split('/').at(-1));
74
+ const sourceBackground = CONFIG.removeBackground && !nativeBackground
75
+ ? 'on a uniform solid pure white background for subsequent background removal' : '';
76
+ const prompt = [item.desc, CONFIG.style, sourceBackground].filter(Boolean).join('. ');
77
+ const args = ['tools', 'generate-image', '--prompt', prompt, '--output', outPath,
78
+ '--aspect-ratio', CONFIG.aspectRatio, '--image-model', CONFIG.model,
79
+ CONFIG.removeBackground ? '--remove-background' : '--no-remove-background'];
80
+ if (CONFIG.referenceImage) args.push('--reference-image', CONFIG.referenceImage);
83
81
 
84
82
  try {
85
- execSync(cmd, { stdio: 'inherit', timeout: 120_000 });
83
+ execFileSync('playcraft', args, { stdio: 'inherit' });
86
84
  done++;
87
85
  log(`[OK ] ${item.name}`);
88
86
  } catch (e) {
@@ -8,10 +8,9 @@
8
8
  // 3. node ta-workspace/scripts/process-<name>.mjs
9
9
  //
10
10
  // 背景处理决策(修改 CONFIG.skipRemoveBg 前请阅读):
11
- // - 独立元素(角色/道具/图标)需透明背景 → skipRemoveBg = false(默认)
12
- // 建议生图时 prompt 加 "on solid bright green #00FF00 background, isolated"
13
- // - 卡牌/棋子/UI面板(矩形本体不需透明)→ skipRemoveBg = true
14
- // 生图时 prompt 加 "flat 2D, no shadow, no 3D effect, clean edges"
11
+ // - 常规工具已验证透明 / 不透明牌面或场景 → skipRemoveBg = true(默认)
12
+ // - 明确选择的独立色幕中间图 → skipRemoveBg = false,按主文第 3 节选择色幕
13
+ // 生成中间图时用 --no-remove-background,最终去背后验证透明边缘
15
14
  // ============================================================
16
15
 
17
16
  import { execSync } from 'child_process';
@@ -32,10 +31,10 @@ const CONFIG = {
32
31
  targetH: 128,
33
32
  /**
34
33
  * 跳过去背景步骤
35
- * - false(默认):执行 remove-background(绿幕素材/独立元素)
36
- * - true:跳过,只做 trim + resize(卡牌/棋子等矩形本体素材)
34
+ * - true(默认):保留已验证透明的结果或不透明牌面/场景,不重复去背
35
+ * - false:仅对独立色幕中间图执行 remove-background
37
36
  */
38
- skipRemoveBg: false,
37
+ skipRemoveBg: true,
39
38
  /**
40
39
  * floodfill 容差(0–255)
41
40
  * 绿幕背景建议 25;默认白背景可用 15