speccrew 0.6.68 → 0.7.0

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 (134) hide show
  1. package/.speccrew/agents/speccrew-task-worker.md +1 -1
  2. package/.speccrew/agents/speccrew-team-leader.md +336 -189
  3. package/.speccrew/skills/speccrew-agentflow-manager/SKILL.md +161 -0
  4. package/.speccrew/skills/speccrew-agentflow-manager/workflow.agentflow.xml +347 -0
  5. package/.speccrew/skills/speccrew-deploy-build/SKILL.md +3 -56
  6. package/.speccrew/skills/speccrew-deploy-build/workflow.agentflow.xml +125 -0
  7. package/.speccrew/skills/speccrew-deploy-migrate/SKILL.md +3 -64
  8. package/.speccrew/skills/speccrew-deploy-migrate/workflow.agentflow.xml +135 -0
  9. package/.speccrew/skills/speccrew-deploy-smoke-test/SKILL.md +4 -156
  10. package/.speccrew/skills/speccrew-deploy-smoke-test/workflow.agentflow.xml +178 -0
  11. package/.speccrew/skills/speccrew-deploy-startup/SKILL.md +3 -135
  12. package/.speccrew/skills/speccrew-deploy-startup/workflow.agentflow.xml +223 -0
  13. package/.speccrew/skills/speccrew-dev-backend/SKILL.md +10 -2
  14. package/.speccrew/skills/speccrew-dev-backend/workflow.agentflow.xml +254 -0
  15. package/.speccrew/skills/speccrew-dev-desktop-electron/SKILL.md +10 -2
  16. package/.speccrew/skills/speccrew-dev-desktop-electron/workflow.agentflow.xml +259 -0
  17. package/.speccrew/skills/speccrew-dev-desktop-tauri/SKILL.md +10 -2
  18. package/.speccrew/skills/speccrew-dev-desktop-tauri/workflow.agentflow.xml +245 -0
  19. package/.speccrew/skills/speccrew-dev-frontend/SKILL.md +10 -2
  20. package/.speccrew/skills/speccrew-dev-frontend/workflow.agentflow.xml +262 -0
  21. package/.speccrew/skills/speccrew-dev-mobile/SKILL.md +10 -2
  22. package/.speccrew/skills/speccrew-dev-mobile/workflow.agentflow.xml +244 -0
  23. package/.speccrew/skills/speccrew-dev-review-backend/SKILL.md +10 -2
  24. package/.speccrew/skills/speccrew-dev-review-backend/workflow.agentflow.xml +251 -0
  25. package/.speccrew/skills/speccrew-dev-review-desktop/SKILL.md +10 -2
  26. package/.speccrew/skills/speccrew-dev-review-desktop/workflow.agentflow.xml +214 -0
  27. package/.speccrew/skills/speccrew-dev-review-frontend/SKILL.md +10 -2
  28. package/.speccrew/skills/speccrew-dev-review-frontend/workflow.agentflow.xml +213 -0
  29. package/.speccrew/skills/speccrew-dev-review-mobile/SKILL.md +10 -2
  30. package/.speccrew/skills/speccrew-dev-review-mobile/workflow.agentflow.xml +214 -0
  31. package/.speccrew/skills/speccrew-fd-api-contract/SKILL.md +7 -1
  32. package/.speccrew/skills/speccrew-fd-api-contract/workflow.agentflow.xml +222 -0
  33. package/.speccrew/skills/speccrew-fd-feature-analyze/SKILL.md +7 -1
  34. package/.speccrew/skills/speccrew-fd-feature-analyze/workflow.agentflow.xml +223 -0
  35. package/.speccrew/skills/speccrew-fd-feature-design/SKILL.md +7 -1
  36. package/.speccrew/skills/speccrew-fd-feature-design/workflow.agentflow.xml +322 -0
  37. package/.speccrew/skills/speccrew-get-timestamp/SKILL.md +3 -39
  38. package/.speccrew/skills/speccrew-get-timestamp/workflow.agentflow.xml +43 -0
  39. package/.speccrew/skills/speccrew-knowledge-bizs-api-analyze/SKILL.md +57 -508
  40. package/.speccrew/skills/{speccrew-knowledge-bizs-api-analyze-xml/SKILL.md → speccrew-knowledge-bizs-api-analyze/workflow.agentflow.xml} +1 -154
  41. package/.speccrew/skills/speccrew-knowledge-bizs-api-graph/SKILL.md +73 -283
  42. package/.speccrew/skills/{speccrew-knowledge-bizs-api-graph-xml/SKILL.md → speccrew-knowledge-bizs-api-graph/workflow.agentflow.xml} +0 -298
  43. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/SKILL.md +931 -801
  44. package/.speccrew/skills/{speccrew-knowledge-bizs-dispatch-xml/SKILL.md → speccrew-knowledge-bizs-dispatch/workflow.agentflow.xml} +42 -272
  45. package/.speccrew/skills/speccrew-knowledge-bizs-identify-entries/SKILL.md +263 -71
  46. package/.speccrew/skills/{speccrew-knowledge-bizs-identify-entries-xml/SKILL.md → speccrew-knowledge-bizs-identify-entries/workflow.agentflow.xml} +8 -184
  47. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/SKILL.md +200 -181
  48. package/.speccrew/skills/{speccrew-knowledge-bizs-init-features-xml/SKILL.md → speccrew-knowledge-bizs-init-features/workflow.agentflow.xml} +7 -134
  49. package/.speccrew/skills/speccrew-knowledge-bizs-module-classify/SKILL.md +5 -89
  50. package/.speccrew/skills/speccrew-knowledge-bizs-module-classify/workflow.agentflow.xml +129 -0
  51. package/.speccrew/skills/speccrew-knowledge-bizs-ui-analyze/SKILL.md +454 -326
  52. package/.speccrew/skills/{speccrew-knowledge-bizs-ui-analyze-xml/SKILL.md → speccrew-knowledge-bizs-ui-analyze/workflow.agentflow.xml} +8 -128
  53. package/.speccrew/skills/speccrew-knowledge-bizs-ui-graph/SKILL.md +302 -247
  54. package/.speccrew/skills/{speccrew-knowledge-bizs-ui-graph-xml/SKILL.md → speccrew-knowledge-bizs-ui-graph/workflow.agentflow.xml} +7 -199
  55. package/.speccrew/skills/speccrew-knowledge-bizs-ui-style-extract/SKILL.md +267 -156
  56. package/.speccrew/skills/{speccrew-knowledge-bizs-ui-style-extract-xml/SKILL.md → speccrew-knowledge-bizs-ui-style-extract/workflow.agentflow.xml} +7 -151
  57. package/.speccrew/skills/speccrew-knowledge-graph-query/SKILL.md +3 -122
  58. package/.speccrew/skills/speccrew-knowledge-graph-query/workflow.agentflow.xml +106 -0
  59. package/.speccrew/skills/speccrew-knowledge-graph-write/SKILL.md +3 -80
  60. package/.speccrew/skills/speccrew-knowledge-graph-write/workflow.agentflow.xml +152 -0
  61. package/.speccrew/skills/speccrew-knowledge-module-summarize/SKILL.md +371 -265
  62. package/.speccrew/skills/{speccrew-knowledge-module-summarize-xml/SKILL.md → speccrew-knowledge-module-summarize/workflow.agentflow.xml} +7 -197
  63. package/.speccrew/skills/speccrew-knowledge-system-summarize/SKILL.md +45 -333
  64. package/.speccrew/skills/{speccrew-knowledge-system-summarize-xml/SKILL.md → speccrew-knowledge-system-summarize/workflow.agentflow.xml} +0 -177
  65. package/.speccrew/skills/speccrew-knowledge-techs-dispatch/SKILL.md +174 -727
  66. package/.speccrew/skills/{speccrew-knowledge-techs-dispatch-xml/SKILL.md → speccrew-knowledge-techs-dispatch/workflow.agentflow.xml} +10 -351
  67. package/.speccrew/skills/speccrew-knowledge-techs-generate/SKILL.md +20 -150
  68. package/.speccrew/skills/{speccrew-knowledge-techs-generate-xml/SKILL.md → speccrew-knowledge-techs-generate/workflow.agentflow.xml} +0 -169
  69. package/.speccrew/skills/speccrew-knowledge-techs-generate-conventions/SKILL.md +75 -587
  70. package/.speccrew/skills/{speccrew-knowledge-techs-generate-conventions-xml/SKILL.md → speccrew-knowledge-techs-generate-conventions/workflow.agentflow.xml} +0 -153
  71. package/.speccrew/skills/speccrew-knowledge-techs-generate-quality/SKILL.md +463 -297
  72. package/.speccrew/skills/{speccrew-knowledge-techs-generate-quality-xml/SKILL.md → speccrew-knowledge-techs-generate-quality/workflow.agentflow.xml} +0 -164
  73. package/.speccrew/skills/speccrew-knowledge-techs-generate-ui-style/SKILL.md +57 -292
  74. package/.speccrew/skills/{speccrew-knowledge-techs-generate-ui-style-xml/SKILL.md → speccrew-knowledge-techs-generate-ui-style/workflow.agentflow.xml} +2 -193
  75. package/.speccrew/skills/speccrew-knowledge-techs-index/SKILL.md +49 -335
  76. package/.speccrew/skills/{speccrew-knowledge-techs-index-xml/SKILL.md → speccrew-knowledge-techs-index/workflow.agentflow.xml} +0 -167
  77. package/.speccrew/skills/speccrew-knowledge-techs-init/SKILL.md +28 -109
  78. package/.speccrew/skills/{speccrew-knowledge-techs-init-xml/SKILL.md → speccrew-knowledge-techs-init/workflow.agentflow.xml} +0 -189
  79. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/SKILL.md +3 -487
  80. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/workflow.agentflow.xml +278 -0
  81. package/.speccrew/skills/speccrew-pm-knowledge-detector/SKILL.md +3 -71
  82. package/.speccrew/skills/speccrew-pm-knowledge-detector/workflow.agentflow.xml +108 -0
  83. package/.speccrew/skills/speccrew-pm-module-initializer/SKILL.md +3 -107
  84. package/.speccrew/skills/speccrew-pm-module-initializer/workflow.agentflow.xml +139 -0
  85. package/.speccrew/skills/speccrew-pm-module-matcher/SKILL.md +3 -115
  86. package/.speccrew/skills/speccrew-pm-module-matcher/workflow.agentflow.xml +146 -0
  87. package/.speccrew/skills/speccrew-pm-requirement-analysis/SKILL.md +3 -343
  88. package/.speccrew/skills/speccrew-pm-requirement-analysis/workflow.agentflow.xml +174 -0
  89. package/.speccrew/skills/speccrew-pm-requirement-assess/SKILL.md +3 -91
  90. package/.speccrew/skills/speccrew-pm-requirement-assess/workflow.agentflow.xml +173 -0
  91. package/.speccrew/skills/speccrew-pm-requirement-clarify/SKILL.md +3 -224
  92. package/.speccrew/skills/speccrew-pm-requirement-clarify/workflow.agentflow.xml +159 -0
  93. package/.speccrew/skills/speccrew-pm-requirement-model/SKILL.md +3 -275
  94. package/.speccrew/skills/speccrew-pm-requirement-model/workflow.agentflow.xml +210 -0
  95. package/.speccrew/skills/speccrew-pm-requirement-simple/SKILL.md +3 -76
  96. package/.speccrew/skills/speccrew-pm-requirement-simple/workflow.agentflow.xml +120 -0
  97. package/.speccrew/skills/speccrew-pm-sub-prd-generate/SKILL.md +7 -1
  98. package/.speccrew/skills/speccrew-pm-sub-prd-generate/workflow.agentflow.xml +218 -0
  99. package/.speccrew/skills/speccrew-sd-backend/SKILL.md +7 -1
  100. package/.speccrew/skills/speccrew-sd-backend/workflow.agentflow.xml +264 -0
  101. package/.speccrew/skills/speccrew-sd-desktop/SKILL.md +7 -1
  102. package/.speccrew/skills/speccrew-sd-desktop/workflow.agentflow.xml +288 -0
  103. package/.speccrew/skills/speccrew-sd-framework-evaluate/SKILL.md +7 -1
  104. package/.speccrew/skills/speccrew-sd-framework-evaluate/workflow.agentflow.xml +235 -0
  105. package/.speccrew/skills/speccrew-sd-frontend/SKILL.md +7 -1
  106. package/.speccrew/skills/speccrew-sd-frontend/workflow.agentflow.xml +299 -0
  107. package/.speccrew/skills/speccrew-sd-mobile/SKILL.md +7 -1
  108. package/.speccrew/skills/speccrew-sd-mobile/workflow.agentflow.xml +301 -0
  109. package/.speccrew/skills/speccrew-test-case-design/SKILL.md +165 -284
  110. package/.speccrew/skills/speccrew-test-case-design/workflow.agentflow.xml +210 -0
  111. package/.speccrew/skills/speccrew-test-code-gen/SKILL.md +204 -324
  112. package/.speccrew/skills/speccrew-test-code-gen/workflow.agentflow.xml +265 -0
  113. package/.speccrew/skills/speccrew-test-reporter/SKILL.md +205 -184
  114. package/.speccrew/skills/speccrew-test-reporter/workflow.agentflow.xml +284 -0
  115. package/.speccrew/skills/speccrew-test-runner/SKILL.md +242 -241
  116. package/.speccrew/skills/speccrew-test-runner/workflow.agentflow.xml +314 -0
  117. package/bin/cli.js +8 -1
  118. package/lib/commands/validate.js +565 -0
  119. package/package.json +1 -1
  120. package/workspace-template/docs/rules/{xml-workflow-spec.md → agentflow-spec.md} +5 -5
  121. package/workspace-template/scripts/validate-agentflow.js +637 -0
  122. package/.speccrew/agents/speccrew-team-leader-xml.md +0 -480
  123. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/STATUS-FORMATS.md +0 -99
  124. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js +0 -176
  125. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/get-next-batch.js +0 -150
  126. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/get-pending-features.js +0 -106
  127. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/mark-stale.js +0 -249
  128. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/merge-features.js +0 -300
  129. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/process-batch-results.js +0 -915
  130. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/update-feature-status.js +0 -226
  131. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/examples/features.json +0 -34
  132. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/scripts/generate-inventory.js +0 -1071
  133. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/scripts/test-inventory.js +0 -26
  134. package/.speccrew/skills/speccrew-knowledge-techs-dispatch/STATUS-FORMATS.md +0 -550
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  name: speccrew-knowledge-bizs-ui-style-extract
3
- description: Extract and aggregate UI design patterns (page types, components, layouts) from analyzed bizs feature documents, outputting to techs ui-style-patterns directory.
3
+ description: Extract and aggregate UI design patterns (page types, components, layouts) from analyzed bizs feature documents using XML workflow blocks, outputting to techs ui-style-patterns directory.
4
4
  tools: Read, Write
