ssd-ql-workflow 0.2.0 → 0.2.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/bin/cli.js +7 -5
- package/package.json +1 -1
- package/templates/openspec/schemas/trinity-workflow/templates/design.md +136 -0
- package/templates/openspec/schemas/trinity-workflow/templates/proposal.md +98 -0
- package/templates/openspec/schemas/trinity-workflow/templates/spec.md +75 -0
- package/templates/openspec/schemas/trinity-workflow/templates/tasks.md +124 -0
package/bin/cli.js
CHANGED
|
@@ -57,11 +57,13 @@ program
|
|
|
57
57
|
console.log(chalk.green('✓ Created openspec/schemas/trinity-workflow/schema.yaml'));
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
//
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
// Copy trinity-workflow templates
|
|
61
|
+
const templatesSrcDir = path.join(TEMPLATES_DIR, 'openspec', 'schemas', 'trinity-workflow', 'templates');
|
|
62
|
+
const templatesDestDir = path.join(openspecDir, 'schemas', 'trinity-workflow', 'templates');
|
|
63
|
+
|
|
64
|
+
if (await fs.pathExists(templatesSrcDir)) {
|
|
65
|
+
await fs.copy(templatesSrcDir, templatesDestDir, { overwrite: options.force });
|
|
66
|
+
console.log(chalk.green('✓ Created openspec/schemas/trinity-workflow/templates/'));
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
// Create .active file
|
package/package.json
CHANGED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Design: {{change-name}}
|
|
2
|
+
|
|
3
|
+
> Created: {{date}}
|
|
4
|
+
> Based on: proposal.md
|
|
5
|
+
|
|
6
|
+
## Architecture Overview
|
|
7
|
+
|
|
8
|
+
<!-- 高层架构图和说明 -->
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
┌─────────────────────────────────────────────────────┐
|
|
12
|
+
│ Architecture Diagram │
|
|
13
|
+
│ │
|
|
14
|
+
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
|
|
15
|
+
│ │ Layer │────▶│ Layer │────▶│ Layer │ │
|
|
16
|
+
│ └─────────┘ └─────────┘ └─────────┘ │
|
|
17
|
+
│ │
|
|
18
|
+
└─────────────────────────────────────────────────────┘
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Data Models
|
|
22
|
+
|
|
23
|
+
### Entity: [EntityName]
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
interface EntityName {
|
|
27
|
+
id: string;
|
|
28
|
+
// ... properties
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Relationships
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
EntityA ──1:N──▶ EntityB
|
|
36
|
+
EntityB ──N:M──▶ EntityC
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## API Design
|
|
40
|
+
|
|
41
|
+
### Endpoints
|
|
42
|
+
|
|
43
|
+
| Method | Path | Description |
|
|
44
|
+
|--------|------|-------------|
|
|
45
|
+
| GET | /api/resource | 获取列表 |
|
|
46
|
+
| POST | /api/resource | 创建资源 |
|
|
47
|
+
| PUT | /api/resource/:id | 更新资源 |
|
|
48
|
+
| DELETE | /api/resource/:id | 删除资源 |
|
|
49
|
+
|
|
50
|
+
### Request/Response Examples
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
// POST /api/resource
|
|
54
|
+
interface CreateRequest {
|
|
55
|
+
name: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface CreateResponse {
|
|
59
|
+
id: string;
|
|
60
|
+
name: string;
|
|
61
|
+
createdAt: Date;
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Component Design
|
|
66
|
+
|
|
67
|
+
### New Components
|
|
68
|
+
|
|
69
|
+
| 组件 | 位置 | 职责 |
|
|
70
|
+
|------|------|------|
|
|
71
|
+
| ComponentA | src/components/ | 描述 |
|
|
72
|
+
|
|
73
|
+
### Modified Components
|
|
74
|
+
|
|
75
|
+
| 组件 | 变更类型 | 说明 |
|
|
76
|
+
|------|----------|------|
|
|
77
|
+
| ComponentB | 扩展 | 新增 props |
|
|
78
|
+
|
|
79
|
+
## State Management
|
|
80
|
+
|
|
81
|
+
<!-- 状态管理方案 -->
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
// Store structure
|
|
85
|
+
interface Store {
|
|
86
|
+
feature: {
|
|
87
|
+
data: Entity[];
|
|
88
|
+
loading: boolean;
|
|
89
|
+
error: Error | null;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Error Handling
|
|
95
|
+
|
|
96
|
+
| 错误场景 | 处理方式 | 用户提示 |
|
|
97
|
+
|----------|----------|----------|
|
|
98
|
+
| 网络错误 | 重试3次 | "网络不稳定,请稍后" |
|
|
99
|
+
| 验证失败 | 显示详情 | "请检查输入" |
|
|
100
|
+
|
|
101
|
+
## Security Considerations
|
|
102
|
+
|
|
103
|
+
- [ ] 输入验证
|
|
104
|
+
- [ ] 权限检查
|
|
105
|
+
- [ ] 数据脱敏
|
|
106
|
+
- [ ] 审计日志
|
|
107
|
+
|
|
108
|
+
## Risks & Mitigations
|
|
109
|
+
|
|
110
|
+
| 风险 | 概率 | 影响 | 缓解措施 |
|
|
111
|
+
|------|------|------|----------|
|
|
112
|
+
| | | | |
|
|
113
|
+
|
|
114
|
+
## Dependencies
|
|
115
|
+
|
|
116
|
+
### New Dependencies
|
|
117
|
+
|
|
118
|
+
| Package | Version | 用途 |
|
|
119
|
+
|---------|---------|------|
|
|
120
|
+
| | | |
|
|
121
|
+
|
|
122
|
+
### Breaking Changes
|
|
123
|
+
|
|
124
|
+
- None / List breaking changes
|
|
125
|
+
|
|
126
|
+
## Testing Strategy
|
|
127
|
+
|
|
128
|
+
| 测试类型 | 覆盖目标 |
|
|
129
|
+
|----------|----------|
|
|
130
|
+
| 单元测试 | 80%+ |
|
|
131
|
+
| 集成测试 | 核心流程 |
|
|
132
|
+
| E2E 测试 | 用户场景 |
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
*Next: `openspec continue` to create specs*
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Proposal: {{change-name}}
|
|
2
|
+
|
|
3
|
+
> Created: {{date}}
|
|
4
|
+
> Status: Draft
|
|
5
|
+
|
|
6
|
+
## Problem Statement
|
|
7
|
+
|
|
8
|
+
<!-- 描述要解决的问题。聚焦于痛点,而非解决方案。 -->
|
|
9
|
+
|
|
10
|
+
## Proposed Solution
|
|
11
|
+
|
|
12
|
+
<!-- 描述解决方案的核心思路。 -->
|
|
13
|
+
|
|
14
|
+
## Options Considered
|
|
15
|
+
|
|
16
|
+
### Option A: [名称]
|
|
17
|
+
|
|
18
|
+
**描述:**
|
|
19
|
+
<!-- 方案描述 -->
|
|
20
|
+
|
|
21
|
+
**优点:**
|
|
22
|
+
-
|
|
23
|
+
|
|
24
|
+
**缺点:**
|
|
25
|
+
-
|
|
26
|
+
|
|
27
|
+
### Option B: [名称]
|
|
28
|
+
|
|
29
|
+
**描述:**
|
|
30
|
+
<!-- 方案描述 -->
|
|
31
|
+
|
|
32
|
+
**优点:**
|
|
33
|
+
-
|
|
34
|
+
|
|
35
|
+
**缺点:**
|
|
36
|
+
-
|
|
37
|
+
|
|
38
|
+
### Option C: [名称] (Recommended)
|
|
39
|
+
|
|
40
|
+
**描述:**
|
|
41
|
+
<!-- 方案描述 -->
|
|
42
|
+
|
|
43
|
+
**优点:**
|
|
44
|
+
-
|
|
45
|
+
|
|
46
|
+
**缺点:**
|
|
47
|
+
-
|
|
48
|
+
|
|
49
|
+
**选择理由:**
|
|
50
|
+
<!-- 为什么推荐这个方案 -->
|
|
51
|
+
|
|
52
|
+
## Success Metrics
|
|
53
|
+
|
|
54
|
+
| 指标 | 当前值 | 目标值 | 测量方法 |
|
|
55
|
+
|------|--------|--------|----------|
|
|
56
|
+
| | | | |
|
|
57
|
+
|
|
58
|
+
## Non-goals
|
|
59
|
+
|
|
60
|
+
<!-- 明确说明这个变更不会做什么。 -->
|
|
61
|
+
|
|
62
|
+
-
|
|
63
|
+
-
|
|
64
|
+
|
|
65
|
+
## Impact Assessment
|
|
66
|
+
|
|
67
|
+
### Affected Components
|
|
68
|
+
|
|
69
|
+
- [ ] 前端组件
|
|
70
|
+
- [ ] 后端 API
|
|
71
|
+
- [ ] 数据模型
|
|
72
|
+
- [ ] 第三方集成
|
|
73
|
+
|
|
74
|
+
### Affected Teams
|
|
75
|
+
|
|
76
|
+
| 团队 | 影响程度 | 通知状态 |
|
|
77
|
+
|------|----------|----------|
|
|
78
|
+
| | | |
|
|
79
|
+
|
|
80
|
+
## Timeline Estimate
|
|
81
|
+
|
|
82
|
+
| 阶段 | 预估工时 |
|
|
83
|
+
|------|----------|
|
|
84
|
+
| Proposal | 0.5d |
|
|
85
|
+
| Design | 1d |
|
|
86
|
+
| Specs | 0.5d |
|
|
87
|
+
| Tasks | 0.5d |
|
|
88
|
+
| Implementation | Xd |
|
|
89
|
+
| **Total** | **Xd** |
|
|
90
|
+
|
|
91
|
+
## Open Questions
|
|
92
|
+
|
|
93
|
+
- [ ] 问题1
|
|
94
|
+
- [ ] 问题2
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
*Next: `openspec continue` to create design.md*
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Spec: {{feature-name}}
|
|
2
|
+
|
|
3
|
+
> Created: {{date}}
|
|
4
|
+
> Based on: design.md
|
|
5
|
+
|
|
6
|
+
## Feature: {{feature-name}}
|
|
7
|
+
|
|
8
|
+
**Description:**
|
|
9
|
+
<!-- 功能描述 -->
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Scenario 1: [场景名称]
|
|
14
|
+
|
|
15
|
+
### Happy Path
|
|
16
|
+
|
|
17
|
+
```gherkin
|
|
18
|
+
Feature: {{feature-name}}
|
|
19
|
+
|
|
20
|
+
Scenario: [成功场景]
|
|
21
|
+
Given [前置条件]
|
|
22
|
+
When [触发动作]
|
|
23
|
+
Then [期望结果]
|
|
24
|
+
|
|
25
|
+
Scenario: [另一个成功场景]
|
|
26
|
+
Given [前置条件]
|
|
27
|
+
And [额外条件]
|
|
28
|
+
When [触发动作]
|
|
29
|
+
Then [期望结果]
|
|
30
|
+
And [额外验证]
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Edge Cases
|
|
34
|
+
|
|
35
|
+
```gherkin
|
|
36
|
+
Scenario: [边界情况]
|
|
37
|
+
Given [边界条件]
|
|
38
|
+
When [触发动作]
|
|
39
|
+
Then [期望处理]
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Error Cases
|
|
43
|
+
|
|
44
|
+
```gherkin
|
|
45
|
+
Scenario: [错误情况]
|
|
46
|
+
Given [错误前置条件]
|
|
47
|
+
When [触发动作]
|
|
48
|
+
Then [错误提示]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Acceptance Criteria
|
|
54
|
+
|
|
55
|
+
- [ ] Given 条件 A,执行操作 B,结果 C
|
|
56
|
+
- [ ] 错误情况正确处理
|
|
57
|
+
- [ ] 边界情况正确处理
|
|
58
|
+
- [ ] 性能符合预期
|
|
59
|
+
|
|
60
|
+
## Test Data
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"testInput": "value",
|
|
65
|
+
"expectedOutput": "expected"
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Notes
|
|
70
|
+
|
|
71
|
+
<!-- 补充说明 -->
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
*Part of change: {{change-name}}*
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Tasks: {{change-name}}
|
|
2
|
+
|
|
3
|
+
> Created: {{date}}
|
|
4
|
+
> Based on: design.md, specs/
|
|
5
|
+
|
|
6
|
+
## Overview
|
|
7
|
+
|
|
8
|
+
**Total Tasks:** X
|
|
9
|
+
**Estimated Time:** X hours
|
|
10
|
+
**Dependencies:** None
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Batch 1: 基础设施
|
|
15
|
+
|
|
16
|
+
**Est:** X min
|
|
17
|
+
|
|
18
|
+
### 1.1 数据模型
|
|
19
|
+
- [ ] 创建 TypeScript 接口
|
|
20
|
+
- 验证:`pnpm typecheck` 通过
|
|
21
|
+
- [ ] 添加类型导出
|
|
22
|
+
- 验证:导入无错误
|
|
23
|
+
|
|
24
|
+
### 1.2 数据库 Schema
|
|
25
|
+
- [ ] 创建 migration 文件
|
|
26
|
+
- 验证:`pnpm db:migrate` 成功
|
|
27
|
+
- [ ] 添加索引
|
|
28
|
+
- 验证:查询计划使用索引
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Batch 2: 核心逻辑
|
|
33
|
+
|
|
34
|
+
**Est:** X min
|
|
35
|
+
|
|
36
|
+
### 2.1 Repository 层
|
|
37
|
+
- [ ] 实现 CRUD 操作
|
|
38
|
+
- 验证:单元测试通过
|
|
39
|
+
- [ ] 添加错误处理
|
|
40
|
+
- 验证:错误场景测试通过
|
|
41
|
+
|
|
42
|
+
### 2.2 Service 层
|
|
43
|
+
- [ ] 实现业务逻辑
|
|
44
|
+
- 验证:单元测试通过
|
|
45
|
+
- [ ] 添加事务支持
|
|
46
|
+
- 验证:回滚测试通过
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Batch 3: API 层
|
|
51
|
+
|
|
52
|
+
**Est:** X min
|
|
53
|
+
|
|
54
|
+
### 3.1 Routes
|
|
55
|
+
- [ ] 创建路由定义
|
|
56
|
+
- 验证:路由注册成功
|
|
57
|
+
- [ ] 添加请求验证
|
|
58
|
+
- 验证:无效请求被拒绝
|
|
59
|
+
|
|
60
|
+
### 3.2 Controllers
|
|
61
|
+
- [ ] 实现控制器方法
|
|
62
|
+
- 验证:API 测试通过
|
|
63
|
+
- [ ] 添加响应格式化
|
|
64
|
+
- 验证:响应结构正确
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Batch 4: 前端集成
|
|
69
|
+
|
|
70
|
+
**Est:** X min
|
|
71
|
+
|
|
72
|
+
### 4.1 API 客户端
|
|
73
|
+
- [ ] 创建 API 函数
|
|
74
|
+
- 验证:类型检查通过
|
|
75
|
+
- [ ] 添加错误处理
|
|
76
|
+
- 验证:错误 UI 显示
|
|
77
|
+
|
|
78
|
+
### 4.2 UI 组件
|
|
79
|
+
- [ ] 创建基础组件
|
|
80
|
+
- 验证:Storybook 渲染
|
|
81
|
+
- [ ] 添加交互逻辑
|
|
82
|
+
- 验证:用户操作响应
|
|
83
|
+
|
|
84
|
+
### 4.3 状态管理
|
|
85
|
+
- [ ] 添加 store slice
|
|
86
|
+
- 验证:状态更新正确
|
|
87
|
+
- [ ] 连接 UI 组件
|
|
88
|
+
- 验证:数据流正确
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Batch 5: 测试与文档
|
|
93
|
+
|
|
94
|
+
**Est:** X min
|
|
95
|
+
|
|
96
|
+
### 5.1 测试
|
|
97
|
+
- [ ] 补充单元测试
|
|
98
|
+
- 验证:覆盖率 > 80%
|
|
99
|
+
- [ ] 添加集成测试
|
|
100
|
+
- 验证:核心流程通过
|
|
101
|
+
- [ ] E2E 测试
|
|
102
|
+
- 验证:用户场景通过
|
|
103
|
+
|
|
104
|
+
### 5.2 文档
|
|
105
|
+
- [ ] 更新 API 文档
|
|
106
|
+
- 验证:文档与实现一致
|
|
107
|
+
- [ ] 更新 README
|
|
108
|
+
- 验证:新功能有说明
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Verification Checklist
|
|
113
|
+
|
|
114
|
+
完成所有任务后验证:
|
|
115
|
+
|
|
116
|
+
- [ ] `pnpm typecheck` 无错误
|
|
117
|
+
- [ ] `pnpm lint` 无错误
|
|
118
|
+
- [ ] `pnpm test` 全部通过
|
|
119
|
+
- [ ] `pnpm build` 成功
|
|
120
|
+
- [ ] 手动测试核心流程
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
*Progress tracked in: task_plan.md, progress.md*
|