momo-ai 1.0.99 → 1.0.100

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 (35) hide show
  1. package/.r2mo/.obsidian/plugins/obsidian-git/obsidian_askpass.bat +21 -0
  2. package/.r2mo/task/goon-001.md +2 -2
  3. package/.r2mo/task/goon-002.md +4 -2
  4. package/.r2mo/task/goon-003.md +7 -0
  5. package/.r2mo/task/goon-004.md +7 -0
  6. package/.r2mo/task/task-001.md +14 -2
  7. package/.r2mo/task/task-002.md +77 -2
  8. package/.r2mo/task/task-003.md +131 -4
  9. package/.r2mo/task/task-004.md +25 -2
  10. package/README.md +161 -72
  11. package/agent/commands/claude/momo/commands/debug.md +26 -0
  12. package/agent/commands/claude/momo/commands/end.md +7 -4
  13. package/agent/commands/claude/momo/commands/goon.md +5 -2
  14. package/agent/commands/claude/momo/commands/plan.md +7 -4
  15. package/agent/commands/claude/momo/commands/run.md +7 -4
  16. package/agent/commands/claude/momo/plugin.json +1 -1
  17. package/agent/commands/codex/momo/.codex-plugin/plugin.json +1 -1
  18. package/agent/commands/codex/momo/commands/debug.md +26 -0
  19. package/agent/commands/codex/momo/skills/momo-debug/SKILL.md +31 -0
  20. package/agent/commands/opencode/momo/commands/debug.md +26 -0
  21. package/package.json +1 -1
  22. package/src/executor/executeApp.js +2 -2
  23. package/src/executor/executeApply.js +4 -2
  24. package/src/executor/executeDict.js +1 -1
  25. package/src/executor/executeDocs.js +1 -1
  26. package/src/executor/executeDomain.js +5 -5
  27. package/src/executor/executeEnv.js +11 -10
  28. package/src/executor/executeMcp.js +2 -1
  29. package/src/executor/executeMmr0.js +5 -5
  30. package/src/executor/executeMmr2.js +5 -5
  31. package/src/executor/executeMod.js +4 -4
  32. package/src/executor/executeOpen.js +3 -2
  33. package/src/utils/momo-ai-cmd.js +39 -11
  34. package/src/utils/momo-audio.js +3 -2
  35. package/src/utils/momo-file-utils.js +10 -2
@@ -0,0 +1,21 @@
1
+ @echo off
2
+ set "PROMPT=%~1"
3
+ set "TEMP_FILE=%OBSIDIAN_GIT_CREDENTIALS_INPUT%"
4
+
5
+ if not "%PROMPT%"=="" echo %PROMPT%> "%TEMP_FILE%"
6
+
7
+ :wait_response
8
+ if not exist "%TEMP_FILE%" (
9
+ echo Trigger file got removed: Abort 1>&2
10
+ exit /b 1
11
+ )
12
+ if exist "%TEMP_FILE%.response" goto :got_response
13
+ ping -n 1 127.0.0.1 >nul
14
+ goto :wait_response
15
+
16
+ :got_response
17
+ set /p RESPONSE=<"%TEMP_FILE%.response"
18
+ echo %RESPONSE%
19
+
20
+ if exist "%TEMP_FILE%" del "%TEMP_FILE%"
21
+ if exist "%TEMP_FILE%.response" del "%TEMP_FILE%.response"
@@ -1,6 +1,6 @@
1
1
  ---
2
- runAt: 2026-05-25.17-45-00
3
- title: 整改-开发 Claude、Codex、OpenCode 命令
2
+ runAt: 2026-05-25.17-57-24
3
+ title: 整改-BUG-强化隔离区域
4
4
  status: Done
5
5
  author:
6
6
  ---
@@ -1,3 +1,5 @@
1
- # task-002 待整改项
1
+ ---
2
+ title: 整改-追加新的命令
3
+ ---
2
4
 
3
- 当前无待整改项。
5
+ (无待整改项)
@@ -0,0 +1,7 @@
1
+ ---
2
+ title: 整改-强化跨平台兼容性(Windows / Linux / macOS)
3
+ ---
4
+
5
+ ## 待整改项
6
+
7
+ 无待整改项。
@@ -0,0 +1,7 @@
1
+ ---
2
+ title: 整改-更新 README.md
3
+ ---
4
+
5
+ ## 待整改项
6
+
7
+ 无待整改项。
@@ -1,6 +1,18 @@
1
1
  ---
2
2
  runAt: 2026-05-25.17-57-24
3
- title: 任务
4
- status: Pending
3
+ title: BUG-强化隔离区域
4
+ status: Done
5
5
  author:
6
6
  ---
7
+ 在使用 /momo: 系列命令时出现了 /momo:plan 002 结果最终回写 task-001.md 的场景,对隔离处理进行一轮强化和修正。
8
+
9
+ ## Changes
10
+
11
+ - 2026-05-26 10:30: 强化 /momo:plan、/momo:run、/momo:end、/momo:goon 四个 skill 的任务隔离机制,防止跨任务回写污染。
12
+ - Files changed: `agent/commands/claude/momo/commands/plan.md`, `run.md`, `end.md`, `goon.md` (源文件)
13
+ - Files changed: `~/.claude/plugins/cache/momo-skills/momo/1.0.0/commands/plan.md`, `run.md`, `end.md`, `goon.md` (Claude 插件缓存)
14
+ - Files changed: `~/.codex/plugins/momo/commands/plan.md`, `run.md`, `end.md`, `goon.md` (Codex 命令)
15
+ - Files changed: `~/.codex/plugins/momo/skills/momo-plan/SKILL.md`, `momo-run/SKILL.md`, `momo-end/SKILL.md`, `momo-goon/SKILL.md` (Codex skill)
16
+ - Files changed: `~/.codex/rules/r2mo-task-workflow.md` (共享规则)
17
+ - 新增三层隔离守卫:(1) 隔离锁定声明(📌 任务隔离锁定),(2) 写回前路径校验,(3) 全程隔离约束禁止操作其他 task/goon 文件
18
+ - Verification: grep 确认全部 12 个文件 + 1 个共享规则均包含隔离锁定、写回校验、隔离约束三个关键词
@@ -1,6 +1,81 @@
1
1
  ---
