speccrew 0.6.69 → 0.7.1

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 (137) 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/init.js +11 -3
  119. package/lib/commands/update.js +11 -3
  120. package/lib/commands/validate.js +565 -0
  121. package/lib/utils.js +43 -0
  122. package/package.json +1 -1
  123. package/workspace-template/docs/rules/{xml-workflow-spec.md → agentflow-spec.md} +5 -5
  124. package/workspace-template/scripts/validate-agentflow.js +637 -0
  125. package/.speccrew/agents/speccrew-team-leader-xml.md +0 -480
  126. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/STATUS-FORMATS.md +0 -99
  127. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js +0 -176
  128. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/get-next-batch.js +0 -150
  129. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/get-pending-features.js +0 -106
  130. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/mark-stale.js +0 -249
  131. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/merge-features.js +0 -300
  132. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/process-batch-results.js +0 -915
  133. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/update-feature-status.js +0 -226
  134. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/examples/features.json +0 -34
  135. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/scripts/generate-inventory.js +0 -1087
  136. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/scripts/test-inventory.js +0 -26
  137. package/.speccrew/skills/speccrew-knowledge-techs-dispatch/STATUS-FORMATS.md +0 -550
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  name: speccrew-knowledge-module-summarize
3
- description: Summarize a module's features to complete MODULE-OVERVIEW.md. Reads all FEATURE-DETAIL.md files of a module and generates the complete module overview with entities, dependencies, and business rules.
3
+ description: Summarize a module's features to complete MODULE-OVERVIEW.md using XML workflow blocks. Reads all FEATURE-DETAIL.md files of a module and generates the complete module overview with entities, dependencies, and business rules.
4
4
  tools: Read, Write, Glob
5
5
  ---
6
6
 
7
- # Module Summarize - Complete Module Overview
7
+ # Module Summarize - Complete Module Overview (XML Workflow)
8
8
 
9
9
  Read all {{feature_name}}.md files of a specific module, extract and summarize information to complete {{module_name}}-overview.md (full version with entities, dependencies, flows, and rules).
10
10
 
@@ -26,17 +26,17 @@ Read all {{feature_name}}.md files of a specific module, extract and summarize i
26
26
 
27
27
  ## Input
28
28
 
29
- - `module_name`: Module name to summarize
30
- - `module_path`: Path to module directory (e.g., `speccrew-workspace/knowledges/bizs/{{platform_type}}/{{module_name}}/`) containing:
31
- - {{module_name}}-overview.md (initial version)
32
- - features/{{feature_name}}.md files
33
- - `language`: Target language for generated content (e.g., "zh", "en") - **REQUIRED**
29
+ | Parameter | Type | Required | Description |
30
+ |-----------|------|----------|-------------|
31
+ | `module_name` | string | Yes | Module name to summarize |
32
+ | `module_path` | string | Yes | Path to module directory (e.g., `speccrew-workspace/knowledges/bizs/{{platform_type}}/{{module_name}}/`) containing: {{module_name}}-overview.md (initial version), features/{{feature_name}}.md files |
33
+ | `language` | string | Yes | Target language for generated content (e.g., "zh", "en") |
34
34
 
35
35
  ## Output
36
36
 
37
- - `{{module_path}}/{{module_name}}-overview.md` - Complete module overview (overwritten)
38
- - Example: `speccrew-workspace/knowledges/bizs/backend-ai/chat/chat-overview.md`
39
- - Example: `speccrew-workspace/knowledges/bizs/web-vue/order/order-overview.md`
37
+ | Output | Path | Description |
38
+ |--------|------|-------------|
39
+ | `{{module_name}}-overview.md` | `{{module_path}}/{{module_name}}-overview.md` | Complete module overview (overwritten). Example: `speccrew-workspace/knowledges/bizs/backend-ai/chat/chat-overview.md` |
40
40
 
41
41
  ## Workflow
42
42
 
@@ -51,230 +51,378 @@ flowchart TD
51
51
  Step6 --> End([End])
