speccrew 0.6.42 → 0.6.44

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.
@@ -40,156 +40,156 @@ For each platform, generates:
40
40
 
41
41
  > **REQUIRED**: Before executing this workflow, read the XML workflow specification: `docs/rules/xml-workflow-spec.md`
42
42
 
43
- <workflow>
44
-
45
- <!-- Input Block -->
46
- <input name="platforms" type="array" required="true" description="Platform list from detection phase" />
47
- <input name="workspace_path" type="string" required="true" description="Absolute path to speccrew-workspace directory" />
48
- <input name="sync_state_bizs_dir" type="string" required="true" description="Absolute path to entry-dirs JSON output directory" />
49
- <input name="configs_dir" type="string" required="true" description="Absolute path to configuration files directory" />
50
-
51
- <!-- Rule Block: Constraints -->
52
- <rule level="mandatory">Use the provided absolute paths directly. DO NOT construct or derive paths yourself.</rule>
53
- <rule level="mandatory">All entryDirs paths must use forward slashes / as path separators (even on Windows)</rule>
54
- <rule level="mandatory">Do not include leading or trailing slashes in entryDirs paths</rule>
55
-
56
- <!-- Loop: Process Each Platform -->
57
- <loop over="platforms" as="platform">
58
-
59
- <!-- Step 1: Read Directory Tree -->
60
- <task name="read-directory-tree" action="run-script">
61
- <description>Read each platform's sourcePath directory structure (3 levels deep)</description>
62
- <script type="bash">
63
- <platform-type>windows</platform-type>
64
- <command>tree /F /A "{platform.sourcePath}" | Select-Object -First 100</command>
65
- </script>
66
- <script type="bash">
67
- <platform-type>unix</platform-type>
68
- <command>tree -L 3 "{platform.sourcePath}"</command>
69
- </script>
70
- <output name="directory_tree" />
71
- </task>
72
-
73
- <!-- Step 2: LLM Analysis - Identify Entry Directories -->
74
- <task name="analyze-entry-dirs" action="run-skill">
75
- <description>Analyze directory tree and identify entry directories based on platform type</description>
76
- <input ref="directory_tree" />
77
- <input ref="platform.platformType" />
78
- <input ref="platform.platformSubtype" />
79
- <input ref="platform.techStack" />
80
- <logic>
81
- <backend>
82
- - Find all directories containing *Controller.java or *Controller.kt files
83
- - These are API entry directories
84
- - Module name = the business package name of the entry directory
85
- </backend>
86
- <frontend-vue-react>
87
- - Find views/ or pages/ directories
88
- - First-level subdirectories under these directories are business modules
89
- </frontend-vue-react>
90
- <mobile-uniapp>
91
- - Find first-level subdirectories under pages/
92
- - Plus top-level pages-* directories (module name = directory name without pages- prefix)
93
- </mobile-uniapp>
94
- <mobile-miniprogram>
95
- - Find first-level subdirectories under pages/ as modules
96
- </mobile-miniprogram>
97
- </logic>
98
- <output name="identified_entries" />
99
- </task>
100
-
101
- <!-- Step 3: Load Exclusion Rules -->
102
- <task name="load-exclusion-rules" action="run-script">
103
- <description>Read tech-stack-mappings.json to load exclusion patterns</description>
104
- <script type="read-file">
105
- <path>{configs_dir}/tech-stack-mappings.json</path>
106
- </script>
107
- <output name="exclusion_rules" />
108
- </task>
109
-
110
- <!-- Gateway: Apply Exclusion Rules -->
111
- <gateway mode="guard">
112
- <condition>identified_entries is not empty</condition>
113
- <then>
114
- <task name="filter-entries" action="run-skill">
115
- <description>Apply exclusion rules to filter out technical directories</description>
116
- <input ref="identified_entries" />
117
- <input ref="exclusion_rules" />
118
- <exclusions>
119
- <pure-technical>config, framework, enums, exception, util, utils, common, constant, constants, type, types, dto, vo, entity, model, mapper, repository, dao, service, impl</pure-technical>
120
- <build-output>dist, build, target, out, node_modules</build-output>
121
- <test-directories>test, tests, spec, __tests__, e2e</test-directories>
122
- <config-directories>.git, .idea, .vscode, .speccrew</config-directories>
123
- </exclusions>
124
- <root-handling>Assign entry files not under any subdirectory to _root module</root-handling>
125
- <output name="filtered_entries" />
126
- </task>
127
- </then>
128
- </gateway>
129
-
130
- <!-- Step 4: Generate entry-dirs JSON -->
131
- <task name="generate-entry-dirs-json" action="run-script">
132
- <description>Generate entry-dirs JSON file for the platform</description>
133
- <output-path>{sync_state_bizs_dir}/entry-dirs-{platform.platformId}.json</output-path>
134
- <content>
135
- <json-structure>
43
+ <workflow id="identify-entries-main" status="pending" version="1.0" desc="Identify business module entry directories for each platform">
44
+
45
+ <!-- ============================================================
46
+ Input Parameters Definition
47
+ ============================================================ -->
48
+ <block type="input" id="I1" desc="Workflow input parameters">
49
+ <field name="platforms" required="true" type="array" desc="Platform list from detection phase"/>
50
+ <field name="workspace_path" required="true" type="string" desc="Absolute path to speccrew-workspace directory"/>
51
+ <field name="sync_state_bizs_dir" required="true" type="string" desc="Absolute path to entry-dirs JSON output directory"/>
52
+ <field name="configs_dir" required="true" type="string" desc="Absolute path to configuration files directory"/>
53
+ </block>
54
+
55
+ <!-- ============================================================
56
+ Global Constraints
57
+ ============================================================ -->
58
+ <block type="rule" id="R1" level="mandatory" desc="Path constraints">
59
+ <field name="text">Use the provided absolute paths directly. DO NOT construct or derive paths yourself.</field>
60
+ <field name="text">All entryDirs paths must use forward slashes / as path separators (even on Windows)</field>
61
+ <field name="text">Do not include leading or trailing slashes in entryDirs paths</field>
62
+ </block>
63
+
64
+ <!-- ============================================================
65
+ Global Continuous Execution Rules
66
+ ============================================================ -->
67
+ <block type="rule" id="GLOBAL-R1" level="forbidden" desc="Continuous execution constraints — NEVER violate">
68
+ <field name="text">DO NOT ask user "Should I continue?" or "How would you like to proceed?" during execution</field>
69
+ <field name="text">DO NOT offer options like "Full execution / Partial / Stop" — always execute ALL tasks to completion</field>
70
+ <field name="text">DO NOT suggest "Due to context window limits, let me pause" — complete current task, use checkpoint for resumption</field>
71
+ <field name="text">DO NOT estimate workload and suggest breaking it into phases — execute ALL items in sequence</field>
72
+ <field name="text">DO NOT warn about "large number of files" or "this may take a while" — proceed with generation</field>
73
+ <field name="text">Context window management: if approaching limit, save progress to checkpoint file and resume — do NOT ask user for guidance</field>
74
+ </block>
75
+
76
+ <!-- ============================================================
77
+ Main Processing Sequence
78
+ ============================================================ -->
79
+ <sequence id="S1" name="Process Platforms" status="pending" desc="Iterate each platform to identify entry directories">
80
+
81
+ <!-- Loop: Process Each Platform -->
82
+ <block type="loop" id="L1" over="${platforms}" as="platform" desc="Iterate each platform to identify entry directories">
83
+
84
+ <!-- Step 1: Read Directory Tree -->
85
+ <block type="task" id="B1" action="run-script" desc="Read each platform's sourcePath directory structure (3 levels deep)">
86
+ <field name="command">tree /F /A "${platform.sourcePath}" | Select-Object -First 100</field>
87
+ <field name="alt_command">tree -L 3 "${platform.sourcePath}"</field>
88
+ <field name="output" var="directory_tree"/>
89
+ </block>
90
+
91
+ <!-- Step 2: LLM Analysis - Identify Entry Directories -->
92
+ <block type="task" id="B2" action="analyze" desc="Analyze directory tree and identify entry directories based on platform type">
93
+ <field name="input" value="${directory_tree}"/>
94
+ <field name="platform_type" value="${platform.platformType}"/>
95
+ <field name="platform_subtype" value="${platform.platformSubtype}"/>
96
+ <field name="tech_stack" value="${platform.techStack}"/>
97
+ <field name="logic_backend" value="Find all directories containing *Controller.java or *Controller.kt files. These are API entry directories. Module name = the business package name of the entry directory"/>
98
+ <field name="logic_frontend_vue_react" value="Find views/ or pages/ directories. First-level subdirectories under these directories are business modules"/>
99
+ <field name="logic_mobile_uniapp" value="Find first-level subdirectories under pages/. Plus top-level pages-* directories (module name = directory name without pages- prefix)"/>
100
+ <field name="logic_mobile_miniprogram" value="Find first-level subdirectories under pages/ as modules"/>
101
+ <field name="output" var="identified_entries"/>
102
+ </block>
103
+
104
+ <!-- Step 3: Load Exclusion Rules -->
105
+ <block type="task" id="B3" action="read-file" desc="Read tech-stack-mappings.json to load exclusion patterns">
106
+ <field name="path" value="${configs_dir}/tech-stack-mappings.json"/>
107
+ <field name="output" var="exclusion_rules"/>
108
+ </block>
109
+
110
+ <!-- Gateway: Apply Exclusion Rules -->
111
+ <block type="gateway" id="G1" mode="guard" desc="Check if identified_entries is not empty">
112
+ <branch test="${identified_entries} != null AND ${identified_entries.length} > 0">
113
+ <block type="task" id="B4" action="analyze" desc="Apply exclusion rules to filter out technical directories">
114
+ <field name="input" value="${identified_entries}"/>
115
+ <field name="exclusion_rules" value="${exclusion_rules}"/>
116
+ <field name="exclusions_pure_technical" value="config, framework, enums, exception, util, utils, common, constant, constants, type, types, dto, vo, entity, model, mapper, repository, dao, service, impl"/>
117
+ <field name="exclusions_build_output" value="dist, build, target, out, node_modules"/>
118
+ <field name="exclusions_test_directories" value="test, tests, spec, __tests__, e2e"/>
119
+ <field name="exclusions_config_directories" value=".git, .idea, .vscode, .speccrew"/>
120
+ <field name="root_handling" value="Assign entry files not under any subdirectory to _root module"/>
121
+ <field name="output" var="filtered_entries"/>
122
+ </block>
123
+ </branch>
124
+ </block>
125
+
126
+ <!-- Step 4: Generate entry-dirs JSON -->
127
+ <block type="task" id="B5" action="write-file" desc="Generate entry-dirs JSON file for the platform">
128
+ <field name="path" value="${sync_state_bizs_dir}/entry-dirs-${platform.platformId}.json"/>
129
+ <field name="content_json">
136
130
  {
137
- "platformId": "{platform.platformId}",
138
- "platformName": "{platform.platformName}",
139
- "platformType": "{platform.platformType}",
140
- "platformSubtype": "{platform.platformSubtype}",
141
- "sourcePath": "{platform.sourcePath}",
142
- "techStack": "{platform.techStack}",
131
+ "platformId": "${platform.platformId}",
132
+ "platformName": "${platform.platformName}",
133
+ "platformType": "${platform.platformType}",
134
+ "platformSubtype": "${platform.platformSubtype}",
135
+ "sourcePath": "${platform.sourcePath}",
136
+ "techStack": "${platform.techStack}",
143
137
  "modules": [
144
138
  { "name": "module-name", "entryDirs": ["relative/path/to/entry"] }
145
139
  ]
146
140
  }