2
2
  runAt: 2026-05-25.17-57-24
3
- title: 任务
4
- status: Pending
3
+ title: 追加新的命令
4
+ status: Done
5
5
  author:
6
6
  ---
7
+ 基于当前 /momo 系列命令,追加新的 /momo:debug 专用命令,这种任务应该是直接处理成 BUG 排查,检查当前环境中是否存在 superpowers,如果有,调用系统排查的命令进行BUG诊断。
8
+
9
+ ## Plan
10
+
11
+ ### 目标拆解
12
+
13
+ 1. **新增 `/momo:debug` AI 命令**:作为 `/momo:plan|run|end|goon` 之外的第五个专用命令,面向 BUG 排查场景
14
+ 2. **Superpowers 检测与调度**:命令执行时先检测当前环境是否安装了 superpowers 插件;有则调用 `superpowers:systematic-debugging` 进行系统化 BUG 诊断;无则降级为手动排查工作流
15
+ 3. **全平台覆盖**:Claude Code / Codex / OpenCode 三平台均需安装该命令
16
+ 4. **安装/卸载闭环**:`momo ai-cmd` 安装和卸载时正确处理 `debug` 命令
17
+
18
+ ### 涉及文件/模块
19
+
20
+ | 文件 | 变更类型 | 说明 |
21
+ |------|----------|------|
22
+ | `agent/commands/claude/momo/commands/debug.md` | 新增 | Claude Code slash command 定义 |
23
+ | `agent/commands/codex/momo/commands/debug.md` | 新增 | Codex prompt command 定义 |
24
+ | `agent/commands/opencode/momo/commands/debug.md` | 新增 | OpenCode command 定义 |
25
+ | `src/utils/momo-ai-cmd.js` | 修改 | `MOMO_COMMANDS` 数组追加 `'momo:debug'`,卸载清理逻辑自动生效 |
26
+ | `agent/commands/claude/momo/plugin.json` | 修改 | `description` 字段追加 `/momo:debug` |
27
+
28
+ ### 执行步骤
29
+
30
+ **Step 1 — 创建 `agent/commands/claude/momo/commands/debug.md`**
31
+
32
+ - YAML frontmatter:`description: "BUG 排查:检测 superpowers 并调用系统化诊断命令"`,`argument-hint: "[bug-description]"`
33
+ - 正文 Workflow:
34
+ 1. 声明本次执行目标(BUG 排查)
35
+ 2. 检测 superpowers 是否可用(检查 skill 列表中是否存在 `superpowers:systematic-debugging`)
36
+ 3. **有 superpowers**:调用 `superpowers:systematic-debugging` skill,传入 `$ARGUMENTS` 作为 BUG 描述,按其工作流执行
37
+ 4. **无 superpowers**:降级为手动排查流程——收集错误信息、定位相关文件、分析根因、给出修复建议
38
+ 5. 排查完成后输出诊断结论和修复方向
39
+ - 风格与 plan.md / run.md 保持一致(Workflow 编号、Verification 段落)
40
+
41
+ **Step 2 — 创建 `agent/commands/codex/momo/commands/debug.md`**
42
+
43
+ - 与 Step 1 内容一致,Codex 平台无需额外适配
44
+
45
+ **Step 3 — 创建 `agent/commands/opencode/momo/commands/debug.md`**
46
+
47
+ - 与 Step 1 内容一致,OpenCode 平台无需额外适配
48
+
49
+ **Step 4 — 修改 `src/utils/momo-ai-cmd.js`**
50
+
51
+ - 将 `MOMO_COMMANDS` 数组从 `['momo:plan', 'momo:run', 'momo:end', 'momo:goon']` 更新为 `['momo:plan', 'momo:run', 'momo:end', 'momo:goon', 'momo:debug']`
52
+ - `removeOpenCodeCommandEntries` 函数依赖此数组进行卸载清理,追加后自动生效,无需额外修改
53
+
54
+ **Step 5 — 修改 `agent/commands/claude/momo/plugin.json`**
55
+
56
+ - 更新 `description` 字段为 `"R2MO task workflow slash commands: /momo:plan, /momo:run, /momo:end, /momo:goon, /momo:debug."`
57
+
58
+ ### 验证方式
59
+
60
+ 1. **语法检查**:`node --check src/utils/momo-ai-cmd.js` 确认无语法错误
61
+ 2. **安装测试**:`node src/momo.js ai-cmd` 选择 Claude 平台安装,确认 `debug.md` 被复制到目标目录
62
+ 3. **命令发现**:在 Claude Code 中输入 `/momo:debug` 确认命令可被发现
63
+ 4. **卸载测试**:`node src/momo.js ai-cmd -u` 确认 `momo:debug` 条目被正确清理
64
+ 5. **功能验证**:在 Claude Code 中执行 `/momo:debug 问题描述` 确认 superpowers 检测逻辑和降级路径均正常工作
65
+
66
+ ### 风险与交接说明
67
+
68
+ - **风险**:superpowers 检测依赖于 skill 列表在运行时可见,若 Claude Code 版本差异导致 skill 发现机制不同,降级路径需作为兜底保障
69
+ - **边界**:本 Plan 仅覆盖 `/momo:debug` 命令的创建与安装,不涉及 superpowers 插件本身的修改
70
+ - **交接**:实施者需确认三平台 debug.md 内容一致;安装后需在真实环境执行一次端到端验证
71
+
72
+ ## Changes
73
+
74
+ - 2026-05-26 11:00: 新增 `/momo:debug` AI 命令,覆盖 Claude Code / Codex / OpenCode 三平台
75
+ - Files changed: `agent/commands/claude/momo/commands/debug.md` (新增), `agent/commands/codex/momo/commands/debug.md` (新增), `agent/commands/opencode/momo/commands/debug.md` (新增), `src/utils/momo-ai-cmd.js` (MOMO_COMMANDS 追加 `momo:debug`), `agent/commands/claude/momo/plugin.json` (description 追加 `/momo:debug`)
76
+ - Verification: `node --check src/utils/momo-ai-cmd.js` 通过;三平台 debug.md 文件存在且 frontmatter 正确;`require('./src/utils/momo-ai-cmd')` 加载正常
77
+
78
+ - 2026-05-26 11:15: 整改闭环 — 修复两处遗漏
79
+ - 整改项 1:`src/utils/momo-ai-cmd.js` marketplace JSON description 追加 `/momo:debug`(L307)
80
+ - 整改项 2:`src/utils/momo-ai-cmd.js` `uninstallCodexPlugin` 追加 `momo-debug.md` 卸载清理(L510)
81
+ - Verification: `node --check src/utils/momo-ai-cmd.js` 通过;`require('./src/utils/momo-ai-cmd')` 加载正常
@@ -1,6 +1,133 @@
1
1
  ---
