@modus-ai/modus 0.2.5 → 0.2.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.
Files changed (49) hide show
  1. package/README.md +62 -45
  2. package/dist/commands/init.d.ts.map +1 -1
  3. package/dist/commands/init.js +37 -6
  4. package/dist/commands/init.js.map +1 -1
  5. package/dist/generators/claude.js +1 -1
  6. package/dist/generators/claude.js.map +1 -1
  7. package/dist/generators/codebuddy.d.ts.map +1 -1
  8. package/dist/generators/codebuddy.js +3 -1
  9. package/dist/generators/codebuddy.js.map +1 -1
  10. package/dist/generators/codex.d.ts +10 -0
  11. package/dist/generators/codex.d.ts.map +1 -0
  12. package/dist/generators/codex.js +178 -0
  13. package/dist/generators/codex.js.map +1 -0
  14. package/dist/generators/cursor.d.ts.map +1 -1
  15. package/dist/generators/cursor.js +36 -7
  16. package/dist/generators/cursor.js.map +1 -1
  17. package/dist/generators/custom.d.ts +55 -0
  18. package/dist/generators/custom.d.ts.map +1 -0
  19. package/dist/generators/custom.js +166 -0
  20. package/dist/generators/custom.js.map +1 -0
  21. package/dist/generators/index.d.ts +1 -0
  22. package/dist/generators/index.d.ts.map +1 -1
  23. package/dist/generators/index.js +10 -0
  24. package/dist/generators/index.js.map +1 -1
  25. package/dist/utils/config.d.ts +6 -1
  26. package/dist/utils/config.d.ts.map +1 -1
  27. package/dist/utils/config.js.map +1 -1
  28. package/package.json +1 -1
  29. package/schemas/harness-schema.yaml +178 -53
  30. package/templates/agents/modus-analyst.md +1 -1
  31. package/templates/commands/auto.md +61 -27
  32. package/templates/commands/harness.md +94 -34
  33. package/templates/commands/init.md +43 -10
  34. package/templates/commands/modus.md +55 -28
  35. package/templates/commands/plan.md +60 -18
  36. package/templates/commands/spec.md +69 -25
  37. package/templates/commands/upgrade.md +54 -0
  38. package/templates/commands/vibe.md +55 -5
  39. package/templates/knowledge-catalog.md +23 -10
  40. package/templates/skills/modus-agents/analyst/SKILL.md +11 -12
  41. package/templates/skills/modus-agents/developer/SKILL.md +14 -12
  42. package/templates/skills/modus-agents/reviewer/SKILL.md +50 -23
  43. package/templates/skills/modus-auto/SKILL.md +580 -123
  44. package/templates/skills/modus-design-brief/SKILL.md +17 -9
  45. package/templates/skills/modus-harness/SKILL.md +95 -96
  46. package/templates/skills/modus-init/SKILL.md +403 -188
  47. package/templates/skills/modus-plan/SKILL.md +16 -5
  48. package/templates/skills/modus-platform/SKILL.md +271 -0
  49. package/templates/skills/modus-vibe/SKILL.md +285 -187
@@ -126,11 +126,13 @@ disable: false
126
126
 
127
127
  #### 4-1:读取 Skill frontmatter(轻量操作,仅读前 20 行)
128
128
 
129
- 读取 `.codebuddy/skills/modus-biz-{domain}/SKILL.md` 的 YAML frontmatter,提取:
129
+ 读取 `modus/knowledge/biz-{domain}/SKILL.md` 的 YAML frontmatter,提取:
130
130
  - `last_hash`:上次记录的 key_files 内容摘要
131
131
  - `key_files`:关键源文件列表
132
132
 
133
- 若 Skill 不存在,跳到 4-4(新建)。
133
+ 若 Skill 不存在(包括 modus/knowledge/ 目录下不存在),跳到 4-4(新建)。
134
+
135
+ > **注意**:`.codebuddy/skills/modus-biz-{domain}/SKILL.md` 自 v3.2 起已降级为引用桩,不含实际内容,请勿从此路径读取。
134
136
 
135
137
  #### 4-2:计算当前 key_files 的 hash
136
138
 
@@ -278,8 +280,17 @@ done | shasum -a 1 | awk '{print $1}'
278
280
 
279
281
  基于已加载的知识和用户确认的意图,生成单一规划文档到 `modus/plans/{name}/plan.md`。
280
282
 
