speccrew 0.7.61 → 0.7.62

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.
@@ -14,341 +14,4 @@ tools: Read, Write, Glob, Grep
14
14
 
15
15
  <!-- @agentflow: workflow.agentflow.xml -->
16
16
 
17
- > **REQUIRED**: Before executing this workflow, read the XML workflow specification: `speccrew-workspace/docs/rules/agentflow-spec.md`
18
-
19
- ## Workflow
20
-
21
- ## Absolute Constraints
22
-
23
- > **These rules apply to ALL steps. Violation = task failure.**
24
-
25
- 1. **FORBIDDEN: `create_file` for documents** — NEVER use `create_file` to write design documents or INDEX. Documents MUST be created by copying the template (Step 4.2a / Step 5.2a) then filling sections with `search_replace` (Step 4.2b / Step 5.2b). `create_file` produces truncated output on large files.
26
-
27
- 2. **FORBIDDEN: Full-file rewrite** — NEVER replace the entire document content in a single operation. Always use targeted `search_replace` on specific sections.
28
-
29
- 3. **MANDATORY: Template-first workflow** — Copy template MUST execute before fill sections. Skipping copy and writing content directly is FORBIDDEN.
30
-
31
- 4. **MANDATORY: Output filename pattern** — Output filename MUST follow pattern: `{feature_id}-{feature_name}-design.md`. Omitting feature_id or using alternative naming is FORBIDDEN.
32
-
33
- ## Step 1: Read Inputs
34
-
35
- > **Conditional Execution**: If `index_only` = `true`, **skip Steps 1-4** and jump directly to Step 5 to generate INDEX.md.
36
-
37
- **Input Parameters** (from agent context):
38
- - `feature_id` (optional): Feature identifier, e.g., `F-CRM-01`. If provided, use new naming format.
39
- - `feature_name`: Feature name, e.g., `customer-list`.
40
- - `platform_id`: Target platform, e.g., `frontend-vue`, `frontend-react`.
41
- - `skip_confirmation` (optional, boolean): When `true`, skip Checkpoint A user confirmation (used in batch dispatch mode)
42
- - `skip_index_generation` (optional, boolean): When `true`, skip Step 5 INDEX.md generation (INDEX.md will be generated by orchestrator after all workers complete)
43
- - `index_only` (optional, boolean): When `true`, skip Steps 1-4 and ONLY execute Step 5 (INDEX.md generation). Used after all platform workers complete.
44
- - `task_id` (optional, string): Task identifier in DISPATCH-PROGRESS.json. Used for status tracking.
45
- - `dispatch_progress_file` (optional, string): Path to DISPATCH-PROGRESS.json. If provided, worker updates its own task status on completion.
46
- - `update_progress_script` (optional, string): Path to update-progress.js script.
47
-
48
- Read in order:
49
-
50
- 1. **Feature Spec document(s)**: `speccrew-workspace/iterations/{number}-{type}-{name}/02.feature-design/{feature-id}-{feature-name}-feature-spec.md`
51
- 2. **API Contract**: `speccrew-workspace/iterations/{number}-{type}-{name}/03.api-contract/{feature-id}-{feature-name}-api-contract.md`
52
- 3. **Frontend techs knowledge** (paths from agent context):
53
- - `speccrew-workspace/knowledges/techs/{platform_id}/tech-stack.md`
54
- - `speccrew-workspace/knowledges/techs/{platform_id}/architecture.md`
55
- - `speccrew-workspace/knowledges/techs/{platform_id}/conventions-design.md`
56
- - `speccrew-workspace/knowledges/techs/{platform_id}/conventions-dev.md`
57
- - `speccrew-workspace/knowledges/techs/{platform_id}/ui-style/ui-style-guide.md` (if exists)
58
- 4. **Design template**: `speccrew-sd-frontend/templates/SD-FRONTEND-TEMPLATE.md`
59
- 5. **Index template**: `speccrew-sd-frontend/templates/INDEX-TEMPLATE.md`
60
-
61
- ## Step 2: Analyze Existing Code Structure
62
-
63
- Use Glob/Grep to understand current codebase:
64
-
65
- | Target | Glob Pattern | Purpose |
66
- |--------|-------------|---------|
67
- | Component directory | `src/components/**/*.vue` or `src/components/**/*.tsx` | Understand component organization |
68
- | Shared/base components | `src/components/base/**/*` | Identify reusable components |
69
- | State management | `src/stores/**/*.ts` or `src/store/**/*.ts` | Understand store pattern |
70
- | Router configuration | `src/router/**/*.ts` | Understand routing structure |
71
- | API layer | `src/apis/**/*.ts` or `src/api/**/*.ts` | Understand API encapsulation pattern |
72
- | Naming conventions | Various | Identify actual naming patterns in use |
73
-
74
- Document findings for reference in later steps.
75
-
76
- ## Step 3: Extract Functions from Feature Spec
77
-
78
- Parse Feature Spec to identify all functions (Section 2.N pattern).
79
-
80
- > **Note**: With the new fine-grained Feature Spec format, each Feature Spec typically contains **3-8 functions** (previously 10-20). The extraction logic remains the same, but the scope is more focused.
81
-
82
- For each function, extract:
83
-
84
- | Aspect | Content to Extract |
85
- |--------|-------------------|
86
- | Frontend prototype | ASCII wireframe from Feature Spec |
87
- | Interaction flow | User actions and system responses |
88
- | Backend API calls | Required API endpoints from API Contract |
89
- | Data requirements | Fields and structures needed |
90
-
91
- Mark each function's components as:
92
-
93
- | Marker | Meaning | Example |
94
- |--------|---------|---------|
95
- | `[EXISTING]` | Reuse current component/store | `[EXISTING] UserSelect component` |
96
- | `[MODIFIED]` | Enhance/change existing | `[MODIFIED] OrderTable - add new column` |
97
- | `[NEW]` | Create brand new | `[NEW] ProductDetailDrawer` |
98
-
99
- **Checkpoint A**:
100
- - If `skip_confirmation` = `true`: Log the function extraction summary and **proceed automatically** without waiting for user confirmation.
101
- - If `skip_confirmation` is not set or `false`: Present function extraction summary to user and **wait for explicit confirmation** before proceeding.
102
-
103
- > ⚠️ **FORBIDDEN**: Worker MUST NOT self-decide to skip confirmation. Only the `skip_confirmation` parameter from dispatch context controls this behavior.
104
-
105
- ## Step 4: Generate Module Design Documents
106
-
107
- For each function (or logical group of closely related functions = one module):
108
-
109
- ### Output File Naming Convention
110
-
111
- **MANDATORY**: The design document file MUST be named using this exact pattern:
112
-
113
- ```
114
- {feature_id}-{feature_name}-design.md
115
- ```
116
-
117
- Examples:
118
- - `F-M01-05-操作日志-design.md` ✅
119
- - `F-M02-01-顾客档案管理-design.md` ✅
120
- - `member-level-change-history-design.md` ❌ (missing feature_id prefix)
121
- - `customer-profile-design.md` ❌ (missing feature_id prefix)
122
-
123
- Where:
124
- - `feature_id`: The exact feature ID from dispatch context (e.g., `F-M01-05`, `F-M02-01`)
125
- - `feature_name`: The exact feature name from dispatch context (e.g., `操作日志`, `顾客档案管理`)
126
-
127
- > ⚠️ **FORBIDDEN**:
128
- > - Using any filename format other than `{feature_id}-{feature_name}-design.md`
129
- > - Omitting the feature_id prefix
130
- > - Translating or paraphrasing the feature_name (must use the exact name from context)
131
- > - Using function/sub-feature names instead of the main feature_name
132
-
133
- ### 4.1 Read Template
134
-
135
- Read `SD-FRONTEND-TEMPLATE.md` for document structure.
136
-
137
- ### 4.2a Copy Template to Document Path
138
-
139
- 1. **Read the design template**: `templates/SD-FRONTEND-TEMPLATE.md`
140
- 2. **Replace top-level placeholders** with known variables:
141
- - Module name, feature name, platform ID, etc.
142
- 3. **Create the document file** using `create_file`:
143
- - **Target path pattern**:
144
- - With `feature_id`: `speccrew-workspace/iterations/{number}-{type}-{name}/03.system-design/{platform_id}/{feature-id}-{feature-name}-design.md`
145
- - Example: `03.system-design/frontend-vue/F-CRM-01-customer-list-design.md`
146
- - Without `feature_id` (backward compatibility): `speccrew-workspace/iterations/{number}-{type}-{name}/03.system-design/{platform_id}/{module}-design.md`
147
- - Content: Template with top-level placeholders replaced
148
- 4. **Verify**: Document should have complete section structure ready for filling
149
-
150
- ### 4.2b Fill Each Section Using search_replace
151
-
152
- Fill each section with technology-specific implementation details.
153
-
154
- > ⚠️ **CRITICAL CONSTRAINTS:**
155
- > - **FORBIDDEN: `create_file` to rewrite the entire document** — it destroys template structure
156
- > - **MUST use `search_replace` to fill each section individually**
157
- > - **All section titles and numbering MUST be preserved**
158
- > - If a section has no applicable content, keep the section title and replace placeholder with "N/A"
159
-
160
- | Section | Technology-Specific Content |
161
- |---------|----------------------------|
162
- | Component tree | Use actual framework patterns (Vue 3 Composition API / React Hooks / etc.) |
163
- | Props/Emits | TypeScript types from conventions-dev.md |
164
- | State management | Actual store pattern (Pinia/Vuex/Redux/Zustand) |
165
- | API layer | Actual request library and interceptor patterns |
166
- | Routing | Actual router config format |
167
- | Pseudo-code | MUST use actual framework syntax from techs knowledge |
168
-
169
- **Key Rules for Pseudo-code**:
170
- - MUST use actual framework API syntax from techs knowledge
171
- - NOT generic pseudo-code
172
- - Include actual import statements
173
- - Use actual store/API patterns from conventions
174
-
175
- ### 4.3 Verify Output
176
-
177
- Verify the completed design document:
178
- - All sections filled with actual content (no remaining placeholders)
179
- - Mermaid diagrams render correctly
180
- - Pseudo-code uses actual framework syntax from techs knowledge
181
-
182
- ## Step 5: Generate Platform INDEX.md
183
-
184
- > **Conditional Execution**:
185
- > - If `skip_index_generation` = `true`, **skip this entire Step 5**.
186
- > - If `index_only` = `true`, this step is the ONLY step to execute (Steps 1-4 are skipped).
187
-
188
- After all module designs are complete:
189
-
190
- ### 5.1 Read Template
191
-
192
- Read `INDEX-TEMPLATE.md` for document structure.
193
-
194
- ### 5.2a Copy Index Template to Document Path
195
-
196
- 1. **Read the index template**: `templates/INDEX-TEMPLATE.md`
197
- 2. **Replace top-level placeholders** (platform name, feature name, etc.)
198
- 3. **Create the document file** using `create_file`:
199
- - Target path: `speccrew-workspace/iterations/{number}-{type}-{name}/03.system-design/{platform_id}/INDEX.md`
200
- - Content: Template with top-level placeholders replaced
201
-
202
- ### 5.2b Fill Index Sections Using search_replace
203
-
204
- > ⚠️ **CRITICAL CONSTRAINTS:**
205
- > - **FORBIDDEN: `create_file` to rewrite the entire document** — it destroys template structure
206
- > - **MUST use `search_replace` to fill each section individually**
207
- > - **All section titles and numbering MUST be preserved**
208
-
209
- | Section | Content Source |
210
- |---------|---------------|
211
- | Tech stack summary | tech-stack.md |
212
- | Shared design decisions | architecture.md, conventions-design.md |
213
- | Global state strategy | architecture.md state management section |
214
- | Base components | conventions-design.md shared components |
215
- | API interceptor config | conventions-dev.md HTTP client section |
216
- | Auth pattern | architecture.md authentication section |
217
-
218
- ### 5.3 Build Module List
219
-
220
- Create table with links to each module design document.
221
-
222
- | Column | Content |
223
- |--------|---------|
224
- | **ID** | Use `feature_id` if available (e.g., `F-CRM-01`), otherwise use module name |
225
- | **Name** | Feature or module name |
226
- | **Document** | Link to design file (e.g., `F-CRM-01-customer-list-design.md`) |
227
- | **Status** | `[NEW]`, `[MODIFIED]`, or `[EXISTING]` |
228
-
229
- Example row with `feature_id`: `| F-CRM-01 | Customer List | F-CRM-01-customer-list-design.md | NEW |`
230
-
231
- ### 5.4 Verify Output
232
-
233
- Verify the completed INDEX.md:
234
- - All sections filled with actual content (no remaining placeholders)
235
- - All module design documents are correctly linked
236
- - Platform-level summary is complete
237
-
238
- ## Step 6: Present Summary
239
-
240
- Present to user:
241
-
242
- ```
243
- Frontend System Design Summary for: {feature-name}
244
- Platform: {platform_id}
245
-
246
- Module Design Documents: {count}
247
- ├── {module1}-design.md
248
- ├── {module2}-design.md
249
- └── ...
250
-
251
- Key Design Decisions:
252
- - State Management: {approach}
253
- - Component Strategy: {approach}
254
- - API Layer: {approach}
255
-
256
- Concerns/Trade-offs:
257
- - {list any concerns}
258
- ```
259
-
260
- **Ask user to confirm:**
261
- 1. Are the component architectures appropriate?
262
- 2. Is the state management strategy correct?
263
- 3. Do the pseudo-code patterns match project conventions?
264
- 4. Are all API calls from API Contract covered?
265
-
266
- ## Step 7: Update Task Status (if dispatch_progress_file provided)
267
-
268
- > **Conditional Execution**: Only execute this step if `dispatch_progress_file` and `task_id` parameters are provided in the dispatch context.
269
-
270
- Update the task status in DISPATCH-PROGRESS.json to mark this task as completed:
271
-
272
- ```
273
- node "${update_progress_script}" update-task --file "${dispatch_progress_file}" --task-id "${task_id}" --status completed
274
- ```
275
-
276
- If the design document generation failed at any step, update with status `failed` instead:
277
- ```
278
- node "${update_progress_script}" update-task --file "${dispatch_progress_file}" --task-id "${task_id}" --status failed
279
- ```
280
-
281
- > ⚠️ **IMPORTANT**: This step MUST be the last action before returning the completion report. Do NOT skip this step in batch dispatch mode.
282
-
283
- ## Step 8: Task Completion Report
284
-
285
- After completing all steps, output a structured completion report for the System Designer Agent to parse and update DISPATCH-PROGRESS.json:
286
-
287
- ### On Success
288
-
289
- ```
290
- ## Task Completion Report
291
- - **Status**: SUCCESS
292
- - **Task ID**: {task_id from context}
293
- - **Platform**: {platform_id}
294
- - **Feature ID**: {feature_id}
295
- - **Feature**: {feature_name}
296
- - **Output Files**:
297
- - speccrew-workspace/iterations/{iter}/03.system-design/{platform_id}/INDEX.md
298
- - speccrew-workspace/iterations/{iter}/03.system-design/{platform_id}/{feature-id}-{feature-name}-design.md (or {module}-design.md if no feature_id)
299
- - **Summary**: Frontend system design completed for {feature_name} on {platform_id} with {count} module designs
300
- ```
301
-
302
- ### On Failure
303
-
304
- ```
305
- ## Task Completion Report
306
- - **Status**: FAILED
307
- - **Task ID**: {task_id from context}
308
- - **Platform**: {platform_id}
309
- - **Feature ID**: {feature_id}
310
- - **Feature**: {feature_name}
311
- - **Output Files**: []
312
- - **Error**: {description of what went wrong}
313
- - **Error Category**: DEPENDENCY_MISSING | VALIDATION_ERROR | BLOCKED
314
- - **Recovery Hint**: {suggestion for how to resolve or retry}
315
- ```
316
-
317
- **Error Categories:**
318
- - `DEPENDENCY_MISSING`: Required input file or knowledge document not found
319
- - `VALIDATION_ERROR`: Input validation failed (e.g., invalid Feature Spec format)
320
- - `BLOCKED`: Blocked by external dependency or prerequisite not met
321
-
322
- # Key Rules
323
-
324
- | Rule | Description |
325
- |------|-------------|
326
- | **Actual Framework Syntax** | All pseudo-code MUST use actual framework/library syntax from techs knowledge, NOT generic code |
327
- | **API Contract READ-ONLY** | API Contract is reference only - do not modify |
328
- | **One Module Per Function Group** | Each module design document maps to one or more related Feature Spec functions |
329
- | **Status Markers Required** | Use [EXISTING], [MODIFIED], [NEW] markers for all components and store modules |
330
- | **Follow Techs Conventions** | Naming, directory structure, patterns must follow techs knowledge |
331
- | **FORBIDDEN: TODO/FIXME Placeholders** | Design documents MUST contain complete implementation logic. Do NOT use TODO, FIXME, HACK, or any placeholder comments. Every component, method, and interaction MUST be fully specified with actual pseudocode. |
332
- | **API Route Consistency** | All API routes in the design document MUST exactly match the routes defined in the API Contract document. Before writing any route, READ the API Contract and copy routes verbatim. Do NOT invent or modify routes. |
333
- | **Cross-Feature Dependency Marking** | When referencing functionality from another Feature (e.g., conflict detection from F-APPT-002), MUST explicitly mark it as `[DEPENDENCY: F-XXX-NNN]` and define a degradation strategy (e.g., hide button, show placeholder) for when that Feature is not yet implemented. |
334
- | **Mermaid for All Diagrams** | ALL component trees, interaction flows, and state management diagrams MUST use Mermaid syntax (`graph TB`, `sequenceDiagram`, `flowchart`). Plain text ASCII diagrams are FORBIDDEN for these sections. |
335
- | **Output Filename Pattern** | Output filename MUST follow pattern: `{feature_id}-{feature_name}-design.md` |
336
-
337
- # Checklist
338
-
339
- - [ ] All techs knowledge documents loaded before design
340
- - [ ] Existing code structure analyzed via Glob/Grep
341
- - [ ] Every Feature Spec function covered in a module design
342
- - [ ] All API calls from API Contract referenced correctly
343
- - [ ] Pseudo-code uses actual framework syntax (not generic)
344
- - [ ] Component naming follows conventions-dev.md
345
- - [ ] State management follows architecture.md patterns
346
- - [ ] Directory structure follows conventions-design.md
347
- - [ ] INDEX.md generated with complete module list
348
- - [ ] All files written to correct paths under 03.system-design/{platform_id}/
349
- - [ ] Output file named as `{feature_id}-{feature_name}-design.md`
350
- - [ ] Checkpoint A passed: function extraction confirmed (or skipped via skip_confirmation)
351
- - [ ] **No TODO/FIXME placeholders** — all components and methods have complete pseudocode
352
- - [ ] **API routes match API Contract exactly** — verified route-by-route
353
- - [ ] **Cross-Feature dependencies explicitly marked** — all `[DEPENDENCY: F-XXX-NNN]` tags present with degradation strategy
354
- - [ ] **Mermaid diagrams used** — no ASCII text diagrams for flows or component trees
17
+ > **REQUIRED**: Read and execute the XML workflow above. The XML contains the complete workflow definition including all steps, rules, conditions, and checklist.