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
@@ -0,0 +1,223 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <workflow id="feature-analyze-main" status="pending" version="1.0" desc="Feature Analysis workflow">
3
+
4
+ <!-- ============================================================
5
+ Input Parameters Definition
6
+ ============================================================ -->
7
+ <block type="input" id="I1" desc="Workflow input parameters">
8
+ <field name="prd_path" required="true" type="string" desc="Path to the Sub-PRD document"/>
9
+ <field name="feature_id" required="false" type="string" desc="Feature identifier, e.g., F-CRM-01"/>
10
+ <field name="feature_name" required="false" type="string" desc="Feature name in English, e.g., customer-list"/>
11
+ <field name="feature_type" required="false" type="string" desc="Page+API or API-only"/>
12
+ <field name="iteration_id" required="false" type="string" desc="Current iteration identifier"/>
13
+ <field name="frontend_platforms" required="false" type="array" desc="List of frontend platforms"/>
14
+ <field name="skip_checkpoint" required="false" type="boolean" default="false" desc="Skip Checkpoint A if true"/>
15
+ <field name="workspace_path" required="true" type="string" desc="Absolute path to speccrew-workspace"/>
16
+ </block>
17
+
18
+ <!-- ============================================================
19
+ Global Constraints
20
+ ============================================================ -->
21
+ <block type="rule" id="R1" level="forbidden" desc="Script execution failure">
22
+ <field name="text">If update-progress.js fails, HARD STOP and report error</field>
23
+ </block>
24
+
25
+ <block type="rule" id="R2" level="forbidden" desc="Hand-written checkpoints">
26
+ <field name="text">ALWAYS use update-progress.js script for .checkpoints.json</field>
27
+ </block>
28
+
29
+ <block type="rule" id="R3" level="forbidden" desc="Skip Checkpoint A">
30
+ <field name="text">User confirmation required before proceeding (unless skip_checkpoint=true)</field>
31
+ </block>
32
+
33
+ <block type="rule" id="R4" level="forbidden" desc="Rename features">
34
+ <field name="text">Output filename MUST use exact feature_name parameter value</field>
35
+ <field name="text">DO NOT translate, abbreviate, or substitute with alternative names</field>
36
+ </block>
37
+
38
+ <block type="rule" id="R5" level="mandatory" desc="Business perspective only">
39
+ <field name="text">Feature Analysis is a PURE BUSINESS document</field>
40
+ <field name="text">Describes WHAT the system does, NOT HOW it's implemented</field>
41
+ </block>
42
+
43
+ <!-- ============================================================
44
+ Main Processing Sequence
45
+ ============================================================ -->
46
+ <sequence id="S1" name="Feature Analysis" status="pending" desc="Analyze PRD and produce function decomposition">
47
+
48
+ <!-- Step 1: Read PRD -->
49
+ <block type="task" id="B1" action="read-file" desc="Read PRD document">
50
+ <field name="path" value="${prd_path}"/>
51
+ <field name="output" var="prd_content"/>
52
+ </block>
53
+
54
+ <!-- Gateway: Validate PRD exists -->
55
+ <block type="gateway" id="G1" mode="guard" desc="Verify PRD exists"
56
+ test="${prd_content} != null" fail-action="stop">
57
+ <field name="message">PRD document not found at: ${prd_path}</field>
58
+ </block>
59
+
60
+ <!-- Step 2: Load System Knowledge -->
61
+ <block type="task" id="B2" action="read-file" desc="Read System Overview">
62
+ <field name="path">${workspace_path}/knowledges/bizs/system-overview.md</field>
63
+ <field name="output" var="system_overview"/>
64
+ </block>
65
+
66
+ <!-- Step 3: Load Related Module Overviews -->
67
+ <block type="task" id="B3" action="analyze" desc="Identify related modules from PRD">
68
+ <field name="input" value="${prd_content}"/>
69
+ <field name="analysis_rules">
70
+ - Extract module names mentioned in PRD
71
+ - Identify cross-module dependencies
72
+ - List related module overview files to read
73
+ </field>
74
+ <field name="output" var="related_modules"/>
75
+ </block>
76
+
77
+ <!-- Loop: Read related module overviews -->
78
+ <block type="loop" id="L1" over="${related_modules}" as="module" desc="Read related module overviews">
79
+ <block type="task" id="B4" action="read-file" desc="Read module overview">
80
+ <field name="path">${workspace_path}/knowledges/bizs/${module.name}/${module.name}-overview.md</field>
81
+ <field name="output" var="module_overview_${module.name}"/>
82
+ </block>
83
+ </block>
84
+
85
+ <!-- Step 4: Discover Frontend Platforms -->
86
+ <block type="gateway" id="G2" mode="exclusive" desc="Get frontend platforms">
87
+ <branch test="${frontend_platforms} != null AND ${frontend_platforms.length} > 0" name="Use provided platforms">
88
+ <block type="event" id="E1" action="log" level="info" desc="Using provided platforms">
89
+ <field name="message">Using provided frontend platforms: ${frontend_platforms}</field>
90
+ </block>
91
+ </branch>
92
+ <branch default="true" name="Auto-discover from techs-manifest">
93
+ <block type="task" id="B5" action="read-file" desc="Read techs manifest">
94
+ <field name="path">${workspace_path}/knowledges/techs/techs-manifest.json</field>
95
+ <field name="output" var="techs_manifest"/>
96
+ </block>
97
+ <block type="task" id="B6" action="analyze" desc="Extract frontend platforms">
98
+ <field name="input" value="${techs_manifest}"/>
99
+ <field name="extraction_rules">
100
+ - Filter platforms with type web-* or mobile-*
101
+ - Extract platform identifiers
102
+ </field>
103
+ <field name="output" var="frontend_platforms"/>
104
+ </block>
105
+ </branch>
106
+ </block>
107
+
108
+ <!-- Step 5: Function Breakdown -->
109
+ <block type="gateway" id="G3" mode="exclusive" desc="Select decomposition mode">
110
+ <branch test="${feature_id} != null" name="Feature-based decomposition">
111
+ <block type="task" id="B7" action="analyze" desc="Extract specific Feature from PRD">
112
+ <field name="input" value="${prd_content}"/>
113
+ <field name="feature_id" value="${feature_id}"/>
114
+ <field name="analysis_rules">
115
+ - Locate Feature in PRD Section 3.4 Feature Breakdown
116
+ - Extract only user stories mapped to this Feature
117
+ - Decompose into 3-8 focused Functions
118
+ - Mark API-only if feature_type indicates
119
+ </field>
120
+ <field name="output" var="function_breakdown"/>
121
+ </block>
122
+ </branch>
123
+ <branch default="true" name="Full PRD decomposition">
124
+ <block type="task" id="B8" action="analyze" desc="Decompose entire PRD">
125
+ <field name="input" value="${prd_content}"/>
126
+ <field name="analysis_rules">
127
+ - Decompose entire PRD into all required Functions
128
+ - May result in 10-20 Functions for complex modules
129
+ </field>
130
+ <field name="output" var="function_breakdown"/>
131
+ </block>
132
+ </branch>
133
+ </block>
134
+
135
+ <!-- Step 6: Analyze Functions with System Markers -->
136
+ <block type="task" id="B9" action="analyze" desc="Analyze functions with system relationship markers">
137
+ <field name="input" value="${function_breakdown}">${system_overview}${related_modules}</field>
138
+ <field name="analysis_rules">
139
+ For each function, identify:
140
+ - Frontend Changes: New pages, components, or modifications
141
+ - Backend Changes: New interfaces or modifications
142
+ - Data Changes: New data structures or modifications
143
+ - System Relationship: [EXISTING], [MODIFIED], or [NEW]
144
+ </field>
145
+ <field name="output" var="analyzed_functions"/>
146
+ </block>
147
+
148
+ <!-- Checkpoint A: User Confirmation -->
149
+ <block type="gateway" id="G4" mode="exclusive" desc="Handle checkpoint A">
150
+ <branch test="${skip_checkpoint} == true" name="Skip confirmation">
151
+ <block type="event" id="E2" action="log" level="info" desc="Skipping checkpoint A">
152
+ <field name="message">skip_checkpoint=true, proceeding without user confirmation</field>
153
+ </block>
154
+ </branch>
155
+ <branch default="true" name="Request confirmation">
156
+ <block type="event" id="E3" action="confirm" title="Function Breakdown Confirmation" type="yesno" desc="Present function breakdown for confirmation">
157
+ <field name="preview">Function Breakdown (Total: ${analyzed_functions.count} functions):
158
+
159
+ ${analyzed_functions.summary}
160
+
161
+ System Relationship Markers:
162
+ - [EXISTING]: ${analyzed_functions.existing_count} - Reuse existing capabilities
163
+ - [MODIFIED]: ${analyzed_functions.modified_count} - Enhance existing features
164
+ - [NEW]: ${analyzed_functions.new_count} - Create new functionality
165
+
166
+ Does this function breakdown align with your understanding of the requirements?</field>
167
+ </block>
168
+ </branch>
169
+ </block>
170
+
171
+ <!-- Step 7: Update Checkpoint A -->
172
+ <block type="task" id="B10" action="run-script" desc="Record checkpoint A passed">
173
+ <field name="command">node "${workspace_path}/scripts/update-progress.js" write-checkpoint --file "${workspace_path}/iterations/${iteration_id}/02.feature-design/.checkpoints.json" --stage 02_feature_design --checkpoint function_decomposition --passed true</field>
174
+ <field name="output" var="checkpoint_a_result"/>
175
+ </block>
176
+
177
+ <!-- Step 8: Write Output Contract -->
178
+ <block type="gateway" id="G5" mode="exclusive" desc="Determine output path">
179
+ <branch test="${feature_id} != null" name="With feature_id">
180
+ <block type="task" id="B11" action="generate" desc="Write feature analysis document">
181
+ <field name="content_template">speccrew-fd-feature-analyze/templates/FEATURE-ANALYSIS-TEMPLATE.md</field>
182
+ <field name="output_path">${prd_parent}/02.feature-design/${feature_id}-${feature_name}.feature-analysis.md</field>
183
+ <field name="data">
184
+ - feature_id: ${feature_id}
185
+ - feature_name: ${feature_name}
186
+ - feature_type: ${feature_type}
187
+ - prd_path: ${prd_path}
188
+ - functions: ${analyzed_functions}
189
+ - platforms: ${frontend_platforms}
190
+ - checkpoint_a: passed
191
+ </field>
192
+ </block>
193
+ </branch>
194
+ <branch default="true" name="Legacy mode">
195
+ <block type="task" id="B12" action="generate" desc="Write feature analysis document">
196
+ <field name="content_template">speccrew-fd-feature-analyze/templates/FEATURE-ANALYSIS-TEMPLATE.md</field>
197
+ <field name="output_path">${prd_parent}/02.feature-design/.feature-analysis.md</field>
198
+ <field name="data">
199
+ - feature_id: ${feature_id}
200
+ - feature_name: ${feature_name}
201
+ - feature_type: ${feature_type}
202
+ - prd_path: ${prd_path}
203
+ - functions: ${analyzed_functions}
204
+ - platforms: ${frontend_platforms}
205
+ - checkpoint_a: passed
206
+ </field>
207
+ </block>
208
+ </branch>
209
+ </block>
210
+
211
+ </sequence>
212
+
213
+ <!-- ============================================================
214
+ Output Results
215
+ ============================================================ -->
216
+ <block type="output" id="O1" desc="Workflow output results">
217
+ <field name="analysis_path" value="${prd_parent}/02.feature-design/${feature_id}-${feature_name}.feature-analysis.md" type="string" desc="Path to feature analysis document"/>
218
+ <field name="function_count" from="${analyzed_functions.count}" type="number" desc="Number of functions decomposed"/>
219
+ <field name="checkpoint_a_status" value="passed" type="string" desc="Checkpoint A status"/>
220
+ <field name="frontend_platforms" from="${frontend_platforms}" type="array" desc="List of frontend platforms"/>
221
+ </block>
222
+
223
+ </workflow>
@@ -22,7 +22,13 @@ ISA-95 Stages 4-6 as internal thinking framework:
22
22
  - Checkpoint A passed (function breakdown confirmed)
