@playcraft/cli 0.0.39 → 0.0.41

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 (121) hide show
  1. package/README.md +66 -3
  2. package/dist/atom-plan/validate-atom-plan.js +298 -0
  3. package/dist/cli-root-help.js +1 -1
  4. package/dist/commands/3d.js +363 -0
  5. package/dist/commands/create.js +337 -0
  6. package/dist/commands/fix-ids.js +17 -3
  7. package/dist/commands/fix-ids.test.js +264 -0
  8. package/dist/commands/image.js +1337 -43
  9. package/dist/commands/login.js +60 -2
  10. package/dist/commands/recommend.js +1 -1
  11. package/dist/commands/remix.js +213 -0
  12. package/dist/commands/skills.js +1379 -0
  13. package/dist/commands/tools-3d.js +473 -0
  14. package/dist/commands/tools-generation.js +454 -0
  15. package/dist/commands/tools-project.js +400 -0
  16. package/dist/commands/tools-research.js +37 -0
  17. package/dist/commands/tools-research.test.js +216 -0
  18. package/dist/commands/tools-utils.js +164 -0
  19. package/dist/commands/tools.js +7 -616
  20. package/dist/config.js +2 -0
  21. package/dist/index.js +20 -2
  22. package/dist/utils/agent-api-client.js +52 -16
  23. package/package.json +9 -3
  24. package/project-template/.claude/agents/designer.md +116 -0
  25. package/project-template/.claude/agents/developer.md +133 -0
  26. package/project-template/.claude/agents/pm.md +164 -0
  27. package/project-template/.claude/agents/refs/README.md +67 -0
  28. package/project-template/.claude/agents/refs/designer-art-style-catalog.md +533 -0
  29. package/project-template/.claude/agents/refs/designer-color-audio-recipes.md +153 -0
  30. package/project-template/.claude/agents/refs/designer-deliverable-spec.md +167 -0
  31. package/project-template/.claude/agents/refs/designer-dimension-axis.md +27 -0
  32. package/project-template/.claude/agents/refs/designer-handoff-v2-checklist.md +68 -0
  33. package/project-template/.claude/agents/refs/designer-master-composite-recipes.md +216 -0
  34. package/project-template/.claude/agents/refs/designer-style-exploration-flow.md +37 -0
  35. package/project-template/.claude/agents/refs/developer-dev-handoff.md +109 -0
  36. package/project-template/.claude/agents/refs/developer-impl-cookbook.md +134 -0
  37. package/project-template/.claude/agents/refs/developer-phase1-flow.md +211 -0
  38. package/project-template/.claude/agents/refs/pm-workflow-detail.md +545 -0
  39. package/project-template/.claude/agents/refs/reviewer-six-dimension-eval.md +286 -0
  40. package/project-template/.claude/agents/refs/ta-3d-flip-recipe.md +85 -0
  41. package/project-template/.claude/agents/refs/ta-atlas-deliverable-standard.md +46 -0
  42. package/project-template/.claude/agents/refs/ta-batch-pipeline-recipes.md +120 -0
  43. package/project-template/.claude/agents/refs/ta-image-generation-detail.md +356 -0
  44. package/project-template/.claude/agents/refs/ta-image-ops-reference.md +495 -0
  45. package/project-template/.claude/agents/refs/ta-pipeline-cookbook.md +699 -0
  46. package/project-template/.claude/agents/refs/ta-tools-reference.md +111 -0
  47. package/project-template/.claude/agents/refs/ta-vfx-preset-catalog.md +365 -0
  48. package/project-template/.claude/agents/reviewer.md +103 -0
  49. package/project-template/.claude/agents/technical-artist.md +111 -0
  50. package/project-template/.claude/hooks/README.md +36 -0
  51. package/project-template/.claude/hooks/validate-atom-plan.mjs +224 -0
  52. package/project-template/.claude/hooks/validate-workflow-stop.mjs +258 -0
  53. package/project-template/.claude/settings.json +32 -0
  54. package/project-template/.claude/settings.local.json +4 -0
  55. package/project-template/.claude/skills/playcraft-ad-psychology/SKILL.md +182 -0
  56. package/project-template/.claude/skills/playcraft-art-style-guide/SKILL.md +123 -0
  57. package/project-template/.claude/skills/playcraft-asset-state-sheet/SKILL.md +141 -0
  58. package/project-template/.claude/skills/playcraft-audio-generation/SKILL.md +280 -0
  59. package/project-template/.claude/skills/playcraft-batch-pipeline/SKILL.md +184 -0
  60. package/project-template/.claude/skills/playcraft-build-optimizer/SKILL.md +306 -0
  61. package/project-template/.claude/skills/playcraft-image-generation/SKILL.md +229 -0
  62. package/project-template/.claude/skills/playcraft-image-generation/reference/build-sprite-sheet.template.mjs +123 -0
  63. package/project-template/.claude/skills/playcraft-image-generation/reference/compare-style.template.mjs +254 -0
  64. package/project-template/.claude/skills/playcraft-image-generation/reference/gen-batch-sprite.template.mjs +235 -0
  65. package/project-template/.claude/skills/playcraft-image-generation/reference/gen-batch.template.mjs +97 -0
  66. package/project-template/.claude/skills/playcraft-image-generation/reference/gen-edit-variants.template.mjs +118 -0
  67. package/project-template/.claude/skills/playcraft-image-generation/reference/process-batch.template.mjs +137 -0
  68. package/project-template/.claude/skills/playcraft-image-generation/reference/prompt-cookbook.md +397 -0
  69. package/project-template/.claude/skills/playcraft-image-generation/reference/validate-sprite-sheet.template.mjs +296 -0
  70. package/project-template/.claude/skills/playcraft-image-ops/SKILL.md +122 -0
  71. package/project-template/.claude/skills/playcraft-masking/SKILL.md +373 -0
  72. package/project-template/.claude/skills/playcraft-research/SKILL.md +212 -0
  73. package/project-template/.claude/skills/playcraft-sprite-generation/SKILL.md +423 -0
  74. package/project-template/.claude/skills/playcraft-storyboard/SKILL.md +148 -0
  75. package/project-template/.claude/skills/playcraft-style-qa/SKILL.md +270 -0
  76. package/project-template/.claude/skills/playcraft-text-rendering/SKILL.md +236 -0
  77. package/project-template/.claude/skills/playcraft-vfx-animation/SKILL.md +130 -0
  78. package/project-template/.claude/skills/playcraft-workflow/SKILL.md +396 -0
  79. package/project-template/.cursor/hooks.json +17 -0
  80. package/project-template/.cursor/rules/playcraft-orchestrator.mdc +87 -0
  81. package/project-template/.cursor/rules/playcraft-subagent-boundary.mdc +18 -0
  82. package/project-template/CLAUDE.md +240 -0
  83. package/project-template/assets/audio/bgm/.gitkeep +0 -0
  84. package/project-template/assets/audio/sfx/.gitkeep +0 -0
  85. package/project-template/assets/bundles/.gitkeep +0 -0
  86. package/project-template/assets/images/bg/.gitkeep +0 -0
  87. package/project-template/assets/images/reference/.gitkeep +0 -0
  88. package/project-template/assets/images/storyboard/.gitkeep +0 -0
  89. package/project-template/assets/images/tiles/.gitkeep +0 -0
  90. package/project-template/assets/images/ui/.gitkeep +0 -0
  91. package/project-template/assets/images/vfx/.gitkeep +0 -0
  92. package/project-template/assets/models/.gitkeep +0 -0
  93. package/project-template/docs/team/agent-conduct.md +105 -0
  94. package/project-template/docs/team/agent-runtime-matrix.md +62 -0
  95. package/project-template/docs/team/atom-plan-format.md +74 -0
  96. package/project-template/docs/team/collaboration.md +288 -0
  97. package/project-template/docs/team/core-model.md +50 -0
  98. package/project-template/docs/team/platform-capabilities.md +15 -0
  99. package/project-template/docs/team/workflow-changelog.md +51 -0
  100. package/project-template/docs/team/workflow-consistency-checklist.md +128 -0
  101. package/project-template/game/config/.gitkeep +0 -0
  102. package/project-template/game/gameplay/.gitkeep +0 -0
  103. package/project-template/game/scenes/.gitkeep +0 -0
  104. package/project-template/logs/.gitkeep +0 -0
  105. package/project-template/ta-workspace/logs/.gitkeep +0 -0
  106. package/project-template/ta-workspace/scripts/.gitkeep +0 -0
  107. package/project-template/ta-workspace/tmp/.gitkeep +0 -0
  108. package/project-template/templates/atom-plan.template.json +26 -0
  109. package/project-template/templates/atom-plan.template.md +76 -0
  110. package/project-template/templates/design-brief.template.md +195 -0
  111. package/project-template/templates/design-lens-checklist.reference.md +117 -0
  112. package/project-template/templates/design-methodology.md +99 -0
  113. package/project-template/templates/designer-log.template.md +98 -0
  114. package/project-template/templates/developer-log.template.md +140 -0
  115. package/project-template/templates/five-axis-framework.md +186 -0
  116. package/project-template/templates/intent-clarifications.template.md +58 -0
  117. package/project-template/templates/layout-spec.template.md +132 -0
  118. package/project-template/templates/project-state.template.md +219 -0
  119. package/project-template/templates/review-report.template.md +166 -0
  120. package/project-template/templates/style-exploration.template.md +93 -0
  121. package/project-template/templates/ta-log.template.md +205 -0
