@zeyue0329/xiaoma-cli 1.0.39 → 1.0.41

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 (27) hide show
  1. package/.idea/workspace.xml +1 -0
  2. package/.xiaoma-core/.coordinator-state.json +19 -0
  3. package/dist/agents/architect.txt +192 -0
  4. package/dist/agents/workflow-helper.txt +93 -0
  5. package/dist/teams/team-all.txt +245 -190
  6. package/dist/teams/team-fullstack-with-database.txt +2 -0
  7. package/dist/teams/team-fullstack.txt +2 -0
  8. package/dist/teams/team-no-ui.txt +2 -0
  9. package/docs/architecture/workflow-coordinator-implementation.md +1188 -0
  10. package/docs/prd/workflow-coordinator-prd.md +1214 -0
  11. package/package.json +1 -1
  12. package/tools/installer/package.json +1 -1
  13. package/tools/workflow-coordinator/README.md +38 -0
  14. package/tools/workflow-coordinator/USAGE.md +548 -0
  15. package/tools/workflow-coordinator/package-lock.json +4868 -0
  16. package/tools/workflow-coordinator/package.json +35 -0
  17. package/tools/workflow-coordinator/src/api/server.js +207 -0
  18. package/tools/workflow-coordinator/src/controller/workflow-controller.js +263 -0
  19. package/tools/workflow-coordinator/src/index.js +113 -0
  20. package/tools/workflow-coordinator/src/parser/workflow-parser.js +144 -0
  21. package/tools/workflow-coordinator/src/utils/state-manager.js +59 -0
  22. package/tools/workflow-coordinator/src/utils/validator.js +86 -0
  23. package/tools/workflow-coordinator/test/integration-test.js +266 -0
  24. package/tools/workflow-coordinator/test/quick-test.js +127 -0
  25. package/xiaoma-core/agents/architect.md +2 -0
  26. package/xiaoma-core/agents/workflow-helper.md +481 -0
  27. package/xiaoma-core/workflows/automated-requirements-analysis.yaml +11 -8
@@ -296,6 +296,7 @@ commands:
296
296
  - execute-checklist {checklist}: 运行任务 execute-checklist (默认为->architect-checklist)
297
297
  - research {topic}: 执行任务 create-deep-research-prompt
298
298
  - shard-prd: 为提供的 architecture.md 运行任务 shard-doc.md (如果未找到则询问)
299
+ - shard-doc: 执行任务 shard-doc.md 切分大型文档到多个小文档
299
300
  - yolo: 切换 Yolo 模式
300
301
  - exit: 作为架构师道别,然后放弃扮演此角色
301
302
  dependencies:
@@ -308,6 +309,7 @@ dependencies:
308
309
  - create-doc.md
309
310
  - document-project.md
310
311
  - execute-checklist.md
312
+ - shard-doc.md
311
313
  templates:
312
314
  - architecture-tmpl.yaml
313
315
  - brownfield-architecture-tmpl.yaml
@@ -2321,6 +2323,59 @@ completion_report:
2321
2323
  祝你使用愉快!工作流执行器将协调所有智能体,像流水线一样自动完成从需求分析到代码实现的完整流程。🎉
2322
2324
  ==================== END: .xiaoma-core/agents/workflow-executor.md ====================
2323
2325
 
