@playcraft/cli 0.1.53-beta → 0.1.54

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 (400) hide show
  1. package/README.md +3 -62
  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/login.js +42 -84
  8. package/dist/commands/skills.js +0 -4
  9. package/dist/commands/tools-3d.js +0 -11
  10. package/dist/commands/tools-generation.js +0 -6
  11. package/dist/commands/tools.js +0 -2
  12. package/dist/config.js +4 -59
  13. package/dist/index.js +3 -42
  14. package/dist/remix/clone.js +0 -2
  15. package/dist/remix/init-template.js +0 -2
  16. package/dist/remix/pull.js +0 -2
  17. package/dist/remix/push.js +1 -21
  18. package/dist/utils/agent-api-client.js +30 -210
  19. package/dist/utils/playcraft-http-client.js +4 -6
  20. package/package.json +5 -15
  21. package/SKILLS_REGISTRY.md +0 -149
  22. package/dist/auth/account-activation.js +0 -157
  23. package/dist/auth/messages.js +0 -30
  24. package/dist/commands/build-temp.js +0 -26
  25. package/dist/commands/platform-skills.generated.js +0 -19
  26. package/dist/commands/playable.js +0 -53
  27. package/dist/commands/preview-runtime.js +0 -21
  28. package/dist/commands/tools-batch.js +0 -113
  29. package/dist/commands/video.js +0 -122
  30. package/dist/commands/workspace-runtime.js +0 -54
  31. package/dist/commands/workspace.js +0 -40
  32. package/dist/preview-runtime/distribution.js +0 -77
  33. package/dist/project-skills/builtin-import.js +0 -225
  34. package/dist/project-skills/commands.js +0 -77
  35. package/dist/project-skills/lifecycle.js +0 -28
  36. package/dist/project-skills/local-run.js +0 -112
  37. package/dist/project-skills/local-store.js +0 -221
  38. package/dist/project-skills/messages.js +0 -80
  39. package/dist/project-skills/reconcile.js +0 -62
  40. package/dist/project-skills/remote-cache.js +0 -51
  41. package/dist/project-skills/validation.js +0 -19
  42. package/dist/recording/messages.js +0 -40
  43. package/dist/recording/project-digest.js +0 -85
  44. package/dist/recording/recorder.js +0 -293
  45. package/dist/recording/scenario.js +0 -50
  46. package/dist/skill-registry/client.js +0 -345
  47. package/dist/skill-registry/commands.js +0 -180
  48. package/dist/skill-registry/evaluation-client.js +0 -156
  49. package/dist/skill-registry/evaluation-commands.js +0 -174
  50. package/dist/skill-registry/messages.js +0 -177
  51. package/dist/skill-registry/package.js +0 -275
  52. package/dist/skill-registry/platform-package.js +0 -100
  53. package/dist/utils/environment-endpoints.js +0 -17
  54. package/dist/utils/error-diagnostics.js +0 -20
  55. package/dist/utils/tool-operation-journal.js +0 -124
  56. package/dist/utils/video-evidence-git.js +0 -81
  57. package/dist/video-replication/client.js +0 -234
  58. package/dist/video-replication/comparison-evidence.js +0 -149
  59. package/dist/video-replication/comparison-files.js +0 -57
  60. package/dist/video-replication/comparison-log.js +0 -72
  61. package/dist/video-replication/comparison-messages.js +0 -104
  62. package/dist/video-replication/comparison-output.js +0 -63
  63. package/dist/video-replication/comparison-preflight.js +0 -66
  64. package/dist/video-replication/comparison.js +0 -230
  65. package/dist/video-replication/diagnostics.js +0 -41
  66. package/dist/video-replication/evidence.js +0 -165
  67. package/dist/video-replication/media.js +0 -112
  68. package/dist/video-replication/messages.js +0 -97
  69. package/dist/workspace/messages.js +0 -67
  70. package/dist/workspace/transfer-client.js +0 -237
  71. package/dist/workspace/transfer-errors.js +0 -48
  72. package/dist/workspace-runtime/batch/content-changes.js +0 -30
  73. package/dist/workspace-runtime/batch/control.js +0 -86
  74. package/dist/workspace-runtime/batch/deliver.js +0 -173
  75. package/dist/workspace-runtime/batch/freeze.js +0 -101
  76. package/dist/workspace-runtime/batch/generate.js +0 -249
  77. package/dist/workspace-runtime/batch/git.js +0 -40
  78. package/dist/workspace-runtime/batch/occupancy.js +0 -8
  79. package/dist/workspace-runtime/batch/policy.js +0 -70
  80. package/dist/workspace-runtime/batch/prepare.js +0 -317
  81. package/dist/workspace-runtime/batch/processes.js +0 -72
  82. package/dist/workspace-runtime/batch/records.js +0 -113
  83. package/dist/workspace-runtime/batch/routes.js +0 -61
  84. package/dist/workspace-runtime/batch/source-candidate.js +0 -86
  85. package/dist/workspace-runtime/batch/source-capture.js +0 -146
  86. package/dist/workspace-runtime/batch/source-failure.js +0 -43
  87. package/dist/workspace-runtime/batch/source-publish.js +0 -130
  88. package/dist/workspace-runtime/codex/app-server.js +0 -1065
  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/delivery-tools.js +0 -144
  92. package/dist/workspace-runtime/codex/jsonrpc-stdio.js +0 -145
  93. package/dist/workspace-runtime/codex/launcher-client.js +0 -177
  94. package/dist/workspace-runtime/codex/loopback.js +0 -146
  95. package/dist/workspace-runtime/codex/mcp-config.js +0 -39
  96. package/dist/workspace-runtime/codex/model-broker.js +0 -263
  97. package/dist/workspace-runtime/codex/native-adapter.js +0 -9
  98. package/dist/workspace-runtime/codex/permissions.js +0 -79
  99. package/dist/workspace-runtime/codex/thread-image.js +0 -38
  100. package/dist/workspace-runtime/codex/tool-response.js +0 -10
  101. package/dist/workspace-runtime/codex/ui-instructions.js +0 -4
  102. package/dist/workspace-runtime/codex/ui-tools.js +0 -203
  103. package/dist/workspace-runtime/codex/work-mode.js +0 -15
  104. package/dist/workspace-runtime/main.js +0 -10
  105. package/dist/workspace-runtime/persistence/journal.js +0 -365
  106. package/dist/workspace-runtime/persistence/native-subagents.js +0 -162
  107. package/dist/workspace-runtime/persistence/sqlite-client.js +0 -77
  108. package/dist/workspace-runtime/persistence/sqlite-worker.js +0 -1161
  109. package/dist/workspace-runtime/persistence/stopped-execution.js +0 -77
  110. package/dist/workspace-runtime/previews/diagnostics.js +0 -44
  111. package/dist/workspace-runtime/previews/output.js +0 -36
  112. package/dist/workspace-runtime/previews/publish.js +0 -283
  113. package/dist/workspace-runtime/previews/runtime-preview.js +0 -251
  114. package/dist/workspace-runtime/previews/single-file.js +0 -43
  115. package/dist/workspace-runtime/processes/managed-writes.js +0 -69
  116. package/dist/workspace-runtime/serve.js +0 -441
  117. package/dist/workspace-runtime/server/accept-operation.js +0 -61
  118. package/dist/workspace-runtime/server/asset-transfers.js +0 -63
  119. package/dist/workspace-runtime/server/auth.js +0 -21
  120. package/dist/workspace-runtime/server/connectivity.js +0 -211
  121. package/dist/workspace-runtime/server/desktop-host.js +0 -429
  122. package/dist/workspace-runtime/server/desktop-preview-config.js +0 -81
  123. package/dist/workspace-runtime/server/desktop-preview-service.js +0 -157
  124. package/dist/workspace-runtime/server/desktop-preview-static.js +0 -53
  125. package/dist/workspace-runtime/server/desktop-preview.js +0 -189
  126. package/dist/workspace-runtime/server/dispatch.js +0 -1655
  127. package/dist/workspace-runtime/server/endpoints.js +0 -21
  128. package/dist/workspace-runtime/server/execution-group.js +0 -90
  129. package/dist/workspace-runtime/server/http.js +0 -1339
  130. package/dist/workspace-runtime/server/lock.js +0 -53
  131. package/dist/workspace-runtime/server/operation-record.js +0 -33
  132. package/dist/workspace-runtime/server/rfb-watch-gate.js +0 -168
  133. package/dist/workspace-runtime/server/session-restore.js +0 -84
  134. package/dist/workspace-runtime/server/source-uploader.js +0 -138
  135. package/dist/workspace-runtime/server/submit-operation.js +0 -41
  136. package/dist/workspace-runtime/server/terminal-host.js +0 -366
  137. package/dist/workspace-runtime/server/types.js +0 -1
  138. package/dist/workspace-runtime/server/workspace-transfer.js +0 -168
  139. package/dist/workspace-runtime/verify-artifact.js +0 -59
  140. package/dist/workspace-runtime/workspaces/append-only-log.js +0 -62
  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 -199
  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/asset-library-import.js +0 -387
  147. package/dist/workspace-runtime/workspaces/asset-publication-access.js +0 -25
  148. package/dist/workspace-runtime/workspaces/asset-transfer-dependencies.js +0 -81
  149. package/dist/workspace-runtime/workspaces/asset-transfer-publish.js +0 -438
  150. package/dist/workspace-runtime/workspaces/asset-transfer-storage.js +0 -389
  151. package/dist/workspace-runtime/workspaces/attachment-content.js +0 -73
  152. package/dist/workspace-runtime/workspaces/attachments.js +0 -185
  153. package/dist/workspace-runtime/workspaces/batch-commit.js +0 -142
  154. package/dist/workspace-runtime/workspaces/binary-content.js +0 -65
  155. package/dist/workspace-runtime/workspaces/binary-write.js +0 -117
  156. package/dist/workspace-runtime/workspaces/cli-context.js +0 -23
  157. package/dist/workspace-runtime/workspaces/cli-credentials.js +0 -115
  158. package/dist/workspace-runtime/workspaces/composer-context.js +0 -147
  159. package/dist/workspace-runtime/workspaces/context-error.js +0 -2
  160. package/dist/workspace-runtime/workspaces/delivery-build.js +0 -331
  161. package/dist/workspace-runtime/workspaces/delivery-store.js +0 -168
  162. package/dist/workspace-runtime/workspaces/delivery.js +0 -64
  163. package/dist/workspace-runtime/workspaces/dependencies.js +0 -279
  164. package/dist/workspace-runtime/workspaces/developer-command.js +0 -98
  165. package/dist/workspace-runtime/workspaces/directories.js +0 -132
  166. package/dist/workspace-runtime/workspaces/directory-access.js +0 -37
  167. package/dist/workspace-runtime/workspaces/directory-attachments.js +0 -245
  168. package/dist/workspace-runtime/workspaces/directory-create.js +0 -57
  169. package/dist/workspace-runtime/workspaces/directory-maintenance.js +0 -111
  170. package/dist/workspace-runtime/workspaces/directory-mutations.js +0 -238
  171. package/dist/workspace-runtime/workspaces/directory-revisions.js +0 -56
  172. package/dist/workspace-runtime/workspaces/directory-stats.js +0 -49
  173. package/dist/workspace-runtime/workspaces/disk-snapshot.js +0 -31
  174. package/dist/workspace-runtime/workspaces/empty-template.js +0 -42
  175. package/dist/workspace-runtime/workspaces/file-content.js +0 -48
  176. package/dist/workspace-runtime/workspaces/files-search.js +0 -116
  177. package/dist/workspace-runtime/workspaces/files.js +0 -150
  178. package/dist/workspace-runtime/workspaces/git-credential-broker.js +0 -312
  179. package/dist/workspace-runtime/workspaces/git-credential-helper.js +0 -68
  180. package/dist/workspace-runtime/workspaces/git-direct-store.js +0 -155
  181. package/dist/workspace-runtime/workspaces/git.js +0 -670
  182. package/dist/workspace-runtime/workspaces/instructions.js +0 -56
  183. package/dist/workspace-runtime/workspaces/json5-edit.js +0 -313
  184. package/dist/workspace-runtime/workspaces/library-attachments.js +0 -268
  185. package/dist/workspace-runtime/workspaces/operation-log.js +0 -23
  186. package/dist/workspace-runtime/workspaces/optional-platform-skills.js +0 -14
  187. package/dist/workspace-runtime/workspaces/parameter-agent-inputs.js +0 -97
  188. package/dist/workspace-runtime/workspaces/parameter-agent-protocol.js +0 -40
  189. package/dist/workspace-runtime/workspaces/parameter-agent-store.js +0 -58
  190. package/dist/workspace-runtime/workspaces/parameter-agent.js +0 -284
  191. package/dist/workspace-runtime/workspaces/parameter-assets.js +0 -189
  192. package/dist/workspace-runtime/workspaces/parameters.js +0 -329
  193. package/dist/workspace-runtime/workspaces/prepare.js +0 -278
  194. package/dist/workspace-runtime/workspaces/registry.js +0 -251
  195. package/dist/workspace-runtime/workspaces/remix-references.js +0 -301
  196. package/dist/workspace-runtime/workspaces/revisions.js +0 -31
  197. package/dist/workspace-runtime/workspaces/session-image.js +0 -104
  198. package/dist/workspace-runtime/workspaces/shared-git.js +0 -40
  199. package/dist/workspace-runtime/workspaces/skill-artifact-loader.js +0 -95
  200. package/dist/workspace-runtime/workspaces/skills.js +0 -191
  201. package/dist/workspace-runtime/workspaces/theme-asset-index.js +0 -157
  202. package/dist/workspace-runtime/workspaces/transfer-quota.js +0 -69
  203. package/dist/workspace-runtime/workspaces/transfer.js +0 -471
  204. package/dist/workspace-runtime/workspaces/turn-changes.js +0 -75
  205. package/dist/workspace-runtime/workspaces/video-attachments.js +0 -49
  206. package/project-template/.claude/skills/playcraft-replica-validation/SKILL.md +0 -25
  207. package/project-template/.claude/skills/playcraft-replica-validation/references/contracts.md +0 -79
  208. package/project-template/.claude/skills/playcraft-video-understanding/SKILL.md +0 -29
  209. package/project-template/.claude/skills/playcraft-video-understanding/references/contracts.md +0 -37
  210. package/project-template-v2/.claude/agents/artist.md +0 -82
  211. package/project-template-v2/.claude/agents/developer.md +0 -153
  212. package/project-template-v2/.claude/agents/game-designer.md +0 -264
  213. package/project-template-v2/.claude/agents/refs/artist-art-style-catalog.md +0 -533
  214. package/project-template-v2/.claude/agents/refs/artist-color-audio-recipes.md +0 -153
  215. package/project-template-v2/.claude/agents/refs/artist-dimension-axis.md +0 -27
  216. package/project-template-v2/.claude/agents/refs/artist-master-composite-recipes.md +0 -208
  217. package/project-template-v2/.claude/agents/refs/atom-skill-library.md +0 -81
  218. package/project-template-v2/.claude/agents/refs/developer-impl-cookbook.md +0 -432
  219. package/project-template-v2/.claude/agents/refs/framework-5-component-filter.md +0 -252
  220. package/project-template-v2/.claude/agents/refs/framework-game-feel-juice.md +0 -266
  221. package/project-template-v2/.claude/agents/refs/framework-mda.md +0 -147
  222. package/project-template-v2/.claude/agents/refs/game-designer-gameplay-sufficiency.md +0 -123
  223. package/project-template-v2/.claude/agents/refs/ta-3d-flip-recipe.md +0 -88
  224. package/project-template-v2/.claude/agents/refs/ta-atlas-deliverable-standard.md +0 -67
  225. package/project-template-v2/.claude/agents/refs/ta-batch-pipeline-recipes.md +0 -120
  226. package/project-template-v2/.claude/agents/refs/ta-image-generation-detail.md +0 -300
  227. package/project-template-v2/.claude/agents/refs/ta-image-ops-reference.md +0 -495
  228. package/project-template-v2/.claude/agents/refs/ta-pipeline-cookbook.md +0 -1141
  229. package/project-template-v2/.claude/agents/refs/ta-tools-reference.md +0 -111
  230. package/project-template-v2/.claude/agents/refs/ta-vfx-preset-catalog.md +0 -365
  231. package/project-template-v2/.claude/agents/refs/threejs-cannon-pitfalls.md +0 -412
  232. package/project-template-v2/.claude/agents/reviewer.md +0 -75
  233. package/project-template-v2/.claude/agents/technical-artist.md +0 -86
  234. package/project-template-v2/.claude/hooks/snapshot-milestone.mjs +0 -243
  235. package/project-template-v2/.claude/hooks/user-prompt.mjs +0 -133
  236. package/project-template-v2/.claude/settings.json +0 -33
  237. package/project-template-v2/.claude/skills/brainstorming/SKILL.md +0 -161
  238. package/project-template-v2/.claude/skills/brainstorming/scripts/frame-template.html +0 -270
  239. package/project-template-v2/.claude/skills/brainstorming/scripts/helper.js +0 -177
  240. package/project-template-v2/.claude/skills/brainstorming/scripts/server.cjs +0 -354
  241. package/project-template-v2/.claude/skills/brainstorming/scripts/start-server.sh +0 -148
  242. package/project-template-v2/.claude/skills/brainstorming/scripts/stop-server.sh +0 -56
  243. package/project-template-v2/.claude/skills/brainstorming/scripts/wait-for-selection.sh +0 -62
  244. package/project-template-v2/.claude/skills/brainstorming/spec-document-reviewer-prompt.md +0 -49
  245. package/project-template-v2/.claude/skills/brainstorming/visual-companion.md +0 -309
  246. package/project-template-v2/.claude/skills/playcraft-ad-psychology/SKILL.md +0 -182
  247. package/project-template-v2/.claude/skills/playcraft-art-style-guide/SKILL.md +0 -123
  248. package/project-template-v2/.claude/skills/playcraft-asset-state-sheet/SKILL.md +0 -205
  249. package/project-template-v2/.claude/skills/playcraft-audio-generation/SKILL.md +0 -280
  250. package/project-template-v2/.claude/skills/playcraft-batch-pipeline/SKILL.md +0 -184
  251. package/project-template-v2/.claude/skills/playcraft-build-optimizer/SKILL.md +0 -306
  252. package/project-template-v2/.claude/skills/playcraft-image-generation/SKILL.md +0 -370
  253. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/build-sprite-sheet.template.mjs +0 -123
  254. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/compare-style.template.mjs +0 -254
  255. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/gen-batch-sprite.template.mjs +0 -333
  256. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/gen-batch.template.mjs +0 -95
  257. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/gen-edit-variants.template.mjs +0 -118
  258. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/process-batch.template.mjs +0 -136
  259. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/prompt-cookbook.md +0 -397
  260. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/validate-sprite-sheet.template.mjs +0 -296
  261. package/project-template-v2/.claude/skills/playcraft-image-ops/SKILL.md +0 -122
  262. package/project-template-v2/.claude/skills/playcraft-image-processing/SKILL.md +0 -219
  263. package/project-template-v2/.claude/skills/playcraft-masking/SKILL.md +0 -373
  264. package/project-template-v2/.claude/skills/playcraft-playable-optimization/SKILL.md +0 -161
  265. package/project-template-v2/.claude/skills/playcraft-research/SKILL.md +0 -215
  266. package/project-template-v2/.claude/skills/playcraft-skill-recommender/SKILL.md +0 -382
  267. package/project-template-v2/.claude/skills/playcraft-sprite-generation/SKILL.md +0 -423
  268. package/project-template-v2/.claude/skills/playcraft-sprite-remix/SKILL.md +0 -158
  269. package/project-template-v2/.claude/skills/playcraft-sprite-sheet/SKILL.md +0 -100
  270. package/project-template-v2/.claude/skills/playcraft-storyboard/SKILL.md +0 -167
  271. package/project-template-v2/.claude/skills/playcraft-style-qa/SKILL.md +0 -270
  272. package/project-template-v2/.claude/skills/playcraft-text-rendering/SKILL.md +0 -236
  273. package/project-template-v2/.claude/skills/playcraft-vfx-animation/SKILL.md +0 -130
  274. package/project-template-v2/.claude/skills/playwright-cli/SKILL.md +0 -390
  275. package/project-template-v2/.claude/skills/playwright-cli/references/element-attributes.md +0 -23
  276. package/project-template-v2/.claude/skills/playwright-cli/references/playwright-tests.md +0 -39
  277. package/project-template-v2/.claude/skills/playwright-cli/references/request-mocking.md +0 -87
  278. package/project-template-v2/.claude/skills/playwright-cli/references/running-code.md +0 -240
  279. package/project-template-v2/.claude/skills/playwright-cli/references/session-management.md +0 -226
  280. package/project-template-v2/.claude/skills/playwright-cli/references/spec-driven-testing.md +0 -308
  281. package/project-template-v2/.claude/skills/playwright-cli/references/storage-state.md +0 -275
  282. package/project-template-v2/.claude/skills/playwright-cli/references/test-generation.md +0 -134
  283. package/project-template-v2/.claude/skills/playwright-cli/references/tracing.md +0 -142
  284. package/project-template-v2/.claude/skills/playwright-cli/references/video-recording.md +0 -153
  285. package/project-template-v2/.claude/skills/session-analyzer/SKILL.md +0 -386
  286. package/project-template-v2/.claude/skills/session-analyzer/scripts/execution-breakdown.mjs +0 -182
  287. package/project-template-v2/.claude/skills/session-analyzer/scripts/find-turns.mjs +0 -72
  288. package/project-template-v2/.claude/skills/session-analyzer/scripts/heavy-output.mjs +0 -121
  289. package/project-template-v2/.claude/skills/session-analyzer/scripts/resolve-session.mjs +0 -102
  290. package/project-template-v2/.claude/skills/session-analyzer/scripts/subagent-stats.mjs +0 -127
  291. package/project-template-v2/.claude/skills/session-analyzer/scripts/subagent-tool-timeline.mjs +0 -106
  292. package/project-template-v2/.claude/skills/session-analyzer/scripts/time-gaps.mjs +0 -128
  293. package/project-template-v2/.claude/skills/session-analyzer/scripts/turn-timeline.mjs +0 -67
  294. package/project-template-v2/.claude/snapshot.mjs +0 -263
  295. package/project-template-v2/.playcraft/skills.lock.json +0 -152
  296. package/project-template-v2/CLAUDE.md +0 -146
  297. package/project-template-v2/assets/audio/bgm/.gitkeep +0 -0
  298. package/project-template-v2/assets/audio/sfx/.gitkeep +0 -0
  299. package/project-template-v2/assets/bundles/.gitkeep +0 -0
  300. package/project-template-v2/assets/images/bg/.gitkeep +0 -0
  301. package/project-template-v2/assets/images/reference/.gitkeep +0 -0
  302. package/project-template-v2/assets/images/storyboard/.gitkeep +0 -0
  303. package/project-template-v2/assets/images/tiles/.gitkeep +0 -0
  304. package/project-template-v2/assets/images/ui/.gitkeep +0 -0
  305. package/project-template-v2/assets/images/vfx/.gitkeep +0 -0
  306. package/project-template-v2/assets/models/.gitkeep +0 -0
  307. package/project-template-v2/docs/harness/iteration-1/context-flow.md +0 -254
  308. package/project-template-v2/docs/harness/iteration-1/generate-flow.md +0 -91
  309. package/project-template-v2/docs/harness/iteration-1/ideate-flow.md +0 -214
  310. package/project-template-v2/docs/harness/iteration-1/optimize-flow.md +0 -75
  311. package/project-template-v2/docs/harness/iteration-1/wrapup-flow.md +0 -63
  312. package/project-template-v2/docs/harness/iteration-2/context-flow.md +0 -223
  313. package/project-template-v2/docs/harness/iteration-2/generate-flow.md +0 -129
  314. package/project-template-v2/docs/harness/iteration-2/ideate-flow.md +0 -267
  315. package/project-template-v2/docs/harness/iteration-2/optimize-flow.md +0 -164
  316. package/project-template-v2/docs/harness/iteration-2/wrapup-flow.md +0 -115
  317. package/project-template-v2/docs/harness/orchestrator-flow.md +0 -364
  318. package/project-template-v2/docs/project-state.json +0 -60
  319. package/project-template-v2/docs/project-state.md +0 -72
  320. package/project-template-v2/docs/standards/README.md +0 -225
  321. package/project-template-v2/docs/standards/agent-behavior-standards.md +0 -174
  322. package/project-template-v2/docs/standards/artifacts/design-brief.md +0 -19
  323. package/project-template-v2/docs/standards/artifacts/design.md +0 -22
  324. package/project-template-v2/docs/standards/artifacts/game-code.md +0 -41
  325. package/project-template-v2/docs/standards/artifacts/todo-list.md +0 -41
  326. package/project-template-v2/docs/standards/iter1-agent-behavior-standards.md +0 -343
  327. package/project-template-v2/game/index.ts +0 -18
  328. package/project-template-v2/globals.d.ts +0 -51
  329. package/project-template-v2/index.css +0 -34
  330. package/project-template-v2/index.html +0 -18
  331. package/project-template-v2/main.ts +0 -9
  332. package/project-template-v2/package.json +0 -46
  333. package/project-template-v2/skills/_shared/scripts/dispatch-clear.mjs +0 -31
  334. package/project-template-v2/skills/_shared/scripts/dispatch-set.mjs +0 -86
  335. package/project-template-v2/skills/_shared/scripts/dod-check.mjs +0 -153
  336. package/project-template-v2/skills/_shared/scripts/handoff-append.mjs +0 -70
  337. package/project-template-v2/skills/_shared/scripts/lib/validator-artifacts.mjs +0 -91
  338. package/project-template-v2/skills/_shared/scripts/pipeline/dod-config.mjs +0 -131
  339. package/project-template-v2/skills/_shared/scripts/pipeline/index.mjs +0 -80
  340. package/project-template-v2/skills/_shared/scripts/pipeline/iteration-1-core.mjs +0 -90
  341. package/project-template-v2/skills/_shared/scripts/pipeline/iteration-2-wrap.mjs +0 -93
  342. package/project-template-v2/skills/_shared/scripts/pipeline/iteration-3-visual.mjs +0 -23
  343. package/project-template-v2/skills/_shared/scripts/render-project-state.mjs +0 -230
  344. package/project-template-v2/skills/_shared/scripts/state-advance-stage.mjs +0 -58
  345. package/project-template-v2/skills/_shared/scripts/state-get.mjs +0 -339
  346. package/project-template-v2/skills/_shared/scripts/state-handoff.mjs +0 -39
  347. package/project-template-v2/skills/_shared/scripts/state-set.mjs +0 -94
  348. package/project-template-v2/skills/_shared/scripts/state-store.mjs +0 -783
  349. package/project-template-v2/skills/_shared/scripts/todo-add.mjs +0 -88
  350. package/project-template-v2/skills/_shared/scripts/todo-get.mjs +0 -130
  351. package/project-template-v2/skills/_shared/scripts/todo-remove.mjs +0 -33
  352. package/project-template-v2/skills/_shared/scripts/todo-set.mjs +0 -47
  353. package/project-template-v2/skills/_shared/scripts/verify-asset-code-sync.mjs +0 -268
  354. package/project-template-v2/skills/_shared/scripts/verify-env.mjs +0 -285
  355. package/project-template-v2/skills/_shared/scripts/verify-placeholders.mjs +0 -161
  356. package/project-template-v2/skills/playable-autoplay/SKILL.md +0 -176
  357. package/project-template-v2/skills/playable-autoplay/agents/openai.yaml +0 -4
  358. package/project-template-v2/skills/playable-debug/SKILL.md +0 -116
  359. package/project-template-v2/skills/playable-debug/agents/openai.yaml +0 -4
  360. package/project-template-v2/skills/playable-debug/references/debug-config.md +0 -40
  361. package/project-template-v2/skills/playable-record/SKILL.md +0 -140
  362. package/project-template-v2/skills/playable-record/scripts/lib/dev-server.mjs +0 -104
  363. package/project-template-v2/skills/playable-record/scripts/lib/record-audio-bridge.js +0 -141
  364. package/project-template-v2/skills/playable-record/scripts/record-playable.mjs +0 -425
  365. package/project-template-v2/skills/playable-record/scripts/verify-contract.mjs +0 -261
  366. package/project-template-v2/skills/playable-record/scripts/verify-firstwin.mjs +0 -398
  367. package/project-template-v2/skills/playable-record/scripts/verify-fusion.mjs +0 -322
  368. package/project-template-v2/skills/playable-record/scripts/verify-lifecycle.mjs +0 -105
  369. package/project-template-v2/skills/playable-record/scripts/verify-vlm-video.mjs +0 -230
  370. package/project-template-v2/skills/playable-validate/SKILL.md +0 -61
  371. package/project-template-v2/skills/playable-validate/validation-rules.md +0 -14
  372. package/project-template-v2/skills/playable-verify-ui/SKILL.md +0 -63
  373. package/project-template-v2/skills/playable-verify-ui/scripts/lib/__init__.py +0 -1
  374. package/project-template-v2/skills/playable-verify-ui/scripts/lib/config_expr.js +0 -218
  375. package/project-template-v2/skills/playable-verify-ui/scripts/lib/node_utils.js +0 -51
  376. package/project-template-v2/skills/playable-verify-ui/scripts/lib/profile_loader.py +0 -59
  377. package/project-template-v2/skills/playable-verify-ui/scripts/lib/report.py +0 -106
  378. package/project-template-v2/skills/playable-verify-ui/scripts/lib/runtime_contract.js +0 -116
  379. package/project-template-v2/skills/playable-verify-ui/scripts/verify_fetch_antipatterns.py +0 -59
  380. package/project-template-v2/skills/playable-verify-ui/scripts/verify_hardcoded_layout.js +0 -64
  381. package/project-template-v2/skills/playable-verify-ui/scripts/verify_runtime_contract.js +0 -58
  382. package/project-template-v2/skills/playable-verify-ui/scripts/verify_text_overlap.py +0 -333
  383. package/project-template-v2/ta-workspace/scripts/.gitkeep +0 -0
  384. package/project-template-v2/tsconfig.json +0 -20
  385. package/project-template-v2/vite.config.ts +0 -27
  386. package/project-templates/batch-locks/phaser.yaml +0 -922
  387. package/project-templates/batch-locks/threejs.yaml +0 -978
  388. package/project-templates/empty/AGENTS.md +0 -41
  389. package/project-templates/empty/gitignore +0 -33
  390. package/templates/preview-runtime/v1/README.md +0 -71
  391. package/templates/preview-runtime/v1/build-preview.mjs +0 -1324
  392. package/templates/preview-runtime/v1/manifest.json +0 -17
  393. package/templates/preview-runtime/v1/release-guard.mjs +0 -87
  394. package/templates/preview-runtime/v1/runtime.d.mts +0 -3
  395. package/templates/preview-runtime/v1/runtime.d.ts +0 -3
  396. package/templates/preview-runtime/v1/runtime.mjs +0 -1121
  397. package/templates/preview-runtime/v1/types/adapters.d.ts +0 -26
  398. package/templates/preview-runtime/v1/types/preview.d.ts +0 -23
  399. package/templates/preview-runtime/v1/types/protocol.d.ts +0 -94
  400. package/templates/preview-runtime/v1/types/runtime.d.ts +0 -14
