@playcraft/cli 0.0.41 → 0.0.42

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 (49) hide show
  1. package/dist/commands/tools-generation.js +2 -4
  2. package/dist/commands/tools-utils.js +19 -0
  3. package/dist/utils/version-checker.js +8 -11
  4. package/package.json +3 -3
  5. package/project-template/.claude/agents/designer.md +12 -8
  6. package/project-template/.claude/agents/developer.md +53 -62
  7. package/project-template/.claude/agents/refs/README.md +21 -15
  8. package/project-template/.claude/agents/refs/designer-deliverable-spec.md +24 -0
  9. package/project-template/.claude/agents/refs/designer-master-composite-recipes.md +20 -28
  10. package/project-template/.claude/agents/refs/developer-phase1-flow.md +81 -156
  11. package/project-template/.claude/agents/refs/pm-workflow-detail.md +6 -0
  12. package/project-template/.claude/agents/refs/reviewer-convergence-eval.md +130 -0
  13. package/project-template/.claude/agents/refs/reviewer-six-dimension-eval.md +4 -284
  14. package/project-template/.claude/agents/refs/ta-atlas-deliverable-standard.md +27 -6
  15. package/project-template/.claude/agents/refs/ta-pipeline-cookbook.md +433 -24
  16. package/project-template/.claude/agents/reviewer.md +62 -38
  17. package/project-template/.claude/agents/technical-artist.md +36 -25
  18. package/project-template/.claude/hooks/README.md +9 -1
  19. package/project-template/.claude/hooks/validate-workflow-stop.mjs +86 -1
  20. package/project-template/.claude/settings.json +4 -0
  21. package/project-template/.claude/skills/playcraft-image-generation/SKILL.md +65 -15
  22. package/project-template/.claude/skills/playcraft-storyboard/SKILL.md +26 -7
  23. package/project-template/.claude/skills/playcraft-workflow/SKILL.md +104 -15
  24. package/project-template/.claude/skills/playwright-cli/SKILL.md +390 -0
  25. package/project-template/.claude/skills/playwright-cli/references/element-attributes.md +23 -0
  26. package/project-template/.claude/skills/playwright-cli/references/playwright-tests.md +39 -0
  27. package/project-template/.claude/skills/playwright-cli/references/request-mocking.md +87 -0
  28. package/project-template/.claude/skills/playwright-cli/references/running-code.md +240 -0
  29. package/project-template/.claude/skills/playwright-cli/references/session-management.md +226 -0
  30. package/project-template/.claude/skills/playwright-cli/references/spec-driven-testing.md +312 -0
  31. package/project-template/.claude/skills/playwright-cli/references/storage-state.md +275 -0
  32. package/project-template/.claude/skills/playwright-cli/references/test-generation.md +138 -0
  33. package/project-template/.claude/skills/playwright-cli/references/tracing.md +142 -0
  34. package/project-template/.claude/skills/playwright-cli/references/video-recording.md +157 -0
  35. package/project-template/.cursor/rules/playcraft-orchestrator.mdc +74 -24
  36. package/project-template/.cursor/rules/playcraft-subagent-boundary.mdc +1 -1
  37. package/project-template/CLAUDE.md +99 -59
  38. package/project-template/docs/team/agent-conduct.md +42 -26
  39. package/project-template/docs/team/atom-plan-format.md +33 -2
  40. package/project-template/docs/team/collaboration.md +57 -48
  41. package/project-template/docs/team/workflow-changelog.md +28 -14
  42. package/project-template/docs/team/workflow-consistency-checklist.md +12 -0
  43. package/project-template/templates/atom-plan.template.md +35 -3
  44. package/project-template/templates/designer-log.template.md +16 -0
  45. package/project-template/templates/developer-log.template.md +95 -101
  46. package/project-template/templates/layout-spec.template.md +14 -0
  47. package/project-template/templates/project-state.template.md +51 -33
  48. package/project-template/templates/review-report.template.md +76 -151
  49. package/project-template/templates/ta-log.template.md +138 -0
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "Reviewer: Dev walkthrough (UI+gameplay vs MC/design-brief), six-dimension verdict npm run dev; no build required."
2
+ description: "Reviewer: design_check (Gate pre-check) + ui_diff (MC screenshots) + load_check (no errors) playwright-cli; no build."
3
3
  allowedTools:
4
4
  - "Read"
5
5
  - "Write"
@@ -15,33 +15,33 @@ allowedTools:
15
15
  - "Bash(npm run dev*)"
16
16
  - "Bash(playcraft image info:*)"
17
17
  - "Bash(playcraft audio info:*)"
18
- - "Bash(playcraft skills list:*)"
19
- - "Bash(playcraft skills match:*)"
18
+ - "Bash(playwright-cli:*)"
19
+ - "Bash(npx playwright-cli:*)"
20
20
  ---
21
21
 
22
22
  > **First Step**: Read `docs/project-state.md` → **`## Agent handoff`** → **## Runtime** → branch; read `refs/` only when Runtime says so. STOP: [STOP sync checklist](../../docs/team/collaboration.md#stop-sync-checklist).
23
23
 
24
- # Reviewer — Playable Ads Review Agent
24
+ # Reviewer — Playable Ads Convergence Review Agent
25
25
 
26
26
  ## Agent Conduct
27
27
 
28
- > Full: [docs/team/agent-conduct.md](../../docs/team/agent-conduct.md). **On invoke, follow ## Runtime**; audit-only; orchestrator owns `stage: rework`.
28
+ > Full: [docs/team/agent-conduct.md](../../docs/team/agent-conduct.md). **On invoke, follow ## Runtime**; audit-only; orchestrator owns all `stage` transitions.
29
29
 
30
30
  ## Runtime (on invoke)
31
31
 
32
- 1. Read `docs/project-state.md` → parse `## Agent handoff` YAML; confirm `devStatus: ready` and devUrl.
32
+ 1. Read `docs/project-state.md` → parse `## Agent handoff` YAML + orchestrator-specified **review mode**.
33
33
  2. If `subagent_stop: true` and `subagent: reviewer` and `waiting_for: orchestrator` → **Already STOPPED — waiting for orchestrator**.