52
52
  ```
53
53
 
54
- ### Step 1: Read Prerequisites
54
+ > **REQUIRED**: Before executing this workflow, read the XML workflow specification: `speccrew-workspace/docs/rules/agentflow-spec.md`
55
+
56
+ ## AgentFlow Definition
57
+
58
+ <!-- @agentflow: workflow.agentflow.xml -->
59
+
60
+ ```xml
61
+ <?xml version="1.0" encoding="UTF-8"?>
62
+ <workflow id="module-summarize" version="1.0" status="pending" desc="Module summarization workflow">
63
+
64
+ <!-- Input Block: Define workflow inputs -->
65
+ <block type="input" id="I1" desc="Module summarize input parameters">
66
+ <field name="module_name" required="true" type="string" desc="Module name to summarize"/>
67
+ <field name="module_path" required="true" type="string" desc="Path to module directory"/>
68
+ <field name="language" required="true" type="string" desc="Target language for generated content"/>
69
+ <field name="workspace_path" required="true" type="string" desc="Workspace root path"/>
70
+ <field name="sync_state_bizs_dir" required="true" type="string" desc="Sync state directory path"/>
71
+ </block>
72
+
73
+ <!-- ==================== GLOBAL CONTINUOUS EXECUTION RULES ==================== -->
74
+ <block type="rule" id="GLOBAL-R1" level="forbidden" desc="Continuous execution constraints — NEVER violate">
75
+ <field name="text">DO NOT ask user "Should I continue?" or "How would you like to proceed?" during execution</field>
76
+ <field name="text">DO NOT offer options like "Full execution / Partial / Stop" — always execute ALL tasks to completion</field>
77
+ <field name="text">DO NOT suggest "Due to context window limits, let me pause" — complete current task, use checkpoint for resumption</field>
78
+ <field name="text">DO NOT estimate workload and suggest breaking it into phases — execute ALL items in sequence</field>
79
+ <field name="text">DO NOT warn about "large number of files" or "this may take a while" — proceed with generation</field>
80
+ <field name="text">Context window management: if approaching limit, save progress to checkpoint file and resume — do NOT ask user for guidance</field>
81
+ </block>
82
+
83
+ <!-- Step 1: Read Prerequisites -->
84
+ <sequence id="S1" name="Step 1: Read Prerequisites" status="pending" desc="Read template, initial overview, and discover features">
85
+ <block type="task" id="B1a" action="read-file" desc="Read module overview template">
86
+ <field name="path" value="./templates/MODULE-OVERVIEW-TEMPLATE.md"/>
87
+ <field name="output" var="template_content"/>
88
+ </block>
89
+
90
+ <block type="task" id="B1b" action="read-file" desc="Read initial overview">
91
+ <field name="path" value="${module_path}/${module_name}-overview.md"/>
92
+ <field name="output" var="initial_overview"/>
93
+ </block>
94
+
95
+ <block type="task" id="B1c" action="run-script" desc="Discover feature files">
96
+ <field name="command">Get-ChildItem -Path "${module_path}/features" -Filter "*.md" -File</field>
97
+ <field name="output" var="feature_files"/>
98
+ </block>
99
+
100
+ <!-- Loop: Read all feature detail files -->
101
+ <block type="loop" id="L1" over="${feature_files}" as="feature_file" desc="Read all feature files">
102
+ <block type="task" id="B1d" action="read-file" desc="Read feature file">
103
+ <field name="path" value="${feature_file}"/>
104
+ <field name="output" var="feature_content"/>
105
+ </block>
106
+ </block>
107
+
108
+ <!-- Checkpoint: Verify prerequisites loaded -->
109
+ <block type="checkpoint" id="CP1" name="prerequisites_loaded" desc="Prerequisites loaded checkpoint">
110
+ <field name="verify" value="${template_content} != null AND ${feature_files} != null"/>
111
+ </block>
112
+
113
+ <!-- Gateway: Handle edge case - no features found -->
114
+ <block type="gateway" id="G1" mode="exclusive" desc="Check if features exist">
115
+ <branch test="${feature_files.length} == 0" name="No features">
116
+ <block type="event" id="E1a" action="log" level="warning" desc="No features warning">
117
+ <field name="message">No feature documents found for module ${module_name}</field>
118
+ </block>
119
+ <block type="task" id="B1e" action="write-file" desc="Generate minimal overview">
120
+ <field name="path" value="${module_path}/${module_name}-overview.md"/>
121
+ <field name="content" value="${minimal_skeleton}"/>
122
+ </block>
123
+ <field name="status" value="partial"/>
124
+ <block type="event" id="E1b" action="signal" desc="Signal complete">
125
+ <field name="message">workflow_complete</field>
126
+ </block>
127
+ </branch>
128
+ <branch test="${feature_files.length} > 0" name="Features found">
129
+ <block type="event" id="E1c" action="log" level="info" desc="Features found">
130
+ <field name="message">Found ${feature_files.length} feature documents</field>
131
+ </block>
132
+ </branch>
133
+ </block>
134
+ </sequence>
135
+
136
+ <!-- Step 2: Extract Entities -->
137
+ <sequence id="S2" name="Step 2: Extract Entities" status="pending" desc="Extract and aggregate entities from features">
138
+ <block type="task" id="B2a" action="analyze" desc="Extract entities">
139
+ <field name="inputs" value="${feature_contents}"/>
140
+ <field name="output" var="extracted_entities"/>
141
+ </block>
142
+
143
+ <!-- Loop: Process each entity for deduplication -->
144
+ <block type="loop" id="L2" over="${extracted_entities}" as="entity" desc="Aggregate entities">
145
+ <block type="task" id="B2b" action="analyze" desc="Aggregate entity">
146
+ <field name="entity" value="${entity}"/>
147
+ <field name="output" var="aggregated_entity"/>
148
+ </block>
149
+ </block>
150
+
151
+ <!-- Checkpoint: Entities aggregated -->
152
+ <block type="checkpoint" id="CP2" name="entities_aggregated" desc="Entities aggregated checkpoint">
153
+ <field name="verify" value="${unique_entities.length} > 0"/>
154
+ </block>
155
+ </sequence>
156
+
157
+ <!-- Step 3: Identify Dependencies -->
158
+ <sequence id="S3" name="Step 3: Identify Dependencies" status="pending" desc="Identify dependencies from features">
159
+ <block type="task" id="B3a" action="analyze" desc="Identify dependencies">
160
+ <field name="inputs" value="${feature_contents}"/>
161
+ <field name="output" var="dependencies"/>
162
+ </block>
163
+
164
+ <!-- Classify dependencies -->
165
+ <block type="loop" id="L3" over="${dependencies}" as="dependency" desc="Classify dependencies">
166
+ <block type="gateway" id="G3" mode="exclusive" desc="Classify direction">
167
+ <branch test="${dependency.direction} == 'provides'" name="Provides">
168
+ <field name="provided_deps" append="${dependency}"/>
169
+ </branch>
170
+ <branch test="${dependency.direction} == 'consumes'" name="Consumes">
171
+ <field name="consumed_deps" append="${dependency}"/>
172
+ </branch>
173
+ </block>
174
+ </block>
175
+
176
+ <!-- Checkpoint: Dependencies classified -->
177
+ <block type="checkpoint" id="CP3" name="dependencies_classified" desc="Dependencies classified checkpoint">
178
+ <field name="verify" value="${dependencies} != null"/>
179
+ </block>
180
+ </sequence>
181
+
182
+ <!-- Step 4: Summarize Business Rules -->
183
+ <sequence id="S4" name="Step 4: Summarize Rules" status="pending" desc="Extract and associate business rules">
184
+ <block type="task" id="B4a" action="analyze" desc="Extract rules">
185
+ <field name="inputs" value="${feature_contents}"/>
186
+ <field name="output" var="business_rules"/>
187
+ </block>
188
+
189
+ <!-- Loop: Associate rules with features -->
190
+ <block type="loop" id="L4" over="${business_rules}" as="rule" desc="Associate rules">
191
+ <block type="task" id="B4b" action="analyze" desc="Find rule source">
192
+ <field name="rule" value="${rule}"/>
193
+ <field name="features" value="${feature_files}"/>
194
+ <field name="output" var="rule_with_source"/>
195
+ </block>
196
+ </block>
197
+
198
+ <!-- Checkpoint: Rules collected -->
199
+ <block type="checkpoint" id="CP4" name="rules_collected" desc="Rules collected checkpoint">
200
+ <field name="verify" value="${business_rules.length} >= 0"/>
201
+ </block>
202
+ </sequence>
203
+
204
+ <!-- Step 5: Generate Complete MODULE-OVERVIEW.md -->
205
+ <sequence id="S5" name="Step 5: Generate Overview" status="pending" desc="Generate complete module overview">
206
+ <!-- Phase A: Skeleton Construction -->
207
+ <block type="task" id="B5a" action="analyze" desc="Count entities">
208
+ <field name="items" value="${unique_entities}"/>
209
+ <field name="output" var="entity_count"/>
210
+ </block>
211
+
212
+ <block type="task" id="B5b" action="analyze" desc="Count dependencies">
213
+ <field name="items" value="${dependencies}"/>
214
+ <field name="output" var="dependency_count"/>
215
+ </block>
216
+
217
+ <block type="task" id="B5c" action="analyze" desc="Count flows">
218
+ <field name="features" value="${feature_contents}"/>
219
+ <field name="output" var="flow_count"/>
220
+ </block>
221
+
222
+ <block type="task" id="B5d" action="analyze" desc="Count rules">
223
+ <field name="items" value="${business_rules}"/>
224
+ <field name="output" var="rule_count"/>
225
+ </block>
226
+
227
+ <!-- Create skeleton structure -->
228
+ <block type="task" id="B5e" action="analyze" desc="Create skeleton">
229
+ <field name="template" value="${template_content}"/>
230
+ <field name="entity_count" value="${entity_count}"/>
231
+ <field name="dependency_count" value="${dependency_count}"/>
232
+ <field name="flow_count" value="${flow_count}"/>
233
+ <field name="rule_count" value="${rule_count}"/>
234
+ <field name="language" value="${language}"/>
235
+ <field name="output" var="document_skeleton"/>
236
+ </block>
237
+
238
+ <!-- Rule: Skeleton must be complete before filling -->
239
+ <block type="rule" id="R1" level="mandatory" desc="Skeleton first">
240
+ <field name="text">DO NOT start filling content until the complete skeleton is verified</field>
241
+ </block>
242
+
243
+ <!-- Checkpoint: Skeleton verified -->
244
+ <block type="checkpoint" id="CP5a" name="skeleton_verified" desc="Skeleton verified checkpoint">
245
+ <field name="verify" value="${document_skeleton} != null AND ${document_skeleton}.contains('[TO BE FILLED]')"/>
246
+ </block>
247
+
248
+ <!-- Phase B: Content Filling -->
249
+ <!-- Read Mermaid rules -->
250
+ <block type="task" id="B5f" action="read-file" desc="Read Mermaid rules">
251
+ <field name="path" value="speccrew-workspace/docs/rules/mermaid-rule.md"/>
252
+ <field name="output" var="mermaid_rules"/>
253
+ </block>
254
+
255
+ <!-- Fill Section 3: Business Entities -->
256
+ <block type="loop" id="L5a" over="${unique_entities}" as="entity" desc="Fill entity rows">
257
+ <block type="task" id="B5g" action="analyze" desc="Fill entity row">
258
+ <field name="entity" value="${entity}"/>
259
+ <field name="language" value="${language}"/>
260
+ <field name="output" var="entity_row"/>
261
+ </block>
262
+ </block>
263
+
264
+ <!-- Fill Section 4: Dependencies -->
265
+ <block type="loop" id="L5b" over="${dependencies}" as="dependency" desc="Fill dependency rows">
266
+ <block type="task" id="B5h" action="analyze" desc="Fill dependency row">
267
+ <field name="dependency" value="${dependency}"/>
268
+ <field name="language" value="${language}"/>
269
+ <field name="output" var="dependency_row"/>
270
+ </block>
271
+ </block>
272
+
273
+ <!-- Fill Section 5: Core Business Flows -->
274
+ <block type="loop" id="L5c" over="${core_flows}" as="flow" desc="Fill flow items">
275
+ <block type="task" id="B5i" action="analyze" desc="Fill flow item">
276
+ <field name="flow" value="${flow}"/>
277
+ <field name="language" value="${language}"/>
278
+ <field name="output" var="flow_item"/>
279
+ </block>
280
+ </block>
281
+
282
+ <!-- Fill Section 6: Business Rules -->
283
+ <block type="loop" id="L5d" over="${business_rules}" as="rule" desc="Fill rule rows">
284
+ <block type="task" id="B5j" action="analyze" desc="Fill rule row">
285
+ <field name="rule" value="${rule}"/>
286
+ <field name="language" value="${language}"/>
287
+ <field name="output" var="rule_row"/>
288
+ </block>
289
+ </block>
290
+
291
+ <!-- Error Handler for document writing -->
292
+ <block type="error-handler" id="EH1" desc="Handle document writing errors">
293
+ <try>
294
+ <!-- Write final document -->
295
+ <block type="gateway" id="G5" mode="exclusive" desc="Check existing document">
296
+ <branch test="${initial_overview} != null" name="Existing document">
297
+ <!-- Use search_replace for existing document -->
298
+ <block type="loop" id="L5e" over="${sections}" as="section" desc="Replace sections">
299
+ <block type="task" id="B5k" action="run-skill" desc="Replace section">
300
+ <field name="skill" value="search_replace"/>
301
+ <field name="file_path" value="${module_path}/${module_name}-overview.md"/>
302
+ <field name="section" value="${section}"/>
303
+ </block>
304
+ </block>
305
+ </branch>
306
+ <branch test="${initial_overview} == null" name="New document">
307
+ <!-- Create new document -->
308
+ <block type="task" id="B5l" action="write-file" desc="Write overview">
309
+ <field name="path" value="${module_path}/${module_name}-overview.md"/>
310
+ <field name="content" value="${document_skeleton}"/>
311
+ </block>
312
+ </branch>
313
+ </block>
314
+ </try>
315
+ <catch error-type="write_error">
316
+ <block type="event" id="EH1-E1" action="log" level="error" desc="Write error">
317
+ <field name="message">Failed to write overview document: ${write_error.message}</field>
318
+ </block>
319
+ <field name="status" value="failed"/>
320
+ </catch>
321
+ <finally>
322
+ <block type="event" id="EH1-E2" action="log" level="info" desc="Write completed">
323
+ <field name="message">Document write operation completed</field>
324
+ </block>
325
+ </finally>
326
+ </block>
327
+
328
+ <!-- Rule: Content language constraint -->
329
+ <block type="rule" id="R2" level="mandatory" desc="Language constraint">
330
+ <field name="text">ALL generated content MUST be in the language specified by the language parameter</field>
331
+ </block>
332
+
333
+ <!-- Rule: Forbidden operations -->
334
+ <block type="rule" id="R3" level="forbidden" desc="No create_file for rewrite">
335
+ <field name="text">FORBIDDEN: create_file for overview document rewrite - use search_replace instead</field>
336
+ </block>
337
+ <block type="rule" id="R4" level="forbidden" desc="No full-file rewrite">
338
+ <field name="text">FORBIDDEN: Full-file rewrite - always use targeted search_replace on specific sections</field>
339
+ </block>
340
+
341
+ <!-- Checkpoint: Document generated -->
342
+ <block type="checkpoint" id="CP5b" name="document_generated" desc="Document generated checkpoint">
343
+ <field name="verify" value="${output_file_exists} == true"/>
344
+ </block>
345
+ </sequence>
346
+
347
+ <!-- Step 6: Report Results -->
348
+ <sequence id="S6" name="Step 6: Report Results" status="pending" desc="Generate completion report">
349
+ <block type="task" id="B6" action="analyze" desc="Generate report">
350
+ <field name="module_name" value="${module_name}"/>
351
+ <field name="feature_count" value="${feature_files.length}"/>
352
+ <field name="entity_count" value="${unique_entities.length}"/>
353
+ <field name="dependency_count" value="${dependencies.length}"/>
354
+ <field name="rule_count" value="${business_rules.length}"/>
355
+ <field name="output" var="completion_report"/>
356
+ </block>
357
+
358
+ <!-- Event: Log completion -->
359
+ <block type="event" id="E6" action="log" level="info" desc="Log completion">
360
+ <field name="message">Module summarization completed:
361
+ - Module: ${module_name}
362
+ - Features Processed: ${feature_files.length}
363
+ - Entities Extracted: ${unique_entities.length}
364
+ - Dependencies Identified: ${dependencies.length}
365
+ - Business Rules Summarized: ${business_rules.length}
366
+ - Output: ${module_name}-overview.md (complete)
367
+ - Status: success</field>
368
+ </block>
369
+ </sequence>
370
+
371
+ <!-- Output Block: Define workflow outputs -->
372
+ <block type="output" id="O1" desc="Module summarize output results">
373
+ <field name="status" value="success"/>
374
+ <field name="module_name" from="${module_name}"/>
375
+ <field name="output_file" from="${module_name}-overview.md"/>
376
+ <field name="message" value="Module summarization completed with ${feature_files.length} features processed"/>
377
+ </block>
378
+
379
+ </workflow>
380
+
381
+ ## Constraints
382
+
383
+ ### Critical Constraints
55
384
 
