@modus-ai/modus 0.2.4 → 0.2.6
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 +100 -42
- package/dist/cli/index.js +2 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +9 -8
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/global.js +1 -1
- package/dist/commands/global.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +37 -7
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/status.js +2 -2
- package/dist/generators/claude.d.ts.map +1 -1
- package/dist/generators/claude.js +1 -37
- package/dist/generators/claude.js.map +1 -1
- package/dist/generators/codebuddy.d.ts.map +1 -1
- package/dist/generators/codebuddy.js +3 -1
- package/dist/generators/codebuddy.js.map +1 -1
- package/dist/generators/codex.d.ts +10 -0
- package/dist/generators/codex.d.ts.map +1 -0
- package/dist/generators/codex.js +178 -0
- package/dist/generators/codex.js.map +1 -0
- package/dist/generators/copilot.d.ts.map +1 -1
- package/dist/generators/copilot.js +0 -1
- package/dist/generators/copilot.js.map +1 -1
- package/dist/generators/cursor.d.ts.map +1 -1
- package/dist/generators/cursor.js +36 -7
- package/dist/generators/cursor.js.map +1 -1
- package/dist/generators/custom.d.ts +55 -0
- package/dist/generators/custom.d.ts.map +1 -0
- package/dist/generators/custom.js +166 -0
- package/dist/generators/custom.js.map +1 -0
- package/dist/generators/index.d.ts +1 -0
- package/dist/generators/index.d.ts.map +1 -1
- package/dist/generators/index.js +10 -0
- package/dist/generators/index.js.map +1 -1
- package/dist/utils/config.d.ts +38 -1
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +10 -2
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/file-system.d.ts.map +1 -1
- package/dist/utils/file-system.js +2 -1
- package/dist/utils/file-system.js.map +1 -1
- package/package.json +1 -1
- package/schemas/harness-schema.yaml +178 -53
- package/schemas/knowledge-schema.yaml +111 -1
- package/templates/agents/modus-analyst.md +1 -1
- package/templates/behavior-guard.md +165 -0
- package/templates/commands/auto.md +61 -25
- package/templates/commands/commit.md +63 -0
- package/templates/commands/harness.md +97 -30
- package/templates/commands/init.md +43 -10
- package/templates/commands/modus.md +55 -28
- package/templates/commands/plan.md +60 -18
- package/templates/commands/spec.md +69 -25
- package/templates/commands/upgrade.md +54 -0
- package/templates/commands/vibe.md +56 -6
- package/templates/knowledge-catalog.md +74 -32
- package/templates/skills/modus-agents/analyst/SKILL.md +18 -3
- package/templates/skills/modus-agents/deployer/SKILL.md +114 -62
- package/templates/skills/modus-agents/designer/SKILL.md +104 -92
- package/templates/skills/modus-agents/developer/SKILL.md +107 -66
- package/templates/skills/modus-agents/perf-auditor/SKILL.md +98 -61
- package/templates/skills/modus-agents/reviewer/SKILL.md +61 -11
- package/templates/skills/modus-agents/security-auditor/SKILL.md +111 -67
- package/templates/skills/modus-agents/skill-creator/SKILL.md +30 -12
- package/templates/skills/modus-agents/tester/SKILL.md +100 -54
- package/templates/skills/modus-auto/SKILL.md +581 -109
- package/templates/skills/modus-design-brief/SKILL.md +45 -19
- package/templates/skills/modus-harness/SKILL.md +150 -85
- package/templates/skills/modus-init/SKILL.md +1145 -319
- package/templates/skills/modus-plan/SKILL.md +125 -48
- package/templates/skills/modus-platform/SKILL.md +271 -0
- package/templates/skills/modus-spec/SKILL.md +175 -331
- package/templates/skills/modus-vibe/SKILL.md +256 -55
|
@@ -13,7 +13,7 @@ disable: false
|
|
|
13
13
|
|
|
14
14
|
## 职责
|
|
15
15
|
|
|
16
|
-
从项目代码和工作流产物中提炼业务知识,生成或更新标准格式的 Skill 文件(
|
|
16
|
+
从项目代码和工作流产物中提炼业务知识,生成或更新标准格式的 Skill 文件(v3/17节,当前默认),并维护知识全景目录(`knowledge-catalog.md`)。支持五种调用模式,覆盖从初始化到持续积累的完整知识生命周期。
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
@@ -21,7 +21,7 @@ disable: false
|
|
|
21
21
|
|
|
22
22
|
### 模式 A:全量初始化(来自 /modus:init)
|
|
23
23
|
|
|
24
|
-
为每个确认的业务域从零生成 `modus-biz-{domain}/SKILL.md`,初始 `status: draft`,`format_version:
|
|
24
|
+
为每个确认的业务域从零生成 `modus-biz-{domain}/SKILL.md`,初始 `status: draft`,`format_version: v3`(17节标准格式,详见 modus-init SKILL 区块 C)。
|
|
25
25
|
|
|
26
26
|
### 模式 B:增量更新(来自 /plan 或 /spec 前置,含 hash 快速检查)
|
|
27
27
|
|
|
@@ -46,8 +46,12 @@ disable: false
|
|
|
46
46
|
**hash 检查(防腐校验通过后执行):**
|
|
47
47
|
|
|
48
48
|
```bash
|
|
49
|
-
#
|
|
50
|
-
|
|
49
|
+
# 标准全局 hash 计算命令(必须与 modus-init 区块 B、modus-plan Step 4-2 使用完全相同的算法)
|
|
50
|
+
# 算法:按文件路径排序 → 输出 "SHA-1:文件路径" 字符串 → 整体再 hash
|
|
51
|
+
# 禁止使用「仅 hash 值排序 hash」或「内容拼接整体 hash」的替代算法
|
|
52
|
+
for f in $(echo "{key_files}" | tr ' ' '\n' | sort); do
|
|
53
|
+
echo "$(shasum -a 1 "$f" | awk '{print $1}'):$f"
|
|
54
|
+
done | shasum -a 1 | awk '{print $1}'
|
|
51
55
|
```
|
|
52
56
|
|
|
53
57
|
**对比结果分级处理:**
|
|
@@ -84,16 +88,16 @@ Step B-10-6:触发跨域联动提示(检查引用了本域的其他 Skill,
|
|
|
84
88
|
### 模式 C:后置回写(来自 /plan、/spec 归档后)
|
|
85
89
|
|
|
86
90
|
将本次工作中新确立的决策、规则、接口契约追加或更新到对应 Skill 文件。
|
|
87
|
-
从产出物(design.md、specs/*/spec.md)提取带类型标签的知识:
|
|
91
|
+
从产出物(design-brief.md、specs/*/spec.md)提取带类型标签的知识:
|
|
88
92
|
- delta spec 的 ADDED Requirements → `[process]` / `[model]` 追加到业务 Skill
|
|
89
93
|
- delta spec 的 MODIFIED Requirements → 更新对应 `[guideline]`
|
|
90
|
-
- design.md 的架构决策章节 → `[decision]` 追加到对应业务 Skill 或 modus-tech-wiki
|
|
94
|
+
- design-brief.md 的架构决策章节 → `[decision]` 追加到对应业务 Skill 或 modus-tech-wiki
|
|
91
95
|
|
|
92
96
|
### 模式 D:知识提取(来自 Harness ARCHIVE 阶段)
|
|
93
97
|
|
|
94
98
|
从 Harness 全流程产物中系统性提取知识条目,判断提升路径,写回 Skill 并更新 catalog。
|
|
95
99
|
|
|
96
|
-
**输入产物:** `01-analysis.md`、`02-sprint-contract.md`、`cr-report.md`、`07-deploy-status.md`
|
|
100
|
+
**输入产物:** `01-analysis.md`、`02-sprint-contract.md`、`03-test-report.md`、`04-perf-report.md`、`05-security-report.md`、`cr-report.md`、`07-deploy-status.md`
|
|
97
101
|
|
|
98
102
|
**提取规则:**
|
|
99
103
|
|
|
@@ -101,9 +105,17 @@ Step B-10-6:触发跨域联动提示(检查引用了本域的其他 Skill,
|
|
|
101
105
|
|---------|---------|---------|---------|
|
|
102
106
|
| 01-analysis.md 的风险点 | 业务边界条件、并发风险 | `[pitfall]` | modus-biz-{domain} |
|
|
103
107
|
| 02-sprint-contract.md 的架构决策 | 技术选型原因 | `[decision]` | modus-tech-wiki |
|
|
108
|
+
| 03-test-report.md 的失败用例与边界条件 | 未覆盖的测试场景、发现的 bug 规律 | `[pitfall]` | modus-biz-{domain} |
|
|
109
|
+
| 04-perf-report.md 的高/中风险项 | N+1 查询、大数据量无分页、慢查询模式 | `[pitfall]` | modus-tech-wiki |
|
|
110
|
+
| 05-security-report.md 的严重/高风险项 | 多租户隔离漏洞、权限缺失、敏感信息泄露 | `[pitfall]` `[invariant]` | modus-team-conventions |
|
|
104
111
|
| cr-report.md 的 P1/P2 问题 | 规范违反模式 | `[pitfall]` `[guideline]` | modus-team-conventions |
|
|
105
112
|
| 07-deploy-status.md 的部署注意事项 | 环境特殊配置 | `[guideline]` | modus-tech-wiki |
|
|
106
113
|
|
|
114
|
+
**03/04/05 报告提取优先级:**
|
|
115
|
+
- `05-security-report.md` 的严重/高危问题必须提取,不可跳过(涉及安全不变量)
|
|
116
|
+
- `04-perf-report.md` 的高风险项(N+1、无分页大查询)必须提取,中风险项选择性提取
|
|
117
|
+
- `03-test-report.md` 仅提取因测试失败而发现的新 pitfall,已通过的用例不提取
|
|
118
|
+
|
|
107
119
|
**成熟度提升判定(统一使用 status 字段):**
|
|
108
120
|
- 本次工作流成功验证了某条知识 → `draft` 升为 `verified`,更新 `last_referenced` 和 `usage_count +1`
|
|
109
121
|
- 若该知识已是 `verified` 且跨不同工作流被引用 ≥2 次 → 升为 `proven`
|
|
@@ -111,7 +123,10 @@ Step B-10-6:触发跨域联动提示(检查引用了本域的其他 Skill,
|
|
|
111
123
|
**hash 更新(ARCHIVE 阶段必做):**
|
|
112
124
|
|
|
113
125
|
```bash
|
|
114
|
-
|
|
126
|
+
# 标准全局 hash 计算命令(与 modus-init 区块 B 规定的算法完全一致)
|
|
127
|
+
for f in $(echo "{key_files}" | tr ' ' '\n' | sort); do
|
|
128
|
+
echo "$(shasum -a 1 "$f" | awk '{print $1}'):$f"
|
|
129
|
+
done | shasum -a 1 | awk '{print $1}'
|
|
115
130
|
```
|
|
116
131
|
|
|
117
132
|
将新 hash 写入 SKILL.md frontmatter 的 `last_hash` 字段。
|
|
@@ -679,7 +694,7 @@ Step 4 扩展:upstream/downstream 双向同步(append-only,Git 无冲突
|
|
|
679
694
|
|
|
680
695
|
### Step 6:质量自检(生成后执行)
|
|
681
696
|
|
|
682
|
-
|
|
697
|
+
`modus-skill-creator`(SubAgent 00)在完成 Skill 生成后,执行自动质量自检:
|
|
683
698
|
|
|
684
699
|
```
|
|
685
700
|
质量自检清单(v3 版本,含新节检查):
|
|
@@ -1042,7 +1057,7 @@ layer: "1"
|
|
|
1042
1057
|
- 更新时必须更新 `updated` 日期和 `last_referenced`
|
|
1043
1058
|
- 模式 D 每次执行后必须同步更新 `modus/knowledge-catalog.md`
|
|
1044
1059
|
- 统一使用 `status` 字段(不使用 `maturity`),枚举值:`draft | verified | proven | stale | archived`
|
|
1045
|
-
- 新生成的 Skill 默认写入 `format_version: v2`;存量 7 节 Skill 迁移前标记 `format_version: v1`
|
|
1060
|
+
- 新生成的 Skill 默认写入 `format_version: v3`(17节标准格式);存量 14 节 Skill 保留 `format_version: v2`;存量 7 节 Skill 迁移前标记 `format_version: v1`
|
|
1046
1061
|
|
|
1047
1062
|
---
|
|
1048
1063
|
|
|
@@ -1050,8 +1065,11 @@ layer: "1"
|
|
|
1050
1065
|
|
|
1051
1066
|
```
|
|
1052
1067
|
verified 达标条件(全部满足方可从 draft 升为 verified):
|
|
1053
|
-
✅ 条件 1
|
|
1054
|
-
|
|
1068
|
+
✅ 条件 1:分两类检查
|
|
1069
|
+
【必须有实质内容的节】Section 2(枚举)、Section 3(业务规则)、Section 5(API)
|
|
1070
|
+
→ 不得为空或仅含「暂无发现」占位符(这些节在项目中必然有真实内容可填)
|
|
1071
|
+
【允许占位符的节】Section 9/10/13/15/16/17(积累型知识)
|
|
1072
|
+
→ 「暂无发现,随工作流积累」是合法初始内容,不阻碍 verified 升级
|
|
1055
1073
|
✅ 条件 2:质量自检清单(见 Step 6)零 ⚠️ 警告
|
|
1056
1074
|
新增检查项:Section 17 开发场景速查 ≥ 3 行
|
|
1057
1075
|
✅ 条件 3:key_files hash 与当前代码库一致(无 stale 状态)
|
|
@@ -1,91 +1,137 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: modus-tester
|
|
3
|
-
description: Use this skill when the Harness orchestrator needs to generate unit tests for code
|
|
3
|
+
description: Use this skill when the Harness orchestrator needs to generate unit tests for changed code after Gate A. Covers three test paths (Happy Path / boundary / exception), uses MockBean isolation, inherits project base test class, and generates 03-test-report.md with HANDOFF block. Triggered by modus-harness in parallel with perf-auditor and security-auditor after Gate A passes.
|
|
4
4
|
allowed-tools: Read, Write, Glob, Bash
|
|
5
5
|
disable: false
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# modus-tester(代码测试 SubAgent)
|
|
9
9
|
|
|
10
|
-
**调用方:** Harness Orchestrator
|
|
11
|
-
**输入:** `02-sprint-contract.md
|
|
12
|
-
**产出物:** `modus/plans/active/{story-id}/03-test-report.md` +
|
|
10
|
+
**调用方:** Harness Orchestrator(Gate A 通过后,与 04/05 并行触发)
|
|
11
|
+
**输入:** `02-sprint-contract.md`(变更文件列表)+ 代码变更 + 业务 Skill(≤ 2 个)
|
|
12
|
+
**产出物:** `modus/plans/active/{story-id}/03-test-report.md` + 测试代码
|
|
13
13
|
|
|
14
14
|
## 职责
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
为本次代码变更生成单元测试,覆盖核心业务逻辑的三条测试路径(Happy Path / 边界条件 / 异常路径),使用 Mock 隔离外部依赖,确保测试独立可重复运行。
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
20
20
|
## 执行流程
|
|
21
21
|
|
|
22
|
-
### Step 1
|
|
22
|
+
### Step 1:确定测试目标
|
|
23
23
|
|
|
24
|
-
读取 `02-sprint-contract.md
|
|
25
|
-
- Service/Manager 层的核心业务方法
|
|
26
|
-
- 有复杂条件分支的逻辑
|
|
27
|
-
- `01-analysis.md` 中标注的验收标准对应的逻辑
|
|
24
|
+
读取 `02-sprint-contract.md` 的 `changed_files`,识别需要测试的类:
|
|
28
25
|
|
|
29
|
-
|
|
26
|
+
**优先级(高 → 低):**
|
|
27
|
+
1. Service / Manager 类(核心业务逻辑,必须测试)
|
|
28
|
+
2. 含复杂条件分支的 Util / Helper 类
|
|
29
|
+
3. Controller / Facade(仅测试参数校验和权限逻辑)
|
|
30
|
+
4. Mapper 接口(通常跳过,属于集成测试范围)
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
### Step 2:三路径测试生成
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
- 主流程成功执行
|
|
35
|
-
- 返回值正确
|
|
34
|
+
对每个测试目标,生成以下三类测试用例:
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
**Path 1 — Happy Path(正常流程)**
|
|
37
|
+
```java
|
|
38
|
+
@Test
|
|
39
|
+
void {method}_success() {
|
|
40
|
+
// Given: 构造合法的输入数据
|
|
41
|
+
// When: 调用被测方法
|
|
42
|
+
// Then: 验证返回结果符合预期
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Path 2 — 边界条件(Boundary)**
|
|
47
|
+
```java
|
|
48
|
+
@Test
|
|
49
|
+
void {method}_withNullInput_throws() { ... }
|
|
50
|
+
|
|
51
|
+
@Test
|
|
52
|
+
void {method}_withEmptyList_returnsEmpty() { ... }
|
|
53
|
+
|
|
54
|
+
@Test
|
|
55
|
+
void {method}_withMaxValue_succeeds() { ... }
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Path 3 — 异常路径(Exception)**
|
|
59
|
+
```java
|
|
60
|
+
@Test
|
|
61
|
+
void {method}_whenDistributedLockFails_throws() { ... }
|
|
62
|
+
|
|
63
|
+
@Test
|
|
64
|
+
void {method}_whenDownstreamRpcTimeout_throwsServiceException() { ... }
|
|
65
|
+
|
|
66
|
+
@Test
|
|
67
|
+
void {method}_whenDatabaseError_rollsBack() { ... }
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Step 3:测试代码规范
|
|
41
71
|
|
|
42
|
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
- 并发场景(如分布式锁被占用)
|
|
72
|
+
**Mock 隔离原则:**
|
|
73
|
+
- 使用 `@MockBean`(Spring)或 `@Mock`(Mockito)隔离所有外部依赖
|
|
74
|
+
- 不使用 `@SpringBootTest`(启动全量容器,速度慢),优先使用 `@ExtendWith(MockitoExtension.class)` 或项目已有的轻量基类
|
|
75
|
+
- 数据库操作全部 Mock,不依赖真实数据库
|
|
47
76
|
|
|
48
|
-
|
|
77
|
+
**继承项目基类:**
|
|
78
|
+
- 读取项目已有的测试基类(如 `AbstractBaseTest`、`BaseServiceTest`),继承或参照其 Mock 配置
|
|
79
|
+
- 若无基类,使用 `@ExtendWith(MockitoExtension.class)`
|
|
49
80
|
|
|
50
|
-
|
|
51
|
-
- 使用
|
|
52
|
-
-
|
|
53
|
-
- 测试方法命名清晰表达场景:`test_{methodName}_{scenario}_{expectedResult}`
|
|
54
|
-
- 断言明确,不只断言 "no exception"
|
|
81
|
+
**断言规范:**
|
|
82
|
+
- 使用 AssertJ 或 JUnit 5 标准断言(`assertThat`/`assertEquals`)
|
|
83
|
+
- 异常测试用 `assertThrows`,验证异常类型和消息
|
|
55
84
|
|
|
56
|
-
### Step 4
|
|
85
|
+
### Step 4:执行测试验证
|
|
57
86
|
|
|
58
|
-
|
|
59
|
-
-
|
|
60
|
-
|
|
87
|
+
```bash
|
|
88
|
+
{constitution.test_command} # 如 mvn test -pl {module} -Dtest={TestClass}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
测试失败 → 修复测试代码(不修改业务代码)后重试。
|
|
61
92
|
|
|
62
93
|
---
|
|
63
94
|
|
|
64
95
|
## 产出物格式(03-test-report.md)
|
|
65
96
|
|
|
66
97
|
```markdown
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
98
|
+
<!--HANDOFF
|
|
99
|
+
agent: "03-tester"
|
|
100
|
+
story_id: "{story-id}"
|
|
101
|
+
gate_status: "passed"
|
|
102
|
+
tests_generated: {N}
|
|
103
|
+
tests_passed: {N}
|
|
104
|
+
coverage_targets:
|
|
105
|
+
- "{ClassName}.{method}(): {覆盖的路径描述}"
|
|
106
|
+
-->
|
|
107
|
+
|
|
108
|
+
# 测试报告 — {Story 标题}
|
|
109
|
+
|
|
110
|
+
## 测试摘要
|
|
111
|
+
- 生成测试用例: {N} 个
|
|
112
|
+
- 通过: {N} 个 | 失败: {N} 个
|
|
113
|
+
- 覆盖的核心逻辑: {列表}
|
|
73
114
|
|
|
74
115
|
## 测试用例列表
|
|
75
116
|
|
|
76
117
|
### {ClassName}Test
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
|
81
|
-
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
## 验收标准覆盖
|
|
88
|
-
| 验收场景 | 对应测试 | 状态 |
|
|
89
|
-
|----------|----------|------|
|
|
90
|
-
| {从 01-analysis.md 提取} | {测试方法名} | ✅/❌ |
|
|
118
|
+
|
|
119
|
+
| 测试用例 | 路径类型 | 测试场景 | 结果 |
|
|
120
|
+
|---------|---------|---------|------|
|
|
121
|
+
| {method}_success | Happy Path | {场景} | ✅ |
|
|
122
|
+
| {method}_withNull_throws | Boundary | null 输入 | ✅ |
|
|
123
|
+
| {method}_whenLockFail | Exception | 分布式锁获取失败 | ✅ |
|
|
124
|
+
|
|
125
|
+
## 未覆盖说明
|
|
126
|
+
|
|
127
|
+
{若有意跳过某些场景,说明原因(如:Mapper 接口属于集成测试范畴,本次跳过)}
|
|
91
128
|
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 质量标准
|
|
133
|
+
|
|
134
|
+
- Service / Manager 类的核心业务方法必须有 Happy Path 覆盖
|
|
135
|
+
- 01-analysis.md 中标注的并发/事务风险点必须有对应的异常路径测试
|
|
136
|
+
- 所有测试必须在 Mock 隔离下独立通过,不依赖外部环境
|
|
137
|
+
- **HANDOFF 块必须位于文件最顶部**,`gate_status` 仅在所有测试通过时为 `passed`
|