2
- runAt: 2026-05-25.11-25-47
3
- title: 任务
4
- status: Pending
5
- author:
2
+ runAt: 2026-05-26.14-41-00
3
+ title: 强化跨平台兼容性(Windows / Linux / macOS)
4
+ status: Done
5
+ author: Claude
6
6
  ---
7
+
8
+ ## 目标
9
+
10
+ 全量扫描 r2mo-lain 所有命令源码,修复 Windows / Linux / macOS 三平台兼容性问题,确保安装、卸载、命令执行在三个平台上行为一致。
11
+
12
+ ## 扫描结果
13
+
14
+ ### 高严重度:Windows `spawn`/`execSync` 缺少 `shell: true`
15
+
16
+ Windows 上 npm 全局安装的 CLI 是 `.cmd` 文件,`spawn`/`execSync` 不加 `shell: true` 会抛 `ENOENT`。
17
+
18
+ | 文件 | 调用 |
19
+ |------|------|
20
+ | `src/utils/momo-audio.js` | `spawnSync(checker)`, `spawn(player.command)` |
21
+ | `src/utils/momo-ai-cmd.js` | `spawnSync(lookup)`, `spawnSync(command)` |
22
+ | `src/executor/executeOpen.js` | `spawn(whereCmd)`, `spawn(command)` |
23
+ | `src/executor/executeApp.js` | `spawn(whereCmd)`, `spawn('ai')` |
24
+ | `src/executor/executeMmr0.js` | `execSync(whereCmd)`, `execSync(git fetch/rev-parse/pull)` |
25
+ | `src/executor/executeMmr2.js` | `execSync(whereCmd)`, `execSync(git fetch/rev-parse/pull)` |
26
+ | `src/executor/executeDomain.js` | `spawn(whereCmd)`, `execSync(git fetch/rev-parse/pull)` |
27
+ | `src/executor/executeDocs.js` | `execSync(whereCmd obsidian)` |
28
+ | `src/executor/executeMod.js` | `execSync(git fetch/rev-parse/pull)` |
29
+ | `src/executor/executeMcp.js` | `execSync(npm install)` |
30
+ | `src/executor/executeApply.js` | `execSync(git pull/clone)` |
31
+ | `src/executor/executeDict.js` | `execSync(npm install -g)` |
32
+ | `src/executor/executeEnv.js` | `execAsync(whereCmd/java/node/npm/git/codex)` 共 8 处 |
33
+ | `src/utils/momo-file-utils.js` | `execSync(git clone)` |
34
+
35
+ ### 高严重度:OpenCode 配置路径
36
+
37
+ - `momo-ai-cmd.js` OpenCode 平台 `targetDir` 硬编码 `~/.config/opencode/`,Windows 不使用此路径,应使用 `%APPDATA%\opencode\`
38
+
39
+ ### 中严重度:Windows 文件锁定
40
+
41
+ - `momo-ai-cmd.js` 中 `fs.rm`/`fs.copyFile` 在文件被占用时抛 `EPERM`/`EBUSY`,无重试机制
42
+
43
+ ### 中严重度:符号链接
44
+
45
+ - `momo-ai-cmd.js` 和 `momo-file-utils.js` 中 `copyDir` 只处理 `isFile()`,跳过 `isSymbolicLink()`
46
+
47
+ ### 低严重度:README 缺少跨平台安装说明
48
+
49
+ - 2.1 安装章节只有一行 `npm install -g momo-ai`,无平台差异说明
50
+ - 缺 Windows 排错提示(PowerShell 执行策略、文件锁定)
51
+
52
+ ## Changes
53
+
54
+ ### 代码修复
55
+
56
+ 1. **`src/utils/momo-ai-cmd.js`**
57
+ - `commandExists` / `runOptionalCommand`:加 `shell: process.platform === 'win32'`
58
+ - 新增 `openCodeConfigDir()`:Windows 使用 `%APPDATA%\opencode\`,其他平台使用 `~/.config/opencode/`
59
+ - `PLATFORMS[2].targetDir` 改为调用 `openCodeConfigDir()`
60
+ - `openCodeConfigFiles` 使用 `openCodeConfigDir()` 查找 legacy jsonc
61
+ - 新增 `retryOnWindows()`:对 `removeIfExists`、`removeExistingPath`、`copyFile` 自动重试 `EPERM`/`EBUSY`
62
+ - `copyDir` 增加 `entry.isSymbolicLink()` 分支
63
+
64
+ 2. **`src/utils/momo-audio.js`**
65
+ - `_isCommandAvailable`:`spawnSync` 加 `shell: process.platform === 'win32'`
66
+ - `_playWith`:`spawn` 加 `shell: process.platform === 'win32'`
67
+
68
+ 3. **`src/utils/momo-file-utils.js`**
69
+ - `gitClone`:`execSync` 加 `shell: process.platform === 'win32'`
70
+
71
+ 4. **`src/executor/executeOpen.js`**
72
+ - `_isCommandAvailable`:`spawn` 加 `shell`
73
+ - `_openWithSpawn`:`spawn` 加 `shell`
74
+
75
+ 5. **`src/executor/executeApp.js`**
76
+ - `_isCommandAvailable`:`spawn` 加 `shell`
77
+ - `_executeAiCommand`:`spawn('ai')` 改 `shell: false` 为 `shell: process.platform === 'win32'`
78
+
79
+ 6. **`src/executor/executeMmr0.js`**
80
+ - `_isCommandAvailable`、`_isRepositoryUpToDate`、`_cloneOrUpdateRepository` 中所有 `execSync` 加 `shell`
81
+
82
+ 7. **`src/executor/executeMmr2.js`**
83
+ - 同上,4 处 `execSync` 加 `shell`
84
+
85
+ 8. **`src/executor/executeDomain.js`**
86
+ - `_isCommandAvailable`:`spawn` 加 `shell`
87
+ - git 操作 3 处 `execSync` 加 `shell`
88
+
89
+ 9. **`src/executor/executeDocs.js`**
90
+ - `execSync(whereCmd obsidian)` 加 `shell`
91
+
92
+ 10. **`src/executor/executeMod.js`**
93
+ - git 操作 3 处 `execSync` 加 `shell`
94
+
95
+ 11. **`src/executor/executeMcp.js`**
96
+ - `execSync('npm install')` 加 `shell`
97
+
98
+ 12. **`src/executor/executeApply.js`**
99
+ - `execSync(git pull/clone)` 2 处加 `shell`
100
+
101
+ 13. **`src/executor/executeDict.js`**
102
+ - `execSync(npm install -g)` 加 `shell`
103
+
104
+ 14. **`src/executor/executeEnv.js`**
105
+ - 新增 `_shellOpt()` 辅助函数
106
+ - 8 处 `execAsync` 调用全部加 `_shellOpt()`
107
+
108
+ ### README.md 修复
109
+
110
+ - 2.1 安装章节:补充 macOS / Linux / Windows 三平台安装命令、权限处理、卸载命令
111
+ - 添加 Windows 文件锁定排错提示
112
+ - 2.3 AI 平台命令安装:闭环流程 Mermaid 图改纵向(`flowchart TD`)
113
+ - 文字按子章节拆分(闭环流程、前置校验、各平台调用方式、卸载、平台安装细节)
114
+ - SDD 表格按平台拆分为两个独立表格
115
+ - 平台安装细节表格改为 bullet list
116
+ - 各列表行加 `<br/>` 换行避免拥挤
117
+
118
+ ### 验证
119
+
120
+ - 14 个修改文件全部通过 `node --check` 语法检查
121
+
122
+ ### Goon 整改闭环(goon-003)
123
+
124
+ 整改项:`momo-file-utils.js` 的 `copyDir` 使用 `fsAsync.stat()`(跟随符号链接),需改为 `fsAsync.lstat()`(不跟随),并补齐 `isSymbolicLink()` 分支。
125
+
126
+ 修复内容:
127
+ - `fsAsync.stat(sPath)` → `fsAsync.lstat(sPath)`
128
+ - 新增 `stat.isSymbolicLink()` 分支:使用 `fsAsync.readlink()` 读取链接目标,再用 `fsAsync.symlink()` 重建链接
129
+ - 目录和普通文件分支保持不变
130
+
131
+ 涉及文件:`src/utils/momo-file-utils.js:20-33`
132
+
133
+ 验证:`node --check src/utils/momo-file-utils.js` 通过,goon-003.md 整改项已清空。
@@ -1,6 +1,29 @@
1
1
  ---
2
2
  runAt: 2026-05-25.11-25-47
3
- title: 任务
4
- status: Pending
3
+ title: 更新 README.md
4
+ status: Done
5
5
  author:
6
6
  ---
7
+ - 扫描 README.md 中看是否有遗漏的命令
8
+ - 强化 Mermaid 图(要瘦长从上往下,方便主页查看)
9
+ - 所有表格不要出现换行,有文字的尽量多列显示
10
+
11
+ ## Changes
12
+
13
+ - **变更摘要**: 更新 README.md,补充遗漏命令、Mermaid 图瘦长化、表格多列无换行
14
+ - **涉及文件**: `README.md`
15
+ - **具体变更**:
16
+ 1. 环境初始化表格补充 `momo focus` 命令(commander 有 focus.json 但 README 遗漏)
17
+ 2. 环境初始化表和开发实施表增加「选项」列,说明列缩短避免换行
18
+ 3. 需求分析表和 SDD 开发表说明列精简,去除跨行描述
19
+ 4. Mermaid 图节点文本精简,移除粗体标记和冗长描述,保持瘦长纵向布局
20
+ - **验证命令**: `grep -c 'momo focus' README.md` → 1
21
+ - **验证结果**: `momo focus` 已出现在环境初始化表格中,所有表格无换行文本,Mermaid 图纵向精简
22
+
23
+ ### 整改闭环(goon-004)
24
+
25
+ - **整改项**: 各平台调用方式表格说明列过长,未完全对齐"多列显示"要求
26
+ - **整改执行**: Claude/OpenCode 表扩展为「命令」「前置」「写回」「说明」4列;Codex 表扩展为「命令」「等价」「说明」3列
27
+ - **涉及文件**: `README.md`
28
+ - **验证命令**: `grep -c '前置' README.md` → 1
29
+ - **验证结果**: 两个平台表均已多列化,无长句挤单单元格,goon-004.md 已清空
package/README.md CHANGED
@@ -23,129 +23,218 @@
23
23
 
24
24
  ### 2.1. 安装
25
25
 
26
+ **前置条件**:Node.js 18+(推荐 LTS 版本)
27
+
28
+ **macOS / Linux**
29
+
30
+ ```bash
31
+ npm install -g momo-ai
32
+ # 验证
33
+ momo help
34
+ ```
35
+
36
+ 若遇到权限问题:
37
+
38
+ ```bash
39
+ sudo npm install -g momo-ai
40
+ # 或使用 nvm 管理 Node 版本,避免 sudo
41
+ ```
42
+
43
+ **Windows**
44
+
26
45
  ```bash