56
- Before processing, read all required files:
57
-
58
- 1. **Read Template**: `templates/MODULE-OVERVIEW-TEMPLATE.md` - Understand the required content structure and section formats
59
-
60
- 2. **Read Initial Module Overview**: `{{module_path}}/{{module_name}}-overview.md` (initial skeleton created by dispatch) containing:
61
- - Section 1: Module Basic Information
62
- - Section 2: Feature List Table with links to detail docs
63
- - Remaining sections: Empty placeholders
64
- - **If missing**: Create a minimal skeleton from feature inventory data
65
-
66
- 3. **Read All Feature Details**: Find and read all `{{module_path}}/features/{{feature_name}}.md` files
67
-
68
- **Edge Cases**:
69
- - **No feature documents found**: Generate a minimal overview with only Section 1-2, return with `status: "partial"`
70
- - **Incomplete feature documents**: Extract available data, note gaps with `<!-- DATA INCOMPLETE: {feature_name} missing Section X -->`
71
-
72
- For each feature-detail.md, extract and categorize the following:
73
-
74
- **From Section 3 (Business Entities / State Objects)** — Priority: High
75
- - **Backend modules**: Entity names, database fields, types, relationships, ORM constraints
76
- - **Frontend modules**: State objects (Store/State), component prop interfaces, computed/derived data
77
- - Aggregate across features to build module-level entity list (deduplicate by entity name)
78
-
79
- **From Section 4 (Dependencies)** — Priority: High
80
- - **Backend**: Internal module API calls, external service dependencies, shared DTOs
81
- - **Frontend**: Component imports, Store/State dependencies, route guard dependencies, shared composables/hooks
82
- - Classify as: "Provided by this module" vs "Consumed from other modules"
83
-
84
- **From Section 6 (Business Rules)** — Priority: High
85
- - Validation rules, state transitions, authorization rules, data consistency constraints
86
- - Associate each rule with its originating feature
87
-
88
- **From Section 5 (Core Processes)** — Priority: Medium
89
- - Step sequences, branching logic, exception handling paths
90
- - Identify cross-feature flows that span multiple features
91
-
92
- **From Section 2 (Feature Details / API Definitions)** — Priority: Medium
93
- - Data constraints: field types, ranges, uniqueness, required fields
94
- - Build constraint matrix for entities
95
-
96
- ### Step 2: Extract Entities
97
-
98
- Aggregate entities from all features:
99
-
100
- ```
101
- From Feature A: Order, OrderItem
102
- From Feature B: Order, Payment
103
- ---------------------------------
104
- Module Entities: Order, OrderItem, Payment
105
- ```
106
-
107
- For each entity, collect:
108
- - Fields and types
109
- - Validation constraints
110
- - Relationships (from multiple features)
111
-
112
- ### Step 3: Identify Dependencies
113
-
114
- Analyze feature details to identify:
115
- - **Internal dependencies**: Other modules this module calls
116
- - **External dependencies**: Third-party services, APIs
117
- - **Data dependencies**: Shared entities, common DTOs
118
-
119
- ### Step 4: Summarize Business Rules
120
-
121
- Collect all business rules from feature details:
122
- - Validation rules
123
- - State transition rules
124
- - Authorization rules
125
- - Data consistency rules
126
-
127
- ### Step 5: Generate Complete MODULE-OVERVIEW.md
128
-
129
- > **⚠️ CRITICAL: Two-Phase Strategy (Skeleton-First, Content-After)**
130
- >
131
- > This step MUST be executed in two phases to ensure consistent document structure.
132
-
133
- ### Phase A: Skeleton Construction (BEFORE any content filling)
134
-
135
- 1. Read MODULE-OVERVIEW-TEMPLATE.md to identify the complete section structure
136
- 2. Count data items from extracted information:
137
- - Section 3: Count unique **Entities** (deduplicated by entity name)
138
- - Section 4: Count unique **Dependencies** (internal + external)
139
- - Section 5: Count unique **Core Business Flows**
140
- - Section 6: Count unique **Business Rules**
141
- 3. For each section with repeating data items, create complete skeleton structure:
142
- - **Section 3 (Entities)**: For each entity, create table row with ALL column placeholders:
143
- ```
144
- | [Entity Name] | [TO BE FILLED] | [TO BE FILLED] | [TO BE FILLED] |
145
- ```
146
- - **Section 4 (Dependencies)**: For each dependency, create table row with ALL column placeholders:
147
- ```
148
- | [Direction] | [Target] | [Content] | [Method] |
149
- ```
150
- - **Section 5 (Core Business Flows)**: For each flow, create flow item with placeholders:
151
- ```
152
- **[Flow Name]**: [TO BE FILLED]
153
- ```
154
- - **Section 6 (Business Rules)**: For each rule, create table row with ALL column placeholders:
155
- ```
156
- | [Rule ID] | [Rule Name] | [Description] | [Related Features] |
157
- ```
158
- 4. Verify skeleton: confirm ALL data items have ALL required column/field placeholders before proceeding
159
-
160
- > ⚠️ DO NOT start filling content until the complete skeleton is verified.
161
-
162
- ### Phase B: Content Filling (AFTER skeleton is complete)
163
-
164
- Fill each `[TO BE FILLED]` placeholder with actual content:
165
- - Entity Description → Business description of the entity
166
- - Entity Key Attributes → Field names with types (deduplicated from all features)
167
- - Entity Business Rules → Constraints and validation rules aggregated from features
168
- - Dependency Content → What is provided/consumed
169
- - Dependency Method → How the dependency is realized (API call, import, injection)
170
- - Core Business Flow → Step sequence with actors and outcomes
171
- - Business Rule Description → Rule logic and enforcement point
172
-
173
- ---
174
-
175
- **⚠️ CRITICAL CONSTRAINTS (apply to this step):**
176
385
  > 1. **FORBIDDEN: `create_file` for overview document** — If skeleton exists, use `search_replace`; if not, copy template first then fill with `search_replace`
