specline 1.2.2 → 1.3.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/cli.mjs +240 -11
- package/package.json +1 -1
- package/templates/.cursor/agents/specline-spec-creator.md +23 -5
- package/templates/.cursor/hooks/specline-pipeline-gate-checks/a1-covers-ref.sh +125 -0
- package/templates/.cursor/hooks/specline-pipeline-gate-checks/a2-a3-reverse.sh +171 -0
- package/templates/.cursor/hooks/specline-pipeline-gate-checks/c1-exception.sh +71 -0
- package/templates/.cursor/hooks/specline-pipeline-gate-checks/c2-vague.sh +60 -0
- package/templates/.cursor/hooks/specline-pipeline-gate-checks/common.sh +68 -0
- package/templates/.cursor/hooks/specline-pipeline-gate-checks/d1-cycle.sh +149 -0
- package/templates/.cursor/hooks/specline-pipeline-gate-checks/d3-type-file.sh +260 -0
- package/templates/.cursor/hooks/specline-pipeline-gate.sh +776 -159
- package/templates/.cursor/skills/specline-apply-change/SKILL.md +4 -0
- package/templates/.cursor/skills/specline-pipeline/SKILL.md +25 -1
- package/templates/specline/config.yaml +44 -0
|
@@ -19,6 +19,10 @@ Implement tasks from a Specline change.
|
|
|
19
19
|
> **入口**:`/specline-apply-change [change-name]` 或直接说「继续实现」
|
|
20
20
|
> **流程**:选 change → 读上下文 → 逐任务实现 → 标记完成
|
|
21
21
|
|
|
22
|
+
> ⚠️ **人机门禁策略感知**:当调用方传递了 `HUMAN_GATE_POLICY=minimal` 或 `HUMAN_GATE_POLICY=none` 上下文时,本 Skill 内所有的 `AskUserQuestion` 交互应自动采用默认安全选项:
|
|
23
|
+
> - change 选择 → 若上下文中已有 change name,直接使用;否则取第一个活跃 change
|
|
24
|
+
> - 其他确认交互 → 自动采用默认安全选项继续,不暂停等待人工输入
|
|
25
|
+
|
|
22
26
|
**Fluid Workflow Integration**
|
|
23
27
|
|
|
24
28
|
This skill supports the "actions on a change" model:
|
|
@@ -71,6 +71,20 @@ description: >-
|
|
|
71
71
|
🟡 = Human Gate(人工确认检查点)
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
+
### 人机门禁策略
|
|
75
|
+
|
|
76
|
+
流水线有 3 个人工确认点:HG1(SPEC 确认)、HG2(Review 条件复核)、HG3(归档确认)。通过 `specline/config.yaml` 中的 `pipeline.human_gate_policy` 控制哪些 HG 需要人工确认:
|
|
77
|
+
|
|
78
|
+
| 策略 | HG1 (SPEC确认) | HG2 (Review复核) | HG3 (归档确认) |
|
|
79
|
+
|------|:-------------:|:----------------:|:-------------:|
|
|
80
|
+
| `full`(默认) | 人工确认 | 条件人工复核 | 人工确认 |
|
|
81
|
+
| `minimal` | 自动通过 | 自动通过 | 人工确认 |
|
|
82
|
+
| `none` | 自动通过 | 自动通过 | 自动通过 |
|
|
83
|
+
|
|
84
|
+
**读取方式**:在每个 HG 触发前读取 `specline/config.yaml` 的 `pipeline.human_gate_policy` 字段(通过 grep/yq),若策略指示跳过当前 HG,则直接写入 `.pipeline-state.json` 中对应 `human_gate_N.passed = true`,不调用 `AskUserQuestion`。
|
|
85
|
+
|
|
86
|
+
**子 Agent 确认行为**:当策略为 `minimal` 或 `none` 时,编排者应在派发子 Agent 时传递 `HUMAN_GATE_POLICY=<policy>` 上下文,告知子 Agent 跳过所有 `AskUserQuestion` 交互(如 spec_ambiguity 暂停、skill 级确认等),直接采用默认安全选项继续执行。编排者自身在测试失败处理中的 spec_ambiguity 暂停也应改为记录 WARNING 事件日志后继续。
|
|
87
|
+
|
|
74
88
|
### 入口模式
|
|
75
89
|
|
|
76
90
|
1. **新建流水线**: `/specline-pipeline <自然语言需求>`
|
|
@@ -173,6 +187,8 @@ exit code 0 = 通过,写入 passed。exit code != 0 = 失败,读取 stderr
|
|
|
173
187
|
|
|
174
188
|
#### Step 5: 人工确认 (Human Gate 1) 🟡
|
|
175
189
|
|
|
190
|
+
> **策略判断**:读取 `specline/config.yaml` → `pipeline.human_gate_policy`。若为 `minimal` 或 `none` → 跳过此 HG,直接写入 `human_gate_1.passed = true`,进入 Phase 2。
|
|
191
|
+
|
|
176
192
|
Spec Gate 通过后,使用 `AskUserQuestion` 工具请求确认。展示内容包括:需求提案摘要、功能需求列表、任务拆解概览(含并行组)。
|
|
177
193
|
|
|
178
194
|
> **用户交互规范**:所有需要用户做选择的交互,必须使用 `AskUserQuestion` 工具而非自由文本询问。结构化问题能让 Cursor 在单次请求中完成交互,避免额外轮次。
|
|
@@ -581,6 +597,8 @@ code-review.json 中 unit test 相关的 finding 标注 `type` 为 `"unit_test_q
|
|
|
581
597
|
|
|
582
598
|
#### Step 11: 可选人工复核 (Human Gate 2) 🟡
|
|
583
599
|
|
|
600
|
+
> **策略判断**:读取 `specline/config.yaml` → `pipeline.human_gate_policy`。若为 `minimal` 或 `none` → 跳过此 HG,直接写入 `human_gate_2.passed = true`,进入 Phase 4。
|
|
601
|
+
|
|
584
602
|
仅当 code-review.json 中 warnings > 0 且 errors = 0 时,使用 `AskUserQuestion`:
|
|
585
603
|
|
|
586
604
|
```javascript
|
|
@@ -637,6 +655,8 @@ exit code 全 0 = 通过,进入 Phase 5。失败处理见 [Layer 3: 测试失
|
|
|
637
655
|
|
|
638
656
|
#### Step 14: 归档确认 (Human Gate 3) 🟡
|
|
639
657
|
|
|
658
|
+
> **策略判断**:读取 `specline/config.yaml` → `pipeline.human_gate_policy`。若为 `none` → 跳过此 HG,直接写入 `human_gate_3.passed = true`,执行归档。`minimal` 策略下 HG3 保留人工确认。
|
|
659
|
+
|
|
640
660
|
全部测试通过后,使用 `AskUserQuestion` 请求归档确认:
|
|
641
661
|
|
|
642
662
|
```javascript
|
|
@@ -718,6 +738,8 @@ jq '.phases.coding.gates.build_gate.passed = null' "$STATE_FILE" > tmp && mv tmp
|
|
|
718
738
|
- 回对应 coding agent 修复实现代码或测试代码(最多 2 次循环)
|
|
719
739
|
- `spec_ambiguity`(Spec 模糊)→ **不自动循环修复**,暂停流水线并展示模糊点给用户
|
|
720
740
|
|
|
741
|
+
> **策略判断**:若 `pipeline.human_gate_policy` 为 `minimal` 或 `none` → 不暂停,将 spec_ambiguity 降级为 WARNING 记录到事件日志并继续下一阶段。
|
|
742
|
+
|
|
721
743
|
Gate 重置(仅重置 test_unit_gate):
|
|
722
744
|
|
|
723
745
|
```bash
|
|
@@ -732,6 +754,8 @@ jq '.phases.test.sub_phases.unit.gates.test_unit_gate.passed = null' "$STATE_FIL
|
|
|
732
754
|
- **测试代码问题** → specline-test-writer 自修(最多 2 次)
|
|
733
755
|
- **实现代码问题** → 利用 `Covers` 追溯链定位到具体任务,回对应 coding agent 修复 → **使用影响范围算法精确重置受影响任务的 Gate**
|
|
734
756
|
- **`spec_ambiguity`**(Spec 模糊)→ **不自动循环修复**,暂停流水线并展示模糊点给用户
|
|
757
|
+
|
|
758
|
+
> **策略判断**:若 `pipeline.human_gate_policy` 为 `minimal` 或 `none` → 不暂停,将 spec_ambiguity 降级为 WARNING 记录到事件日志并继续下一阶段。
|
|
735
759
|
- 循环最多 2 次
|
|
736
760
|
|
|
737
761
|
Gate 重置:
|
|
@@ -1029,7 +1053,7 @@ postToolUse → specline-reminder.sh
|
|
|
1029
1053
|
| 1 | **不做判断,只做编排** | 不评估代码质量、需求好坏、测试覆盖——这些由子 Agent 和 Gate 脚本负责 |
|
|
1030
1054
|
| 2 | **所有门禁通过 Gate 脚本** | 调用 `specline-pipeline-gate.sh`,不要自己写 grep/检查逻辑 |
|
|
1031
1055
|
| 3 | **状态文件是唯一真相源** | 所有决策基于 `.pipeline-state.json` 的当前值 |
|
|
1032
|
-
| 4 |
|
|
1056
|
+
| 4 | **人工确认点必须尊重策略** | 根据 `pipeline.human_gate_policy` 配置决定是否暂停,不要无条件跳过或强制暂停 human_gate |
|
|
1033
1057
|
| 5 | **测试 Agent 必须黑盒** | 不给 specline-test-writer 传递源代码文件路径 |
|
|
1034
1058
|
| 6 | **Hook 阻断绝不静默降级** | 子 Agent 被 hook 阻止时,必须先诊断、沟通、修复后重试 |
|
|
1035
1059
|
| 7 | **接受 Hook 约束** | preToolUse/postToolUse/sessionStart Hook 会自动校验和提醒,不要试图绕过 |
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
schema: spec-driven
|
|
2
2
|
|
|
3
|
+
# Specline 项目配置 (config-schema-v1)
|
|
4
|
+
#
|
|
3
5
|
# Project context (optional)
|
|
4
6
|
# This is shown to AI when creating artifacts.
|
|
5
7
|
# Add your tech stack, conventions, style guides, domain knowledge, etc.
|
|
@@ -18,3 +20,45 @@ schema: spec-driven
|
|
|
18
20
|
# - Always include a "Non-goals" section
|
|
19
21
|
# tasks:
|
|
20
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
|