specline 2.0.0 → 2.0.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.
Files changed (43) hide show
  1. package/core/agents/specline-spec-creator.yaml +16 -0
  2. package/core/agents/specline-spec-reviewer.yaml +14 -2
  3. package/core/skills/specline-pipeline/SKILL.md +63 -9
  4. package/lib/merge.mjs +7 -3
  5. package/package.json +1 -1
  6. package/templates/.cursor/README.md +0 -18
  7. package/templates/.cursor/agents/specline-backend-dev.md +0 -47
  8. package/templates/.cursor/agents/specline-code-reviewer.md +0 -110
  9. package/templates/.cursor/agents/specline-config-dev.md +0 -52
  10. package/templates/.cursor/agents/specline-config-reviewer.md +0 -79
  11. package/templates/.cursor/agents/specline-explore-assistant.md +0 -81
  12. package/templates/.cursor/agents/specline-frontend-dev.md +0 -47
  13. package/templates/.cursor/agents/specline-spec-creator.md +0 -376
  14. package/templates/.cursor/agents/specline-spec-reviewer.md +0 -144
  15. package/templates/.cursor/agents/specline-test-runner.md +0 -107
  16. package/templates/.cursor/agents/specline-test-writer.md +0 -170
  17. package/templates/.cursor/hooks/specline-agent-guard.sh +0 -131
  18. package/templates/.cursor/hooks/specline-auto-format.sh +0 -12
  19. package/templates/.cursor/hooks/specline-phase-guard.sh +0 -201
  20. package/templates/.cursor/hooks/specline-pipeline-gate-checks/a1-covers-ref.sh +0 -125
  21. package/templates/.cursor/hooks/specline-pipeline-gate-checks/a2-a3-reverse.sh +0 -171
  22. package/templates/.cursor/hooks/specline-pipeline-gate-checks/c1-exception.sh +0 -71
  23. package/templates/.cursor/hooks/specline-pipeline-gate-checks/c2-vague.sh +0 -60
  24. package/templates/.cursor/hooks/specline-pipeline-gate-checks/common.sh +0 -68
  25. package/templates/.cursor/hooks/specline-pipeline-gate-checks/d1-cycle.sh +0 -149
  26. package/templates/.cursor/hooks/specline-pipeline-gate-checks/d3-type-file.sh +0 -260
  27. package/templates/.cursor/hooks/specline-pipeline-gate.sh +0 -1569
  28. package/templates/.cursor/hooks/specline-reminder.sh +0 -147
  29. package/templates/.cursor/hooks/specline-session-start.sh +0 -259
  30. package/templates/.cursor/hooks/specline-shell-guard.sh +0 -18
  31. package/templates/.cursor/hooks.json +0 -46
  32. package/templates/.cursor/skills/specline-apply-change/SKILL.md +0 -197
  33. package/templates/.cursor/skills/specline-archive-change/SKILL.md +0 -173
  34. package/templates/.cursor/skills/specline-explore/SKILL.md +0 -504
  35. package/templates/.cursor/skills/specline-knowledge/SKILL.md +0 -539
  36. package/templates/.cursor/skills/specline-pipeline/SKILL.md +0 -616
  37. package/templates/.cursor/skills/specline-pipeline/references/error-recovery-details.md +0 -49
  38. package/templates/.cursor/skills/specline-pipeline/references/event-log-spec.md +0 -59
  39. package/templates/.cursor/skills/specline-pipeline/references/pipeline-state-schema.md +0 -87
  40. package/templates/.cursor/skills/specline-pipeline/templates/subagent-prompts.md +0 -253
  41. package/templates/.cursor/skills/specline-propose/SKILL.md +0 -186
  42. package/templates/.cursor/skills/specline-quickfix/SKILL.md +0 -265
  43. package/templates/specline/config.yaml +0 -64
