@wwkit/harness 1.0.27 → 1.0.28
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/package.json +1 -1
- package/skills/pytest/SKILL.md +38 -30
package/package.json
CHANGED
package/skills/pytest/SKILL.md
CHANGED
|
@@ -11,23 +11,26 @@ metadata:
|
|
|
11
11
|
workflow: sequential
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
# pytest
|
|
14
|
+
# pytest 技能(固定 Sprint 冲刺)
|
|
15
15
|
|
|
16
|
-
##
|
|
16
|
+
## 执行范式
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
- **MUST**:子工作流通过 `read` 加载 `references/xxx.md` 并按其指令执行,**不再调用独立 skill**(原 pytest-* 子 skill 已合并入 references/)。
|
|
18
|
+
每次调用 = 一个固定 Sprint,三个事件:
|
|
19
|
+
|
|
20
|
+
1. **Sprint Planning**:解析入参 → 定义 Sprint Goal → todowrite 落固定 7 项 Sprint Backlog(每项带 DoD)
|
|
21
|
+
2. **Sprint Execution**:7 步 + 双层 loop 逐项执行,每项 = 执行 → 验证 DoD → todowrite 勾单 Done
|
|
22
|
+
3. **Sprint Review**:对照 Sprint Goal 验证 Increment(测试报告)及输出语义,沉淀 1 条回顾
|
|
24
23
|
|
|
25
|
-
|
|
24
|
+
**Sprint Goal** = `对 {{source}} 执行 {{test_type}} 测试,产出测试质量报告(unit 达标 score≥90,integration 达标 score≥70)`。
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
**铁律(最高优先级):**
|
|
27
|
+
|
|
28
|
+
- **没有 Sprint Backlog 不能开始执行**:收到任务消息后,先做 Sprint Planning(解析入参)再 todowrite 落固定 7 项 Sprint Backlog,然后才进入 Sprint Execution。
|
|
29
|
+
- **每项执行周期** = 进度检查(Daily Scrum 映射)→ 执行 → 验证 DoD → 勾单 Done。
|
|
30
|
+
- **子工作流通过 `read` 加载 `references/xxx.md` 并按其指令执行**,**不再调用独立 skill**(原 pytest-* 子 skill 已合并入 references/)。
|
|
31
|
+
- **禁止**:混合测试类型(unit 不混合 integration,反之亦然)。
|
|
32
|
+
- **禁止**:修改 conftest.py(除非直接导致失败)。
|
|
33
|
+
- **禁止**:使用 WebFetch 或任何网络请求。
|
|
31
34
|
|
|
32
35
|
## 配置表(按 test_type 分支)
|
|
33
36
|
|
|
@@ -57,14 +60,7 @@ metadata:
|
|
|
57
60
|
|
|
58
61
|
## 输入参数(自包含)
|
|
59
62
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
- **JSON 对象**:`{test_type, source, test_dir}`,直接取字段值。
|
|
63
|
-
- **key=value**:`test_type=unit, source=src/mymodule`,按 `,` 和 `=` 拆分为字段。
|
|
64
|
-
- **纯文本 prose**:含 "集成/integration" → integration;含 "单元/unit" → unit;默认 unit。`source` 从文本中出现的路径推断。
|
|
65
|
-
- **命令风格**:`unit src/mymodule` 或 `integration src/mymodule tests/integration/mymodule`,第一段为 test_type,第二段为 source,第三段(可选)为 test_dir。
|
|
66
|
-
|
|
67
|
-
字段清单:
|
|
63
|
+
入参为调用方传入的**原始任务消息**,可为 JSON 对象、key=value、自然语言或命令风格等任意形态,agent 依据字段语义自主提取(详见 Step 1)。字段清单:
|
|
68
64
|
|
|
69
65
|
| 字段 | 类型 | 必填 | 说明 |
|
|
70
66
|
|------|------|------|------|
|
|
@@ -72,6 +68,8 @@ metadata:
|
|
|
72
68
|
| source | string | 是 | 源码包目录或 .py 文件路径 |
|
|
73
69
|
| test_dir | string | 否 | 测试目录;未指定时按 `tests/{test_type}/{归一化路径}/` 自动推导 |
|
|
74
70
|
|
|
71
|
+
**提取原则**:从消息中自主识别三个字段——命令风格(`unit src/mymodule` 或 `integration src/mymodule tests/integration/mymodule`,第一段为 test_type,第二段为 source,第三段可选为 test_dir)、JSON 对象(`{test_type, source, test_dir}`)、key=value(`test_type=..., source=...`)、或自然语言(含 "集成/integration" → integration;含 "单元/unit" → unit;默认 unit;`source` 从出现的路径推断)。
|
|
72
|
+
|
|
75
73
|
**必填校验**:若无法解析出 `test_type` 或 `source`,将错误信息输出到 stderr 并结束,**禁止**继续执行。
|
|
76
74
|
|
|
77
75
|
**test_type 校验**:解析后若 `test_type` 不在 `{unit, integration, sample}` 中,输出 "test_type 只能是 unit、integration 或 sample,得到: {value}" 并结束。
|
|
@@ -84,17 +82,19 @@ metadata:
|
|
|
84
82
|
|
|
85
83
|
## 工作流程
|
|
86
84
|
|
|
87
|
-
### 阶段 0:todowrite
|
|
85
|
+
### 阶段 0:todowrite 落单(Sprint Backlog)
|
|
88
86
|
|
|
89
|
-
收到任务消息后,先用 `todowrite`
|
|
87
|
+
收到任务消息后,先用 `todowrite` 创建固定 7 项 Sprint Backlog(status=pending),每项带 DoD:
|
|
90
88
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
89
|
+
| # | 任务 | 对应 Step | DoD |
|
|
90
|
+
|---|------|----------|-----|
|
|
91
|
+
| 1 | 入参校验与目录映射 | Step 1 | test_type/source/test_dir 已校验,target/test_dir/report_dir/flow_start_time 已确定,7 项清单已建 |
|
|
92
|
+
| 2 | 模块适用性评估 | Step 2 | 得到 testable_classes(或为空已按原因退出) |
|
|
93
|
+
| 3 | 环境检查 | Step 3 | 得到 config(或 env-ensure 失败已退出);integration 补充检查已记录警告 |
|
|
94
|
+
| 4 | 覆盖率分析(外层 loop) | Step 4 | 得到 score/uncovered_areas,按退出条件结束或进入下一轮 |
|
|
95
|
+
| 5 | 用例创建 | Step 5 | 得到 new_cases_count(=0 已跳过 execute+fix 直接轮尾评分) |
|
|
96
|
+
| 6 | 测试执行 | Step 6 | 得到通过/失败结果(有失败已进入 Step 7) |
|
|
97
|
+
| 7 | 用例修复(内层 loop) | Step 7 | 得到修复结果,按内层退出条件回到 Step 6 或 Step 4 轮尾评分 |
|
|
98
98
|
|
|
99
99
|
每步完成立即 todowrite 勾单(status=completed)。
|
|
100
100
|
|
|
@@ -502,6 +502,14 @@ integration:
|
|
|
502
502
|
- 内容:上述完整报告(含源码 Bug 汇总)
|
|
503
503
|
- 同时在 chat 中输出报告摘要
|
|
504
504
|
|
|
505
|
+
## Sprint Review
|
|
506
|
+
|
|
507
|
+
所有 Backlog Items 完成后:
|
|
508
|
+
|
|
509
|
+
- **对照 Sprint Goal 验证**:是否对 `{{source}}` 完成 `{{test_type}}` 测试并产出测试质量报告?得分是否达标(unit≥90,integration≥70)?报告是否写入 `report_dir/test_report.md`?
|
|
510
|
+
- **展示 Increment**:测试报告路径 + chat 摘要。
|
|
511
|
+
- **简要回顾(Retrospective)**:沉淀 1 条改进项供下一轮采纳。
|
|
512
|
+
|
|
505
513
|
## 规则
|
|
506
514
|
|
|
507
515
|
**共同规则**:
|