specline 1.0.0 → 1.1.0
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/README.md +48 -12
- package/cli.mjs +403 -10
- package/package.json +5 -1
- package/templates/.cursor/agents/specline-backend-dev.md +1 -1
- package/templates/.cursor/agents/specline-code-reviewer.md +1 -1
- package/templates/.cursor/agents/specline-config-dev.md +52 -0
- package/templates/.cursor/agents/specline-config-reviewer.md +79 -0
- package/templates/.cursor/agents/specline-frontend-dev.md +1 -1
- package/templates/.cursor/agents/specline-test-writer.md +1 -1
- package/templates/.cursor/hooks/specline-agent-guard.sh +113 -5
- package/templates/.cursor/hooks/specline-phase-guard.sh +202 -0
- package/templates/.cursor/hooks/specline-pipeline-gate.sh +5 -2
- package/templates/.cursor/hooks/specline-reminder.sh +139 -0
- package/templates/.cursor/hooks/specline-session-start.sh +134 -0
- package/templates/.cursor/hooks.json +22 -1
- package/templates/.cursor/skills/specline-apply-change/SKILL.md +35 -8
- package/templates/.cursor/skills/specline-archive-change/SKILL.md +39 -4
- package/templates/.cursor/skills/specline-explore/SKILL.md +21 -18
- package/templates/.cursor/skills/specline-pipeline/SKILL.md +311 -184
- package/templates/.cursor/skills/specline-propose/SKILL.md +101 -42
|
@@ -5,75 +5,134 @@ description: >-
|
|
|
5
5
|
直接按内联模板创建全部 Artifact,不依赖外部 CLI。
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
## Layer 1: TL;DR
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
> **一句话**:根据自然语言需求生成完整的 Spec 规划文件。
|
|
11
|
+
> **入口**:`/specline-pipeline <需求>` 或由编排者通过 Task 工具派发
|
|
12
|
+
> **产出**:proposal.md / design.md / tasks.md / spec.md
|
|
13
|
+
> **耗时**:约 30 秒 - 2 分钟
|
|
14
|
+
|
|
15
|
+
**核心流程**:`需求 → 推导 change-name → 创建目录 → 生成 4 Artifact → 自检`
|
|
16
|
+
|
|
17
|
+
**最终生成的文件结构**:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
specline/changes/<change-name>/
|
|
21
|
+
├── proposal.md ← What & Why & Scope
|
|
22
|
+
├── design.md ← Architecture & Decisions
|
|
23
|
+
├── tasks.md ← 实现清单(含依赖 DAG)
|
|
24
|
+
└── specs/
|
|
25
|
+
└── <capability>/
|
|
26
|
+
└── spec.md ← Requirements & Scenarios
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
11
30
|
|
|
12
|
-
|
|
31
|
+
## Layer 2: Happy Path
|
|
13
32
|
|
|
14
|
-
|
|
33
|
+
**Input**: 用户需求描述(自然语言),由编排者传入 change-name。
|
|
15
34
|
|
|
16
|
-
|
|
35
|
+
### Step 1: 理解需求并推导 change name
|
|
17
36
|
|
|
18
|
-
|
|
37
|
+
如果编排者没有传入明确的 change name,从需求描述推导 kebab-case 名称(如 "添加用户登录功能" → `add-user-login`)。
|
|
19
38
|
|
|
20
|
-
|
|
21
|
-
specline-pipeline-gate.sh new --change "<name>"
|
|
22
|
-
```
|
|
39
|
+
### Step 2: 创建 Change 目录
|
|
23
40
|
|
|
24
|
-
|
|
41
|
+
```bash
|
|
42
|
+
specline-pipeline-gate.sh new --change "<name>"
|
|
43
|
+
```
|
|
25
44
|
|
|
26
|
-
|
|
45
|
+
创建 `specline/changes/<name>/` 目录及必要的元数据文件。
|
|
27
46
|
|
|
28
|
-
|
|
29
|
-
|------|----------|------|---------|
|
|
30
|
-
| 1 | proposal.md | `specline/changes/<name>/proposal.md` | What/Why/Scope/Non-goals |
|
|
31
|
-
| 2 | spec.md | `specline/changes/<name>/specs/<capability>/spec.md` | Purpose/Requirements/Scenarios(WHEN/THEN) |
|
|
32
|
-
| 3 | design.md | `specline/changes/<name>/design.md` | Architecture/Decisions/DataFlow |
|
|
33
|
-
| 4 | tasks.md | `specline/changes/<name>/tasks.md` | Type/Depends/Covers/Files 标注 |
|
|
47
|
+
### Step 3: 按顺序生成 4 个 Artifact
|
|
34
48
|
|
|
35
|
-
|
|
49
|
+
| 顺序 | Artifact | 路径 | 内容要点 |
|
|
50
|
+
|------|----------|------|---------|
|
|
51
|
+
| 1 | proposal.md | `specline/changes/<name>/proposal.md` | What/Why/Scope/Non-goals |
|
|
52
|
+
| 2 | spec.md | `specline/changes/<name>/specs/<capability>/spec.md` | Purpose/Requirements/Scenarios(WHEN/THEN) |
|
|
53
|
+
| 3 | design.md | `specline/changes/<name>/design.md` | Architecture/Decisions/DataFlow |
|
|
54
|
+
| 4 | tasks.md | `specline/changes/<name>/tasks.md` | Type/Depends/Covers/Files 标注 |
|
|
36
55
|
|
|
37
|
-
|
|
56
|
+
**每个 Artifact 的创建规则**:
|
|
38
57
|
|
|
39
|
-
|
|
58
|
+
- **proposal.md**:描述 What(做什么)/ Why(为什么做)/ Scope(包含和不包含的范围)/ Impact(影响哪些系统)
|
|
40
59
|
|
|
41
|
-
|
|
60
|
+
- **spec.md**:H1 标题含 "Specification",包含 `## Purpose` 和 `## Requirements`,每个 Requirement 至少 1 个 Scenario,每个 Scenario 含 `**WHEN**`/`**THEN**` 配对,至少覆盖 Happy Path 和 1 个异常场景
|
|
42
61
|
|
|
43
|
-
|
|
44
|
-
- **Type**: frontend | backend | infra | db | config | docs
|
|
45
|
-
- **Depends**: (none) | 依赖的任务编号
|
|
46
|
-
- **Covers**: Requirement: xxx, Scenario: xxx
|
|
47
|
-
- **Files**: 任务涉及的文件路径列表
|
|
62
|
+
- **design.md**:包含 Architecture、Key Design Decisions(每项说明选择理由和替代方案)、Data Flow、组件/模块交互
|
|
48
63
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
64
|
+
- **tasks.md**:每个任务必须标注:
|
|
65
|
+
- **Type**: frontend | backend | infra | db | config | docs
|
|
66
|
+
- **Depends**: (none) | 依赖的任务编号
|
|
67
|
+
- **Covers**: Requirement: xxx, Scenario: xxx
|
|
68
|
+
- **Files**: 任务涉及的文件路径列表
|
|
53
69
|
|
|
54
|
-
|
|
70
|
+
任务拆分原则:
|
|
71
|
+
- 按功能领域垂直拆分(前/后端分开)
|
|
72
|
+
- `Depends: (none)` 占比 ≥ 60%
|
|
73
|
+
- 第 1 批次(无依赖任务)的 Files 集合互不重叠
|
|
55
74
|
|
|
56
|
-
|
|
57
|
-
specline-pipeline-gate.sh artifacts --change "<name>" --json
|
|
58
|
-
```
|
|
75
|
+
> 💡 **并行度自检**:统计 tasks.md 中 `Depends: (none)` 的任务占比 — ≥ 60% 通过,< 60% 则重新拆解(最多 2 次),仍不达标则记录警告。
|
|
59
76
|
|
|
60
|
-
|
|
77
|
+
### Step 4: 验证完整性
|
|
61
78
|
|
|
62
|
-
|
|
79
|
+
```bash
|
|
80
|
+
specline-pipeline-gate.sh artifacts --change "<name>" --json
|
|
81
|
+
```
|
|
63
82
|
|
|
64
|
-
|
|
65
|
-
- ≥ 60% → 通过
|
|
66
|
-
- < 60% → 重新拆解(最多 2 次),仍不达标则记录警告
|
|
83
|
+
确保 proposal/design/tasks/specs 四个文件都已存在。
|
|
67
84
|
|
|
68
|
-
|
|
85
|
+
### Step 5: 输出完成摘要
|
|
69
86
|
|
|
70
|
-
完成摘要:
|
|
71
87
|
- Change 名称和位置
|
|
72
88
|
- 4 个文件生成确认
|
|
73
89
|
- 任务统计(总数 N、独立任务 M、并行度 M/N)
|
|
74
90
|
|
|
75
|
-
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Layer 3: 规范详解
|
|
94
|
+
|
|
95
|
+
### tasks.md 拆分规范
|
|
96
|
+
|
|
97
|
+
✅ **好的任务拆分**:
|
|
98
|
+
|
|
99
|
+
```markdown
|
|
100
|
+
## 1. 数据模型 [x]
|
|
101
|
+
- Type: backend
|
|
102
|
+
- Depends: (none)
|
|
103
|
+
- Files: server/models/user.py
|
|
104
|
+
- Covers: Requirement: 用户数据模型
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
> 任务粒度适中,Files 范围明确,Covers 可追溯到具体 Requirement。
|
|
108
|
+
|
|
109
|
+
❌ **不好的任务拆分**:
|
|
110
|
+
|
|
111
|
+
```markdown
|
|
112
|
+
## 1. 实现后端 [ ]
|
|
113
|
+
- Type: backend
|
|
114
|
+
- Files: server/*.py
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
> 太粗:Files 范围太大,没有 Covers 追溯链,Depends 缺失导致无法判断批次。
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
### 关键原则速查
|
|
122
|
+
|
|
123
|
+
| 原则 | 说明 |
|
|
124
|
+
|------|------|
|
|
125
|
+
| 垂直拆分 | 按功能领域分(前/后端分开),不按技术层分 |
|
|
126
|
+
| 独立可测 | 每个任务可独立验证完成状态 |
|
|
127
|
+
| 文件不交叠 | 第 1 批次(Depends: none)任务的文件集合无交集 |
|
|
128
|
+
| 可追溯 | 每个任务必须通过 Covers 追溯到具体 Requirement/Scenario |
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
### Guardrails
|
|
133
|
+
|
|
76
134
|
- 所有文件直接写入 `specline/changes/<name>/`,不调用外部 CLI
|
|
77
135
|
- 先读已有 dependency 再生成后续文件
|
|
78
136
|
- 需求不明确时用结构化提问(AskUserQuestion)澄清
|
|
79
137
|
- 优先做出合理判断保持节奏,只在关键不清时询问
|
|
138
|
+
- **Hook 阻断不降级**:如果本 Skill 因 `specline-spec-creator` 子 Agent 被 hook 阻止而作为降级方案被调用,必须首先通知用户阻断原因,并尝试诊断修复(参考 specline-pipeline SKILL 中的 Hook 阻断处理规范)。不得在 hook 问题未解决时静默直接执行
|