177
386
  > 2. **FORBIDDEN: Full-file rewrite** — Always use targeted `search_replace` on specific sections
178
387
  > 3. **MANDATORY: Template-first workflow** — Template (or existing skeleton) MUST be in place before filling sections
179
388
 
180
- **IMPORTANT**: ALL generated content (entity descriptions, business rules, flow descriptions, section headers, and narrative text) MUST be written in the language specified by the `language` parameter. Only code identifiers, file paths, and technical terms (class names, API endpoints) remain in their original language.
181
-
182
- 1. **Read Configuration**:
183
- - Read `speccrew-workspace/docs/rules/mermaid-rule.md` - Get Mermaid diagram compatibility guidelines
184
-
185
- 2. **Prepare document file (if not already exists)**:
186
- - If the initial skeleton from Step 1 exists at `module_path/module_name-overview.md`:
187
- - Use the existing file as the base (sections 1-2 already populated)
188
- - If no skeleton exists:
189
- - **Read template**: `templates/MODULE-OVERVIEW-TEMPLATE.md`
190
- - **Replace top-level placeholders** (module name, language, etc.)
191
- - **Create document** using `create_file` at `module_path/module_name-overview.md`
192
-
193
- 3. **Fill each section using search_replace**:
194
-
195
- > ⚠️ **CRITICAL CONSTRAINTS:**
196
- > - **FORBIDDEN: `create_file` to rewrite the entire document** — it destroys template/skeleton structure
197
- > - **MUST use `search_replace` to fill each section individually**
198
- > - **All section titles and numbering MUST be preserved**
199
- > - If a section has no applicable content, keep the section title and replace placeholder with "N/A"
200
-
201
- **Locate and fill via `search_replace`:**
202
-
203
- **Section 1: Module Basic Info** (from initial version)
204
- - Keep existing information
205
-
206
- **Locate and fill via `search_replace`:**
207
-
208
- **Section 2: Feature List** (from initial version)
209
- - Keep feature list table
210
- - Ensure all links to {{feature_name}}.md are correct
389
+ ### Content Language
211
390
 