@@ -0,0 +1,699 @@
1
+ # TA Pipeline Cookbook
2
+
3
+ > Read by Technical Artist at **production** Wave 2 entry (**Step 0a → 0 → 1 → 2** in order). **Prerequisite:** Production Pipeline Wave 1 (Designer Ph.2) = `done` — orchestrator invokes TA only after Designer wave completes.
4
+
5
+ ## Step 0a — Upstream Intake (mandatory, before Skill Discovery)
6
+
7
+ > **Purpose:** Understand what PM locked, what Designer delivered, and what Wave 1 added — without re-reading everything in four docs (PM/Designer keep them concise; narrative lives in style-exploration + designer-log).
8
+
9
+ Read each file (Read tool or shell), then fill **`logs/ta-log.md` § Upstream Intake** before any generation.
10
+
11
+ ```bash
12
+ cat docs/project-state.md # stage, gates, Pipeline waves, spec-gap
13
+ cat docs/design-brief.md # experience flow, Style Direction, gameplay — prompt + QA context
14
+ cat docs/layout-spec.md # assetMapping, atlas groups, dimensions (contract)
15
+ cat docs/atom-plan.json # assignTo: TA, dependsOn
16
+ cat docs/atom-plan.md # TA Skill Context
17
+ cat docs/style-exploration.md
18
+ cat logs/designer-log.md
19
+ ls assets/images/reference/ # MC + ASR paths
20
+ ls assets/audio/ # Designer Ph.2 raw audio (if present)
21
+ ```
22
+
23
+ | Doc | You need from it (one line in ta-log) |
24
+ | ------------------- | ---------------------------------------------------- |
25
+ | `project-state` | Current wave, blockers, `selectedMcOption` |
26
+ | `design-brief` | Hook→EndCard beats + Style Direction for completions |
27
+ | `layout-spec` | Every path you must fill + atlas groups |
28
+ | `atom-plan.json` | TA atom list + dependencies |
29
+ | `atom-plan.md` | TA Skill Context |
30
+ | `style-exploration` | Confirmed MC path + per-panel visual intent |
31
+ | `designer-log` | Handoff Pack, Style Intent Notes, ASR inventory |
32
+
33
+ **MUST NOT** start Step 0 Skill Discovery or Step 1 gap table until Upstream Intake rows are ticked.
34
+
35
+ ---
36
+
37
+ ## Step 0 (Skill Discovery) → Enrich TA Skill Context
38
+
39
+ Before executing any atom, run two rounds of Skill Discovery:
40
+
41
+ ---
42
+
43
+ ### Part A — Pipeline Skill Discovery(工作流决策)
44
+
45
+ ```bash
46
+ # Find relevant aiimage Skills for completion pipeline
47
+ playcraft skills list --category visual --json
48
+ playcraft skills match --intent "<style>,<element_type>,sprite,atlas" --json
49
+
50
+ # Find 3D Skills if needed
51
+ playcraft skills match --intent "3d,sprite,flip,render" --json
52
+
53
+ # Find validator Skills for compliance check
54
+ playcraft skills list --category validator --json
55
+ ```
56
+
57
+ ---
58
+
59
+ ### Part B — Atom Skill Recipe Read(生成参数提取)
60
+
61
+ For every atom assigned to TA with a non-empty `skillRef` in `atom-plan.json` `atoms[]`, read its generation recipe:
62
+
63
+ ```bash
64
+ # Read generation recipe from PM-assigned skillRef
65
+ # Replace <skillRef> with the atom's skillRef value (e.g., jewel_tile.aiimage)
66
+ playcraft skills scaffold <skillRef> --dry-run
67
+ ```
68
+
69
+ The scaffold output reveals the atom Skill's **Recipe** section: prompt template, aspect ratio, recommended model, variant directions. Use this as your **base prompt** for Stage A completions, then add `--reference-image` for style consistency.
70
+
71
+ **Example workflow** — atom `tile_02` has `skillRef: jewel_tile.aiimage`:
72
+
73
+ ```bash
74
+ # Step 1: Read the recipe
75
+ playcraft skills scaffold jewel_tile.aiimage --dry-run
76
+ # → Output:
77
+ # prompt: "isometric jewel tile, {color} gemstone, faceted crystal, soft glow, game UI style"
78
+ # aspectRatio: 1:1
79
+ # model: gpt-image-2
80
+ # variants: blue sapphire / red ruby / green emerald / yellow topaz
81
+
82
+ # Step 2: Generate using recipe prompt + Designer reference for style consistency
83
+ playcraft tools generate-image \
84
+ --prompt "isometric jewel tile, red ruby, faceted crystal, soft glow, game UI style" \
85
+ --reference-image assets/images/storyboard/master_composite_option_<selectedMcOption>.png \ # style anchor
86
+ --reference-image assets/images/tiles/tile_01.png \ # Designer's approved sample
87
+ --aspect-ratio 1:1 \
88
+ --image-model gpt-image-2 \ # recipe-recommended model
89
+ --output assets/images/tiles/tile_02.png
90
+ ```
91
+
92
+ **Key principle**: The atom Skill provides the **semantic description** (what the element is); `--reference-image` enforces **visual style** (how it matches this project's look). Both are necessary.
93
+
94
+ If `skillRef` is `—` or empty for an atom, skip Part B for that atom and rely on Designer's Style Intent Notes alone.
95
+
96
+ ---
97
+
98
+ ### Write findings into `docs/atom-plan.md` under `## TA Skill Context`
99
+
100
+ ```markdown
101
+ ### {{atom_id}} — {{slot_name}}
102
+
103
+ - **Production approach**: (e.g., "derive from Designer sample using reference-image")
104
+ - **Atom Skill recipe** (`skillRef: jewel_tile.aiimage`):
105
+ - Base prompt template: "isometric jewel tile, {color} gemstone, faceted crystal, soft glow"
106
+ - aspectRatio: 1:1
107
+ - Recommended model: gpt-image-2
108
+ - Variant directions: blue / red / green / yellow
109
+ - **Matched pipeline Skills**: `playcraft-sprite-sheet` — sprite frame merging workflow
110
+ - **Pipeline decision**: "generate 5 remaining tile colors using recipe prompt + master*composite_option*[X] / ASR crop reference"
111
+ - **Candidate new Skill**: `mahjong_tile_set.aiimage` — full 34-tile batch production
112
+ ```
113
+
114
+ ---
115
+
116
+ ## Step 1 (Asset Completion)
117
+
118
+ > **生图前请先阅读 `playcraft-image-generation` Skill**(包含模型选择决策树、reference-image 工作流和错误恢复策略)。
119
+
120
+ > **精灵图生产原则**:所有动画序列帧必须「单帧生成 → 去背景 → resize → sprite-sheet 合并」,严禁让 AI 直接生成网格图后切割(帧尺寸不均、无 alpha、帧出血)。详见本节末尾"Sprite Sheet Pipeline"。
121
+
122
+ ### Step 1: Map the Gap
123
+
124
+ ```bash
125
+ # Read the full expected asset list from layout-spec
126
+ cat docs/layout-spec.md # assetMapping defines EVERY file that must exist
127
+
128
+ # Check what Designer has already delivered
129
+ cat logs/designer-log.md
130
+ ls assets/images/tiles/
131
+ ls assets/images/bg/
132
+ ls assets/images/ui/
133
+ ```
134
+
135
+ Build a gap table: for each `assetMapping` entry, check if the file exists. Missing files are your production list.
136
+
137
+ ### Step 2: Identify Style Reference
138
+
139
+ ```bash
140
+ # The confirmed concept mockup is your master reference
141
+ cat docs/style-exploration.md # find confirmed option path
142
+ # e.g., assets/images/storyboard/master_composite_option_<selectedMcOption>.png
143
+
144
+ # Also use any approved samples as secondary references
145
+ ls assets/images/tiles/ # Designer's samples
146
+ ```
147
+
148
+ ### Step 3: Complete Missing Elements
149
+
150
+ **规则:超过 5 个元素 → 写 Node.js 脚本;5 个以内 → 直接命令行。**
151
+
152
+ **Prompt 来源优先级**(写 prompt 前先确认):
153
+
154
+ 1. **atom Skill recipe**(Step 0 Part B 已提取)— 有 skillRef → 用 recipe 的 prompt 模板,替换变量
155
+ 2. **Designer Style Intent Notes**(`logs/designer-log.md`)— 无 skillRef 或 recipe 不够具体 → 从 Style Intent Notes 提炼
156
+ 3. **design-brief StyleDirection** — 兜底,最通用
157
+
158
+ **少量元素(逐个生成)**:
159
+
160
+ ```bash
161
+ # prompt = atom Skill recipe 模板(已在 TA Skill Context 中提取)+ Designer style notes
162
+ playcraft tools generate-image \
163
+ --prompt "<recipe base prompt, e.g.: isometric jewel tile, red ruby, faceted crystal, soft glow, game UI style>" \
164
+ --reference-image assets/images/storyboard/master_composite_option_<selectedMcOption>.png \ # 风格锚定
165
+ --reference-image assets/images/tiles/<designer_sample>.png \ # Designer 样本(若有)
166
+ --output assets/images/tiles/<new_element>.png \
167
+ --aspect-ratio 1:1 \
168
+ --image-model <recipe recommended model, e.g.: gpt-image-2>
169
+ ```
170
+
171
+ **批量元素(10+ 个)→ 必须用 ta-workspace 脚本**:
172
+
173
+ ```javascript
174
+ // Write this to ta-workspace/scripts/gen-elements.mjs, then run: node ta-workspace/scripts/gen-elements.mjs
175
+ import { execSync } from "child_process";
176
+ import { existsSync, mkdirSync } from "fs";
177
+
178
+ // MODEL: from atom Skill recipe (Step 0 Part B) or fallback to gemini-flash
179
+ const MODEL = "google/gemini-3.1-flash-image-preview";
180
+ const REF =
181
+ "assets/images/storyboard/master_composite_option_<selectedMcOption>.png";
182
+ const REF2 = "assets/images/tiles/<designer_sample>.png"; // Designer approved sample (add if available)
183
+ const OUT = "assets/images/tiles";
184
+
185
+ // STYLE: atom Skill recipe base prompt (from TA Skill Context in atom-plan.md)
186
+ // e.g., "isometric jewel tile, {color} gemstone, faceted crystal surface, soft glow, game UI style"
187
+ // Replace {color} / {variant} per element
188
+ const BASE_PROMPT = "<atom Skill recipe base prompt from TA Skill Context>";
189
+
190
+ const ELEMENTS = [
191
+ { name: "element_01", variant: "<specific variant, e.g.: blue sapphire>" },
192
+ { name: "element_02", variant: "<specific variant, e.g.: red ruby>" },
193
+ // ... all elements to generate, using recipe variant directions
194
+ ];
195
+
196
+ mkdirSync(OUT, { recursive: true });
197
+ let done = 0,
198
+ skipped = 0,
199
+ failed = 0;
200
+
201
+ for (const el of ELEMENTS) {
202
+ const outPath = `${OUT}/${el.name}.png`;
203
+ if (existsSync(outPath)) {
204
+ console.log(`[SKIP] ${el.name}`);
205
+ skipped++;
206
+ continue;
207
+ }
208
+
209
+ console.log(`[GEN ] ${el.name}`);
210
+ // prompt = BASE_PROMPT with variant filled in + Designer style anchor via --reference-image
211
+ const prompt = BASE_PROMPT.replace("{variant}", el.variant).replace(
212
+ "{color}",
213
+ el.variant,
214
+ );
215
+ try {
216
+ execSync(
217
+ `playcraft tools generate-image` +
218
+ ` --prompt "${prompt}"` +
219
+ ` --output "${outPath}" --aspect-ratio 1:1` +
220
+ ` --reference-image "${REF}"` +
221
+ (existsSync(REF2) ? ` --reference-image "${REF2}"` : "") +
222
+ ` --image-model "${MODEL}"` +
223
+ ` --timeout 120`,
224
+ { stdio: "inherit" },
225
+ );
226
+ done++;
227
+ } catch (e) {
228
+ console.error(`[FAIL] ${el.name}:`, e.message);
229
+ failed++;
230
+ }
231
+ }
232
+ console.log(`Done: ${done} | Skipped: ${skipped} | Failed: ${failed}`);
233
+ if (failed > 0) process.exit(1);
234
+ ```
235
+
236
+ **Same-type elements → same model + same reference → consistent style.**
237
+
238
+ **结构相似变体(卡牌/棋子/图标集)→ Edit 模型路径**:
239
+
240
+ 当元素结构相同、只改局部(换花色、换数字、换颜色)时,Edit 模型路径比重新生成更快且局部一致性更强:
241
+
242
+ ```
243
+ Phase 1:高质量模型生成 1 张完美基图
244
+ → gpt-image-2 / gemini-flash(反复生成直到满意)
245
+
246
+ Phase 2:用参考图 + prompt 批量生成变体
247
+ → 任何 text+image 或 image→image 模型均支持 --reference-image
248
+ → 将基图作为 --reference-image,prompt 中描述变体差异
249
+ ```
250
+
251
+ 使用脚本模板:
252
+
253
+ ```bash
254
+ cp .claude/skills/playcraft-image-generation/reference/gen-edit-variants.template.mjs \
255
+ ta-workspace/scripts/gen-<name>-variants.mjs
256
+ # 修改 CONFIG.baseImage / CONFIG.editModel / VARIANTS[] 后运行
257
+ node ta-workspace/scripts/gen-<name>-variants.mjs
258
+ ```
259
+
260
+ ### Step 4: Process Assets(去背景 + resize + 验证)
261
+
262
+ > **先判断素材类型,再决定是否需要去背景**(参见 playcraft-image-generation Skill 4.5 节背景处理决策树)
263
+
264
+ **卡牌 / 棋子 / UI 面板(矩形本体,不需要透明背景)**:
265
+
266
+ ```bash
267
+ # 直接 resize,不做去背景(白色牌面就是牌的一部分!)
268
+ playcraft image resize --input <file>.png --output <file>.png --width <W> --height <H> --fit contain
269
+ ```
270
+
271
+ 批量处理使用 `process-batch.template.mjs` 并设置 `CONFIG.skipRemoveBg = true`。
272
+
273
+ **独立元素(角色/道具/图标,需要透明背景)→ 绿幕策略**:
274
+
275
+ 生图时 prompt 末尾加 `"on solid bright green #00FF00 background, isolated, centered"`(当前所有模型 ALPHA = no,无原生透明输出),然后:
276
+
277
+ ```bash
278
+ # 绿幕抠图(tolerance=25 对绿色效果最好)
279
+ playcraft image remove-background --input in.png --output out.png --tolerance 25
280
+ ```
281
+
282
+ **批量处理 → ta-workspace 脚本模板**:
283
+
284
+ ```bash
285
+ cp .claude/skills/playcraft-image-generation/reference/process-batch.template.mjs \
286
+ ta-workspace/scripts/process-<name>.mjs
287
+ # 修改 CONFIG(特别是 skipRemoveBg 和 removeBgTolerance)后运行
288
+ node ta-workspace/scripts/process-<name>.mjs
289
+ ```
290
+
291
+ ---
292
+
293
+ ## Step 2 (Technical Production Pipeline)
294
+
295
+ ### Pipeline Selection — 先判断再动手
296
+
297
+ **Before choosing any specific pipeline, analyze the task's nature.**
298
+
299
+ | Task Nature | Best Pipeline | Why |
300
+ | ------------------------------------------------------------------------------------- | ------------------------------------------------------ | ------------------------------------------------- |
301
+ | **concept/mockup → generate complete asset set** | Sprite Generation (`playcraft-sprite-generation`) | AI direct generation with reference-image |
302
+ | **Structure identical, change local details only** (cards suit/rank, icon set symbol) | Edit Model Pipeline (`gen-edit-variants.template.mjs`) | 1 base image × N edits; local consistency highest |
303
+ | **Change material/texture, preserve symbols exactly** (mahjong white→ice/metal/wood) | 3D white model + texture swap | Symbols stay 100% intact as face texture |
304
+ | **Full creative restyle** (symbols also redesigned) | Sprite Remix (per-frame AI) | AI creativity needed for new symbol style |
305
+ | **Pure color/mood shift** | Image Processing (tint/blur/grayscale) | Simplest, no frame splitting needed |
306
+ | **Add animation to static elements** | `animate` presets | Built-in motion presets |
307
+ | **Add VFX effects** (explosion, sparkle) | `use-vfx` presets | Pre-built VFX sprite sheets |
308
+ | **Remix existing sprite sheet preserving grid layout** | Sprite Remix (split→regen→reassemble) | Grid topology preserved |
309
+
310
+ **Core decision rule:**
311
+
312
+ ```
313
+ Do you have a complete asset set already, or just a concept/mockup?
314
+
315
+ ├── JUST A CONCEPT → Sprite Generation pipeline (AI batch generate → smart split → assemble)
316
+
317
+ └── HAVE EXISTING ASSETS → Need to transform them
318
+
319
+ ├── Preserve symbols EXACTLY?
320
+ │ ├── YES → Can swap base material/texture?
321
+ │ │ ├── YES → 3D white model + texture swap (see ta-3d-flip-recipe.md)
322
+ │ │ └── NO → Image Processing (tint/overlay/filter)
323
+ │ │
324
+ │ └── NO (symbols also redesigned) → Sprite Remix (per-frame AI)
325
+
326
+ └── Just color/mood shift? → Image Processing (tint/blur/grayscale)
327
+ ```
328
+
329
+ ### Sprite Sheet Pipeline
330
+
331
+ **JSON 输出规则(必须了解,直接影响 Compliance Gate 和 Developer 集成):**
332
+
333
+ | 命令 | JSON 输出 | 网格参数来源 | ta-log 记录要求 |
334
+ | -------------- | ---------------- | --------------------------------------------------- | ----------------------------------------- |
335
+ | `sprite-sheet` | 自动生成 `.json` | JSON 文件本身 | 填"见 JSON" |
336
+ | `animate` | **无** | stdout `Layout: Nx × Ny \| Frame size: WxH` | **必填** columns/frameW/frameH/frameCount |
337
+ | `use-vfx` | **无** | `playcraft image list-vfx --json` 的 frames/columns | **必填** 同上 |
338
+
339
+ ```bash
340
+ # Scenario A: Generate animation frames from a static image
341
+ playcraft image animate \
342
+ --input assets/images/tiles/<element>.png \
343
+ --preset bounce # spin|bounce|pulse|shake|float|blink|swing|wobble|flip
344
+ --frames 8 \
345
+ --output assets/images/tiles/<element>_anim.png \
346
+ --columns 4
347
+ # → produces <element>_anim.png ONLY (NO JSON)
348
+ # → stdout prints: "Layout: 4x2 | Frame size: 128x128"
349
+ # → RECORD these params in ta-log.md Sprite Grid Params section immediately
350
+
351
+ # Scenario B: Merge separately generated frames (PREFERRED for animation sequences)
352
+ # Frame filenames MUST be zero-padded: f00.png, f01.png... NOT f0.png, f1.png...
353
+ # sprite-sheet sorts by filename (dictionary order): f0 < f10 < f2 without zero-padding
354
+ playcraft image sprite-sheet \
355
+ --inputs assets/images/frames/f00.png,f01.png,f02.png \
356
+ --output assets/images/tiles/<element>_sheet \
357
+ --columns 4 \
358
+ --cell-width 64 --cell-height 64
359
+ # → produces <element>_sheet.png + <element>_sheet.json (auto-generated)
360
+
361
+ # Scenario C: VFX preset sprite sheets
362
+ playcraft image list-vfx --json # shows frames + columns for each preset
363
+ playcraft image use-vfx \
364
+ --preset explosion_small \
365
+ --output assets/images/vfx/explosion.png \
366
+ --tint "#FF4400" \
367
+ --scale 1.5
368
+ # → produces explosion.png ONLY (NO JSON)
369
+ # → record from list-vfx: explosion_small has frames=8, columns=4
370
+
371
+ # Scenario D: Remix / reskin existing sprite sheet
372
+ playcraft image sprite-split \
373
+ --input assets/images/<source_sheet>.png \
374
+ --output-dir assets/images/frames_split \
375
+ --rows 4 --columns 8 --frame-width 100 --frame-height 100
376
+
377
+ playcraft image sprite-sheet \
378
+ --input-dir assets/images/frames_remix_nobg/ \
379
+ --sort name \
380
+ --output assets/images/<remixed_sheet> \
381
+ --columns 8 --cell-width 100 --cell-height 100
382
+
383
+ # Scenario E: Large batch (10+ frames) → write ta-workspace Node.js script
384
+ # See playcraft-image-generation Skill for Node.js templates.
385
+ ```
386
+
387
+ ---
388
+
389
+ ### AI 生成精灵图网格的风险警告
390
+
391
+ **严禁**让 AI 直接生成 `NxM 网格图` 后用 `sprite-split` 切割来得到动画帧。这是动画序列帧生产的错误做法:
392
+
393
+ ```
394
+ ❌ 错误做法(动画序列帧):
395
+ AI 直接生成 "4x2 grid of bouncing tile, 8 frames" 网格图
396
+ → sprite-split 切割
397
+ 失败原因:
398
+ · AI 不理解"网格约束"——每格内容大小不均匀,引擎按固定步长裁剪时错位
399
+ · 帧出血(frame bleeding)——相邻格内容互相污染边缘,padding=0 时线性过滤加剧
400
+ · 无 alpha 通道——AI 默认输出 RGB,透明区域变黑色
401
+ · 帧间视觉不一致——AI 对每格独立理解,角色比例/光照在帧间随机变化
402
+
403
+ ✅ 正确做法(动画序列帧):
404
+ 1. AI 生成单帧参考图(带绿幕背景:prompt 末尾加 "on solid bright green #00FF00 background")
405
+ 2. 去背景(remove-background --tolerance 25)→ resize(统一到精确尺寸)
406
+ 3. 对每帧执行步骤 1-2(同模型 + 同 reference,保证风格一致)
407
+ 4. sprite-sheet 合并(几何精确 + 自动输出 JSON)
408
+
409
+ 例外(静态元素集,不是动画):
410
+ gpt-image-2 精灵图直出策略(playcraft-image-generation Skill §1.2)
411
+ 适用于:麻将牌面、扑克牌面、Match-3 元素集等「同一静态元素的变体集合」
412
+ 不适用于:动画序列帧(bounce/walk/attack 等)
413
+ ```
414
+
415
+ ---
416
+
417
+ ### 精灵图技术验证(Compliance Gate 前必做)
418
+
419
+ 每张精灵图在进入 Compliance Gate 前,必须通过技术验证。不能仅检查"文件是否存在"。
420
+
421
+ **快速手动验证(所有精灵图):**
422
+
423
+ ```bash
424
+ # 1. 数学验算:实际尺寸 = 声明的网格参数推算值
425
+ playcraft image info assets/images/tiles/tile_anim.png --json
426
+ # 验证:
427
+ # width == columns × frameWidth (animate padding 固定为 0)
428
+ # height == ceil(frameCount / columns) × frameHeight
429
+ # channels == 4 (如果是 3,说明没有 alpha 通道,透明区域会渲染为黑色)
430
+
431
+ # 2. 帧名排序警告(sprite-sheet 命令)
432
+ # sprite-sheet 按文件名字典序排帧,数字后缀必须补零对齐
433
+ # ❌ f0.png f1.png f2.png ... f10.png → 字典序: f0 f1 f10 f2(f10 排在 f2 前面!)
434
+ # ✅ f00.png f01.png f02.png ... f10.png → 正确排序
435
+ ls ta-workspace/frames/ | sort # 确认排序正确
436
+
437
+ # 3. JSON 内容验证(仅 sprite-sheet 命令输出)
438
+ cat assets/images/tiles/tile_sheet.json | python3 -m json.tool
439
+ # 验证:
440
+ # frames 中 key 数量 == frameCount
441
+ # meta.size.w/h == 实际图片尺寸
442
+ # 每个 frame.x/y/w/h 坐标覆盖了正确区域
443
+ ```
444
+
445
+ **自动化验证脚本(批量验证,推荐):**
446
+
447
+ ```bash
448
+ cp .claude/skills/playcraft-image-generation/reference/validate-sprite-sheet.template.mjs \
449
+ ta-workspace/scripts/validate-sprite-sheet.mjs
450
+ # 编辑 SHEETS 数组,填入所有精灵图的 source/columns/frameWidth/frameHeight/frameCount
451
+ node ta-workspace/scripts/validate-sprite-sheet.mjs
452
+ # → 输出每张图的通过/失败详情 + 汇总
453
+ # → 失败时 exit code = 1,将问题写入 ta-workspace/logs/sprite-validate.log
454
+ ```
455
+
456
+ **常见失败及修复:**
457
+
458
+ | 失败现象 | 原因 | 修复 |
459
+ | ---------------------- | ------------------------------------------- | --------------------------------------- |
460
+ | 实际宽度 ≠ cols×frameW | frameWidth 记录错误,或帧图片 resize 不正确 | 确认所有帧已 resize 到完全相同的 W×H |
461
+ | channels = 3 | 去背景步骤缺失或输出格式为 JPEG | 确认使用 remove-background + 输出为 PNG |
462
+ | JSON 帧数不匹配 | sprite-sheet 命令未接收到所有输入帧 | 检查 --inputs 列表是否完整 |
463
+ | 帧顺序错乱 | 文件名未补零(f1.png 排在 f10.png 后面) | 重命名帧文件:f00.png f01.png... |
464
+ | 帧内容抽查发现空帧 | 裁剪坐标超出图片范围 | 确认 padding 参数与实际生成命令一致 |
465
+
466
+ ---
467
+
468
+ ### 3D Pipeline
469
+
470
+ For material/texture swap while preserving symbols or 3D flip animations, see `refs/ta-3d-flip-recipe.md`.
471
+
472
+ **Option A: AI 3D Model Generation**
473
+
474
+ ```bash
475
+ playcraft tools generate-3d \
476
+ --input assets/images/storyboard/master_composite_option_<selectedMcOption>.png \
477
+ --output assets/models/tile \
478
+ --name tile_base
479
+
480
+ playcraft 3d info assets/models/tile_base.glb
481
+ playcraft 3d optimize \
482
+ --input assets/models/tile_base.glb \
483
+ --output assets/models/tile_base_opt.glb \
484
+ --texture-size 512
485
+ ```
486
+
487
+ **Option B: White Model + Texture (fastest)**
488
+
489
+ ```bash
490
+ playcraft tools generate-image \
491
+ --prompt "<texture description, top-down, diffuse map>" \
492
+ --output assets/textures/tile_face.png
493
+
494
+ playcraft 3d apply-texture \
495
+ --model cube \ # sphere|cube|cylinder|cone|torus|plane|capsule
496
+ --texture assets/textures/tile_face.png \
497
+ --output assets/models/tile.glb
498
+ ```
499
+
500
+ ### Image Post-Processing Pipeline
501
+
502
+ ```bash
503
+ # Standard element pipeline: Generate → Resize → Remove bg → Convert
504
+ playcraft tools generate-image --prompt "..." --output <raw>.png
505
+ playcraft image resize --input <raw>.png --output <spec>.png --width W --height H --fit contain
506
+ playcraft image remove-background --input <spec>.png --output <nobg>.png
507
+ playcraft image convert --input <nobg>.png --output <final>.webp --quality 85
508
+
509
+ # Color variants (reuse same base element)
510
+ playcraft image tint --input <base>.png --output <variant_blue>.png --color "#0055FF"
511
+ playcraft image tint --input <base>.png --output <variant_red>.png --color "#FF2200"
512
+
513
+ # Pixel art style
514
+ playcraft image pixelate --input <src>.png --output <px>.png --pixel-size 8
515
+
516
+ # Overlay (UI composite)
517
+ playcraft image overlay --base bg.png --overlay icon.png --output composite.png --x 100 --y 200
518
+ ```
519
+
520
+ ### Audio Post-Processing Pipeline
521
+
522
+ ```bash
523
+ # Compress BGM to budget
524
+ playcraft audio compress --input assets/audio/bgm/bgm.mp3 --output assets/audio/bgm/bgm.mp3
525
+
526
+ # Trim SFX to target duration
527
+ playcraft audio trim --input assets/audio/sfx/match.mp3 --output assets/audio/sfx/match.mp3 --end 1.5
528
+
529
+ # Make BGM seamlessly loopable
530
+ playcraft audio loop --input assets/audio/bgm/bgm.mp3 --output assets/audio/bgm/bgm.mp3
531
+
532
+ # Add fade out
533
+ playcraft audio fade --input assets/audio/bgm/bgm.mp3 --output assets/audio/bgm/bgm.mp3 --fade-out 2.0
534
+
535
+ # Verify
536
+ playcraft audio info --input assets/audio/bgm/bgm.mp3
537
+ ```
538
+
539
+ ---
540
+
541
+ ## TA agent workflow (L1 → L2 detail)
542
+
543
+ > **Moved from `agents/technical-artist.md`** — Spec Quick-Check through Compliance Gate, reference-image matrix, DAG edits. **Atlas/WebP defaults:** see `refs/ta-atlas-deliverable-standard.md`.
544
+
545
+ ### Step 0: Spec Quick-Check (30s)
546
+
547
+ Validate inputs before any work:
548
+
549
+ - Every `assetMapping` entry has clear size/format requirements → if gaps: `spec-gap` in project-state.md
550
+ - `logs/designer-log.md` exists with Composite path + Style Intent Notes → if missing: `blocked`
551
+
552
+ ### Step 0b: Extract Representative Samples
553
+
554
+ > **Invoke `playcraft-masking` skill** for segment/remove-background decision tree.
555
+
556
+ Designer's **ASR sheets** (UI + element state reference) contain **representative states** (2-3 per type), not full sets. Your job:
557
+
558
+ 1. From **ASR** (preferred): `crop` each state slot → `resize` to spec → these become your `--reference-image` for Stage A batch generation
559
+ 2. From **Master Composite** (fallback): extract elements not covered in ASR
560
+ 3. Check `designer-log.md` **ASR State Inventory** — note which states are covered vs which need expansion
561
+ 4. Background: generate clean bg using composite as `--reference-image`
562
+ 5. Text assets: → **invoke `playcraft-text-rendering` skill**
563
+ 6. Representative quality insufficient → ICP request to Designer for supplementary samples
564
+
565
+ **ASR 提取方法(按优先级)**:
566
+
567
+ > ⚠️ **严禁对 ASR 网格布局图使用纯 text prompt 的 segment!** 使用 `designer-log` 中的槽位坐标 + `crop`。
568
+
569
+ ```
570
+ ASR 是已知网格布局?(ui_state_sheet / element_state_sheet,行列分明)
571
+ ├─ 是 → 方法 1: crop 直切(最可靠,零歧义)
572
+ │ 1. playcraft image info --input assets/images/reference/ui_state_sheet_<X>.png → 获取尺寸
573
+ │ 2. 从 designer-log ASR State Inventory 读取行列与 bbox
574
+ │ 3. playcraft image crop --input <asr_sheet> --x <x> --y <y> --width <w> --height <h> --output <out>
575
+ │ 4. 对有背景底色的元素:crop 后再 remove-background --method floodfill
576
+
577
+ ├─ 元素位置不规则但 bbox 已知 → 方法 2: segment --boxes(精确框选)
578
+ │ segment --input <asr_sheet> --boxes '[[x1,y1,x2,y2]]' --output-dir <dir>
579
+
580
+ └─ 仅 MC 有该类型 → 方法 3: decompose-layers 或 segment --text(最后手段,见 playcraft-masking)
581
+ ```
582
+
583
+ **常见踩坑**:
584
+
585
+ - ❌ `segment --text "apple tile icon"` → SAM3 可能只切出苹果图案,丢失 tile 方块底板
586
+ - ❌ `segment --text "panda character"` → 图上有 panda face tile + panda 角色,会返回多个 instance,score 最高的不一定是你要的
587
+ - ✅ `playcraft image crop --x 50 --y 50 --width 400 --height 400` → 精确、零歧义
588
+ - ✅ `segment --boxes '[[50,50,450,450]]'` → 框选已知位置的元素
589
+
590
+ ### Step 0c: Style Interpretation Check
591
+
592
+ > **Invoke `playcraft-style-qa` skill** for methodology.
593
+
594
+ Read designer-log Style Intent Notes → write interpretation table to `ta-log.md` → confidence low = blocked, medium = proceed with caution, high = proceed.
595
+
596
+ ### Step 1: Skill Discovery
597
+
598
+ - Part A: `playcraft skills list/match` → find pipeline Skills → write to atom-plan `## TA Skill Context`
599
+ - Part B: `playcraft skills scaffold <skillRef> --dry-run` for each atom → extract prompt/model params
600
+ (See **Step 0** above for bash examples.)
601
+
602
+ ### Pipeline model (E → A → B → C → D)
603
+
604
+ ```
605
+ Gate #2 → TA starts
606
+
607
+ ├─ E: Extract (Step 0b) — decompose-layers or segment references from composites
608
+ │ │
609
+ │ ├─ C₁: generate-3d (if referenceSource="designer-sample")
610
+ │ │
611
+ │ ├─ A: Batch Element Generation (sprite sheet per type)
612
+ │ │ │
613
+ │ │ ├──→ B: animate / sprite-sheet / use-vfx
614
+ │ │ └──→ C₂: apply-texture (if referenceSource="ta-completion")
615
+ │ │
616
+ │ └─ (extraction insufficient → ICP → Designer supplementary)
617
+
618
+ ├─ D: Audio post-processing (independent, waits for Designer Ph.2 audio)
619
+
620
+ └─ All done → Compliance Gate
621
+ ```
622
+
623
+ ### Pipeline selection (quick)
624
+
625
+ | Situation | Pipeline | Skill/Ref |
626
+ | ---------------------------------- | ------------------------------- | ----------------------------- |
627
+ | Multi-element batch (>3 same type) | Sprite sheet one-shot → split | `playcraft-sprite-generation` |
628
+ | Add animation to static element | animate presets → sprite-sheet | `playcraft-vfx-animation` |
629
+ | Add VFX (glow/particle/trail) | use-vfx presets | `playcraft-vfx-animation` |
630
+ | 3D model + texture | generate-3d → apply-texture | `refs/ta-3d-flip-recipe.md` |
631
+ | Color/mood shift only | Image processing (tint/overlay) | `playcraft-image-ops` |
632
+ | Background removal | floodfill / AI / SAM3 | `playcraft-masking` |
633
+
634
+ ### Stage A: Batch Element Generation
635
+
636
+ > **Invoke the `playcraft-sprite-generation` skill** for the complete workflow.
637
+
638
+ | Step | Action | Done when |
639
+ | -------------- | -------------------------------------------------------------- | -------------------------------------------- |
640
+ | A.1 Define | Write spec (count/grid/sizes/full element list) to `ta-log.md` | List count = assetMapping count |
641
+ | A.2 Prompt | Write five-section prompt to `ta-log.md` | Follows Scene/Canvas/Set/Details/Constraints |
642
+ | A.3 Review | 9-item checklist | All pass |
643
+ | A.4 Generate | One-shot full sprite sheet | Image + .json sidecar output |
644
+ | A.5 Verify+Fix | Check each cell → fix errors with targeted regen | Error ≤ 30% fixed; >30% redo from A.2 |
645
+ | A.6 Split | Crop + replace fixes + final verify | File count = list count, dims match |
646
+
647
+ ### Stage B: Animation + VFX
648
+
649
+ > **Invoke `playcraft-vfx-animation` skill** for preset catalog, decision tree, and game-type recipes.
650
+
651
+ Triggered per Stage A output that needs animation. Output: sprite sheet with grid params recorded in `ta-log.md`.
652
+
653
+ ### Stage C: 3D Pipeline
654
+
655
+ > **Read `refs/ta-3d-flip-recipe.md`** for material reskin and 3D flip workflows.
656
+
657
+ - C₁ (referenceSource="designer-sample"): starts immediately after extraction
658
+ - C₂ (referenceSource="ta-completion"): waits for Stage A output
659
+
660
+ ### Stage D: Audio Post-Processing
661
+
662
+ Independent track, waits only for Designer Ph.2 audio delivery:
663
+
664
+ - `playcraft audio compress/trim/loop/fade` as needed per layout-spec requirements
665
+ - Record all processing in `ta-log.md`
666
+
667
+ ### Compliance Gate (full checklist)
668
+
669
+ | Check | Criteria |
670
+ | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
671
+ | All assetMapping files exist | Zero missing |
672
+ | Image dimensions match assetSpec | Exact match |
673
+ | Image format | **WebP** for runtime deliverables per `ta-atlas-deliverable-standard`; PNG/JPG only if layout-spec explicitly requires |
674
+ | Sprite / atlas grid params | In ta-log.md (cols/frameW/frameH/frameCount); `.json` beside each atlas |
675
+ | Audio format | MP3 after TA post-process |
676
+ | No external dependencies | Standalone files |
677
+ | Style Interpretation completed | ta-log.md has interpretation table |
678
+ | No open TA questions | intent-clarifications.md clear |
679
+
680
+ > **TA 阶段不管体积。** 品质和规格合规是唯一目标。体积优化在 Developer build 阶段。
681
+
682
+ **After compliance**: Write `logs/ta-log.md` manifest → mark atoms `✅ done` → update project-state.md.
683
+
684
+ ### Reference image rules
685
+
686
+ | CAPABILITY | `--reference-image` | Models |
687
+ | ------------- | ------------------- | ----------------------------------------- |
688
+ | `text+image` | ✅ optional | gpt-image-2, nano-banana-2, gemini-flash |
689
+ | `image→image` | ✅ required | qwen-image-edit-max, wan2.6-image |
690
+ | `text→image` | ❌ not supported | hy-image-lite, qwen-image-max, flux-2-pro |
691
+
692
+ **Same model for same element set** — consistency requires identical model across a batch.
693
+
694
+ ### DAG modification protocol
695
+
696
+ - Redundant atom → `⏭️ skipped`
697
+ - Missing asset → add row, assign to TA
698
+ - Direction changes → **STOP and report**
699
+ - Always append to DAG Revisions