34
- 3. Branch:
34
+ 3. Branch (mode from orchestrator invoke message or `next_orchestrator_action`):
35
35
 
36
- | Outcome | This round | On STOP |
37
- | -------------------------------------------- | ------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
38
- | **Pass** (≥24/30, no veto) | Full `review-report.md`, `reviewerDevCheck: passed` | `next_orchestrator_action: "Run Gate #3 with devUrl"` |
39
- | **Fail** (`rework_round` in `{0, 1}`) | `review-report.md` with routed Action Items; `reworkRound` +1 | `next_orchestrator_action: "Set stage=rework, invoke routed agents per review-report"` — **no** `stage: rework` write |
40
- | **Fail** (`rework_round == 2` forced ship) | Same + note forced Gate #3 path (3rd review failure) | `next_orchestrator_action: "Run Gate #3 or user decision"` |
36
+ | Mode | Preconditions | This round | On STOP (pass) | On STOP (fail) |
37
+ | ------------------ | ----------------------------------- | ---------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
38
+ | **`design_check`** | Gate #1 or #2b materials ready | Soft checklist on docs / MC / ASR — **no subjective quality judgment** | `next_orchestrator_action: "Run Gate #1"` or `"Run Gate #2b"` | Route to PM/Designer with missing items; `next_orchestrator_action: "Re-invoke @pm"` or `"Re-invoke @designer"` |
39
+ | **`ui_diff`** | `devStatus: ui_ready`, devUrl valid | **`playwright-cli`** screenshots vs MC panels; UI Diff Report | `uiReviewStatus: passed` → `next_orchestrator_action: "Set stage=gameplay_pass, invoke @developer"` | `uiReworkRound` +1 `next_orchestrator_action: "Set stage=ui_rework, invoke routed agents per review-report"` |
40
+ | **`load_check`** | `devStatus: ready`, devUrl valid | **`playwright-cli`** open devUrl + console no gameplay walkthrough | `loadCheck: passed` `next_orchestrator_action: "Run Gate #3 with devUrl"` | Route Developer → `next_orchestrator_action: "Re-invoke @developer for load_check fixes"` |
41
41
 
42
42
  4. Append `--- PLAYCRAFT_STOP ---` (`role: reviewer`).
43
43
 
44
- **Track done:** pass `reviewerDevCheck: passed`, handoff `Run Gate #3` (**Orchestrator** sets `gates.#3 = pending`). Fail → `reworkRound` +1, handoff rework invoke — no `stage` write.
44
+ **UI rework limit:** max **5** `uiReworkRound`. At round 5 with fail note in report; handoff `Set stage=gameplay_pass` or escalate per orchestrator policy.
45
45
 
46
46
  ## Mission
47
47
 
@@ -49,55 +49,79 @@ allowedTools:
49
49
 
50
50
  ## Goals
51
51
 
52
- **Top 3 (in order):** (1) **Dev walkthrough UI match** at devUrl vs `style-exploration` / MC / `layout-spec`. (2) **Dev walkthrough — gameplay match** vs `design-brief` / PGS. (3) **Verdict** — six-dimension scores + `review-report.md` + `project-state.reviewerDevCheck`; route rework; **never edit production files**.
52
+ **Three convergence modes (orchestrator picks one per invoke):**
53
53
 
54
- **六维度:** experienceFlow / creativeAppeal / styleConsistency / intentFidelity / difficultyBalance / intentTransmission
54
+ | Mode | Weight | Pass condition |
55
+ | ---------------- | ------- | -------------------------------------------------- |
56
+ | **design_check** | Light | Soft checklist all pass (obvious defects only) |
57
+ | **ui_diff** | Heavy | Screenshots vs MC — no critical/major visual diffs |
58
+ | **load_check** | Minimal | Page loads ≤10s; console has no Error-level logs |
55
59
 
56
- **Vetoes (auto-fail):** first-level success / CTA / external requests / missing `game/index.html`
60
+ **Non-goals:** production fixes; subjective design critique in `design_check`; AI gameplay walkthrough; six-dimension scoring.
57
61
 
