@playcraft/cli 0.1.33 → 0.1.35-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 (346) hide show
  1. package/README.md +3 -56
  2. package/dist/agent/local-backend.js +1 -1
  3. package/dist/cli-root-help.js +0 -2
  4. package/dist/commands/build.js +4 -9
  5. package/dist/commands/create.js +33 -26
  6. package/dist/commands/image.js +6 -2
  7. package/dist/commands/login.js +42 -84
  8. package/dist/commands/skills.js +0 -2
  9. package/dist/commands/tools-3d.js +0 -11
  10. package/dist/commands/tools-generation.js +109 -68
  11. package/dist/commands/tools-image-context.js +23 -0
  12. package/dist/commands/tools.js +2 -2
  13. package/dist/config.js +4 -59
  14. package/dist/index.js +3 -36
  15. package/dist/remix/clone.js +0 -2
  16. package/dist/remix/init-template.js +0 -2
  17. package/dist/remix/pull.js +0 -2
  18. package/dist/remix/push.js +1 -21
  19. package/dist/utils/agent-api-client.js +30 -185
  20. package/dist/utils/image-asset-context.js +105 -0
  21. package/dist/utils/playcraft-http-client.js +4 -6
  22. package/package.json +5 -14
  23. package/project-template/.claude/agents/refs/ta-image-generation-detail.md +67 -123
  24. package/project-template/.claude/skills/playcraft-image-generation/SKILL.md +105 -44
  25. package/project-template/.claude/skills/playcraft-image-generation/reference/gen-batch-sprite.template.mjs +42 -33
  26. package/project-template/.claude/skills/playcraft-image-generation/reference/gen-batch.template.mjs +18 -20
  27. package/project-template/.claude/skills/playcraft-image-generation/reference/process-batch.template.mjs +6 -7
  28. package/project-template/.claude/skills/playcraft-image-generation/reference/prompt-cookbook.md +36 -39
  29. package/project-templates/phaser/.claude/agents/refs/ta-image-generation-detail.md +59 -59
  30. package/project-templates/phaser/.claude/skills/playcraft-image-generation/SKILL.md +105 -44
  31. package/project-templates/phaser/.claude/skills/playcraft-image-generation/reference/gen-batch-sprite.template.mjs +42 -33
  32. package/project-templates/phaser/.claude/skills/playcraft-image-generation/reference/gen-batch.template.mjs +18 -20
  33. package/project-templates/phaser/.claude/skills/playcraft-image-generation/reference/process-batch.template.mjs +6 -7
  34. package/project-templates/phaser/.claude/skills/playcraft-image-generation/reference/prompt-cookbook.md +36 -39
  35. package/project-templates/threejs/.claude/agents/refs/ta-image-generation-detail.md +59 -59
  36. package/project-templates/threejs/.claude/skills/playcraft-image-generation/SKILL.md +105 -44
  37. package/project-templates/threejs/.claude/skills/playcraft-image-generation/reference/gen-batch-sprite.template.mjs +42 -33
  38. package/project-templates/threejs/.claude/skills/playcraft-image-generation/reference/gen-batch.template.mjs +18 -20
  39. package/project-templates/threejs/.claude/skills/playcraft-image-generation/reference/process-batch.template.mjs +6 -7
  40. package/project-templates/threejs/.claude/skills/playcraft-image-generation/reference/prompt-cookbook.md +36 -39
  41. package/dist/auth/account-activation.js +0 -157
  42. package/dist/auth/messages.js +0 -30
  43. package/dist/commands/platform-skills.generated.js +0 -19
  44. package/dist/commands/playable.js +0 -53
  45. package/dist/commands/tools-batch.js +0 -87
  46. package/dist/commands/video.js +0 -111
  47. package/dist/commands/workspace-runtime.js +0 -54
  48. package/dist/commands/workspace.js +0 -35
  49. package/dist/project-skills/builtin-import.js +0 -225
  50. package/dist/project-skills/commands.js +0 -77
  51. package/dist/project-skills/lifecycle.js +0 -28
  52. package/dist/project-skills/local-run.js +0 -112
  53. package/dist/project-skills/local-store.js +0 -221
  54. package/dist/project-skills/messages.js +0 -80
  55. package/dist/project-skills/reconcile.js +0 -62
  56. package/dist/project-skills/remote-cache.js +0 -51
  57. package/dist/project-skills/validation.js +0 -19
  58. package/dist/recording/messages.js +0 -40
  59. package/dist/recording/project-digest.js +0 -85
  60. package/dist/recording/recorder.js +0 -293
  61. package/dist/recording/scenario.js +0 -50
  62. package/dist/utils/environment-endpoints.js +0 -17
  63. package/dist/utils/tool-operation-journal.js +0 -124
  64. package/dist/utils/video-evidence-git.js +0 -81
  65. package/dist/video-replication/client.js +0 -222
  66. package/dist/video-replication/comparison-evidence.js +0 -149
  67. package/dist/video-replication/comparison-files.js +0 -57
  68. package/dist/video-replication/comparison-log.js +0 -72
  69. package/dist/video-replication/comparison-messages.js +0 -104
  70. package/dist/video-replication/comparison-output.js +0 -63
  71. package/dist/video-replication/comparison-preflight.js +0 -66
  72. package/dist/video-replication/comparison.js +0 -216
  73. package/dist/video-replication/evidence.js +0 -165
  74. package/dist/video-replication/media.js +0 -111
  75. package/dist/video-replication/messages.js +0 -89
  76. package/dist/workspace/messages.js +0 -35
  77. package/dist/workspace/transfer-client.js +0 -174
  78. package/dist/workspace-runtime/codex/app-server.js +0 -965
  79. package/dist/workspace-runtime/codex/compact.js +0 -46
  80. package/dist/workspace-runtime/codex/config-toml.js +0 -107
  81. package/dist/workspace-runtime/codex/jsonrpc-stdio.js +0 -145
  82. package/dist/workspace-runtime/codex/launcher-client.js +0 -177
  83. package/dist/workspace-runtime/codex/loopback.js +0 -146
  84. package/dist/workspace-runtime/codex/mcp-config.js +0 -39
  85. package/dist/workspace-runtime/codex/model-broker.js +0 -263
  86. package/dist/workspace-runtime/codex/native-adapter.js +0 -9
  87. package/dist/workspace-runtime/codex/permissions.js +0 -70
  88. package/dist/workspace-runtime/codex/work-mode.js +0 -15
  89. package/dist/workspace-runtime/main.js +0 -10
  90. package/dist/workspace-runtime/persistence/journal.js +0 -355
  91. package/dist/workspace-runtime/persistence/native-subagents.js +0 -162
  92. package/dist/workspace-runtime/persistence/sqlite-client.js +0 -77
  93. package/dist/workspace-runtime/persistence/sqlite-worker.js +0 -1096
  94. package/dist/workspace-runtime/previews/output.js +0 -36
  95. package/dist/workspace-runtime/previews/publish.js +0 -262
  96. package/dist/workspace-runtime/previews/single-file.js +0 -43
  97. package/dist/workspace-runtime/processes/managed-writes.js +0 -69
  98. package/dist/workspace-runtime/production/contracts.js +0 -17
  99. package/dist/workspace-runtime/production/controller.js +0 -207
  100. package/dist/workspace-runtime/production/dependencies.js +0 -60
  101. package/dist/workspace-runtime/production/native.js +0 -203
  102. package/dist/workspace-runtime/production/processes.js +0 -86
  103. package/dist/workspace-runtime/production/save-command.js +0 -35
  104. package/dist/workspace-runtime/production/source-copy.js +0 -91
  105. package/dist/workspace-runtime/production/stages.js +0 -205
  106. package/dist/workspace-runtime/production/storage.js +0 -60
  107. package/dist/workspace-runtime/serve.js +0 -207
  108. package/dist/workspace-runtime/server/auth.js +0 -21
  109. package/dist/workspace-runtime/server/connectivity.js +0 -201
  110. package/dist/workspace-runtime/server/desktop-host.js +0 -429
  111. package/dist/workspace-runtime/server/desktop-preview-config.js +0 -81
  112. package/dist/workspace-runtime/server/desktop-preview-service.js +0 -157
  113. package/dist/workspace-runtime/server/desktop-preview-static.js +0 -53
  114. package/dist/workspace-runtime/server/desktop-preview.js +0 -189
  115. package/dist/workspace-runtime/server/dispatch.js +0 -1174
  116. package/dist/workspace-runtime/server/endpoints.js +0 -19
  117. package/dist/workspace-runtime/server/execution-group.js +0 -85
  118. package/dist/workspace-runtime/server/http.js +0 -1127
  119. package/dist/workspace-runtime/server/lock.js +0 -53
  120. package/dist/workspace-runtime/server/rfb-watch-gate.js +0 -168
  121. package/dist/workspace-runtime/server/terminal-host.js +0 -366
  122. package/dist/workspace-runtime/server/types.js +0 -1
  123. package/dist/workspace-runtime/server/workspace-transfer.js +0 -99
  124. package/dist/workspace-runtime/workspaces/archive.js +0 -207
  125. package/dist/workspace-runtime/workspaces/artifact-events.js +0 -55
  126. package/dist/workspace-runtime/workspaces/artifact-files.js +0 -197
  127. package/dist/workspace-runtime/workspaces/artifact-receipts.js +0 -89
  128. package/dist/workspace-runtime/workspaces/artifacts.js +0 -282
  129. package/dist/workspace-runtime/workspaces/attachment-content.js +0 -123
  130. package/dist/workspace-runtime/workspaces/attachments.js +0 -181
  131. package/dist/workspace-runtime/workspaces/batch-commit.js +0 -142
  132. package/dist/workspace-runtime/workspaces/cli-context.js +0 -23
  133. package/dist/workspace-runtime/workspaces/cli-credentials.js +0 -111
  134. package/dist/workspace-runtime/workspaces/composer-context.js +0 -125
  135. package/dist/workspace-runtime/workspaces/context-error.js +0 -2
  136. package/dist/workspace-runtime/workspaces/dependencies.js +0 -264
  137. package/dist/workspace-runtime/workspaces/developer-command.js +0 -64
  138. package/dist/workspace-runtime/workspaces/directories.js +0 -123
  139. package/dist/workspace-runtime/workspaces/directory-access.js +0 -37
  140. package/dist/workspace-runtime/workspaces/directory-attachments.js +0 -245
  141. package/dist/workspace-runtime/workspaces/directory-maintenance.js +0 -111
  142. package/dist/workspace-runtime/workspaces/directory-stats.js +0 -49
  143. package/dist/workspace-runtime/workspaces/disk-snapshot.js +0 -31
  144. package/dist/workspace-runtime/workspaces/empty-template.js +0 -40
  145. package/dist/workspace-runtime/workspaces/files-search.js +0 -116
  146. package/dist/workspace-runtime/workspaces/files.js +0 -120
  147. package/dist/workspace-runtime/workspaces/git-credential-broker.js +0 -312
  148. package/dist/workspace-runtime/workspaces/git-credential-helper.js +0 -68
  149. package/dist/workspace-runtime/workspaces/git-direct-store.js +0 -155
  150. package/dist/workspace-runtime/workspaces/git.js +0 -658
  151. package/dist/workspace-runtime/workspaces/instructions.js +0 -56
  152. package/dist/workspace-runtime/workspaces/json5-edit.js +0 -170
  153. package/dist/workspace-runtime/workspaces/library-attachments.js +0 -268
  154. package/dist/workspace-runtime/workspaces/parameters.js +0 -272
  155. package/dist/workspace-runtime/workspaces/prepare.js +0 -264
  156. package/dist/workspace-runtime/workspaces/registry.js +0 -236
  157. package/dist/workspace-runtime/workspaces/revisions.js +0 -31
  158. package/dist/workspace-runtime/workspaces/skill-artifact-loader.js +0 -91
  159. package/dist/workspace-runtime/workspaces/skills.js +0 -189
  160. package/dist/workspace-runtime/workspaces/transfer.js +0 -288
  161. package/dist/workspace-runtime/workspaces/turn-changes.js +0 -72
  162. package/dist/workspace-runtime/workspaces/video-attachments.js +0 -49
  163. package/project-template/.claude/skills/playcraft-replica-validation/SKILL.md +0 -25
  164. package/project-template/.claude/skills/playcraft-replica-validation/references/contracts.md +0 -79
  165. package/project-template/.claude/skills/playcraft-video-understanding/SKILL.md +0 -29
  166. package/project-template/.claude/skills/playcraft-video-understanding/references/contracts.md +0 -37
  167. package/project-template-v2/.claude/agents/artist.md +0 -82
  168. package/project-template-v2/.claude/agents/developer.md +0 -153
  169. package/project-template-v2/.claude/agents/game-designer.md +0 -264
  170. package/project-template-v2/.claude/agents/refs/artist-art-style-catalog.md +0 -533
  171. package/project-template-v2/.claude/agents/refs/artist-color-audio-recipes.md +0 -153
  172. package/project-template-v2/.claude/agents/refs/artist-dimension-axis.md +0 -27
  173. package/project-template-v2/.claude/agents/refs/artist-master-composite-recipes.md +0 -208
  174. package/project-template-v2/.claude/agents/refs/atom-skill-library.md +0 -81
  175. package/project-template-v2/.claude/agents/refs/developer-impl-cookbook.md +0 -432
  176. package/project-template-v2/.claude/agents/refs/framework-5-component-filter.md +0 -252
  177. package/project-template-v2/.claude/agents/refs/framework-game-feel-juice.md +0 -266
  178. package/project-template-v2/.claude/agents/refs/framework-mda.md +0 -147
  179. package/project-template-v2/.claude/agents/refs/game-designer-gameplay-sufficiency.md +0 -123
  180. package/project-template-v2/.claude/agents/refs/ta-3d-flip-recipe.md +0 -88
  181. package/project-template-v2/.claude/agents/refs/ta-atlas-deliverable-standard.md +0 -67
  182. package/project-template-v2/.claude/agents/refs/ta-batch-pipeline-recipes.md +0 -120
  183. package/project-template-v2/.claude/agents/refs/ta-image-generation-detail.md +0 -300
  184. package/project-template-v2/.claude/agents/refs/ta-image-ops-reference.md +0 -495
  185. package/project-template-v2/.claude/agents/refs/ta-pipeline-cookbook.md +0 -1141
  186. package/project-template-v2/.claude/agents/refs/ta-tools-reference.md +0 -111
  187. package/project-template-v2/.claude/agents/refs/ta-vfx-preset-catalog.md +0 -365
  188. package/project-template-v2/.claude/agents/refs/threejs-cannon-pitfalls.md +0 -412
  189. package/project-template-v2/.claude/agents/reviewer.md +0 -75
  190. package/project-template-v2/.claude/agents/technical-artist.md +0 -86
  191. package/project-template-v2/.claude/hooks/snapshot-milestone.mjs +0 -243
  192. package/project-template-v2/.claude/hooks/user-prompt.mjs +0 -133
  193. package/project-template-v2/.claude/settings.json +0 -33
  194. package/project-template-v2/.claude/skills/brainstorming/SKILL.md +0 -161
  195. package/project-template-v2/.claude/skills/brainstorming/scripts/frame-template.html +0 -270
  196. package/project-template-v2/.claude/skills/brainstorming/scripts/helper.js +0 -177
  197. package/project-template-v2/.claude/skills/brainstorming/scripts/server.cjs +0 -354
  198. package/project-template-v2/.claude/skills/brainstorming/scripts/start-server.sh +0 -148
  199. package/project-template-v2/.claude/skills/brainstorming/scripts/stop-server.sh +0 -56
  200. package/project-template-v2/.claude/skills/brainstorming/scripts/wait-for-selection.sh +0 -62
  201. package/project-template-v2/.claude/skills/brainstorming/spec-document-reviewer-prompt.md +0 -49
  202. package/project-template-v2/.claude/skills/brainstorming/visual-companion.md +0 -309
  203. package/project-template-v2/.claude/skills/playcraft-ad-psychology/SKILL.md +0 -182
  204. package/project-template-v2/.claude/skills/playcraft-art-style-guide/SKILL.md +0 -123
  205. package/project-template-v2/.claude/skills/playcraft-asset-state-sheet/SKILL.md +0 -205
  206. package/project-template-v2/.claude/skills/playcraft-audio-generation/SKILL.md +0 -280
  207. package/project-template-v2/.claude/skills/playcraft-batch-pipeline/SKILL.md +0 -184
  208. package/project-template-v2/.claude/skills/playcraft-build-optimizer/SKILL.md +0 -306
  209. package/project-template-v2/.claude/skills/playcraft-image-generation/SKILL.md +0 -298
  210. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/build-sprite-sheet.template.mjs +0 -123
  211. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/compare-style.template.mjs +0 -254
  212. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/gen-batch-sprite.template.mjs +0 -324
  213. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/gen-batch.template.mjs +0 -97
  214. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/gen-edit-variants.template.mjs +0 -118
  215. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/process-batch.template.mjs +0 -137
  216. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/prompt-cookbook.md +0 -397
  217. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/validate-sprite-sheet.template.mjs +0 -296
  218. package/project-template-v2/.claude/skills/playcraft-image-ops/SKILL.md +0 -122
  219. package/project-template-v2/.claude/skills/playcraft-image-processing/SKILL.md +0 -219
  220. package/project-template-v2/.claude/skills/playcraft-masking/SKILL.md +0 -373
  221. package/project-template-v2/.claude/skills/playcraft-playable-optimization/SKILL.md +0 -161
  222. package/project-template-v2/.claude/skills/playcraft-research/SKILL.md +0 -215
  223. package/project-template-v2/.claude/skills/playcraft-skill-recommender/SKILL.md +0 -382
  224. package/project-template-v2/.claude/skills/playcraft-sprite-generation/SKILL.md +0 -423
  225. package/project-template-v2/.claude/skills/playcraft-sprite-remix/SKILL.md +0 -158
  226. package/project-template-v2/.claude/skills/playcraft-sprite-sheet/SKILL.md +0 -100
  227. package/project-template-v2/.claude/skills/playcraft-storyboard/SKILL.md +0 -167
  228. package/project-template-v2/.claude/skills/playcraft-style-qa/SKILL.md +0 -270
  229. package/project-template-v2/.claude/skills/playcraft-text-rendering/SKILL.md +0 -236
  230. package/project-template-v2/.claude/skills/playcraft-vfx-animation/SKILL.md +0 -130
  231. package/project-template-v2/.claude/skills/playwright-cli/SKILL.md +0 -390
  232. package/project-template-v2/.claude/skills/playwright-cli/references/element-attributes.md +0 -23
  233. package/project-template-v2/.claude/skills/playwright-cli/references/playwright-tests.md +0 -39
  234. package/project-template-v2/.claude/skills/playwright-cli/references/request-mocking.md +0 -87
  235. package/project-template-v2/.claude/skills/playwright-cli/references/running-code.md +0 -240
  236. package/project-template-v2/.claude/skills/playwright-cli/references/session-management.md +0 -226
  237. package/project-template-v2/.claude/skills/playwright-cli/references/spec-driven-testing.md +0 -308
  238. package/project-template-v2/.claude/skills/playwright-cli/references/storage-state.md +0 -275
  239. package/project-template-v2/.claude/skills/playwright-cli/references/test-generation.md +0 -134
  240. package/project-template-v2/.claude/skills/playwright-cli/references/tracing.md +0 -142
  241. package/project-template-v2/.claude/skills/playwright-cli/references/video-recording.md +0 -153
  242. package/project-template-v2/.claude/skills/session-analyzer/SKILL.md +0 -386
  243. package/project-template-v2/.claude/skills/session-analyzer/scripts/execution-breakdown.mjs +0 -182
  244. package/project-template-v2/.claude/skills/session-analyzer/scripts/find-turns.mjs +0 -72
  245. package/project-template-v2/.claude/skills/session-analyzer/scripts/heavy-output.mjs +0 -121
  246. package/project-template-v2/.claude/skills/session-analyzer/scripts/resolve-session.mjs +0 -102
  247. package/project-template-v2/.claude/skills/session-analyzer/scripts/subagent-stats.mjs +0 -127
  248. package/project-template-v2/.claude/skills/session-analyzer/scripts/subagent-tool-timeline.mjs +0 -106
  249. package/project-template-v2/.claude/skills/session-analyzer/scripts/time-gaps.mjs +0 -128
  250. package/project-template-v2/.claude/skills/session-analyzer/scripts/turn-timeline.mjs +0 -67
  251. package/project-template-v2/.claude/snapshot.mjs +0 -263
  252. package/project-template-v2/.playcraft/skills.lock.json +0 -152
  253. package/project-template-v2/CLAUDE.md +0 -146
  254. package/project-template-v2/assets/audio/bgm/.gitkeep +0 -0
  255. package/project-template-v2/assets/audio/sfx/.gitkeep +0 -0
  256. package/project-template-v2/assets/bundles/.gitkeep +0 -0
  257. package/project-template-v2/assets/images/bg/.gitkeep +0 -0
  258. package/project-template-v2/assets/images/reference/.gitkeep +0 -0
  259. package/project-template-v2/assets/images/storyboard/.gitkeep +0 -0
  260. package/project-template-v2/assets/images/tiles/.gitkeep +0 -0
  261. package/project-template-v2/assets/images/ui/.gitkeep +0 -0
  262. package/project-template-v2/assets/images/vfx/.gitkeep +0 -0
  263. package/project-template-v2/assets/models/.gitkeep +0 -0
  264. package/project-template-v2/docs/harness/iteration-1/context-flow.md +0 -254
  265. package/project-template-v2/docs/harness/iteration-1/generate-flow.md +0 -91
  266. package/project-template-v2/docs/harness/iteration-1/ideate-flow.md +0 -214
  267. package/project-template-v2/docs/harness/iteration-1/optimize-flow.md +0 -75
  268. package/project-template-v2/docs/harness/iteration-1/wrapup-flow.md +0 -63
  269. package/project-template-v2/docs/harness/iteration-2/context-flow.md +0 -223
  270. package/project-template-v2/docs/harness/iteration-2/generate-flow.md +0 -129
  271. package/project-template-v2/docs/harness/iteration-2/ideate-flow.md +0 -267
  272. package/project-template-v2/docs/harness/iteration-2/optimize-flow.md +0 -164
  273. package/project-template-v2/docs/harness/iteration-2/wrapup-flow.md +0 -115
  274. package/project-template-v2/docs/harness/orchestrator-flow.md +0 -364
  275. package/project-template-v2/docs/project-state.json +0 -60
  276. package/project-template-v2/docs/project-state.md +0 -72
  277. package/project-template-v2/docs/standards/README.md +0 -225
  278. package/project-template-v2/docs/standards/agent-behavior-standards.md +0 -174
  279. package/project-template-v2/docs/standards/artifacts/design-brief.md +0 -19
  280. package/project-template-v2/docs/standards/artifacts/design.md +0 -22
  281. package/project-template-v2/docs/standards/artifacts/game-code.md +0 -41
  282. package/project-template-v2/docs/standards/artifacts/todo-list.md +0 -41
  283. package/project-template-v2/docs/standards/iter1-agent-behavior-standards.md +0 -343
  284. package/project-template-v2/game/index.ts +0 -18
  285. package/project-template-v2/globals.d.ts +0 -51
  286. package/project-template-v2/index.css +0 -34
  287. package/project-template-v2/index.html +0 -18
  288. package/project-template-v2/main.ts +0 -9
  289. package/project-template-v2/package.json +0 -46
  290. package/project-template-v2/skills/_shared/scripts/dispatch-clear.mjs +0 -31
  291. package/project-template-v2/skills/_shared/scripts/dispatch-set.mjs +0 -86
  292. package/project-template-v2/skills/_shared/scripts/dod-check.mjs +0 -153
  293. package/project-template-v2/skills/_shared/scripts/handoff-append.mjs +0 -70
  294. package/project-template-v2/skills/_shared/scripts/lib/validator-artifacts.mjs +0 -91
  295. package/project-template-v2/skills/_shared/scripts/pipeline/dod-config.mjs +0 -131
  296. package/project-template-v2/skills/_shared/scripts/pipeline/index.mjs +0 -80
  297. package/project-template-v2/skills/_shared/scripts/pipeline/iteration-1-core.mjs +0 -90
  298. package/project-template-v2/skills/_shared/scripts/pipeline/iteration-2-wrap.mjs +0 -93
  299. package/project-template-v2/skills/_shared/scripts/pipeline/iteration-3-visual.mjs +0 -23
  300. package/project-template-v2/skills/_shared/scripts/render-project-state.mjs +0 -230
  301. package/project-template-v2/skills/_shared/scripts/state-advance-stage.mjs +0 -58
  302. package/project-template-v2/skills/_shared/scripts/state-get.mjs +0 -339
  303. package/project-template-v2/skills/_shared/scripts/state-handoff.mjs +0 -39
  304. package/project-template-v2/skills/_shared/scripts/state-set.mjs +0 -94
  305. package/project-template-v2/skills/_shared/scripts/state-store.mjs +0 -783
  306. package/project-template-v2/skills/_shared/scripts/todo-add.mjs +0 -88
  307. package/project-template-v2/skills/_shared/scripts/todo-get.mjs +0 -130
  308. package/project-template-v2/skills/_shared/scripts/todo-remove.mjs +0 -33
  309. package/project-template-v2/skills/_shared/scripts/todo-set.mjs +0 -47
  310. package/project-template-v2/skills/_shared/scripts/verify-asset-code-sync.mjs +0 -268
  311. package/project-template-v2/skills/_shared/scripts/verify-env.mjs +0 -285
  312. package/project-template-v2/skills/_shared/scripts/verify-placeholders.mjs +0 -161
  313. package/project-template-v2/skills/playable-autoplay/SKILL.md +0 -176
  314. package/project-template-v2/skills/playable-autoplay/agents/openai.yaml +0 -4
  315. package/project-template-v2/skills/playable-debug/SKILL.md +0 -116
  316. package/project-template-v2/skills/playable-debug/agents/openai.yaml +0 -4
  317. package/project-template-v2/skills/playable-debug/references/debug-config.md +0 -40
  318. package/project-template-v2/skills/playable-record/SKILL.md +0 -140
  319. package/project-template-v2/skills/playable-record/scripts/lib/dev-server.mjs +0 -104
  320. package/project-template-v2/skills/playable-record/scripts/lib/record-audio-bridge.js +0 -141
  321. package/project-template-v2/skills/playable-record/scripts/record-playable.mjs +0 -425
  322. package/project-template-v2/skills/playable-record/scripts/verify-contract.mjs +0 -261
  323. package/project-template-v2/skills/playable-record/scripts/verify-firstwin.mjs +0 -398
  324. package/project-template-v2/skills/playable-record/scripts/verify-fusion.mjs +0 -322
  325. package/project-template-v2/skills/playable-record/scripts/verify-lifecycle.mjs +0 -105
  326. package/project-template-v2/skills/playable-record/scripts/verify-vlm-video.mjs +0 -230
  327. package/project-template-v2/skills/playable-validate/SKILL.md +0 -61
  328. package/project-template-v2/skills/playable-validate/validation-rules.md +0 -14
  329. package/project-template-v2/skills/playable-verify-ui/SKILL.md +0 -63
  330. package/project-template-v2/skills/playable-verify-ui/scripts/lib/__init__.py +0 -1
  331. package/project-template-v2/skills/playable-verify-ui/scripts/lib/config_expr.js +0 -218
  332. package/project-template-v2/skills/playable-verify-ui/scripts/lib/node_utils.js +0 -51
  333. package/project-template-v2/skills/playable-verify-ui/scripts/lib/profile_loader.py +0 -59
  334. package/project-template-v2/skills/playable-verify-ui/scripts/lib/report.py +0 -106
  335. package/project-template-v2/skills/playable-verify-ui/scripts/lib/runtime_contract.js +0 -116
  336. package/project-template-v2/skills/playable-verify-ui/scripts/verify_fetch_antipatterns.py +0 -59
  337. package/project-template-v2/skills/playable-verify-ui/scripts/verify_hardcoded_layout.js +0 -64
  338. package/project-template-v2/skills/playable-verify-ui/scripts/verify_runtime_contract.js +0 -58
  339. package/project-template-v2/skills/playable-verify-ui/scripts/verify_text_overlap.py +0 -333
  340. package/project-template-v2/ta-workspace/scripts/.gitkeep +0 -0
  341. package/project-template-v2/tsconfig.json +0 -20
  342. package/project-template-v2/vite.config.ts +0 -27
  343. package/project-templates/batch-locks/phaser.yaml +0 -922
  344. package/project-templates/batch-locks/threejs.yaml +0 -978
  345. package/project-templates/empty/AGENTS.md +0 -39
  346. package/project-templates/empty/gitignore +0 -33