147
- </json-structure>
148
- </content>
149
- <output name="generated_json_path" />
150
- </task>
151
-
152
- <!-- Checkpoint: Persist Generated JSON -->
153
- <checkpoint name="entry-dirs-generated" verify="file_exists({sync_state_bizs_dir}/entry-dirs-{platform.platformId}.json)" />
154
-
155
- <!-- Step 5: Validation -->
156
- <task name="validate-output" action="run-skill">
157
- <description>Validate the generated entry-dirs JSON</description>
158
- <input ref="generated_json_path" />
159
- <validation-rules>
160
- <rule>modules array is not empty</rule>
161
- <rule>each module has at least one entry directory</rule>
162
- <rule>module names are business-meaningful (not technical terms like config, util)</rule>
163
- <rule>entryDirs paths are correct and accessible</rule>
164
- <rule>JSON format is valid</rule>
165
- </validation-rules>
166
- <output name="validation_result" />
167
- </task>
168
-
169
- <!-- Gateway: Validation Result -->
170
- <gateway mode="exclusive">
171
- <branch condition="validation_result.status == 'failed'">
172
- <error-handler>
173
- <catch>
174
- <event action="log">Entry directory recognition failed for platform {platform.platformId}</event>
175
- <task name="re-analyze" action="run-skill">
176
- <description>Re-analyze the directory tree due to validation failure</description>
177
- <input ref="directory_tree" />
178
- <output name="re_analyzed_entries" />
179
- </task>
180
- </catch>
181
- </error-handler>
182
- </branch>
183
- <branch condition="validation_result.status == 'passed'">
184
- <event action="log">Platform {platform.platformId} entry-dirs validation passed</event>
185
- </branch>
186
- </gateway>
187
-
188
- </loop>
189
-
190
- <!-- Output Block -->
191
- <output name="generated_files" from="generated_json_path" description="List of all generated entry-dirs JSON files" />
192
- <output name="validation_summary" from="validation_result" description="Summary of validation results for all platforms" />
141
+ </field>
142
+ <field name="output" var="generated_json_path"/>
143
+ </block>
144
+
145
+ <!-- Checkpoint: Persist Generated JSON -->
146
+ <block type="checkpoint" id="CP1" name="entry-dirs-generated" desc="Verify entry-dirs JSON was generated">
147
+ <field name="file" value="${sync_state_bizs_dir}/entry-dirs-${platform.platformId}.json"/>
148
+ <field name="verify" value="file_exists(${sync_state_bizs_dir}/entry-dirs-${platform.platformId}.json)"/>
149
+ </block>
150
+
151
+ <!-- Step 5: Validation -->
152
+ <block type="task" id="B6" action="analyze" desc="Validate the generated entry-dirs JSON">
153
+ <field name="input" value="${generated_json_path}"/>
154
+ <field name="validation_rules">
155
+ - modules array is not empty
156
+ - each module has at least one entry directory
157
+ - module names are business-meaningful (not technical terms like config, util)
158
+ - entryDirs paths are correct and accessible
159
+ - JSON format is valid
160
+ </field>
161
+ <field name="output" var="validation_result"/>
162
+ </block>
163
+
164
+ <!-- Gateway: Validation Result -->
165
+ <block type="gateway" id="G2" mode="exclusive" desc="Handle validation result">
166
+ <branch test="${validation_result.status} == 'failed'">
167
+ <block type="error-handler" id="EH1" desc="Handle validation failure">
168
+ <catch error-type="validation_failed">
169
+ <block type="event" id="E1" action="log" level="warn" desc="Log validation failure">Entry directory recognition failed for platform ${platform.platformId}</block>
170
+ <block type="task" id="B7" action="analyze" desc="Re-analyze the directory tree due to validation failure">
171
+ <field name="input" value="${directory_tree}"/>
172
+ <field name="output" var="re_analyzed_entries"/>
173
+ </block>
174
+ </catch>
175
+ </block>
176
+ </branch>
177
+ <branch test="${validation_result.status} == 'passed'">
178
+ <block type="event" id="E2" action="log" level="info" desc="Log validation success">Platform ${platform.platformId} entry-dirs validation passed</block>
179
+ </branch>
180
+ </block>
181
+
182
+ </block>
183
+
184
+ </sequence>
185
+
186
+ <!-- ============================================================
187
+ Output Results
188
+ ============================================================ -->
189
+ <block type="output" id="O1" desc="Workflow output results">
190
+ <field name="generated_files" from="${generated_json_path}" type="array" desc="List of all generated entry-dirs JSON files"/>
191
+ <field name="validation_summary" from="${validation_result}" type="object" desc="Summary of validation results for all platforms"/>
192
+ </block>
193
193
 
194
194
  </workflow>
195
195