281
- **确定 plan 名称:**
282
- - 从用户 prompt 提取关键词,生成 kebab-case 名称(如 `add-batch-approve`)
283
+ **确定产出路径(Story 模式 vs 独立模式):**
284
+
285
+ ```
286
+ 情形 A:来自 /modus:auto(context_bundle 含 story_id)
287
+ 产出路径:modus/stories/{story-id}/plan.md
288
+
289
+ 情形 B:用户直接运行 /modus:plan(无 story_id)
290
+ 产出路径:modus/plans/{name}/plan.md
291
+ plan 名称:从用户 prompt 提取关键词,生成 kebab-case(如 add-batch-approve)
292
+ ```
293
+
283
294
  - 如果目录已存在,提示用户确认
284
295
 
285
296
  **写入状态文件:**
@@ -433,7 +444,7 @@ plan.md 生成后,展示结果并进入确认循环:
433
444
 
434
445
  1. 读取 `modus/config.yaml` 的 `platforms` 字段
435
446
  2. 对受影响的每个业务域(Step 4 前置更新 / 新建的域),按以下规则同步:
436
- - **CodeBuddy** → 源文件即 `.codebuddy/skills/modus-biz-{domain}/SKILL.md`(已更新,无需额外操作)
447
+ - **CodeBuddy** → 同步更新 `.codebuddy/skills/modus-biz-{domain}/SKILL.md` 引用桩的摘要行(权威源已在 `modus/knowledge/biz-{domain}/SKILL.md` 中更新)
437
448
  - **Claude** → 写入 `.claude/agents/modus-biz-{domain}.md`(覆盖旧版本)
438
449
  - **Cursor** → 写入 `.cursor/rules/modus-biz-{domain}.mdc`(带 frontmatter,覆盖旧版本)
439
450
  - **Copilot** → 在 `.github/copilot-instructions.md` 中替换对应域的标记段落