5
5
  ---
6
6
 
7
- # Bizs UI Style Extract
7
+ # Bizs UI Style Extract (XML Workflow)
8
8
 
9
- Extract and aggregate **UI design patterns** from bizs pipeline analyzed feature documents. Through cross-module clustering analysis, identify common page types, component patterns, and layout patterns, then output them to the techs knowledge base `ui-style-patterns/` subdirectory.
9
+ Extract and aggregate **UI design patterns** from bizs pipeline analyzed feature documents using XML workflow blocks. Through cross-module clustering analysis, identify common page types, component patterns, and layout patterns, then output them to the techs knowledge base `ui-style-patterns/` subdirectory.
10
10
 
11
11
  ## Language Adaptation
12
12
 
@@ -66,155 +66,270 @@ Extract and aggregate **UI design patterns** from bizs pipeline analyzed feature
66
66
 
67
67
  3. **MANDATORY: Template-first workflow** — Copy template MUST execute before filling sections for every pattern document.
68
68
 
69
- ## Workflow Overview
70
-
71
- ```mermaid
72
- graph TB
73
- S1[Step 1: Load Features Manifest] --> S2[Step 2: Read Feature Documents]
74
- S2 --> S3[Step 3: Read Module Overviews]
75
- S3 --> S4[Step 4: Cross-Module Clustering]
76
- S4 --> S5[Step 5: Generate Pattern Documents]
77
- S5 --> S6[Step 6: Return Summary]
78
- ```
79
-
80
- ---
81
-
82
- ## Step 1: Load Features Manifest
83
-
84
- **Goal**: Read the features manifest to identify all completed features.
85
-
86
- **Input Validation**:
87
- - If `platform_type` is NOT `web`, `mobile`, or `desktop` → Skip this skill (backend platforms do not have UI patterns)
88
- - Verify `features_manifest_path` exists and is valid JSON
89
- - Verify `feature_docs_path` exists and is a directory
90
- - Create `output_path` directory if it does not exist
91
-
92
- **Action**:
93
- - Read `{features_manifest_path}` (e.g., `speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/features-{platform}.json`)
94
- - Filter features where `status === "completed"`
95
- - Collect feature metadata: `featureId`, `module`, `documentPath`
96
-
97
- **Output**: List of completed features with their document paths.
98
-
99
- ---
100
-
101
- ## Step 2: Read Feature Documents
102
-
103
- **Goal**: Extract UI-related information from all completed feature documents.
104
-
105
- **Action**:
106
- - For each completed feature, read the `.md` document from `documentPath`
107
- - Extract the following sections:
108
- - **Interface Prototype**: ASCII wireframe diagrams
109
- - **Page Elements Table**: Component list with types and responsibilities
110
- - **Business Flow Description**: Interaction patterns
111
-
112
- **Extraction Focus**:
113
- | Section | What to Extract |
114
- |---------|-----------------|
115
- | Interface Prototype | ASCII wireframe structure, layout regions |
116
- | Page Elements Table | Component names, types, responsibilities, interactions |
117
- | Business Flow Description | User interaction sequences, navigation patterns |
118
-
119
- ---
120
-
121
- ## Step 3: Read Module Overviews
122
-
123
- **Goal**: Gather module-level aggregated information for context.
124
-
125
- **Action**:
126
- - Read all `module-overview.md` files from `{module_overviews_path}`
127
- - Extract module-level summaries about:
128
- - Common page structures
129
- - Shared components
130
- - Navigation patterns
131
-
132
- **Output**: Module-level context for pattern clustering.
133
-
134
- ---
135
-
136
- ## Step 4: Cross-Module Clustering Analysis
137
-
138
- **Goal**: Identify recurring UI patterns across modules through clustering analysis.
139
-
140
- **Action**:
141
- - Analyze all extracted UI information from Steps 2-3
142
- - Cluster similar patterns into categories:
143
- - **Page Types**: Pages with similar structure and purpose
144
- - **Component Patterns**: Reusable component combinations
145
- - **Layout Patterns**: Repeating structural layouts
146
-
147
- **Clustering Strategy**:
148
- - Adopt dynamic discovery strategy — Agent automatically identifies and categorizes pattern types based on actual analysis results
149
- - Templates only standardize output format, do not limit pattern types
150
- - Common patterns include but are not limited to:
151
-
152
- | Category | Common Patterns |
153
- |----------|-----------------|
154
- | Page Types | list-page, form-page, detail-page, tree-list-page, dashboard-page, wizard-page |
155
- | Component Patterns | search-filter-bar, data-table-pagination, modal-form, drawer-detail, tab-panel |
156
- | Layout Patterns | sidebar-content, topbar-sidebar-content, full-screen |
157
-
158
- **Pattern Recognition Criteria**:
159
- - **Frequency**: Pattern appears in 2+ features (stronger signal if across different modules)
160
- - **Similarity**: Structural similarity in ASCII wireframes
161
- - **Semantic alignment**: Similar business purpose and interaction flow
162
-
163
- > **Note**: Cross-module occurrence is a strong signal but not required. Patterns appearing in multiple features within a single module are also valid for extraction.
164
-
165
- ---
166
-
167
- ## Step 5: Generate Pattern Documents
168
-
169
- **Goal**: Create pattern documents for each identified pattern using template-fill workflow.
170
-
171
- ### 5.1 Template Selection
172
-
173
- | Pattern Category | Template File | Output Directory |
174
- |-----------------|---------------|------------------|
175
- | Page types | `templates/PAGE-TYPE-TEMPLATE.md` | `{output_path}/page-types/` |
176
- | Component patterns | `templates/COMPONENT-PATTERN-TEMPLATE.md` | `{output_path}/components/` |
177
- | Layout patterns | `templates/LAYOUT-PATTERN-TEMPLATE.md` | `{output_path}/layouts/` |
178
-
179
- **File Naming Convention**:
180
- - Use `kebab-case` for pattern names
181
- - Examples: `list-page.md`, `search-filter-bar.md`, `sidebar-content.md`
182
-
183
- ### 5.2 For Each Pattern: Copy Template to Document Path
184
-
185
- For each identified pattern:
186
- 1. **Select the appropriate template** based on pattern category
187
- 2. **Replace top-level placeholders** (pattern name, category, etc.)
188
- 3. **Create the document** using `create_file` at the corresponding output path
189
- 4. **Verify**: Document has complete section structure ready for filling
190
-
191
- ### 5.3 For Each Pattern: Fill Sections Using search_replace
192
-
193
- > ⚠️ **CRITICAL CONSTRAINTS:**
194
- > - **FORBIDDEN: `create_file` to rewrite the entire document**
195
- > - **MUST use `search_replace` to fill each section individually**
196
- > - **All section titles MUST be preserved**
197
-
198
- **Content Requirements**:
199
- 1. **ASCII wireframes**: Must be generalized versions (not direct copies from specific features)
200
- 2. **Instance references**: Must use relative paths to reference actual feature documents
201
- 3. **Mermaid diagrams**: Must follow `speccrew-workspace/docs/rules/mermaid-rule.md` rules
202
- - Use `graph TB/LR` syntax only
203
- - No `<br/>` tags, no `style` definitions, no nested `subgraph`
204
- - No `direction` keyword, no special symbols
205
-
206
- ---
207
-
208
- ## Step 6: Return Summary
209
-
210
- **Goal**: Provide summary of generated pattern documents.
211
-
212
- **Action**:
213
- - Collect all generated file paths
214
- - Count patterns by category
215
- - Return summary object
216
-
217
- ---
69
+ ## AgentFlow Definition
70
+
71
+ <!-- @agentflow: workflow.agentflow.xml -->
72
+
73
+ > **REQUIRED**: Before executing this workflow, read the XML workflow specification: `speccrew-workspace/docs/rules/agentflow-spec.md`
74
+
75
+ <!-- ============================================================
76
+ Input Parameters Definition
77
+ ============================================================ -->
78
+ <block type="input" id="I1" desc="Workflow input parameters">
79
+ <field name="platform_id" required="true" type="string" desc="Platform identifier (e.g., web-vue, mobile-uniapp)"/>
80
+ <field name="platform_type" required="true" type="string" desc="Platform type (web, mobile, desktop)"/>
81
+ <field name="feature_docs_path" required="true" type="string" desc="Completed feature documents base path"/>
82
+ <field name="features_manifest_path" required="true" type="string" desc="Path to features-{platform}.json"/>
83
+ <field name="module_overviews_path" required="true" type="string" desc="Parent directory containing all module overview subdirectories"/>
84
+ <field name="output_path" required="true" type="string" desc="Output directory for pattern documents"/>
85
+ <field name="language" required="true" type="string" desc="User language code"/>
86
+ </block>
87
+
88
+ <!-- ============================================================
89
+ Global Constraints
90
+ ============================================================ -->
91
+ <block type="rule" id="R1" level="forbidden" desc="Document generation constraints">
92
+ <field name="text">Using create_file to write pattern documents directly</field>
93
+ <field name="text">Full-file rewrite of pattern documents</field>
94
+ </block>
95
+
96
+ <block type="rule" id="R2" level="mandatory" desc="Document generation requirements">
97
+ <field name="text">Copy template MUST execute before filling sections for every pattern document</field>
98
+ <field name="text">All generated pattern documents must be in the specified language</field>
99
+ </block>
100
+
101
+ <!-- ============================================================
102
+ Global Continuous Execution Rules
103
+ ============================================================ -->
104
+ <block type="rule" id="GLOBAL-R1" level="forbidden" desc="Continuous execution constraints — NEVER violate">
105
+ <field name="text">DO NOT ask user "Should I continue?" or "How would you like to proceed?" during execution</field>
106
+ <field name="text">DO NOT offer options like "Full execution / Partial / Stop" — always execute ALL tasks to completion</field>
107
+ <field name="text">DO NOT suggest "Due to context window limits, let me pause" — complete current task, use checkpoint for resumption</field>
108
+ <field name="text">DO NOT estimate workload and suggest breaking it into phases — execute ALL items in sequence</field>
109
+ <field name="text">DO NOT warn about "large number of files" or "this may take a while" — proceed with generation</field>
110
+ <field name="text">Context window management: if approaching limit, save progress to checkpoint file and resume — do NOT ask user for guidance</field>
111
+ </block>
112
+
113
+ <!-- ============================================================
114
+ Gateway: Platform Type Check
115
+ ============================================================ -->
116
+ <block type="gateway" id="G1" mode="exclusive" desc="Check platform type for UI pattern extraction">
117
+ <branch test="${platform_type} NOT IN ['web', 'mobile', 'desktop']" name="Backend platform">
118
+ <block type="event" id="E1" action="log" level="info" desc="Log skip reason">
119
+ <field name="message">Skipping skill: backend platforms do not have UI patterns</field>
120
+ </block>
121
+ <block type="task" id="B1" action="analyze" desc="Return skip status">
122
+ <field name="status" value="skipped"/>
123
+ <field name="reason" value="Backend platform does not have UI patterns"/>
124
+ <field name="output" var="summary"/>
125
+ </block>
126
+ </branch>
127
+ <branch test="${platform_type} IN ['web', 'mobile', 'desktop']" name="UI platform">
128
+
129
+ <!-- ============================================================
130
+ Step 1: Load Features Manifest
131
+ ============================================================ -->
132
+ <sequence id="S1" name="Step 1: Load Features Manifest" status="pending" desc="Read features manifest to identify completed features">
133
+ <block type="task" id="B2" action="read-file" desc="Read features manifest file">
134
+ <field name="path" value="${features_manifest_path}"/>
135
+ <field name="output" var="featuresManifest"/>
136
+ </block>
137
+
138
+ <block type="task" id="B3" action="analyze" desc="Filter completed features">
139
+ <field name="input" value="${featuresManifest}"/>
140
+ <field name="filter" value="status === 'completed'"/>
141
+ <field name="collect" value="featureId, module, documentPath"/>
142
+ <field name="output" var="completed_features"/>
143
+ </block>
144
+ </sequence>
145
+
146
+ <!-- ============================================================
147
+ Gateway: Check Completed Features
148
+ ============================================================ -->
149
+ <block type="gateway" id="G2" mode="guard" desc="Check if completed features exist">
150
+ <branch test="${completed_features.length} > 0" name="Has completed features">
151
+
152
+ <!-- Step 1.5: Create Output Directory -->
153
+ <block type="task" id="B4" action="run-script" desc="Create output directory structure">
154
+ <field name="command">node -e "require('fs').mkdirSync('${output_path}/page-types', {recursive:true}); require('fs').mkdirSync('${output_path}/components', {recursive:true}); require('fs').mkdirSync('${output_path}/layouts', {recursive:true})"</field>
155
+ </block>
156
+
157
+ <!-- ============================================================
158
+ Step 2: Read Feature Documents
159
+ ============================================================ -->
160
+ <sequence id="S2" name="Step 2: Read Feature Documents" status="pending" desc="Extract UI information from feature documents">
161
+ <block type="task" id="B5" action="analyze" desc="Extract UI-related information from feature documents">
162
+ <field name="input" value="${completed_features}"/>
163
+ <field name="feature_docs_path" value="${feature_docs_path}"/>
164
+ <field name="extract_section" value="Interface Prototype"/>
165
+ <field name="extract_items" value="ASCII wireframe diagrams, layout regions"/>
166
+ <field name="extract_section_2" value="Page Elements Table"/>
167
+ <field name="extract_items_2" value="Component names, types, responsibilities, interactions"/>
168
+ <field name="extract_section_3" value="Business Flow Description"/>
169
+ <field name="extract_items_3" value="User interaction sequences, navigation patterns"/>
170
+ <field name="output" var="ui_extracted_data"/>
171
+ </block>
172
+ </sequence>
173
+
174
+ <!-- ============================================================
175
+ Step 3: Read Module Overviews
176
+ ============================================================ -->
177
+ <sequence id="S3" name="Step 3: Read Module Overviews" status="pending" desc="Gather module-level context">
178
+ <block type="task" id="B6" action="analyze" desc="Read module overview files for context">
179
+ <field name="glob_pattern" value="${module_overviews_path}/*/module-overview.md"/>
180
+ <field name="extract_items" value="Common page structures, Shared components, Navigation patterns"/>
181
+ <field name="output" var="module_context"/>
182
+ </block>
183
+ </sequence>
184
+
185
+ <!-- Checkpoint: Data Collection Complete -->
186
+ <block type="checkpoint" id="CP1" name="data-collection-complete" desc="Data collection complete">
187
+ <field name="file" value="${output_path}/.progress.json"/>
188
+ <field name="verify" value="${ui_extracted_data} != null AND ${module_context} != null"/>
189
+ </block>
190
+
191
+ <!-- ============================================================
192
+ Step 4: Cross-Module Clustering Analysis
193
+ ============================================================ -->
194
+ <sequence id="S4" name="Step 4: Cross-Module Clustering Analysis" status="pending" desc="Identify recurring UI patterns">
195
+ <block type="task" id="B7" action="analyze" desc="Perform cross-module clustering analysis">
196
+ <field name="input" value="${ui_extracted_data}"/>
197
+ <field name="module_context" value="${module_context}"/>
198
+ <field name="clustering_approach" value="Dynamic discovery - Agent automatically identifies and categorizes pattern types based on actual analysis results"/>
199
+ <field name="note" value="Templates only standardize output format, do not limit pattern types"/>
200
+ <field name="categories_page_types" value="Pages with similar structure and purpose (e.g., list-page, form-page, detail-page, tree-list-page, dashboard-page, wizard-page)"/>
201
+ <field name="categories_component_patterns" value="Reusable component combinations (e.g., search-filter-bar, data-table-pagination, modal-form, drawer-detail, tab-panel)"/>
202
+ <field name="categories_layout_patterns" value="Repeating structural layouts (e.g., sidebar-content, topbar-sidebar-content, full-screen)"/>
203
+ <field name="recognition_frequency" value="Pattern appears in 2+ features (stronger signal if across different modules)"/>
204
+ <field name="recognition_similarity" value="Structural similarity in ASCII wireframes"/>
205
+ <field name="recognition_semantic" value="Similar business purpose and interaction flow"/>
206
+ <field name="output" var="identified_patterns"/>
207
+ </block>
208
+ </sequence>
209
+
210
+ <!-- ============================================================
211
+ Gateway: Check Identified Patterns
212
+ ============================================================ -->
213
+ <block type="gateway" id="G3" mode="exclusive" desc="Check if patterns were identified">
214
+ <branch test="${identified_patterns.length} == 0" name="No patterns">
215
+ <block type="event" id="E2" action="log" level="warn" desc="Log no patterns">
216
+ <field name="message">No patterns identified from feature documents</field>
217
+ </block>
218
+ <block type="task" id="B8" action="analyze" desc="Return empty result">
219
+ <field name="status" value="completed"/>
220
+ <field name="platform_id" value="${platform_id}"/>
221
+ <field name="patterns_page_types" value='{"count": 0, "files": []}'/>
222
+ <field name="patterns_components" value='{"count": 0, "files": []}'/>
223
+ <field name="patterns_layouts" value='{"count": 0, "files": []}'/>
224
+ <field name="total_patterns" value="0"/>
225
+ <field name="output_path" value="${output_path}"/>
226
+ <field name="output" var="summary"/>
227
+ </block>
228
+ </branch>
229
+ <branch test="${identified_patterns.length} > 0" name="Has patterns">
230
+
231
+ <!-- ============================================================
232
+ Step 5: Generate Pattern Documents
233
+ ============================================================ -->
234
+ <block type="loop" id="L1" over="${identified_patterns}" as="pattern" desc="Generate pattern documents">
235
+
236
+ <!-- 5.1 Template Selection -->
237
+ <block type="gateway" id="G4" mode="exclusive" desc="Select template based on pattern category">
238
+ <branch test="${pattern.category} == 'page-types'" name="Page type">
239
+ <block type="task" id="B9" action="analyze" desc="Select page type template">
240
+ <field name="template_path" value="./templates/PAGE-TYPE-TEMPLATE.md"/>
241
+ <field name="output_directory" value="${output_path}/page-types/"/>
242
+ <field name="output" var="selected_template"/>
243
+ </block>
244
+ </branch>
245
+ <branch test="${pattern.category} == 'components'" name="Component pattern">
246
+ <block type="task" id="B10" action="analyze" desc="Select component pattern template">
247
+ <field name="template_path" value="./templates/COMPONENT-PATTERN-TEMPLATE.md"/>
248
+ <field name="output_directory" value="${output_path}/components/"/>
249
+ <field name="output" var="selected_template"/>
250
+ </block>
251
+ </branch>
252
+ <branch test="${pattern.category} == 'layouts'" name="Layout pattern">
253
+ <block type="task" id="B11" action="analyze" desc="Select layout pattern template">
254
+ <field name="template_path" value="./templates/LAYOUT-PATTERN-TEMPLATE.md"/>
255
+ <field name="output_directory" value="${output_path}/layouts/"/>
256
+ <field name="output" var="selected_template"/>
257
+ </block>
258
+ </branch>
259
+ </block>
260
+
261
+ <!-- 5.2 Copy Template to Document Path -->
262
+ <block type="task" id="B12" action="run-script" desc="Copy template to output path">
263
+ <field name="template" value="${selected_template}"/>
264
+ <field name="filename_format" value="kebab-case (e.g., list-page.md, search-filter-bar.md, sidebar-content.md)"/>
265
+ <field name="output_path" value="${selected_template.output_directory}/${pattern.name}.md"/>
266
+ <field name="output" var="document_path"/>
267
+ </block>
268
+
269
+ <!-- 5.3 Fill Sections Using search_replace -->
270
+ <block type="task" id="B13" action="analyze" desc="Fill pattern document sections">
271
+ <field name="document_path" value="${document_path}"/>
272
+ <field name="pattern" value="${pattern}"/>
273
+ <field name="language" value="${language}"/>
274
+ <field name="constraint_forbidden" value="Using create_file to rewrite the entire document"/>
275
+ <field name="constraint_mandatory" value="Use search_replace to fill each section individually"/>
276
+ <field name="constraint_sections" value="All section titles MUST be preserved"/>
277
+ <field name="content_ascii_wireframes" value="Must be generalized versions (not direct copies from specific features)"/>
278
+ <field name="content_instance_references" value="Must use relative paths to reference actual feature documents"/>
279
+ <field name="mermaid_rule" value="Follow speccrew-workspace/docs/rules/mermaid-rule.md rules"/>
280
+ <field name="mermaid_syntax" value="Use graph TB/LR syntax only"/>
281
+ <field name="mermaid_no_br" value="No br/ tags, no style definitions, no nested subgraph"/>
282
+ <field name="mermaid_no_direction" value="No direction keyword, no special symbols"/>
283
+ <field name="output" var="filled_document"/>
284
+ </block>
285
+
286
+ <!-- Checkpoint: Pattern Document Generated -->
287
+ <block type="checkpoint" id="CP2" name="pattern-document-generated" desc="Pattern document generated">
288
+ <field name="file" value="${output_path}/.progress.json"/>
289
+ <field name="verify" value="file_exists(${document_path}) AND document_has_all_sections(${document_path})"/>
290
+ </block>
291
+
292
+ </block>
293
+
294
+ <!-- Step 6: Return Summary -->
295
+ <block type="task" id="B14" action="analyze" desc="Generate summary of pattern documents">
296
+ <field name="collect_files" value="All generated file paths"/>
297
+ <field name="collect_counts" value="Pattern counts by category"/>
298
+ <field name="output" var="summary"/>
299
+ </block>
300
+
301
+ </branch>
302
+ </block>
303
+
304
+ </branch>
305
+ <branch test="${completed_features.length} == 0" name="No completed features">
306
+ <block type="event" id="E3" action="log" level="warn" desc="Log no features">
307
+ <field name="message">No completed features found - returning empty result</field>
308
+ </block>
309
+ <block type="task" id="B15" action="analyze" desc="Return empty summary">
310
+ <field name="status" value="completed"/>
311
+ <field name="platform_id" value="${platform_id}"/>
312
+ <field name="patterns_page_types" value='{"count": 0, "files": []}'/>
313
+ <field name="patterns_components" value='{"count": 0, "files": []}'/>
314
+ <field name="patterns_layouts" value='{"count": 0, "files": []}'/>
315
+ <field name="total_patterns" value="0"/>
316
+ <field name="output_path" value="${output_path}"/>
317
+ <field name="output" var="summary"/>
318
+ </block>
319
+ </branch>
320
+ </block>
321
+
322
+ </branch>
323
+ </block>
324
+
325
+ <!-- ============================================================
326
+ Output Results
327
+ ============================================================ -->
328
+ <block type="output" id="O1" desc="Workflow output results">
329
+ <field name="final_summary" from="${summary}" type="object" desc="Summary of generated pattern documents with file list and counts"/>
330
+ </block>
331
+
332
+ </workflow>
218
333
 
219
334
  ## Generation Rules
220
335
 
@@ -237,8 +352,6 @@ For each identified pattern:
237
352
  - Template section headers remain in English
238
353
  - Content text matches user language
239
354
 
240
- ---
241
-
242
355
  ## Error Handling
243
356
 
244
357
  | Scenario | Handling |
@@ -248,8 +361,6 @@ For each identified pattern:
248
361
  | Template not found | Use default structure, log warning |
249
362
  | Feature document missing | Skip feature, continue with others |
250
363
 
251
- ---
252
-
253
364
  ## Checklist
254
365
 
255
366
  - [ ] Step 1: Features manifest loaded, completed features identified