claude-code-workflow 6.3.48 → 6.3.49

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 (211) hide show
  1. package/.claude/CLAUDE.md +6 -8
  2. package/.claude/agents/action-planning-agent.md +28 -45
  3. package/.claude/agents/cli-lite-planning-agent.md +93 -1
  4. package/.claude/agents/code-developer.md +144 -27
  5. package/.claude/commands/ccw-coordinator.md +175 -21
  6. package/.claude/commands/ccw-debug.md +832 -0
  7. package/.claude/commands/ccw.md +90 -9
  8. package/.claude/commands/cli/cli-init.md +1 -0
  9. package/.claude/commands/issue/convert-to-plan.md +718 -0
  10. package/.claude/commands/issue/from-brainstorm.md +382 -0
  11. package/.claude/commands/memory/tips.md +332 -0
  12. package/.claude/commands/workflow/analyze-with-file.md +804 -0
  13. package/.claude/commands/workflow/brainstorm/auto-parallel.md +18 -43
  14. package/.claude/commands/workflow/brainstorm/role-analysis.md +705 -0
  15. package/.claude/commands/workflow/brainstorm-with-file.md +1153 -0
  16. package/.claude/commands/workflow/debug-with-file.md +7 -5
  17. package/.claude/commands/workflow/execute.md +6 -4
  18. package/.claude/commands/workflow/lite-plan.md +2 -2
  19. package/.claude/commands/workflow/plan-verify.md +162 -327
  20. package/.claude/commands/workflow/plan.md +162 -26
  21. package/.claude/commands/workflow/replan.md +78 -2
  22. package/.claude/commands/workflow/{review-fix.md → review-cycle-fix.md} +6 -6
  23. package/.claude/commands/workflow/review-module-cycle.md +2 -2
  24. package/.claude/commands/workflow/review-session-cycle.md +2 -2
  25. package/.claude/commands/workflow/tools/conflict-resolution.md +16 -26
  26. package/.claude/commands/workflow/tools/context-gather.md +81 -118
  27. package/.claude/commands/workflow/tools/task-generate-agent.md +94 -10
  28. package/.claude/skills/ccw-help/command.json +4 -4
  29. package/.claude/skills/lite-skill-generator/SKILL.md +650 -0
  30. package/.claude/skills/lite-skill-generator/templates/simple-skill.md +68 -0
  31. package/.claude/skills/lite-skill-generator/templates/style-guide.md +64 -0
  32. package/.claude/skills/skill-generator/SKILL.md +277 -85
  33. package/.claude/skills/skill-generator/phases/01-requirements-discovery.md +4 -15
  34. package/.claude/skills/skill-generator/phases/02-structure-generation.md +72 -17
  35. package/.claude/skills/skill-generator/phases/03-phase-generation.md +218 -51
  36. package/.claude/skills/skill-generator/phases/04-specs-templates.md +111 -41
  37. package/.claude/skills/skill-generator/phases/05-validation.md +139 -56
  38. package/.claude/skills/skill-generator/templates/autonomous-action.md +78 -268
  39. package/.claude/skills/skill-generator/templates/autonomous-orchestrator.md +14 -0
  40. package/.claude/skills/skill-generator/templates/code-analysis-action.md +12 -0
  41. package/.claude/skills/skill-generator/templates/llm-action.md +12 -0
  42. package/.claude/skills/skill-generator/templates/script-template.md +368 -0
  43. package/.claude/skills/skill-generator/templates/sequential-phase.md +14 -0
  44. package/.claude/skills/skill-generator/templates/skill-md.md +14 -0
  45. package/.claude/skills/skill-tuning/SKILL.md +130 -266
  46. package/.claude/skills/skill-tuning/phases/orchestrator.md +95 -283
  47. package/.claude/skills/skill-tuning/specs/problem-taxonomy.md +90 -198
  48. package/.claude/skills/skill-tuning/specs/tuning-strategies.md +193 -1345
  49. package/.claude/workflows/cli-templates/schemas/plan-verify-agent-schema.json +47 -0
  50. package/.claude/workflows/cli-templates/schemas/verify-json-schema.json +158 -0
  51. package/.claude/workflows/cli-tools-usage.md +1 -1
  52. package/.codex/AGENTS.md +1 -3
  53. package/.codex/prompts/analyze-with-file.md +607 -0
  54. package/.codex/prompts/brainstorm-to-cycle.md +455 -0
  55. package/.codex/prompts/brainstorm-with-file.md +933 -0
  56. package/.codex/prompts/debug-with-file.md +15 -20
  57. package/.codex/skills/ccw-cli-tools/SKILL.md +559 -0
  58. package/ccw/dist/commands/cli.d.ts.map +1 -1
  59. package/ccw/dist/commands/cli.js +29 -5
  60. package/ccw/dist/commands/cli.js.map +1 -1
  61. package/ccw/dist/commands/issue.d.ts +2 -0
  62. package/ccw/dist/commands/issue.d.ts.map +1 -1
  63. package/ccw/dist/commands/issue.js +62 -20
  64. package/ccw/dist/commands/issue.js.map +1 -1
  65. package/ccw/dist/config/litellm-api-config-manager.d.ts.map +1 -1
  66. package/ccw/dist/config/litellm-api-config-manager.js +5 -3
  67. package/ccw/dist/config/litellm-api-config-manager.js.map +1 -1
  68. package/ccw/dist/config/litellm-provider-models.d.ts +73 -0
  69. package/ccw/dist/config/litellm-provider-models.d.ts.map +1 -0
  70. package/ccw/dist/config/litellm-provider-models.js +172 -0
  71. package/ccw/dist/config/litellm-provider-models.js.map +1 -0
  72. package/ccw/dist/config/provider-models.d.ts +25 -51
  73. package/ccw/dist/config/provider-models.d.ts.map +1 -1
  74. package/ccw/dist/config/provider-models.js +84 -149
  75. package/ccw/dist/config/provider-models.js.map +1 -1
  76. package/ccw/dist/config/storage-paths.d.ts.map +1 -1
  77. package/ccw/dist/config/storage-paths.js +23 -5
  78. package/ccw/dist/config/storage-paths.js.map +1 -1
  79. package/ccw/dist/core/auth/csrf-middleware.js +3 -3
  80. package/ccw/dist/core/auth/csrf-middleware.js.map +1 -1
  81. package/ccw/dist/core/dashboard-generator.d.ts.map +1 -1
  82. package/ccw/dist/core/dashboard-generator.js +3 -1
  83. package/ccw/dist/core/dashboard-generator.js.map +1 -1
  84. package/ccw/dist/core/routes/claude-routes.d.ts.map +1 -1
  85. package/ccw/dist/core/routes/claude-routes.js +206 -14
  86. package/ccw/dist/core/routes/claude-routes.js.map +1 -1
  87. package/ccw/dist/core/routes/cli-routes.d.ts.map +1 -1
  88. package/ccw/dist/core/routes/cli-routes.js.map +1 -1
  89. package/ccw/dist/core/routes/commands-routes.d.ts +7 -0
  90. package/ccw/dist/core/routes/commands-routes.d.ts.map +1 -0
  91. package/ccw/dist/core/routes/commands-routes.js +480 -0
  92. package/ccw/dist/core/routes/commands-routes.js.map +1 -0
  93. package/ccw/dist/core/routes/model-routes.d.ts +11 -0
  94. package/ccw/dist/core/routes/model-routes.d.ts.map +1 -0
  95. package/ccw/dist/core/routes/model-routes.js +112 -0
  96. package/ccw/dist/core/routes/model-routes.js.map +1 -0
  97. package/ccw/dist/core/routes/nav-status-routes.d.ts.map +1 -1
  98. package/ccw/dist/core/routes/nav-status-routes.js +84 -1
  99. package/ccw/dist/core/routes/nav-status-routes.js.map +1 -1
  100. package/ccw/dist/core/routes/provider-routes.d.ts +11 -0
  101. package/ccw/dist/core/routes/provider-routes.d.ts.map +1 -0
  102. package/ccw/dist/core/routes/provider-routes.js +67 -0
  103. package/ccw/dist/core/routes/provider-routes.js.map +1 -0
  104. package/ccw/dist/core/routes/skills-routes.d.ts.map +1 -1
  105. package/ccw/dist/core/routes/skills-routes.js +219 -7
  106. package/ccw/dist/core/routes/skills-routes.js.map +1 -1
  107. package/ccw/dist/core/routes/system-routes.d.ts.map +1 -1
  108. package/ccw/dist/core/routes/system-routes.js +58 -6
  109. package/ccw/dist/core/routes/system-routes.js.map +1 -1
  110. package/ccw/dist/core/server.d.ts.map +1 -1
  111. package/ccw/dist/core/server.js +13 -0
  112. package/ccw/dist/core/server.js.map +1 -1
  113. package/ccw/dist/mcp-server/index.js +2 -2
  114. package/ccw/dist/mcp-server/index.js.map +1 -1
  115. package/ccw/dist/tools/claude-cli-tools.d.ts +48 -11
  116. package/ccw/dist/tools/claude-cli-tools.d.ts.map +1 -1
  117. package/ccw/dist/tools/claude-cli-tools.js +146 -50
  118. package/ccw/dist/tools/claude-cli-tools.js.map +1 -1
  119. package/ccw/dist/tools/cli-config-manager.d.ts +1 -13
  120. package/ccw/dist/tools/cli-config-manager.d.ts.map +1 -1
  121. package/ccw/dist/tools/cli-config-manager.js +3 -27
  122. package/ccw/dist/tools/cli-config-manager.js.map +1 -1
  123. package/ccw/dist/tools/cli-executor-core.d.ts.map +1 -1
  124. package/ccw/dist/tools/cli-executor-core.js +7 -2
  125. package/ccw/dist/tools/cli-executor-core.js.map +1 -1
  126. package/ccw/dist/tools/cli-executor-state.d.ts.map +1 -1
  127. package/ccw/dist/tools/cli-history-store.d.ts +11 -0
  128. package/ccw/dist/tools/cli-history-store.d.ts.map +1 -1
  129. package/ccw/dist/tools/cli-history-store.js +82 -2
  130. package/ccw/dist/tools/cli-history-store.js.map +1 -1
  131. package/ccw/dist/tools/command-registry.d.ts +7 -0
  132. package/ccw/dist/tools/command-registry.d.ts.map +1 -1
  133. package/ccw/dist/tools/command-registry.js +14 -1
  134. package/ccw/dist/tools/command-registry.js.map +1 -1
  135. package/ccw/dist/tools/generate-module-docs.d.ts.map +1 -1
  136. package/ccw/dist/tools/generate-module-docs.js +11 -7
  137. package/ccw/dist/tools/generate-module-docs.js.map +1 -1
  138. package/ccw/dist/tools/litellm-executor.d.ts +1 -0
  139. package/ccw/dist/tools/litellm-executor.d.ts.map +1 -1
  140. package/ccw/dist/tools/litellm-executor.js +11 -9
  141. package/ccw/dist/tools/litellm-executor.js.map +1 -1
  142. package/ccw/dist/types/skill-types.d.ts +97 -0
  143. package/ccw/dist/types/skill-types.d.ts.map +1 -0
  144. package/ccw/dist/types/skill-types.js +6 -0
  145. package/ccw/dist/types/skill-types.js.map +1 -0
  146. package/ccw/src/commands/cli.ts +36 -5
  147. package/ccw/src/commands/issue.ts +81 -26
  148. package/ccw/src/config/litellm-api-config-manager.ts +5 -3
  149. package/ccw/src/config/litellm-provider-models.ts +222 -0
  150. package/ccw/src/config/provider-models.ts +91 -190
  151. package/ccw/src/config/storage-paths.ts +20 -5
  152. package/ccw/src/core/auth/csrf-middleware.ts +3 -3
  153. package/ccw/src/core/dashboard-generator.ts +3 -1
  154. package/ccw/src/core/routes/claude-routes.ts +233 -15
  155. package/ccw/src/core/routes/cli-routes.ts +2 -3
  156. package/ccw/src/core/routes/commands-routes.ts +620 -0
  157. package/ccw/src/core/routes/nav-status-routes.ts +95 -1
  158. package/ccw/src/core/routes/provider-routes.ts +78 -0
  159. package/ccw/src/core/routes/skills-routes.ts +266 -45
  160. package/ccw/src/core/routes/system-routes.ts +102 -50
  161. package/ccw/src/core/server.ts +13 -0
  162. package/ccw/src/mcp-server/index.ts +2 -2
  163. package/ccw/src/templates/dashboard-css/18-cli-settings.css +35 -0
  164. package/ccw/src/templates/dashboard-css/37-commands.css +193 -0
  165. package/ccw/src/templates/dashboard-js/components/navigation.js +4 -0
  166. package/ccw/src/templates/dashboard-js/i18n.js +116 -0
  167. package/ccw/src/templates/dashboard-js/views/cli-manager.js +249 -4
  168. package/ccw/src/templates/dashboard-js/views/commands-manager.js +503 -0
  169. package/ccw/src/templates/dashboard-js/views/issue-manager.js +7 -7
  170. package/ccw/src/templates/dashboard-js/views/mcp-manager.js +2 -7
  171. package/ccw/src/templates/dashboard-js/views/skills-manager.js +164 -23
  172. package/ccw/src/templates/dashboard.html +7 -0
  173. package/ccw/src/tools/claude-cli-tools.ts +170 -56
  174. package/ccw/src/tools/cli-config-manager.ts +2 -33
  175. package/ccw/src/tools/cli-executor-core.ts +8 -2
  176. package/ccw/src/tools/cli-history-store.ts +92 -2
  177. package/ccw/src/tools/command-registry.ts +16 -1
  178. package/ccw/src/tools/generate-module-docs.ts +11 -7
  179. package/ccw/src/tools/litellm-executor.ts +13 -9
  180. package/ccw/src/types/skill-types.ts +99 -0
  181. package/package.json +1 -1
  182. package/.claude/commands/enhance-prompt.md +0 -93
  183. package/.claude/commands/memory/code-map-memory.md +0 -687
  184. package/.claude/commands/memory/docs.md +0 -615
  185. package/.claude/commands/memory/load-skill-memory.md +0 -182
  186. package/.claude/commands/memory/skill-memory.md +0 -525
  187. package/.claude/commands/memory/swagger-docs.md +0 -773
  188. package/.claude/commands/memory/tech-research-rules.md +0 -310
  189. package/.claude/commands/memory/workflow-skill-memory.md +0 -517
  190. package/.claude/commands/task/breakdown.md +0 -208
  191. package/.claude/commands/task/create.md +0 -152
  192. package/.claude/commands/task/execute.md +0 -270
  193. package/.claude/commands/task/replan.md +0 -441
  194. package/.claude/commands/version.md +0 -254
  195. package/.claude/commands/workflow/action-plan-verify.md +0 -485
  196. package/.claude/commands/workflow/brainstorm/api-designer.md +0 -587
  197. package/.claude/commands/workflow/brainstorm/data-architect.md +0 -220
  198. package/.claude/commands/workflow/brainstorm/product-manager.md +0 -200
  199. package/.claude/commands/workflow/brainstorm/product-owner.md +0 -200
  200. package/.claude/commands/workflow/brainstorm/scrum-master.md +0 -200
  201. package/.claude/commands/workflow/brainstorm/subject-matter-expert.md +0 -200
  202. package/.claude/commands/workflow/brainstorm/system-architect.md +0 -389
  203. package/.claude/commands/workflow/brainstorm/ui-designer.md +0 -221
  204. package/.claude/commands/workflow/brainstorm/ux-expert.md +0 -221
  205. package/.claude/commands/workflow/debug.md +0 -331
  206. package/.claude/commands/workflow/develop-with-file.md +0 -1044
  207. package/.claude/skills/ccw-loop/README.md +0 -303
  208. package/.claude/skills/skill-generator/templates/script-bash.md +0 -277
  209. package/.claude/skills/skill-generator/templates/script-python.md +0 -198
  210. package/.codex/prompts/debug.md +0 -318
  211. package/ccw/src/core/routes/mcp-routes.ts.backup +0 -549
