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,339 +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`.
39
- - `feature_name`: Feature name, e.g., `customer-list`.
40
- - `platform_id`: Target platform, e.g., `mobile-uniapp`, `mobile-flutter`.
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-name]-feature-spec.md`
51
- 2. **API Contract**: `speccrew-workspace/iterations/{number}-{type}-{name}/03.api-contract/[feature-name]-api-contract.md`
52
- 3. **Mobile 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
- 4. **Design template**: `speccrew-sd-mobile/templates/SD-MOBILE-TEMPLATE.md`
58
- 5. **Index template**: `speccrew-sd-mobile/templates/INDEX-TEMPLATE.md`
59
-
60
- ## Step 2: Analyze Existing Code Structure
61
-
62
- Use Glob/Grep to understand current codebase:
63
-
64
- | Target | Glob Pattern | Purpose |
65
- |--------|-------------|---------|
66
- | Screen/Page directory | `lib/screens/**/*.dart` or `src/screens/**/*.tsx` | Understand screen organization |
67
- | Widget/Component directory | `lib/widgets/**/*.dart` or `src/components/**/*` | Understand widget organization |
68
- | State management | `lib/providers/**/*.dart` or `src/stores/**/*` | Understand state pattern |
69
- | Navigation configuration | `lib/router/**/*.dart` or `src/navigation/**/*` | Understand routing structure |
70
- | API layer | `lib/api/**/*.dart` or `src/api/**/*` | Understand API encapsulation pattern |
71
- | Local storage | `lib/storage/**/*.dart` or `src/storage/**/*` | Understand persistence patterns |
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
- For each function, extract:
81
-
82
- | Aspect | Content to Extract |
83
- |--------|-------------------|
84
- | Mobile prototype | UI flow description from Feature Spec |
85
- | Interaction flow | User actions and system responses |
86
- | Backend API calls | Required API endpoints from API Contract |
87
- | Data requirements | Fields and structures needed |
88
- | Platform features | Camera, GPS, push notifications, biometrics, etc. |
89
-
90
- Mark each function's screens/widgets as:
91
-
92
- | Marker | Meaning | Example |
93
- |--------|---------|---------|
94
- | `[EXISTING]` | Reuse current screen/widget | `[EXISTING] UserProfileScreen` |
95
- | `[MODIFIED]` | Enhance/change existing | `[MODIFIED] OrderList - add pull-to-refresh` |
96
- | `[NEW]` | Create brand new | `[NEW] ProductDetailPage` |
97
-
98
- **Checkpoint A**:
99
- - If `skip_confirmation` = `true`: Log the function extraction summary and **proceed automatically** without waiting for user confirmation.
100
- - If `skip_confirmation` is not set or `false`: Present function extraction summary to user and **wait for explicit confirmation** before proceeding.
101
-
102
- > ⚠️ **FORBIDDEN**: Worker MUST NOT self-decide to skip confirmation. Only the `skip_confirmation` parameter from dispatch context controls this behavior.
103
-
104
- ## Step 4: Generate Module Design Documents
105
-
106
- For each function (or logical group of closely related functions = one module):
107
-
108
- ### Output File Naming Convention
109
-
110
- **MANDATORY**: The design document file MUST be named using this exact pattern:
111
-
112
- ```
113
- {feature_id}-{feature_name}-design.md
114
- ```
115
-
116
- Examples:
117
- - `F-M01-05-操作日志-design.md` ✅
118
- - `F-M02-01-顾客档案管理-design.md` ✅
119
- - `member-level-change-history-design.md` ❌ (missing feature_id prefix)
120
- - `customer-profile-design.md` ❌ (missing feature_id prefix)
121
-
122
- Where:
123
- - `feature_id`: The exact feature ID from dispatch context (e.g., `F-M01-05`, `F-M02-01`)
124
- - `feature_name`: The exact feature name from dispatch context (e.g., `操作日志`, `顾客档案管理`)
125
-
126
- > ⚠️ **FORBIDDEN**:
127
- > - Using any filename format other than `{feature_id}-{feature_name}-design.md`
128
- > - Omitting the feature_id prefix
129
- > - Translating or paraphrasing the feature_name (must use the exact name from context)
130
- > - Using function/sub-feature names instead of the main feature_name
131
-
132
- ### 4.1 Read Template
133
-
134
- Read `SD-MOBILE-TEMPLATE.md` for document structure.
135
-
136
- ### 4.2a Copy Template to Document Path
137
-
138
- 1. **Read the design template**: `templates/SD-MOBILE-TEMPLATE.md`
139
- 2. **Replace top-level placeholders** with known variables:
140
- - Module name, feature name, platform ID, etc.
141
- 3. **Create the document file** using `create_file`:
142
- - Target path: `speccrew-workspace/iterations/{number}-{type}-{name}/03.system-design/{platform_id}/{module}-design.md`
143
- - Content: Template with top-level placeholders replaced
144
- 4. **Verify**: Document should have complete section structure ready for filling
145
-
146
- ### 4.2b Fill Each Section Using search_replace
147
-
148
- Fill each section with technology-specific implementation details.
149
-
150
- > ⚠️ **CRITICAL CONSTRAINTS:**
151
- > - **FORBIDDEN: `create_file` to rewrite the entire document** — it destroys template structure
152
- > - **MUST use `search_replace` to fill each section individually**
153
- > - **All section titles and numbering MUST be preserved**
154
- > - If a section has no applicable content, keep the section title and replace placeholder with "N/A"
155
-
156
- | Section | Technology-Specific Content |
157
- |---------|----------------------------|
158
- | Screen/widget tree | Use actual framework patterns (Flutter Widgets / React Native Components) |
159
- | Props/Parameters | Type definitions from conventions-dev.md |
160
- | State management | Actual pattern (Provider/Bloc/Riverpod for Flutter, Redux/MobX for React Native) |
161
- | API layer | Actual HTTP client (Dio for Flutter, Axios/fetch for React Native) |
162
- | Navigation | Actual router config (GoRouter for Flutter, React Navigation for React Native) |
163
- | Local storage | Actual storage solution (SharedPreferences/Hive/SQLite/MMKV) |
164
- | Platform features | Actual plugin APIs (camera, geolocator, local_notifications, etc.) |
165
- | Pseudo-code | MUST use actual framework syntax from techs knowledge |
166
-
167
- **Key Rules for Pseudo-code**:
168
- - MUST use actual framework API syntax from techs knowledge
169
- - NOT generic pseudo-code
170
- - Include actual import statements
171
- - Use actual state management/API patterns from conventions
172
-
173
- ### 4.3 Verify Output
174
-
175
- Verify the completed design document:
176
- - All sections filled with actual content (no remaining placeholders)
177
- - Mermaid diagrams render correctly
178
- - Pseudo-code uses actual framework syntax from techs knowledge
179
-
180
- ## Step 5: Generate Platform INDEX.md
181
-
182
- > **Conditional Execution**:
183
- > - If `skip_index_generation` = `true`, **skip this entire Step 5**.
184
- > - If `index_only` = `true`, this step is the ONLY step to execute (Steps 1-4 are skipped).
185
-
186
- After all module designs are complete:
187
-
188
- ### 5.1 Read Template
189
-
190
- Read `INDEX-TEMPLATE.md` for document structure.
191
-
192
- ### 5.2a Copy Index Template to Document Path
193
-
194
- 1. **Read the index template**: `templates/INDEX-TEMPLATE.md`
195
- 2. **Replace top-level placeholders** (platform name, feature name, etc.)
196
- 3. **Create the document file** using `create_file`:
197
- - Target path: `speccrew-workspace/iterations/{number}-{type}-{name}/03.system-design/{platform_id}/INDEX.md`
198
- - Content: Template with top-level placeholders replaced
199
-
200
- ### 5.2b Fill Index Sections Using search_replace
201
-
202
- > ⚠️ **CRITICAL CONSTRAINTS:**
203
- > - **FORBIDDEN: `create_file` to rewrite the entire document** — it destroys template structure
204
- > - **MUST use `search_replace` to fill each section individually**
205
- > - **All section titles and numbering MUST be preserved**
206
-
207
- | Section | Content Source |
208
- |---------|---------------|
209
- | Tech stack summary | tech-stack.md |
210
- | Target platforms | tech-stack.md (iOS/Android min versions) |
211
- | Shared design decisions | architecture.md, conventions-design.md |
212
- | State management strategy | architecture.md state management section |
213
- | Base widgets/components | conventions-design.md shared components |
214
- | API client configuration | conventions-dev.md HTTP client section |
215
- | Authentication pattern | architecture.md authentication section |
216
- | Third-party SDKs | tech-stack.md dependencies |
217
-
218
- ### 5.3 Build Module List
219
-
220
- Create table with links to each module design document.
221
-
222
- ### 5.4 Verify Output
223
-
224
- Verify the completed INDEX.md:
225
- - All sections filled with actual content (no remaining placeholders)
226
- - All module design documents are correctly linked
227
- - Platform-level summary is complete
228
-
229
- ## Step 6: Present Summary
230
-
231
- Present to user:
232
-
233
- ```
234
- Mobile System Design Summary for: {feature-name}
235
- Platform: {platform_id}
236
-
237
- Module Design Documents: {count}
238
- ├── {module1}-design.md
239
- ├── {module2}-design.md
240
- └── ...
241
-
242
- Key Design Decisions:
243
- - State Management: {approach}
244
- - Navigation Strategy: {approach}
245
- - API Layer: {approach}
246
- - Local Storage: {approach}
247
- - Platform Features: {list}
248
-
249
- Concerns/Trade-offs:
250
- - {list any concerns}
251
- ```
252
-
253
- **Ask user to confirm:**
254
- 1. Are the screen architectures appropriate?
255
- 2. Is the state management strategy correct?
256
- 3. Do the pseudo-code patterns match project conventions?
257
- 4. Are all API calls from API Contract covered?
258
- 5. Are platform-specific features (permissions, native integration) properly handled?
259
-
260
- ## Step 7: Update Task Status (if dispatch_progress_file provided)
261
-
262
- > **Conditional Execution**: Only execute this step if `dispatch_progress_file` and `task_id` parameters are provided in the dispatch context.
263
-
264
- Update the task status in DISPATCH-PROGRESS.json to mark this task as completed:
265
-
266
- ```
267
- node "${update_progress_script}" update-task --file "${dispatch_progress_file}" --task-id "${task_id}" --status completed
268
- ```
269
-
270
- If the design document generation failed at any step, update with status `failed` instead:
271
- ```
272
- node "${update_progress_script}" update-task --file "${dispatch_progress_file}" --task-id "${task_id}" --status failed
273
- ```
274
-
275
- > ⚠️ **IMPORTANT**: This step MUST be the last action before returning the completion report. Do NOT skip this step in batch dispatch mode.
276
-
277
- ## Step 8: Task Completion Report
278
-
279
- After completing all steps, output a structured completion report for the System Designer Agent to parse and update DISPATCH-PROGRESS.json:
280
-
281
- ### On Success
282
-
283
- ```
284
- ## Task Completion Report
285
- - **Status**: SUCCESS
286
- - **Task ID**: {task_id from context}
287
- - **Platform**: {platform_id}
288
- - **Feature**: {feature_name}
289
- - **Output Files**:
290
- - speccrew-workspace/iterations/{iter}/03.system-design/{platform_id}/INDEX.md
291
- - speccrew-workspace/iterations/{iter}/03.system-design/{platform_id}/{module1}-design.md
292
- - speccrew-workspace/iterations/{iter}/03.system-design/{platform_id}/{module2}-design.md
293
- - **Summary**: Mobile system design completed for {feature_name} on {platform_id} with {count} module designs
294
- ```
295
-
296
- ### On Failure
297
-
298
- ```
299
- ## Task Completion Report
300
- - **Status**: FAILED
301
- - **Task ID**: {task_id from context}
302
- - **Platform**: {platform_id}
303
- - **Feature**: {feature_name}
304
- - **Output Files**: []
305
- - **Error**: {description of what went wrong}
306
- - **Error Category**: DEPENDENCY_MISSING | VALIDATION_ERROR | BLOCKED
307
- - **Recovery Hint**: {suggestion for how to resolve or retry}
308
- ```
309
-
310
- **Error Categories:**
311
- - `DEPENDENCY_MISSING`: Required input file or knowledge document not found
312
- - `VALIDATION_ERROR`: Input validation failed (e.g., invalid Feature Spec format)
313
- - `BLOCKED`: Blocked by external dependency or prerequisite not met
314
-
315
- # Key Rules
316
-
317
- | Rule | Description |
318
- |------|-------------|
319
- | **Actual Framework Syntax** | All pseudo-code MUST use actual framework/library syntax from techs knowledge, NOT generic code |
320
- | **API Contract READ-ONLY** | API Contract is reference only - do not modify |
321
- | **One Module Per Function Group** | Each module design document maps to one or more related Feature Spec functions |
322
- | **Status Markers Required** | Use [EXISTING], [MODIFIED], [NEW] markers for all screens, widgets, and store modules |
323
- | **Follow Techs Conventions** | Naming, directory structure, patterns must follow techs knowledge |
324
- | **Platform-Specific Handling** | Properly handle iOS/Android differences, permissions, and native integrations |
325
- | **Offline Support** | Consider offline-first patterns where applicable |
326
- | **FORBIDDEN: TODO/FIXME Placeholders** | Design documents MUST contain complete implementation logic. Do NOT use TODO, FIXME, HACK, or any placeholder comments. Every screen, component, and method MUST be fully specified with actual pseudocode. |
327
- | **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. |
328
- | **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. |
329
- | **Mermaid for All Diagrams** | ALL screen trees, navigation flows, interaction sequences, and state diagrams MUST use Mermaid syntax (`graph TB`, `sequenceDiagram`, `flowchart`). Plain text ASCII diagrams are FORBIDDEN for these sections. |
330
- | **Output Filename Pattern** | Output filename MUST follow pattern: `{feature_id}-{feature_name}-design.md` |
331
-
332
- # Checklist
333
-
334
- - [ ] All techs knowledge documents loaded before design
335
- - [ ] Existing code structure analyzed via Glob/Grep
336
- - [ ] Every Feature Spec function covered in a module design
337
- - [ ] All API calls from API Contract referenced correctly
338
- - [ ] Pseudo-code uses actual framework syntax (not generic)
339
- - [ ] Screen/widget naming follows conventions-dev.md
340
- - [ ] State management follows architecture.md patterns
341
- - [ ] Navigation follows conventions-design.md
342
- - [ ] Local storage strategy documented
343
- - [ ] Platform permissions and native integrations documented
344
- - [ ] App lifecycle handling documented
345
- - [ ] INDEX.md generated with complete module list
346
- - [ ] All files written to correct paths under 03.system-design/{platform_id}/
347
- - [ ] Output file named as `{feature_id}-{feature_name}-design.md`
348
- - [ ] **Checkpoint A passed**: function extraction confirmed (or skipped via skip_confirmation)
349
- - [ ] **No TODO/FIXME placeholders** — all screens and methods have complete pseudocode
350
- - [ ] **API routes match API Contract exactly** — verified route-by-route
351
- - [ ] **Cross-Feature dependencies explicitly marked** — all `[DEPENDENCY: F-XXX-NNN]` tags present with degradation strategy
352
- - [ ] **Mermaid diagrams used** — no ASCII text diagrams for flows or screen trees
17
+ > **REQUIRED**: Read and execute the XML workflow above. The XML contains the complete workflow definition including all steps, rules, conditions, and checklist.