27
46
  npm install -g momo-ai
28
- # 查看帮助
47
+ # 验证
29
48
  momo help
30
49
  ```
31
50
 
51
+ 若遇到执行策略限制(PowerShell):
52
+
53
+ ```powershell
54
+ Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
55
+ npm install -g momo-ai
56
+ ```
57
+
58
+ **卸载**
59
+
60
+ ```bash
61
+ npm uninstall -g momo-ai
62
+ ```
63
+
64
+ > **Windows 提示**:安装或卸载 `momo ai-cmd` 时,请先关闭 Claude Code / Codex / OpenCode,否则文件可能被锁定导致操作失败。若仍遇到 `EPERM` 或 `EBUSY` 错误,关闭应用后重试即可。
65
+
32
66
  ### 2.2. 常用命令
33
67
 
34
68
  #### 🛠️ 环境初始化(工程初始化)
35
69
 
36
- | 命令 | 说明 | 示例 |
37
- |:---|:---|:---|
38
- | `momo app` | 创建 R2MO/Spring 或 ZERO/Vertx 应用 | `momo app -n my-app` |
39
- | `momo apply` | 从远程仓库安装技能到当前项目;`-i` 可反馈本地技能到仓库 | `momo apply` |
40
- | `momo env` | 环境信息检查 | `momo env` |
41
- | `momo help` | 显示帮助的详细信息 | `momo help` |
42
- | `momo init` | 初始化 `.r2mo` 规范目录结构 | `momo init` |
43
- | `momo mcp` | 配置 MCP Skills Server,整合项目和全局技能 | `momo mcp` |
44
- | `momo open` | 使用指定的 AI 工具打开项目 | `momo open` |
45
- | `momo team` | 根据 DPA 架构位置写入 `.r2mo/momo.yaml` 角色配置 | `momo team` |
46
- | `momo ui` | r2mo-ui 模板创建/更新 UI 子项目(Rust/WASM + Tauri) | `momo ui` |
70
+ | 命令 | 说明 | 选项 | 示例 |
71
+ |:---|:---|:---|:---|
72
+ | `momo app` | 创建 R2MO/Spring 或 ZERO/Vertx 应用 | `-n` 指定名称 | `momo app -n my-app` |
73
+ | `momo apply` | 从远程仓库安装技能到当前项目 | `-i` 反馈到仓库 | `momo apply` |
74
+ | `momo env` | 环境信息检查 | | `momo env` |
75
+ | `momo focus` | 维护 DPA focus 配置与任务绑定 | `-d` 完成备份;`-c` 同步配置 | `momo focus` |
76
+ | `momo help` | 显示帮助的详细信息 | | `momo help` |
77
+ | `momo init` | 初始化 `.r2mo` 规范目录结构 | | `momo init` |
78
+ | `momo mcp` | 配置 MCP Skills Server | | `momo mcp` |
79
+ | `momo open` | 使用指定 AI 工具打开项目 | | `momo open` |
80
+ | `momo team` | 写入 `.r2mo/momo.yaml` 角色配置 | | `momo team` |
81
+ | `momo ui` | 创建/更新 UI 子项目 | | `momo ui` |
47
82
 
48
83
  #### 📋 需求分析
49
84
 
50
85
  | 命令 | 说明 | 示例 |
51
86
  |:---|:---|:---|
52
87
  | `momo docs` | 使用 Obsidian 打开文档目录 | `momo docs` |
53
- | `momo menu` | 扫描 `src/pages` 下 `menu.yaml`,打印完整树型菜单 | `momo menu` |
54
- | `momo mod` | 拉取 r2mo-spec 到 `.r2mo/repo`,拷贝 OpenAPI 到 `.r2mo/api/` | `momo mod` |
55
- | `momo openapi` | 从子项目 OpenAPI 提取 Operation/Schema 文档到 `-ui/.r2mo/api/` | `momo openapi` |
88
+ | `momo menu` | 扫描 `src/pages` 下 `menu.yaml` 打印树型菜单 | `momo menu` |
89
+ | `momo mod` | 拉取 r2mo-spec,拷贝 OpenAPI 到 `.r2mo/api/` | `momo mod` |
90
+ | `momo openapi` | 提取子项目 OpenAPI 文档到 `-ui/.r2mo/api/` | `momo openapi` |
56
91
 
57
92
  #### 🚀 开发实施
58
93
 
59
- | 命令 | 说明 | 示例 |
60
- |:---|:---|:---|
61
- | `momo admin` | 根据项目需求文档生成前端页面结构 | `momo admin` |
62
- | `momo dict` | `.r2mo/api/components/schemas` 读取结构并导出字典;`-r` 逆向生成 SQL | `momo dict` |
63
- | `momo domain` | 在指定目录执行 r2mo_proto 脚本生成 Protobuf | `momo domain` |
64
- | `momo mmr0` | r2mo-spec 仓库下载并生成 Flyway SQL 文件 | `momo mmr0` |
65
- | `momo mmr2` | r2mo-spec 仓库下载并生成 Entity 类 | `momo mmr2` |
94
+ | 命令 | 说明 | 选项 | 示例 |
95
+ |:---|:---|:---|:---|
96
+ | `momo admin` | 根据需求文档生成前端页面结构 | | `momo admin` |
97
+ | `momo dict` | 读取 schemas 导出字典 | `-r` 逆向生成 SQL | `momo dict` |
98
+ | `momo domain` | 执行 r2mo_proto 生成 Protobuf | | `momo domain` |
99
+ | `momo mmr0` | 下载并生成 Flyway SQL 文件 | | `momo mmr0` |
100
+ | `momo mmr2` | 下载并生成 Entity 类 | | `momo mmr2` |
66
101
 
67
102
  #### 🤖 SDD 开发
68
103
 
69
104
  | 命令 | 说明 | 示例 |
70
105
  |:---|:---|:---|
71
- | `momo ask` | 从模板目录中选择提示词并复制到剪切板 | `momo ask` |
72
- | `momo plan` | 从项目根或 `.r2mo` 目录下的 `task/` 中选择任务,生成 Plan 阶段提示词到剪贴板 | `momo plan` |
73
- | `momo run` | 从项目根或 `.r2mo` 目录下的 `task/` 中选择任务,生成提示词到剪贴板 | `momo run` |
74
- | `momo task` | 按项目根或 `.r2mo` 目录下的 `task/thread` 配置对齐任务槽位;thread 缺失时默认 20,满队列时交互选择要转历史的任务 | `momo task` |
106
+ | `momo ask` | 从模板选择提示词复制到剪贴板 | `momo ask` |
107
+ | `momo plan` | 选择任务生成 Plan 提示词到剪贴板 | `momo plan` |
108
+ | `momo run` | 选择任务生成提示词到剪贴板 | `momo run` |
109
+ | `momo task` | `task/thread` 配置对齐任务槽位 | `momo task` |
75
110
 
76
111
  ### 2.3. AI 平台命令安装
77
112
 
78
- `momo ai-cmd` 会把命令安装到 Claude Code、Codex、OpenCode 的可用位置。命令源随 npm 包一起发布,位于 `agent/commands/`。
113
+ `momo ai-cmd` 将命令安装到 Claude Code、Codex、OpenCode 的可用位置。命令源随 npm 包发布,位于 `agent/commands/`。
79
114
 
80
115
  ```bash