@@ -2,6 +2,20 @@
2
2
 
3
3
  自主模式动作文件的模板。
4
4
 
5
+ ## Purpose
6
+
7
+ 生成 Autonomous 执行模式的 Action 文件,定义可独立执行的动作单元。
8
+
9
+ ## Usage Context
10
+
11
+ | Phase | Usage |
12
+ |-------|-------|
13
+ | Phase 3 (Phase Generation) | `config.execution_mode === 'autonomous'` 时生成 |
14
+ | Generation Trigger | 为每个 `config.autonomous_config.actions` 生成一个 action 文件 |
15
+ | Output Location | `.claude/skills/{skill-name}/phases/actions/{action-id}.md` |
16
+
17
+ ---
18
+
5
19
  ## 模板结构
6
20
 
7
21
  ```markdown
@@ -70,10 +84,42 @@ return {
70
84
  | `{{error_handling_table}}` | 错误处理表格 |
71
85
  | `{{next_actions_hints}}` | 后续动作提示 |
72
86
 
87
+ ## 动作生命周期
88
+
89
+ ```
90
+ 状态驱动执行流:
91
+
92
+ state.status === 'pending'
93
+
94
+ ┌─ Init ─┐ ← 1次执行,环境准备
95
+ │ 创建工作目录 │
96
+ │ 初始化 context │
97
+ │ status → running │
98
+ └────┬────┘
99
+
100
+ ┌─ CRUD Loop ─┐ ← N次迭代,核心业务
101
+ │ 编排器选择动作 │ List / Create / Edit / Delete
102
+ │ execute(state) │ 共享模式: 收集输入 → 操作 context.items → 返回更新
103
+ │ 更新 state │
104
+ └────┬────┘
105
+
106
+ ┌─ Complete ─┐ ← 1次执行,保存结果
107
+ │ 序列化输出 │
108
+ │ status → completed │
109
+ └──────────┘
110
+
111
+ 共享状态结构:
112
+ state.status → 'pending' | 'running' | 'completed'
113
+ state.context.items → 业务数据数组
114
+ state.completed_actions → 已执行动作 ID 列表
115
+ ```
116
+
73
117
  ## 动作类型模板
74
118
 
75
119
  ### 1. 初始化动作 (Init)
76
120
 
121
+ **触发条件**: `state.status === 'pending'`,仅执行一次
122
+
77
123
  ```markdown