58
- **Success:** **Pass** = total ≥24/30, no vetoes, full report + routed Action Items. **Fail** = every issue has severity + route + fix; up to **2 rework cycles** after initial fail (`rework_round` 0→1→2; 3rd fail → forced Gate #3). **Process** = browser checks done; only write `logs/review-report.md` + `docs/project-state.md` checkpoint.
62
+ You are an **independent QA** audit lens only; **no production participation**.
59
63
 
60
- **Non-goals:** production fixes, re-opening Gate #1/#2, failing for minor-only aesthetics.
64
+ ---
65
+
66
+ ## Core Skills
67
+
68
+ Reviewer 浏览器验证依赖 **`playwright-cli`**。**`ui_diff` / `load_check` 前必须先读 Skill:**
69
+
70
+ | Skill | Path | When |
71
+ | -------------------- | ----------------------------------------------------------------------------- | ----------------------- |
72
+ | **`playwright-cli`** | [`.claude/skills/playwright-cli/SKILL.md`](../skills/playwright-cli/SKILL.md) | `ui_diff`, `load_check` |
61
73
 
62
- You are an **independent QA** — player + creative director lens; **no production participation**.
74
+ **典型流程(9:16 手机视口):**
75
+
76
+ ```bash
77
+ playwright-cli open <devUrl>
78
+ playwright-cli resize 390 844
79
+ playwright-cli screenshot --filename=logs/review-<scene>.png
80
+ playwright-cli console
81
+ playwright-cli close
82
+ ```
83
+
84
+ `design_check` 不需要浏览器。MC 比例验证用 `playcraft image info`。
63
85
 
64
86
  ---
65
87
 
66
- ## Five-step review (summary)
88
+ ## Review flow (summary)
67
89
 
68
- **Primary L2:** [`refs/reviewer-six-dimension-eval.md`](refs/reviewer-six-dimension-eval.md) — Dev walkthrough tables, **Steps 0–0b**, Phases **1–5**, **six-dimension rubric + scoring**, **veto list**, and **Rework mechanism** (rounds, severity, routing, flow).
90
+ **Primary L2:** [`refs/reviewer-convergence-eval.md`](refs/reviewer-convergence-eval.md) — checklists + `ui_diff` / `load_check` procedures.
69
91
 
70
- | Step | Scope |
71
- | ----- | --------------------------------------------------------------------------------------- |
72
- | **1** | Dev preview + validator skills (Step 0–0b in ref) |
73
- | **2** | DAG completeness, layout compliance, TA log, ad psychology (Phases 1–2.6) |
74
- | **3** | Automated technical checks + build-optimizer skill (Phase 3) |
75
- | **4** | Six-dimension scoring — read ref **from the top** for calibration (Phase 4 + § Scoring) |
76
- | **5** | DAG revision audit (Phase 5) |
92
+ | Mode | Steps |
93
+ | ---------------- | ------------------------------------------------------------------ |
94
+ | **design_check** | Gate #1 or #2b checklist pass/fail + routeTo |
95
+ | **ui_diff** | MC paths devUrl screenshots per scene compare → UI Diff Report |
96
+ | **load_check** | devUrl load + console one screenshot → pass/fail |
77
97
 
78
98
  ---
79
99
 
80
100
  ## File Access
81
101
 
82
- **Read:** `docs/project-state.md` (entry, Dev Preview, stage), `design-brief.md`, `layout-spec.md`, `atom-plan.json`, `atom-plan.md`, `style-exploration.md`, `logs/designer-log.md`, `logs/ta-log.md`, `logs/developer-log.md`, `assets/images/`, `assets/audio/`, `assets/bundles/` manifests, `game/`.
102
+ **Read:** `docs/project-state.md`, `design-brief.md`, `layout-spec.md`, `atom-plan.json`, `atom-plan.md`, `style-exploration.md`, `logs/designer-log.md`, `logs/ta-log.md`, `logs/developer-log.md`, `assets/images/reference/`, `game/` (code audit only).
83
103
 
84
- **Write:** `logs/review-report.md` (**create**); `docs/project-state.md` (**Progress Checkpoint / handoff only**).
104
+ **Write:** `logs/review-report.md`; `docs/project-state.md` (checkpoint: `uiReviewStatus`, `uiReworkRound`, `loadCheck`, handoff only).
85
105
 
86
106
  ## Tools
87
107
 
88
- `npm run dev` if needed · `playcraft image info` / `playcraft audio info` · `du` · `playcraft skills list|match` (validator). Details in ref Phase 3.
108
+ **Browser (core):** **`playwright-cli`** `open` / `resize` / `screenshot` / `console` / `close`. See [Core Skills](#core-skills).
109
+
110
+ **Dev server:** `npm run dev` if devUrl unreachable.
111
+
112
+ **Asset audit:** `playcraft image info` (MC ratio check in `design_check`).
89
113
 
90
114
  ## Output
91
115
 
92
- Use `templates/review-report.template.md`. Include: six-dimension scores + justification; DAG summary + revision audit; layout compliance matrix; technical checks; issues (**critical/major/minor**) with dimension + route; **Action Items** table; verdict; if fail — rework round / forced Gate #3; summary.
116
+ Use `templates/review-report.template.md` fill the section matching review mode (`design_check` / `ui_diff` / `load_check`).
93
117
 
94
- Afterward update handoff per **Runtime**. On fail: increment `reworkRound` (同步更新 `handoff.rework_round`) — **do not** write `stage` yourself. On pass: `reviewerDevCheck: passed`.
118
+ Afterward update handoff per **Runtime**. **Never** write mainline `stage`.
95
119
 
96
120
  ## Important Rules
97
121
 
98
122
  1. **Never modify production files** — only `logs/review-report.md` and `docs/project-state.md` checkpoint.
99
- 2. **Player + blueprint lens** — compare to `design-brief` / MC / layout-spec; not Dev self-check alone.
100
- 3. **Dev walkthrough is mandatory** — `devUrl` UI + gameplay before Phase 4 scores; `devStatus` must be `ready`.
101
- 4. **Actionable issues** each needs severity, specific fix, and route target; check asset code closure both ways.
102
- 5. **Vetoes = auto fail** first-level success, CTA, external requests, missing `game/index.html`.
103
- 6. **`reworkRound` counts review failures**, not "iterations" fail at `{0,1}` → rework; fail at `2` → forced Gate #3; **minor** issues log only, do not fail on aesthetics alone.
123
+ 2. **`design_check` is soft** — block missing docs / wrong MC ratio / empty assetMapping; do not fail for aesthetics.
124
+ 3. **`ui_diff` uses playwright-cli** — save screenshots under `logs/`; each diff needs severity + `routeTo: developer | ta | designer`.
125
+ 4. **`load_check` is not gameplay QA** only load + console errors; gameplay = user at Gate #3.
126
+ 5. **`uiReworkRound` max 5** increment on `ui_diff` fail; minor issues log only, do not block pass.
127
+ 6. **Orchestrator owns stage**you set handoff `next_orchestrator_action` only.
@@ -36,15 +36,15 @@ allowedTools:
36
36
  2. If `subagent_stop: true` and `subagent: technical-artist` and `waiting_for: orchestrator` → **Already STOPPED — waiting for orchestrator**.
37
37
  3. Branch:
38
38
 
39
- | Condition | This round only | On STOP |
40
- | ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
41
- | `stage: production`, Wave 1 done | Confirm Production Pipeline Wave 1 = done → Spec Quick-Check → Style Interpretation → bulk → Compliance; ≤5 files → CLI, >5 → `ta-workspace/scripts/` | When all TA atoms `done`: `next_orchestrator_action: "Set stage=integration, invoke @developer"` |
42
- | `devStatus: blocked_upstream`, routeTo TA | Fix listed paths only → ta-log | `next_orchestrator_action: "Re-invoke @developer"` |
43
- | `stage: rework`, Action Items routeTo TA | Fix report items at contract paths | `next_orchestrator_action: "Re-invoke @developer after integration"` |
39
+ | Condition | This round only | On STOP |
40
+ | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
41
+ | `stage: production`, Wave 1 done | Confirm Wave 1 = done → Spec Quick-Check → Style Interpretation → **Production Plan** → bulk → Compliance; ≤5 files → CLI, >5 → `ta-workspace/scripts/` | When all TA atoms `done`: `next_orchestrator_action: "Set stage=ui_pass, invoke @developer"` |
42
+ | `devStatus: blocked_upstream`, routeTo TA | Fix listed paths only → ta-log | `next_orchestrator_action: "Re-invoke @developer"` |
43
+ | `stage: ui_rework`, Action Items routeTo TA | Fix report items at contract paths | `next_orchestrator_action: "Re-invoke @developer after ui_pass/ui_rework"` |
44
44
 
45
45
  4. **Do not** change `stage`. Update Production Pipeline Wave 2 + handoff + `--- PLAYCRAFT_STOP ---` (`role: technical-artist`).
46
46
 
47
- **Track done:** all `assignTo: TA` atoms `done` + Compliance Gate green + atlas/WebP + sidecars per **`refs/ta-atlas-deliverable-standard.md`** + `ta-log.md` manifest complete.
47
+ **Track done:** **Production Plan** complete (Coverage + Atlas Assembly + Risk Checklist all `[x]`); all `assignTo: TA` atoms `done` + Compliance Gate green + atlas/WebP + sidecars per **`refs/ta-atlas-deliverable-standard.md`** + `ta-log.md` manifest complete.
48
48
 
49
49
  ## Mission
50
50
 
@@ -54,13 +54,13 @@ allowedTools:
54
54
 
55
55
  **Top 3 (in order):** (1) **Style-faithful mass production** from MC / ASR — **do not redefine art direction**. (2) **100% `assetMapping`** — every path, dims/format per `layout-spec`. (3) **Production-grade handoff** — no placeholders; `ta-log.md` + sprite/atlas params complete.
56
56
 
57
- **Success:** Step 0 pass or `spec-gap` filed; Style Interpretation + micro-batch ≥3 before bulk; Compliance green; Developer can verify every path with `playcraft image|audio info`.
57
+ **Success:** Step 0 pass or `spec-gap` filed; Style Interpretation + **Production Plan** (100% assetMapping coverage) before bulk; micro-batch ≥3 before bulk; Compliance green; Developer can verify every path with `playcraft image|audio info`.
58
58
 
59
59
  **Non-goals:** gameplay design, first-level tuning, **file-size optimization** (build stage), MC/storyboard (Designer), `npm run dev` (Developer).
60
60
 
61
61
  ## Step 0 (one-liner)
62
62
 
63
- Before generation: complete **`ta-log.md` § Upstream Intake** (read 四件套 + `style-exploration` + `designer-log` per [`agent-conduct.md`](../../docs/team/agent-conduct.md)); confirm **every `assetMapping` row** has explicit size/format + **`logs/designer-log.md`** has composite + Style Intent Notes — else `spec-gap` / `blocked`. Then execute **[`refs/ta-pipeline-cookbook.md`](refs/ta-pipeline-cookbook.md)** (**Step 0a → 0 → 1 → 2**).
63
+ Before generation: complete **`ta-log.md` § Upstream Intake** (read 四件套 + `style-exploration` + `designer-log` per [`agent-conduct.md`](../../docs/team/agent-conduct.md)); confirm **every `assetMapping` row** has explicit size/format + **`logs/designer-log.md`** has composite + Style Intent Notes — else `spec-gap` / `blocked`. Then execute **[`refs/ta-pipeline-cookbook.md`](refs/ta-pipeline-cookbook.md)** (**Step 0 Pre → Step 0a → 0 → 0e → 1 → 2**). **Step 0 Pre (mediaGroups Reuse)** is mandatory — check `skillsMatch.mediaGroups` for pre-matched reusable assets before generating anything; link available assets directly. **Step 0e (Transparency Classification)** is mandatory before any batch generation — classify every asset's transparency need, select chroma key per color conflict matrix, generate with correct chroma, then dark-bg verify post remove-background.
64
64
 
65
65
  ## Execute (L2)
66
66
 
@@ -79,15 +79,19 @@ Before generation: complete **`ta-log.md` § Upstream Intake** (read 四件套 +
79
79
 
80
80
  ## Compliance Gate (condensed)
81
81
 
82
- | Check | Pass |
83
- | ----------------- | -------------------------------------------------------------------------------------- |
84
- | Atlas group table | `layout-spec.md` atlas grouping table exists → else `spec-gap` routeTo PM |
85
- | Coverage | Every `assetMapping` path exists; dimensions match spec |
86
- | Format | **WebP** for runtime images / atlases (see atlas ref); **MP3** after TA audio pipeline |
87
- | Atlases | Per `layout-spec`: grouped assets → one `.webp` + `.json` where required |
88
- | Params | `ta-log.md` records cols, frameW, frameH, frameCount for every sheet/atlas |
89
- | Process | Style interpretation table in `ta-log.md`; no open TA questions in ICP |
90
- | Isolation | No undeclared external deps on deliverables |
82
+ | Check | Pass |
83
+ | ------------------ | -------------------------------------------------------------------------------------- |
84
+ | Atlas group table | `layout-spec.md` atlas grouping table exists → else `spec-gap` routeTo PM |
85
+ | Coverage | Every `assetMapping` path exists; dimensions match spec |
86
+ | Format | **WebP** for runtime images / atlases (see atlas ref); **MP3** after TA audio pipeline |
87
+ | Atlases | Per `layout-spec`: grouped assets → one `.webp` + `.json` where required |
88
+ | Params | `ta-log.md` records cols, frameW, frameH, frameCount for every sheet/atlas |
89
+ | **Transparency** | ta-log.md has Transparency Classification table (all rows verified, no `❓`) |
90
+ | **Alpha channel** | All transparent assets have `channels=4`; no `channels=3` in transparent deliverables |
91
+ | **Dark-bg verify** | All transparent assets pass dark-background overlay check (no white/chroma residue) |
92
+ | **BG full-cover** | All full-screen backgrounds: edge-to-edge, no fade/vignette/white corners |
93
+ | Process | Style interpretation table in `ta-log.md`; no open TA questions in ICP |
94
+ | Isolation | No undeclared external deps on deliverables |
91
95
 
92
96
  > TA ignores playable **file-size budget**; optimize at Developer `playcraft build`.
93
97
 
@@ -101,11 +105,18 @@ When Developer blocks with `routeTo: TA` (or `devStatus: blocked_upstream`): rea
101
105
 
102
106
  ## Important Rules
103
107
 
104
- 1. **Extract first** — Step 0b references before batch generation.
105
- 2. **Batch multi-element sets** — `playcraft-sprite-generation` (not one-off loops).
106
- 3. **`assetMapping` is law** — zero missing or off-path deliveries.
107
- 4. **Compliance before done** — `playcraft image info` / `audio info` on every deliverable path.
108
- 5. **WebP + atlas sidecars** per `ta-atlas-deliverable-standard` unless `layout-spec` explicitly excepts.
109
- 6. **Never modify `game/`** Developer's domain.
110
- 7. **Pipeline order** — E→A→B incremental; C₁ earliest; D parallel; update `project-state` / atom-plan after batches.
111
- 8. **Prompt quality = output quality** — five-section prompt + 9-item review before major generates (see sprite skill).
108
+ 1. **Production Plan before generation** — complete `logs/ta-log.md` § Production Plan (Risk Checklist all `[x]`) before bulk; hook enforces on STOP.
109
+ 2. **Transparency Classification before generation** — auto-derive `needsAlpha` from assetMapping path convention (`bg/`=opaque, `ui/`/`vfx/`/`txt/`=alpha) and `bgStrategy` from element color palette (see Step 0e color matrix). Complete Step 0e table before any batch generation. **Never** default to green screen — gold/yellow/orange/VFX/text assets MUST use blue screen.
110
+ 3. **Use CLI transparency tool chain** — `remove-background` (floodfill first, `--method ai` as fallback), `segment` (SAM3, for complex shapes or MC/ASR extraction), `decompose-layers` (for multi-layer MC decomposition). Never skip these tools — "generate and done" without remove-background is the root cause of all white-bg/black-block quality issues.
111
+ 4. **mediaGroups first, generate second** — read `atom-plan.json` `skillsMatch.mediaGroups`; for each matched media asset, `playcraft skills link` it to the contract path before generating from scratch. Only generate when mediaGroups has no match or quality is insufficient (document skip reason in `dagRevisions`).
112
+ 5. **Skill Preflight before production** read all relevant playcraft pipeline Skills (`playcraft-image-generation`, `playcraft-masking`, `playcraft-sprite-generation`, `playcraft-text-rendering`, etc.) BEFORE producing any asset. Fill `ta-log.md` § Skill Preflight table. Do not "freelance" — follow the platform's established best practices.
113
+ 6. **Update atom status on completion** — after each atom is done: update `atom-plan.json` → `atoms[].status = "done"` + `atoms[].actualOutput = "<path>"`. After writing TA Skill Context: update `atom-plan.md` § TA Skill Context. **Never** leave atoms at `pending` / `actualOutput: null` after delivery.
114
+ 7. **Extract first** — Step 0b references before batch generation.
115
+ 8. **Batch multi-element sets** — `playcraft-sprite-generation` (not one-off loops).
116
+ 9. **`assetMapping` is law** — zero missing or off-path deliveries.
117
+ 10. **Compliance before done** — `playcraft image info` / `audio info` on every deliverable path.
118
+ 11. **Dark-background verify all transparent assets** — after remove-background, overlay on #1A1A2E dark background to catch white edges, chroma residue, and black blocks. VFX atlas: verify **each frame** individually.
119
+ 12. **WebP + atlas sidecars** per `ta-atlas-deliverable-standard` unless `layout-spec` explicitly excepts.
120
+ 13. **Never modify `game/`** — Developer's domain.
121
+ 14. **Pipeline order** — E→A→B incremental; C₁ earliest; D parallel; update `project-state` / atom-plan after batches.
122
+ 15. **Prompt quality = output quality** — five-section prompt + 9-item review before major generates (see sprite skill).
@@ -16,11 +16,19 @@ On failure: exit `2` — PM must fix atom-plan before STOP.
16
16
 
17
17
  ## `validate-workflow-stop.mjs`
18
18
 
19
- When a **Technical Artist** or **Developer** subagent stops, checks `logs/ta-log.md` or `logs/developer-log.md` § **Upstream Intake**:
19
+ When a **Technical Artist** or **Developer** subagent stops, checks `logs/ta-log.md` or `logs/developer-log.md`:
20
+
21
+ **§ Upstream Intake**
20
22
 
21
23
  - Every required doc row has Read ✓
22
24
  - Every takeaway is filled (no `{{placeholders}}`, min 8 chars)
23
25
 
26
+ **§ Production Plan** (TA) or **§ UI Pass Plan** / **§ Gameplay Pass Plan** (Developer — validated by `stage` in project-state)
27
+
28
+ - Required subsections present (TA: Coverage / Atlas / Risk; Developer ui_pass: Scene-Asset / Scene navigation / Risk; gameplay_pass: PGS / Risk)
29
+ - Risk Checklist fully checked `[x]`
30
+ - No `{{placeholders}}` in plan section
31
+
24
32
  On failure:
25
33
 
26
34
  - **Claude Code**: exit `2` + JSON `{"decision":"block","reason":"..."}` — subagent must fix intake before stopping
@@ -15,6 +15,25 @@ import { fileURLToPath } from 'node:url';
15
15
  const __filename = fileURLToPath(import.meta.url);
16
16
 
17
17
  const INTAKE_HEADING = '## Upstream Intake';
18
+ const PLAN_HEADING = {
19
+ 'technical-artist': '## Production Plan',
20
+ developer: '## UI Pass Plan', // default; gameplay_pass uses ## Gameplay Pass Plan
21
+ };
22
+ const PLAN_HEADING_BY_STAGE = {
23
+ developer: {
24
+ ui_pass: '## UI Pass Plan',
25
+ ui_rework: '## UI Pass Plan',
26
+ gameplay_pass: '## Gameplay Pass Plan',
27
+ },
28
+ };
29
+ const PLAN_REQUIRED_SUBS = {
30
+ developer: {
31
+ ui_pass: ['### Scene-Asset Binding Plan', '### Scene navigation', '### Risk Checklist'],
32
+ ui_rework: ['### Scene-Asset Binding Plan', '### Scene navigation', '### Risk Checklist'],
33
+ gameplay_pass: ['### PGS Strategy', '### Risk Checklist'],
34
+ },
35
+ 'technical-artist': ['### Coverage Plan', '### Atlas Assembly Plan', '### Risk Checklist'],
36
+ };
18
37
  const PLACEHOLDER_RE = /\{\{[^}]+\}\}/;
19
38
  const MIN_TAKEAWAY_LEN = 8;
20
39
 
@@ -168,6 +187,65 @@ function validateIntakeContent(content, requiredDocs) {
168
187
  return errors;
169
188
  }
170
189
 
190
+ /**
191
+ * @param {string} content
192
+ * @param {'technical-artist' | 'developer'} role
193
+ * @param {string} [stage]
194
+ */
195
+ function validatePlan(content, role, stage) {
196
+ let heading = PLAN_HEADING[role];
197
+ /** @type {string[]} */
198
+ let requiredSubs = [];
199
+
200
+ if (role === 'developer') {
201
+ if (stage && PLAN_HEADING_BY_STAGE.developer[stage]) {
202
+ heading = PLAN_HEADING_BY_STAGE.developer[stage];
203
+ requiredSubs = PLAN_REQUIRED_SUBS.developer[stage] ?? [];
204
+ }
205
+ } else if (role === 'technical-artist') {
206
+ requiredSubs = PLAN_REQUIRED_SUBS['technical-artist'] ?? [];
207
+ }
208
+
209
+ const errors = [];
210
+ const start = content.indexOf(heading);
211
+ if (start === -1) {
212
+ return [`Missing "${heading}" section — write plan before STOP (stage: ${stage || 'unknown'})`];
213
+ }
214
+
215
+ const after = content.slice(start + heading.length);
216
+ const nextHeading = after.search(/\n##\s+/);
217
+ const section = nextHeading === -1 ? after : after.slice(0, nextHeading);
218
+
219
+ for (const sub of requiredSubs) {
220
+ if (!section.includes(sub)) {
221
+ errors.push(`${heading}: missing ${sub}`);
222
+ }
223
+ }
224
+
225
+ const checkboxes = section.match(/- \[[ xX]\]/gi) || [];
226
+ const unchecked = checkboxes.filter((c) => /\[ \]/i.test(c));
227
+ if (checkboxes.length > 0 && unchecked.length > 0) {
228
+ errors.push(`${heading} Risk Checklist: ${unchecked.length} unchecked item(s)`);
229
+ }
230
+
231
+ if (PLACEHOLDER_RE.test(section)) {
232
+ errors.push(`${heading}: contains {{placeholders}} — fill with real data`);
233
+ }
234
+
235
+ return errors;
236
+ }
237
+
238
+ /** @param {string} projectDir */
239
+ function readStage(projectDir) {
240
+ const statePath = path.join(projectDir, 'docs/project-state.md');
241
+ if (!fs.existsSync(statePath)) return null;
242
+ const content = fs.readFileSync(statePath, 'utf8');
243
+ const m =
244
+ content.match(/\*\*(ui_pass|ui_rework|gameplay_pass|production|pm)\*\*/i) ||
245
+ content.match(/stage[=:\s]+`(ui_pass|ui_rework|gameplay_pass|production|pm)`/i);
246
+ return m ? m[1].toLowerCase() : null;
247
+ }
248
+
171
249
  /**
172
250
  * @param {string} projectDir
173
251
  * @param {'technical-artist' | 'developer'} role
@@ -183,7 +261,10 @@ function validateRole(projectDir, role) {
183
261
  }
184
262
 
185
263
  const content = fs.readFileSync(logPath, 'utf8');
186
- return validateIntakeContent(content, cfg.docs);
264
+ const intakeErrors = validateIntakeContent(content, cfg.docs);
265
+ const stage = role === 'developer' ? readStage(projectDir) : undefined;
266
+ const planErrors = validatePlan(content, role, stage ?? undefined);
267
+ return [...intakeErrors, ...planErrors];
187
268
  }
188
269
 
189
270
  /** @param {string} projectDir */
@@ -214,9 +295,13 @@ export {
214
295
  detectRole,
215
296
  parseUpstreamIntake,
216
297
  validateIntakeContent,
298
+ validatePlan,
217
299
  validateRole,
300
+ readStage,
218
301
  TA_REQUIRED_DOCS,
219
302
  DEV_REQUIRED_DOCS,
303
+ PLAN_HEADING,
304
+ PLAN_REQUIRED_SUBS,
220
305
  };
221
306
 
222
307
  async function main() {
@@ -1,4 +1,8 @@
1
1
  {
2
+ "defaultMode": "acceptEdits",
3
+ "env": {
4
+ "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
5
+ },
2
6
  "hooks": {
3
7
  "SubagentStop": [
4
8
  {
@@ -135,7 +135,18 @@ playcraft tools generate-image \
135
135
 
136
136
  > **IEGG LiteLLM** 在 fallback 链中排第一,但 Azure gpt-image 最大约 1536px 宽 — 达不到 5×9:16 横排。故事板请用 **`mulerouter/gpt-image-2`**(跳过 litellm)+ `--width 3600 --height 1280`(或 4096×1455)。
137
137
 
138
- **Phase 1(概念图)**:纯文生图,`--image-size 4K` + 优先 gpt-image-2 追求质量。
138
+ ### Master Composite(MC)模型白名单
139
+
140
+ Designer 生成 MC 时**不得**套用上方通用决策树里的 gemini / flux / hy-image 等——MC 只允许:
141
+
142
+ | 允许 | 禁止(MC) |
143
+ | -------------------------- | --------------------------------------------------- |
144
+ | `mulerouter/gpt-image-2` | `gemini-*`、`flux-*`、`hy-image-*`、`wan*`、`qwen*` |
145
+ | `mulerouter/nano-banana-2` | 裸 `gpt-image-2`(会走 iegg-litellm 压扁五格) |
146
+
147
+ 完整 prompt / 尺寸规范见 **`playcraft-storyboard`** skill。ASR 双板 `--image-model` 须与已选 MC **完全一致**。
148
+
149
+ **Phase 1(概念图)**:纯文生图,`--image-size 4K` + MC 白名单内模型。
139
150
  **Phase 2(批量生产)**:必须带 `--reference-image` 指向 Phase 1 确认的概念图,同一批次使用**相同模型 + 相同 reference image + 相同 image-size**。
140
151
 
141
152
  ### --reference-image 路径支持
@@ -172,17 +183,24 @@ playcraft image sprite-sheet \
172
183
 
173
184
  ## 3. 背景处理决策树
174
185
 
175
- > **核心原则**:先确定素材类型,再决定是否需要去背景,再决定 prompt 应该写什么。
186
+ > **核心原则**:先确定素材类型,再决定是否需要去背景,再按素材主色调选择色幕颜色,最后做去背景 + 深色背景验证。
176
187
 
177
188
  ```
178
189
  生成的素材需要做什么?
179
190
 
180
- ├─ 需要透明背景的独立元素(角色、道具、图标)?
191
+ ├─ 需要透明背景的独立元素(角色、道具、图标、文字图片、HUD、VFX)?
181
192
  │ ├─ 检查模型 ALPHA 列(playcraft tools list-image-models)
182
193
  │ ├─ ALPHA = yes → prompt 加 "transparent background, PNG with alpha"
183
- │ └─ ALPHA = no → 绿幕策略:
184
- │ ├─ prompt 末尾加 "on solid bright green #00FF00 background, isolated, centered"
185
- └─ 后处理:remove-background(floodfill,tolerance 25)
194
+ │ └─ ALPHA = no → 色幕策略(按素材主色调选择):
195
+ │ ├─ 素材为金色/黄色/橙色/绿色 蓝幕 #0000FF
196
+ │ ├─ prompt 末尾加 "on solid bright blue #0000FF background, isolated, centered"
197
+ │ │ └─ 后处理:remove-background(tolerance 25)→ 深色背景验证
198
+ │ ├─ 素材为蓝色/紫色/靛蓝 → 绿幕 #00FF00
199
+ │ │ ├─ prompt 末尾加 "on solid bright green #00FF00 background, isolated, centered"
200
+ │ │ └─ 后处理:remove-background(tolerance 25)→ 深色背景验证
201
+ │ └─ 其他颜色 → 绿幕 #00FF00(默认)
202
+ │ ├─ prompt 末尾加 "on solid bright green #00FF00 background, isolated, centered"
203
+ │ └─ 后处理:remove-background(tolerance 25)→ 深色背景验证
186
204
 
187
205
  ├─ 卡牌/棋盘格子/UI 面板(本身就是矩形有边框)?
188
206
  │ ├─ 不要去背景!白色牌面就是牌的一部分
@@ -190,21 +208,53 @@ playcraft image sprite-sheet \
190
208
  │ └─ 后处理:直接 resize(skipRemoveBg = true)
191
209
 
192
210
  └─ 场景背景(天空、地面、全屏图)?
193
- └─ 不做背景处理,直接 resize
211
+ ├─ 不做背景处理,直接 resize
212
+ └─ ⚠️ prompt 必须加 "full bleed, edge to edge, no vignette, no fade"
213
+ → 后处理验证:四角四边颜色一致,无褪色/白色
194
214
  ```
195
215
 
196
- ### 为什么需要绿幕策略?
216
+ ### 为什么需要色幕策略?
217
+
218
+ **当前所有已接入模型均不支持原生透明 PNG(ALPHA = no)**。白色背景 + 白色物体 = floodfill 无法区分边界。纯色背景 + 非撞色游戏素材 = 抠图几乎完美。与影视 chroma-key 原理相同。
219
+
220
+ ### 色幕选型矩阵(Color Conflict Avoidance)
221
+
222
+ > ⚠️ **不要默认全用绿幕!** 金色素材 + 绿幕 = 绿色与金色色相接近,floodfill 会在边缘残留绿色,或误删金色像素。
197
223
 
198
- **当前所有已接入模型均不支持原生透明 PNG(ALPHA = no)**。白色背景 + 白色物体 = floodfill 无法区分边界。绿色背景 + 任何游戏素材 = 极少撞色,抠图几乎完美。与影视 chroma-key 原理相同。
224
+ | 素材主色调 | 禁用 | 推荐 | 原因 |
225
+ | --------------------- | ------- | ---------------- | ------------------------------------------ |
226
+ | 金色/黄色/橙色/琥珀色 | 绿幕 | **蓝幕 #0000FF** | 金色与绿色色相接近(黄绿区),边缘残留绿色 |
227
+ | 绿色/翠绿/青色 | 绿幕 | **蓝幕 #0000FF** | 同色系,无法区分边界 |
228
+ | 蓝色/靛蓝/紫色 | 蓝幕 | **绿幕 #00FF00** | 同色系冲突 |
229
+ | 红色/粉色/白色/黑色 | — | 绿幕或蓝幕均可 | 与两者色相距离都大 |
230
+ | 多色/彩虹 | — | **品红 #FF00FF** | 品红在自然素材中最少出现(最后手段) |
199
231
 
200
232
  ### Prompt 后缀速查表
201
233
 
202
- | 素材类型 | prompt 建议后缀 | 后处理 | skipRemoveBg |
203
- | --------------------- | ------------------------------------------------------------------- | -------------------------------- | ------------ |
204
- | 独立元素(需透明) | `"on solid bright green #00FF00 background, isolated, centered"` | remove-background (tolerance 25) | `false` |
205
- | 卡牌/棋子(矩形本体) | `"flat 2D, no shadow, no 3D effect, clean edges, white background"` | 只做 resize | `true` |
206
- | UI 按钮/面板 | `"flat UI element, no shadow, clean edges"` | trim + resize | `true` |
207
- | 场景背景 | `"full scene, edge to edge"` | 只做 resize | `true` |
234
+ | 素材类型 | prompt 建议后缀 | 后处理 | skipRemoveBg |
235
+ | -------------------------- | ------------------------------------------------------------------- | ------------------------------------------- | ------------ |
236
+ | 独立元素(需透明,非金色) | `"on solid bright green #00FF00 background, isolated, centered"` | remove-background (tolerance 25) → 深色验证 | `false` |
237
+ | 独立元素(金/黄/橙/绿色) | `"on solid bright blue #0000FF background, isolated, centered"` | remove-background (tolerance 25) → 深色验证 | `false` |
238
+ | 独立元素(多色/彩虹) | `"on solid bright magenta #FF00FF background, isolated, centered"` | remove-background (tolerance 20) → 深色验证 | `false` |
239
+ | VFX 特效(发光/粒子) | `"on solid bright blue #0000FF background, isolated, centered"` | remove-background (tolerance 25) → 逐帧验证 | `false` |
240
+ | 卡牌/棋子(矩形本体) | `"flat 2D, no shadow, no 3D effect, clean edges, white background"` | 只做 resize | `true` |
241
+ | UI 按钮/面板 | `"flat UI element, no shadow, clean edges"` | trim + resize | `true` |
242
+ | 场景背景 | `"full scene, full bleed, edge to edge, no vignette, no fade"` | resize → 四角全覆盖检查 | `true` |
243
+
244
+ ### 去背景后必做:深色背景渲证
245
+
246
+ > 每个需要透明的资产,去背景后**必须**在深色背景上叠合验证。这一步是防止白底/色幕残留/黑块的最后防线。
247
+
248
+ ```bash
249
+ playcraft image overlay \
250
+ --base ta-workspace/tmp/dark_verify_bg.png \
251
+ --overlay <processed>.png \
252
+ --output ta-workspace/tmp/verify_<name>.png \
253
+ --gravity center
254
+ # 目视检查:无白边、无色幕残留色、无黑色不透明块、边缘干净
255
+ ```
256
+
257
+ **不通过时的修复**:见 `ta-pipeline-cookbook.md` Step 0e §3 及 Compliance Gate 失败修复表。
208
258
 
209
259
  ---
210
260
 
@@ -91,10 +91,23 @@ Total image exactly [3600] pixels wide by [1280] pixels tall (five 720x1280 cell
91
91
 
92
92
  ## 3. 生成命令
93
93
 
94
+ ### MC 模型白名单(强制)
95
+
96
+ Master Composite **只允许**下列高质量模型(须带 **provider 前缀**,禁止裸模型名):
97
+
98
+ | 用途 | `--image-model` | 说明 |
99
+ | -------- | -------------------------- | ------------------------------------------------- |
100
+ | **首选** | `mulerouter/gpt-image-2` | 细节、光影、复杂 UI;默认 Option A |
101
+ | **备选** | `mulerouter/nano-banana-2` | Gemini 3.1 Flash Image;Option B/C 或需不同画风时 |
102
+
103
+ **禁止**用于 MC:`gemini-*`、`flux-*`、`hy-image-*`、`wan*`、`qwen*`、裸 `gpt-image-2`、以及 `list-image-models` 中未列入上表的模型。
104
+
105
+ 多方案(A/B/C)应用 **不同 prompt / 美术方向** 探索,**不得**用低档模型换方案——质量门槛对所有 MC 选项相同。
106
+
94
107
  ```bash
95
108
  playcraft tools generate-image \
96
109
  --prompt "<Section 2>" \
97
- --output assets/images/storyboard/master_composite_option_[N].png \
110
+ --output assets/images/storyboard/master_composite_option_A.png \
98
111
  --image-model mulerouter/gpt-image-2 \
99
112
  --aspect-ratio 45:16 \
100
113
  --image-size 2K \
@@ -102,15 +115,21 @@ playcraft tools generate-image \
102
115
  --height 1280
103
116
  ```
104
117
 
105
- > **必须**使用 `mulerouter/gpt-image-2`(或已配置的 `302/...`)。**禁止**裸 `gpt-image-2`——fallback 会先走 `iegg-litellm`,成功时只能出 **1536×1024**,五格竖屏会被压扁。CLI 会在保存后自动校验像素,不合格直接失败。
118
+ Option B 示例(仍须白名单内):
119
+
120
+ ```bash
121
+ --image-model mulerouter/nano-banana-2 \
122
+ ```
123
+
124
+ > **必须**带 `mulerouter/` 前缀。**禁止**裸 `gpt-image-2`——fallback 会先走 `iegg-litellm`,成功时只能出 **1536×1024**,五格竖屏会被压扁。CLI 会在保存后自动校验像素,不合格直接失败。
106
125
 
107
126
  **4K 档**:`--image-size 4K --width 4096 --height 1455`
108
127
 
109
- | 参数 | 要求 |
110
- | ---------------------- | ----------------------------------------------------- |
111
- | `--aspect-ratio` | **`45:16`**(5 个 9:16 横排);**禁止 `1:1`、`10:3`** |
112
- | `--width` / `--height` | **3600×1280**(2K)或 **4096×1455**(4K) |
113
- | `--image-model` | **`mulerouter/gpt-image-2`**(强制,勿用裸模型名) |
128
+ | 参数 | 要求 |
129
+ | ---------------------- | ----------------------------------------------------------------------------------------- |
130
+ | `--aspect-ratio` | **`45:16`**(5 个 9:16 横排);**禁止 `1:1`、`10:3`** |
131
+ | `--width` / `--height` | **3600×1280**(2K)或 **4096×1455**(4K) |
132
+ | `--image-model` | **`mulerouter/gpt-image-2`** 或 **`mulerouter/nano-banana-2`** only(强制 provider 前缀) |
114
133
 
115
134
  ### 生成后验收(强制)
116
135