@@ -1,254 +0,0 @@
1
- /**
2
- * compare-style.template.mjs
3
- *
4
- * 色彩风格一致性定量检查脚本。
5
- * 用途:TA Micro-Batch Validation 辅助工具,对 AI 补全素材与 Artist 样本做客观色彩比较。
6
- *
7
- * 使用方法:
8
- * cp .claude/skills/playcraft-image-generation/reference/compare-style.template.mjs \
9
- * ta-workspace/scripts/compare-style.mjs
10
- * # 修改下方 CONFIG 区域后运行:
11
- * node ta-workspace/scripts/compare-style.mjs
12
- *
13
- * 输出示例:
14
- * [COMPARE] tile_sample_1.png vs tile_comp_01.png
15
- * 色相距离(加权): 8.3° → ✅ 优秀(< 15°)
16
- * 明度差异: 0.06 → ✅ 优秀(< 0.10)
17
- * 饱和度差异: 0.04 → ✅ 优秀(< 0.10)
18
- * 综合一致性评分: 4.7 / 5 → ✅ 通过(≥ 3.0)
19
- *
20
- * 依赖:@gltf-transform/core(CLI 已内置)、sharp(CLI 已内置)
21
- * 若 sharp 未全局可用,运行前:npm install sharp --no-save
22
- */
23
-
24
- import { execSync } from 'child_process';
25
- import { existsSync, mkdirSync, appendFileSync } from 'fs';
26
- import path from 'path';
27
-
28
- // ─── CONFIG ───────────────────────────────────────────────────────────────────
29
-
30
- const CONFIG = {
31
- /** Artist 样本图(风格基准) */
32
- referenceImage: 'assets/images/tiles/tile_sample_1.png',
33
-
34
- /** 要检查的 TA 补全素材目录或文件列表 */
35
- targetDir: 'assets/images/tiles',
36
-
37
- /** 只检查该目录下的哪些文件(glob 后缀匹配) */
38
- targetGlob: '.png',
39
-
40
- /** 排除文件名包含这些关键词的文件(Artist 样本自身) */
41
- excludeKeywords: ['sample', 'concept', 'selected', 'storyboard'],
42
-
43
- /** 日志输出路径 */
44
- logFile: 'ta-workspace/logs/style-compare.log',
45
-
46
- /** 评分阈值(低于此值输出警告) */
47
- warnThreshold: 3.0,
48
- };
49
-
50
- // ─── HELPERS ──────────────────────────────────────────────────────────────────
51
-
52
- /**
53
- * 用 playcraft image info 提取图片的 dominant colors(HSL 列表)
54
- * 返回格式:[{ h, s, l, weight }](weight 为面积占比估算)
55
- */
56
- function extractDominantColors(imagePath) {
57
- try {
58
- const raw = execSync(
59
- `playcraft image info --input "${imagePath}" --json`,
60
- { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] }
61
- );
62
- const info = JSON.parse(raw);
63
-
64
- // playcraft image info 返回 dominantColors 数组:[{ r, g, b, hex, percent }]
65
- const colors = (info.dominantColors || []).slice(0, 5);
66
- return colors.map(c => {
67
- const hsl = rgbToHsl(c.r, c.g, c.b);
68
- return { ...hsl, weight: (c.percent || 20) / 100 };
69
- });
70
- } catch {
71
- return [];
72
- }
73
- }
74
-
75
- function rgbToHsl(r, g, b) {
76
- r /= 255; g /= 255; b /= 255;
77
- const max = Math.max(r, g, b), min = Math.min(r, g, b);
78
- const l = (max + min) / 2;
79
- if (max === min) return { h: 0, s: 0, l };
80
- const d = max - min;
81
- const s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
82
- let h;
83
- switch (max) {
84
- case r: h = ((g - b) / d + (g < b ? 6 : 0)) / 6; break;
85
- case g: h = ((b - r) / d + 2) / 6; break;
86
- default: h = ((r - g) / d + 4) / 6;
87
- }
88
- return { h: h * 360, s, l };
89
- }
90
-
91
- /**
92
- * 计算两组 dominant colors 之间的加权色相距离(°)
93
- * 色相距离取最短弧(0–180°)
94
- */
95
- function weightedHueDist(colorsA, colorsB) {
96
- if (!colorsA.length || !colorsB.length) return 999;
97
- let totalDist = 0, totalWeight = 0;
98
- for (const a of colorsA) {
99
- // 找 B 中色相最近的颜色
100
- let minDist = Infinity;
101
- for (const b of colorsB) {
102
- const raw = Math.abs(a.h - b.h);
103
- const dist = raw > 180 ? 360 - raw : raw;
104
- if (dist < minDist) minDist = dist;
105
- }
106
- totalDist += minDist * a.weight;
107
- totalWeight += a.weight;
108
- }
109
- return totalWeight > 0 ? totalDist / totalWeight : 999;
110
- }
111
-
112
- /**
113
- * 计算明度 / 饱和度的加权平均差异(0–1)
114
- */
115
- function weightedChannelDiff(colorsA, colorsB, channel) {
116
- if (!colorsA.length || !colorsB.length) return 1;
117
- const avgA = colorsA.reduce((s, c) => s + c[channel] * c.weight, 0) /
118
- colorsA.reduce((s, c) => s + c.weight, 0);
119
- const avgB = colorsB.reduce((s, c) => s + c[channel] * c.weight, 0) /
120
- colorsB.reduce((s, c) => s + c.weight, 0);
121
- return Math.abs(avgA - avgB);
122
- }
123
-
124
- /**
125
- * 综合一致性评分 1–5
126
- *
127
- * 评分规则(与 playcraft-style-qa Micro-Batch 标准对齐):
128
- * 色相距离 < 15° 且 明度/饱和度差 < 0.10 → 5 分
129
- * 色相距离 < 20° 且 明度/饱和度差 < 0.15 → 4 分
130
- * 色相距离 < 30° 且 明度/饱和度差 < 0.20 → 3 分(勉强可接受)
131
- * 色相距离 < 45° 且 明度/饱和度差 < 0.30 → 2 分(需调整)
132
- * 其他 → 1 分(停止,提问 Artist)
133
- */
134
- function calcScore(hueDist, lightDiff, satDiff) {
135
- const channelOk = Math.max(lightDiff, satDiff);
136
- if (hueDist < 15 && channelOk < 0.10) return 5;
137
- if (hueDist < 20 && channelOk < 0.15) return 4;
138
- if (hueDist < 30 && channelOk < 0.20) return 3;
139
- if (hueDist < 45 && channelOk < 0.30) return 2;
140
- return 1;
141
- }
142
-
143
- function scoreLabel(score) {
144
- if (score >= 4) return '✅ 良好';
145
- if (score >= 3) return '⚠️ 可接受';
146
- return '❌ 偏差过大,需停止';
147
- }
148
-
149
- function hueLabel(dist) {
150
- if (dist < 15) return '✅ 优秀(< 15°)';
151
- if (dist < 30) return '⚠️ 偏差(< 30°)';
152
- return '❌ 严重偏差(≥ 30°)';
153
- }
154
-
155
- function channelLabel(diff) {
156
- if (diff < 0.10) return '✅ 优秀(< 0.10)';
157
- if (diff < 0.20) return '⚠️ 偏差(< 0.20)';
158
- return '❌ 严重偏差(≥ 0.20)';
159
- }
160
-
161
- // ─── MAIN ─────────────────────────────────────────────────────────────────────
162
-
163
- async function main() {
164
- const logDir = path.dirname(CONFIG.logFile);
165
- if (!existsSync(logDir)) mkdirSync(logDir, { recursive: true });
166
-
167
- const refPath = CONFIG.referenceImage;
168
- if (!existsSync(refPath)) {
169
- console.error(`[ERROR] 参考图不存在: ${refPath}`);
170
- process.exit(1);
171
- }
172
-
173
- console.log(`\n📊 色彩风格一致性检查`);
174
- console.log(` 参考图: ${refPath}\n`);
175
-
176
- const refColors = extractDominantColors(refPath);
177
- if (!refColors.length) {
178
- console.error('[ERROR] 无法从参考图提取颜色,请确认 playcraft image info 可用');
179
- process.exit(1);
180
- }
181
-
182
- // 收集目标文件
183
- let targets = [];
184
- try {
185
- const { readdirSync } = await import('fs');
186
- targets = readdirSync(CONFIG.targetDir)
187
- .filter(f => f.endsWith(CONFIG.targetGlob))
188
- .filter(f => !CONFIG.excludeKeywords.some(kw => f.includes(kw)))
189
- .map(f => path.join(CONFIG.targetDir, f));
190
- } catch {
191
- console.error(`[ERROR] 无法读取目录: ${CONFIG.targetDir}`);
192
- process.exit(1);
193
- }
194
-
195
- if (!targets.length) {
196
- console.log(' 未找到需要检查的目标文件');
197
- return;
198
- }
199
-
200
- const results = [];
201
- let failCount = 0;
202
-
203
- for (const target of targets) {
204
- const targetColors = extractDominantColors(target);
205
- if (!targetColors.length) {
206
- console.log(` [SKIP] ${path.basename(target)} — 无法提取颜色`);
207
- continue;
208
- }
209
-
210
- const hueDist = weightedHueDist(refColors, targetColors);
211
- const lightDiff = weightedChannelDiff(refColors, targetColors, 'l');
212
- const satDiff = weightedChannelDiff(refColors, targetColors, 's');
213
- const score = calcScore(hueDist, lightDiff, satDiff);
214
-
215
- if (score < CONFIG.warnThreshold) failCount++;
216
-
217
- const line = [
218
- `[COMPARE] ${path.basename(refPath)} vs ${path.basename(target)}`,
219
- ` 色相距离(加权): ${hueDist.toFixed(1)}° → ${hueLabel(hueDist)}`,
220
- ` 明度差异: ${lightDiff.toFixed(2)} → ${channelLabel(lightDiff)}`,
221
- ` 饱和度差异: ${satDiff.toFixed(2)} → ${channelLabel(satDiff)}`,
222
- ` 综合一致性评分: ${score} / 5 → ${scoreLabel(score)}`,
223
- '',
224
- ].join('\n');
225
-
226
- console.log(line);
227
- results.push({ file: path.basename(target), score, hueDist, lightDiff, satDiff });
228
- }
229
-
230
- // 汇总
231
- const avgScore = results.reduce((s, r) => s + r.score, 0) / (results.length || 1);
232
- const summary = [
233
- `=== 汇总 ===`,
234
- ` 检查文件数: ${results.length}`,
235
- ` 平均评分: ${avgScore.toFixed(1)} / 5`,
236
- ` 低于阈值数: ${failCount}(阈值 ${CONFIG.warnThreshold})`,
237
- failCount > 0
238
- ? ` ⚠️ 建议:停止低分文件类型的批量生产,调整生成参数或向 Artist 提问 ICP`
239
- : ` ✅ 全部通过,可继续批量生产`,
240
- '',
241
- ].join('\n');
242
-
243
- console.log(summary);
244
-
245
- // 写日志
246
- const timestamp = new Date().toISOString();
247
- appendFileSync(CONFIG.logFile, `\n[${timestamp}]\n${results.map(r =>
248
- `${r.file}: score=${r.score} hue=${r.hueDist.toFixed(1)}° L=${r.lightDiff.toFixed(2)} S=${r.satDiff.toFixed(2)}`
249
- ).join('\n')}\n${summary}`);
250
-
251
- if (failCount > 0) process.exit(1);
252
- }
253
-
254
- main().catch(e => { console.error(e); process.exit(1); });
@@ -1,333 +0,0 @@
1
- // ============================================================
2
- // gen-batch-sprite.template.mjs — 精灵图直出脚本模板
3
- //
4
- // 核心原则:一次 API (Application Programming Interface, 应用程序编程接口) 调用生成包含多个元素的
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
- * 使用 list-image-models 核实本次模型;默认示例为 Image 2.5。
38
- * 用户或制作流程锁定其他模型时填写实际 provider/model。
39
- * 请求使用命令行默认等待时间,不在脚本中提前杀死仍在运行的请求。
40
- */
41
- model: 'iegg-litellm/gpt-image-2.5-sunburst',
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
- * 卡牌白色牌面属于主体,应在 items.desc 中描述并设 removeBg=false。
69
- */
70
- style: 'flat 2D illustration, isolated subjects, centered, no shadow',
71
- /**
72
- * 最终是否需要透明:true 为独立元素,false 为不透明牌面/场景。
73
- * automatic:整板由工具交付透明,切分后保留,不重复去背。
74
- * chroma:保留色幕中间图,切分后逐格去背;仅限主文第 3 节明确选择的流程。
75
- */
76
- removeBg: true,
77
- backgroundMode: 'automatic',
78
- /** 独立色幕才使用;按主体颜色选择,金/黄/橙/绿用蓝幕,蓝/紫用绿幕。 */
79
- chromaColor: '#00FF00',
80
- chromaTolerance: 25,
81
-
82
- /**
83
- * 切分单元尺寸(像素)。留空(null)= 自动按精灵图实际像素尺寸 ÷ 网格推导(推荐)。
84
- * 仅当模型输出的格子并非均匀均分、需要手动指定时才填写。
85
- * ⚠️ 不要写死 256:4K 精灵图按 256 切分会严重错位。
86
- */
87
- cellWidth: null,
88
- cellHeight: null,
89
- /** 帧间距(像素),默认 0 */
90
- padding: 0,
91
- };
92
-
93
- // ============ DATA — 分批定义元素 ============
94
- // 规则:每批 ≤ CONFIG.columns × CONFIG.rows 个元素
95
- // 每个元素必须有 name(输出文件名)和 desc(精灵图中该格的内容描述)
96
- const BATCHES = [
97
- {
98
- sheetName: 'sheet_batch_1',
99
- items: [
100
- { name: 'item_01', desc: '<格 1 内容描述>' },
101
- { name: 'item_02', desc: '<格 2 内容描述>' },
102
- { name: 'item_03', desc: '<格 3 内容描述>' },
103
- { name: 'item_04', desc: '<格 4 内容描述>' },
104
- // 最多 CONFIG.columns × CONFIG.rows 个
105
- ],
106
- },
107
- {
108
- sheetName: 'sheet_batch_2',
109
- items: [
110
- { name: 'item_05', desc: '<格 5 内容描述>' },
111
- { name: 'item_06', desc: '<格 6 内容描述>' },
112
- // ...
113
- ],
114
- },
115
- // 继续添加批次...
116
- ];
117
-
118
- // ============ 精灵图 Prompt 构建器 ============
119
- /**
120
- * 根据 items 列表构建精灵图网格 prompt
121
- * 描述网格布局,避免重绘边框或格子标签。
122
- */
123
- /**
124
- * 读取精灵图实际像素尺寸(用于自动推导切分单元尺寸)。
125
- * 失败返回 null,由调用方决定是否中止该批次。
126
- */
127
- function readSheetDims(sheetPath) {
128
- try {
129
- const out = playcraft(['image', 'info', '--input', sheetPath, '--json'], { capture: true });
130
- const meta = JSON.parse(out.slice(out.indexOf('{')));
131
- if (typeof meta.width === 'number' && typeof meta.height === 'number') {
132
- return { width: meta.width, height: meta.height };
133
- }
134
- } catch {
135
- // fall through → null
136
- }
137
- return null;
138
- }
139
-
140
- function buildSpriteSheetPrompt(items, columns, config) {
141
- const actualRows = Math.ceil(items.length / columns);
142
- const cellDescs = items.map((item, i) => {
143
- const col = (i % columns) + 1;
144
- const row = Math.floor(i / columns) + 1;
145
- return `[Row${row},Col${col}]: ${item.desc}`;
146
- }).join('; ');
147
-
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.';
155
-
156
- return [
157
- `Sprite sheet grid layout, ${columns} columns × ${actualRows} rows.`,
158
- `Each cell contains one element. Cell contents: ${cellDescs}.`,
159
- bgInstruction,
160
- `Grid layout, uniform cell size, equal spacing, elements perfectly centered in each cell.`,
161
- `No borders between cells, no labels, no numbers on cells.`,
162
- config.style,
163
- ].filter(Boolean).join(' ');
164
- }
165
-
166
- // ============ LOGIC — 通常不需要修改 ============
167
-
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
- }
175
- mkdirSync(CONFIG.sheetDir, { recursive: true });
176
- mkdirSync(CONFIG.outputDir, { recursive: true });
177
- mkdirSync('ta-workspace/logs', { recursive: true });
178
-
179
- function log(msg) {
180
- const line = `[${new Date().toISOString()}] ${msg}`;
181
- console.log(line);
182
- appendFileSync(LOG_FILE, line + '\n');
183
- }
184
-
185
- const totalElements = BATCHES.reduce((s, b) => s + b.items.length, 0);
186
- log(`=== Batch Sprite Generation Start ===`);
187
- log(`Total: ${BATCHES.length} batches, ${totalElements} elements`);
188
- log(`Model: ${CONFIG.model}`);
189
-
190
- let doneBatches = 0, failedBatches = 0;
191
-
192
- for (let bi = 0; bi < BATCHES.length; bi++) {
193
- const batch = BATCHES[bi];
194
- const sheetPath = `${CONFIG.sheetDir}/${batch.sheetName}.png`;
195
-
196
- // ── Step 1: 生成精灵图(幂等跳过)────────────────────────────────
197
- if (existsSync(sheetPath)) {
198
- log(`[SKIP-SHEET] (${bi + 1}/${BATCHES.length}) ${batch.sheetName} already exists`);
199
- } else {
200
- log(`[GEN-SHEET ] (${bi + 1}/${BATCHES.length}) Generating ${batch.sheetName} (${batch.items.length} elements)`);
201
- const prompt = buildSpriteSheetPrompt(batch.items, CONFIG.columns, CONFIG);
202
-
203
- try {
204
- playcraft(
205
- [
206
- 'tools', 'generate-image',
207
- '--prompt', prompt,
208
- '--output', sheetPath,
209
- '--aspect-ratio', CONFIG.aspectRatio,
210
- '--image-model', CONFIG.model,
211
- CONFIG.removeBg && CONFIG.backgroundMode === 'automatic'
212
- ? '--remove-background' : '--no-remove-background',
213
- ],
214
- );
215
- log(`[OK-SHEET ] ${batch.sheetName}`);
216
- } catch (e) {
217
- log(`[FAIL-SHEET] ${batch.sheetName}: ${e.message?.slice(0, 200)}`);
218
- failedBatches++;
219
- continue;
220
- }
221
- }
222
-
223
- // ── Step 2: sprite-split 切分精灵图 ──────────────────────────────
224
- const actualRows = Math.ceil(batch.items.length / CONFIG.columns);
225
- // 检查第一个切分结果是否已存在(幂等)
226
- const firstItemPath = `${CONFIG.outputDir}/${batch.items[0]?.name}.png`;
227
- if (batch.items[0] && existsSync(firstItemPath)) {
228
- log(`[SKIP-SPLIT] ${batch.sheetName} already split`);
229
- doneBatches++;
230
- continue;
231
- }
232
-
233
- // 切分单元尺寸:优先用 CONFIG 显式值;否则按精灵图实际像素尺寸 ÷ 网格自动推导。
234
- // ⚠️ 绝不写死 256——4K 精灵图按 256 切分会严重错位(test11 类事故)。
235
- const padding = CONFIG.padding ?? 0;
236
- let cellWidth = CONFIG.cellWidth;
237
- let cellHeight = CONFIG.cellHeight;
238
- if (cellWidth == null || cellHeight == null) {
239
- const dims = readSheetDims(sheetPath);
240
- if (!dims) {
241
- log(
242
- `[FAIL-SPLIT] ${batch.sheetName}: 无法读取精灵图尺寸,请在 CONFIG 显式设置 cellWidth/cellHeight`,
243
- );
244
- failedBatches++;
245
- continue;
246
- }
247
- // 去掉帧间距后按网格均分
248
- cellWidth ??= Math.floor((dims.width - padding * (CONFIG.columns - 1)) / CONFIG.columns);
249
- cellHeight ??= Math.floor((dims.height - padding * (actualRows - 1)) / actualRows);
250
- log(
251
- `[CELL-SIZE ] ${batch.sheetName}: sheet ${dims.width}×${dims.height} → cell ${cellWidth}×${cellHeight} (grid ${CONFIG.columns}×${actualRows}, padding ${padding})`,
252
- );
253
- }
254
- if (!(cellWidth > 0 && cellHeight > 0)) {
255
- log(`[FAIL-SPLIT] ${batch.sheetName}: 推导出的 cell 尺寸非法 (${cellWidth}×${cellHeight})`);
256
- failedBatches++;
257
- continue;
258
- }
259
-
260
- log(`[SPLIT ] Splitting ${batch.sheetName} (${CONFIG.columns}×${actualRows}, cell ${cellWidth}×${cellHeight})`);
261
- const splitDir = `ta-workspace/tmp/${batch.sheetName}`;
262
-
263
- try {
264
- playcraft([
265
- 'image', 'sprite-split',
266
- '--input', sheetPath,
267
- '--output-dir', splitDir,
268
- '--rows', String(actualRows),
269
- '--columns', String(CONFIG.columns),
270
- '--frame-width', String(cellWidth),
271
- '--frame-height', String(cellHeight),
272
- '--padding', String(padding),
273
- ]);
274
- } catch (e) {
275
- log(`[FAIL-SPLIT] ${batch.sheetName}: ${e.message?.slice(0, 200)}`);
276
- failedBatches++;
277
- continue;
278
- }
279
-
280
- // ── Step 3: 保留自动透明结果;独立色幕才逐格去背 ────────────────
281
- // 任何缺帧 / 处理失败都视为该批次失败(FAIL,不是 WARN):一个不完整的
282
- // 批次绝不能被报成 OK-BATCH,否则下游会拿到缺图的资产集。
283
- const removeCellBackground = CONFIG.removeBg && CONFIG.backgroundMode === 'chroma';
284
- log(`[RENAME ] Renaming ${batch.items.length} cells${removeCellBackground ? ' + remove-background' : ''}`);
285
- let processedOk = 0;
286
- let batchFailed = false;
287
- for (let j = 0; j < batch.items.length; j++) {
288
- const item = batch.items[j];
289
- const row = Math.floor(j / CONFIG.columns);
290
- const col = j % CONFIG.columns;
291
- // sprite-split 默认命名:frame_r{row}_c{col}.png(0-indexed)
292
- const srcPath = `${splitDir}/frame_r${row}_c${col}.png`;
293
- const dstPath = `${CONFIG.outputDir}/${item.name}.png`;
294
-
295
- if (!existsSync(srcPath)) {
296
- log(`[FAIL-CELL ] Expected cell not found: ${srcPath} (item ${item.name}, index ${j}/${batch.items.length})`);
297
- batchFailed = true;
298
- continue;
299
- }
300
- try {
301
- if (removeCellBackground) {
302
- // 只处理独立色幕,保留常规工具已经交付的透明边缘。
303
- playcraft([
304
- 'image', 'remove-background',
305
- '--input', srcPath,
306
- '--output', dstPath,
307
- '--tolerance', String(CONFIG.chromaTolerance),
308
- ]);
309
- } else {
310
- copyFileSync(srcPath, dstPath);
311
- }
312
- processedOk++;
313
- } catch (e) {
314
- log(`[FAIL-CELL ] Failed to process ${srcPath} → ${dstPath}: ${e.message?.slice(0, 120)}`);
315
- batchFailed = true;
316
- }
317
- }
318
-
319
- if (batchFailed) {
320
- log(`[FAIL-BATCH] (${bi + 1}/${BATCHES.length}) ${batch.sheetName} → only ${processedOk}/${batch.items.length} cells OK (see FAIL-CELL above)`);
321
- failedBatches++;
322
- } else {
323
- log(`[OK-BATCH ] (${bi + 1}/${BATCHES.length}) ${batch.sheetName} → ${batch.items.length} files`);
324
- doneBatches++;
325
- }
326
- }
327
-
328
- log(`\n=== Complete: Done=${doneBatches} Failed=${failedBatches}/${BATCHES.length} batches ===`);
329
- log(`Output: ${CONFIG.outputDir}`);
330
- if (failedBatches > 0) {
331
- log('Re-run to retry failed batches (successful batches will be skipped)');
332
- process.exit(1);
333
- }
@@ -1,95 +0,0 @@
1
- // ============================================================
2
- // gen-batch.template.mjs — 批量 AI (Artificial Intelligence, 人工智能) 生图脚本模板
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 { execFileSync } from 'child_process';
12
- import { existsSync, mkdirSync, appendFileSync } from 'fs';
13
-
14
- // ============ CONFIG — 修改这里 ============
15
- const CONFIG = {
16
- /**
17
- * 生图模型。
18
- * 先 list-image-models,再填写本次实际模型;普通素材优先 Image 2.5。
19
- * 用户或制作流程锁定其他模型时保留其选择。
20
- * 参考图要求模型支持 text+image 或 image→image。
21
- */
22
- model: 'iegg-litellm/gpt-image-2.5-sunburst',
23
- /** 概念图路径(确认过风格的样本,所有后续图的参考来源) */
24
- referenceImage: 'assets/images/concept/approved_sample.png',
25
- /** 输出目录 */
26
- outputDir: 'assets/images/batch',
27
- /** 图片比例 */
28
- aspectRatio: '1:1',
29
- /**
30
- * 统一风格描述(从 design-brief.md 复制,粘贴到每个 prompt 末尾)
31
- * 示例:"flat 2D icon, vibrant colors, clean edges, no shadow"
32
- */
33
- style: '<从 design-brief 复制的统一风格描述>',
34
- /** 最终透明设 true;完整场景或不透明牌面设 false。独立色幕使用精灵图模板。 */
35
- removeBackground: true,
36
- };
37
- // ============ DATA — 定义要生成的素材列表 ============
38
- const ITEMS = [
39
- { name: 'item_01', desc: '<素材描述 1>' },
40
- { name: 'item_02', desc: '<素材描述 2>' },
41
- // 继续添加...
42
- ];
43
- // ============ LOGIC — 通常不需要修改 ============
44
-
45
- const LOG_FILE = 'ta-workspace/logs/gen-batch.log';
46
- mkdirSync(CONFIG.outputDir, { recursive: true });
47
- mkdirSync('ta-workspace/logs', { recursive: true });
48
-
49
- function log(msg) {
50
- const line = `[${new Date().toISOString()}] ${msg}`;
51
- console.log(line);
52
- appendFileSync(LOG_FILE, line + '\n');
53
- }
54
-
55
- log(`=== Batch Generation Start ===`);
56
- log(`Total: ${ITEMS.length} | Model: ${CONFIG.model}`);
57
-
58
- let done = 0, skipped = 0, failed = 0;
59
- const failures = [];
60
-
61
- for (let i = 0; i < ITEMS.length; i++) {
62
- const item = ITEMS[i];
63
- const outPath = `${CONFIG.outputDir}/${item.name}.png`;
64
-
65
- if (existsSync(outPath)) {
66
- log(`[SKIP] (${i + 1}/${ITEMS.length}) ${item.name}`);
67
- skipped++;
68
- continue;
69
- }
70
-
71
- log(`[GEN ] (${i + 1}/${ITEMS.length}) ${item.name}`);
72
-
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);
81
-
82
- try {
83
- execFileSync('playcraft', args, { stdio: 'inherit' });
84
- done++;
85
- log(`[OK ] ${item.name}`);
86
- } catch (e) {
87
- log(`[FAIL] ${item.name}: ${e.message?.slice(0, 100)}`);
88
- failures.push(item.name);
89
- failed++;
90
- }
91
- }
92
-
93
- log(`\n=== Complete: Done=${done} Skipped=${skipped} Failed=${failed}/${ITEMS.length} ===`);
94
- if (failures.length > 0) log(`Failed: ${failures.join(', ')}`);
95
- if (failed > 0) process.exit(1);