81
116
  # 交互式选择安装平台
82
117
  momo ai-cmd
83
118
  ```
84
119
 
85
- 每次安装都会先清理 `momo` 自己在所选平台上的旧安装记录,再写入最新命令并重新注册;重复执行可用于刷新 Claude Code / Codex / OpenCode 的命令或技能索引。
120
+ 每次安装会先清理 `momo` 在所选平台上的旧记录,再写入最新命令并重新注册。重复执行可用于刷新索引。
121
+
122
+ ---
86
123
 
87
- 安装后在不同平台的调用方式如下。Claude Code / OpenCode 使用 slash command;Codex 当前使用 plugin skill,不支持把第三方命令注册成 `/momo-run` 这种自定义 slash command。
124
+ #### 闭环流程
88
125
 
89
- 完整闭环为:`requirement(task.md) -> [plan(task.md)] -> run Changes(task.md) -> end(goon.md) -> goon Changes(task.md) -> end(goon.md)`。这里的 `task.md` / `goon.md` 是流程占位写法,实际分别表示当前参数编号对应的 `task-xxx.md` / `goon-xxx.md`。`plan`、`run`、`end` 都只以编号定位 `task-xxx.md`;`goon` 同时定位同编号的 `task-xxx.md` 和 `goon-xxx.md`。`plan` 是可选步骤,只写回 `task-xxx.md` 的 `## Plan`,不执行实现;`run` 优先按已存在的 `## Plan` 执行,没有 `## Plan` 时直接按任务正文执行,并追加 `Changes`;`end` 每次都先清空 `goon-xxx.md` 原始内容,再写入当前待整改项;`goon` 完成整改后把闭环记录追加回 `task-xxx.md` 的 `Changes`,然后应再次执行 `end` 验证并重写当前剩余待整改项或空状态。当 `end` 验证后 `goon-xxx.md` 为空或无待整改项时,该编号任务闭环完成。`plan`、`run`、`end` 三个命令要求对应 `task-xxx.md` 在 frontmatter 之后必须存在非空正文;如果正文为空或只有空白字符,命令应立即停止并直接返回,不执行后续提示词。所有 `goon-xxx.md` 的 frontmatter `title` 都必须与对应 `task-xxx.md` 标题一致,并追加 `整改-` 前缀,例如 `task-001.md` 的标题为 `开发 Claude、Codex、OpenCode 命令` 时,`goon-001.md` 标题必须为 `整改-开发 Claude、Codex、OpenCode 命令`。
126
+ 四个命令形成一个 `plan run end goon` 闭环:
90
127
 
