kld-sdd 2.4.7
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 +287 -0
- package/bin/kld-sdd-init.js +24 -0
- package/index.js +13 -0
- package/lib/init.js +906 -0
- package/package.json +36 -0
- package/skywalk-sdd/index.js +587 -0
- package/templates/openspec/design.md +290 -0
- package/templates/openspec/overview.md +143 -0
- package/templates/openspec/proposal.md +108 -0
- package/templates/openspec/spec.md +185 -0
- package/templates/openspec/tasks.md +287 -0
- package/templates/opsx-commands/apply.md +420 -0
- package/templates/opsx-commands/archive.md +85 -0
- package/templates/opsx-commands/check.md +344 -0
- package/templates/opsx-commands/design.md +560 -0
- package/templates/opsx-commands/explore.md +89 -0
- package/templates/opsx-commands/propose.md +399 -0
- package/templates/opsx-commands/spec.md +516 -0
- package/templates/opsx-commands/task.md +423 -0
- package/templates/opsx-commands/test.md +207 -0
- package/templates/skills/opsx-apply/SKILL.md +167 -0
- package/templates/skills/opsx-archive/SKILL.md +97 -0
- package/templates/skills/opsx-check/SKILL.md +147 -0
- package/templates/skills/opsx-design/SKILL.md +179 -0
- package/templates/skills/opsx-explore/SKILL.md +99 -0
- package/templates/skills/opsx-propose/SKILL.md +258 -0
- package/templates/skills/opsx-spec/SKILL.md +190 -0
- package/templates/skills/opsx-task/SKILL.md +211 -0
- package/templates/skills/opsx-test/SKILL.md +138 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: opsx-test
|
|
3
|
+
description: "单元测试执行技能 - 自动检测并运行测试用例,输出结构化测试报告"
|
|
4
|
+
argument-hint: "[test-scope] [options]"
|
|
5
|
+
license: MIT
|
|
6
|
+
compatibility: Requires project test framework.
|
|
7
|
+
metadata:
|
|
8
|
+
author: sdd-team
|
|
9
|
+
version: "3.0"
|
|
10
|
+
allowed-tools:
|
|
11
|
+
- Bash
|
|
12
|
+
- Read
|
|
13
|
+
- Write
|
|
14
|
+
- Edit
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
你是一个 SDD(Specification-Driven Development)测试执行专家。激活本技能后,你将自动检测项目测试框架并执行测试,输出结构化报告。
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
> **⚠️ 命令定位**
|
|
21
|
+
>
|
|
22
|
+
> 本技能专注于**单元测试执行**,是 `/opsx:apply` 流程的可选验证环节。
|
|
23
|
+
> - 用户可在完成代码实现后主动调用
|
|
24
|
+
> - 输出标准化测试报告,便于质量追踪
|
|
25
|
+
|
|
26
|
+
> **📊 Telemetry(必做,不得跳过)**
|
|
27
|
+
> - 阶段开始:`node skywalk-sdd/log.js start --command=test --project=<项目根目录绝对路径> --change=<变更名称> --agent=<Agent类型>`(保存 event_id)
|
|
28
|
+
> - 阶段结束:`node skywalk-sdd/log.js end --event-id=<event_id> --result=success|failure --summary="摘要" --project=<项目根目录绝对路径>`
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 技能定位
|
|
33
|
+
|
|
34
|
+
| 维度 | 内容 |
|
|
35
|
+
|------|------|
|
|
36
|
+
| 核心问题 | 代码实现是否通过测试验证 |
|
|
37
|
+
| 关键输出 | 结构化测试报告(通过/失败/覆盖率) |
|
|
38
|
+
| 触发时机 | apply 完成后、用户主动调用 |
|
|
39
|
+
| 支持范围 | 全量/变更相关/指定文件/最近修改 |
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 启动流程
|
|
44
|
+
|
|
45
|
+
### 1. 【交互引导】确认测试范围
|
|
46
|
+
|
|
47
|
+
若未提供 test-scope,使用 **AskUserQuestion** 让用户选择:
|
|
48
|
+
> "请选择测试执行范围:
|
|
49
|
+
> - A. **全量测试** - 运行项目所有测试用例
|
|
50
|
+
> - B. **变更相关** - 仅运行当前变更涉及的测试
|
|
51
|
+
> - C. **指定文件/目录** - 运行指定路径的测试
|
|
52
|
+
> - D. **最近修改** - 运行最近修改文件相关的测试"
|
|
53
|
+
|
|
54
|
+
### 2. 【自动检测】识别项目类型和测试框架
|
|
55
|
+
|
|
56
|
+
**检测项目类型**:
|
|
57
|
+
| 项目标识 | 项目类型 | 测试框架 |
|
|
58
|
+
|---------|----------|----------|
|
|
59
|
+
| `package.json` | Node.js/TypeScript | Jest / Mocha / Vitest |
|
|
60
|
+
| `pom.xml` | Java Maven | JUnit / TestNG |
|
|
61
|
+
| `build.gradle` | Java Gradle | JUnit / TestNG |
|
|
62
|
+
| `requirements.txt` / `pyproject.toml` | Python | pytest / unittest |
|
|
63
|
+
| `go.mod` | Go | go test |
|
|
64
|
+
| `Cargo.toml` | Rust | cargo test |
|
|
65
|
+
| `*.csproj` | C# / .NET | xUnit / NUnit / MSTest |
|
|
66
|
+
|
|
67
|
+
**检测测试文件**:
|
|
68
|
+
| 项目类型 | 测试文件模式 |
|
|
69
|
+
|---------|-------------|
|
|
70
|
+
| TypeScript/JS | `*.test.ts`, `*.spec.ts`, `*.test.js`, `__tests__/` |
|
|
71
|
+
| Java | `src/test/java/**/*Test.java`, `*Tests.java` |
|
|
72
|
+
| Python | `test_*.py`, `*_test.py`, `tests/` |
|
|
73
|
+
| Go | `*_test.go` |
|
|
74
|
+
| Rust | `#[cfg(test)]`, `tests/` |
|
|
75
|
+
|
|
76
|
+
### 3. 确认测试执行计划
|
|
77
|
+
|
|
78
|
+
> "🧪 **测试执行计划**:
|
|
79
|
+
> - 项目类型:[type]
|
|
80
|
+
> - 测试框架:[framework]
|
|
81
|
+
> - 测试文件数:[N]
|
|
82
|
+
> - 预计耗时:[estimate]
|
|
83
|
+
>
|
|
84
|
+
> 确认执行?"
|
|
85
|
+
|
|
86
|
+
### 4. 执行测试
|
|
87
|
+
|
|
88
|
+
根据检测到的框架执行对应命令:
|
|
89
|
+
|
|
90
|
+
| 框架 | 命令 |
|
|
91
|
+
|------|------|
|
|
92
|
+
| Jest | `npx jest --coverage` |
|
|
93
|
+
| Vitest | `npx vitest run --coverage` |
|
|
94
|
+
| pytest | `python -m pytest --cov` |
|
|
95
|
+
| go test | `go test ./... -cover` |
|
|
96
|
+
| JUnit (Maven) | `mvn test` |
|
|
97
|
+
| JUnit (Gradle) | `./gradlew test` |
|
|
98
|
+
|
|
99
|
+
### 5. 输出结构化测试报告
|
|
100
|
+
|
|
101
|
+
> "📊 **测试执行报告**
|
|
102
|
+
>
|
|
103
|
+
> | 指标 | 数值 |
|
|
104
|
+
> |------|------|
|
|
105
|
+
> | 总用例数 | [N] |
|
|
106
|
+
> | 通过 | [passed] ✅ |
|
|
107
|
+
> | 失败 | [failed] ❌ |
|
|
108
|
+
> | 跳过 | [skipped] ⏭ |
|
|
109
|
+
> | 覆盖率 | [coverage]% |
|
|
110
|
+
> | 耗时 | [duration] |
|
|
111
|
+
>
|
|
112
|
+
> **失败用例详情**(如有):
|
|
113
|
+
> | 用例名 | 文件 | 错误信息 |
|
|
114
|
+
> |--------|------|---------|
|
|
115
|
+
> | [name] | [file:line] | [error] |"
|
|
116
|
+
|
|
117
|
+
### 6. 【交互引导】根据结果引导下一步
|
|
118
|
+
|
|
119
|
+
**全部通过**:
|
|
120
|
+
> "✅ 所有测试通过!建议下一步:
|
|
121
|
+
> - A. 继续实施下一个任务
|
|
122
|
+
> - B. 运行 `/opsx:archive` 归档变更"
|
|
123
|
+
|
|
124
|
+
**有失败**:
|
|
125
|
+
> "❌ [N] 个测试失败,请选择:
|
|
126
|
+
> - A. 查看失败详情并修复
|
|
127
|
+
> - B. 忽略失败继续(不推荐)
|
|
128
|
+
> - C. 重新运行指定用例"
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Guardrails
|
|
133
|
+
|
|
134
|
+
- 测试执行前必须确认项目类型和框架
|
|
135
|
+
- 测试失败时提供清晰的错误定位(文件 + 行号)
|
|
136
|
+
- 支持增量测试(只运行变更相关的测试)
|
|
137
|
+
- 测试报告必须结构化、可操作
|
|
138
|
+
- 不自动修复测试失败,引导用户决策
|