6aspec 2.0.0-dev.2
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 +296 -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 +227 -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 +211 -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 +48 -0
- package/lib/cli.js +318 -0
- package/lib/installer.js +333 -0
- package/package.json +62 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 基于TDD生成 Mermaid 流程图/交互时序图/状态机图的标准操作流程 (Visual Logic Diagrams SOP)
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# visual-logic: 基于 TDD 生成 Mermaid 图表的标准操作流程(按需生成)
|
|
7
|
+
|
|
8
|
+
## 背景与原则
|
|
9
|
+
本 SOP 用于在“需要时”生成业务逻辑可视化图表。不是每次需求都复杂,也不是每个业务功能都需要图表,因此本 SOP 强制遵守:
|
|
10
|
+
- **按需生成**:由人来判断本次哪些流程/入口需要画图;未被选中的图表类型与范围,禁止为了完整性而补齐。
|
|
11
|
+
- **只依赖既有设计**:图表必须严格基于已产出的 TDD(以及可选补充材料),不得自行脑补业务规则。
|
|
12
|
+
|
|
13
|
+
## 角色
|
|
14
|
+
你现在的角色是【技术方案可视化设计师】,负责把 TDD 中的写流程/异步流程/状态流转转换为 Mermaid 图表,以提升可读性与对齐效率。
|
|
15
|
+
|
|
16
|
+
## 目标
|
|
17
|
+
基于指定的 TDD 文档,按人类选择的范围输出以下一种或多种 Mermaid 图表:
|
|
18
|
+
- **业务流程图(Flowchart)**
|
|
19
|
+
- **交互时序图(Sequence Diagram)**
|
|
20
|
+
- **状态机图(State Diagram)**
|
|
21
|
+
|
|
22
|
+
## 输入要求
|
|
23
|
+
### 必需输入
|
|
24
|
+
- **TDD 文档路径**:`6aspecdoc/green/<feature-name>/artifacts/tech-design.md`(feature-name 使用 kebab-case 命名,如:user-authentication)
|
|
25
|
+
- **人类选择的生成范围(必须明确,否则中断提问)**:
|
|
26
|
+
- 需要生成的图表类型:Flowchart / Sequence / State(可多选)
|
|
27
|
+
- 覆盖范围:具体到“哪些入口/哪些业务流程/哪些对象”(例如:仅 `3.1` 中某个写 API;或某个事件订阅;或某个后台任务)
|
|
28
|
+
- 抽象层级:是否细到 service/repository/facade 级别(建议默认到 service/repository/facade)
|
|
29
|
+
|
|
30
|
+
### 可选输入(用于补齐 TDD 未显式写清的信息)
|
|
31
|
+
- 数据模型文档:`6aspecdoc/green/<feature-name>/artifacts/domain-model.md`
|
|
32
|
+
- PRD:`.prd/{功能名称}-prd.md`
|
|
33
|
+
- 事件清单:`./.6aspec/biz/event-list.md`(当涉及事件订阅/发布时)
|
|
34
|
+
- 能力地图:`./.6aspec/biz/functional-capability-Map.md`(当涉及跨模块 Facade 依赖时)
|
|
35
|
+
|
|
36
|
+
## 中断机制(必须执行)
|
|
37
|
+
如果出现以下任一情况,必须停止画图并输出“提问清单”,等待人类补充:
|
|
38
|
+
- TDD 未明确对应入口的**执行逻辑**(关键分支/校验/写入/副作用)导致流程无法确定
|
|
39
|
+
- 需要状态机图,但 TDD/模型未明确**状态集合、迁移条件、触发入口**
|
|
40
|
+
- 需要时序图,但 TDD 未明确**参与者边界**(哪些模块/Facade/Repo/异步任务参与)
|
|
41
|
+
- 人类未明确“生成范围”或范围过大且不可执行(例如:要求“全系统所有流程都画”)
|
|
42
|
+
|
|
43
|
+
## 输出要求
|
|
44
|
+
1. **输出格式**:Markdown 源码 + Mermaid 代码块(严禁截图)
|
|
45
|
+
2. **输出位置**:`6aspecdoc/green/<feature-name>/artifacts/visual-logic.md`
|
|
46
|
+
3. **引用关系**:在输出文档开头必须写明:
|
|
47
|
+
- 输入 TDD 文档路径
|
|
48
|
+
- 本次选择生成的图表类型与覆盖范围
|
|
49
|
+
4. **禁止项**:不涉及 UI/交互/样式;不写测试用例;不新增查询接口设计
|
|
50
|
+
|
|
51
|
+
## 标准操作流程(SOP)
|
|
52
|
+
|
|
53
|
+
### 第一步:确认输入与范围(Gatekeeping)
|
|
54
|
+
输出一个确认表(或列表),逐项确认:
|
|
55
|
+
- TDD 路径是否存在、是否可读
|
|
56
|
+
- 本次需要生成的图表类型(多选)
|
|
57
|
+
- 本次覆盖范围(入口/流程/对象,必须具体)
|
|
58
|
+
- 抽象层级(例如:Controller/Façade/Service/Repository/外部 Facade/JobWorker)
|
|
59
|
+
|
|
60
|
+
若任意项缺失:停止并输出提问清单。
|
|
61
|
+
|
|
62
|
+
### 第二步:从 TDD 抽取“可视化要素”
|
|
63
|
+
只允许从 TDD(以及人类提供的补充输入)中抽取:
|
|
64
|
+
- 入口清单(写 API / 定时任务 / 事件订阅 / 后台任务)
|
|
65
|
+
- 每个入口的执行逻辑(含关键分支)
|
|
66
|
+
- 幂等/并发控制点(用于标注关键节点)
|
|
67
|
+
- 外部依赖与调用点(用于时序图参与者)
|
|
68
|
+
- 状态与迁移信息(仅当选择生成状态机图)
|
|
69
|
+
|
|
70
|
+
### 第三步:生成 Mermaid 图表(按选择的图表类型分别输出)
|
|
71
|
+
|
|
72
|
+
#### 3.1 业务流程图(Flowchart)
|
|
73
|
+
适用:存在多分支判断、异常分支、幂等/并发门禁、异步投递等逻辑。
|
|
74
|
+
要求:
|
|
75
|
+
- 每个被选中的入口至少 1 张流程图
|
|
76
|
+
- 节点必须可映射回 TDD 的“执行逻辑”描述(禁止新增分支)
|
|
77
|
+
|
|
78
|
+
#### 3.2 交互时序图(Sequence Diagram)
|
|
79
|
+
适用:需要对齐模块边界、依赖调用顺序、异步链路。
|
|
80
|
+
要求:
|
|
81
|
+
- 参与者命名使用逻辑层级:Client/Controller/Façade/Service/Repository/ExternalFacade/JobProducer/JobWorker/EventBus 等
|
|
82
|
+
- 清晰体现:同步调用、异步投递/消费、失败重试/补偿点(若 TDD 已描述)
|
|
83
|
+
|
|
84
|
+
#### 3.3 状态机图(State Diagram)
|
|
85
|
+
适用:对象存在明确状态集合与迁移(订单/合同/流程单/任务等)。
|
|
86
|
+
要求:
|
|
87
|
+
- 必须在图旁边列出:状态集合来源(来自 TDD 或模型的哪一段描述)
|
|
88
|
+
- 迁移必须标注触发入口(API/事件/定时任务/后台任务)
|
|
89
|
+
|
|
90
|
+
### 第四步:输出文档并自检
|
|
91
|
+
1. 写入 `6aspecdoc/green/<feature-name>/artifacts/visual-logic.md`
|
|
92
|
+
2. 自检:
|
|
93
|
+
- Mermaid 语法是否完整
|
|
94
|
+
- 是否严格遵循"按需生成"与"范围约束"
|
|
95
|
+
- 是否存在任何"凭空补充"的业务分支(如有则删除并提问)
|
|
96
|
+
|
|
97
|
+
## 流程完成提示 (Workflow Progress)
|
|
98
|
+
|
|
99
|
+
**重要提示**:本节内容仅用于向用户输出流程进度提示,**不要写入任何文档文件**。
|
|
100
|
+
|
|
101
|
+
当完成本 SOP 流程后,必须向用户输出以下流程进度提示:
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
✅ **已完成:生成可视化逻辑图 (visual-logic) - 可选流程**
|
|
106
|
+
|
|
107
|
+
📊 **进度:可选流程已完成**
|
|
108
|
+
|
|
109
|
+
**下一步建议:**
|
|
110
|
+
- 【主流程】任务拆解:命令 `tasks`
|
|
111
|
+
继续主流程,将技术方案拆解为可执行的开发任务
|
|
112
|
+
|
|
113
|
+
**完整流程图:**
|
|
114
|
+
```
|
|
115
|
+
主流程:领域建模 ✅ → 技术方案 ✅ → 任务生成 → 执行任务 (2/4)
|
|
116
|
+
可选流程:生成可视化逻辑图 ✅
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
# 绿地需求状态文件结构定义
|
|
2
|
+
|
|
3
|
+
## 概述
|
|
4
|
+
|
|
5
|
+
每个绿地需求都有一个状态文件 `.green-status.json`,用于跟踪需求的生命周期状态、工件完成情况和任务进度。
|
|
6
|
+
|
|
7
|
+
## 文件位置
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
6aspecdoc/green/<feature-name>/.green-status.json
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 状态文件结构
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"name": "string", // 需求名称(kebab-case)
|
|
18
|
+
"status": "string", // 当前生命周期状态
|
|
19
|
+
"created": "ISO8601", // 创建时间
|
|
20
|
+
"lastModified": "ISO8601", // 最后修改时间
|
|
21
|
+
"artifacts": { // 工件完成情况
|
|
22
|
+
"requirement": {
|
|
23
|
+
"status": "string", // 工件状态:pending/ready/done/blocked
|
|
24
|
+
"path": "string", // 工件路径
|
|
25
|
+
"completedAt": "ISO8601" // 完成时间(可选)
|
|
26
|
+
},
|
|
27
|
+
"models": {
|
|
28
|
+
"status": "string",
|
|
29
|
+
"path": "string",
|
|
30
|
+
"completedAt": "ISO8601",
|
|
31
|
+
"files": ["string"] // 模型文件列表(可选)
|
|
32
|
+
},
|
|
33
|
+
"design": {
|
|
34
|
+
"status": "string",
|
|
35
|
+
"path": "string",
|
|
36
|
+
"completedAt": "ISO8601"
|
|
37
|
+
},
|
|
38
|
+
"tasks": {
|
|
39
|
+
"status": "string",
|
|
40
|
+
"path": "string",
|
|
41
|
+
"completedAt": "ISO8601",
|
|
42
|
+
"files": ["string"] // 任务文件列表(可选)
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"tasks": { // 任务进度
|
|
46
|
+
"total": 0, // 总任务数
|
|
47
|
+
"completed": 0, // 已完成任务数
|
|
48
|
+
"remaining": 0, // 剩余任务数
|
|
49
|
+
"lastExecuted": "string" // 最后执行的任务文件名(可选)
|
|
50
|
+
},
|
|
51
|
+
"nextAction": { // 下一步建议(可选)
|
|
52
|
+
"command": "string", // 建议的命令
|
|
53
|
+
"description": "string" // 描述
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## 生命周期状态
|
|
59
|
+
|
|
60
|
+
| 状态 | 说明 | 下一步命令 |
|
|
61
|
+
|------|------|-----------|
|
|
62
|
+
| `created` | 已创建,等待需求澄清 | `/6aspec:green:new` 或 `/6aspec:green:clarify` |
|
|
63
|
+
| `requirement_clarified` | 需求已澄清 | `/6aspec:green:model`(可选:`/6aspec:green:clarify` 继续深化) |
|
|
64
|
+
| `modeled` | 领域建模完成 | `/6aspec:green:design` |
|
|
65
|
+
| `designed` | 技术方案完成 | `/6aspec:green:tasks` |
|
|
66
|
+
| `tasks_created` | 任务已拆解 | `/6aspec:green:execute-task` |
|
|
67
|
+
| `implementing` | 实施中 | `/6aspec:green:execute-task` |
|
|
68
|
+
| `completed` | 已完成 | `/6aspec:green:archive` |
|
|
69
|
+
| `archived` | 已归档 | - |
|
|
70
|
+
|
|
71
|
+
## 工件状态
|
|
72
|
+
|
|
73
|
+
| 状态 | 说明 |
|
|
74
|
+
|------|------|
|
|
75
|
+
| `pending` | 等待创建 |
|
|
76
|
+
| `ready` | 准备就绪,可以创建 |
|
|
77
|
+
| `done` | 已完成 |
|
|
78
|
+
| `blocked` | 被阻塞,等待依赖工件完成 |
|
|
79
|
+
|
|
80
|
+
## 工件依赖关系
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
requirement (需求澄清文档)
|
|
84
|
+
↓
|
|
85
|
+
models (领域模型)
|
|
86
|
+
↓
|
|
87
|
+
design (技术方案)
|
|
88
|
+
↓
|
|
89
|
+
tasks (任务列表)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## 状态转换规则
|
|
93
|
+
|
|
94
|
+
1. **created → requirement_clarified**
|
|
95
|
+
- 条件:requirement 工件状态为 done
|
|
96
|
+
- 触发:完成需求澄清文档
|
|
97
|
+
|
|
98
|
+
2. **requirement_clarified → modeled**
|
|
99
|
+
- 条件:models 工件状态为 done
|
|
100
|
+
- 触发:完成领域建模
|
|
101
|
+
|
|
102
|
+
3. **modeled → designed**
|
|
103
|
+
- 条件:design 工件状态为 done
|
|
104
|
+
- 触发:完成技术方案
|
|
105
|
+
|
|
106
|
+
4. **designed → tasks_created**
|
|
107
|
+
- 条件:tasks 工件状态为 done
|
|
108
|
+
- 触发:完成任务拆解
|
|
109
|
+
|
|
110
|
+
5. **tasks_created → implementing**
|
|
111
|
+
- 条件:开始执行任务
|
|
112
|
+
- 触发:执行第一个任务
|
|
113
|
+
|
|
114
|
+
6. **implementing → completed**
|
|
115
|
+
- 条件:所有任务完成(tasks.completed == tasks.total)
|
|
116
|
+
- 触发:完成最后一个任务
|
|
117
|
+
|
|
118
|
+
7. **completed → archived**
|
|
119
|
+
- 条件:用户确认归档
|
|
120
|
+
- 触发:执行归档命令
|
|
121
|
+
|
|
122
|
+
## 回退(rollback)
|
|
123
|
+
|
|
124
|
+
仅允许**单步回退**,且**必须先提示用户、获得明确确认后**才可执行;执行时将删除当前阶段生成的工件。
|
|
125
|
+
|
|
126
|
+
| 当前状态 | 回退后状态 | 触发命令 | 将删除的工件 |
|
|
127
|
+
|----------|------------|----------|--------------|
|
|
128
|
+
| `requirement_clarified` | `created` | `/6aspec:green:rollback` | requirement.md |
|
|
129
|
+
| `modeled` | `requirement_clarified` | `/6aspec:green:rollback` | artifacts/domain-model.md |
|
|
130
|
+
| `designed` | `modeled` | `/6aspec:green:rollback` | artifacts/tech-design.md、api-definition.md、visual-logic.md(若存在) |
|
|
131
|
+
| `tasks_created` | `designed` | `/6aspec:green:rollback` | tasks/ 目录下全部文件 |
|
|
132
|
+
|
|
133
|
+
**不允许回退**:`created`(无上一阶段)、`implementing`、`completed`、`archived`。详见 `.6aspec/rules/green/6A_rollback_sop.md`。
|
|
134
|
+
|
|
135
|
+
## 示例
|
|
136
|
+
|
|
137
|
+
### 初始状态(刚创建)
|
|
138
|
+
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"name": "user-authentication",
|
|
142
|
+
"status": "created",
|
|
143
|
+
"created": "2026-02-16T03:00:00Z",
|
|
144
|
+
"lastModified": "2026-02-16T03:00:00Z",
|
|
145
|
+
"artifacts": {
|
|
146
|
+
"requirement": {
|
|
147
|
+
"status": "pending",
|
|
148
|
+
"path": "6aspecdoc/green/user-authentication/requirement.md"
|
|
149
|
+
},
|
|
150
|
+
"models": {
|
|
151
|
+
"status": "blocked",
|
|
152
|
+
"path": "6aspecdoc/green/user-authentication/artifacts/"
|
|
153
|
+
},
|
|
154
|
+
"design": {
|
|
155
|
+
"status": "blocked",
|
|
156
|
+
"path": "6aspecdoc/green/user-authentication/artifacts/"
|
|
157
|
+
},
|
|
158
|
+
"tasks": {
|
|
159
|
+
"status": "blocked",
|
|
160
|
+
"path": "6aspecdoc/green/user-authentication/tasks/"
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"tasks": {
|
|
164
|
+
"total": 0,
|
|
165
|
+
"completed": 0,
|
|
166
|
+
"remaining": 0
|
|
167
|
+
},
|
|
168
|
+
"nextAction": {
|
|
169
|
+
"command": "new",
|
|
170
|
+
"description": "开始需求澄清"
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### 需求澄清完成后
|
|
176
|
+
|
|
177
|
+
```json
|
|
178
|
+
{
|
|
179
|
+
"name": "user-authentication",
|
|
180
|
+
"status": "requirement_clarified",
|
|
181
|
+
"created": "2026-02-16T03:00:00Z",
|
|
182
|
+
"lastModified": "2026-02-16T03:15:00Z",
|
|
183
|
+
"artifacts": {
|
|
184
|
+
"requirement": {
|
|
185
|
+
"status": "done",
|
|
186
|
+
"path": "6aspecdoc/green/user-authentication/requirement.md",
|
|
187
|
+
"completedAt": "2026-02-16T03:15:00Z"
|
|
188
|
+
},
|
|
189
|
+
"models": {
|
|
190
|
+
"status": "ready",
|
|
191
|
+
"path": "6aspecdoc/green/user-authentication/artifacts/"
|
|
192
|
+
},
|
|
193
|
+
"design": {
|
|
194
|
+
"status": "blocked",
|
|
195
|
+
"path": "6aspecdoc/green/user-authentication/artifacts/"
|
|
196
|
+
},
|
|
197
|
+
"tasks": {
|
|
198
|
+
"status": "blocked",
|
|
199
|
+
"path": "6aspecdoc/green/user-authentication/tasks/"
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
"tasks": {
|
|
203
|
+
"total": 0,
|
|
204
|
+
"completed": 0,
|
|
205
|
+
"remaining": 0
|
|
206
|
+
},
|
|
207
|
+
"nextAction": {
|
|
208
|
+
"command": "model",
|
|
209
|
+
"description": "开始领域建模"
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### 实施中
|
|
215
|
+
|
|
216
|
+
```json
|
|
217
|
+
{
|
|
218
|
+
"name": "user-authentication",
|
|
219
|
+
"status": "implementing",
|
|
220
|
+
"created": "2026-02-16T03:00:00Z",
|
|
221
|
+
"lastModified": "2026-02-16T05:30:00Z",
|
|
222
|
+
"artifacts": {
|
|
223
|
+
"requirement": {
|
|
224
|
+
"status": "done",
|
|
225
|
+
"path": "6aspecdoc/green/user-authentication/requirement.md",
|
|
226
|
+
"completedAt": "2026-02-16T03:15:00Z"
|
|
227
|
+
},
|
|
228
|
+
"models": {
|
|
229
|
+
"status": "done",
|
|
230
|
+
"path": "6aspecdoc/green/user-authentication/artifacts/",
|
|
231
|
+
"completedAt": "2026-02-16T03:45:00Z",
|
|
232
|
+
"files": ["domain-model.md"]
|
|
233
|
+
},
|
|
234
|
+
"design": {
|
|
235
|
+
"status": "done",
|
|
236
|
+
"path": "6aspecdoc/green/user-authentication/artifacts/",
|
|
237
|
+
"completedAt": "2026-02-16T04:15:00Z"
|
|
238
|
+
},
|
|
239
|
+
"tasks": {
|
|
240
|
+
"status": "done",
|
|
241
|
+
"path": "6aspecdoc/green/user-authentication/tasks/",
|
|
242
|
+
"completedAt": "2026-02-16T04:30:00Z",
|
|
243
|
+
"files": ["task_01_user_model.md", "task_02_auth_api.md", "task_03_session.md"]
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
"tasks": {
|
|
247
|
+
"total": 8,
|
|
248
|
+
"completed": 5,
|
|
249
|
+
"remaining": 3,
|
|
250
|
+
"lastExecuted": "task_05_session_management.md"
|
|
251
|
+
},
|
|
252
|
+
"nextAction": {
|
|
253
|
+
"command": "execute-task",
|
|
254
|
+
"description": "继续执行剩余 3 个任务"
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## 使用说明
|
|
260
|
+
|
|
261
|
+
### 读取状态
|
|
262
|
+
|
|
263
|
+
所有命令在执行前应该读取状态文件,了解当前状态:
|
|
264
|
+
|
|
265
|
+
```javascript
|
|
266
|
+
const statusPath = '6aspecdoc/green/<feature-name>/.green-status.json';
|
|
267
|
+
const status = JSON.parse(fs.readFileSync(statusPath, 'utf8'));
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### 更新状态
|
|
271
|
+
|
|
272
|
+
命令执行后应该更新状态文件:
|
|
273
|
+
|
|
274
|
+
```javascript
|
|
275
|
+
status.lastModified = new Date().toISOString();
|
|
276
|
+
status.artifacts.requirement.status = 'done';
|
|
277
|
+
status.artifacts.requirement.completedAt = new Date().toISOString();
|
|
278
|
+
status.status = 'requirement_clarified';
|
|
279
|
+
fs.writeFileSync(statusPath, JSON.stringify(status, null, 2));
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### 状态检查
|
|
283
|
+
|
|
284
|
+
在执行命令前,检查状态是否符合预期:
|
|
285
|
+
|
|
286
|
+
```javascript
|
|
287
|
+
if (status.status !== 'requirement_clarified') {
|
|
288
|
+
console.error('错误:当前状态不允许执行此命令');
|
|
289
|
+
console.error(`当前状态:${status.status}`);
|
|
290
|
+
console.error(`期望状态:requirement_clarified`);
|
|
291
|
+
process.exit(1);
|
|
292
|
+
}
|
|
293
|
+
```
|