91
128
  ```mermaid
92
- flowchart LR
93
- A["Requirement<br/>task-xxx.md"] --> B["momo:plan<br/>可选:写入/更新 ## Plan"]
94
- A --> C["momo:run<br/>按任务正文或 ## Plan 执行"]
129
+ flowchart TD
130
+ A[“`task-xxx.md`”] --> B[momo:plan<br/>可选”]
131
+ A --> C[momo:run]
95
132
  B --> C
96
- C --> D["momo:end<br/>验证并重写 goon-xxx.md"]
97
- D --> E{"goon-xxx.md<br/>是否有待整改项"}
98
- E -- "" --> F["momo:goon<br/>按 task + goon 整改"]
99
- F --> G["task-xxx.md<br/>追加 Changes"]
133
+ C --> D[momo:end]
134
+ D --> E{“有待整改?”}
135
+ E -- 有 --> F[momo:goon]
136
+ F --> G[“追加 Changes]
100
137
  G --> D
101
- E -- "" --> H["Done<br/>goon-xxx.md 无待整改项"]
102
-
103
- classDef requirement fill:#e8f1ff,stroke:#4a7bd1,color:#12325b,stroke-width:1px;
104
- classDef optional fill:#fff4d6,stroke:#d4a72c,color:#5b4300,stroke-width:1px;
105
- classDef execute fill:#e8f7e8,stroke:#43a047,color:#123d1b,stroke-width:1px;
106
- classDef verify fill:#f3e8ff,stroke:#8e5ad7,color:#41215f,stroke-width:1px;
107
- classDef remediate fill:#ffe8e8,stroke:#d45a5a,color:#5d1f1f,stroke-width:1px;
108
- classDef done fill:#e6fffb,stroke:#1aa39a,color:#0f4f4a,stroke-width:1px;
109
-
110
- class A requirement;
111
- class B optional;
112
- class C execute;
113
- class D,E verify;
114
- class F,G remediate;
115
- class H done;
138
+ E -- 无 --> H[Done ✅”]
139
+
140
+ classDef requirement fill:#e8f1ff,stroke:#4a7bd1,color:#12325b
141
+ classDef optional fill:#fff4d6,stroke:#d4a72c,color:#5b4300
142
+ classDef execute fill:#e8f7e8,stroke:#43a047,color:#123d1b
143
+ classDef verify fill:#f3e8ff,stroke:#8e5ad7,color:#41215f
144
+ classDef remediate fill:#ffe8e8,stroke:#d45a5a,color:#5d1f1f
145
+ classDef done fill:#e6fffb,stroke:#1aa39a,color:#0f4f4a
146
+
147
+ class A requirement
148
+ class B optional
149
+ class C execute
150
+ class D,E verify
151
+ class F,G remediate
152
+ class H done
116
153
  ```