212
- **Locate and fill via `search_replace`:**
213
-
214
- **Section 3: Business Entities** (NEW)
215
-
216
- **Backend example:**
217
- | Entity Name | Description | Key Attributes | Business Rules |
218
- |---|---|---|---|
219
- | Order | Order master data | id, orderNo, amount, status | Status flow constraint |
220
-
221
- **Frontend example:**
222
- | Entity Name | Description | Key Attributes | Business Rules |
223
- |---|---|---|---|
224
- | OrderState | Order list view state | orders[], selectedOrder, loading, error | loading prevents re-fetch |
225
- | OrderFormProps | Order form component interface | order: Order, editable: boolean, onSave: Function | order required |
226
-
227
- Include ER diagram based on entity relationships.
228
-
229
- **Locate and fill via `search_replace`:**
230
-
231
- **Section 4: Dependencies** (NEW)
232
-
233
- **Backend example:**
234
- | Direction | Target | Content | Method |
235
- |---|---|---|---|
236
- | Uses | UserService | Get user info | API call |
237
-
238
- **Frontend example:**
239
- | Direction | Target | Content | Method |
240
- |---|---|---|---|
241
- | Imports | UserStore | Get user state | Store injection |
242
- | Imports | UserCard | Display user info | Component import |
243
-
244
- **Locate and fill via `search_replace`:**
245
-
246
- **Section 5: Core Business Flows** (NEW)
247
-
248
- Based on feature interactions, identify core flows:
249
-
250
- **Backend example:**
251
- Create Order: Validate params → Calculate amount → Save to DB → Notify downstream
252
-
253
- **Frontend example:**
254
- Order List: Load data → Display list → User selects → Load detail → Display detail → Edit → Submit → Update state
255
-
256
- **Locate and fill via `search_replace`:**
391
+ **IMPORTANT**: ALL generated content (entity descriptions, business rules, flow descriptions, section headers, and narrative text) MUST be written in the language specified by the `language` parameter. Only code identifiers, file paths, and technical terms (class names, API endpoints) remain in their original language.
257
392
 