23
23
  - Feature Spec document generation needed
24
24
 
25
- # Workflow
25
+ ## AgentFlow Definition
26
+
27
+ <!-- @agentflow: workflow.agentflow.xml -->
28
+
29
+ > **REQUIRED**: Before executing this workflow, read the XML workflow specification: `speccrew-workspace/docs/rules/agentflow-spec.md`
30
+
31
+ ## Workflow
26
32
 
27
33
  ## Absolute Constraints
28
34
 
@@ -0,0 +1,322 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <workflow id="feature-design-main" status="pending" version="1.0" desc="Feature Design and Spec Generation workflow">
3
+
4
+ <!-- ============================================================
5
+ Input Parameters Definition
6
+ ============================================================ -->
7
+ <block type="input" id="I1" desc="Workflow input parameters">
8
+ <field name="feature_analysis_path" required="true" type="string" desc="Path to .feature-analysis.md"/>
9
+ <field name="prd_path" required="true" type="string" desc="Path to the Sub-PRD document"/>
10
+ <field name="feature_id" required="false" type="string" desc="Feature identifier, e.g., F-CRM-01"/>
11
+ <field name="feature_name" required="false" type="string" desc="Feature name in English"/>
12
+ <field name="feature_type" required="false" type="string" desc="Page+API or API-only"/>
13
+ <field name="frontend_platforms" required="false" type="array" desc="List of frontend platforms"/>
14
+ <field name="output_path" required="false" type="string" desc="Custom output path (auto-generated if not provided)"/>
15
+ <field name="skip_checkpoint" required="false" type="boolean" default="false" desc="Skip Checkpoint B if true"/>
16
+ <field name="iteration_id" required="true" type="string" desc="Current iteration identifier"/>
17
+ <field name="workspace_path" required="true" type="string" desc="Absolute path to speccrew-workspace"/>
18
+ </block>
19
+
20
+ <!-- ============================================================
21
+ Global Constraints
22
+ ============================================================ -->
23
+ <block type="rule" id="R1" level="forbidden" desc="Phase B Content Filling">
24
+ <field name="text">NEVER use create_file to rewrite document after skeleton creation</field>
25
+ <field name="text">NEVER abandon search_replace mid-way and switch to create_file</field>
26
+ <field name="text">MUST continue using search_replace for EVERY section</field>
27
+ </block>
28
+
29
+ <block type="rule" id="R2" level="mandatory" desc="Template-first workflow">
30
+ <field name="text">Step 5 (copy template) MUST precede Step 6 (fill content)</field>
31
+ </block>
32
+
33
+ <block type="rule" id="R3" level="mandatory" desc="Mermaid diagrams">
34
+ <field name="text">ALL interaction flows MUST use Mermaid syntax</field>
35
+ <field name="text">Plain text ASCII flowcharts are FORBIDDEN</field>
36
+ </block>
37
+
38
+ <block type="rule" id="R4" level="forbidden" desc="Rename features">
39
+ <field name="text">Output filename MUST use exact feature_name parameter value</field>
40
+ <field name="text">DO NOT translate, abbreviate, or substitute</field>
41
+ </block>
42
+
43
+ <!-- ============================================================
44
+ Main Processing Sequence
45
+ ============================================================ -->
46
+ <sequence id="S1" name="Feature Design" status="pending" desc="Generate Feature Spec from analysis">
47
+
48
+ <!-- Step 0: Precondition Check -->
49
+ <block type="task" id="B1" action="read-file" desc="Read feature analysis document">
50
+ <field name="path" value="${feature_analysis_path}"/>
51
+ <field name="output" var="feature_analysis"/>
52
+ </block>
53
+
54
+ <!-- Gateway: Validate analysis exists -->
55
+ <block type="gateway" id="G1" mode="guard" desc="Verify analysis exists"
56
+ test="${feature_analysis} != null" fail-action="stop">
57
+ <field name="message">Feature Analysis document not found. Run speccrew-fd-feature-analyze first.</field>
58
+ </block>
59
+
60
+ <!-- Step 0.2: Verify Checkpoint A -->
61
+ <block type="task" id="B2" action="analyze" desc="Verify Checkpoint A passed">
62
+ <field name="input" value="${feature_analysis}"/>
63
+ <field name="verification_rules">
64
+ - Check function_decomposition.passed == true
65
+ - Extract feature_id, feature_name, feature_type
66
+ - Extract functions list
67
+ - Extract platforms list
68
+ </field>
69
+ <field name="output" var="checkpoint_a_status"/>
70
+ </block>
71
+
72
+ <!-- Gateway: Checkpoint A validation -->
73
+ <block type="gateway" id="G2" mode="guard" desc="Verify Checkpoint A passed"
74
+ test="${checkpoint_a_status.passed} == true" fail-action="stop">
75
+ <field name="message">Checkpoint A not passed. Run speccrew-fd-feature-analyze first.</field>
76
+ </block>
77
+
78
+ <!-- Step 0.3: Verify Feature Name Consistency -->
79
+ <block type="task" id="B3" action="analyze" desc="Check feature name consistency">
80
+ <field name="input" value="${feature_analysis}">${feature_name}</field>
81
+ <field name="check_rules">
82
+ - Compare analysis file Feature Name with feature_name parameter
83
+ - Log discrepancy if found
84
+ - Continue with feature_name parameter for file naming
85
+ </field>
86
+ <field name="output" var="name_check_result"/>
87
+ </block>
88
+
89
+ <!-- Step 1: Frontend Design (Conditional) -->
90
+ <block type="gateway" id="G3" mode="exclusive" desc="Conditional frontend design">
91
+ <branch test="${feature_type} == 'API-only'" name="Skip frontend">
92
+ <block type="event" id="E1" action="log" level="info" desc="Skipping frontend design">
93
+ <field name="message">feature_type is API-only, skipping frontend design</field>
94
+ </block>
95
+ </branch>
96
+ <branch default="true" name="Execute frontend design">
97
+ <block type="task" id="B4" action="analyze" desc="Design UI prototypes">
98
+ <field name="input" value="${feature_analysis}">${frontend_platforms}</field>
99
+ <field name="design_rules">
100
+ - Create ASCII wireframes for each platform
101
+ - Use Pattern M-A (Card List), M-B (Mobile Form), M-C (Action Sheet) for mobile
102
+ - Document interface element descriptions
103
+ </field>
104
+ <field name="output" var="ui_prototypes"/>
105
+ </block>
106
+
107
+ <block type="task" id="B5" action="analyze" desc="Design interaction flows">
108
+ <field name="input" value="${feature_analysis}">${ui_prototypes}</field>
109
+ <field name="design_rules">
110
+ - Document User Action → Frontend Response → Backend API Call
111
+ - Generate Mermaid sequenceDiagram for each flow
112
+ - Map cross-module data flows (ISA-95 Stage 4)
113
+ </field>
114
+ <field name="output" var="interaction_flows"/>
115
+ </block>
116
+
117
+ <block type="task" id="B6" action="analyze" desc="Map backend APIs">
118
+ <field name="input" value="${interaction_flows}">${feature_analysis}</field>
119
+ <field name="mapping_rules">
120
+ - Map each frontend action to backend API endpoint
121
+ - Document data exchanged
122
+ </field>
123
+ <field name="output" var="api_mapping"/>
124
+ </block>
125
+ </branch>
126
+ </block>
127
+
128
+ <!-- Step 2: Backend Design -->
129
+ <block type="task" id="B7" action="analyze" desc="Design backend interfaces">
130
+ <field name="input" value="${feature_analysis}">${api_mapping}</field>
131
+ <field name="design_rules">
132
+ - List API/Interface with method and description
133
+ - Document processing logic flow (Mermaid flowchart TD)
134
+ - Document data access scheme (Read/Write targets)
135
+ - Document cross-module interactions
136
+ </field>
137
+ <field name="output" var="backend_design"/>
138
+ </block>
139
+
140
+ <!-- Step 3: Data Model and Business Rules -->
141
+ <block type="task" id="B8" action="analyze" desc="Design data model">
142
+ <field name="input" value="${feature_analysis}">${backend_design}</field>
143
+ <field name="design_rules">
144
+ - Define new data structures (field, type, constraints, description)
145
+ - Document modifications to existing structures
146
+ - Define data relationships (1:1, 1:N, N:M)
147
+ - Document data sources
148
+ - Define permission rules
149
+ - Define business logic rules (Rule ID, Description, Trigger, Action)
150
+ - Define validation rules (Frontend and Backend)
151
+ </field>
152
+ <field name="output" var="data_model"/>
153
+ </block>
154
+
155
+ <!-- Step 4: Checkpoint B -->
156
+ <block type="gateway" id="G4" mode="exclusive" desc="Handle checkpoint B">
157
+ <branch test="${skip_checkpoint} == true" name="Skip confirmation">
158
+ <block type="event" id="E2" action="log" level="info" desc="Skipping checkpoint B">
159
+ <field name="message">skip_checkpoint=true, proceeding without user confirmation</field>
160
+ </block>
161
+ </branch>
162
+ <branch default="true" name="Request confirmation">
163
+ <block type="event" id="E3" action="confirm" title="Feature Design Summary - Checkpoint B" type="yesno" desc="Present design summary for confirmation">
164
+ <field name="preview">Feature: ${feature_name} (${feature_id})
165
+
166
+ FUNCTIONS DESIGNED
167
+ Total: ${feature_analysis.function_count} functions
168
+
169
+ SYSTEM RELATIONSHIP SUMMARY
170
+ - [EXISTING]: ${feature_analysis.existing_count} - Reuse existing capabilities
171
+ - [MODIFIED]: ${feature_analysis.modified_count} - Enhance existing features
172
+ - [NEW]: ${feature_analysis.new_count} - Create new functionality
173
+
174
+ FRONTEND COMPONENTS
175
+ - Platforms: ${frontend_platforms}
176
+ - Total Functions with UI: ${ui_prototypes.function_count}
177
+
178
+ BACKEND INTERFACES
179
+ - Total APIs: ${backend_design.api_count}
180
+ - Cross-Module Interactions: ${backend_design.cross_module_count}
181
+
182
+ DATA ENTITIES
183
+ - New Entities: ${data_model.new_entities_count}
184
+ - Modified Entities: ${data_model.modified_entities_count}
185
+ - Business Rules: ${data_model.business_rules_count}
186
+
187
+ Please confirm:
188
+ 1. Function Coverage: Does this design cover all functions?
189
+ 2. System Relationship Markers: Are [EXISTING]/[MODIFIED]/[NEW] markers accurate?
190
+ 3. UI/UX Approach: Do wireframes match expectations?
191
+ 4. Backend Interface Scope: Are API endpoints correctly identified?
192
+ 5. Data Model Completeness: Does it cover all fields and relationships?
193
+ 6. Business Perspective: Verify NO file paths, framework names, code snippets, SQL, or technical types</field>
194
+ </block>
195
+ </branch>
196
+ </block>
197
+
198
+ <!-- Step 4.3: Update Checkpoint B -->
199
+ <block type="task" id="B9" action="run-script" desc="Record checkpoint B passed">
200
+ <field name="command">node "${workspace_path}/scripts/update-progress.js" write-checkpoint --file "${workspace_path}/iterations/${iteration_id}/02.feature-design/.checkpoints.json" --stage 02_feature_design --checkpoint feature_design_review --passed true</field>
201
+ <field name="output" var="checkpoint_b_result"/>
202
+ </block>
203
+
204
+ <!-- Step 5: Determine Output Path and Copy Template -->
205
+ <block type="task" id="B10" action="read-file" desc="Read Feature Spec template">
206
+ <field name="path">speccrew-fd-feature-design/templates/FEATURE-SPEC-TEMPLATE.md</field>
207
+ <field name="output" var="template_content"/>
208
+ </block>
209
+
210
+ <!-- Gateway: Determine output path mode -->
211
+ <block type="gateway" id="G5" mode="exclusive" desc="Determine output path">
212
+ <branch test="${feature_id} != null" name="Single Feature Mode">
213
+ <block type="task" id="B11" action="generate" desc="Create document from template">
214
+ <field name="template" value="${template_content}"/>
215
+ <field name="placeholders">
216
+ - [Feature Name] → ${feature_name}
217
+ - {Feature ID} → ${feature_id}
218
+ - {Feature Name} → ${feature_name}
219
+ - {Page+API / API-only} → ${feature_type}
220
+ - {Link to Sub-PRD} → ${prd_path}
221
+ </field>
222
+ <field name="output_path">${workspace_path}/iterations/${iteration_id}/02.feature-design/${feature_id}-${feature_name}-feature-spec.md</field>
223
+ <field name="output" var="document_created"/>
224
+ </block>
225
+ </branch>
226
+ <branch default="true" name="Legacy Mode">
227
+ <block type="task" id="B12" action="generate" desc="Create document from template">
228
+ <field name="template" value="${template_content}"/>
229
+ <field name="placeholders">
230
+ - [Feature Name] → ${feature_name}
231
+ - {Feature ID} → ${feature_id}
232
+ - {Feature Name} → ${feature_name}
233
+ - {Page+API / API-only} → ${feature_type}
234
+ - {Link to Sub-PRD} → ${prd_path}
235
+ </field>
236
+ <field name="output_path">${workspace_path}/iterations/${iteration_id}/02.feature-design/${feature_name}-feature-spec.md</field>
237
+ <field name="output" var="document_created"/>
238
+ </block>
239
+ </branch>
240
+ </block>
241
+
242
+ <!-- Step 6: Fill Sections Using search_replace -->
243
+ <block type="loop" id="L1" over="${feature_analysis.functions}" as="function" desc="Fill each function section">
244
+ <block type="task" id="B13" action="edit-file" desc="Fill Frontend Prototype section">
245
+ <field name="path">${output_path}</field>
246
+ <field name="operation">search_replace</field>
247
+ <field name="search">#### ${function.id}.1 Frontend Prototype
248
+
249
+ [TO BE FILLED]</field>
250
+ <field name="replace">#### ${function.id}.1 Frontend Prototype
251
+
252
+ ${ui_prototypes[function.id]}</field>
253
+ </block>
254
+
255
+ <block type="task" id="B14" action="edit-file" desc="Fill Interaction Flow section">
256
+ <field name="path">${output_path}</field>
257
+ <field name="operation">search_replace</field>
258
+ <field name="search">#### ${function.id}.2 Interaction Flow
259
+
260
+ [TO BE FILLED]</field>
261
+ <field name="replace">#### ${function.id}.2 Interaction Flow
262
+
263
+ ${interaction_flows[function.id]}</field>
264
+ </block>
265
+
266
+ <block type="task" id="B15" action="edit-file" desc="Fill Backend Interface section">
267
+ <field name="path">${output_path}</field>
268
+ <field name="operation">search_replace</field>
269
+ <field name="search">#### ${function.id}.3 Backend Interface
270
+
271
+ [TO BE FILLED]</field>
272
+ <field name="replace">#### ${function.id}.3 Backend Interface
273
+
274
+ ${backend_design[function.id]}</field>
275
+ </block>
276
+
277
+ <block type="task" id="B16" action="edit-file" desc="Fill Data Definition section">
278
+ <field name="path">${output_path}</field>
279
+ <field name="operation">search_replace</field>
280
+ <field name="search">#### ${function.id}.4 Data Definition
281
+
282
+ [TO BE FILLED]</field>
283
+ <field name="replace">#### ${function.id}.4 Data Definition
284
+
285
+ ${data_model[function.id]}</field>
286
+ </block>
287
+ </block>
288
+
289
+ <!-- Step 7: Mermaid Diagram Compliance -->
290
+ <block type="task" id="B17" action="analyze" desc="Verify Mermaid compliance">
291
+ <field name="input" value="${output_path}"/>
292
+ <field name="verification_rules">
293
+ - NO style definitions (classDef, style)
294
+ - NO HTML tags (<br/>, <b>)
295
+ - Use standard syntax only (sequenceDiagram, flowchart TD)
296
+ </field>
297
+ <field name="output" var="mermaid_check"/>
298
+ </block>
299
+
300
+ <!-- Step 8: Update Checkpoint -->
301
+ <block type="task" id="B18" action="run-script" desc="Record feature spec review checkpoint">
302
+ <field name="command">node "${workspace_path}/scripts/update-progress.js" write-checkpoint --file "${workspace_path}/iterations/${iteration_id}/02.feature-design/.checkpoints.json" --stage 02_feature_design --checkpoint feature_spec_review --passed true</field>
303
+ </block>
304
+
305
+ <!-- Step 9: Update Progress with Metadata -->
306
+ <block type="task" id="B19" action="run-script" desc="Update dispatch progress with metadata">
307
+ <field name="command">node "${workspace_path}/scripts/update-progress.js" update-task --file "${workspace_path}/iterations/${iteration_id}/DISPATCH-PROGRESS.json" --task-id "${feature_id}" --status completed --metadata '{"function_count": ${feature_analysis.function_count}, "component_count": ${ui_prototypes.component_count}, "api_count": ${backend_design.api_count}, "entity_count": ${data_model.entity_count}}'</field>
308
+ </block>
309
+
310
+ </sequence>
311
+
312
+ <!-- ============================================================
313
+ Output Results
314
+ ============================================================ -->
315
+ <block type="output" id="O1" desc="Workflow output results">
316
+ <field name="feature_spec_path" value="${output_path}" type="string" desc="Path to generated Feature Spec"/>
317
+ <field name="function_count" from="${feature_analysis.function_count}" type="number" desc="Number of functions designed"/>
318
+ <field name="api_count" from="${backend_design.api_count}" type="number" desc="Number of APIs defined"/>
319
+ <field name="checkpoint_b_status" value="passed" type="string" desc="Checkpoint B status"/>
320
+ </block>
321
+
322
+ </workflow>
@@ -32,47 +32,11 @@ Any Agent or script requiring timestamp generation
32
32
  | `HHmm` | Time only (24h) | `1326` |