@@ -1,324 +0,0 @@
1
- // ============================================================
2
- // gen-batch-sprite.template.mjs — gpt-image-2 精灵图直出脚本模板
3
- //
4
- // 核心原则:让 gpt-image-2 一次 API 调用直接生成包含多个元素的
5
- // 网格精灵图,然后用 sprite-split 切分。比逐个生成效率高 N 倍。
6
- //
7
- // 适用场景:
8
- // - 卡牌(扑克/麻将/游戏卡):一批 13 张以内
9
- // - 图标集:一批 9-16 张以内
10
- // - 数字/字母贴图:一批 ≤16 个
11
- //
12
- // 使用方式:
13
- // 1. cp .claude/skills/playcraft-image-generation/reference/gen-batch-sprite.template.mjs ta-workspace/scripts/gen-<name>-sprite.mjs
14
- // 2. 修改下方 CONFIG 和 BATCHES 区域
15
- // 3. node ta-workspace/scripts/gen-<name>-sprite.mjs
16
- // ============================================================
17
-
18
- import { execFileSync } from 'child_process';
19
- import { existsSync, mkdirSync, appendFileSync, copyFileSync } from 'fs';
20
-
21
- /**
22
- * Run the `playcraft` CLI with an argv ARRAY (never a shell string), so prompts
23
- * and paths containing $(), backticks, quotes, spaces, backslashes, etc. are
24
- * passed verbatim and cannot be reinterpreted by a shell.
25
- * - capture:true → returns stdout (utf8); otherwise inherits stdio.
26
- */
27
- function playcraft(args, { capture = false, timeout } = {}) {
28
- return execFileSync('playcraft', args, {
29
- ...(capture ? { encoding: 'utf8' } : { stdio: 'inherit' }),
30
- ...(timeout ? { timeout } : {}),
31
- });
32
- }
33
-
34
- // ============ CONFIG — 修改这里 ============
35
- const CONFIG = {
36
- /**
37
- * 精灵图直出模型:永远用 gpt-image-2(图像理解 + 布局能力最强)
38
- * mulerouter 质量更高(建议作为主模型),iegg 更快(备用)
39
- * 注意:精灵图生成比单图慢,通常需要 90-150s,timeout 设 240 以上
40
- */
41
- model: 'mulerouter/gpt-image-2',
42
-
43
- /**
44
- * 每批精灵图的列数
45
- * 行数由 items.length / columns 自动计算。
46
- * 推荐:每批 ≤16 个元素(如 columns=4 则每批最多 4 行),超过会出现混乱。
47
- */
48
- columns: 4,
49
-
50
- /**
51
- * 宽高比:根据 columns/rows 比例选择
52
- * - 1:1 → 4×4 方形网格
53
- * - 3:2 → 4×3 横向网格(4列3行)
54
- * - 2:3 → 3×4 纵向网格(3列4行)
55
- * - 16:9 → 适合宽横向布局
56
- */
57
- aspectRatio: '1:1',
58
-
59
- /** 生成的精灵图输出目录 */
60
- sheetDir: 'assets/gen/sheets',
61
- /** sprite-split 切分后的单图输出目录 */
62
- outputDir: 'assets/images/batch',
63
-
64
- /**
65
- * 通用风格描述(追加到每个批次 prompt 末尾)
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
74
- */
75
- style: 'flat 2D illustration, isolated on solid bright green #00FF00 background, centered, no shadow',
76
- /**
77
- * 切分后是否对每帧执行 remove-background(绿幕去背景)
78
- * true → 独立元素(需透明通道):remove-background --tolerance 25
79
- * false → 卡牌/UI 面板等矩形元素:直接 resize,不去背景
80
- */
81
- removeBg: true,
82
-
83
- /**
84
- * 切分单元尺寸(像素)。留空(null)= 自动按精灵图实际像素尺寸 ÷ 网格推导(推荐)。
85
- * 仅当模型输出的格子并非均匀均分、需要手动指定时才填写。
86
- * ⚠️ 不要写死 256:4K 精灵图按 256 切分会严重错位。
87
- */
88
- cellWidth: null,
89
- cellHeight: null,
90
- /** 帧间距(像素),默认 0 */
91
- padding: 0,
92
- };
93
-
94
- // ============ DATA — 分批定义元素 ============
95
- // 规则:每批 ≤ CONFIG.columns × CONFIG.rows 个元素
96
- // 每个元素必须有 name(输出文件名)和 desc(精灵图中该格的内容描述)
97
- const BATCHES = [
98
- {
99
- sheetName: 'sheet_batch_1',
100
- items: [
101
- { name: 'item_01', desc: '<格 1 内容描述>' },
102
- { name: 'item_02', desc: '<格 2 内容描述>' },
103
- { name: 'item_03', desc: '<格 3 内容描述>' },
104
- { name: 'item_04', desc: '<格 4 内容描述>' },
105
- // 最多 CONFIG.columns × CONFIG.rows 个
106
- ],
107
- },
108
- {
109
- sheetName: 'sheet_batch_2',
110
- items: [
111
- { name: 'item_05', desc: '<格 5 内容描述>' },
112
- { name: 'item_06', desc: '<格 6 内容描述>' },
113
- // ...
114
- ],
115
- },
116
- // 继续添加批次...
117
- ];
118
-
119
- // ============ 精灵图 Prompt 构建器 ============
120
- /**
121
- * 根据 items 列表构建精灵图网格 prompt
122
- * 关键词组合让 gpt-image-2 理解"网格布局"意图
123
- */
124
- /**
125
- * 读取精灵图实际像素尺寸(用于自动推导切分单元尺寸)。
126
- * 失败返回 null,由调用方决定是否中止该批次。
127
- */
128
- function readSheetDims(sheetPath) {
129
- try {
130
- const out = playcraft(['image', 'info', '--input', sheetPath, '--json'], { capture: true });
131
- const meta = JSON.parse(out.slice(out.indexOf('{')));
132
- if (typeof meta.width === 'number' && typeof meta.height === 'number') {
133
- return { width: meta.width, height: meta.height };
134
- }
135
- } catch {
136
- // fall through → null
137
- }
138
- return null;
139
- }
140
-
141
- function buildSpriteSheetPrompt(items, columns, style, removeBg) {
142
- const actualRows = Math.ceil(items.length / columns);
143
- const cellDescs = items.map((item, i) => {
144
- const col = (i % columns) + 1;
145
- const row = Math.floor(i / columns) + 1;
146
- return `[Row${row},Col${col}]: ${item.desc}`;
147
- }).join('; ');
148
-
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.';
153
-
154
- return [
155
- `Sprite sheet grid layout, ${columns} columns × ${actualRows} rows.`,
156
- `Each cell contains one element. Cell contents: ${cellDescs}.`,
157
- bgInstruction,
158
- `Grid layout, uniform cell size, equal spacing, elements perfectly centered in each cell.`,
159
- `No borders between cells, no labels, no numbers on cells.`,
160
- style,
161
- ].join(' ');
162
- }
163
-
164
- // ============ LOGIC — 通常不需要修改 ============
165
-
166
- const LOG_FILE = 'ta-workspace/logs/gen-batch-sprite.log';
167
- mkdirSync(CONFIG.sheetDir, { recursive: true });
168
- mkdirSync(CONFIG.outputDir, { recursive: true });
169
- mkdirSync('ta-workspace/logs', { recursive: true });
170
-
171
- function log(msg) {
172
- const line = `[${new Date().toISOString()}] ${msg}`;
173
- console.log(line);
174
- appendFileSync(LOG_FILE, line + '\n');
175
- }
176
-
177
- const totalElements = BATCHES.reduce((s, b) => s + b.items.length, 0);
178
- log(`=== Batch Sprite Generation Start ===`);
179
- log(`Total: ${BATCHES.length} batches, ${totalElements} elements`);
180
- log(`Model: ${CONFIG.model}`);
181
-
182
- let doneBatches = 0, failedBatches = 0;
183
-
184
- for (let bi = 0; bi < BATCHES.length; bi++) {
185
- const batch = BATCHES[bi];
186
- const sheetPath = `${CONFIG.sheetDir}/${batch.sheetName}.png`;
187
-
188
- // ── Step 1: 生成精灵图(幂等跳过)────────────────────────────────
189
- if (existsSync(sheetPath)) {
190
- log(`[SKIP-SHEET] (${bi + 1}/${BATCHES.length}) ${batch.sheetName} already exists`);
191
- } else {
192
- 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);
194
-
195
- try {
196
- playcraft(
197
- [
198
- 'tools', 'generate-image',
199
- '--prompt', prompt,
200
- '--output', sheetPath,
201
- '--aspect-ratio', CONFIG.aspectRatio,
202
- '--image-model', CONFIG.model,
203
- '--timeout', '240',
204
- ],
205
- { timeout: 300_000 },
206
- );
207
- log(`[OK-SHEET ] ${batch.sheetName}`);
208
- } catch (e) {
209
- log(`[FAIL-SHEET] ${batch.sheetName}: ${e.message?.slice(0, 200)}`);
210
- failedBatches++;
211
- continue;
212
- }
213
- }
214
-
215
- // ── Step 2: sprite-split 切分精灵图 ──────────────────────────────
216
- const actualRows = Math.ceil(batch.items.length / CONFIG.columns);
217
- // 检查第一个切分结果是否已存在(幂等)
218
- const firstItemPath = `${CONFIG.outputDir}/${batch.items[0]?.name}.png`;
219
- if (batch.items[0] && existsSync(firstItemPath)) {
220
- log(`[SKIP-SPLIT] ${batch.sheetName} already split`);
221
- doneBatches++;
222
- continue;
223
- }
224
-
225
- // 切分单元尺寸:优先用 CONFIG 显式值;否则按精灵图实际像素尺寸 ÷ 网格自动推导。
226
- // ⚠️ 绝不写死 256——4K 精灵图按 256 切分会严重错位(test11 类事故)。
227
- const padding = CONFIG.padding ?? 0;
228
- let cellWidth = CONFIG.cellWidth;
229
- let cellHeight = CONFIG.cellHeight;
230
- if (cellWidth == null || cellHeight == null) {
231
- const dims = readSheetDims(sheetPath);
232
- if (!dims) {
233
- log(
234
- `[FAIL-SPLIT] ${batch.sheetName}: 无法读取精灵图尺寸,请在 CONFIG 显式设置 cellWidth/cellHeight`,
235
- );
236
- failedBatches++;
237
- continue;
238
- }
239
- // 去掉帧间距后按网格均分
240
- cellWidth ??= Math.floor((dims.width - padding * (CONFIG.columns - 1)) / CONFIG.columns);
241
- cellHeight ??= Math.floor((dims.height - padding * (actualRows - 1)) / actualRows);
242
- log(
243
- `[CELL-SIZE ] ${batch.sheetName}: sheet ${dims.width}×${dims.height} → cell ${cellWidth}×${cellHeight} (grid ${CONFIG.columns}×${actualRows}, padding ${padding})`,
244
- );
245
- }
246
- if (!(cellWidth > 0 && cellHeight > 0)) {
247
- log(`[FAIL-SPLIT] ${batch.sheetName}: 推导出的 cell 尺寸非法 (${cellWidth}×${cellHeight})`);
248
- failedBatches++;
249
- continue;
250
- }
251
-
252
- log(`[SPLIT ] Splitting ${batch.sheetName} (${CONFIG.columns}×${actualRows}, cell ${cellWidth}×${cellHeight})`);
253
- const splitDir = `ta-workspace/tmp/${batch.sheetName}`;
254
-
255
- try {
256
- playcraft([
257
- 'image', 'sprite-split',
258
- '--input', sheetPath,
259
- '--output-dir', splitDir,
260
- '--rows', String(actualRows),
261
- '--columns', String(CONFIG.columns),
262
- '--frame-width', String(cellWidth),
263
- '--frame-height', String(cellHeight),
264
- '--padding', String(padding),
265
- ]);
266
- } catch (e) {
267
- log(`[FAIL-SPLIT] ${batch.sheetName}: ${e.message?.slice(0, 200)}`);
268
- failedBatches++;
269
- continue;
270
- }
271
-
272
- // ── Step 3: 重命名(+可选绿幕去背景)切分结果到最终位置 ─────────
273
- // 任何缺帧 / 处理失败都视为该批次失败(FAIL,不是 WARN):一个不完整的
274
- // 批次绝不能被报成 OK-BATCH,否则下游会拿到缺图的资产集。
275
- log(`[RENAME ] Renaming ${batch.items.length} cells${CONFIG.removeBg ? ' + remove-background' : ''}`);
276
- let processedOk = 0;
277
- let batchFailed = false;
278
- for (let j = 0; j < batch.items.length; j++) {
279
- const item = batch.items[j];
280
- const row = Math.floor(j / CONFIG.columns);
281
- const col = j % CONFIG.columns;
282
- // sprite-split 默认命名:frame_r{row}_c{col}.png(0-indexed)
283
- const srcPath = `${splitDir}/frame_r${row}_c${col}.png`;
284
- const dstPath = `${CONFIG.outputDir}/${item.name}.png`;
285
-
286
- if (!existsSync(srcPath)) {
287
- log(`[FAIL-CELL ] Expected cell not found: ${srcPath} (item ${item.name}, index ${j}/${batch.items.length})`);
288
- batchFailed = true;
289
- continue;
290
- }
291
- try {
292
- if (CONFIG.removeBg) {
293
- // 绿幕去背景(tolerance 25 适合纯绿色 #00FF00 背景)
294
- playcraft([
295
- 'image', 'remove-background',
296
- '--input', srcPath,
297
- '--output', dstPath,
298
- '--tolerance', '25',
299
- ]);
300
- } else {
301
- copyFileSync(srcPath, dstPath);
302
- }
303
- processedOk++;
304
- } catch (e) {
305
- log(`[FAIL-CELL ] Failed to process ${srcPath} → ${dstPath}: ${e.message?.slice(0, 120)}`);
306
- batchFailed = true;
307
- }
308
- }
309
-
310
- if (batchFailed) {
311
- log(`[FAIL-BATCH] (${bi + 1}/${BATCHES.length}) ${batch.sheetName} → only ${processedOk}/${batch.items.length} cells OK (see FAIL-CELL above)`);
312
- failedBatches++;
313
- } else {
314
- log(`[OK-BATCH ] (${bi + 1}/${BATCHES.length}) ${batch.sheetName} → ${batch.items.length} files`);
315
- doneBatches++;
316
- }
317
- }
318
-
319
- log(`\n=== Complete: Done=${doneBatches} Failed=${failedBatches}/${BATCHES.length} batches ===`);
320
- log(`Output: ${CONFIG.outputDir}`);
321
- if (failedBatches > 0) {
322
- log('Re-run to retry failed batches (successful batches will be skipped)');
323
- process.exit(1);
324
- }
@@ -1,97 +0,0 @@
1
- // ============================================================
2
- // gen-batch.template.mjs — 批量 AI 生图脚本模板
3
- // 用途:从零批量生成一组风格一致的素材(reference-image 模式)
4
- //
5
- // 使用方式:
6
- // 1. cp .claude/skills/playcraft-image-generation/reference/gen-batch.template.mjs ta-workspace/scripts/gen-<name>.mjs
7
- // 2. 修改下方 CONFIG 和 ITEMS 区域
8
- // 3. node ta-workspace/scripts/gen-<name>.mjs
9
- // ============================================================
10
-
11
- import { execSync } from 'child_process';
12
- import { existsSync, mkdirSync, appendFileSync } from 'fs';
13
-
14
- // ============ CONFIG — 修改这里 ============
15
- const CONFIG = {
16
- /**
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
25
- */
26
- model: 'google/gemini-3.1-flash-image-preview',
27
- /** 概念图路径(确认过风格的样本,所有后续图的参考来源) */
28
- referenceImage: 'assets/images/concept/approved_sample.png',
29
- /** 输出目录 */
30
- outputDir: 'assets/images/batch',
31
- /** 图片比例 */
32
- aspectRatio: '1:1',
33
- /**
34
- * 统一风格描述(从 design-brief.md 复制,粘贴到每个 prompt 末尾)
35
- * 示例:"flat 2D icon, vibrant colors, clean edges, white background, no shadow"
36
- */
37
- style: '<从 design-brief 复制的统一风格描述>',
38
- };
39
- // ============ DATA — 定义要生成的素材列表 ============
40
- const ITEMS = [
41
- { name: 'item_01', desc: '<素材描述 1>' },
42
- { name: 'item_02', desc: '<素材描述 2>' },
43
- // 继续添加...
44
- ];
45
- // ============ LOGIC — 通常不需要修改 ============
46
-
47
- const LOG_FILE = 'ta-workspace/logs/gen-batch.log';
48
- mkdirSync(CONFIG.outputDir, { recursive: true });
49
- mkdirSync('ta-workspace/logs', { recursive: true });
50
-
51
- function log(msg) {
52
- const line = `[${new Date().toISOString()}] ${msg}`;
53
- console.log(line);
54
- appendFileSync(LOG_FILE, line + '\n');
55
- }
56
-
57
- log(`=== Batch Generation Start ===`);
58
- log(`Total: ${ITEMS.length} | Model: ${CONFIG.model}`);
59
-
60
- let done = 0, skipped = 0, failed = 0;
61
- const failures = [];
62
-
63
- for (let i = 0; i < ITEMS.length; i++) {
64
- const item = ITEMS[i];
65
- const outPath = `${CONFIG.outputDir}/${item.name}.png`;
66
-
67
- if (existsSync(outPath)) {
68
- log(`[SKIP] (${i + 1}/${ITEMS.length}) ${item.name}`);
69
- skipped++;
70
- continue;
71
- }
72
-
73
- log(`[GEN ] (${i + 1}/${ITEMS.length}) ${item.name}`);
74
-
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}"`;
83
-
84
- try {
85
- execSync(cmd, { stdio: 'inherit', timeout: 120_000 });
86
- done++;
87
- log(`[OK ] ${item.name}`);
88
- } catch (e) {
89
- log(`[FAIL] ${item.name}: ${e.message?.slice(0, 100)}`);
90
- failures.push(item.name);
91
- failed++;
92
- }
93
- }
94
-
95
- log(`\n=== Complete: Done=${done} Skipped=${skipped} Failed=${failed}/${ITEMS.length} ===`);
96
- if (failures.length > 0) log(`Failed: ${failures.join(', ')}`);
97
- if (failed > 0) process.exit(1);
@@ -1,118 +0,0 @@
1
- // ============================================================
2
- // gen-edit-variants.template.mjs — 基图 + Edit 模型生成变体脚本模板
3
- // 用途:先用高质量模型生成 1 张完美基图,再用 edit 模型批量修改出一组变体
4
- //
5
- // 适用场景:结构相同、只改局部的变体集合
6
- // - 扑克牌(换花色/换数字)
7
- // - 棋子系列(换颜色/换图案)
8
- // - 图标集(换内容符号)
9
- //
10
- // 使用方式:
11
- // 1. cp .claude/skills/playcraft-image-generation/reference/gen-edit-variants.template.mjs ta-workspace/scripts/gen-<name>-variants.mjs
12
- // 2. Phase 1:先手动生成基图(见下方说明),存为 CONFIG.baseImage 路径
13
- // 3. 填写 CONFIG 和 VARIANTS,然后 node ta-workspace/scripts/gen-<name>-variants.mjs
14
- //
15
- // Edit 模型决策(按优先级):
16
- // 1. mulerouter/qwen-image-edit-max — 纯 edit,局部修改能力最强
17
- // 2. mulerouter/gpt-image-2 — 有图走 /edit 端点,质量高
18
- // 3. mulerouter/wan2.6-image — 图生图,回退选项
19
- // ============================================================
20
-
21
- import { execSync } from 'child_process';
22
- import { existsSync, mkdirSync, appendFileSync } from 'fs';
23
-
24
- // ============ CONFIG — 修改这里 ============
25
- const CONFIG = {
26
- /**
27
- * Phase 1 基图路径(必须已存在)
28
- * 生成基图的命令示例(gpt-image-2 质量最高,双 provider 回退):
29
- * playcraft tools generate-image \
30
- * --prompt "A playing card: Ace of Spades. [完整风格描述]" \
31
- * --output assets/images/cards/base_ace_spades.png \
32
- * --aspect-ratio 3:4 \
33
- * --image-model iegg-litellm/gpt-image-2
34
- */
35
- baseImage: 'assets/images/cards/base_ace_spades.png',
36
- /** Edit 模型(qwen-image-edit-max 局部修改能力最强) */
37
- editModel: 'mulerouter/qwen-image-edit-max',
38
- /** 输出目录 */
39
- outputDir: 'assets/images/cards',
40
- /** 图片比例(建议与基图相同) */
41
- aspectRatio: '3:4',
42
- };
43
- // ============ DATA — 定义要生成的变体列表 ============
44
- // editPrompt 应该描述"修改指令"而不是"完整重新描述"
45
- // 好的写法:'Change the rank symbol from A to 2, show two spade symbols in center'
46
- // 差的写法:'A playing card with two spade symbols...'(这是重新生成,不是编辑)
47
- const VARIANTS = [
48
- {
49
- name: 'spades_2',
50
- editPrompt: 'Change the rank symbol from A to 2. Show two spade suit symbols in center.',
51
- },
52
- {
53
- name: 'spades_3',
54
- editPrompt: 'Change the rank symbol from A to 3. Show three spade suit symbols in center.',
55
- },
56
- // 继续添加变体...
57
- ];
58
- // ============ LOGIC — 通常不需要修改 ============
59
-
60
- const LOG_FILE = 'ta-workspace/logs/gen-edit-variants.log';
61
- mkdirSync(CONFIG.outputDir, { recursive: true });
62
- mkdirSync('ta-workspace/logs', { recursive: true });
63
-
64
- function log(msg) {
65
- const line = `[${new Date().toISOString()}] ${msg}`;
66
- console.log(line);
67
- appendFileSync(LOG_FILE, line + '\n');
68
- }
69
-
70
- // 检查基图
71
- if (!existsSync(CONFIG.baseImage)) {
72
- log(`ERROR: Base image not found: ${CONFIG.baseImage}`);
73
- log(`Please generate the base image first (Phase 1), then run this script.`);
74
- process.exit(1);
75
- }
76
-
77
- log(`=== Edit Variants Start ===`);
78
- log(`Base: ${CONFIG.baseImage} | Model: ${CONFIG.editModel}`);
79
- log(`Total variants: ${VARIANTS.length}`);
80
-
81
- let done = 0, skipped = 0, failed = 0;
82
- const failures = [];
83
-
84
- for (let i = 0; i < VARIANTS.length; i++) {
85
- const variant = VARIANTS[i];
86
- const outPath = `${CONFIG.outputDir}/${variant.name}.png`;
87
-
88
- if (existsSync(outPath)) {
89
- log(`[SKIP] (${i + 1}/${VARIANTS.length}) ${variant.name}`);
90
- skipped++;
91
- continue;
92
- }
93
-
94
- log(`[EDIT] (${i + 1}/${VARIANTS.length}) ${variant.name}: ${variant.editPrompt.slice(0, 60)}...`);
95
-
96
- const promptEscaped = variant.editPrompt.replace(/"/g, '\\"');
97
- const cmd =
98
- `playcraft tools generate-image` +
99
- ` --prompt "${promptEscaped}"` +
100
- ` --output "${outPath}"` +
101
- ` --aspect-ratio ${CONFIG.aspectRatio}` +
102
- ` --reference-image "${CONFIG.baseImage}"` +
103
- ` --image-model "${CONFIG.editModel}"`;
104
-
105
- try {
106
- execSync(cmd, { stdio: 'inherit', timeout: 120_000 });
107
- done++;
108
- log(`[OK ] ${variant.name}`);
109
- } catch (e) {
110
- log(`[FAIL] ${variant.name}: ${e.message?.slice(0, 100)}`);
111
- failures.push(variant.name);
112
- failed++;
113
- }
114
- }
115
-
116
- log(`\n=== Complete: Done=${done} Skipped=${skipped} Failed=${failed}/${VARIANTS.length} ===`);
117
- if (failures.length > 0) log(`Failed: ${failures.join(', ')}`);
118
- if (failed > 0) process.exit(1);
@@ -1,137 +0,0 @@
1
- // ============================================================
2
- // process-batch.template.mjs — 批量图片处理脚本模板
3
- // 用途:对一批图片执行去背景 / trim + resize + 验证
4
- //
5
- // 使用方式:
6
- // 1. cp .claude/skills/playcraft-image-generation/reference/process-batch.template.mjs ta-workspace/scripts/process-<name>.mjs
7
- // 2. 修改下方 CONFIG 区域(特别是 SKIP_REMOVE_BG 选项)
8
- // 3. node ta-workspace/scripts/process-<name>.mjs
9
- //
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"
15
- // ============================================================
16
-
17
- import { execSync } from 'child_process';
18
- import { readdirSync, existsSync, mkdirSync, appendFileSync, unlinkSync } from 'fs';
19
- import { join, basename, extname } from 'path';
20
-
21
- // ============ CONFIG — 修改这里 ============
22
- const CONFIG = {
23
- /** 输入目录(gen-batch 的输出目录) */
24
- inputDir: 'assets/images/batch',
25
- /** 输出目录 */
26
- outputDir: 'assets/images/processed',
27
- /** 临时文件目录(去背景中间结果) */
28
- tmpDir: 'ta-workspace/tmp',
29
- /** 目标宽度(像素) */
30
- targetW: 128,
31
- /** 目标高度(像素) */
32
- targetH: 128,
33
- /**
34
- * 跳过去背景步骤
35
- * - false(默认):执行 remove-background(绿幕素材/独立元素)
36
- * - true:跳过,只做 trim + resize(卡牌/棋子等矩形本体素材)
37
- */
38
- skipRemoveBg: false,
39
- /**
40
- * floodfill 容差(0–255)
41
- * 绿幕背景建议 25;默认白背景可用 15
42
- * 仅在 skipRemoveBg = false 时生效
43
- */
44
- removeBgTolerance: 25,
45
- /** resize 时的 fit 模式:contain / cover / fill / inside / outside */
46
- resizeFit: 'contain',
47
- };
48
- // ============ LOGIC — 通常不需要修改 ============
49
-
50
- const LOG_FILE = 'ta-workspace/logs/process-batch.log';
51
- mkdirSync(CONFIG.outputDir, { recursive: true });
52
- mkdirSync(CONFIG.tmpDir, { recursive: true });
53
- mkdirSync('ta-workspace/logs', { recursive: true });
54
-
55
- function log(msg) {
56
- const line = `[${new Date().toISOString()}] ${msg}`;
57
- console.log(line);
58
- appendFileSync(LOG_FILE, line + '\n');
59
- }
60
-
61
- const SUPPORTED_EXTS = new Set(['.png', '.jpg', '.jpeg', '.webp']);
62
- const files = readdirSync(CONFIG.inputDir)
63
- .filter(f => SUPPORTED_EXTS.has(extname(f).toLowerCase()))
64
- .sort()
65
- .map(f => join(CONFIG.inputDir, f));
66
-
67
- log(`=== Batch Processing Start ===`);
68
- log(`Files: ${files.length} | skipRemoveBg: ${CONFIG.skipRemoveBg} | Target: ${CONFIG.targetW}x${CONFIG.targetH}`);
69
-
70
- let done = 0, skipped = 0, failed = 0;
71
- const failures = [];
72
-
73
- for (let i = 0; i < files.length; i++) {
74
- const inputPath = files[i];
75
- const name = basename(inputPath, extname(inputPath));
76
- const outPath = join(CONFIG.outputDir, `${name}.png`);
77
-
78
- if (existsSync(outPath)) {
79
- log(`[SKIP] (${i + 1}/${files.length}) ${name}`);
80
- skipped++;
81
- continue;
82
- }
83
-
84
- log(`[PROC] (${i + 1}/${files.length}) ${name}`);
85
-
86
- try {
87
- if (CONFIG.skipRemoveBg) {
88
- // 卡牌/棋子等矩形本体:直接 resize(不需要去背景)
89
- execSync(
90
- `playcraft image resize` +
91
- ` --input "${inputPath}"` +
92
- ` --output "${outPath}"` +
93
- ` --width ${CONFIG.targetW}` +
94
- ` --height ${CONFIG.targetH}` +
95
- ` --fit ${CONFIG.resizeFit}`,
96
- { stdio: 'inherit' },
97
- );
98
- } else {
99
- // 独立元素:先去背景,再 resize
100
- const tmpNobg = join(CONFIG.tmpDir, `${name}_nobg.png`);
101
-
102
- // 步骤 1:去背景(绿幕 tolerance=25 效果最好)
103
- execSync(
104
- `playcraft image remove-background` +
105
- ` --input "${inputPath}"` +
106
- ` --output "${tmpNobg}"` +
107
- ` --tolerance ${CONFIG.removeBgTolerance}`,
108
- { stdio: 'inherit' },
109
- );
110
-
111
- // 步骤 2:resize 到目标尺寸
112
- execSync(
113
- `playcraft image resize` +
114
- ` --input "${tmpNobg}"` +
115
- ` --output "${outPath}"` +
116
- ` --width ${CONFIG.targetW}` +
117
- ` --height ${CONFIG.targetH}` +
118
- ` --fit ${CONFIG.resizeFit}`,
119
- { stdio: 'inherit' },
120
- );
121
-
122
- // 清理临时文件
123
- if (existsSync(tmpNobg)) unlinkSync(tmpNobg);
124
- }
125
-
126
- log(`[OK ] ${name}`);
127
- done++;
128
- } catch (e) {
129
- log(`[FAIL] ${name}: ${e.message?.slice(0, 100)}`);
130
- failures.push(name);
131
- failed++;
132
- }
133
- }
134
-
135
- log(`\n=== Complete: Done=${done} Skipped=${skipped} Failed=${failed}/${files.length} ===`);
136
- if (failures.length > 0) log(`Failed: ${failures.join(', ')}`);
137
- if (failed > 0) process.exit(1);