258
- **Section 6: Business Rules** (NEW)
393
+ ## Return Value Format
259
394
 
260
- | Rule ID | Rule Name | Description | Related Features |
261
- |---------|-----------|-------------|------------------|
262
- | R001 | Order amount > 0 | Order total must be positive | create-order |
263
- | R002 | Stock check | Must check inventory before order | create-order |
395
+ ```json
396
+ {
397
+ "status": "success|failed",
398
+ "module_name": "module_name",
399
+ "output_file": "module_name-overview.md",
400
+ "message": "Module summarization completed with N features processed"
401
+ }
402
+ ```
264
403
 
265
- Apply source traceability rules (see [Reference Guides > Source Traceability Guide](#source-traceability-guide))
404
+ ## Task Completion Report
266
405
 
267
- ### Step 6: Report Results
406
+ Upon completion, output the following structured report:
268
407
 
269
- ```
270
- Module summarization completed:
271
- - Module: {{module_name}}
272
- - Features Processed: {{feature_count}}
273
- - Entities Extracted: {{entity_count}}
274
- - Dependencies Identified: {{dependency_count}}
275
- - Business Rules Summarized: {{rule_count}}
276
- - Output: {{module_name}}-overview.md (complete)
277
- - Status: success
408
+ ```json
409
+ {
410
+ "status": "success | partial | failed",
411
+ "skill": "speccrew-knowledge-module-summarize",
412
+ "output_files": [
413
+ "{module_path}/{module_name}-overview.md"
414
+ ],
415
+ "summary": "Module overview completed with entities, dependencies, and business rules extracted from {feature_count} features",
416
+ "metrics": {
417
+ "modules_processed": 1,
418
+ "documents_generated": 1,
419
+ "features_covered": 0
420
+ },
421
+ "errors": [],
422
+ "next_steps": [
423
+ "Run speccrew-knowledge-system-summarize to aggregate all modules into system overview"
424
+ ]
425
+ }
278
426
  ```
279
427
 
280
428
  ## Reference Guides
@@ -356,47 +504,6 @@ Frontend (React): `[OrderDetail.tsx](../../../../../src/pages/order/OrderDetail.
356
504
 
357
505
  > **Note**: This skill focuses on document aggregation only. Knowledge graph data (nodes, edges) is handled separately by the dispatch skill's `process-batch-results.js` script during Stage 2. Module-summarize does NOT read from or write to the knowledge graph.
358
506
 
359
- ## Return
360
-
361
- **Return Value (JSON format):**
362
-
363
- ```json
364
- {
365
- "status": "success|failed",
366
- "module_name": "module_name",
367
- "output_file": "module_name-overview.md",
368
- "message": "Module summarization completed with N features processed"
369
- }
370
- ```
371
-
372
- ---
373
-
374
- ## Task Completion Report
375
-
376
- Upon completion, output the following structured report:
377
-
378
- ```json
379
- {
380
- "status": "success | partial | failed",
381
- "skill": "speccrew-knowledge-module-summarize",
382
- "output_files": [
383
- "{module_path}/{module_name}-overview.md"
384
- ],
385
- "summary": "Module overview completed with entities, dependencies, and business rules extracted from {feature_count} features",
386
- "metrics": {
387
- "modules_processed": 1,
388
- "documents_generated": 1,
389
- "features_covered": 0
390
- },
391
- "errors": [],
392
- "next_steps": [
393
- "Run speccrew-knowledge-system-summarize to aggregate all modules into system overview"
394
- ]
395
- }
396
- ```
397
-
398
- ---
399
-
400
507
  ## Checklist
401
508
 
402
509
  - [ ] Step 1: Prerequisites read (template, initial overview, feature details)
@@ -405,4 +512,3 @@ Upon completion, output the following structured report:
405
512
  - [ ] Step 4: Business rules collected
406
513
  - [ ] Step 5: Section 3-6 completed in {{module_name}}-overview.md
407
514
  - [ ] Step 6: Results reported
408
-