@@ -1,265 +0,0 @@
1
- ---
2
- name: specline-quickfix
3
- description: 轻量修改 Skill —— 小改动用 quickfix,大功能用 pipeline
4
- ---
5
-
6
- # /specline-quickfix 轻量修改 Skill
7
-
8
- ---
9
-
10
- ## Layer 1: 速览与定位
11
-
12
- **一句话定位**:小改动用 quickfix,大功能用 pipeline。
13
-
14
- **入口**:`/specline-quickfix <描述>`
15
-
16
- **你做:**
17
- - 读取相关代码理解上下文
18
- - 直接 Write/StrReplace 编辑文件(不使用子 Agent)
19
- - ReadLints 自动校验 + 修复(最多 2 次循环)
20
- - 运行项目已有单元测试(失败修复最多 2 次循环)
21
- - 生成轻量归档(summary.md + files-changed.json)
22
-
23
- **你不做:**
24
- - 创建 proposal.md、design.md、tasks.md、specs/ 等规划文档
25
- - 启动任何 specline-* 子 Agent
26
- - 创建 `.pipeline-state.json` 或 `.pipeline-sessions.json`
27
- - 写新测试、跑集成/E2E 测试
28
-
29
- ### 流程概览
30
-
31
- ```
32
- UNDERSTAND ──→ IMPLEMENT ──→ REVIEW ──→ TEST ──→ ARCHIVE
33
- (读代码) (直编辑) (Lint+自审) (现有单测) (轻量归档)
34
- ```
35
-
36
- ### Hook 透明
37
-
38
- Quickfix 不绑定 Pipeline session,所有 Hook(sessionStart、preToolUse、postToolUse、subagentStart、beforeShellExecution)自动透明放行,不产生任何拦截或提醒。
39
-
40
- ---
41
-
42
- ## Layer 2: Happy Path
43
-
44
- ### Phase 1: UNDERSTAND
45
-
46
- **目标**:理解变更上下文,明确修改范围。
47
-
48
- **Steps**:
49
-
50
- 1. 解析用户描述,提取关键词(文件名、函数名、错误信息等)
51
- 2. 使用 Read 工具读取相关源文件,理解当前逻辑
52
- 3. 确认变更范围:
53
- - 1-3 个文件 ✓
54
- - 单一关注点 ✓
55
- - 不涉及架构变更 ✓
56
- - 不需要新测试 ✓
57
- 4. **意图模糊时**:使用 AskUserQuestion 向用户确认变更范围和目标,不要猜测
58
-
59
- **准入条件**:变更范围已验证在 quickfix 适用范围内(参见 Layer 3 边界判断)
60
-
61
- ---
62
-
63
- ### Phase 2: IMPLEMENT
64
-
65
- **目标**:直接编辑源文件,完成修改。
66
-
67
- **Steps**:
68
-
69
- 1. 使用 Write / StrReplace 工具直接编辑文件
70
- 2. **不使用子 Agent**,不调用 Task 工具
71
- 3. 编辑完成后,运行 ReadLints 检查新增的 lint 错误
72
-
73
- **约束**:
74
- - 只修改 UNDERSTAND 阶段确认的文件
75
- - 如果发现需要修改第 4 个文件 → 暂停并建议转 `/specline-pipeline`
76
- - 保持现有代码风格和命名约定
77
-
78
- ---
79
-
80
- ### Phase 3: REVIEW
81
-
82
- **目标**:通过 Lint 检查和 Agent 自审确保代码质量。
83
-
84
- **Steps**:
85
-
86
- 1. 运行 ReadLints 收集所有 lint 问题
87
- 2. **如有 lint 错误**:自动修复 → 再次 ReadLints → 最多循环 2 次
88
- - 第 1 次修复后仍有错误 → 分析原因,再次修复
89
- - 第 2 次修复后仍有错误 → 报告用户,附错误列表和修复尝试记录,暂停
90
- 3. **Agent 自审**:
91
- - 变更逻辑是否正确?
92
- - 是否处理了边界条件?
93
- - 是否引入了新问题(如未使用的导入、副作用)?
94
- - 是否破坏现有功能?
95
- 4. 自审通过 → 进入 TEST 阶段
96
-
97
- ---
98
-
99
- ### Phase 4: TEST
100
-
101
- **目标**:运行项目已有单元测试,确保不引入回归。
102
-
103
- **Steps**:
104
-
105
- 1. **自动检测测试框架**:
106
- - 检查 `package.json` scripts → Jest / Mocha / Vitest
107
- - 检查 `pytest` / `go test` / `cargo test` 配置
108
- 2. **有测试配置**:运行现有单元测试
109
- - 通过 → 进入 ARCHIVE 阶段
110
- - 失败 → 分析失败原因,修复代码 → 重新运行 → 最多循环 2 次
111
- - 第 2 次修复后仍失败 → 报告用户(附失败详情和修复尝试记录),暂停
112
- 3. **无测试配置**:跳过 TEST 阶段,进入 ARCHIVE 阶段(在 summary.md 中标注)
113
-
114
- **不运行**:集成测试、E2E 测试、新编写的测试。
115
-
116
- ---
117
-
118
- ### Phase 5: ARCHIVE
119
-
120
- **目标**:生成轻量归档,提供变更可追溯性。
121
-
122
- **Steps**:
123
-
124
- 1. 在 `specline/changes/archive/` 下创建归档目录:
125
- ```
126
- specline/changes/archive/YYYY-MM-DD-<description>/
127
- ├── summary.md
128
- └── files-changed.json
129
- ```
130
- 2. **summary.md** 内容:
131
- ```markdown
132
- # <变更标题>
133
-
134
- ## What
135
- <一句话描述做了什么>
136
-
137
- ## Why
138
- <为什么要做这个修改>
139
-
140
- ## Files Changed
141
- - path/to/file1 — <修改简述>
142
- - path/to/file2 — <修改简述>
143
-
144
- ## Test Result
145
- - 通过 / 跳过(无现有单元测试)/ 失败(附详情)
146
- ```
147
- 3. **files-changed.json** 内容:
148
- ```json
149
- {
150
- "files": ["path/to/file1", "path/to/file2"],
151
- "change_count": 2,
152
- "description": "<变更描述>"
153
- }
154
- ```
155
- 4. 展示变更摘要,**询问用户**:是否需要 git commit?
156
-
157
- **无人确认点**:整个 quickfix 流程不暂停等待人工确认(lint + test 是自动质量底线)。
158
-
159
- ---
160
-
161
- ## Layer 3: 异常与边界
162
-
163
- ### Quickfix vs Pipeline 边界判断
164
-
165
- 使用以下规则判断变更是否适合 quickfix:
166
-
167
- | 维度 | Quickfix (`/specline-quickfix`) | Pipeline (`/specline-pipeline`) |
168
- |------|-------------------------------|-------------------------------|
169
- | 文件改动数 | 1-3 个 | 4+ 个 |
170
- | 关注点 | 单一关注点 | 多关注点/跨模块 |
171
- | 架构变更 | 无新架构/新组件 | 需要新组件/新 API |
172
- | 测试 | 不需要新测试 | 需要写新测试 |
173
- | 典型场景 | 修 bug、改配置、文档微调 | 新增功能、重构 |
174
- | 产出 | summary.md + files-changed.json | proposal/design/tasks/specs + 全部测试 |
175
- | 人工确认 | 0 个 | 3 个 |
176
- | 耗时 | 1-3 分钟 | 10-30 分钟 |
177
-
178
- **边界处理规则**:
179
-
180
- | 异常情况 | 处理方式 |
181
- |----------|----------|
182
- | 变更范围 > 3 个文件 | 暂停,建议转 `/specline-pipeline` |
183
- | 需要写新测试 | 暂停,建议转 `/specline-pipeline` |
184
- | 涉及架构变更/新 API | 暂停,建议转 `/specline-pipeline` |
185
- | Lint 修复 2 次后仍有错误 | 报告用户(附错误列表和修复记录),暂停 |
186
- | 测试失败 2 次后仍失败 | 报告用户(附失败详情和修复记录),暂停 |
187
- | 实现过程中发现需要额外文件 | 如果总数仍 ≤ 3 → 继续;如果 > 3 → 暂停并建议转 pipeline |
188
- | 项目无测试配置 | 跳过 TEST 阶段,在 summary.md 中标注 |
189
-
190
- ### 不适合 Quickfix 的典型场景
191
-
192
- - 新增功能模块(需要 spec/design 规划)
193
- - 跨 3+ 模块的接口变更
194
- - 数据库 schema 变更
195
- - 需要新增测试覆盖的复杂修复
196
- - 需要多人/多步骤协调的改动
197
-
198
- **使用建议**:如果不确定,优先用 quickfix。如果需要更严格的流程保证,用 pipeline。
199
-
200
- ---
201
-
202
- ## Layer 4: 附录
203
-
204
- ### 与 Pipeline 的关系
205
-
206
- ```
207
- specline-pipeline (完整流程) specline-quickfix (轻量流程)
208
- SPEC UNDERSTAND
209
- ↓ ↓
210
- CODING (子 Agent 并发) IMPLEMENT (单 Agent 直编)
211
- ↓ ↓
212
- CODE REVIEW (review Agent) REVIEW (ReadLints + 自审)
213
- ↓ ↓
214
- TEST (unit → integration → e2e) TEST (现有单测 only)
215
- ↓ ↓
216
- ARCHIVE (Delta sync) ARCHIVE (summary + files-changed)
217
- ```
218
-
219
- 两者完全独立,通过边界判断规则选择。不共享状态文件,不互相依赖。
220
-
221
- ### 归档目录结构兼容性
222
-
223
- Quickfix 归档目录结构与 Pipeline 归档保持一致:
224
-
225
- ```
226
- specline/changes/archive/
227
- ├── YYYY-MM-DD-<pipeline-change>/ ← Pipeline 归档
228
- │ ├── proposal.md
229
- │ ├── design.md
230
- │ ├── tasks.md
231
- │ ├── specs/
232
- │ └── ...
233
-
234
- └── YYYY-MM-DD-<quickfix-description>/ ← Quickfix 归档
235
- ├── summary.md
236
- └── files-changed.json
237
- ```
238
-
239
- 两种归档方式共存于同一目录,通过内容区分(Pipeline 归档有 proposal.md 等完整文档,Quickfix 归档只有 summary.md + files-changed.json)。
240
-
241
- ---
242
-
243
- ## Anti-Rationalization 表格
244
-
245
- Quickfix 的极简流程容易让人产生"反正很快,随便点"的心态:
246
-
247
- | 借口 | 现实 |
248
- |------|------|
249
- | "顺便多改一个文件也没事,就一行" | Quickfix 的 1-3 文件边界是防止范围蔓延的最后防线。第 4 个文件应该走 Pipeline。 |
250
- | "不需要 ReadLints,我肉眼确认了" | 人类肉眼无法可靠检测拼写错误、未使用导入、类型不匹配。ReadLints 是自动化底线。 |
251
- | "测试跳过没事,改动很小" | 改动越小越容易有隐性耦合。现有测试套件就是你的回归检测网。 |
252
- | "不用归档了,就是个小修,没记录无所谓" | 不归档意味着不可追溯。三个月后没人记得这个修改是谁做的、为什么做的。 |
253
- | "不用询问用户 git commit,我自己提交了" | Commit 是用户的决定,不是 Agent 的。擅自 commit 剥夺了用户的审查机会。 |
254
-
255
- ## Verification Checklist
256
-
257
- Quickfix 完成后,自查:
258
-
259
- - [ ] UNDERSTAND 阶段确认了变更范围(≤3 文件,单一关注点)
260
- - [ ] IMPLEMENT 阶段只修改了确认的文件,未越界
261
- - [ ] REVIEW 阶段 ReadLints 通过(或 2 次修复后仍有错误已报告)
262
- - [ ] Agent 自审完成:逻辑正确、边界已处理、未引入新问题、未破坏现有功能
263
- - [ ] TEST 阶段现有单元测试全部通过(或已标注跳过原因)
264
- - [ ] ARCHIVE 阶段 summary.md + files-changed.json 已写入归档目录
265
- - [ ] 已询问用户是否需要 git commit
@@ -1,64 +0,0 @@
1
- schema: spec-driven
2
-
3
- # Specline 项目配置 (config-schema-v1)
4
- #
5
- # Project context (optional)
6
- # This is shown to AI when creating artifacts.
7
- # Add your tech stack, conventions, style guides, domain knowledge, etc.
8
- # Example:
9
- # context: |
10
- # Tech stack: TypeScript, React, Node.js
11
- # We use conventional commits
12
- # Domain: e-commerce platform
13
-
14
- # Per-artifact rules (optional)
15
- # Add custom rules for specific artifacts.
16
- # Example:
17
- # rules:
18
- # proposal:
19
- # - Keep proposals under 500 words
20
- # - Always include a "Non-goals" section
21
- # tasks:
22
- # - Break tasks into chunks of max 2 hours
23
-
24
- # Project structure (optional)
25
- # Declares project layout and module configuration.
26
- # When present, Gate scripts use these settings instead of auto-detection.
27
- # When absent, Gates auto-detect by scanning for language marker files (go.mod, package.json, etc.)
28
- #
29
- # Example (monorepo with Go backend + TypeScript frontend):
30
- # project:
31
- # layout: monorepo
32
- # modules:
33
- # - path: backend/
34
- # language: go
35
- # build: go build ./...
36
- # lint: golangci-lint run ./...
37
- # test: go test ./...
38
- # - path: frontend/
39
- # language: typescript
40
- # build: npm run build
41
- # lint: npx eslint .
42
- # test: npx vitest run
43
- #
44
- # Example (single-language project):
45
- # project:
46
- # layout: single
47
- # modules:
48
- # - path: .
49
- # language: python
50
- # build: python -m compileall .
51
- # lint: ruff check .
52
- # test: pytest
53
- #
54
- # Supported languages: go, python, typescript, javascript, rust, java, kotlin
55
- # All fields under modules[] are optional except 'path' and 'language'
56
-
57
- # Pipeline configuration (optional)
58
- # Control the human gate policy for the pipeline.
59
- # - full: All 3 human gates are active (default, current behavior)
60
- # - minimal: Only the archive confirmation (HG3) requires human approval;
61
- # HG1 (SPEC confirm) and HG2 (code review check) are auto-approved
62
- # - none: All human gates are auto-approved (use with caution, primarily for CI/CD)
63
- pipeline:
64
- human_gate_policy: full