117
154
 
118
- | 平台 | 调用方式 | 说明 |
155
+ 各步骤行为:
156
+
157
+ - **plan**(可选)— 只写回 `task-xxx.md` 的 `## Plan`,不执行实现
158
+ - **run** — 优先按已有 `## Plan` 执行,无 Plan 时按任务正文执行,追加 `Changes`
159
+ - **end** — 清空 `goon-xxx.md` 原始内容,写入当前待整改项
160
+ - **goon** — 按整改项执行,闭环记录追加回 `task-xxx.md` 的 `Changes`,再执行 `end` 验证
161
+
162
+ 当 `end` 验证后 `goon-xxx.md` 无待整改项时,该编号任务闭环完成。
163
+
164
+ > `goon-xxx.md` 的 frontmatter `title` 必须与对应 `task-xxx.md` 标题一致,并追加 `整改-` 前缀。
165
+
166
+ ---
167
+
168
+ #### 前置校验
169
+
170
+ `plan`、`run`、`end` 要求对应 `task-xxx.md` 在 frontmatter 之后必须存在非空正文。正文为空时命令立即返回,不执行后续提示词。
171
+
172
+ ---
173
+
174
+ #### 各平台调用方式
175
+
176
+ **Claude Code / OpenCode** — slash command
177
+
178
+ | 命令 | 前置 | 写回 | 说明 |
179
+ |:---|:---|:---|:---|
180
+ | `/momo:plan 001` | 正文非空 | `## Plan` | 不执行、不追加 Changes |
181
+ | `/momo:run 001` | 正文非空 | `Changes` | 优先按 Plan 执行 |
182
+ | `/momo:end 001` | 正文非空 | `goon-001.md` | 标题为 `整改-` + task 标题 |
183
+ | `/momo:goon 001` | goon 存在 | `Changes` | 整改后再 end 验证 |
184
+
185
+ **Codex** — plugin skill
186
+
187
+ | 命令 | 等价 | 说明 |
119
188
  |:---|:---|:---|
120
- | Claude Code / OpenCode | `/momo:plan 001` | 读取 `.r2mo/task/task-001.md`,正文非空时追加或更新 `## Plan`,不执行实现、不追加 Changes |
121
- | Claude Code / OpenCode | `/momo:run 001` | 读取 `.r2mo/task/task-001.md`,正文非空时优先按 `## Plan` 执行,先在聊天窗口显示最终执行提示词,再执行开发任务并追加 Changes |
122
- | Claude Code / OpenCode | `/momo:end 001` | 读取 `.r2mo/task/task-001.md`,正文非空时验证任务完成情况,并生成或重写 `.r2mo/task/goon-001.md`,goon 文件只保留当前待整改项,标题固定为 `整改-` + task 标题 |
123
- | Claude Code / OpenCode | `/momo:goon 001` | 读取 `.r2mo/task/goon-001.md`,并对齐 `.r2mo/task/task-001.md` 执行整改任务,完成后回写 task Changes,再使用 `/momo:end 001` 验证 |
124
- | Codex | `$momo-plan 001` 或 `/use` 选择 `momo-plan` | 与 `/momo:plan 001` 等价 |
125
- | Codex | `$momo-run 001` 或 `/use` 选择 `momo-run` | 与 `/momo:run 001` 等价 |
126
- | Codex | `$momo-end 001` 或 `/use` 选择 `momo-end` | 与 `/momo:end 001` 等价 |
127
- | Codex | `$momo-goon 001` 或 `/use` 选择 `momo-goon` | 与 `/momo:goon 001` 等价,完成后再使用 `$momo-end 001` 验证 |
189
+ | `$momo-plan 001` | `/momo:plan` | Plan |
190
+ | `$momo-run 001` | `/momo:run` | 执行开发 |
191
+ | `$momo-end 001` | `/momo:end` | 验证整改 |
192
+ | `$momo-goon 001` | `/momo:goon` | 整改后验证 |
193
+
194
+ 参数为三位数字编号(如 `001`)。格式不对时命令停止并提示正确用法。
128
195
 