2326
+ ==================== START: .xiaoma-core/agents/workflow-helper.md ====================
2327
+ # agent
2328
+
2329
+ CRITICAL: Read the full YAML, start activation to alter your state of being, follow startup section instructions, stay in this being until told to exit this mode:
2330
+
2331
+ ```yaml
2332
+ on_failure:
2333
+ max_retries: 3
2334
+ escalation: 请检查架构模板完整性
2335
+ ```
2336
+
2337
+ ## 调试
2338
+
2339
+ ### 启用详细日志
2340
+
2341
+ 在协调器启动时查看详细日志:
2342
+ ```bash
2343
+ DEBUG=* node src/index.js start automated-requirements-analysis
2344
+ ```
2345
+
2346
+ ### 查看状态文件
2347
+
2348
+ 工作流状态保存在:`.xiaoma-core/.coordinator-state.json`
2349
+
2350
+ 查看:
2351
+ ```bash
2352
+ cat .xiaoma-core/.coordinator-state.json
2353
+ ```
2354
+
2355
+ ## 使用提示
2356
+
2357
+ 1. **先启动协调器**:在Claude Code中启动工作流前,确保协调器已运行
2358
+ 2. **保持终端开启**:协调器需要持续运行,不要关闭终端
2359
+ 3. **监控日志**:协调器日志会显示详细的执行进度和问题
2360
+ 4. **状态恢复**:如果中断,状态文件允许从中断点恢复
2361
+ 5. **工作流定义**:所有工作流定义在`xiaoma-core/workflows/`目录
2362
+
2363
+ ## 与workflow-executor的区别
2364
+
2365
+ **workflow-executor**(旧方案):
2366
+ - 完全由AI驱动,基于AI判断决定下一步
2367
+ - 会在关键点暂停询问用户
2368
+ - 无法完全自动化
2369
+
2370
+ **workflow-helper + Coordinator**(新方案):
2371
+ - 程序化流程控制,消除AI决策延迟
2372
+ - 完全自动执行,无需人工确认
2373
+ - 状态持久化,支持恢复
2374
+ - 质量门控,自动验证输出
2375
+
2376
+ workflow-helper专注于"执行层",协调器负责"控制层",实现关注点分离和更可靠的自动化。
2377
+ ==================== END: .xiaoma-core/agents/workflow-helper.md ====================
2378
+
2324
2379
  ==================== START: .xiaoma-core/tasks/advanced-elicitation.md ====================
2325
2380
  <!-- Powered by XiaoMa™ Core -->
2326
2381
 
@@ -5555,6 +5610,196 @@ The LLM will:
5555
5610
  - Offer to provide detailed analysis of any section, especially those with warnings or failures
5556
5611
  ==================== END: .xiaoma-core/tasks/execute-checklist.md ====================
5557
5612
 
