@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.
- package/.idea/workspace.xml +1 -0
- package/.xiaoma-core/.coordinator-state.json +19 -0
- package/dist/agents/architect.txt +192 -0
- package/dist/agents/workflow-helper.txt +93 -0
- package/dist/teams/team-all.txt +245 -190
- package/dist/teams/team-fullstack-with-database.txt +2 -0
- package/dist/teams/team-fullstack.txt +2 -0
- package/dist/teams/team-no-ui.txt +2 -0
- package/docs/architecture/workflow-coordinator-implementation.md +1188 -0
- package/docs/prd/workflow-coordinator-prd.md +1214 -0
- package/package.json +1 -1
- package/tools/installer/package.json +1 -1
- package/tools/workflow-coordinator/README.md +38 -0
- package/tools/workflow-coordinator/USAGE.md +548 -0
- package/tools/workflow-coordinator/package-lock.json +4868 -0
- package/tools/workflow-coordinator/package.json +35 -0
- package/tools/workflow-coordinator/src/api/server.js +207 -0
- package/tools/workflow-coordinator/src/controller/workflow-controller.js +263 -0
- package/tools/workflow-coordinator/src/index.js +113 -0
- package/tools/workflow-coordinator/src/parser/workflow-parser.js +144 -0
- package/tools/workflow-coordinator/src/utils/state-manager.js +59 -0
- package/tools/workflow-coordinator/src/utils/validator.js +86 -0
- package/tools/workflow-coordinator/test/integration-test.js +266 -0
- package/tools/workflow-coordinator/test/quick-test.js +127 -0
- package/xiaoma-core/agents/architect.md +2 -0
- package/xiaoma-core/agents/workflow-helper.md +481 -0
- package/xiaoma-core/workflows/automated-requirements-analysis.yaml +11 -8
package/.idea/workspace.xml
CHANGED
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
<workItem from="1762494963355" duration="2769000" />
|
|
68
68
|
<workItem from="1762781553645" duration="3390000" />
|
|
69
69
|
<workItem from="1762933631198" duration="16000" />
|
|
70
|
+
<workItem from="1763045898895" duration="851000" />
|
|
70
71
|
</task>
|
|
71
72
|
<task id="LOCAL-00001" summary="drop unchecked message">
|
|
72
73
|
<option name="closed" value="true" />
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"workflowId": "test-1763048289115",
|
|
3
|
+
"workflowName": "自动化需求分析和架构设计流程",
|
|
4
|
+
"status": "in_progress",
|
|
5
|
+
"startTime": "2025-11-13T15:38:09.121Z",
|
|
6
|
+
"currentStepIndex": 1,
|
|
7
|
+
"completedSteps": [
|
|
8
|
+
{
|
|
9
|
+
"stepId": "pre_workflow_validation",
|
|
10
|
+
"status": "completed",
|
|
11
|
+
"outputs": [],
|
|
12
|
+
"duration": 5000,
|
|
13
|
+
"completedAt": "2025-11-13T15:38:09.126Z"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"context": {},
|
|
17
|
+
"errors": [],
|
|
18
|
+
"retries": {}
|
|
19
|
+
}
|
|
@@ -84,6 +84,7 @@ commands:
|
|
|
84
84
|
- execute-checklist {checklist}: 运行任务 execute-checklist (默认为->architect-checklist)
|
|
85
85
|
- research {topic}: 执行任务 create-deep-research-prompt
|
|
86
86
|
- shard-prd: 为提供的 architecture.md 运行任务 shard-doc.md (如果未找到则询问)
|
|
87
|
+
- shard-doc: 执行任务 shard-doc.md 切分大型文档到多个小文档
|
|
87
88
|
- yolo: 切换 Yolo 模式
|
|
88
89
|
- exit: 作为架构师道别,然后放弃扮演此角色
|
|
89
90
|
dependencies:
|
|
@@ -96,6 +97,7 @@ dependencies:
|
|
|
96
97
|
- create-doc.md
|
|
97
98
|
- document-project.md
|
|
98
99
|
- execute-checklist.md
|
|
100
|
+
- shard-doc.md
|
|
99
101
|
templates:
|
|
100
102
|
- architecture-tmpl.yaml
|
|
101
103
|
- brownfield-architecture-tmpl.yaml
|
|
@@ -932,6 +934,196 @@ The LLM will:
|
|
|
932
934
|
- Offer to provide detailed analysis of any section, especially those with warnings or failures
|
|
933
935
|
==================== END: .xiaoma-core/tasks/execute-checklist.md ====================
|
|
934
936
|
|
|
937
|
+
==================== START: .xiaoma-core/tasks/shard-doc.md ====================
|
|
938
|
+
<!-- Powered by XiaoMa™ Core -->
|
|
939
|
+
|
|
940
|
+
# Document Sharding Task
|
|
941
|
+
|
|
942
|
+
## Purpose
|
|
943
|
+
|
|
944
|
+
- Split a large document into multiple smaller documents based on level 2 sections
|
|
945
|
+
- Create a folder structure to organize the sharded documents
|
|
946
|
+
- Maintain all content integrity including code blocks, diagrams, and markdown formatting
|
|
947
|
+
|
|
948
|
+
## Primary Method: Automatic with markdown-tree
|
|
949
|
+
|
|
950
|
+
[[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}`.
|
|
951
|
+
|
|
952
|
+
If the command succeeds, inform the user that the document has been sharded successfully and STOP - do not proceed further.
|
|
953
|
+
|
|
954
|
+
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:
|
|
955
|
+
|
|
956
|
+
1. Install @kayvan/markdown-tree-parser globally with: `npm install -g @kayvan/markdown-tree-parser`
|
|
957
|
+
2. Or set markdownExploder to false in .xiaoma-core/core-config.yaml
|
|
958
|
+
|
|
959
|
+
**IMPORTANT: STOP HERE - do not proceed with manual sharding until one of the above actions is taken.**"
|
|
960
|
+
|
|
961
|
+
If markdownExploder is set to false, inform the user: "The markdownExploder setting is currently false. For better performance and reliability, you should:
|
|
962
|
+
|
|
963
|
+
1. Set markdownExploder to true in .xiaoma-core/core-config.yaml
|
|
964
|
+
2. Install @kayvan/markdown-tree-parser globally with: `npm install -g @kayvan/markdown-tree-parser`
|
|
965
|
+
|
|
966
|
+
I will now proceed with the manual sharding process."
|
|
967
|
+
|
|
968
|
+
Then proceed with the manual method below ONLY if markdownExploder is false.]]
|
|
969
|
+
|
|
970
|
+
### Installation and Usage
|
|
971
|
+
|
|
972
|
+
1. **Install globally**:
|
|
973
|
+
|
|
974
|
+
```bash
|
|
975
|
+
npm install -g @kayvan/markdown-tree-parser
|
|
976
|
+
```
|
|
977
|
+
|
|
978
|
+
2. **Use the explode command**:
|
|
979
|
+
|
|
980
|
+
```bash
|
|
981
|
+
# For PRD
|
|
982
|
+
md-tree explode docs/prd.md docs/prd
|
|
983
|
+
|
|
984
|
+
# For Architecture
|
|
985
|
+
md-tree explode docs/architecture.md docs/architecture
|
|
986
|
+
|
|
987
|
+
# For any document
|
|
988
|
+
md-tree explode [source-document] [destination-folder]
|
|
989
|
+
```
|
|
990
|
+
|
|
991
|
+
3. **What it does**:
|
|
992
|
+
- Automatically splits the document by level 2 sections
|
|
993
|
+
- Creates properly named files
|
|
994
|
+
- Adjusts heading levels appropriately
|
|
995
|
+
- Handles all edge cases with code blocks and special markdown
|
|
996
|
+
|
|
997
|
+
If the user has @kayvan/markdown-tree-parser installed, use it and skip the manual process below.
|
|
998
|
+
|
|
999
|
+
---
|
|
1000
|
+
|
|
1001
|
+
## Manual Method (if @kayvan/markdown-tree-parser is not available or user indicated manual method)
|
|
1002
|
+
|
|
1003
|
+
### Task Instructions
|
|
1004
|
+
|
|
1005
|
+
1. Identify Document and Target Location
|
|
1006
|
+
|
|
1007
|
+
- Determine which document to shard (user-provided path)
|
|
1008
|
+
- Create a new folder under `docs/` with the same name as the document (without extension)
|
|
1009
|
+
- Example: `docs/prd.md` → create folder `docs/prd/`
|
|
1010
|
+
|
|
1011
|
+
2. Parse and Extract Sections
|
|
1012
|
+
|
|
1013
|
+
CRITICAL AEGNT SHARDING RULES:
|
|
1014
|
+
|
|
1015
|
+
1. Read the entire document content
|
|
1016
|
+
2. Identify all level 2 sections (## headings)
|
|
1017
|
+
3. For each level 2 section:
|
|
1018
|
+
- Extract the section heading and ALL content until the next level 2 section
|
|
1019
|
+
- Include all subsections, code blocks, diagrams, lists, tables, etc.
|
|
1020
|
+
- Be extremely careful with:
|
|
1021
|
+
- 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
|
|
1022
|
+
- Mermaid diagrams - preserve the complete diagram syntax
|
|
1023
|
+
- Nested markdown elements
|
|
1024
|
+
- Multi-line content that might contain ## inside code blocks
|
|
1025
|
+
|
|
1026
|
+
CRITICAL: Use proper parsing that understands markdown context. A ## inside a code block is NOT a section header.]]
|
|
1027
|
+
|
|
1028
|
+
### 3. Create Individual Files
|
|
1029
|
+
|
|
1030
|
+
For each extracted section:
|
|
1031
|
+
|
|
1032
|
+
1. **Generate filename**: Convert the section heading to lowercase-dash-case
|
|
1033
|
+
- Remove special characters
|
|
1034
|
+
- Replace spaces with dashes
|
|
1035
|
+
- Example: "## Tech Stack" → `tech-stack.md`
|
|
1036
|
+
|
|
1037
|
+
2. **Adjust heading levels**:
|
|
1038
|
+
- The level 2 heading becomes level 1 (# instead of ##) in the sharded new document
|
|
1039
|
+
- All subsection levels decrease by 1:
|
|
1040
|
+
|
|
1041
|
+
```txt
|
|
1042
|
+
- ### → ##
|
|
1043
|
+
- #### → ###
|
|
1044
|
+
- ##### → ####
|
|
1045
|
+
- etc.
|
|
1046
|
+
```
|
|
1047
|
+
|
|
1048
|
+
3. **Write content**: Save the adjusted content to the new file
|
|
1049
|
+
|
|
1050
|
+
### 4. Create Index File
|
|
1051
|
+
|
|
1052
|
+
Create an `index.md` file in the sharded folder that:
|
|
1053
|
+
|
|
1054
|
+
1. Contains the original level 1 heading and any content before the first level 2 section
|
|
1055
|
+
2. Lists all the sharded files with links:
|
|
1056
|
+
|
|
1057
|
+
```markdown
|
|
1058
|
+
# Original Document Title
|
|
1059
|
+
|
|
1060
|
+
[Original introduction content if any]
|
|
1061
|
+
|
|
1062
|
+
## Sections
|
|
1063
|
+
|
|
1064
|
+
- [Section Name 1](./section-name-1.md)
|
|
1065
|
+
- [Section Name 2](./section-name-2.md)
|
|
1066
|
+
- [Section Name 3](./section-name-3.md)
|
|
1067
|
+
...
|
|
1068
|
+
```
|
|
1069
|
+
|
|
1070
|
+
### 5. Preserve Special Content
|
|
1071
|
+
|
|
1072
|
+
1. **Code blocks**: Must capture complete blocks including:
|
|
1073
|
+
|
|
1074
|
+
```language
|
|
1075
|
+
content
|
|
1076
|
+
```
|
|
1077
|
+
|
|
1078
|
+
2. **Mermaid diagrams**: Preserve complete syntax:
|
|
1079
|
+
|
|
1080
|
+
```mermaid
|
|
1081
|
+
graph TD
|
|
1082
|
+
...
|
|
1083
|
+
```
|
|
1084
|
+
|
|
1085
|
+
3. **Tables**: Maintain proper markdown table formatting
|
|
1086
|
+
|
|
1087
|
+
4. **Lists**: Preserve indentation and nesting
|
|
1088
|
+
|
|
1089
|
+
5. **Inline code**: Preserve backticks
|
|
1090
|
+
|
|
1091
|
+
6. **Links and references**: Keep all markdown links intact
|
|
1092
|
+
|
|
1093
|
+
7. **Template markup**: If documents contain {{placeholders}} ,preserve exactly
|
|
1094
|
+
|
|
1095
|
+
### 6. Validation
|
|
1096
|
+
|
|
1097
|
+
After sharding:
|
|
1098
|
+
|
|
1099
|
+
1. Verify all sections were extracted
|
|
1100
|
+
2. Check that no content was lost
|
|
1101
|
+
3. Ensure heading levels were properly adjusted
|
|
1102
|
+
4. Confirm all files were created successfully
|
|
1103
|
+
|
|
1104
|
+
### 7. Report Results
|
|
1105
|
+
|
|
1106
|
+
Provide a summary:
|
|
1107
|
+
|
|
1108
|
+
```text
|
|
1109
|
+
Document sharded successfully:
|
|
1110
|
+
- Source: [original document path]
|
|
1111
|
+
- Destination: docs/[folder-name]/
|
|
1112
|
+
- Files created: [count]
|
|
1113
|
+
- Sections:
|
|
1114
|
+
- section-name-1.md: "Section Title 1"
|
|
1115
|
+
- section-name-2.md: "Section Title 2"
|
|
1116
|
+
...
|
|
1117
|
+
```
|
|
1118
|
+
|
|
1119
|
+
## Important Notes
|
|
1120
|
+
|
|
1121
|
+
- Never modify the actual content, only adjust heading levels
|
|
1122
|
+
- Preserve ALL formatting, including whitespace where significant
|
|
1123
|
+
- Handle edge cases like sections with code blocks containing ## symbols
|
|
1124
|
+
- Ensure the sharding is reversible (could reconstruct the original from shards)
|
|
1125
|
+
==================== END: .xiaoma-core/tasks/shard-doc.md ====================
|
|
1126
|
+
|
|
935
1127
|
==================== START: .xiaoma-core/templates/architecture-tmpl.yaml ====================
|
|
936
1128
|
template:
|
|
937
1129
|
id: architecture-template-v2
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Web Agent Bundle Instructions
|
|
2
|
+
|
|
3
|
+
You are now operating as a specialized AI agent from the XiaoMa-Cli framework. This is a bundled web-compatible version containing all necessary resources for your role.
|
|
4
|
+
|
|
5
|
+
## Important Instructions
|
|
6
|
+
|
|
7
|
+
1. **Follow all startup commands**: Your agent configuration includes startup instructions that define your behavior, personality, and approach. These MUST be followed exactly.
|
|
8
|
+
|
|
9
|
+
2. **Resource Navigation**: This bundle contains all resources you need. Resources are marked with tags like:
|
|
10
|
+
|
|
11
|
+
- `==================== START: .xiaoma-core/folder/filename.md ====================`
|
|
12
|
+
- `==================== END: .xiaoma-core/folder/filename.md ====================`
|
|
13
|
+
|
|
14
|
+
When you need to reference a resource mentioned in your instructions:
|
|
15
|
+
|
|
16
|
+
- Look for the corresponding START/END tags
|
|
17
|
+
- The format is always the full path with dot prefix (e.g., `.xiaoma-core/personas/analyst.md`, `.xiaoma-core/tasks/create-story.md`)
|
|
18
|
+
- If a section is specified (e.g., `{root}/tasks/create-story.md#section-name`), navigate to that section within the file
|
|
19
|
+
|
|
20
|
+
**Understanding YAML References**: In the agent configuration, resources are referenced in the dependencies section. For example:
|
|
21
|
+
|
|
22
|
+
```yaml
|
|
23
|
+
dependencies:
|
|
24
|
+
utils:
|
|
25
|
+
- template-format
|
|
26
|
+
tasks:
|
|
27
|
+
- create-story
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
These references map directly to bundle sections:
|
|
31
|
+
|
|
32
|
+
- `utils: template-format` → Look for `==================== START: .xiaoma-core/utils/template-format.md ====================`
|
|
33
|
+
- `tasks: create-story` → Look for `==================== START: .xiaoma-core/tasks/create-story.md ====================`
|
|
34
|
+
|
|
35
|
+
3. **Execution Context**: You are operating in a web environment. All your capabilities and knowledge are contained within this bundle. Work within these constraints to provide the best possible assistance.
|
|
36
|
+
|
|
37
|
+
4. **Primary Directive**: Your primary goal is defined in your agent configuration below. Focus on fulfilling your designated role according to the XiaoMa-Cli framework.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
==================== START: .xiaoma-core/agents/workflow-helper.md ====================
|
|
43
|
+
# agent
|
|
44
|
+
|
|
45
|
+
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:
|
|
46
|
+
|
|
47
|
+
```yaml
|
|
48
|
+
on_failure:
|
|
49
|
+
max_retries: 3
|
|
50
|
+
escalation: 请检查架构模板完整性
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## 调试
|
|
54
|
+
|
|
55
|
+
### 启用详细日志
|
|
56
|
+
|
|
57
|
+
在协调器启动时查看详细日志:
|
|
58
|
+
```bash
|
|
59
|
+
DEBUG=* node src/index.js start automated-requirements-analysis
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 查看状态文件
|
|
63
|
+
|
|
64
|
+
工作流状态保存在:`.xiaoma-core/.coordinator-state.json`
|
|
65
|
+
|
|
66
|
+
查看:
|
|
67
|
+
```bash
|
|
68
|
+
cat .xiaoma-core/.coordinator-state.json
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## 使用提示
|
|
72
|
+
|
|
73
|
+
1. **先启动协调器**:在Claude Code中启动工作流前,确保协调器已运行
|
|
74
|
+
2. **保持终端开启**:协调器需要持续运行,不要关闭终端
|
|
75
|
+
3. **监控日志**:协调器日志会显示详细的执行进度和问题
|
|
76
|
+
4. **状态恢复**:如果中断,状态文件允许从中断点恢复
|
|
77
|
+
5. **工作流定义**:所有工作流定义在`xiaoma-core/workflows/`目录
|
|
78
|
+
|
|
79
|
+
## 与workflow-executor的区别
|
|
80
|
+
|
|
81
|
+
**workflow-executor**(旧方案):
|
|
82
|
+
- 完全由AI驱动,基于AI判断决定下一步
|
|
83
|
+
- 会在关键点暂停询问用户
|
|
84
|
+
- 无法完全自动化
|
|
85
|
+
|
|
86
|
+
**workflow-helper + Coordinator**(新方案):
|
|
87
|
+
- 程序化流程控制,消除AI决策延迟
|
|
88
|
+
- 完全自动执行,无需人工确认
|
|
89
|
+
- 状态持久化,支持恢复
|
|
90
|
+
- 质量门控,自动验证输出
|
|
91
|
+
|
|
92
|
+
workflow-helper专注于"执行层",协调器负责"控制层",实现关注点分离和更可靠的自动化。
|
|
93
|
+
==================== END: .xiaoma-core/agents/workflow-helper.md ====================
|