@@ -0,0 +1,271 @@
1
+ ---
2
+ name: modus-platform
3
+ description: >
4
+ Use this skill when executing /modus:platform command for AI platform adapter management.
5
+ Supports adding new platform adapters via online research (-add), listing registered platforms (-list),
6
+ and removing platform adapters (-remove). When adding a platform, the AI researches the target
7
+ platform's rules/commands/skills loading mechanism online and generates a platform.yaml descriptor,
8
+ which the modus CLI then uses to generate adapter files. This is how Cursor, Claude, CodeBuddy
9
+ support was originally built — each platform was analyzed and formalized into a generator.
10
+ Trigger on: /modus:platform, add platform adapter, 添加平台适配, 新增平台, platform -add,
11
+ platform -list, platform -remove, 注册新平台, 扩展平台支持, 适配新 AI 工具.
12
+ allowed-tools: Read, Write, Glob, Bash, WebSearch, WebFetch
13
+ disable: false
14
+ ---
15
+
16
+ # modus-platform(AI 平台适配管理)
17
+
18
+ **触发条件:** 用户运行 `/modus:platform [-add|-list|-remove]` 时使用此 Skill。
19
+
20
+ ---
21
+
22
+ ## 职责
23
+
24
+ 管理 Modus 对 AI 编码工具平台的适配。每个平台用一个 `platform.yaml` 描述符注册,
25
+ `modus update` 时自动生成对应的 framework 适配文件,`/modus:init` 时自动同步业务域 biz skill。
26
+
27
+ **已内置平台**(无需 `-add`):
28
+
29
+ | 平台 | 生成器 | 输出位置 |
30
+ |------|--------|---------|
31
+ | codebuddy | codebuddy.ts | `.codebuddy/` |
32
+ | claude | claude.ts | `.claude/` + `CLAUDE.md` |
33
+ | cursor | cursor.ts | `.cursor/rules/` |
34
+ | copilot | copilot.ts | `.github/copilot-instructions.md` |
35
+ | codex | codex.ts | `AGENTS.md` |
36
+
37
+ **自定义平台**(通过 `-add` 添加):由 `modus/platforms/{name}/platform.yaml` + `custom.ts` 通用生成器驱动。
38
+
39
+ ---
40
+
41
+ ## 参数说明
42
+
43
+ ```
44
+ /modus:platform -add <platform-name> [--docs <url>] [--force]
45
+ /modus:platform -list
46
+ /modus:platform -remove <platform-name>
47
+
48
+ -add <name> 添加新平台适配(联网搜索平台规则,生成 platform.yaml)
49
+ -list 列出所有已注册平台(内置 + 自定义)
50
+ -remove <name> 移除自定义平台(删除 platform.yaml 及生成的适配文件)
51
+ --docs <url> 提供平台官方文档 URL,优先从此处提取信息
52
+ --force 强制覆盖已存在的 platform.yaml
53
+ ```
54
+
55
+ ---
56
+
57
+ ## 执行流程
58
+
59
+ ### 参数解析(优先执行)
60
+
61
+ ```
62
+ -list → 跳到「-list 流程」
63
+ -remove → 跳到「-remove 流程」
64
+ -add → 执行「-add 流程」(主流程)
65
+ 无参数 → 输出帮助信息,列出已注册平台
66
+ ```
67
+
68
+ ---
69
+
70
+ ## -add 流程:添加新平台适配
71
+
72
+ ### Step 1:前置检查
73
+
74
+ ```
75
+ ① 检查 modus/platforms/{name}/platform.yaml 是否已存在
76
+ → 若存在且未传 --force:提示已注册,建议 -remove 后重新添加或加 --force
77
+ → 若存在且 --force:继续(将覆盖)
78
+
79
+ ② 检查是否为已内置平台(codebuddy/claude/cursor/copilot/codex)
80
+ → 若是:提示「该平台已内置支持,无需 -add」,结束执行
81
+ ```
82
+
83
+ ### Step 2:联网研究平台规范(核心步骤)
84
+
85
+ > **这一步对标当时分析 Cursor 平台的过程**——Agent 自主搜集信息,而非用户手动填写。
86
+
87
+ 优先读取 `--docs <url>`(若提供),否则联网搜索:
88
+
89
+ ```
90
+ 搜索词(按优先级):
91
+ 1. "{platform-name} AI coding rules directory"
92
+ 2. "{platform-name} slash commands configuration"
93
+ 3. "{platform-name} context files agent instructions"
94
+ 4. "{platform-name} SKILL.md OR rules.md OR instructions.md"
95
+ ```
96
+
97
+ **需要回答的平台能力问题清单:**
98
+
99
+ ```
100
+ □ Q1: 上下文规则如何加载?
101
+ → 专用目录(如 .cursor/rules/)?单文件(如 AGENTS.md)?系统提示注入?
102
+ → outputDir 和 fileExtension
103
+
104
+ □ Q2: 是否支持多文件 Skill 分散加载?
105
+ → 渐进式(progressive)/ 全量合并(flat)/ 不支持(none)
106
+ → capabilities.skillsLoading
107
+
108
+ □ Q3: 命令如何触发?
109
+ → /slash 命令?自然语言关键词?配置文件定义?
110
+ → capabilities.commandsTrigger
111
+
112
+ □ Q4: 是否有原生多文件规则机制(类似 .cursor/rules/)?
113
+ → capabilities.nativeRules
114
+
115
+ □ Q5: 是否支持 Sub-Agent / 并行 Task?
116
+ → capabilities.subAgents
117
+
118
+ □ Q6: 业务域 biz skill 应该放在哪里?
119
+ → bizSkill.outputPath 模板(含 {domain} 占位符)
120
+ → bizSkill.wrapper(文件头部格式)
121
+ ```
122
+
123
+ **输出分析摘要:**
124
+
125
+ ```
126
+ === 平台分析:{platform-name} ===
127
+ 上下文加载:{结论}
128
+ 多文件规则:{支持/不支持}
129
+ 命令触发:{slash/natural/file}
130
+ Sub-Agent:{是/否}
131
+ 信息来源:{URL 或「搜索推断」}
132
+ 置信度:{高/中/低}
133
+ ```
134
+
135
+ ### Step 3:生成 platform.yaml
136
+
137
+ 在 `modus/platforms/{name}/platform.yaml` 写入:
138
+
139
+ ```yaml
140
+ # {label} — Modus 平台适配描述符
141
+ # 由 /modus:platform -add 自动生成,可手动调整后运行 modus update 重新生成适配文件
142
+ name: {name}
143
+ label: {label}
144
+ outputDir: {outputDir}
145
+ fileExtension: {fileExtension}
146
+ capabilities:
147
+ skillsLoading: {progressive|flat|none}
148
+ subAgents: {true|false}
149
+ commandsTrigger: {slash|natural|file}
150
+ nativeRules: {true|false}
151
+ bizSkill:
152
+ enabled: {true|false}
153
+ outputPath: "{outputDir}/modus-biz-{domain}.{fileExtension}"
154
+ wrapper: |
155
+ # {domain} Business Domain Rules
156
+ <!-- Source: modus/knowledge/biz-{domain}/SKILL.md -->
157
+ {content}
158
+ constitutionTemplate: |
159
+ # Modus Project Rules — {label}
160
+ {hardRules}
161
+ commandsTemplate: |
162
+ # Modus Commands — {label}
163
+ {commands}
164
+ ```
165
+
166
+ ### Step 4:更新 modus/config.yaml
167
+
168
+ 在 `customPlatforms` 字段追加平台名(幂等):
169
+
170
+ ```yaml
171
+ customPlatforms:
172
+ - {name}
173
+ ```
174
+
175
+ ### Step 5:生成 framework 适配文件
176
+
177
+ 提示用户运行 `modus update` 触发 `custom.ts` 生成器,或直接调用(若有权限):
178
+
179
+ ```
180
+ → 在 {outputDir}/ 生成:
181
+ modus-constitution.{ext} — 项目宪法(hard_rules)
182
+ modus-commands.{ext} — 命令索引
183
+ modus-init.{ext} — init Skill(若 skillsLoading != none)
184
+ modus-vibe.{ext} — vibe Skill
185
+ modus-plan.{ext} — plan Skill
186
+ modus-spec.{ext} — spec Skill
187
+ modus-auto.{ext} — auto Skill
188
+ modus-harness.{ext} — harness Skill
189
+ ```
190
+
191
+ ### Step 6:验收报告
192
+
193
+ ```
194
+ ✅ 平台适配完成:{label}
195
+
196
+ 已生成文件:
197
+ modus/platforms/{name}/platform.yaml ← 描述符(可手动调整)
198
+ {outputDir}/modus-constitution.{ext}
199
+ {outputDir}/modus-commands.{ext}
200
+ ... (共 N 个文件)
201
+
202
+ 后续 biz skill 同步:
203
+ 每次运行 /modus:init 时,modus-biz-* 内容会自动同步到:
204
+ {bizSkill.outputPath}
205
+
206
+ 验证方式:
207
+ 1. 在 {platform-name} 中打开本项目
208
+ 2. 输入 /modus:vibe 或相应触发词
209
+ 3. 确认 AI 能识别业务域知识
210
+
211
+ 已知限制:
212
+ {根据 capabilities 分析,列出与内置平台的差异,如「不支持 Sub-Agent,harness 降级单步执行」}
213
+ ```
214
+
215
+ ---
216
+
217
+ ## -list 流程:列出已注册平台
218
+
219
+ ```
220
+ === 已注册平台 ===
221
+
222
+ 内置平台:
223
+ ✓ codebuddy (.codebuddy/)
224
+ ✓ claude (.claude/ + CLAUDE.md)
225
+ ✓ cursor (.cursor/rules/)
226
+ ✓ copilot (.github/copilot-instructions.md)
227
+ ✓ codex (AGENTS.md)
228
+
229
+ 自定义平台(modus/platforms/*/platform.yaml):
230
+ ✓ windsurf (.windsurf/rules/) [2026-05-18]
231
+ ✓ aider (.aider/) [2026-05-10]
232
+
233
+ 当前启用(modus/config.yaml platforms 字段):
234
+ codebuddy, claude, cursor, codex, windsurf
235
+ ```
236
+
237
+ 若无自定义平台:
238
+ ```
239
+ 暂无自定义平台。使用 /modus:platform -add <name> 添加。
240
+ ```
241
+
242
+ ---
243
+
244
+ ## -remove 流程:移除自定义平台
245
+
246
+ ```
247
+ Step 1: 确认 modus/platforms/{name}/platform.yaml 存在
248
+ Step 2: 读取 outputDir 配置,确认生成文件列表
249
+ Step 3: 展示将被删除的文件(预览)
250
+ Step 4: 用户确认(--force 时跳过)
251
+ Step 5: 删除 modus/platforms/{name}/ 目录
252
+ Step 6: 删除 {outputDir}/modus-*.{ext} 文件(仅删 modus 生成的,不影响用户文件)
253
+ Step 7: 从 modus/config.yaml customPlatforms 移除该平台名
254
+ Step 8: 输出完成报告
255
+ ```
256
+
257
+ ---
258
+
259
+ ## 已知平台特性参考(内置知识)
260
+
261
+ | 平台 | rules 目录 | Skill 加载 | 命令触发 | Sub-Agent |
262
+ |------|-----------|-----------|---------|-----------|
263
+ | Cursor | `.cursor/rules/` (.mdc) | progressive | /slash | 否(单 Agent) |
264
+ | Claude Code | `.claude/` | flat (agents) | /slash | 是 |
265
+ | CodeBuddy | `.codebuddy/skills/` | progressive | /slash | 是 |
266
+ | GitHub Copilot | `.github/copilot-instructions.md` | flat (单文件) | 自然语言 | 否 |
267
+ | Codex / OpenCode | `AGENTS.md` | flat (单文件) | 自然语言 | 否 |
268
+ | Windsurf (Cascade) | `.windsurfrules` | flat (单文件) | /slash | 否 |
269
+ | Aider | `.aider.conf.yml` | flat (配置) | CLI flags | 否 |
270
+
271
+ > 上表为已知信息,`-add` 时会通过联网搜索验证最新规范。