5613
+ ==================== START: .xiaoma-core/tasks/shard-doc.md ====================
5614
+ <!-- Powered by XiaoMa™ Core -->
5615
+
5616
+ # Document Sharding Task
5617
+
5618
+ ## Purpose
5619
+
5620
+ - Split a large document into multiple smaller documents based on level 2 sections
5621
+ - Create a folder structure to organize the sharded documents
5622
+ - Maintain all content integrity including code blocks, diagrams, and markdown formatting
5623
+
5624
+ ## Primary Method: Automatic with markdown-tree
5625
+
5626
+ [[LLM: First, check if markdownExploder is set to true in .xiaoma-core/core-config.yaml. If it is, attempt to run the command: `md-tree explode {input file} {output path}`.
5627
+
5628
+ If the command succeeds, inform the user that the document has been sharded successfully and STOP - do not proceed further.
5629
+
5630
+ If the command fails (especially with an error indicating the command is not found or not available), inform the user: "The markdownExploder setting is enabled but the md-tree command is not available. Please either:
5631
+
5632
+ 1. Install @kayvan/markdown-tree-parser globally with: `npm install -g @kayvan/markdown-tree-parser`
5633
+ 2. Or set markdownExploder to false in .xiaoma-core/core-config.yaml
5634
+
5635
+ **IMPORTANT: STOP HERE - do not proceed with manual sharding until one of the above actions is taken.**"
5636
+
5637
+ If markdownExploder is set to false, inform the user: "The markdownExploder setting is currently false. For better performance and reliability, you should:
5638
+
5639
+ 1. Set markdownExploder to true in .xiaoma-core/core-config.yaml
5640
+ 2. Install @kayvan/markdown-tree-parser globally with: `npm install -g @kayvan/markdown-tree-parser`
5641
+
5642
+ I will now proceed with the manual sharding process."
5643
+
5644
+ Then proceed with the manual method below ONLY if markdownExploder is false.]]
5645
+
5646
+ ### Installation and Usage
5647
+
5648
+ 1. **Install globally**:
5649
+
5650
+ ```bash
5651
+ npm install -g @kayvan/markdown-tree-parser
5652
+ ```
5653
+
5654
+ 2. **Use the explode command**:
5655
+
5656
+ ```bash
5657
+ # For PRD
5658
+ md-tree explode docs/prd.md docs/prd
5659
+
5660
+ # For Architecture
5661
+ md-tree explode docs/architecture.md docs/architecture
5662
+
5663
+ # For any document
5664
+ md-tree explode [source-document] [destination-folder]
5665
+ ```
5666
+
5667
+ 3. **What it does**:
5668
+ - Automatically splits the document by level 2 sections
5669
+ - Creates properly named files
5670
+ - Adjusts heading levels appropriately
5671
+ - Handles all edge cases with code blocks and special markdown
5672
+
5673
+ If the user has @kayvan/markdown-tree-parser installed, use it and skip the manual process below.
5674
+
5675
+ ---
5676
+
5677
+ ## Manual Method (if @kayvan/markdown-tree-parser is not available or user indicated manual method)
5678
+
5679
+ ### Task Instructions
5680
+
5681
+ 1. Identify Document and Target Location
5682
+
5683
+ - Determine which document to shard (user-provided path)
5684
+ - Create a new folder under `docs/` with the same name as the document (without extension)
5685
+ - Example: `docs/prd.md` → create folder `docs/prd/`
5686
+
5687
+ 2. Parse and Extract Sections
5688
+
5689
+ CRITICAL AEGNT SHARDING RULES:
5690
+
5691
+ 1. Read the entire document content
5692
+ 2. Identify all level 2 sections (## headings)
5693
+ 3. For each level 2 section:
5694
+ - Extract the section heading and ALL content until the next level 2 section
5695
+ - Include all subsections, code blocks, diagrams, lists, tables, etc.
5696
+ - Be extremely careful with:
5697
+ - Fenced code blocks (```) - ensure you capture the full block including closing backticks and account for potential misleading level 2's that are actually part of a fenced section example
5698
+ - Mermaid diagrams - preserve the complete diagram syntax
5699
+ - Nested markdown elements
5700
+ - Multi-line content that might contain ## inside code blocks
5701
+
5702
+ CRITICAL: Use proper parsing that understands markdown context. A ## inside a code block is NOT a section header.]]
5703
+
5704
+ ### 3. Create Individual Files
5705
+
5706
+ For each extracted section:
5707
+
5708
+ 1. **Generate filename**: Convert the section heading to lowercase-dash-case
5709
+ - Remove special characters
5710
+ - Replace spaces with dashes
5711
+ - Example: "## Tech Stack" → `tech-stack.md`
5712
+
5713
+ 2. **Adjust heading levels**:
5714
+ - The level 2 heading becomes level 1 (# instead of ##) in the sharded new document
5715
+ - All subsection levels decrease by 1:
5716
+
5717
+ ```txt
5718
+ - ### → ##
5719
+ - #### → ###
5720
+ - ##### → ####
5721
+ - etc.
5722
+ ```
5723
+
5724
+ 3. **Write content**: Save the adjusted content to the new file
5725
+
5726
+ ### 4. Create Index File
5727
+
5728
+ Create an `index.md` file in the sharded folder that:
5729
+
5730
+ 1. Contains the original level 1 heading and any content before the first level 2 section
5731
+ 2. Lists all the sharded files with links:
5732
+
5733
+ ```markdown
5734
+ # Original Document Title
5735
+
5736
+ [Original introduction content if any]
5737
+
5738
+ ## Sections
5739
+
5740
+ - [Section Name 1](./section-name-1.md)
5741
+ - [Section Name 2](./section-name-2.md)
5742
+ - [Section Name 3](./section-name-3.md)
5743
+ ...
5744
+ ```
5745
+
5746
+ ### 5. Preserve Special Content
5747
+
5748
+ 1. **Code blocks**: Must capture complete blocks including:
5749
+
5750
+ ```language
5751
+ content
5752
+ ```
5753
+
5754
+ 2. **Mermaid diagrams**: Preserve complete syntax:
5755
+
5756
+ ```mermaid
5757
+ graph TD
5758
+ ...
5759
+ ```
5760
+
5761
+ 3. **Tables**: Maintain proper markdown table formatting
5762
+
5763
+ 4. **Lists**: Preserve indentation and nesting
5764
+
5765
+ 5. **Inline code**: Preserve backticks
5766
+
5767
+ 6. **Links and references**: Keep all markdown links intact
5768
+
5769
+ 7. **Template markup**: If documents contain {{placeholders}} ,preserve exactly
5770
+
5771
+ ### 6. Validation
5772
+
5773
+ After sharding:
5774
+
5775
+ 1. Verify all sections were extracted
5776
+ 2. Check that no content was lost
5777
+ 3. Ensure heading levels were properly adjusted
5778
+ 4. Confirm all files were created successfully
5779
+
5780
+ ### 7. Report Results
5781
+
5782
+ Provide a summary:
5783
+
5784
+ ```text
5785
+ Document sharded successfully:
5786
+ - Source: [original document path]
5787
+ - Destination: docs/[folder-name]/
5788
+ - Files created: [count]
5789
+ - Sections:
5790
+ - section-name-1.md: "Section Title 1"
5791
+ - section-name-2.md: "Section Title 2"
5792
+ ...
5793
+ ```
5794
+
5795
+ ## Important Notes
5796
+
5797
+ - Never modify the actual content, only adjust heading levels
5798
+ - Preserve ALL formatting, including whitespace where significant
5799
+ - Handle edge cases like sections with code blocks containing ## symbols
5800
+ - Ensure the sharding is reversible (could reconstruct the original from shards)
5801
+ ==================== END: .xiaoma-core/tasks/shard-doc.md ====================
5802
+
5558
5803
  ==================== START: .xiaoma-core/templates/architecture-tmpl.yaml ====================
5559
5804
  template:
5560
5805
  id: architecture-template-v2
@@ -9124,196 +9369,6 @@ The story creation is successful when:
9124
9369
  - **Implicit:** An annotated change-checklist (or the record of its completion) reflecting the discussions, findings, and decisions made during the process.
9125
9370
  ==================== END: .xiaoma-core/tasks/correct-course.md ====================
9126
9371
 
9127
- ==================== START: .xiaoma-core/tasks/shard-doc.md ====================
9128
- <!-- Powered by XiaoMa™ Core -->
9129
-
9130
- # Document Sharding Task
9131
-
9132
- ## Purpose
9133
-
9134
- - Split a large document into multiple smaller documents based on level 2 sections
9135
- - Create a folder structure to organize the sharded documents
9136
- - Maintain all content integrity including code blocks, diagrams, and markdown formatting
9137
-
9138
- ## Primary Method: Automatic with markdown-tree
9139
-
9140
- [[LLM: First, check if markdownExploder is set to true in .xiaoma-core/core-config.yaml. If it is, attempt to run the command: `md-tree explode {input file} {output path}`.
9141
-
9142
- If the command succeeds, inform the user that the document has been sharded successfully and STOP - do not proceed further.
9143
-
9144
- If the command fails (especially with an error indicating the command is not found or not available), inform the user: "The markdownExploder setting is enabled but the md-tree command is not available. Please either:
9145
-
9146
- 1. Install @kayvan/markdown-tree-parser globally with: `npm install -g @kayvan/markdown-tree-parser`
9147
- 2. Or set markdownExploder to false in .xiaoma-core/core-config.yaml
9148
-
9149
- **IMPORTANT: STOP HERE - do not proceed with manual sharding until one of the above actions is taken.**"
9150
-
9151
- If markdownExploder is set to false, inform the user: "The markdownExploder setting is currently false. For better performance and reliability, you should:
9152
-
9153
- 1. Set markdownExploder to true in .xiaoma-core/core-config.yaml
9154
- 2. Install @kayvan/markdown-tree-parser globally with: `npm install -g @kayvan/markdown-tree-parser`
9155
-
9156
- I will now proceed with the manual sharding process."
9157
-
9158
- Then proceed with the manual method below ONLY if markdownExploder is false.]]
9159
-
9160
- ### Installation and Usage
9161
-
9162
- 1. **Install globally**:
9163
-
9164
- ```bash
9165
- npm install -g @kayvan/markdown-tree-parser
9166
- ```
9167
-
9168
- 2. **Use the explode command**:
9169
-
9170
- ```bash
9171
- # For PRD
9172
- md-tree explode docs/prd.md docs/prd
9173
-
9174
- # For Architecture
9175
- md-tree explode docs/architecture.md docs/architecture
9176
-
9177
- # For any document
9178
- md-tree explode [source-document] [destination-folder]
9179
- ```
9180
-
9181
- 3. **What it does**:
9182
- - Automatically splits the document by level 2 sections
9183
- - Creates properly named files
9184
- - Adjusts heading levels appropriately
9185
- - Handles all edge cases with code blocks and special markdown
9186
-
9187
- If the user has @kayvan/markdown-tree-parser installed, use it and skip the manual process below.
9188
-
9189
- ---
9190
-
9191
- ## Manual Method (if @kayvan/markdown-tree-parser is not available or user indicated manual method)
9192
-
9193
- ### Task Instructions
9194
-
9195
- 1. Identify Document and Target Location
9196
-
9197
- - Determine which document to shard (user-provided path)
9198
- - Create a new folder under `docs/` with the same name as the document (without extension)
9199
- - Example: `docs/prd.md` → create folder `docs/prd/`
9200
-
9201
- 2. Parse and Extract Sections
9202
-
9203
- CRITICAL AEGNT SHARDING RULES:
9204
-
9205
- 1. Read the entire document content
9206
- 2. Identify all level 2 sections (## headings)
9207
- 3. For each level 2 section:
9208
- - Extract the section heading and ALL content until the next level 2 section
9209
- - Include all subsections, code blocks, diagrams, lists, tables, etc.
9210
- - Be extremely careful with:
9211
- - Fenced code blocks (```) - ensure you capture the full block including closing backticks and account for potential misleading level 2's that are actually part of a fenced section example
9212
- - Mermaid diagrams - preserve the complete diagram syntax
9213
- - Nested markdown elements
9214
- - Multi-line content that might contain ## inside code blocks
9215
-
9216
- CRITICAL: Use proper parsing that understands markdown context. A ## inside a code block is NOT a section header.]]
9217
-
9218
- ### 3. Create Individual Files
9219
-
9220
- For each extracted section:
9221
-
9222
- 1. **Generate filename**: Convert the section heading to lowercase-dash-case
9223
- - Remove special characters
9224
- - Replace spaces with dashes
9225
- - Example: "## Tech Stack" → `tech-stack.md`
9226
-
9227
- 2. **Adjust heading levels**:
9228
- - The level 2 heading becomes level 1 (# instead of ##) in the sharded new document
9229
- - All subsection levels decrease by 1:
9230
-
9231
- ```txt
9232
- - ### → ##
9233
- - #### → ###
9234
- - ##### → ####
9235
- - etc.
9236
- ```
9237
-
9238
- 3. **Write content**: Save the adjusted content to the new file
9239
-
9240
- ### 4. Create Index File
9241
-
9242
- Create an `index.md` file in the sharded folder that:
9243
-
9244
- 1. Contains the original level 1 heading and any content before the first level 2 section
9245
- 2. Lists all the sharded files with links:
9246
-
9247
- ```markdown
9248
- # Original Document Title
9249
-
9250
- [Original introduction content if any]
9251
-
9252
- ## Sections
9253
-
9254
- - [Section Name 1](./section-name-1.md)
9255
- - [Section Name 2](./section-name-2.md)
9256
- - [Section Name 3](./section-name-3.md)
9257
- ...
9258
- ```
9259
-
9260
- ### 5. Preserve Special Content
9261
-
9262
- 1. **Code blocks**: Must capture complete blocks including:
9263
-
9264
- ```language
9265
- content
9266
- ```
9267
-
9268
- 2. **Mermaid diagrams**: Preserve complete syntax:
9269
-
9270
- ```mermaid
9271
- graph TD
9272
- ...
9273
- ```
9274
-
9275
- 3. **Tables**: Maintain proper markdown table formatting
9276
-
9277
- 4. **Lists**: Preserve indentation and nesting
9278
-
9279
- 5. **Inline code**: Preserve backticks
9280
-
9281
- 6. **Links and references**: Keep all markdown links intact
9282
-
9283
- 7. **Template markup**: If documents contain {{placeholders}} ,preserve exactly
9284
-
9285
- ### 6. Validation
9286
-
9287
- After sharding:
9288
-
9289
- 1. Verify all sections were extracted
9290
- 2. Check that no content was lost
9291
- 3. Ensure heading levels were properly adjusted
9292
- 4. Confirm all files were created successfully
9293
-
9294
- ### 7. Report Results
9295
-
9296
- Provide a summary:
9297
-
9298
- ```text
9299
- Document sharded successfully:
9300
- - Source: [original document path]
9301
- - Destination: docs/[folder-name]/
9302
- - Files created: [count]
9303
- - Sections:
9304
- - section-name-1.md: "Section Title 1"
9305
- - section-name-2.md: "Section Title 2"
9306
- ...
9307
- ```
9308
-
9309
- ## Important Notes
9310
-
9311
- - Never modify the actual content, only adjust heading levels
9312
- - Preserve ALL formatting, including whitespace where significant
9313
- - Handle edge cases like sections with code blocks containing ## symbols
9314
- - Ensure the sharding is reversible (could reconstruct the original from shards)
9315
- ==================== END: .xiaoma-core/tasks/shard-doc.md ====================
9316
-
9317
9372
  ==================== START: .xiaoma-core/templates/brownfield-prd-tmpl.yaml ====================
9318
9373
  template:
9319
9374
  id: brownfield-prd-template-v2
@@ -1242,6 +1242,7 @@ commands:
1242
1242
  - execute-checklist {checklist}: 运行任务 execute-checklist (默认为->architect-checklist)
1243
1243
  - research {topic}: 执行任务 create-deep-research-prompt
1244
1244
  - shard-prd: 为提供的 architecture.md 运行任务 shard-doc.md (如果未找到则询问)
1245
+ - shard-doc: 执行任务 shard-doc.md 切分大型文档到多个小文档
1245
1246
  - yolo: 切换 Yolo 模式
1246
1247
  - exit: 作为架构师道别,然后放弃扮演此角色
1247
1248
  dependencies:
@@ -1254,6 +1255,7 @@ dependencies:
1254
1255
  - create-doc.md
1255
1256
  - document-project.md
1256
1257
  - execute-checklist.md
1258
+ - shard-doc.md
1257
1259
  templates:
1258
1260
  - architecture-tmpl.yaml
1259
1261
  - brownfield-architecture-tmpl.yaml
@@ -413,6 +413,7 @@ commands:
413
413
  - execute-checklist {checklist}: 运行任务 execute-checklist (默认为->architect-checklist)
414
414
  - research {topic}: 执行任务 create-deep-research-prompt
415
415
  - shard-prd: 为提供的 architecture.md 运行任务 shard-doc.md (如果未找到则询问)
416
+ - shard-doc: 执行任务 shard-doc.md 切分大型文档到多个小文档
416
417
  - yolo: 切换 Yolo 模式
417
418
  - exit: 作为架构师道别,然后放弃扮演此角色
418
419
  dependencies:
@@ -425,6 +426,7 @@ dependencies:
425
426
  - create-doc.md
426
427
  - document-project.md
427
428
  - execute-checklist.md
429
+ - shard-doc.md
428
430
  templates:
429
431
  - architecture-tmpl.yaml
430
432
  - brownfield-architecture-tmpl.yaml
@@ -359,6 +359,7 @@ commands:
359
359
  - execute-checklist {checklist}: 运行任务 execute-checklist (默认为->architect-checklist)
360
360
  - research {topic}: 执行任务 create-deep-research-prompt
361
361
  - shard-prd: 为提供的 architecture.md 运行任务 shard-doc.md (如果未找到则询问)
362
+ - shard-doc: 执行任务 shard-doc.md 切分大型文档到多个小文档
362
363
  - yolo: 切换 Yolo 模式
363
364
  - exit: 作为架构师道别,然后放弃扮演此角色
364
365
  dependencies:
@@ -371,6 +372,7 @@ dependencies:
371
372
  - create-doc.md
372
373
  - document-project.md
373
374
  - execute-checklist.md
375
+ - shard-doc.md
374
376
  templates:
375
377
  - architecture-tmpl.yaml
376
378
  - brownfield-architecture-tmpl.yaml