78
124
  # Action: Initialize
79
125
 
@@ -91,101 +137,29 @@ return {
91
137
 
92
138
  \`\`\`javascript
93
139
  async function execute(state) {
94
- // 1. 创建工作目录
95
140
  Bash(\`mkdir -p "\${workDir}"\`);
96
-
97
- // 2. 初始化数据
98
- const initialData = {
99
- items: [],
100
- metadata: {}
101
- };
102
-
103
- // 3. 返回状态更新
141
+
104
142
  return {
105
143
  stateUpdates: {
106
144
  status: 'running',
107
- context: initialData
145
+ started_at: new Date().toISOString(),
146
+ context: { items: [], metadata: {} }
108
147
  }
109
148
  };
110
149
  }
111
150
  \`\`\`
112
151
 
113
- ## State Updates
114
-
115
- \`\`\`javascript
116
- return {
117
- stateUpdates: {
118
- status: 'running',
119
- started_at: new Date().toISOString(),
120
- context: { /* 初始数据 */ }
121
- }
122
- };
123
- \`\`\`
124
-
125
152
  ## Next Actions
126
153
 
127
- - 成功: 进入主处理循环
154
+ - 成功: 进入主处理循环 (由编排器选择首个 CRUD 动作)
128
155
  - 失败: action-abort
129
156
  ```
130
157
 
131
- ### 2. 列表动作 (List)
132
-
133
- ```markdown
134
- # Action: List Items
135
-
136
- 显示当前项目列表。
158
+ ### 2. CRUD 动作 (List / Create / Edit / Delete)
137
159
 
138
- ## Purpose
139
-
140
- 展示所有项目供用户查看和选择。
141
-
142
- ## Preconditions
143
-
144
- - [ ] state.status === 'running'
160
+ **触发条件**: `state.status === 'running'`,循环执行直至用户退出
145
161
 
146
- ## Execution
147
-
148
- \`\`\`javascript
149
- async function execute(state) {
150
- const items = state.context.items || [];
151
-
152
- if (items.length === 0) {
153
- console.log('暂无项目');
154
- } else {
155
- console.log('项目列表:');
156
- items.forEach((item, i) => {
157
- console.log(\`\${i + 1}. \${item.name} - \${item.status}\`);
158
- });
159
- }
160
-
161
- return {
162
- stateUpdates: {
163
- last_action: 'list',
164
- current_view: 'list'
165
- }
166
- };
167
- }
168
- \`\`\`
169
-
170
- ## State Updates
171
-
172
- \`\`\`javascript
173
- return {
174
- stateUpdates: {
175
- current_view: 'list',
176
- last_viewed_at: new Date().toISOString()
177
- }
178
- };
179
- \`\`\`
180
-
181
- ## Next Actions
182
-
183
- - 用户选择创建: action-create
184
- - 用户选择编辑: action-edit
185
- - 用户退出: action-complete
186
- ```
187
-
188
- ### 3. 创建动作 (Create)
162
+ > 以 Create 为示例展示共享模式。List / Edit / Delete 遵循同一结构,仅 `执行逻辑` 和 `状态更新字段` 不同。
189
163
 
190
164
  ```markdown
191
165
  # Action: Create Item
@@ -194,7 +168,7 @@ return {
194
168
 
195
169
  ## Purpose
196
170
 
197
- 引导用户创建新项目。
171
+ 收集用户输入,向 context.items 追加新记录。
198
172
 
199
173
  ## Preconditions
200
174
 
@@ -204,26 +178,24 @@ return {
204
178
 
205
179
  \`\`\`javascript
206
180
  async function execute(state) {
207
- // 1. 收集信息
181
+ // 1. 收集输入
208
182
  const input = await AskUserQuestion({
209
183
  questions: [{
210
184
  question: "请输入项目名称:",
211
185
  header: "名称",
212
186
  multiSelect: false,
213
- options: [
214
- { label: "手动输入", description: "输入自定义名称" }
215
- ]
187
+ options: [{ label: "手动输入", description: "输入自定义名称" }]
216
188
  }]
217
189
  });
218
-
219
- // 2. 创建项目
190
+
191
+ // 2. 操作 context.items (核心逻辑因动作类型而异)
220
192
  const newItem = {
221
193
  id: Date.now().toString(),
222
194
  name: input["名称"],
223
195
  status: 'pending',
224
196
  created_at: new Date().toISOString()
225
197
  };
226
-
198
+
227
199
  // 3. 返回状态更新
228
200
  return {
229
201
  stateUpdates: {
@@ -231,177 +203,30 @@ async function execute(state) {
231
203
  ...state.context,
232
204
  items: [...(state.context.items || []), newItem]
233
205
  },
234
- last_created_id: newItem.id
235
- }
236
- };
237
- }
238
- \`\`\`
239
-
240
- ## State Updates
241
-
242
- \`\`\`javascript
243
- return {
244
- stateUpdates: {
245
- 'context.items': [...items, newItem],
246
- last_action: 'create',
247
- last_created_id: newItem.id
248
- }
249
- };
250
- \`\`\`
251
-
252
- ## Next Actions
253
-
254
- - 继续创建: action-create
255
- - 返回列表: action-list
256
- ```
257
-
258
- ### 4. 编辑动作 (Edit)
259
-
260
- ```markdown
261
- # Action: Edit Item
262
-
263
- 编辑现有项目。
264
-
265
- ## Purpose
266
-
267
- 修改已存在的项目。
268
-
269
- ## Preconditions
270
-
271
- - [ ] state.status === 'running'
272
- - [ ] state.selected_item_id !== null
273
-
274
- ## Execution
275
-
276
- \`\`\`javascript
277
- async function execute(state) {
278
- const itemId = state.selected_item_id;
279
- const items = state.context.items || [];
280
- const item = items.find(i => i.id === itemId);
281
-
282
- if (!item) {
283
- throw new Error(\`Item not found: \${itemId}\`);
284
- }
285
-
286
- // 1. 显示当前值
287
- console.log(\`当前名称: \${item.name}\`);
288
-
289
- // 2. 收集新值
290
- const input = await AskUserQuestion({
291
- questions: [{
292
- question: "请输入新名称(留空保持不变):",
293
- header: "新名称",
294
- multiSelect: false,
295
- options: [
296
- { label: "保持不变", description: \`当前: \${item.name}\` },
297
- { label: "手动输入", description: "输入新名称" }
298
- ]
299
- }]
300
- });
301
-
302
- // 3. 更新项目
303
- const updatedItems = items.map(i =>
304
- i.id === itemId
305
- ? { ...i, name: input["新名称"] || i.name, updated_at: new Date().toISOString() }
306
- : i
307
- );
308
-
309
- return {
310
- stateUpdates: {
311
- context: { ...state.context, items: updatedItems },
312
- selected_item_id: null
206
+ last_action: 'create'
313
207
  }
314
208
  };
315
209
  }
316
210
  \`\`\`
317
211
 
318
- ## State Updates
319
-
320
- \`\`\`javascript
321
- return {
322
- stateUpdates: {
323
- 'context.items': updatedItems,
324
- selected_item_id: null,
325
- last_action: 'edit'
326
- }
327
- };
328
- \`\`\`
329
-
330
212
  ## Next Actions
331
213
 
332
- - 返回列表: action-list
214
+ - 继续操作: 编排器根据 state 选择下一动作
215
+ - 用户退出: action-complete
333
216
  ```
334
217
 
335
- ### 5. 删除动作 (Delete)
336
-
337
- ```markdown
338
- # Action: Delete Item
339
-
340
- 删除项目。
341
-
342
- ## Purpose
218
+ **其他 CRUD 动作差异对照:**
343
219
 
344
- 从列表中移除项目。
220
+ | 动作 | 核心逻辑 | 额外前置条件 | 关键状态字段 |
221
+ |------|---------|------------|------------|
222
+ | List | `items.forEach(→ console.log)` | 无 | `current_view: 'list'` |
223
+ | Create | `items.push(newItem)` | 无 | `last_created_id` |
224
+ | Edit | `items.map(→ 替换匹配项)` | `selected_item_id !== null` | `updated_at` |
225
+ | Delete | `items.filter(→ 排除匹配项)` | `selected_item_id !== null` | 确认对话 → 执行 |
345
226
 
346
- ## Preconditions
227
+ ### 3. 完成动作 (Complete)
347
228
 
348
- - [ ] state.status === 'running'
349
- - [ ] state.selected_item_id !== null
350
-
351
- ## Execution
352
-
353
- \`\`\`javascript
354
- async function execute(state) {
355
- const itemId = state.selected_item_id;
356
- const items = state.context.items || [];
357
-
358
- // 1. 确认删除
359
- const confirm = await AskUserQuestion({
360
- questions: [{
361
- question: "确认删除此项目?",
362
- header: "确认",
363
- multiSelect: false,
364
- options: [
365
- { label: "确认删除", description: "不可恢复" },
366
- { label: "取消", description: "返回列表" }
367
- ]
368
- }]
369
- });
370
-
371
- if (confirm["确认"] === "取消") {
372
- return { stateUpdates: { selected_item_id: null } };
373
- }
374
-
375
- // 2. 执行删除
376
- const updatedItems = items.filter(i => i.id !== itemId);
377
-
378
- return {
379
- stateUpdates: {
380
- context: { ...state.context, items: updatedItems },
381
- selected_item_id: null
382
- }
383
- };
384
- }
385
- \`\`\`
386
-
387
- ## State Updates
388
-
389
- \`\`\`javascript
390
- return {
391
- stateUpdates: {
392
- 'context.items': filteredItems,
393
- selected_item_id: null,
394
- last_action: 'delete'
395
- }
396
- };
397
- \`\`\`
398
-
399
- ## Next Actions
400
-
401
- - 返回列表: action-list
402
- ```
403
-
404
- ### 6. 完成动作 (Complete)
229
+ **触发条件**: 用户明确退出或终止条件满足,仅执行一次
405
230
 
406
231
  ```markdown
407
232
  # Action: Complete
@@ -410,7 +235,7 @@ return {
410
235
 
411
236
  ## Purpose
412
237
 
413
- 保存最终状态,结束 Skill 执行。
238
+ 序列化最终状态,结束 Skill 执行。
414
239
 
415
240
  ## Preconditions
416
241
 
@@ -420,41 +245,26 @@ return {
420
245
 
421
246
  \`\`\`javascript
422
247
  async function execute(state) {
423
- // 1. 保存最终数据
424
248
  Write(\`\${workDir}/final-output.json\`, JSON.stringify(state.context, null, 2));
425
-
426
- // 2. 生成摘要
249
+
427
250
  const summary = {
428
251
  total_items: state.context.items?.length || 0,
429
252
  duration: Date.now() - new Date(state.started_at).getTime(),
430
253
  actions_executed: state.completed_actions.length
431
254
  };
432
-
433
- console.log('任务完成!');
434
- console.log(\`处理项目: \${summary.total_items}\`);
435
- console.log(\`执行动作: \${summary.actions_executed}\`);
436
-
255
+
256
+ console.log(\`任务完成: \${summary.total_items} 项, \${summary.actions_executed} 次操作\`);
257
+
437
258
  return {
438
259
  stateUpdates: {
439
260
  status: 'completed',
440
- summary: summary
261
+ completed_at: new Date().toISOString(),
262
+ summary
441
263
  }
442
264
  };
443
265
  }
444
266
  \`\`\`
445
267
 
446
- ## State Updates
447
-
448
- \`\`\`javascript
449
- return {
450
- stateUpdates: {
451
- status: 'completed',
452
- completed_at: new Date().toISOString(),
453
- summary: { /* 统计信息 */ }
454
- }
455
- };
456
- \`\`\`
457
-
458
268
  ## Next Actions
459
269
 
460
270
  - 无(终止状态)
@@ -2,6 +2,20 @@
2
2
 
3
3
  自主模式编排器的模板。
4
4
 
5
+ ## Purpose
6
+
7
+ 生成 Autonomous 执行模式的 Orchestrator 文件,负责状态驱动的动作选择和执行循环。
8
+
9
+ ## Usage Context
10
+
11
+ | Phase | Usage |
12
+ |-------|-------|
13
+ | Phase 3 (Phase Generation) | `config.execution_mode === 'autonomous'` 时生成 |
14
+ | Generation Trigger | 创建编排器逻辑,管理动作选择和状态更新 |
15
+ | Output Location | `.claude/skills/{skill-name}/phases/orchestrator.md` |
16
+
17
+ ---
18
+
5
19
  ## ⚠️ 重要提示
6
20
 
7
21
  > **Phase 0 是强制前置阶段**:在 Orchestrator 启动执行循环之前,必须先完成 Phase 0 的规范研读。
@@ -2,6 +2,18 @@
2
2
 
3
3
  代码分析动作模板,用于在 Skill 中集成代码探索和分析能力。
4
4
 
5
+ ## Purpose
6
+
7
+ 为 Skill 生成代码分析动作,集成 MCP 工具 (ACE) 和 Agent 进行语义搜索和深度分析。
8
+
9
+ ## Usage Context
10
+
11
+ | Phase | Usage |
12
+ |-------|-------|
13
+ | Optional | 当 Skill 需要代码探索和分析能力时使用 |
14
+ | Generation Trigger | 用户选择添加 code-analysis 动作类型 |
15
+ | Agent Types | Explore, cli-explore-agent, universal-executor |
16
+
5
17
  ---
6
18
 
7
19
  ## 配置结构
@@ -2,6 +2,18 @@
2
2
 
3
3
  LLM 动作模板,用于在 Skill 中集成 LLM 调用能力。
4
4
 
5
+ ## Purpose
6
+
7
+ 为 Skill 生成 LLM 动作,通过 CCW CLI 统一接口调用 Gemini/Qwen/Codex 进行分析或生成。
8
+
9
+ ## Usage Context
10
+
11
+ | Phase | Usage |
12
+ |-------|-------|
13
+ | Optional | 当 Skill 需要 LLM 能力时使用 |
14
+ | Generation Trigger | 用户选择添加 llm 动作类型 |
15
+ | Tools | gemini, qwen, codex (支持 fallback chain) |
16
+
5
17
  ---
6
18
 
7
19
  ## 配置结构