@playcraft/cli 0.0.40 → 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.
- package/README.md +66 -3
- package/dist/atom-plan/validate-atom-plan.js +298 -0
- package/dist/cli-root-help.js +1 -1
- package/dist/commands/3d.js +363 -0
- package/dist/commands/create.js +337 -0
- package/dist/commands/image.js +1337 -43
- package/dist/commands/recommend.js +1 -1
- package/dist/commands/remix.js +213 -0
- package/dist/commands/skills.js +1379 -0
- package/dist/commands/tools-3d.js +473 -0
- package/dist/commands/tools-generation.js +454 -0
- package/dist/commands/tools-project.js +400 -0
- package/dist/commands/tools-research.js +37 -0
- package/dist/commands/tools-research.test.js +216 -0
- package/dist/commands/tools-utils.js +164 -0
- package/dist/commands/tools.js +7 -616
- package/dist/config.js +2 -0
- package/dist/index.js +19 -1
- package/package.json +9 -3
- package/project-template/.claude/agents/designer.md +116 -0
- package/project-template/.claude/agents/developer.md +133 -0
- package/project-template/.claude/agents/pm.md +164 -0
- package/project-template/.claude/agents/refs/README.md +67 -0
- package/project-template/.claude/agents/refs/designer-art-style-catalog.md +533 -0
- package/project-template/.claude/agents/refs/designer-color-audio-recipes.md +153 -0
- package/project-template/.claude/agents/refs/designer-deliverable-spec.md +167 -0
- package/project-template/.claude/agents/refs/designer-dimension-axis.md +27 -0
- package/project-template/.claude/agents/refs/designer-handoff-v2-checklist.md +68 -0
- package/project-template/.claude/agents/refs/designer-master-composite-recipes.md +216 -0
- package/project-template/.claude/agents/refs/designer-style-exploration-flow.md +37 -0
- package/project-template/.claude/agents/refs/developer-dev-handoff.md +109 -0
- package/project-template/.claude/agents/refs/developer-impl-cookbook.md +134 -0
- package/project-template/.claude/agents/refs/developer-phase1-flow.md +211 -0
- package/project-template/.claude/agents/refs/pm-workflow-detail.md +545 -0
- package/project-template/.claude/agents/refs/reviewer-six-dimension-eval.md +286 -0
- package/project-template/.claude/agents/refs/ta-3d-flip-recipe.md +85 -0
- package/project-template/.claude/agents/refs/ta-atlas-deliverable-standard.md +46 -0
- package/project-template/.claude/agents/refs/ta-batch-pipeline-recipes.md +120 -0
- package/project-template/.claude/agents/refs/ta-image-generation-detail.md +356 -0
- package/project-template/.claude/agents/refs/ta-image-ops-reference.md +495 -0
- package/project-template/.claude/agents/refs/ta-pipeline-cookbook.md +699 -0
- package/project-template/.claude/agents/refs/ta-tools-reference.md +111 -0
- package/project-template/.claude/agents/refs/ta-vfx-preset-catalog.md +365 -0
- package/project-template/.claude/agents/reviewer.md +103 -0
- package/project-template/.claude/agents/technical-artist.md +111 -0
- package/project-template/.claude/hooks/README.md +36 -0
- package/project-template/.claude/hooks/validate-atom-plan.mjs +224 -0
- package/project-template/.claude/hooks/validate-workflow-stop.mjs +258 -0
- package/project-template/.claude/settings.json +32 -0
- package/project-template/.claude/settings.local.json +4 -0
- package/project-template/.claude/skills/playcraft-ad-psychology/SKILL.md +182 -0
- package/project-template/.claude/skills/playcraft-art-style-guide/SKILL.md +123 -0
- package/project-template/.claude/skills/playcraft-asset-state-sheet/SKILL.md +141 -0
- package/project-template/.claude/skills/playcraft-audio-generation/SKILL.md +280 -0
- package/project-template/.claude/skills/playcraft-batch-pipeline/SKILL.md +184 -0
- package/project-template/.claude/skills/playcraft-build-optimizer/SKILL.md +306 -0
- package/project-template/.claude/skills/playcraft-image-generation/SKILL.md +229 -0
- package/project-template/.claude/skills/playcraft-image-generation/reference/build-sprite-sheet.template.mjs +123 -0
- package/project-template/.claude/skills/playcraft-image-generation/reference/compare-style.template.mjs +254 -0
- package/project-template/.claude/skills/playcraft-image-generation/reference/gen-batch-sprite.template.mjs +235 -0
- package/project-template/.claude/skills/playcraft-image-generation/reference/gen-batch.template.mjs +97 -0
- package/project-template/.claude/skills/playcraft-image-generation/reference/gen-edit-variants.template.mjs +118 -0
- package/project-template/.claude/skills/playcraft-image-generation/reference/process-batch.template.mjs +137 -0
- package/project-template/.claude/skills/playcraft-image-generation/reference/prompt-cookbook.md +397 -0
- package/project-template/.claude/skills/playcraft-image-generation/reference/validate-sprite-sheet.template.mjs +296 -0
- package/project-template/.claude/skills/playcraft-image-ops/SKILL.md +122 -0
- package/project-template/.claude/skills/playcraft-masking/SKILL.md +373 -0
- package/project-template/.claude/skills/playcraft-research/SKILL.md +212 -0
- package/project-template/.claude/skills/playcraft-sprite-generation/SKILL.md +423 -0
- package/project-template/.claude/skills/playcraft-storyboard/SKILL.md +148 -0
- package/project-template/.claude/skills/playcraft-style-qa/SKILL.md +270 -0
- package/project-template/.claude/skills/playcraft-text-rendering/SKILL.md +236 -0
- package/project-template/.claude/skills/playcraft-vfx-animation/SKILL.md +130 -0
- package/project-template/.claude/skills/playcraft-workflow/SKILL.md +396 -0
- package/project-template/.cursor/hooks.json +17 -0
- package/project-template/.cursor/rules/playcraft-orchestrator.mdc +87 -0
- package/project-template/.cursor/rules/playcraft-subagent-boundary.mdc +18 -0
- package/project-template/CLAUDE.md +240 -0
- package/project-template/assets/audio/bgm/.gitkeep +0 -0
- package/project-template/assets/audio/sfx/.gitkeep +0 -0
- package/project-template/assets/bundles/.gitkeep +0 -0
- package/project-template/assets/images/bg/.gitkeep +0 -0
- package/project-template/assets/images/reference/.gitkeep +0 -0
- package/project-template/assets/images/storyboard/.gitkeep +0 -0
- package/project-template/assets/images/tiles/.gitkeep +0 -0
- package/project-template/assets/images/ui/.gitkeep +0 -0
- package/project-template/assets/images/vfx/.gitkeep +0 -0
- package/project-template/assets/models/.gitkeep +0 -0
- package/project-template/docs/team/agent-conduct.md +105 -0
- package/project-template/docs/team/agent-runtime-matrix.md +62 -0
- package/project-template/docs/team/atom-plan-format.md +74 -0
- package/project-template/docs/team/collaboration.md +288 -0
- package/project-template/docs/team/core-model.md +50 -0
- package/project-template/docs/team/platform-capabilities.md +15 -0
- package/project-template/docs/team/workflow-changelog.md +51 -0
- package/project-template/docs/team/workflow-consistency-checklist.md +128 -0
- package/project-template/game/config/.gitkeep +0 -0
- package/project-template/game/gameplay/.gitkeep +0 -0
- package/project-template/game/scenes/.gitkeep +0 -0
- package/project-template/logs/.gitkeep +0 -0
- package/project-template/ta-workspace/logs/.gitkeep +0 -0
- package/project-template/ta-workspace/scripts/.gitkeep +0 -0
- package/project-template/ta-workspace/tmp/.gitkeep +0 -0
- package/project-template/templates/atom-plan.template.json +26 -0
- package/project-template/templates/atom-plan.template.md +76 -0
- package/project-template/templates/design-brief.template.md +195 -0
- package/project-template/templates/design-lens-checklist.reference.md +117 -0
- package/project-template/templates/design-methodology.md +99 -0
- package/project-template/templates/designer-log.template.md +98 -0
- package/project-template/templates/developer-log.template.md +140 -0
- package/project-template/templates/five-axis-framework.md +186 -0
- package/project-template/templates/intent-clarifications.template.md +58 -0
- package/project-template/templates/layout-spec.template.md +132 -0
- package/project-template/templates/project-state.template.md +219 -0
- package/project-template/templates/review-report.template.md +166 -0
- package/project-template/templates/style-exploration.template.md +93 -0
- package/project-template/templates/ta-log.template.md +205 -0
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: playcraft-workflow
|
|
3
|
+
description: PlayCraft 可玩广告开发工作流与 Skill 体系入口。在开始构建任何游戏项目、选择组件、查找 Skill、生成图片/音频、创建 Remix 时自动触发。解释双层 Skill 体系并引导正确工作流。
|
|
4
|
+
triggers: 构建游戏,开始开发,创建项目,选择组件,选择 skill,查找 skill,生成图片,生成音频,工作流,workflow
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# PlayCraft 工作流与 Skill 体系
|
|
8
|
+
|
|
9
|
+
## 执行模式(首先判断)
|
|
10
|
+
|
|
11
|
+
在开始任何工作前,先判断当前执行环境:
|
|
12
|
+
|
|
13
|
+
### Multi-Agent Mode(默认,优先使用)
|
|
14
|
+
|
|
15
|
+
如果当前环境支持 sub-agent 调用(Claude Code 的 `@agent` 语法可用):
|
|
16
|
+
|
|
17
|
+
1. **你是 orchestrator**,不要自己执行任何 Agent 的工作
|
|
18
|
+
2. 按 `CLAUDE.md` 中 Orchestration Protocol 的阶段转换表 spawn sub-agents
|
|
19
|
+
3. 每个 sub-agent 完成后,读取 `docs/project-state.md` 的 **`## Agent handoff`** YAML + Gates 表,再决定下一步
|
|
20
|
+
4. **Orchestrator 会话**优先遵循 `.cursor/rules/playcraft-orchestrator.mdc`;子 Agent 会话不加载 orchestrator rule
|
|
21
|
+
5. **仅 orchestrator** 对用户 `AskUserQuestion` — 子 Agent **禁止**问用户(见 `docs/team/agent-conduct.md`)
|
|
22
|
+
- `gate_pending` 非 null 且 `waiting_for: user_gate` 时:**只跑 Gate**,不得 invoke 子 Agent
|
|
23
|
+
- `subagent_stop: true` 时:只执行 `next_orchestrator_action`
|
|
24
|
+
- Gate #1 / #2a / #2b:`AskUserQuestion`(子 Agent 更新 handoff 后 STOP)
|
|
25
|
+
- Gate #3:Reviewer 通过后展示 **devUrl**(用户只点链,不跑 `npm run dev`)
|
|
26
|
+
- Gate / handoff 细则:`docs/team/collaboration.md` § Gate Protocol、§ Agent Handoff
|
|
27
|
+
6. `devStatus: ready` → `@reviewer`;`devStatus: blocked_upstream` → 按 `devBlockers.routeTo` 调度 TA/Designer → 再 `@developer`
|
|
28
|
+
7. 当前交付终点 = 用户在 Dev URL 验收通过(`done`),**不要求** `playcraft build`
|
|
29
|
+
|
|
30
|
+
### Single-Agent Mode(降级模式,当 sub-agent 不可用时)
|
|
31
|
+
|
|
32
|
+
串行执行所有阶段,但**必须**:
|
|
33
|
+
|
|
34
|
+
- 每进入一个新阶段时,先完整读取对应 `.claude/agents/<role>.md` 的所有指令
|
|
35
|
+
- 不可跳过任何阶段的必选产出(特别是 TA 的完整素材生产——UI 图、VFX、精灵图都必须生产)
|
|
36
|
+
- 必须执行 Spec Quick-Check:TA 在 production Wave 2 启动后 30s 内;Developer 在 `integration` 启动后 30s 内
|
|
37
|
+
- PM 定稿后运行 `playcraft skills link --from-atom-plan`;Developer 优先读 `.claude/skills/<atomId>/SKILL.md`,仅断链时用 `playcraft skills read`
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## 双层 Skill 体系
|
|
42
|
+
|
|
43
|
+
PlayCraft 使用 **两套互补的 Skill 系统**:
|
|
44
|
+
|
|
45
|
+
| 层 | 位置 | 用途 | 发现方式 |
|
|
46
|
+
| ---------------------- | ----------------------------------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ |
|
|
47
|
+
| **Claude Code Skills** | `.claude/skills/` | 平台工具使用指南(图片生成、音频、代码编辑器等) | IDE 自动发现和注入 |
|
|
48
|
+
| **DAG Atom Skills** | `playcraft skills match` 返回的 `skillDir` 路径 | 游戏积木(玩法规则、组件、图片、音效、配置) | `playcraft skills match` CLI 推荐;PM 定稿后 `playcraft skills link --from-atom-plan` 软链到 `.claude/skills/` 供 IDE 自动发现 |
|
|
49
|
+
|
|
50
|
+
**关键规则**:构建任何新游戏项目前,**必须先运行 `playcraft skills match`** 获取完整的推荐积木清单,再动手写代码。
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 标准工作流(必须遵守)
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
① 运行本地 Skill 推荐(必须)
|
|
58
|
+
playcraft skills match --intent "<关键词,逗号分隔>" --json
|
|
59
|
+
# 自动推断引擎;若已定:加 --engine <threejs|phaser>
|
|
60
|
+
|
|
61
|
+
② 评估本地 Skill 覆盖度
|
|
62
|
+
- 完整覆盖 → 进入步骤 ③
|
|
63
|
+
- 部分覆盖 → 进入步骤 ③,同时触发 ②-ext
|
|
64
|
+
- 完全没有 → 触发 ②-ext
|
|
65
|
+
|
|
66
|
+
② -ext(本地不足时)网络研究补充
|
|
67
|
+
- 参阅 playcraft-research SKILL,按角色执行定向研究
|
|
68
|
+
- 研究结论写入 `docs/atom-plan.md` 的对应 Context 区域
|
|
69
|
+
- 标记候选新 Skill(在 DAG Revisions 中记录)
|
|
70
|
+
|
|
71
|
+
③ 读取每个代码 Skill 的 SKILL.md(PM 已 link 后优先项目内路径):
|
|
72
|
+
cat .claude/skills/<atomId>/SKILL.md
|
|
73
|
+
# 软链缺失时兜底:playcraft skills read <atomId>
|
|
74
|
+
- 理解 Recipe;列出将使用的 ref/ 文件
|
|
75
|
+
- 将关键信息记入 `docs/atom-plan.md` 对应的 Context 区域
|
|
76
|
+
|
|
77
|
+
④ PM 定稿 `atom-plan.json` 后,软连接 DAG Skill 到项目(IDE 自动发现,强烈推荐):
|
|
78
|
+
playcraft skills link --from-atom-plan --prune
|
|
79
|
+
|
|
80
|
+
⑤ 执行 scaffold 命令,复制 ref 文件到项目(注:package.json/tsconfig.json 使用 merge-json 模式,不覆盖已有配置)
|
|
81
|
+
playcraft skills scaffold --engine <引擎> --atoms <skill1,skill2> --out ./game
|
|
82
|
+
|
|
83
|
+
⑥ 按各媒体 Skill 的参数(或网络研究得出的参数)生成图片/音频资产
|
|
84
|
+
playcraft tools generate-image --prompt "..." --output ta-workspace/xxx.png
|
|
85
|
+
playcraft tools generate-sfx --prompt "..." --duration 1.5
|
|
86
|
+
playcraft tools generate-bgm --prompt "..."
|
|
87
|
+
|
|
88
|
+
⑦ 在已有 ref 文件基础上(或基于研究方案)编写项目代码
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**禁止**:
|
|
92
|
+
|
|
93
|
+
- ❌ 未运行 `skills match` 就开始写引擎/布局/输入/渲染代码
|
|
94
|
+
- ❌ 未读 SKILL.md(项目软链或 CLI 兜底)就跳过 Skill 内容直接从头实现
|
|
95
|
+
- ❌ 对已有 ref 文件重新实现相同功能
|
|
96
|
+
- ❌ 手动猜测 Skill 名称
|
|
97
|
+
- ❌ 本地无 Skill 就直接凭感觉写——先做网络研究,把依据记录在活 DAG 里
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Agent 自增强协议(Skill-on-Demand)
|
|
102
|
+
|
|
103
|
+
> **核心原则**:Skill 是持续可用的资源,不是一次性查询。每个 Agent 在其专属阶段都应独立做角色相关的 Skill 发现。
|
|
104
|
+
|
|
105
|
+
### 为什么需要多次 Skill 查询
|
|
106
|
+
|
|
107
|
+
- 每个 Agent 是独立 session,不继承前一个 Agent 的 Skill 搜索结果
|
|
108
|
+
- 每个角色需要的 Skill 类型完全不同
|
|
109
|
+
- 在实现某个具体功能时才知道需要什么,无法在规划阶段完全预见
|
|
110
|
+
|
|
111
|
+
### 按角色的 Skill 发现模式
|
|
112
|
+
|
|
113
|
+
**PM(规划阶段)**
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# 确认玩法类型的已有实现和依赖关系
|
|
117
|
+
playcraft skills match --engine <engine> --intent "<gameplay_type>,<game_mechanic>" --json
|
|
118
|
+
# 浏览所有可用配置封包
|
|
119
|
+
playcraft skills list --category config --json
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Designer(创意样本生产阶段)**
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# 找视觉资产参考和生成参数(aiimage Skill 包含 manifest.json 里的 generation 字段)
|
|
126
|
+
playcraft skills list --category visual --json
|
|
127
|
+
# 找音频资产参考
|
|
128
|
+
playcraft skills list --category audio --json
|
|
129
|
+
# 按具体元素类型搜索
|
|
130
|
+
playcraft skills match --intent "<element_type>,<art_style>" --json
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Technical Artist(技术生产阶段)**
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# 找精灵图/图集生产 Skill
|
|
137
|
+
playcraft skills list --category visual --json
|
|
138
|
+
playcraft skills match --intent "<element_type>,sprite,atlas,sheet" --json
|
|
139
|
+
# 找 3D 渲染/翻转精灵图 Skill
|
|
140
|
+
playcraft skills match --intent "3d,sprite,flip,render" --json
|
|
141
|
+
# 找图片处理 Skill
|
|
142
|
+
playcraft skills match --intent "image,processing,pipeline" --json
|
|
143
|
+
# 找验证器(用于合规检查)
|
|
144
|
+
playcraft skills list --category validator --json
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**Developer(代码实现阶段)**
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# 每实现一个 Atom 前,先搜索是否有现成的代码积木
|
|
151
|
+
playcraft skills match --engine <engine> --intent "<feature_name>,<component_type>" --json
|
|
152
|
+
# 找引擎适配层
|
|
153
|
+
playcraft skills list --category engine --json
|
|
154
|
+
# 找布局/UI 组件
|
|
155
|
+
playcraft skills list --category layout --json
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Reviewer(质量验证阶段)**
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# 找可用的校验器 Skill
|
|
162
|
+
playcraft skills list --category validator --json
|
|
163
|
+
# 按具体校验目标搜索
|
|
164
|
+
playcraft skills match --intent "validator,balance,compliance,ux" --json
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### "写代码前先查 Skill" 规则
|
|
168
|
+
|
|
169
|
+
在实现任何非平凡组件之前,**必须先执行此检查**:
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
1. 我即将实现:<描述功能>
|
|
173
|
+
2. 运行:playcraft skills match --engine <e> --intent "<功能关键词>" --json
|
|
174
|
+
3a. 找到完整匹配 Skill → 读取其 SKILL.md → scaffold → 基于 ref 文件实现
|
|
175
|
+
3b. 找到部分匹配 → 使用 Skill 作为基础,参阅 playcraft-research 补充网络研究
|
|
176
|
+
3c. 完全未找到 Skill → 参阅 playcraft-research 执行定向网络研究 → 研究结论写入
|
|
177
|
+
`atom-plan.md` § Impl Skill Context → 在 `dagRevisions` / DAG Revisions 标注候选新 Skill → 实现
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
> 本地 Skill 库不可能穷尽所有场景。遇到陌生玩法、新艺术风格、特定算法时,**网络研究是标准流程,不是例外**。关键是把研究结论沉淀进活 DAG,让整个团队受益。
|
|
181
|
+
|
|
182
|
+
**典型触发场景**:
|
|
183
|
+
|
|
184
|
+
- 要写一个新的 UI 组件 → `skills match --intent "ui,component,<具体名称>"`
|
|
185
|
+
- 要实现某种玩法规则 → `skills match --intent "<gameplay>,rules,algorithm"`
|
|
186
|
+
- 要做图片后处理/精灵图 → 读取 `playcraft-image-generation` SKILL.md(涵盖后处理管线与脚本模板)
|
|
187
|
+
- 要做音频生成/处理 → 读取 `playcraft-audio-generation` SKILL.md
|
|
188
|
+
- 要读取某个 Skill 的完整说明 → `playcraft skills read <atomId>`
|
|
189
|
+
|
|
190
|
+
### Skill 依赖链发现
|
|
191
|
+
|
|
192
|
+
Atom Skill 之间通过 `imports` 字段形成依赖链。发现一个 Skill 可能引出更多:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
# 读取某 Skill 的完整 SKILL.md(含 imports / Recipe / 操作流程)
|
|
196
|
+
playcraft skills read <atomId>
|
|
197
|
+
|
|
198
|
+
# match 输出的 JSON 中每个 item 包含 skillDir 字段,可直接访问 ref/ 目录
|
|
199
|
+
# 例如读取 memory_match 的 PGS 规则骨架:
|
|
200
|
+
playcraft skills match --engine phaser --intent "memory,match" --json \
|
|
201
|
+
| python3 -c "import json,sys; items=json.load(sys.stdin)['items']; [print(i['atomId'], i['skillDir']) for i in items]"
|
|
202
|
+
|
|
203
|
+
# 查看 skill 的 ref/ 目录文件(先用 read 获取 skillDir)
|
|
204
|
+
playcraft skills read <atomId> # 找到 skillDir 路径
|
|
205
|
+
# 然后直接读取 ref/ 文件:
|
|
206
|
+
cat <skillDir>/ref/<file>
|
|
207
|
+
|
|
208
|
+
# 按依赖 Skill 名称递归读取
|
|
209
|
+
playcraft skills match --intent "<imported_skill_keywords>" --json
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## 活 DAG 分层富集模式(保持一致性)
|
|
215
|
+
|
|
216
|
+
> **问题**:多个 Agent 各自做 DAG/Skill 搜索,结果会不会冲突?谁的优先?
|
|
217
|
+
>
|
|
218
|
+
> **答案**:不冲突。**活 DAG** 在 `docs/atom-plan.json`(`atoms[]` + `skillsMatch`);各 Agent 在 `docs/atom-plan.md` 向专属 Context 区富集,形成统一知识库。
|
|
219
|
+
|
|
220
|
+
### 活 DAG 的分层结构
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
docs/atom-plan.json
|
|
224
|
+
├── skillsMatch ← PM:`playcraft skills match --json`(skillRef 唯一来源)
|
|
225
|
+
├── atoms[] ← PM:排期 DAG;Gameplay/Config 的 skillRef 仅来自 skillsMatch.items
|
|
226
|
+
└── dagRevisions[] ← 结构变更 / skills-match-gap(可与 md 同步)
|
|
227
|
+
|
|
228
|
+
docs/atom-plan.md
|
|
229
|
+
├── Atom List(可选镜像表) ← 与 atoms[] 同步;可省略
|
|
230
|
+
├── ## Acceptance Criteria ← PM:每 atom 一条可测验收
|
|
231
|
+
├── ## Asset Skill Context ← Designer
|
|
232
|
+
├── ## TA Skill Context ← TA
|
|
233
|
+
├── ## Impl Skill Context ← Developer
|
|
234
|
+
└── ## DAG Revisions ← 人类可读修订记录
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Skills 路径真源:`playcraft.config.json` → `agent.skillsDir`(**不要**在 atom-plan 写死 node_modules)。格式详解:[`docs/team/atom-plan-format.md`](../../docs/team/atom-plan-format.md)
|
|
238
|
+
|
|
239
|
+
### 各 Agent 的读写职责
|
|
240
|
+
|
|
241
|
+
| Agent | 读取 | 写入 |
|
|
242
|
+
| -------------------- | ---------------------------------------- | ----------------------------------------------------- |
|
|
243
|
+
| **PM** | design-brief, layout-spec | `atom-plan.json`(skillsMatch + atoms[]) |
|
|
244
|
+
| **Designer** | `atoms[]` + design-brief | `atom-plan.md` § Asset Skill Context |
|
|
245
|
+
| **Technical Artist** | `atoms[]` + Asset Context + designer-log | `atom-plan.md` § TA Skill Context;`atoms[].status` |
|
|
246
|
+
| **Developer** | `atoms[]` + Context 区 + design-brief | `atom-plan.md` § Impl Skill Context;`atoms[].status` |
|
|
247
|
+
| **Reviewer** | JSON + MD(只读) | 不写 |
|
|
248
|
+
|
|
249
|
+
### 为什么这样设计能避免冲突
|
|
250
|
+
|
|
251
|
+
**示例**:游戏风格为"像素风"
|
|
252
|
+
|
|
253
|
+
```
|
|
254
|
+
PM:
|
|
255
|
+
→ 搜索 aigameplay skills,得到 arrow_pick_match_rules
|
|
256
|
+
→ 在 atoms[] 填:arrow_rules | skillRef = arrow_pick_match_rules.aigameplay
|
|
257
|
+
→ 不知道像素风需要什么具体的图片参数,留 VisualAtom skillRef 为空(—)
|
|
258
|
+
|
|
259
|
+
Designer:
|
|
260
|
+
→ 读到 StyleDirection = "像素风 8-bit 高饱和"
|
|
261
|
+
→ 搜索 aiimage skills,得到 pixel_art_sprite.aiimage
|
|
262
|
+
→ 读 pixel_art_sprite 的 manifest.json:了解 prompt 模板、block 尺寸参数
|
|
263
|
+
→ 在 Asset Skill Context 写:bg_atom → pixel_art_sprite → 关键参数...
|
|
264
|
+
→ 现在知道"像素风"具体怎么生产了
|
|
265
|
+
|
|
266
|
+
Developer:
|
|
267
|
+
→ 读 PM 的 skillRef = arrow_pick_match_rules.aigameplay
|
|
268
|
+
→ 读 Designer 的 Asset Skill Context(了解视觉风格,确保代码绑定正确)
|
|
269
|
+
→ 搜索额外的 aicomponent skills
|
|
270
|
+
→ 在 Impl Skill Context 写:arrow_rules_impl → 实现细节...
|
|
271
|
+
|
|
272
|
+
Reviewer:
|
|
273
|
+
→ 读 Atom List + Asset Skill Context + Impl Skill Context
|
|
274
|
+
→ 有了完整 Skill 依据,搜索 aivalidator skills 进行验证
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
**无冲突的根本原因**:每个 Agent 的写入区域不重叠。DAG 是合作共建的,不是争夺的。
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
## Scaffold 所有权模型(防冲突)
|
|
282
|
+
|
|
283
|
+
> **核心规则**:`playcraft skills match/list` 是只读操作,任何 Agent 随时可用,零冲突。
|
|
284
|
+
> **唯一风险**:`playcraft skills scaffold`(写文件),必须遵守所有权规则。
|
|
285
|
+
|
|
286
|
+
### 每个 Agent 的 Scaffold 域
|
|
287
|
+
|
|
288
|
+
| Agent | 可 Scaffold 的 Skill 类型 | 写入目录 | 禁止 Scaffold |
|
|
289
|
+
| -------------------- | -------------------------------------------------------------- | --------- | --------------------------------------------------------- |
|
|
290
|
+
| **Developer** | `aicomponent`, `aigameplay`, `aiconfig` | `game/` | `aiimage`, `aiaudio`, `aivalidator` |
|
|
291
|
+
| **Technical Artist** | ❌ 不 Scaffold(读 manifest.json generation 参数,直接调 CLI) | `assets/` | **全部**(TA 通过 CLI 管线生产,不 Scaffold) |
|
|
292
|
+
| **Designer** | ❌ 不 Scaffold | `assets/` | **全部**(只读 manifest.json 的 generation 参数用于生成) |
|
|
293
|
+
| **Reviewer** | ❌ 不 Scaffold | 只读 | **全部**(read-only 角色) |
|
|
294
|
+
| **PM** | ❌ 不 Scaffold | `docs/` | **全部**(只做规划 + 协调) |
|
|
295
|
+
|
|
296
|
+
### 为什么 Designer 和 TA 不需要 Scaffold
|
|
297
|
+
|
|
298
|
+
`aiimage` / `aiaudio` Skill 没有 `ref/` 代码文件,只有 `manifest.json` 中的 `generation` 字段(prompt、aspectRatio、duration 等)。Designer 和 TA 读取这些参数作为生成基准,通过 `playcraft image *`、`playcraft tools generate-image` 等 CLI 命令执行,不复制任何文件到项目。
|
|
299
|
+
|
|
300
|
+
### Production 串行编排(production-serial-v1)
|
|
301
|
+
|
|
302
|
+
Gate #2b 通过后 **严格串行**(见 `workflow-changelog.md`):
|
|
303
|
+
|
|
304
|
+
```
|
|
305
|
+
Wave 1 Designer Ph.2 → Wave 2 TA → integration Developer
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
Developer 仅在 `integration` 写入 `game/**`,此时 TA 已交付合同路径上的真实资产。
|
|
309
|
+
|
|
310
|
+
### 避免重复 Scaffold 的规则
|
|
311
|
+
|
|
312
|
+
同一个 Skill 不应被多次 Scaffold 到同一目录:
|
|
313
|
+
|
|
314
|
+
- PM 在 `atom-plan.json` → `atoms[]` 标注 `skillRef`(若有)+ 调度元信息(assignTo/dependsOn/priority/parallelGroup/referenceSource)
|
|
315
|
+
- Developer 在 `integration` 开始时,按 `atoms[]` 中 `assignTo: Developer` 批量 scaffold 一次
|
|
316
|
+
- **不要在实现单个 Atom 时反复 scaffold** — 先统一 scaffold 所有依赖,再逐一实现
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
## 如何阅读 Atom Skill 的 SKILL.md
|
|
321
|
+
|
|
322
|
+
每个 Atom Skill 的 `SKILL.md` 包含:
|
|
323
|
+
|
|
324
|
+
1. **YAML frontmatter**:`name`(格式为 `<name>.<bundleType>`)、`description`、`triggers`
|
|
325
|
+
2. **功能说明**:Skill 做什么、输出什么
|
|
326
|
+
3. **Scaffold / Imports**:依赖哪些其他 Skill
|
|
327
|
+
4. **Skill Definition 区块**(部分 Skill 有):
|
|
328
|
+
```yaml
|
|
329
|
+
## Skill Definition
|
|
330
|
+
tools:
|
|
331
|
+
- bash
|
|
332
|
+
- read
|
|
333
|
+
prompt_extension: |
|
|
334
|
+
这里是注入给 agent 的操作指令
|
|
335
|
+
```
|
|
336
|
+
`prompt_extension` 的内容是 agent 执行此 Skill 时需要遵循的具体指令。
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
## Skill 推荐示例
|
|
341
|
+
|
|
342
|
+
```bash
|
|
343
|
+
# Three.js 3D 棋盘消除游戏
|
|
344
|
+
playcraft skills match --engine threejs --intent "board,3d,path,animation"
|
|
345
|
+
|
|
346
|
+
# Phaser 三消游戏
|
|
347
|
+
playcraft skills match --engine phaser --intent "match3,grid,tile,score"
|
|
348
|
+
|
|
349
|
+
# 跑酷游戏
|
|
350
|
+
playcraft skills match --engine phaser --intent "parkour,left_right,run,obstacle"
|
|
351
|
+
|
|
352
|
+
# 查看所有可用 Skill
|
|
353
|
+
playcraft skills list --json
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
## 平台工具快速参考
|
|
359
|
+
|
|
360
|
+
### Claude Code Skills(`.claude/skills/` 目录,自动注入)
|
|
361
|
+
|
|
362
|
+
> ⚠️ 下表只列出**项目模板中实际存在**的 Skill。不要查找或引用表外的 Skill 名称。
|
|
363
|
+
|
|
364
|
+
| Skill | 职责 | 主要角色 |
|
|
365
|
+
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------- | ------------- |
|
|
366
|
+
| `playcraft-workflow`(本文件) | 工作流入口、Skill 体系、DAG 协作规范 | 全员 |
|
|
367
|
+
| `playcraft-image-generation` | AI 图片生成全指南:模型选择、gpt-image-2 双 provider、精灵图直出、绿幕策略、edit 变体、错误恢复、ta-workspace 脚本模板 | Designer / TA |
|
|
368
|
+
| `playcraft-audio-generation` | AI 音频生成全指南:SFX/BGM 生成参数、prompt 套路、本地音频后处理(compress/fade/loop) | Designer |
|
|
369
|
+
| `playcraft-research` | 网络研究协议:`tools research/fetch-url/search-image` 三工具标准流程、研究结果融入活 DAG | 全员 |
|
|
370
|
+
|
|
371
|
+
### CLI 命令组(`playcraft <group>`,无需 Skill 文件)
|
|
372
|
+
|
|
373
|
+
| 命令组 | 能力摘要 | 主要角色 | 完整文档 |
|
|
374
|
+
| --------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------ |
|
|
375
|
+
| `playcraft tools generate-image` | AI 文生图/图生图;`--reference-image`、`--image-model`(裸模型名时后端按优先级 fallback)、`--count N`(同 prompt 批量出图)、`--timeout` | Designer / TA | `docs/cli/tools.md §1.2` |
|
|
376
|
+
| `playcraft tools generate-sfx/bgm` | AI 音效/背景音乐生成 | Designer | `docs/cli/tools.md §1.2` |
|
|
377
|
+
| `playcraft tools generate-3d` 系列 | AI 3D 模型生成、贴图、重拓扑、UV 展开、动作 | TA | `docs/cli/tools.md §1.3` |
|
|
378
|
+
| `playcraft tools research/fetch-url` | AI 网络研究与 URL 读取 | 全员 | `docs/cli/tools.md §1.7` |
|
|
379
|
+
| `playcraft tools save-to-git/build-project/publish` | 项目保存、构建、发布 | Developer | `docs/cli/tools.md §1.4` |
|
|
380
|
+
| `playcraft image` | 本地图片处理 + 后端抠图/分层:resize/crop/decompose-layers/segment/remove-background/sprite-split/sprite-sheet/batch/pipeline/animate/tint/overlay/gen-tile-back | TA | `docs/cli/tools.md §2`;分层与蒙版选型见 `playcraft-masking` |
|
|
381
|
+
| `playcraft audio` | 本地音频处理:compress/trim/fade/loop/normalize/mix | Designer / TA | `docs/cli/tools.md §3` |
|
|
382
|
+
| `playcraft 3d` | 本地 3D 处理:白模库/apply-texture/optimize/convert | TA | `docs/cli/tools.md §4` |
|
|
383
|
+
| `npm run dev` | 项目 Dev 预览(`package.json` → `scripts.dev`) | Developer / Reviewer | 用户不执行;Gate #3 由 orchestrator 递 devUrl |
|
|
384
|
+
| `playcraft build / build-all` | 打包 Playable Ads(**未来**交付路径,非当前 `done` 条件) | — | — |
|
|
385
|
+
| `playcraft skills match/list/link/scaffold/read` | DAG Atom Skill 推荐、IDE 软链、脚手架、内容读取(`link` 供 PM;`read` 供 Developer Preflight) | 全员 | — |
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
389
|
+
## Skill 目录发现优先级
|
|
390
|
+
|
|
391
|
+
`playcraft skills` 命令按以下优先级发现 Skill 目录:
|
|
392
|
+
|
|
393
|
+
1. `--skills-dir <path>` 参数
|
|
394
|
+
2. `playcraft.config.json` 中的 `skillsDir` 字段
|
|
395
|
+
3. `AGENT_SKILLS_PATHS` 环境变量
|
|
396
|
+
4. `<项目根>/node_modules/@playcraft/skills/skills`(npm 安装后)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"hooks": {
|
|
4
|
+
"subagentStop": [
|
|
5
|
+
{
|
|
6
|
+
"command": "node .claude/hooks/validate-atom-plan.mjs",
|
|
7
|
+
"timeout": 30,
|
|
8
|
+
"failClosed": false
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"command": "node .claude/hooks/validate-workflow-stop.mjs",
|
|
12
|
+
"timeout": 30,
|
|
13
|
+
"failClosed": false
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: PlayCraft playable ad orchestrator — gates, stages, sub-agent spawn only
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# PlayCraft Orchestrator
|
|
7
|
+
|
|
8
|
+
You are the **orchestrator** for a PlayCraft playable ad project. Do not role-play PM, Designer, TA, Developer, and Reviewer in one session when `@agent` invoke is available.
|
|
9
|
+
|
|
10
|
+
## Invoke `@developer` (`integration` only)
|
|
11
|
+
|
|
12
|
+
Sub-agents start a **fresh session** — they do not see your `playcraft skills match` output. Before spawn (after TA Wave 2 `done`):
|
|
13
|
+
|
|
14
|
+
1. Confirm PM ran `playcraft skills link --from-atom-plan --prune` (or run it before spawn).
|
|
15
|
+
2. Read `docs/atom-plan.json` → `atoms[]` where `assignTo: Developer` and `skillRef` is non-null.
|
|
16
|
+
3. Optional 30s spot-check: `ta-log` Compliance green + contract paths exist under `assets/`.
|
|
17
|
+
4. In the **first message** to `@developer`, paste skillRef list and require: read `.claude/skills/<skillRef>/SKILL.md` + `ref/` first; **only if** `test -f .claude/skills/<skillRef>/SKILL.md` fails, use `playcraft skills read` (uses `playcraft.config.json` `skillsDir`); then `playcraft skills scaffold --atoms … --out ./game`.
|
|
18
|
+
5. Ban hand-written PGS that ignores linked Skill `ref/`.
|
|
19
|
+
|
|
20
|
+
Integration STOP invalid without **§ Skill Preflight** (each row: `linked` or `cli-fallback`).
|
|
21
|
+
|
|
22
|
+
## Before every decision
|
|
23
|
+
|
|
24
|
+
1. Read `docs/project-state.md` → parse **`## Agent handoff`** YAML + Gates table + **Production Pipeline** waves.
|
|
25
|
+
2. If `gate_pending` non-null and `waiting_for: user_gate` → **Gate only** — do **not** invoke sub-agents.
|
|
26
|
+
3. If `subagent_stop: true` and `waiting_for: orchestrator` → execute **only** `next_orchestrator_action`.
|
|
27
|
+
4. Follow `CLAUDE.md` Orchestration Protocol and `docs/team/collaboration.md` § Gate Protocol, § Agent Handoff.
|
|
28
|
+
5. Before invoke: reset handoff (`subagent_stop: false`, `waiting_for: none`, `subagent: <target>`).
|
|
29
|
+
|
|
30
|
+
## Gates (only you ask the user)
|
|
31
|
+
|
|
32
|
+
| Gate | When | Action |
|
|
33
|
+
| ---- | ---- | ------ |
|
|
34
|
+
| #1 | handoff `gate_pending: "1"` or `gates.#1 = pending` | `AskUserQuestion` → pass → `stage: style_exploration` → `@designer` |
|
|
35
|
+
| #2a | `gate_pending: "2a"` | `AskUserQuestion` → `selectedMcOption` → resume `@designer` |
|
|
36
|
+
| #2b | `gate_pending: "2b"` | Confirm MC+ASR → `stage: production` → invoke `@designer` Ph.2 **only** |
|
|
37
|
+
| #3 | Reviewer pass, `devStatus: ready` | Show **devUrl** via `AskUserQuestion` — user never runs `npm run dev` |
|
|
38
|
+
|
|
39
|
+
Sub-agents **must not** use `AskUserQuestion` or set mainline `stage`. See `docs/team/agent-conduct.md`.
|
|
40
|
+
|
|
41
|
+
## Workflow STOP hooks (Claude Code + Cursor)
|
|
42
|
+
|
|
43
|
+
After **Technical Artist** or **Developer** subagent STOP, `.claude/hooks/validate-workflow-stop.mjs` runs automatically:
|
|
44
|
+
|
|
45
|
+
- **Claude Code**: `.claude/settings.json` → `SubagentStop`
|
|
46
|
+
- **Cursor**: `.cursor/hooks.json` → `subagentStop`
|
|
47
|
+
|
|
48
|
+
If intake validation fails, the subagent **cannot stop** until `logs/ta-log.md` or `logs/developer-log.md` § **Upstream Intake** is complete. Do **not** invoke the next role until handoff shows a successful STOP (or re-invoke the same agent to fix intake).
|
|
49
|
+
|
|
50
|
+
**Serial spawn after Gate #2b:** `@designer` → (Wave 1 done) `@technical-artist` → (Wave 2 done) `stage: integration` + `@developer`. **Never** spawn `@developer` during `production`.
|
|
51
|
+
|
|
52
|
+
## Stage sync on handoff
|
|
53
|
+
|
|
54
|
+
When executing `next_orchestrator_action`, **also** update `stage` / gates (sub-agents never do this):
|
|
55
|
+
|
|
56
|
+
| Action substring | Must write |
|
|
57
|
+
| ---------------- | ---------- |
|
|
58
|
+
| `Run Gate #1` | After pass: `stage: style_exploration`, `gates.#1 = passed` |
|
|
59
|
+
| `Run Gate #2a` | `gates.#2a = passed`, set `selectedMcOption`, resume `@designer` (stage stays `style_exploration`) |
|
|
60
|
+
| `Run Gate #2b` | `stage: production`, `gates.#2b = passed`, invoke `@designer` Ph.2 only |
|
|
61
|
+
| `Invoke @technical-artist` | Wave 1 `done` → invoke TA (stay `production`) |
|
|
62
|
+
| `Set stage=integration` / invoke `@developer` | Wave 2 `done` → `stage: integration` |
|
|
63
|
+
| `Invoke @reviewer` | `stage: review` |
|
|
64
|
+
| `Set stage=rework` | `stage: rework` + invoke routed agents |
|
|
65
|
+
| `Run Gate #3` | `gates.#3 = pending` → accept → `stage: done` |
|
|
66
|
+
|
|
67
|
+
## Handoff × stage matrix
|
|
68
|
+
|
|
69
|
+
| stage | gate_pending | Typical `next_orchestrator_action` |
|
|
70
|
+
| ----- | ------------ | ------------------------------------ |
|
|
71
|
+
| `pm` | `"1"` | Run Gate #1 |
|
|
72
|
+
| `style_exploration` | `"2a"` | Run Gate #2a |
|
|
73
|
+
| `style_exploration` | `"2b"` | Run Gate #2b → `stage: production` → `@designer` Ph.2 |
|
|
74
|
+
| `production` | null, Wave 1 pending | `@designer` Ph.2 |
|
|
75
|
+
| `production` | null, Wave 1 done | `Invoke @technical-artist` |
|
|
76
|
+
| `production` | null, Wave 2 done | `Set stage=integration, invoke @developer` |
|
|
77
|
+
| `integration` | null, `devStatus: ready` | Invoke `@reviewer` |
|
|
78
|
+
| `integration` | null, `blocked_upstream` | Re-invoke per `devBlockers.routeTo` → `@developer` |
|
|
79
|
+
| `review` | — (fail handoff) | Set `stage: rework`, invoke routed agents |
|
|
80
|
+
| `rework` | null | Fixes → `@developer` → `@reviewer` |
|
|
81
|
+
| `review` | `"3"` or pass | Gate #3 devUrl |
|
|
82
|
+
|
|
83
|
+
## Stage shortcuts
|
|
84
|
+
|
|
85
|
+
- Gate #2b → `@designer` only; Wave 1 done → `@technical-artist`; Wave 2 done → `integration` + `@developer`
|
|
86
|
+
- Review fail → **you** set `stage: rework` (Reviewer does not)
|
|
87
|
+
- `done` = user accepts devUrl; **not** `playcraft build`
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: PlayCraft sub-agent file boundaries — no user gates, STOP protocol
|
|
3
|
+
globs: .claude/agents/**,docs/**,logs/**,assets/**,game/**
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Sub-Agent Boundary
|
|
8
|
+
|
|
9
|
+
When editing project outputs as a **sub-agent** (PM / Designer / TA / Developer / Reviewer):
|
|
10
|
+
|
|
11
|
+
- **Do not** `AskUserQuestion` or ask the user to choose Gate options.
|
|
12
|
+
- On gate-ready work: update `## Agent handoff` YAML + `gates.#*` = `pending` + Progress Checkpoint → **STOP** (see `## Runtime` in your agent file).
|
|
13
|
+
- If `subagent_stop: true` for your role → do not duplicate work; wait for orchestrator.
|
|
14
|
+
- Read `docs/team/agent-conduct.md` and your `.claude/agents/<role>.md` § Runtime + § Agent Conduct.
|
|
15
|
+
- **Do not** change mainline `stage` — use `next_orchestrator_action` in handoff.
|
|
16
|
+
- R/W matrix: `docs/team/collaboration.md`.
|
|
17
|
+
|
|
18
|
+
Designer: read `selectedMcOption` before ASR (UI + element state sheets). TA: only after Production Pipeline Wave 1 `done`. Developer: only in `integration`; complete `developer-log.md` § Skill Preflight before `game/` edits; never `devStatus: ready` with open `devBlockers`.
|