33
33
  | `ISO` | ISO 8601 format | `2026-03-17T13:26:45+08:00` |
34
34
 
35
- ## Usage
35
+ ## AgentFlow Definition
36
36
 
37
- ### Method 1: Direct Script Execution (Node.js - Cross Platform)
37
+ <!-- @agentflow: workflow.agentflow.xml -->
38
38
 
39
- ```bash
40
- # Node.js (cross-platform, recommended)
41
- node scripts/get-timestamp.js "YYYY-MM-DD-HHmmss"
42
- ```
43
-
44
- ### Method 2: Default Format (YYYY-MM-DD-HHmmss)
45
-
46
- ```bash
47
- # Without format parameter, returns YYYY-MM-DD-HHmmss
48
- node scripts/get-timestamp.js
49
- ```
50
-
51
- ## Integration Examples
52
-
53
- ### For Report Filenames
54
-
55
- ```bash
56
- TIMESTAMP=$(node scripts/get-timestamp.js "YYYY-MM-DD-HHmmss")
57
- FILENAME="diagnosis-report-${TIMESTAMP}.md"
58
- # Result: diagnosis-report-2026-03-17-132645.md
59
- ```
60
-
61
- ### For Archive Naming
62
-
63
- ```bash
64
- TIMESTAMP=$(node scripts/get-timestamp.js "YYYY-MM-DD")
65
- ARCHIVE_NAME="tech-debt-archived-${TIMESTAMP}.md"
66
- # Result: tech-debt-archived-2026-03-17.md
67
- ```
68
-
69
- ### For Template Variables
70
-
71
- When filling `{{generated_at}}` in templates:
72
- ```bash
73
- generated_at=$(node scripts/get-timestamp.js "ISO")
74
- # Result: 2026-03-17T13:26:45+08:00
75
- ```
39
+ > **REQUIRED**: Before executing this workflow, read the XML workflow specification: `speccrew-workspace/docs/rules/agentflow-spec.md`
76
40
 
77
41
  ## Script Location
78
42