129
- 参数必须是 `001` 这类三位数字编号。格式不对时,命令或 skill 会停止并提示正确用法。
130
- 编号参数与文件一一对应,例如 `/momo:run 010` 只表示当前工作目录下的 `.r2mo/task/task-010.md`。`plan`、`run`、`end` 都对应 `.r2mo/task/task-010.md`;`goon 010` 同时对应 `.r2mo/task/task-010.md` 和 `.r2mo/task/goon-010.md`。如果对应文件不存在,命令不会猜测其他编号,而是直接询问用户提供最新任务号。如果 `task-010.md` frontmatter 之后正文为空,`plan`、`run`、`end` 会直接返回,不继续执行。
196
+ 编号与文件一一对应:`/momo:run 010` → `.r2mo/task/task-010.md`;`goon 010` 同时对应 `task-010.md` 和 `goon-010.md`。文件不存在时命令直接询问最新任务号。
131
197
 
132
- 四个核心命令最终发送给 AI Agent 的提示词使用短列表“任务派发单”格式,统一包含输入范围、前置校验、调度策略或写回规则,便于不同 Agent 在 `plan -> run -> end -> goon` 闭环中准确接力。
198
+ 四个命令发送给 AI Agent 的提示词统一使用”任务派发单”短列表格式,包含输入范围、前置校验、调度策略和写回规则。
199
+
200
+ ---
133
201
 
134
- 卸载时使用全量清理,已安装的平台会被删除,未安装的平台会被跳过:
202
+ #### 卸载
135
203
 
136
204
  ```bash
137
205
  momo ai-cmd --uninstall
138
206
  ```
139
207
 
140
- 平台安装方式:
208
+ 全量清理:已安装的平台会被删除,未安装的跳过。
141
209
 
142
- | 平台 | 安装方式 | 验证 |
143
- |:---|:---|:---|
144
- | Claude Code | 写入 `~/.claude/plugins/marketplaces/momo-skills`,并调用 `claude plugin marketplace add/update`、`claude plugin install momo@momo-skills` | `claude plugin list` 或 `claude plugin details momo@momo-skills` |
145
- | Codex | 写入 `~/.codex/marketplaces/momo-skills`、兼容 prompts,以及 plugin skills `momo-plan`、`momo-run`、`momo-end`、`momo-goon`;当前 Codex 0.133 的 `/` 补全不支持自定义 `/momo-run` slash command,稳定入口是 skills | `codex plugin list`;`codex debug prompt-input` 中应出现 `momo:momo-plan`、`momo:momo-run`、`momo:momo-end`、`momo:momo-goon` |
146
- | OpenCode | 写入 `~/.config/opencode/opencode.json` 的 `command` 配置,并清理旧 `opencode.jsonc` 中的 momo 命令残留 | 检查 `command["momo:plan"]`、`command["momo:run"]`、`command["momo:end"]`、`command["momo:goon"]` 是否存在 |
210
+ ---
211
+
212
+ #### 平台安装细节
213
+
214
+ **Claude Code**
215
+
216
+ - 写入 `~/.claude/plugins/marketplaces/momo-skills`
217
+ - 写入 `~/.claude/plugins/cache/momo-skills/momo/1.0.0`
218
+ - 更新 `~/.claude/settings.json`(启用插件、注册 marketplace)
219
+ - 若 `claude` CLI 可用:自动执行 `plugin marketplace add/update` 和 `plugin install`
220
+ - 验证:`claude plugin list` 或 `claude plugin details momo@momo-skills`
221
+
222
+ **Codex**
223
+
224
+ - 写入 `~/.codex/plugins/momo` 及 `~/.codex/marketplaces/momo-skills`
225
+ - 写入 `~/.codex/prompts/momo-*.md` 兼容 prompts
226
+ - 更新 `~/.codex/config.toml`(注册 marketplace 和 plugin)
227
+ - 若 `codex` CLI 可用:自动执行 `plugin marketplace add` 和 `plugin add`
228
+ - 验证:`codex plugin list`;`codex debug prompt-input` 中应出现 `momo:momo-plan` 等
229
+
230
+ **OpenCode**
231
+
232
+ - macOS / Linux:写入 `~/.config/opencode/opencode.json`
233
+ - Windows:写入 `%APPDATA%\opencode\opencode.json`
234
+ - 清理旧 `opencode.jsonc` 中 momo 残留
235
+ - 验证:检查 `command[“momo:plan”]` 等是否存在
147
236
 
148
- 如果 Claude Code、Codex 或 OpenCode 已经打开,安装后请重启应用或在项目根开启新会话,让命令或 skill 索引重新加载。
237
+ 安装后请重启应用或开启新会话,让命令或 skill 索引重新加载。
149
238
 
150
239
  ### 2.4. 发布
151
240