6aspec 2.0.0-dev.10
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/.6aspec/rules/biz/api_rule.md +578 -0
- package/.6aspec/rules/biz/background_job_rule.md +719 -0
- package/.6aspec/rules/biz/c_user_system_rule.md +240 -0
- package/.6aspec/rules/biz/code.md +39 -0
- package/.6aspec/rules/biz/event_subscriber_rule.md +529 -0
- package/.6aspec/rules/biz/project-structure.md +90 -0
- package/.6aspec/rules/biz/scheduled_job_rule.md +850 -0
- package/.6aspec/rules/brown/brown_archive_sop.md +132 -0
- package/.6aspec/rules/brown/brown_constitution.md +20 -0
- package/.6aspec/rules/brown/brown_continue_sop.md +97 -0
- package/.6aspec/rules/brown/brown_design_sop.md +155 -0
- package/.6aspec/rules/brown/brown_ff_sop.md +194 -0
- package/.6aspec/rules/brown/brown_impact_sop.md +293 -0
- package/.6aspec/rules/brown/brown_implement_sop.md +133 -0
- package/.6aspec/rules/brown/brown_list_sop.md +69 -0
- package/.6aspec/rules/brown/brown_new_sop.md +257 -0
- package/.6aspec/rules/brown/brown_proposal_sop.md +160 -0
- package/.6aspec/rules/brown/brown_quick_sop.md +134 -0
- package/.6aspec/rules/brown/brown_review_sop.md +270 -0
- package/.6aspec/rules/brown/brown_rollback_sop.md +188 -0
- package/.6aspec/rules/brown/brown_specs_sop.md +228 -0
- package/.6aspec/rules/brown/brown_status_sop.md +135 -0
- package/.6aspec/rules/brown/brown_tasks_sop.md +202 -0
- package/.6aspec/rules/brown/brown_understand_sop.md +208 -0
- package/.6aspec/rules/brown/brown_verify_sop.md +360 -0
- package/.6aspec/rules/green/6A_archive_sop.md +301 -0
- package/.6aspec/rules/green/6A_clarify_sop.md +238 -0
- package/.6aspec/rules/green/6A_code_implementation_sop.md +110 -0
- package/.6aspec/rules/green/6A_constitution.md +52 -0
- package/.6aspec/rules/green/6A_continue_sop.md +186 -0
- package/.6aspec/rules/green/6A_design_sop.md +228 -0
- package/.6aspec/rules/green/6A_import_model_table_sop.md +120 -0
- package/.6aspec/rules/green/6A_init_event_list_sop.md +62 -0
- package/.6aspec/rules/green/6A_init_map_sop.md +79 -0
- package/.6aspec/rules/green/6A_model_sop.md +210 -0
- package/.6aspec/rules/green/6A_new_sop.md +319 -0
- package/.6aspec/rules/green/6A_rollback_sop.md +198 -0
- package/.6aspec/rules/green/6A_status_sop.md +275 -0
- package/.6aspec/rules/green/6A_tasks_sop.md +181 -0
- package/.6aspec/rules/green/6A_visual_logic_sop.md +121 -0
- package/.6aspec/rules/green/green_status_schema.md +293 -0
- package/.6aspec/script/create_entities_from_markdown.py +688 -0
- package/.claude/commands/6aspec/brown/archive.md +11 -0
- package/.claude/commands/6aspec/brown/continue.md +11 -0
- package/.claude/commands/6aspec/brown/design.md +11 -0
- package/.claude/commands/6aspec/brown/ff.md +11 -0
- package/.claude/commands/6aspec/brown/impact.md +11 -0
- package/.claude/commands/6aspec/brown/implement.md +11 -0
- package/.claude/commands/6aspec/brown/list.md +11 -0
- package/.claude/commands/6aspec/brown/new.md +11 -0
- package/.claude/commands/6aspec/brown/proposal.md +11 -0
- package/.claude/commands/6aspec/brown/quick.md +11 -0
- package/.claude/commands/6aspec/brown/review.md +11 -0
- package/.claude/commands/6aspec/brown/rollback.md +11 -0
- package/.claude/commands/6aspec/brown/specs.md +11 -0
- package/.claude/commands/6aspec/brown/status.md +11 -0
- package/.claude/commands/6aspec/brown/tasks.md +11 -0
- package/.claude/commands/6aspec/brown/understand.md +11 -0
- package/.claude/commands/6aspec/brown/verify.md +11 -0
- package/.claude/commands/6aspec/green/archive.md +8 -0
- package/.claude/commands/6aspec/green/clarify.md +13 -0
- package/.claude/commands/6aspec/green/continue.md +8 -0
- package/.claude/commands/6aspec/green/design.md +8 -0
- package/.claude/commands/6aspec/green/execute-task.md +20 -0
- package/.claude/commands/6aspec/green/import-model-table.md +8 -0
- package/.claude/commands/6aspec/green/init.md +14 -0
- package/.claude/commands/6aspec/green/model.md +12 -0
- package/.claude/commands/6aspec/green/new.md +13 -0
- package/.claude/commands/6aspec/green/rollback.md +8 -0
- package/.claude/commands/6aspec/green/status.md +8 -0
- package/.claude/commands/6aspec/green/tasks.md +8 -0
- package/.claude/commands/6aspec/green/visual-logic.md +9 -0
- package/.claude/settings.local.json +8 -0
- package/.cursor/commands/6aspec/brown/archive.md +9 -0
- package/.cursor/commands/6aspec/brown/continue.md +9 -0
- package/.cursor/commands/6aspec/brown/design.md +9 -0
- package/.cursor/commands/6aspec/brown/ff.md +9 -0
- package/.cursor/commands/6aspec/brown/impact.md +9 -0
- package/.cursor/commands/6aspec/brown/implement.md +9 -0
- package/.cursor/commands/6aspec/brown/list.md +9 -0
- package/.cursor/commands/6aspec/brown/new.md +9 -0
- package/.cursor/commands/6aspec/brown/proposal.md +9 -0
- package/.cursor/commands/6aspec/brown/quick.md +9 -0
- package/.cursor/commands/6aspec/brown/review.md +9 -0
- package/.cursor/commands/6aspec/brown/rollback.md +9 -0
- package/.cursor/commands/6aspec/brown/specs.md +9 -0
- package/.cursor/commands/6aspec/brown/status.md +9 -0
- package/.cursor/commands/6aspec/brown/tasks.md +9 -0
- package/.cursor/commands/6aspec/brown/understand.md +9 -0
- package/.cursor/commands/6aspec/brown/verify.md +9 -0
- package/.cursor/commands/6aspec/green/archive.md +9 -0
- package/.cursor/commands/6aspec/green/clarify.md +14 -0
- package/.cursor/commands/6aspec/green/continue.md +9 -0
- package/.cursor/commands/6aspec/green/design.md +9 -0
- package/.cursor/commands/6aspec/green/execute-task.md +21 -0
- package/.cursor/commands/6aspec/green/import-model-table.md +9 -0
- package/.cursor/commands/6aspec/green/init.md +15 -0
- package/.cursor/commands/6aspec/green/model.md +13 -0
- package/.cursor/commands/6aspec/green/new.md +14 -0
- package/.cursor/commands/6aspec/green/rollback.md +9 -0
- package/.cursor/commands/6aspec/green/status.md +9 -0
- package/.cursor/commands/6aspec/green/tasks.md +9 -0
- package/.cursor/commands/6aspec/green/visual-logic.md +10 -0
- package/README.en.md +36 -0
- package/README.md +146 -0
- package/bin/6a-spec-install +54 -0
- package/bin/6aspec +64 -0
- package/lib/cli.js +451 -0
- package/lib/installer.js +333 -0
- package/package.json +62 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# rollback: 流程回退标准操作流程 (Rollback SOP)
|
|
2
|
+
|
|
3
|
+
## 目标
|
|
4
|
+
将当前需求回退**一个阶段**,并删除该阶段生成的工件,以便重新执行上一阶段或修正后重做本阶段。仅允许单步回退,且**必须获得用户明确确认后**才执行删除与状态更新。
|
|
5
|
+
|
|
6
|
+
## 规则
|
|
7
|
+
1. **单步回退**:每次只能回退一个阶段,不允许跨多阶段回退
|
|
8
|
+
2. **先提示后执行**:必须先列出将删除的文件并提示用户,**只有在用户给出明确确认指令后**才允许执行删除和状态更新
|
|
9
|
+
3. **禁止从实现阶段回退**:状态为 `implementing`、`completed`、`archived` 时不允许回退;`created` 无上一阶段,也不允许
|
|
10
|
+
|
|
11
|
+
## 允许回退的状态与目标
|
|
12
|
+
|
|
13
|
+
| 当前状态 | 回退后状态 | 将删除的工件 |
|
|
14
|
+
|----------|------------|--------------|
|
|
15
|
+
| `requirement_clarified` | `created` | `6aspecdoc/green/<feature-name>/requirement.md` |
|
|
16
|
+
| `modeled` | `requirement_clarified` | `6aspecdoc/green/<feature-name>/artifacts/domain-model.md` |
|
|
17
|
+
| `designed` | `modeled` | `6aspecdoc/green/<feature-name>/artifacts/tech-design.md`、`api-definition.md`;若存在则一并删除 `artifacts/visual-logic.md` |
|
|
18
|
+
| `tasks_created` | `designed` | `6aspecdoc/green/<feature-name>/tasks/` 目录下全部文件(含 `README.md` 及所有 `task-*.md`) |
|
|
19
|
+
|
|
20
|
+
## 执行步骤
|
|
21
|
+
|
|
22
|
+
### Step 1: 确定需求并读取状态
|
|
23
|
+
|
|
24
|
+
1. **确定当前需求**:根据当前工作目录或用户 @ 的文件,确定 `6aspecdoc/green/<feature-name>/`;若有多个需求则让用户选择。
|
|
25
|
+
2. **读取状态文件**:读取 `6aspecdoc/green/<feature-name>/.green-status.json`。若文件不存在,停止并提示先运行 `/6aspec:green:new`。
|
|
26
|
+
3. **阶段门禁**:检查 `status`:
|
|
27
|
+
- **允许回退**:仅当 `status` 为 `requirement_clarified`、`modeled`、`designed`、`tasks_created` 之一时继续。
|
|
28
|
+
- **拒绝回退**:若为 `created`、`implementing`、`completed`、`archived`,则停止并输出:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
❌ 不允许执行回退 (rollback)
|
|
32
|
+
|
|
33
|
+
当前状态:<status>
|
|
34
|
+
|
|
35
|
+
允许回退的阶段:仅限 requirement_clarified、modeled、designed、tasks_created。
|
|
36
|
+
created(无上一阶段)、implementing(已进入代码实现)、completed、archived 不允许回退。
|
|
37
|
+
|
|
38
|
+
若已进入实现阶段且需求有变更,建议通过修改需求/设计文档并补充任务处理,或新建需求。
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Step 2: 列出回退影响并请求用户明确确认
|
|
42
|
+
|
|
43
|
+
根据当前状态,输出**回退影响说明**,并**禁止在未得到用户明确确认前执行任何删除或写状态文件操作**。
|
|
44
|
+
|
|
45
|
+
输出格式(必须包含以下内容):
|
|
46
|
+
|
|
47
|
+
```markdown
|
|
48
|
+
## 回退影响说明
|
|
49
|
+
|
|
50
|
+
- **当前状态**:<current-status>
|
|
51
|
+
- **回退后状态**:<target-status>
|
|
52
|
+
- **回退后下一步**:需重新执行 <command>(<描述>)
|
|
53
|
+
|
|
54
|
+
### 即将删除的文件(执行回退后将不可恢复)
|
|
55
|
+
|
|
56
|
+
<按下面表格根据当前状态填写>
|
|
57
|
+
|
|
58
|
+
| 路径 | 说明 |
|
|
59
|
+
|------|------|
|
|
60
|
+
| <path1> | <说明> |
|
|
61
|
+
| <path2> | <说明> |
|
|
62
|
+
|
|
63
|
+
### 状态文件更新
|
|
64
|
+
|
|
65
|
+
- `.green-status.json` 中 `status` 将更新为 `<target-status>`
|
|
66
|
+
- 当前阶段对应工件的 `status` 将置为 pending/blocked
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
⚠️ **请确认后再执行回退**
|
|
71
|
+
|
|
72
|
+
回退将**永久删除**上述文件,且不可通过本命令恢复。
|
|
73
|
+
|
|
74
|
+
请明确回复以下之一后,我才会执行删除与状态更新:
|
|
75
|
+
- **「确认回退」**
|
|
76
|
+
- **「执行回退」**
|
|
77
|
+
|
|
78
|
+
若不需要回退,请直接说明取消。
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**根据当前状态填写的删除清单:**
|
|
82
|
+
|
|
83
|
+
- **requirement_clarified → created**
|
|
84
|
+
| 路径 | 说明 |
|
|
85
|
+
|------|------|
|
|
86
|
+
| `6aspecdoc/green/<feature-name>/requirement.md` | 需求澄清文档 |
|
|
87
|
+
|
|
88
|
+
- **modeled → requirement_clarified**
|
|
89
|
+
| 路径 | 说明 |
|
|
90
|
+
|------|------|
|
|
91
|
+
| `6aspecdoc/green/<feature-name>/artifacts/domain-model.md` | 领域模型文档 |
|
|
92
|
+
|
|
93
|
+
- **designed → modeled**
|
|
94
|
+
| 路径 | 说明 |
|
|
95
|
+
|------|------|
|
|
96
|
+
| `6aspecdoc/green/<feature-name>/artifacts/tech-design.md` | 技术设计文档 |
|
|
97
|
+
| `6aspecdoc/green/<feature-name>/artifacts/api-definition.md` | API 定义文档 |
|
|
98
|
+
| `6aspecdoc/green/<feature-name>/artifacts/visual-logic.md` | 可视化逻辑图(若存在) |
|
|
99
|
+
|
|
100
|
+
- **tasks_created → designed**
|
|
101
|
+
| 路径 | 说明 |
|
|
102
|
+
|------|------|
|
|
103
|
+
| `6aspecdoc/green/<feature-name>/tasks/` 下全部文件 | 任务列表及 README 等 |
|
|
104
|
+
|
|
105
|
+
### Step 3: 等待用户明确确认
|
|
106
|
+
|
|
107
|
+
- **仅当**用户回复中包含「确认回退」或「执行回退」的**明确意图**时,才继续执行 Step 4。
|
|
108
|
+
- 若用户回复取消、或仅表达犹豫(如「再想想」),则**不执行**回退,并回复已取消。
|
|
109
|
+
- 若用户未明确确认,则**不得**执行任何文件删除或状态文件写入。
|
|
110
|
+
|
|
111
|
+
### Step 4: 执行回退(仅在用户已明确确认后)
|
|
112
|
+
|
|
113
|
+
4.1 **删除工件文件**
|
|
114
|
+
按 Step 2 中列出的路径执行删除(若某路径不存在则跳过,不报错)。
|
|
115
|
+
|
|
116
|
+
4.2 **更新 `.green-status.json`**
|
|
117
|
+
按当前回退类型更新状态与工件状态(见下表),并更新 `lastModified`、`nextAction`。
|
|
118
|
+
|
|
119
|
+
**requirement_clarified → created**
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"status": "created",
|
|
124
|
+
"lastModified": "<ISO8601-now>",
|
|
125
|
+
"artifacts": {
|
|
126
|
+
"requirement": { "status": "pending", "path": "..." },
|
|
127
|
+
"models": { "status": "blocked", "path": "..." },
|
|
128
|
+
"design": { "status": "blocked", "path": "..." },
|
|
129
|
+
"tasks": { "status": "blocked", "path": "..." }
|
|
130
|
+
},
|
|
131
|
+
"nextAction": { "command": "new", "description": "完成需求澄清" }
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**modeled → requirement_clarified**
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"status": "requirement_clarified",
|
|
140
|
+
"lastModified": "<ISO8601-now>",
|
|
141
|
+
"artifacts": {
|
|
142
|
+
"models": { "status": "ready", "path": "..." },
|
|
143
|
+
"design": { "status": "blocked", "path": "..." },
|
|
144
|
+
"tasks": { "status": "blocked", "path": "..." }
|
|
145
|
+
},
|
|
146
|
+
"nextAction": { "command": "model", "description": "开始领域建模" }
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**designed → modeled**
|
|
151
|
+
|
|
152
|
+
```json
|
|
153
|
+
{
|
|
154
|
+
"status": "modeled",
|
|
155
|
+
"lastModified": "<ISO8601-now>",
|
|
156
|
+
"artifacts": {
|
|
157
|
+
"design": { "status": "blocked", "path": "..." },
|
|
158
|
+
"tasks": { "status": "blocked", "path": "..." }
|
|
159
|
+
},
|
|
160
|
+
"tasks": { "total": 0, "completed": 0, "remaining": 0 },
|
|
161
|
+
"nextAction": { "command": "design", "description": "开始技术方案设计" }
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**tasks_created → designed**
|
|
166
|
+
|
|
167
|
+
```json
|
|
168
|
+
{
|
|
169
|
+
"status": "designed",
|
|
170
|
+
"lastModified": "<ISO8601-now>",
|
|
171
|
+
"artifacts": {
|
|
172
|
+
"tasks": { "status": "blocked", "path": "..." }
|
|
173
|
+
},
|
|
174
|
+
"tasks": { "total": 0, "completed": 0, "remaining": 0 },
|
|
175
|
+
"nextAction": { "command": "tasks", "description": "开始任务拆解" }
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Step 5: 输出回退结果
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
✅ 回退已执行
|
|
183
|
+
|
|
184
|
+
需求:<feature-name>
|
|
185
|
+
回退前状态:<previous-status>
|
|
186
|
+
当前状态:<new-status>
|
|
187
|
+
已删除:<列出已删除的路径>
|
|
188
|
+
|
|
189
|
+
下一步:请运行 /6aspec:green:<command> 重新执行该阶段(或先修改需求/设计后再执行)。
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## 注意
|
|
193
|
+
- **严禁在未获得用户明确确认前**执行 Step 4 的删除或状态更新。
|
|
194
|
+
- 删除为永久操作,不提供撤销;用户确认前务必确保其理解将删除的内容。
|
|
195
|
+
- 仅支持单步回退;需回退多步时,请多次执行 rollback。
|
|
196
|
+
|
|
197
|
+
## 参考
|
|
198
|
+
- 状态定义:`.6aspec/rules/green/green_status_schema.md`
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
# 绿地需求状态查询 SOP
|
|
2
|
+
|
|
3
|
+
## 目标
|
|
4
|
+
|
|
5
|
+
查询并显示当前绿地需求的状态、工件完成情况、任务进度和下一步建议。
|
|
6
|
+
|
|
7
|
+
## 前置条件
|
|
8
|
+
|
|
9
|
+
- 已经通过 `/6aspec:green:new` 创建了需求目录
|
|
10
|
+
- 存在状态文件 `.green-status.json`
|
|
11
|
+
|
|
12
|
+
## 执行步骤
|
|
13
|
+
|
|
14
|
+
### Step 1: 检测当前需求
|
|
15
|
+
|
|
16
|
+
**1.1 检查是否在需求目录下**
|
|
17
|
+
|
|
18
|
+
检查当前工作目录是否在 `6aspecdoc/green/<feature-name>/` 下:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pwd
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
如果在需求目录下,自动识别需求名称(从路径中提取)。
|
|
25
|
+
|
|
26
|
+
**1.2 如果不在需求目录下,列出所有活跃需求**
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
find 6aspecdoc/green -maxdepth 2 -name ".green-status.json" -type f
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
如果找到多个需求,使用 **AskUserQuestion** 让用户选择要查看的需求。
|
|
33
|
+
|
|
34
|
+
如果没有找到任何需求,输出:
|
|
35
|
+
```
|
|
36
|
+
未找到任何绿地需求。
|
|
37
|
+
|
|
38
|
+
请先运行 /6aspec:green:new 创建一个新需求。
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Step 2: 读取状态文件
|
|
42
|
+
|
|
43
|
+
读取 `6aspecdoc/green/<feature-name>/.green-status.json` 文件:
|
|
44
|
+
|
|
45
|
+
```javascript
|
|
46
|
+
const statusPath = '6aspecdoc/green/<feature-name>/.green-status.json';
|
|
47
|
+
const status = JSON.parse(fs.readFileSync(statusPath, 'utf8'));
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
如果文件不存在或格式错误,输出错误信息并退出。
|
|
51
|
+
|
|
52
|
+
### Step 3: 解析状态信息
|
|
53
|
+
|
|
54
|
+
从状态文件中提取以下信息:
|
|
55
|
+
|
|
56
|
+
- `name`: 需求名称
|
|
57
|
+
- `status`: 当前生命周期状态
|
|
58
|
+
- `created`: 创建时间
|
|
59
|
+
- `lastModified`: 最后修改时间
|
|
60
|
+
- `artifacts`: 工件完成情况
|
|
61
|
+
- `tasks`: 任务进度
|
|
62
|
+
- `nextAction`: 下一步建议
|
|
63
|
+
|
|
64
|
+
### Step 4: 显示状态信息
|
|
65
|
+
|
|
66
|
+
按照以下格式输出状态信息:
|
|
67
|
+
|
|
68
|
+
```markdown
|
|
69
|
+
## 需求状态:<feature-name>
|
|
70
|
+
|
|
71
|
+
**当前阶段**:<status-display-name>
|
|
72
|
+
**创建时间**:<formatted-created-time>
|
|
73
|
+
**最后更新**:<formatted-modified-time>
|
|
74
|
+
|
|
75
|
+
### 工件完成情况
|
|
76
|
+
<artifact-status-list>
|
|
77
|
+
|
|
78
|
+
### 任务进度
|
|
79
|
+
<task-progress>
|
|
80
|
+
|
|
81
|
+
### 下一步建议
|
|
82
|
+
<next-action-suggestion>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
#### 4.1 状态显示名称映射
|
|
86
|
+
|
|
87
|
+
| 状态值 | 显示名称 |
|
|
88
|
+
|--------|---------|
|
|
89
|
+
| `created` | 已创建(等待需求澄清) |
|
|
90
|
+
| `requirement_clarified` | 需求已澄清 |
|
|
91
|
+
| `modeled` | 领域建模完成 |
|
|
92
|
+
| `designed` | 技术方案完成 |
|
|
93
|
+
| `tasks_created` | 任务已拆解 |
|
|
94
|
+
| `implementing` | 实施中 |
|
|
95
|
+
| `completed` | 已完成 |
|
|
96
|
+
| `archived` | 已归档 |
|
|
97
|
+
|
|
98
|
+
#### 4.2 工件状态显示
|
|
99
|
+
|
|
100
|
+
对于每个工件,根据其状态显示不同的图标和说明:
|
|
101
|
+
|
|
102
|
+
- `done`: ✓ <工件名称> (<文件路径>)
|
|
103
|
+
- `ready`: ⧗ <工件名称> (<文件路径>) - 准备就绪
|
|
104
|
+
- `pending`: ○ <工件名称> (<文件路径>) - 等待创建
|
|
105
|
+
- `blocked`: ⊗ <工件名称> (<文件路径>) - 等待依赖工件
|
|
106
|
+
|
|
107
|
+
工件名称映射:
|
|
108
|
+
- `requirement`: 需求澄清文档
|
|
109
|
+
- `models`: 领域模型
|
|
110
|
+
- `design`: 技术方案
|
|
111
|
+
- `tasks`: 任务列表
|
|
112
|
+
|
|
113
|
+
如果工件有 `files` 字段,显示文件数量:
|
|
114
|
+
```
|
|
115
|
+
✓ 领域模型 (artifacts/) - 3 个文件
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
#### 4.3 任务进度显示
|
|
119
|
+
|
|
120
|
+
根据任务状态显示:
|
|
121
|
+
|
|
122
|
+
- 如果 `tasks.total == 0`: "尚未拆解任务"
|
|
123
|
+
- 如果 `tasks.completed == tasks.total`: "✓ 所有任务已完成 (N/N)"
|
|
124
|
+
- 否则: "进行中:N/M 已完成,剩余 K 个任务"
|
|
125
|
+
|
|
126
|
+
如果有 `lastExecuted` 字段,显示:
|
|
127
|
+
```
|
|
128
|
+
最后执行:<task-file-name>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
#### 4.4 下一步建议
|
|
132
|
+
|
|
133
|
+
根据当前状态和 `nextAction` 字段显示建议:
|
|
134
|
+
|
|
135
|
+
如果有 `nextAction` 字段:
|
|
136
|
+
```
|
|
137
|
+
运行 /6aspec:green:<command> - <description>
|
|
138
|
+
或运行 /6aspec:green:continue 自动执行下一步
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
如果没有 `nextAction` 字段,根据状态推断:
|
|
142
|
+
|
|
143
|
+
| 状态 | 建议 |
|
|
144
|
+
|------|------|
|
|
145
|
+
| `created` | 运行 /6aspec:green:clarify 继续需求澄清,或运行 /6aspec:green:model 开始领域建模 |
|
|
146
|
+
| `requirement_clarified` | 运行 /6aspec:green:model 开始领域建模(可选:运行 /6aspec:green:clarify 继续深化需求) |
|
|
147
|
+
| `modeled` | 运行 /6aspec:green:design 开始技术方案设计 |
|
|
148
|
+
| `designed` | 运行 /6aspec:green:tasks 开始任务拆解 |
|
|
149
|
+
| `tasks_created` | 运行 /6aspec:green:execute-task 开始执行任务 |
|
|
150
|
+
| `implementing` | 运行 /6aspec:green:execute-task 继续执行任务 |
|
|
151
|
+
| `completed` | 运行 /6aspec:green:archive 归档需求 |
|
|
152
|
+
| `archived` | 需求已归档 |
|
|
153
|
+
|
|
154
|
+
### Step 5: 支持 JSON 输出(可选)
|
|
155
|
+
|
|
156
|
+
如果用户请求 JSON 格式输出(通过参数 `--json`),直接输出状态文件的内容:
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"name": "...",
|
|
161
|
+
"status": "...",
|
|
162
|
+
...
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## 输出示例
|
|
167
|
+
|
|
168
|
+
### 示例 1: 需求澄清完成后
|
|
169
|
+
|
|
170
|
+
```markdown
|
|
171
|
+
## 需求状态:user-authentication
|
|
172
|
+
|
|
173
|
+
**当前阶段**:需求已澄清
|
|
174
|
+
**创建时间**:2026-02-16 11:00
|
|
175
|
+
**最后更新**:2026-02-16 11:15
|
|
176
|
+
|
|
177
|
+
### 工件完成情况
|
|
178
|
+
✓ 需求澄清文档 (requirement.md)
|
|
179
|
+
⧗ 领域模型 (artifacts/) - 准备就绪
|
|
180
|
+
⊗ 技术方案 (artifacts/) - 等待领域模型
|
|
181
|
+
⊗ 任务列表 (tasks/) - 等待技术方案
|
|
182
|
+
|
|
183
|
+
### 任务进度
|
|
184
|
+
尚未拆解任务
|
|
185
|
+
|
|
186
|
+
### 下一步建议
|
|
187
|
+
运行 /6aspec:green:model 开始领域建模
|
|
188
|
+
或运行 /6aspec:green:continue 自动执行下一步
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### 示例 2: 实施中
|
|
192
|
+
|
|
193
|
+
```markdown
|
|
194
|
+
## 需求状态:user-authentication
|
|
195
|
+
|
|
196
|
+
**当前阶段**:实施中
|
|
197
|
+
**创建时间**:2026-02-16 11:00
|
|
198
|
+
**最后更新**:2026-02-16 15:30
|
|
199
|
+
|
|
200
|
+
### 工件完成情况
|
|
201
|
+
✓ 需求澄清文档 (requirement.md)
|
|
202
|
+
✓ 领域模型 (artifacts/) - 3 个文件
|
|
203
|
+
✓ 技术方案 (artifacts/)
|
|
204
|
+
✓ 任务列表 (tasks/) - 8 个任务
|
|
205
|
+
|
|
206
|
+
### 任务进度
|
|
207
|
+
进行中:5/8 已完成,剩余 3 个任务
|
|
208
|
+
最后执行:task_05_session_management.md
|
|
209
|
+
|
|
210
|
+
### 下一步建议
|
|
211
|
+
运行 /6aspec:green:execute-task 继续执行任务
|
|
212
|
+
或运行 /6aspec:green:continue 自动执行下一步
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### 示例 3: 已完成
|
|
216
|
+
|
|
217
|
+
```markdown
|
|
218
|
+
## 需求状态:user-authentication
|
|
219
|
+
|
|
220
|
+
**当前阶段**:已完成
|
|
221
|
+
**创建时间**:2026-02-16 11:00
|
|
222
|
+
**最后更新**:2026-02-16 18:45
|
|
223
|
+
|
|
224
|
+
### 工件完成情况
|
|
225
|
+
✓ 需求澄清文档 (requirement.md)
|
|
226
|
+
✓ 领域模型 (artifacts/) - 3 个文件
|
|
227
|
+
✓ 技术方案 (artifacts/)
|
|
228
|
+
✓ 任务列表 (tasks/) - 8 个任务
|
|
229
|
+
|
|
230
|
+
### 任务进度
|
|
231
|
+
✓ 所有任务已完成 (8/8)
|
|
232
|
+
|
|
233
|
+
### 下一步建议
|
|
234
|
+
运行 /6aspec:green:archive 归档需求
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## 错误处理
|
|
238
|
+
|
|
239
|
+
### 错误 1: 状态文件不存在
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
错误:未找到状态文件
|
|
243
|
+
|
|
244
|
+
路径:6aspecdoc/green/<feature-name>/.green-status.json
|
|
245
|
+
|
|
246
|
+
这可能是因为:
|
|
247
|
+
1. 需求目录不是通过 /6aspec:green:new 创建的
|
|
248
|
+
2. 状态文件被意外删除
|
|
249
|
+
|
|
250
|
+
请运行 /6aspec:green:new 重新创建需求。
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### 错误 2: 状态文件格式错误
|
|
254
|
+
|
|
255
|
+
```
|
|
256
|
+
错误:状态文件格式错误
|
|
257
|
+
|
|
258
|
+
路径:6aspecdoc/green/<feature-name>/.green-status.json
|
|
259
|
+
|
|
260
|
+
错误信息:<parse-error>
|
|
261
|
+
|
|
262
|
+
请检查状态文件格式是否正确,或运行 /6aspec:green:new 重新创建需求。
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## 注意事项
|
|
266
|
+
|
|
267
|
+
1. **只读操作**:status 命令只读取状态,不修改任何文件
|
|
268
|
+
2. **时间格式化**:显示时间时使用易读格式(YYYY-MM-DD HH:mm)
|
|
269
|
+
3. **路径简化**:显示文件路径时使用相对路径,省略 `6aspecdoc/green/<feature-name>/` 前缀
|
|
270
|
+
4. **用户友好**:使用图标和颜色(如果终端支持)提升可读性
|
|
271
|
+
5. **状态一致性**:如果发现状态不一致(如工件状态与生命周期状态不匹配),显示警告信息
|
|
272
|
+
|
|
273
|
+
## 参考文档
|
|
274
|
+
|
|
275
|
+
- 状态文件结构定义:`.6aspec/rules/green/green_status_schema.md`
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 任务拆解标准操作流程 (Functional Entrypoint SOP)
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# tasks: 任务拆解标准操作流程 (Functional Entrypoint SOP)
|
|
7
|
+
|
|
8
|
+
## 工作流概述
|
|
9
|
+
|
|
10
|
+
当触发 tasks 工作流时,AI 需作为 **Lead Engineer / Project Manager**,基于已生成的 `tech-design.md` 文档,将架构设计转化为以**入口点(API/事件/定时任务)**为核心的原子开发任务。
|
|
11
|
+
|
|
12
|
+
## 前置条件(依赖门禁,必须首先执行)
|
|
13
|
+
|
|
14
|
+
在执行任务拆解前,**必须**先完成依赖检查,不通过则**立即停止**并提示,不得继续:
|
|
15
|
+
|
|
16
|
+
1. **确定当前需求**:根据当前工作目录或用户 @ 的文件,确定 `6aspecdoc/green/<feature-name>/`;若有多个需求则让用户选择。
|
|
17
|
+
2. **读取状态文件**:读取 `6aspecdoc/green/<feature-name>/.green-status.json`。若文件不存在,停止并提示先运行 `/6aspec:green:new` 创建需求。
|
|
18
|
+
3. **检查上一流程已完成**:
|
|
19
|
+
- 若 `status` 不是 `designed`,停止并提示:
|
|
20
|
+
```
|
|
21
|
+
❌ 未通过依赖检查,无法执行任务拆解
|
|
22
|
+
|
|
23
|
+
当前状态:<status>
|
|
24
|
+
要求状态:designed(技术方案已完成)
|
|
25
|
+
|
|
26
|
+
请先完成技术方案设计:运行 /6aspec:green:design,并确保生成 artifacts/tech-design.md、api-definition.md 且状态已更新为 designed。
|
|
27
|
+
```
|
|
28
|
+
- 若 `artifacts.design.status` 不是 `done`,停止并提示先运行 `/6aspec:green:design` 完成技术方案。
|
|
29
|
+
4. **检查 tech-design.md 存在**:若 `6aspecdoc/green/<feature-name>/artifacts/tech-design.md` 不存在,停止并提示先完成技术方案设计。
|
|
30
|
+
|
|
31
|
+
**只有以上检查全部通过后,才允许继续执行本 SOP 的拆解步骤。**
|
|
32
|
+
|
|
33
|
+
## 0. 执行协议 (Protocol) - 必须遵守
|
|
34
|
+
|
|
35
|
+
你是一个**技术项目经理 (TPM)**。在执行任务拆解前,请严格遵守:
|
|
36
|
+
|
|
37
|
+
1. **主动检索 (Active Retrieval)**:
|
|
38
|
+
* 当用户指定 `{功能名称}` 时,优先尝试读取 `6aspecdoc/green/<feature-name>/artifacts/tech-design.md`。
|
|
39
|
+
* 如果找不到 TDD 文档,**立即停止**并报错,提示用户先完成 TDD 设计。
|
|
40
|
+
|
|
41
|
+
2. **思维链门禁 (Chain of Thought Gatekeeping)**:
|
|
42
|
+
* 在输出任务列表前,**必须**先输出 `<thinking>` 块。
|
|
43
|
+
* **Check**: TDD 是否包含清晰的“接口列表”、“定时任务列表”、“事件订阅列表”?
|
|
44
|
+
* **Check**: 所有的入口点是否都有对应的“执行逻辑”描述?
|
|
45
|
+
* **Decision**: 若 TDD 内容严重缺失(如只有标题无逻辑),拒绝拆解,要求用户先完善 TDD。
|
|
46
|
+
|
|
47
|
+
3. **依赖分析 (Dependency Analysis)**:
|
|
48
|
+
* 在 `<thinking>` 块中,分析任务间的依赖关系(例如:退款任务依赖于支付查询接口)。
|
|
49
|
+
* 基于依赖关系生成合理的**开发顺序**,而不是简单的线性排列。
|
|
50
|
+
|
|
51
|
+
## 核心原则
|
|
52
|
+
1. **纵向拆解**:一个任务即一个完整的功能入口,包含其关联的枚举、 DTO、Service、Repository,gateway 等所有逻辑实现
|
|
53
|
+
2. **职责完备**:在执行某个任务时,AI 应根据需要自动创建或修改涉及的模型与逻辑,而不是拆分成多个任务
|
|
54
|
+
3. **规约驱动**:不同类型的任务必须显式指定对应的编码规约文件
|
|
55
|
+
|
|
56
|
+
## 输入要求
|
|
57
|
+
- **必需输入**:已完成的 `tech-design.md` 文档
|
|
58
|
+
- **关联规约**:
|
|
59
|
+
- API 任务:`./.6aspec/rules/biz/api_rule.md`
|
|
60
|
+
- 事件订阅任务:`./.6aspec/rules/biz/event_subscriber_rule.md`
|
|
61
|
+
- 定时任务任务:`./.6aspec/rules/biz/scheduled_job_rule.md`
|
|
62
|
+
- 后台任务任务:`./.6aspec/rules/biz/background_job_rule.md`
|
|
63
|
+
|
|
64
|
+
## 第一阶段:任务分类与规则映射
|
|
65
|
+
|
|
66
|
+
在拆解时,AI 必须识别 TDD 中的功能点属于哪种类型,并分配对应的规约文件:
|
|
67
|
+
|
|
68
|
+
| 任务类型 | 识别特征 | 关联规约文件 |
|
|
69
|
+
| :--- | :--- | :--- |
|
|
70
|
+
| **API 任务** | TDD 中的 RESTful API 设计、Controller 接口 | `./.6aspec/rules/biz/api_rule.md` |
|
|
71
|
+
| **事件订阅任务** | TDD 中的事件订阅 (Subscriber)、异步消息处理 | `./.6aspec/rules/biz/event_subscriber_rule.md` |
|
|
72
|
+
| **定时任务任务** | TDD 中的定时任务 (Scheduled Task)、Cron 任务 | `./.6aspec/rules/biz/scheduled_job_rule.md` |
|
|
73
|
+
| **后台任务任务** | TDD 中的后台任务(Async Background Job)、需要异步执行的任务 | `./.6aspec/rules/biz/background_job_rule.md` |
|
|
74
|
+
|
|
75
|
+
## 第二阶段:输出规范
|
|
76
|
+
|
|
77
|
+
### 1. 目录结构
|
|
78
|
+
所有任务文件必须存储在以下路径:
|
|
79
|
+
- `6aspecdoc/green/<feature-name>/tasks/`(feature-name 使用 kebab-case 命名,如:user-authentication)
|
|
80
|
+
|
|
81
|
+
### 2. 文件命名规范
|
|
82
|
+
- 格式:`task-{序号}-{任务类型}-{功能简名}.md`
|
|
83
|
+
- 示例:`task-001-api-create-contract.md`, `task-002-event-contract-signed.md`
|
|
84
|
+
|
|
85
|
+
### 3. 任务文档模板 (Task Template)
|
|
86
|
+
每个生成的任务文件必须**严格包含**以下章节:
|
|
87
|
+
|
|
88
|
+
```markdown
|
|
89
|
+
# 任务 [序号]: [任务标题 (如: 开发 XXX 接口)]
|
|
90
|
+
|
|
91
|
+
### 0. 任务状态
|
|
92
|
+
- 状态:[待开始 / 进行中 / 已完成 / 阻塞 / 取消]
|
|
93
|
+
- 最后更新:[YYYY-MM-DD]
|
|
94
|
+
|
|
95
|
+
### 1. 任务目标
|
|
96
|
+
- 描述任务的入口点(如:开发 API `POST /v1/contract/save`)
|
|
97
|
+
- 明确该任务需要实现的功能边界
|
|
98
|
+
|
|
99
|
+
### 2. 预计工时(小时)
|
|
100
|
+
- 预计:X 小时
|
|
101
|
+
- **评估基准 (Baseline)**:
|
|
102
|
+
- 简单 CRUD 接口:0.5 - 1h
|
|
103
|
+
- 带简单业务逻辑(校验/状态变更):1 - 2h
|
|
104
|
+
- 复杂逻辑(外部调用/并发锁/事务):3 - 5h
|
|
105
|
+
- 极高复杂度(核心金融链路):5h+
|
|
106
|
+
|
|
107
|
+
### 2.5 任务依赖与前置条件 (Dependencies)
|
|
108
|
+
- **前置任务**:[Task-001 / 无] (必须先完成的任务)
|
|
109
|
+
- **依赖模块**:[UserFacade / PaymentService] (需调用的外部依赖)
|
|
110
|
+
|
|
111
|
+
### 3. 业务规则与实现细节
|
|
112
|
+
- **核心逻辑**:基于 TDD 中的"执行逻辑"描述,详细说明 Service 层及领域层需处理的规则(如存在对应的可视化文档 `visual-logic.md`,可作为辅助参考,但不得脱离 TDD 自行补充规则)。
|
|
113
|
+
- **核心技术决策**:回顾 TDD 中的关键决策(如幂等方案),再次确认落实。
|
|
114
|
+
- **数据结构与契约 (Binding)**:
|
|
115
|
+
- **API 契约**:必须严格遵循 `api-definition.md` 中的 Request/Response 结构。
|
|
116
|
+
- **Entity 引用**:实体类与 Mapper 均已预生成,请在代码实现阶段搜索并复用(如 `MyEntity.java`, `MyEntityMapper.java`或者`MyEntityDao.java`),**严禁重复创建**。
|
|
117
|
+
- **状态流转**:若涉及状态变更,明确状态机逻辑。
|
|
118
|
+
- **数据结构**:涉及的 DTO、Command、Query 的定义要求
|
|
119
|
+
- **异常处理**:需捕获并抛出的业务异常类型。
|
|
120
|
+
|
|
121
|
+
### 4. 跨模块依赖调用
|
|
122
|
+
- 明确需要调用哪些已有模块的 Facade 或 RMI 接口
|
|
123
|
+
- 描述依赖的数据来源或前置条件
|
|
124
|
+
|
|
125
|
+
### 5. 必须参考的编码规则
|
|
126
|
+
- **本任务类型**:[API / 事件订阅 / 定时任务 / 后台任务]
|
|
127
|
+
- **规则文件**:[此处填入对应的 .md 规则路径]
|
|
128
|
+
- **编码公共规则文件**:`.6aspec/rules/biz/code.md`和`.6aspec/rules/biz/project-structure.md`
|
|
129
|
+
- **执行说明**:在执行本任务代码生成时,必须严格遵守该规则文件中的代码分层、命名及注释规范
|
|
130
|
+
- **C/B 端标识**:API 接口必须识别是 C 端(小程序端)还是 B 端(PC 端和 APP 端)
|
|
131
|
+
|
|
132
|
+
### 6. 验收标准 (DoD)
|
|
133
|
+
- [ ] 对应的接口/订阅者/定时器已成功创建。
|
|
134
|
+
- [ ] 内部逻辑(Service/Repository)完整实现且符合业务预期。
|
|
135
|
+
- [ ] 幂等性与并发控制已按 TDD 要求实现。
|
|
136
|
+
- [ ] 满足规约文件中的所有强制性要求。
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## 第三阶段:拆解执行步骤
|
|
140
|
+
1. **扫描入口点**:从 TDD 文档中提取所有“接口设计”、“事件设计”、“定时任务”和“后台任务”中的条目。
|
|
141
|
+
2. **合并依赖项**:将该入口点涉及的所有业务逻辑(Service)、数据访问(Repository)、模型定义(DTO/VO/Enum)全部归入该入口点的原子任务中。
|
|
142
|
+
3. **排序与编排**:基于`<thinking>`中的依赖分析,对任务进行逻辑排序(先基础后上层,先前置后依赖)。
|
|
143
|
+
4. **生成文件**:为每个识别出的入口点生成独立的任务 Markdown 文件。
|
|
144
|
+
5. **生成总览**:任务拆解完成后,必须在 `6aspecdoc/green/<feature-name>/tasks/README.md` 输出任务总览。
|
|
145
|
+
6. **状态维护(必须执行)**:后续每当完成一个任务,必须同步更新:
|
|
146
|
+
- 对应任务文件中的"任务状态"。
|
|
147
|
+
- `6aspecdoc/green/<feature-name>/tasks/README.md` 中该任务的状态展示。
|
|
148
|
+
|
|
149
|
+
## 输出要求
|
|
150
|
+
1. **格式**:Markdown 源码格式。
|
|
151
|
+
2. **一致性**:任务中的类名、方法名和字段名必须与 TDD 保持完全一致。
|
|
152
|
+
3. **禁用范围**:不拆解前端任务、不拆解单纯的单元测试任务、不拆解 Entity/SQL 任务。
|
|
153
|
+
4. **总览 README(必须输出)**:在 `6aspecdoc/green/<feature-name>/tasks/README.md` 生成任务总览文件,必须包含:
|
|
154
|
+
- **项目进度看板**:任务总工时、已完成工时、进度条。
|
|
155
|
+
- **任务清单**:按推荐执行顺序排列,包含状态图标 (✅/🔄/⏳)。
|
|
156
|
+
- **开发阶段划分**:建议将任务划分为 Phase 1 (Core), Phase 2 (Extensions) 等阶段。
|
|
157
|
+
- **验收标准汇总**:从各任务 DoD 汇总,形成整体 DoD。
|
|
158
|
+
- **注意事项与相关文档链接**: 至少包含指向 `../artifacts/tech-design.md`、`../artifacts/api-definition.md` 的链接;如存在则包含 `../artifacts/visual-logic.md`
|
|
159
|
+
|
|
160
|
+
## 流程完成提示 (Workflow Progress)
|
|
161
|
+
|
|
162
|
+
**重要提示**:本节内容仅用于向用户输出流程进度提示,**不要写入任何文档文件**。
|
|
163
|
+
|
|
164
|
+
当完成本 SOP 流程后,必须向用户输出以下流程进度提示:
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
✅ **已完成:任务拆解 (tasks)**
|
|
169
|
+
|
|
170
|
+
📊 **进度:3/4 (主流程)**
|
|
171
|
+
|
|
172
|
+
**下一步建议:**
|
|
173
|
+
- 【主流程】执行开发任务:命令 `execute-task`
|
|
174
|
+
开始执行具体的开发任务,将设计转化为代码实现
|
|
175
|
+
|
|
176
|
+
**完整流程图:**
|
|
177
|
+
```
|
|
178
|
+
主流程:领域建模 ✅ → 技术方案 ✅ → 任务生成 ✅ → 执行任务 (3/4)
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
---
|