specline 1.4.0 → 2.0.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 +132 -125
- package/adapters/claude/deploy.json +12 -0
- package/adapters/claude/hooks/hooks.json +12 -0
- package/adapters/claude/hooks.json +12 -0
- package/adapters/claude/orchestration.md +17 -0
- package/adapters/codex/agent.toml.hbs +7 -0
- package/adapters/codex/deploy.json +12 -0
- package/adapters/codex/hooks.json +12 -0
- package/adapters/codex/orchestration.md +18 -0
- package/adapters/cursor/deploy.json +12 -0
- package/adapters/cursor/hooks.json +9 -0
- package/adapters/cursor/orchestration.md +17 -0
- package/adapters/opencode/deploy.json +12 -0
- package/adapters/opencode/orchestration.md +18 -0
- package/adapters/opencode/plugin.js +10 -0
- package/cli.mjs +161 -558
- package/core/agents/specline-backend-dev.yaml +45 -0
- package/core/agents/specline-code-reviewer.yaml +67 -0
- package/core/agents/specline-config-dev.yaml +50 -0
- package/core/agents/specline-config-reviewer.yaml +70 -0
- package/core/agents/specline-explore-assistant.yaml +79 -0
- package/core/agents/specline-frontend-dev.yaml +45 -0
- package/core/agents/specline-spec-creator.yaml +58 -0
- package/core/agents/specline-spec-reviewer.yaml +58 -0
- package/core/agents/specline-test-runner.yaml +62 -0
- package/core/agents/specline-test-writer.yaml +67 -0
- package/core/bootstrap/using-specline.md +14 -0
- package/core/gates/pipeline-gate-checks/a1-covers-ref.sh +125 -0
- package/core/gates/pipeline-gate-checks/a2-a3-reverse.sh +171 -0
- package/core/gates/pipeline-gate-checks/c1-exception.sh +71 -0
- package/core/gates/pipeline-gate-checks/c2-vague.sh +60 -0
- package/core/gates/pipeline-gate-checks/common.sh +68 -0
- package/core/gates/pipeline-gate-checks/d1-cycle.sh +149 -0
- package/core/gates/pipeline-gate-checks/d3-type-file.sh +260 -0
- package/core/gates/pipeline-gate.sh +1456 -0
- package/core/hooks/session-start.sh +259 -0
- package/core/skills/specline-apply-change/SKILL.md +197 -0
- package/core/skills/specline-archive-change/SKILL.md +173 -0
- package/core/skills/specline-explore/SKILL.md +504 -0
- package/core/skills/specline-knowledge/SKILL.md +539 -0
- package/core/skills/specline-pipeline/SKILL.md +604 -0
- package/core/skills/specline-pipeline/references/error-recovery-details.md +49 -0
- package/core/skills/specline-pipeline/references/event-log-spec.md +59 -0
- package/core/skills/specline-pipeline/references/pipeline-state-schema.md +87 -0
- package/core/skills/specline-pipeline/templates/subagent-prompts.md +397 -0
- package/core/skills/specline-propose/SKILL.md +186 -0
- package/core/skills/specline-quickfix/SKILL.md +289 -0
- package/core/templates/AGENTS.md.hbs +5 -0
- package/core/templates/specline/config.yaml +15 -0
- package/lib/deploy-claude.mjs +80 -0
- package/lib/deploy-codex.mjs +77 -0
- package/lib/deploy-opencode.mjs +93 -0
- package/lib/deploy.mjs +668 -0
- package/lib/gate.mjs +103 -0
- package/lib/hash.mjs +13 -0
- package/lib/hook.mjs +105 -0
- package/lib/init.mjs +122 -0
- package/lib/lock.mjs +99 -0
- package/lib/merge.mjs +184 -0
- package/lib/paths.mjs +40 -0
- package/lib/platforms.mjs +74 -0
- package/lib/render-agents.mjs +88 -0
- package/lib/render.mjs +126 -0
- package/lib/sync.mjs +253 -0
- package/lib/tty-select.mjs +89 -0
- package/package.json +4 -1
- package/templates/.cursor/README.md +18 -0
- package/templates/.cursor/agents/specline-code-reviewer.md +18 -2
- package/templates/.cursor/agents/specline-spec-creator.md +51 -2
- package/templates/.cursor/agents/specline-test-runner.md +10 -1
- package/templates/.cursor/agents/specline-test-writer.md +58 -7
- package/templates/.cursor/hooks/specline-pipeline-gate-checks/a2-a3-reverse.sh +1 -1
- package/templates/.cursor/hooks/specline-pipeline-gate.sh +118 -0
- package/templates/.cursor/skills/specline-pipeline/SKILL.md +10 -4
- package/templates/.cursor/skills/specline-propose/SKILL.md +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Specline
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Spec 驱动 AI 编码流水线**,内置确定性质量门禁。
|
|
4
4
|
|
|
5
5
|
自然语言需求 → 自动走完 编写规格 → 编码 → 审查 → 测试 → 归档 全流程:
|
|
6
6
|
|
|
@@ -14,6 +14,21 @@
|
|
|
14
14
|
/specline-quickfix "修复登录按钮样式"
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
整理面向 AI 的项目知识库?一个命令搞定:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
/specline-knowledge
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## 支持平台
|
|
24
|
+
|
|
25
|
+
| 平台 | 状态 | 说明 |
|
|
26
|
+
|------|------|------|
|
|
27
|
+
| **Cursor** | ✅ 完整支持 | Skills + Agents + Hooks 原生集成 |
|
|
28
|
+
| **Claude Code** | ✅ 完整支持 | Skills + Agents + settings.json hooks |
|
|
29
|
+
| **Codex** | ✅ 完整支持 | Skills + TOML Agents + hooks.json |
|
|
30
|
+
| **OpenCode** | ✅ 完整支持 | Skills + Plugin + prompt 内嵌 agents |
|
|
31
|
+
|
|
17
32
|
## 它能做什么
|
|
18
33
|
|
|
19
34
|
**完整流水线**(新功能、重构):
|
|
@@ -38,14 +53,14 @@
|
|
|
38
53
|
## 核心特性
|
|
39
54
|
|
|
40
55
|
- **需求驱动**:自然语言 → 结构化规格文档(Requirements + Scenarios + WHEN/THEN)
|
|
56
|
+
- **跨平台**:同一套 Spec 驱动流水线,适配 Cursor / Claude Code / Codex / OpenCode
|
|
41
57
|
- **并行编码**:自动按前端/后端/config 拆分任务,同批次并发派发 Coding Agent
|
|
42
58
|
- **TDD 白盒测试**:无依赖任务自动启用 TDD 模式(先写单测 → 确认失败 → 最小实现 → 重构),与黑盒 test-writer 并行协作
|
|
43
59
|
- **确定性门禁**:每个阶段用 Shell 脚本的退出码判定是否通过,不做模糊判断
|
|
44
60
|
- **黑盒测试**:测试 Agent 只看 Spec 文档,不能读取任何实现源码
|
|
45
61
|
- **断点续跑**:随时中断,下次从最后一个可信门禁自动恢复(tasks.md 的 `[x]`/`[ ]` 标记进度)
|
|
46
|
-
- **人机协作**:3 个人工检查点——Spec 确认、Review 可选复核、归档确认,支持 `full`/`minimal`/`none`
|
|
47
|
-
- **
|
|
48
|
-
- **安全 Hook**:自动拦截危险 Shell 命令(如 `rm -rf`、`curl|bash`)+ 代码变更后自动格式化
|
|
62
|
+
- **人机协作**:3 个人工检查点——Spec 确认、Review 可选复核、归档确认,支持 `full`/`minimal`/`none` 三级自动化策略配置
|
|
63
|
+
- **AI 知识库**:自动检测、生成、更新六类项目知识文件(术语表/架构/约定/决策/参考/操作指南)
|
|
49
64
|
- **零外部依赖**:不依赖 OpenSpec CLI,全部功能自包含
|
|
50
65
|
|
|
51
66
|
## 快速开始
|
|
@@ -54,44 +69,88 @@
|
|
|
54
69
|
# 全局安装
|
|
55
70
|
npm install -g specline
|
|
56
71
|
|
|
57
|
-
#
|
|
72
|
+
# 在项目中初始化(交互式选择平台)
|
|
58
73
|
cd my-project
|
|
59
74
|
specline init
|
|
60
75
|
|
|
76
|
+
# 指定平台初始化
|
|
77
|
+
specline init --platform cursor
|
|
78
|
+
specline init --platform cursor,claude
|
|
79
|
+
specline init --platform all
|
|
80
|
+
|
|
61
81
|
# 或者用 npx(无需安装)
|
|
62
|
-
npx specline init
|
|
82
|
+
npx specline init --platform cursor
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### `--platform` 参数
|
|
86
|
+
|
|
87
|
+
| 值 | 说明 |
|
|
88
|
+
|----|------|
|
|
89
|
+
| `cursor` | 部署 Cursor IDE 集成(默认) |
|
|
90
|
+
| `claude` | 部署 Claude Code 集成 |
|
|
91
|
+
| `codex` | 部署 Codex 集成 |
|
|
92
|
+
| `opencode` | 部署 OpenCode 集成 |
|
|
93
|
+
| `all` | 部署全部平台 |
|
|
94
|
+
|
|
95
|
+
TTY 环境下不指定 `--platform` 时进入交互式多选界面;非 TTY 环境默认 `cursor`。
|
|
96
|
+
|
|
97
|
+
## Upgrading
|
|
63
98
|
|
|
64
|
-
|
|
65
|
-
|
|
99
|
+
```bash
|
|
100
|
+
# 升级 CLI 到最新版本
|
|
101
|
+
npm update -g specline
|
|
66
102
|
|
|
67
|
-
#
|
|
103
|
+
# 同步项目文件到最新模板
|
|
68
104
|
specline sync
|
|
69
|
-
|
|
105
|
+
|
|
106
|
+
# 预览同步变更(不实际写入)
|
|
107
|
+
specline sync --dry-run
|
|
70
108
|
```
|
|
71
109
|
|
|
72
|
-
|
|
110
|
+
v1 用户升级到 v2 详见 [迁移指南](docs/migration/v1-to-v2.md)。
|
|
111
|
+
|
|
112
|
+
## 架构
|
|
73
113
|
|
|
74
114
|
```
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
│
|
|
80
|
-
│
|
|
81
|
-
│
|
|
82
|
-
│
|
|
83
|
-
│
|
|
84
|
-
│
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
│
|
|
88
|
-
│
|
|
89
|
-
│
|
|
90
|
-
|
|
91
|
-
|
|
115
|
+
specline init --platform <list>
|
|
116
|
+
│
|
|
117
|
+
▼
|
|
118
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
119
|
+
│ core/ ← 平台无关的源文件 │
|
|
120
|
+
│ ├── skills/ ← 7 个 Skill(含模板变量) │
|
|
121
|
+
│ ├── agents/ ← Agent YAML Canonical │
|
|
122
|
+
│ ├── gates/ ← 确定性门禁脚本 │
|
|
123
|
+
│ ├── hooks/ ← SessionStart hook 源 │
|
|
124
|
+
│ └── bootstrap/ ← 通用 bootstrap 文档 │
|
|
125
|
+
├─────────────────────────────────────────────────────────────┤
|
|
126
|
+
│ adapters/<platform>/ ← 平台特定配置 │
|
|
127
|
+
│ ├── deploy.json ← 部署描述(目录/格式/变量) │
|
|
128
|
+
│ ├── hooks.json ← 平台 Hook 配置 │
|
|
129
|
+
│ └── orchestration.md ← 工具映射参考 │
|
|
130
|
+
├─────────────────────────────────────────────────────────────┤
|
|
131
|
+
│ lib/ ← CLI 模块 │
|
|
132
|
+
│ ├── render.mjs ← Skill/Agent 渲染器 │
|
|
133
|
+
│ ├── deploy.mjs ← 单平台部署逻辑 │
|
|
134
|
+
│ ├── lock.mjs ← Lock file v2 读写 │
|
|
135
|
+
│ └── ... │
|
|
136
|
+
└─────────────────────────────────────────────────────────────┘
|
|
137
|
+
│
|
|
138
|
+
▼ 渲染 + 部署
|
|
139
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
140
|
+
│ 项目目录 │
|
|
141
|
+
│ ├── .cursor/ (Cursor) │
|
|
142
|
+
│ ├── .claude/ (Claude Code) │
|
|
143
|
+
│ ├── .agents/ (Codex) │
|
|
144
|
+
│ ├── .opencode/ (OpenCode) │
|
|
145
|
+
│ └── specline/ ← 运行时(跨平台共享) │
|
|
146
|
+
│ ├── config.yaml │
|
|
147
|
+
│ ├── platforms.yaml │
|
|
148
|
+
│ ├── changes/ │
|
|
149
|
+
│ └── bin/gate.sh │
|
|
150
|
+
└─────────────────────────────────────────────────────────────┘
|
|
92
151
|
```
|
|
93
152
|
|
|
94
|
-
|
|
153
|
+
初始化后在对应平台中输入:
|
|
95
154
|
|
|
96
155
|
```
|
|
97
156
|
/specline-pipeline "添加 JWT 用户认证"
|
|
@@ -109,6 +168,12 @@ my-project/
|
|
|
109
168
|
/specline-explore
|
|
110
169
|
```
|
|
111
170
|
|
|
171
|
+
让 AI 理解你的项目:
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
/specline-knowledge
|
|
175
|
+
```
|
|
176
|
+
|
|
112
177
|
## 工作流选择
|
|
113
178
|
|
|
114
179
|
Specline 提供两种工作流,按变更规模选择:
|
|
@@ -136,14 +201,14 @@ PHASE 1: SPEC(规格)
|
|
|
136
201
|
├── design.md — 技术设计(架构/数据流/决策)
|
|
137
202
|
└── tasks.md — 任务清单(Type/Depends/Covers/Testable/Files + [ ] 进度标记)
|
|
138
203
|
→ specline-spec-reviewer 审核
|
|
139
|
-
→ Gate: grep + jq 格式校验 + semantic
|
|
140
|
-
→ 🟡 人工确认 Spec
|
|
204
|
+
→ Gate: grep + jq 格式校验 + semantic 语义检查
|
|
205
|
+
→ 🟡 人工确认 Spec 和任务规划
|
|
141
206
|
|
|
142
207
|
PHASE 2: CODING(编码)
|
|
143
208
|
解析 tasks.md → 按依赖 DAG 分层 → 同批次前后端/config Agent 并发
|
|
144
209
|
无依赖 + 可测试任务 → 自动启用 TDD 模式(RED-GREEN-REFACTOR)
|
|
145
210
|
每完成一个任务,[ ] 自动标记为 [x]
|
|
146
|
-
→ Gate:
|
|
211
|
+
→ Gate: 编译检查 + 单元测试文件存在性检查
|
|
147
212
|
|
|
148
213
|
PHASE 3: REVIEW(审查)
|
|
149
214
|
specline-code-reviewer + specline-config-reviewer 分别审查代码和配置/文档
|
|
@@ -151,98 +216,54 @@ PHASE 3: REVIEW(审查)
|
|
|
151
216
|
|
|
152
217
|
PHASE 4: TEST(测试)
|
|
153
218
|
单元测试 → 集成测试 → E2E 测试(黑盒,只看 Spec)
|
|
154
|
-
→
|
|
155
|
-
→ 失败自动分析:测试写错了 / 代码写错了 / Spec 模糊
|
|
156
|
-
→ 自动重试最多 2 次
|
|
219
|
+
→ 失败自动分析 + 自动重试最多 2 次
|
|
157
220
|
|
|
158
221
|
PHASE 5: ARCHIVE(归档)
|
|
159
|
-
→ 🟡
|
|
222
|
+
→ 🟡 人工确认归档
|
|
160
223
|
→ delta specs 合并到主规格目录
|
|
161
224
|
→ 按日期归档到 specline/changes/archive/
|
|
162
225
|
✅ 完成
|
|
163
|
-
|
|
164
|
-
### TDD 白盒测试
|
|
165
|
-
|
|
166
|
-
Pipeline 采用「两层测试分离」架构:
|
|
167
|
-
|
|
168
|
-
```
|
|
169
|
-
Coding Agent(白盒 TDD) Test-Writer(黑盒)
|
|
170
|
-
───────────────────────── ─────────────────
|
|
171
|
-
产出: tests/unit/** 产出: tests/integration/**
|
|
172
|
-
tests/models/** tests/e2e/**
|
|
173
|
-
测试: 单个函数的输入输出 测试: 跨模块的用户行为
|
|
174
|
-
边界条件、异常路径 API 端到端契约
|
|
175
|
-
Spec Scenario 全覆盖
|
|
176
|
-
触发: 编码时同步产出 触发: Phase 2 与 Coding 并行启动
|
|
177
|
-
先写测试 → 确认失败 → 写实现 只读 Spec,不读源码
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
tasks.md 中 `Testable: true` 的任务自动启用 TDD 模式(完整 RED-GREEN-REFACTOR 循环),`Testable: false` 的任务保持原有流程。两个测试域严格目录隔离,冲突检测自动识别越界。
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
## 轻量修复流程
|
|
184
|
-
|
|
185
|
-
```
|
|
186
|
-
PHASE 1: UNDERSTAND(理解)
|
|
187
|
-
读取相关代码 → 理解上下文 → 意图模糊时 AskUserQuestion 确认
|
|
188
|
-
|
|
189
|
-
PHASE 2: IMPLEMENT(实现)
|
|
190
|
-
直接 Write/StrReplace 编辑 1-3 个文件
|
|
191
|
-
不需要 Spec 文档、DAG 构建、批次调度
|
|
192
|
-
|
|
193
|
-
PHASE 3: REVIEW(审查)
|
|
194
|
-
ReadLints 检查 + 自动修复(最多 2 次)→ Agent 自审逻辑正确性
|
|
195
|
-
|
|
196
|
-
PHASE 4: TEST(测试)
|
|
197
|
-
仅运行项目已有单元测试,无测试则跳过
|
|
198
|
-
失败自动修复最多 2 次
|
|
199
|
-
|
|
200
|
-
PHASE 5: ARCHIVE(归档)
|
|
201
|
-
生成 summary.md + files-changed.json → 询问是否 git commit
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
## 架构
|
|
205
|
-
|
|
206
|
-
```
|
|
207
|
-
/specline-pipeline ← 完整流水线(大功能) /specline-quickfix ← 轻量修复(小改动)
|
|
208
|
-
│ │
|
|
209
|
-
▼ ▼
|
|
210
|
-
specline-pipeline SKILL ← 编排层 编排者直接执行(无子 Agent)
|
|
211
|
-
│ Read → Write → ReadLints → Shell → 归档
|
|
212
|
-
├── SKILL.md 核心编排指令(~500 行)
|
|
213
|
-
├── templates/ subagent-prompts.md(3 套 prompt 模板)
|
|
214
|
-
└── references/ Schema / 事件日志 / 约束参考文档
|
|
215
|
-
│
|
|
216
|
-
┌───┼──────────────────┬──────────────────────┐
|
|
217
|
-
▼ ▼ ▼ ▼
|
|
218
|
-
9 个子 Agent specline-pipeline- Cursor Hooks
|
|
219
|
-
(创造性工作) gate.sh (安全网 + 约束)
|
|
220
|
-
(确定性门禁)
|
|
221
226
|
```
|
|
222
227
|
|
|
223
228
|
## CLI 命令
|
|
224
229
|
|
|
225
230
|
| 命令 | 说明 |
|
|
226
231
|
|------|------|
|
|
227
|
-
| `specline init [
|
|
228
|
-
| `specline
|
|
229
|
-
| `specline
|
|
230
|
-
| `specline --
|
|
232
|
+
| `specline init [--platform <list>]` | 初始化 Specline 项目,支持多平台部署 |
|
|
233
|
+
| `specline sync [--dry-run] [--platform <list>]` | 同步模板文件到最新版本 |
|
|
234
|
+
| `specline gate <subcommand>` | Gate 门禁 CLI 包装(spec/build/lint/test/list) |
|
|
235
|
+
| `specline hook session-start [--platform <p>]` | 跨平台 SessionStart hook |
|
|
236
|
+
| `specline platforms` | 查看已部署平台列表 |
|
|
237
|
+
| `specline update` | 检查 CLI 新版本 |
|
|
238
|
+
| `specline --version` | 显示版本号 |
|
|
231
239
|
| `specline --help` | 显示帮助信息 |
|
|
232
240
|
|
|
233
241
|
## 子 Agent 列表
|
|
234
242
|
|
|
235
243
|
| Agent | 职责 |
|
|
236
244
|
|-------|------|
|
|
237
|
-
| `specline-spec-creator` |
|
|
245
|
+
| `specline-spec-creator` | 根据自然语言需求生成 proposal/design/tasks/spec |
|
|
238
246
|
| `specline-spec-reviewer` | 审核规格的完整性、一致性和覆盖度 |
|
|
239
|
-
| `specline-frontend-dev` | UI
|
|
240
|
-
| `specline-backend-dev` | API
|
|
241
|
-
| `specline-config-dev` | Shell
|
|
242
|
-
| `specline-code-reviewer` |
|
|
243
|
-
| `specline-config-reviewer` | Shell
|
|
244
|
-
| `specline-test-writer` |
|
|
245
|
-
| `specline-test-runner` |
|
|
247
|
+
| `specline-frontend-dev` | UI 组件、页面、样式、交互逻辑 |
|
|
248
|
+
| `specline-backend-dev` | API 端点、数据模型、业务逻辑 |
|
|
249
|
+
| `specline-config-dev` | Shell 脚本、配置文件、Markdown 文档 |
|
|
250
|
+
| `specline-code-reviewer` | 代码质量、安全性、可维护性审查 |
|
|
251
|
+
| `specline-config-reviewer` | 配置文件语法、Shell 脚本安全性审查 |
|
|
252
|
+
| `specline-test-writer` | 黑盒测试编写(只看 Spec 不读源码) |
|
|
253
|
+
| `specline-test-runner` | 执行测试并分类失败原因 |
|
|
254
|
+
| `specline-explore-assistant` | 设计压力测试,辅助探索模式 |
|
|
255
|
+
|
|
256
|
+
## Skills 列表
|
|
257
|
+
|
|
258
|
+
| Skill | 入口 | 说明 |
|
|
259
|
+
|-------|------|------|
|
|
260
|
+
| `specline-pipeline` | `/specline-pipeline <需求>` | 完整开发流水线编排 |
|
|
261
|
+
| `specline-quickfix` | `/specline-quickfix <描述>` | 轻量修复(1-3 文件) |
|
|
262
|
+
| `specline-propose` | 由 pipeline 调度 | 生成 Spec 规划文件 |
|
|
263
|
+
| `specline-apply-change` | 由 pipeline 调度 | 执行 tasks.md 中的任务 |
|
|
264
|
+
| `specline-explore` | `/specline-explore` | 探索模式,思考伙伴 |
|
|
265
|
+
| `specline-archive-change` | 由 pipeline 调度 | 归档完成的 Change |
|
|
266
|
+
| `specline-knowledge` | `/specline-knowledge` | AI 知识库管理 |
|
|
246
267
|
|
|
247
268
|
## 确定性门禁
|
|
248
269
|
|
|
@@ -250,34 +271,20 @@ specline-pipeline SKILL ← 编排层 编排者直接执行(
|
|
|
250
271
|
|
|
251
272
|
| 门禁 | 检查内容 |
|
|
252
273
|
|------|---------|
|
|
253
|
-
| Spec |
|
|
254
|
-
| Build |
|
|
255
|
-
| Lint |
|
|
274
|
+
| Spec | 结构性检查 + 语义检查(Covers 引用悬空、依赖环路、异常场景缺失、模糊需求) |
|
|
275
|
+
| Build | 编译检查 + Testable 任务单元测试文件存在性 |
|
|
276
|
+
| Lint | Linter 退出码 + code-review.json error 数量 |
|
|
256
277
|
| Test | 测试框架退出码 + 覆盖率阈值 |
|
|
257
278
|
| Archive | 归档目录结构 + 必要文件完整性 |
|
|
258
279
|
|
|
259
|
-
## Hook 约束体系
|
|
260
|
-
|
|
261
|
-
Specline 通过 Cursor Hooks 构建三层约束,确保长对话中 Agent 始终遵循流水线的阶段逻辑:
|
|
262
|
-
|
|
263
|
-
| Hook | 时机 | 作用 |
|
|
264
|
-
|------|------|------|
|
|
265
|
-
| `sessionStart` | 新会话启动 | 扫描活跃 pipeline,自动注入阶段上下文到 Agent 系统提示 |
|
|
266
|
-
| `preToolUse` | 工具调用前 | 阶段校验:SPEC 阶段拦截代码编辑、阶段不匹配的子 Agent 启动 |
|
|
267
|
-
| `postToolUse` | 工具调用后 | 注入下一步提醒:更新 tasks.md checkbox、运行 Gate 脚本 |
|
|
268
|
-
| `subagentStart` | 子 Agent 启动前 | 白名单 + 阶段匹配双校验 |
|
|
269
|
-
| `beforeShellExecution` | Shell 命令执行前 | 拦截危险命令(`rm -rf`、`curl\|bash`、`sudo`) |
|
|
270
|
-
| `afterFileEdit` | 文件编辑后 | 自动格式化代码 |
|
|
271
|
-
|
|
272
|
-
> 非流水线会话完全透明——所有 Hook 第一步检查「是否有活跃 pipeline」,无则直接放行。
|
|
273
|
-
|
|
274
280
|
## 环境要求
|
|
275
281
|
|
|
276
|
-
- **
|
|
282
|
+
- **Node.js** >= 20.0.0
|
|
277
283
|
- **jq**(Gate 脚本 JSON 处理)
|
|
278
284
|
- macOS 预装
|
|
279
285
|
- Linux: `apt install jq`
|
|
280
286
|
- Windows: `choco install jq`
|
|
287
|
+
- **支持的 AI 编码平台**(至少一个):Cursor / Claude Code / Codex / OpenCode
|
|
281
288
|
|
|
282
289
|
## License
|
|
283
290
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"platform": "claude",
|
|
3
|
+
"skills_dir": ".claude/skills",
|
|
4
|
+
"agents_dir": ".claude/agents",
|
|
5
|
+
"agent_format": "md",
|
|
6
|
+
"hooks_file": ".claude/settings.json",
|
|
7
|
+
"vars": {
|
|
8
|
+
"DISPATCH": "使用 Agent 工具派发 {{ROLE}} 角色",
|
|
9
|
+
"CONFIRM": "在对话中向用户提问确认",
|
|
10
|
+
"LINT": "运行 linter 命令检查"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Claude Code Orchestration Reference
|
|
2
|
+
|
|
3
|
+
## Tool Mapping
|
|
4
|
+
|
|
5
|
+
| Specline 抽象 | Claude Code 工具 |
|
|
6
|
+
|--------------|-----------------|
|
|
7
|
+
| 派发子 Agent | Agent 工具 / plugin agents |
|
|
8
|
+
| 用户确认 | 对话中提问 |
|
|
9
|
+
| Lint 检查 | bash 命令执行 linter |
|
|
10
|
+
| 文件读取 | Read |
|
|
11
|
+
| 文件编辑 | Write / Edit |
|
|
12
|
+
| Shell 执行 | bash |
|
|
13
|
+
| 搜索 | grep / find |
|
|
14
|
+
|
|
15
|
+
## Notes
|
|
16
|
+
- Claude Code 支持项目级 agents(.claude/agents/*.md)
|
|
17
|
+
- Hook 通过 .claude/settings.json 的 hooks 段配置
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"platform": "codex",
|
|
3
|
+
"skills_dir": ".agents/skills",
|
|
4
|
+
"agents_dir": ".agents/agents",
|
|
5
|
+
"agent_format": "toml",
|
|
6
|
+
"hooks_file": ".codex/hooks.json",
|
|
7
|
+
"vars": {
|
|
8
|
+
"DISPATCH": "spawn {{ROLE}} agent with prompt:",
|
|
9
|
+
"CONFIRM": "在对话中向用户提问确认",
|
|
10
|
+
"LINT": "运行 linter 命令检查"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Codex Orchestration Reference
|
|
2
|
+
|
|
3
|
+
## Tool Mapping
|
|
4
|
+
|
|
5
|
+
| Specline 抽象 | Codex 工具 |
|
|
6
|
+
|--------------|-----------|
|
|
7
|
+
| 派发子 Agent | spawn named agent / subagent |
|
|
8
|
+
| 用户确认 | 对话 / CLI prompt |
|
|
9
|
+
| Lint 检查 | bash 命令执行 linter |
|
|
10
|
+
| 文件读取 | read |
|
|
11
|
+
| 文件编辑 | apply_patch |
|
|
12
|
+
| Shell 执行 | bash |
|
|
13
|
+
| 搜索 | grep / glob |
|
|
14
|
+
|
|
15
|
+
## Notes
|
|
16
|
+
- Codex 支持 named agents(.agents/agents/*.toml)
|
|
17
|
+
- Skills 自动扫描 .agents/skills/ 目录
|
|
18
|
+
- SubagentStart 不能 deny,阶段约束靠 Skill + Gate
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"platform": "cursor",
|
|
3
|
+
"skills_dir": ".cursor/skills",
|
|
4
|
+
"agents_dir": ".cursor/agents",
|
|
5
|
+
"agent_format": "md",
|
|
6
|
+
"hooks_file": ".cursor/hooks.json",
|
|
7
|
+
"vars": {
|
|
8
|
+
"DISPATCH": "使用 Task 工具,subagent_type=\"{{ROLE}}\"",
|
|
9
|
+
"CONFIRM": "使用 AskUserQuestion 工具",
|
|
10
|
+
"LINT": "使用 ReadLints 工具"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Cursor Orchestration Reference
|
|
2
|
+
|
|
3
|
+
## Tool Mapping
|
|
4
|
+
|
|
5
|
+
| Specline 抽象 | Cursor 工具 |
|
|
6
|
+
|--------------|------------|
|
|
7
|
+
| 派发子 Agent | `Task(subagent_type="<role>")` |
|
|
8
|
+
| 用户确认 | `AskUserQuestion` |
|
|
9
|
+
| Lint 检查 | `ReadLints` |
|
|
10
|
+
| 文件读取 | `Read` |
|
|
11
|
+
| 文件编辑 | `Write` / `StrReplace` |
|
|
12
|
+
| Shell 执行 | `Shell` |
|
|
13
|
+
| 搜索 | `Grep` / `Glob` |
|
|
14
|
+
|
|
15
|
+
## Notes
|
|
16
|
+
- Cursor 支持命名 subagent 类型,直接映射到 .cursor/agents/*.md
|
|
17
|
+
- SessionStart hook 通过 .cursor/hooks.json 配置
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"platform": "opencode",
|
|
3
|
+
"skills_dir": ".opencode/skills",
|
|
4
|
+
"agents_dir": null,
|
|
5
|
+
"agent_format": null,
|
|
6
|
+
"hooks_file": null,
|
|
7
|
+
"vars": {
|
|
8
|
+
"DISPATCH": "使用 task(subagent_type=\"general\") 并在 prompt 中内嵌 {{ROLE}} 的 instructions",
|
|
9
|
+
"CONFIRM": "在对话中向用户提问确认",
|
|
10
|
+
"LINT": "运行 linter 命令检查"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# OpenCode Orchestration Reference
|
|
2
|
+
|
|
3
|
+
## Tool Mapping
|
|
4
|
+
|
|
5
|
+
| Specline 抽象 | OpenCode 工具 |
|
|
6
|
+
|--------------|--------------|
|
|
7
|
+
| 派发子 Agent | task(subagent_type="general") + prompt 内嵌 |
|
|
8
|
+
| 用户确认 | 对话中提问 |
|
|
9
|
+
| Lint 检查 | bash 命令执行 linter |
|
|
10
|
+
| 文件读取 | read |
|
|
11
|
+
| 文件编辑 | apply_patch |
|
|
12
|
+
| Shell 执行 | bash |
|
|
13
|
+
| 搜索 | grep / glob |
|
|
14
|
+
|
|
15
|
+
## Notes
|
|
16
|
+
- OpenCode 无命名 subagent 类型,role instructions 内嵌在 prompt 中
|
|
17
|
+
- Skills 通过 plugin.js 注册 .opencode/skills/ 路径
|
|
18
|
+
- Bootstrap 通过 experimental.chat.messages.transform hook 注入
|