momo-ai 1.0.21 → 1.0.22

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 (94) hide show
  1. package/.claude/skills/r2mo-rad-lain/SKILL.md +63 -374
  2. package/.trae/skills/algorithmic-art/LICENSE.txt +202 -0
  3. package/.trae/skills/algorithmic-art/SKILL.md +405 -0
  4. package/.trae/skills/algorithmic-art/templates/generator_template.js +223 -0
  5. package/.trae/skills/algorithmic-art/templates/viewer.html +599 -0
  6. package/.trae/skills/doc-coauthoring/SKILL.md +375 -0
  7. package/.trae/skills/frontend-design/LICENSE.txt +177 -0
  8. package/.trae/skills/frontend-design/SKILL.md +42 -0
  9. package/.trae/skills/r2mo-rad-lain/SKILL.md +101 -0
  10. package/README.md +9 -32
  11. package/docs/images/r2mo-lain.png +0 -0
  12. package/package.json +11 -11
  13. package/skills/r2mo-rad-domain/SKILL.md +70 -0
  14. package/src/_skill/repositories.json +9 -3
  15. package/src/_template/LAIN/.obsidian/app.json +1 -0
  16. package/src/_template/LAIN/.obsidian/appearance.json +10 -0
  17. package/src/_template/LAIN/.obsidian/community-plugins.json +7 -0
  18. package/src/_template/LAIN/.obsidian/core-plugins.json +33 -0
  19. package/src/_template/LAIN/.obsidian/plugins/dataview/main.js +20876 -0
  20. package/src/_template/LAIN/.obsidian/plugins/dataview/manifest.json +11 -0
  21. package/src/_template/LAIN/.obsidian/plugins/dataview/styles.css +141 -0
  22. package/src/_template/LAIN/.obsidian/plugins/obsidian-excalidraw-plugin/data.json +815 -0
  23. package/src/_template/LAIN/.obsidian/plugins/obsidian-excalidraw-plugin/main.js +10 -0
  24. package/src/_template/LAIN/.obsidian/plugins/obsidian-excalidraw-plugin/manifest.json +12 -0
  25. package/src/_template/LAIN/.obsidian/plugins/obsidian-excalidraw-plugin/styles.css +1 -0
  26. package/src/_template/LAIN/.obsidian/plugins/obsidian-kanban/main.js +153 -0
  27. package/src/_template/LAIN/.obsidian/plugins/obsidian-kanban/manifest.json +11 -0
  28. package/src/_template/LAIN/.obsidian/plugins/obsidian-kanban/styles.css +1 -0
  29. package/src/_template/LAIN/.obsidian/plugins/obsidian-plantuml/main.js +7732 -0
  30. package/src/_template/LAIN/.obsidian/plugins/obsidian-plantuml/manifest.json +10 -0
  31. package/src/_template/LAIN/.obsidian/plugins/obsidian-plantuml/styles.css +38 -0
  32. package/src/_template/LAIN/.obsidian/plugins/obsidian-tasks-plugin/main.js +504 -0
  33. package/src/_template/LAIN/.obsidian/plugins/obsidian-tasks-plugin/manifest.json +12 -0
  34. package/src/_template/LAIN/.obsidian/plugins/obsidian-tasks-plugin/styles.css +1 -0
  35. package/src/_template/LAIN/.obsidian/snippets/body-font.css +27 -0
  36. package/src/_template/LAIN/.obsidian/themes/Primary/manifest.json +9 -0
  37. package/src/_template/LAIN/.obsidian/themes/Primary/theme.css +3878 -0
  38. package/src/_template/LAIN/.obsidian/themes/Retro Windows/manifest.json +7 -0
  39. package/src/_template/LAIN/.obsidian/themes/Retro Windows/theme.css +582 -0
  40. package/src/_template/LAIN/.obsidian/themes/RetroOS 98/manifest.json +9 -0
  41. package/src/_template/LAIN/.obsidian/themes/RetroOS 98/theme.css +2566 -0
  42. package/src/_template/LAIN/.obsidian/types.json +28 -0
  43. package/src/_template/LAIN/.obsidian/workspace.json +184 -0
  44. package/src/_template/LAIN/AGENTS.md +170 -16
  45. package/src/_template/R2MO/domain-enhance.md +10 -0
  46. package/src/commander/app.json +13 -0
  47. package/src/commander/apply.json +13 -0
  48. package/src/commander/ask.json +6 -0
  49. package/src/commander/docs.json +13 -0
  50. package/src/commander/domain.json +19 -0
  51. package/src/commander/init.json +1 -1
  52. package/src/commander/mmr0.json +6 -0
  53. package/src/commander/mmr2.json +6 -0
  54. package/src/executor/executeApp.js +133 -0
  55. package/src/executor/{executeSkills.js → executeApply.js} +166 -302
  56. package/src/executor/executeAsk.js +274 -0
  57. package/src/executor/executeDocs.js +498 -0
  58. package/src/executor/executeDomain.js +293 -0
  59. package/src/executor/executeInit.js +159 -383
  60. package/src/executor/executeMcp.js +74 -1
  61. package/src/executor/executeMmr0.js +488 -0
  62. package/src/executor/executeMmr2.js +880 -0
  63. package/src/executor/index.js +15 -3
  64. package/src/python/r2mo_proto.py +418 -0
  65. package/src/python/r2mo_proto_database.py +369 -0
  66. package/src/python/r2mo_proto_domain.py +458 -0
  67. package/src/utils/momo-menu.js +43 -13
  68. package/.claude/skills/r2mo-rad-lain/PROMPT.md +0 -281
  69. package/.claude/skills/r2mo-rad-lain/README.md +0 -192
  70. package/.claude/skills/r2mo-rad-lain/examples/argument-parsing.js +0 -154
  71. package/.claude/skills/r2mo-rad-lain/examples/file-operations.js +0 -182
  72. package/.claude/skills/r2mo-rad-lain/file-utils-api.md +0 -281
  73. package/.claude/skills/r2mo-rad-lain/menu-api.md +0 -187
  74. package/.claude/skills/r2mo-rad-lain/scripts/file-utils.js +0 -223
  75. package/.claude/skills/r2mo-rad-lain/scripts/menu.js +0 -289
  76. package/.claude/skills/r2mo-rad-lain/scripts/yaml-parser.js +0 -209
  77. package/.claude/skills/r2mo-rad-lain/templates/command.json.template +0 -13
  78. package/.claude/skills/r2mo-rad-lain/templates/executor.js.template +0 -32
  79. package/.claude/skills/r2mo-rad-lain/templates/interactive-menu.js.template +0 -221
  80. package/src/_template/LAIN/.momo/advanced/actor.md +0 -42
  81. package/src/_template/LAIN/.momo/advanced/refer.json +0 -46
  82. package/src/_template/LAIN/.momo/scripts/submodule-clean.sh +0 -56
  83. package/src/_template/LAIN/changes/proposal.md +0 -39
  84. package/src/_template/LAIN/changes/tasks/task-detail.md +0 -45
  85. package/src/_template/LAIN/changes/tasks.md +0 -49
  86. package/src/_template/LAIN/execute/admin-n-f-dashboard.md +0 -53
  87. package/src/_template/LAIN/execute/admin-n-f-form.md +0 -51
  88. package/src/_template/LAIN/execute/admin-n-f-home.md +0 -49
  89. package/src/_template/LAIN/execute/admin-n-f-list.md +0 -52
  90. package/src/_template/LAIN/execute/admin-n-f-login.md +0 -56
  91. package/src/_template/LAIN/specification/project-model.md +0 -13
  92. package/src/_template/LAIN/specification/project.md +0 -73
  93. package/src/_template/LAIN/specification/requirement.md +0 -25
  94. package/src/commander/skills.json +0 -20
@@ -0,0 +1,28 @@
1
+ {
2
+ "types": {
3
+ "aliases": "aliases",
4
+ "cssclasses": "multitext",
5
+ "tags": "tags",
6
+ "TQ_explain": "checkbox",
7
+ "TQ_extra_instructions": "text",
8
+ "TQ_short_mode": "checkbox",
9
+ "TQ_show_backlink": "checkbox",
10
+ "TQ_show_cancelled_date": "checkbox",
11
+ "TQ_show_created_date": "checkbox",
12
+ "TQ_show_depends_on": "checkbox",
13
+ "TQ_show_done_date": "checkbox",
14
+ "TQ_show_due_date": "checkbox",
15
+ "TQ_show_edit_button": "checkbox",
16
+ "TQ_show_id": "checkbox",
17
+ "TQ_show_on_completion": "checkbox",
18
+ "TQ_show_postpone_button": "checkbox",
19
+ "TQ_show_priority": "checkbox",
20
+ "TQ_show_recurrence_rule": "checkbox",
21
+ "TQ_show_scheduled_date": "checkbox",
22
+ "TQ_show_start_date": "checkbox",
23
+ "TQ_show_tags": "checkbox",
24
+ "TQ_show_task_count": "checkbox",
25
+ "TQ_show_tree": "checkbox",
26
+ "TQ_show_urgency": "checkbox"
27
+ }
28
+ }
@@ -0,0 +1,184 @@
1
+ {
2
+ "main": {
3
+ "id": "655d8fbd3ca8925e",
4
+ "type": "split",
5
+ "children": [
6
+ {
7
+ "id": "53637ba5abb4e2f5",
8
+ "type": "tabs",
9
+ "children": [
10
+ {
11
+ "id": "868bf28c7dfa6b07",
12
+ "type": "leaf",
13
+ "state": {
14
+ "type": "empty",
15
+ "state": {},
16
+ "icon": "lucide-file",
17
+ "title": "新标签页"
18
+ }
19
+ }
20
+ ]
21
+ }
22
+ ],
23
+ "direction": "vertical"
24
+ },
25
+ "left": {
26
+ "id": "241a27cf97cc5c6f",
27
+ "type": "split",
28
+ "children": [
29
+ {
30
+ "id": "448438498df7c61c",
31
+ "type": "tabs",
32
+ "children": [
33
+ {
34
+ "id": "b3ca9eae4f946a44",
35
+ "type": "leaf",
36
+ "state": {
37
+ "type": "file-explorer",
38
+ "state": {
39
+ "sortOrder": "alphabetical",
40
+ "autoReveal": false
41
+ },
42
+ "icon": "lucide-folder-closed",
43
+ "title": "文件列表"
44
+ }
45
+ },
46
+ {
47
+ "id": "59ba0ff8a43ff128",
48
+ "type": "leaf",
49
+ "state": {
50
+ "type": "search",
51
+ "state": {
52
+ "query": "",
53
+ "matchingCase": false,
54
+ "explainSearch": false,
55
+ "collapseAll": false,
56
+ "extraContext": false,
57
+ "sortOrder": "alphabetical"
58
+ },
59
+ "icon": "lucide-search",
60
+ "title": "搜索"
61
+ }
62
+ },
63
+ {
64
+ "id": "9035846dabb5c961",
65
+ "type": "leaf",
66
+ "state": {
67
+ "type": "bookmarks",
68
+ "state": {},
69
+ "icon": "lucide-bookmark",
70
+ "title": "书签"
71
+ }
72
+ }
73
+ ]
74
+ }
75
+ ],
76
+ "direction": "horizontal",
77
+ "width": 300
78
+ },
79
+ "right": {
80
+ "id": "a57821880c8fbeaf",
81
+ "type": "split",
82
+ "children": [
83
+ {
84
+ "id": "c29c48c827e00b59",
85
+ "type": "tabs",
86
+ "children": [
87
+ {
88
+ "id": "6fc5230bf35729dd",
89
+ "type": "leaf",
90
+ "state": {
91
+ "type": "backlink",
92
+ "state": {
93
+ "collapseAll": false,
94
+ "extraContext": false,
95
+ "sortOrder": "alphabetical",
96
+ "showSearch": false,
97
+ "searchQuery": "",
98
+ "backlinkCollapsed": false,
99
+ "unlinkedCollapsed": true
100
+ },
101
+ "icon": "links-coming-in",
102
+ "title": "反向链接"
103
+ }
104
+ },
105
+ {
106
+ "id": "2b62aeacf1c03fe2",
107
+ "type": "leaf",
108
+ "state": {
109
+ "type": "outgoing-link",
110
+ "state": {
111
+ "linksCollapsed": false,
112
+ "unlinkedCollapsed": true
113
+ },
114
+ "icon": "links-going-out",
115
+ "title": "出链"
116
+ }
117
+ },
118
+ {
119
+ "id": "5a29c8ef76bdaefe",
120
+ "type": "leaf",
121
+ "state": {
122
+ "type": "tag",
123
+ "state": {
124
+ "sortOrder": "frequency",
125
+ "useHierarchy": true,
126
+ "showSearch": false,
127
+ "searchQuery": ""
128
+ },
129
+ "icon": "lucide-tags",
130
+ "title": "标签"
131
+ }
132
+ },
133
+ {
134
+ "id": "9f738fe7c6c4fa1c",
135
+ "type": "leaf",
136
+ "state": {
137
+ "type": "all-properties",
138
+ "state": {
139
+ "sortOrder": "frequency",
140
+ "showSearch": false,
141
+ "searchQuery": ""
142
+ },
143
+ "icon": "lucide-archive",
144
+ "title": "添加笔记属性"
145
+ }
146
+ },
147
+ {
148
+ "id": "9e16b53e7c79344f",
149
+ "type": "leaf",
150
+ "state": {
151
+ "type": "outline",
152
+ "state": {
153
+ "followCursor": false,
154
+ "showSearch": false,
155
+ "searchQuery": ""
156
+ },
157
+ "icon": "lucide-list",
158
+ "title": "大纲"
159
+ }
160
+ }
161
+ ]
162
+ }
163
+ ],
164
+ "direction": "horizontal",
165
+ "width": 300,
166
+ "collapsed": true
167
+ },
168
+ "left-ribbon": {
169
+ "hiddenItems": {
170
+ "switcher:打开快速切换": false,
171
+ "graph:查看关系图谱": false,
172
+ "canvas:新建白板": false,
173
+ "daily-notes:打开/创建今天的日记": false,
174
+ "templates:插入模板": false,
175
+ "command-palette:打开命令面板": false,
176
+ "markdown-importer:打开 Markdown 格式转换器": false,
177
+ "workspaces:管理工作区布局": false,
178
+ "publish:发布更改": false,
179
+ "bases:新建数据库": false
180
+ }
181
+ },
182
+ "active": "868bf28c7dfa6b07",
183
+ "lastOpenFiles": []
184
+ }
@@ -33,6 +33,133 @@
33
33
  - 用途: 将需求分解为具体可执行的任务
34
34
  - id = momo-task, uri = https://s.trae.ai/a/1fdc4e
35
35
 
36
+ ## Momo CLI 命令
37
+
38
+ ### 基础命令
39
+
40
+ #### `momo help [-c <command>]`
41
+ 显示帮助信息。如果指定 `-c` 参数,则显示特定命令的详细帮助。
42
+
43
+ **示例:**
44
+ ```bash
45
+ momo help
46
+ momo help -c init
47
+ ```
48
+
49
+ #### `momo env`
50
+ 检查当前环境信息,包括 Node.js 版本、Python 版本等系统依赖。
51
+
52
+ **示例:**
53
+ ```bash
54
+ momo env
55
+ ```
56
+
57
+ #### `momo init [-d <dir>]`
58
+ 初始化 Spec 工程,创建项目目录结构和模板文件。
59
+
60
+ **参数:**
61
+ - `-d, --dir`: 项目目录,如果不提供则使用当前目录
62
+
63
+ **示例:**
64
+ ```bash
65
+ momo init
66
+ momo init -d ./my-project
67
+ ```
68
+
69
+ ### 开发工具命令
70
+
71
+ #### `momo open [-d <dir>]`
72
+ 使用指定的 AI 工具(Antigravity、Trae、Cursor)打开项目目录。
73
+
74
+ **参数:**
75
+ - `-d, --dir`: 指定要打开的目录路径,默认为当前目录
76
+
77
+ **示例:**
78
+ ```bash
79
+ momo open
80
+ momo open -d ./src
81
+ ```
82
+
83
+ #### `momo app -n <name>`
84
+ 创建新的 R2MO/Spring 或 ZERO/Vertx 应用。
85
+
86
+ **参数:**
87
+ - `-n, --name`: 应用名称(必填)
88
+
89
+ **示例:**
90
+ ```bash
91
+ momo app -n my-app
92
+ ```
93
+
94
+ #### `momo domain [-d <dir>]`
95
+ 在指定目录中执行 `r2mo_proto.py` 脚本,用于处理 Maven 项目的领域模型。
96
+
97
+ **参数:**
98
+ - `-d, --dir`: 目标目录(默认为当前目录),必须是包含 `pom.xml` 的 Maven 项目根目录
99
+
100
+ **验证要求:**
101
+ - 目录必须包含 `pom.xml` 文件
102
+ - 必须存在 `{artifactId}-domain` 和 `{artifactId}-ui` 子模块
103
+
104
+ **示例:**
105
+ ```bash
106
+ momo domain
107
+ momo domain -d ./my-maven-project
108
+ ```
109
+
110
+ ### 技能管理命令
111
+
112
+ #### `momo apply -r [repo_name]`
113
+ 从远程仓库安装技能到本地项目的指定目录。
114
+
115
+ **参数:**
116
+ - `-r, --remote`: 从远程仓库安装技能(可选指定仓库名)
117
+
118
+ **安装目标选择:**
119
+ - Cursor 默认 (`.claude/skills/`)
120
+ - Antigravity (`.agent/skills/`)
121
+ - Trae CN (`.trae/skills/`)
122
+ - Trae (`.trae/skills/`)
123
+
124
+ **示例:**
125
+ ```bash
126
+ momo apply -r
127
+ momo apply -r anthropics/skills
128
+ ```
129
+
130
+ #### `momo mcp [-c]`
131
+ 配置 MCP Skills Server,整合项目和全局技能,生成 Cursor 的 `mcp.json` 配置文件。
132
+
133
+ **参数:**
134
+ - `-c, --check`: 仅检查依赖,不进行配置
135
+
136
+ **功能:**
137
+ - 自动安装 MCP 依赖包到 `.r2mo/mcpserver` 目录
138
+ - 生成 `.cursor/mcp.json` 配置文件
139
+ - 将配置内容复制到剪切板
140
+
141
+ **示例:**
142
+ ```bash
143
+ momo mcp
144
+ momo mcp -c
145
+ ```
146
+
147
+ ### 提示词管理命令
148
+
149
+ #### `momo ask`
150
+ 从模板目录中选择提示词并复制到剪切板。
151
+
152
+ **功能:**
153
+ - 从主项目的 `src/_template/R2MO/` 目录加载所有提示词模板
154
+ - 以表格形式显示模板的标题和版本
155
+ - 选择后提取 `--- BEGIN` 和 `--- END` 之间的内容
156
+ - 自动复制到剪切板并显示详细信息
157
+
158
+ **示例:**
159
+ ```bash
160
+ momo ask
161
+ ```
162
+
36
163
  ## 项目目录结构
37
164
 
38
165
  ```
@@ -42,6 +169,17 @@ project/
42
169
  │ ├── prompt/
43
170
  │ ├── scripts/
44
171
  │ └── template/
172
+ ├── .claude/
173
+ │ └── skills/ # Cursor 技能目录
174
+ ├── .agent/
175
+ │ └── skills/ # Antigravity 技能目录
176
+ ├── .trae/
177
+ │ └── skills/ # Trae 技能目录
178
+ ├── .r2mo/
179
+ │ ├── repo/ # 远程仓库缓存
180
+ │ └── mcpserver/ # MCP 服务器配置
181
+ ├── .cursor/
182
+ │ └── mcp.json # Cursor MCP 配置
45
183
  ├── integration/
46
184
  ├── source/
47
185
  ├── specification/
@@ -82,29 +220,45 @@ project/
82
220
 
83
221
  ## 工作流程规范
84
222
 
85
- ### 需求变更流程
86
- 1. 使用 `momo add -n "需求名称"` 创建新的需求变更
87
- 2. 使用 `momo plan -n "需求名称"` 生成开发计划
88
- 3. 使用 `momo run` 执行具体任务
89
- 4. 使用 `momo archive -n "需求名称"` 归档完成的需求
223
+ ### 项目初始化流程
224
+ 1. 使用 `momo init [-d <dir>]` 创建新的 Spec 工程
225
+ 2. 编辑 `specification/project.md` 定义项目基本信息
226
+ 3. 编辑 `specification/project-model.md` 定义领域模型
227
+ 4. 编辑 `specification/requirement.md` 定义项目需求
228
+
229
+ ### 技能管理流程
230
+ 1. 使用 `momo apply -r` 从远程仓库安装技能到项目
231
+ 2. 使用 `momo mcp` 配置 MCP Skills Server
232
+ 3. 技能会自动整合到 Cursor 的 MCP 工具中
233
+
234
+ ### 应用开发流程
235
+ 1. 使用 `momo app -n <name>` 创建新的应用项目
236
+ 2. 选择应用类型(R2MO/Spring 或 ZERO/Vertx)
237
+ 3. 使用 `momo domain -d <dir>` 处理领域模型
90
238
 
91
- ### 角色管理流程
92
- 1. 使用 `momo actors` 查看所有已定义角色
93
- 2. 使用 `momo actor -a "角色名称"` 创建新角色
239
+ ### 提示词使用流程
240
+ 1. 使用 `momo ask` 从模板目录选择提示词
241
+ 2. 提示词会自动复制到剪切板
242
+ 3. 在 AI 工具中粘贴使用
94
243
 
95
- ### 任务执行流程
96
- 1. 使用 `momo tasks` 查看所有待执行任务
97
- 2. 使用 `momo run -a {actor} -t {task}` 分配任务给角色执行
244
+ ### AI 工具集成流程
245
+ 1. 使用 `momo open [-d <dir>]` 打开项目到指定的 AI 工具
246
+ 2. 支持的工具:Antigravity、Trae、Cursor
247
+ 3. 使用 `momo mcp` 配置 Cursor 的 MCP 服务器
98
248
 
99
249
  ## 提示词规范
100
250
 
101
- 1. 所有提示词存储在 `.momo/prompt/` 目录中
102
- 2. 使用 `momo run` 命令时会自动将相关提示词复制到剪贴板
103
- 3. 提示词内容基于项目规范和需求文档生成
251
+ 1. 所有提示词模板存储在 `src/_template/R2MO/` 目录中
252
+ 2. 使用 `momo ask` 命令可以快速选择和复制提示词
253
+ 3. 提示词模板使用 front-matter 格式,包含 `title` 和 `version` 字段
254
+ 4. 提示词内容位于 `--- BEGIN` 和 `--- END` 标记之间
104
255
 
105
256
  ## 注意事项
106
257
 
107
- 1. 请勿直接修改 `specification/changes/` 目录下的文件,应通过 `momo` 命令进行管理
258
+ 1. 请勿直接修改 `specification/changes/` 目录下的文件,应通过规范流程进行管理
108
259
  2. 所有需求变更应遵循 OpenSpec 标准流程
109
260
  3. 归档的需求存储在 `specification/.archives/` 目录中,可通过时间戳识别
110
- 4. 不同 AI 工具应使用对应的 `integration/` 子目录进行配置
261
+ 4. 不同 AI 工具应使用对应的技能目录进行配置
262
+ 5. `momo domain` 命令要求目标目录必须是有效的 Maven 项目,且包含必需的子模块
263
+ 6. `momo app` 命令会检查目标目录是否已存在,避免覆盖现有项目
264
+ 7. 远程仓库缓存存储在 `.r2mo/repo` 目录中,已自动添加到 `.gitignore`
@@ -0,0 +1,10 @@
1
+ ---
2
+ title: 模型强化提示
3
+ version: 1.0.0
4
+ ---
5
+
6
+ ## 提示词
7
+
8
+ --- BEGIN
9
+ 使用 r2mo-rad-domain 技能分析当前项目并且强化模型,包括 enum 枚举类型追加中文说明,没有中文注释的属性追加中文注释。
10
+ --- END
@@ -0,0 +1,13 @@
1
+ {
2
+ "executor": "executeApp",
3
+ "description": "创建 R2MO/Spring 或 ZERO/Vertx 应用",
4
+ "command": "app",
5
+ "options": [
6
+ {
7
+ "name": "name",
8
+ "alias": "n",
9
+ "description": "应用名称(必填)",
10
+ "type": "string"
11
+ }
12
+ ]
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "executor": "executeApply",
3
+ "description": "从远程仓库安装技能到本地项目(仅支持远程)",
4
+ "command": "apply",
5
+ "options": [
6
+ {
7
+ "name": "remote",
8
+ "alias": "r",
9
+ "description": "从远程仓库安装技能(可选指定仓库名)",
10
+ "type": "string"
11
+ }
12
+ ]
13
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "executor": "executeAsk",
3
+ "description": "从模板目录中选择提示词并复制到剪切板",
4
+ "command": "ask",
5
+ "options": []
6
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "executor": "executeDocs",
3
+ "description": "使用 Obsidian 打开文档目录",
4
+ "command": "docs",
5
+ "options": [
6
+ {
7
+ "name": "dir",
8
+ "alias": "d",
9
+ "description": "目标目录(默认当前目录)",
10
+ "type": "string"
11
+ }
12
+ ]
13
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "executor": "executeDomain",
3
+ "description": "在指定目录执行 r2mo_proto 脚本生成 Protobuf",
4
+ "command": "domain",
5
+ "options": [
6
+ {
7
+ "name": "dir",
8
+ "alias": "d",
9
+ "description": "目标目录(默认为当前目录)",
10
+ "type": "string"
11
+ },
12
+ {
13
+ "name": "entity",
14
+ "alias": "e",
15
+ "description": "从 Entity 生成(true)或从 SQL 生成(false),默认 true",
16
+ "type": "boolean"
17
+ }
18
+ ]
19
+ }
@@ -4,7 +4,7 @@
4
4
  "command": "init",
5
5
  "options": [
6
6
  {
7
- "name": "directory",
7
+ "name": "dir",
8
8
  "alias": "d",
9
9
  "description": "项目目录,如果不提供则是默认目录!",
10
10
  "default": "."
@@ -0,0 +1,6 @@
1
+ {
2
+ "executor": "executeMmr0",
3
+ "description": "从 r2mo-spec 仓库下载并生成 Flyway SQL 文件",
4
+ "command": "mmr0",
5
+ "options": []
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "executor": "executeMmr2",
3
+ "description": "从 r2mo-spec 仓库下载并生成 Entity 类",
4
+ "command": "mmr2",
5
+ "options": []
6
+ }
@@ -0,0 +1,133 @@
1
+ const { spawn } = require('child_process');
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+ const Ec = require('../epic');
5
+ const { selectSingle } = require('../utils/momo-menu');
6
+ const { parseOptional } = require('../utils/momo-args');
7
+
8
+ // 应用类型配置
9
+ const APP_TYPES = [
10
+ {
11
+ name: 'R2MO / Spring',
12
+ command: 'spring',
13
+ description: '基于 Spring 框架的 R2MO 应用'
14
+ },
15
+ {
16
+ name: 'ZERO / Vertx',
17
+ command: 'zero',
18
+ description: '基于 Vertx 框架的 ZERO 应用'
19
+ }
20
+ ];
21
+
22
+ /**
23
+ * 检查命令是否可用
24
+ * @param {string} command 命令名称
25
+ * @returns {Promise<boolean>}
26
+ */
27
+ const _isCommandAvailable = async (command) => {
28
+ return new Promise((resolve) => {
29
+ const whereCmd = process.platform === 'win32' ? 'where' : 'which';
30
+ const childProcess = spawn(whereCmd, [command], { stdio: 'pipe' });
31
+ childProcess.on('close', (code) => {
32
+ resolve(code === 0);
33
+ });
34
+ childProcess.on('error', () => {
35
+ resolve(false);
36
+ });
37
+ });
38
+ };
39
+
40
+ /**
41
+ * 执行 ai 命令
42
+ * @param {string} appType 应用类型 (spring/zero)
43
+ * @param {string} appName 应用名称
44
+ */
45
+ const _executeAiCommand = async (appType, appName) => {
46
+ return new Promise((resolve, reject) => {
47
+ Ec.waiting(`🚀 正在创建 ${appType === 'spring' ? 'R2MO/Spring' : 'ZERO/Vertx'} 应用: ${appName.cyan}...`);
48
+
49
+ const child = spawn('ai', [appType, '-n', appName], {
50
+ stdio: 'inherit',
51
+ shell: false
52
+ });
53
+
54
+ child.on('close', (code) => {
55
+ if (code === 0) {
56
+ Ec.info(`✅ 应用创建成功: ${appName.cyan}`);
57
+ resolve();
58
+ } else {
59
+ reject(new Error(`ai 命令执行失败,退出码: ${code}`));
60
+ }
61
+ });
62
+
63
+ child.on('error', (error) => {
64
+ reject(new Error(`执行 ai 命令失败: ${error.message}`));
65
+ });
66
+ });
67
+ };
68
+
69
+ module.exports = async (options) => {
70
+ try {
71
+ // 1. 检查 -n 参数是否传入
72
+ const nameArg = parseOptional('name', 'n');
73
+ if (!nameArg.hasFlag || !nameArg.value) {
74
+ Ec.error('❌ 缺少必需参数: -n <应用名称>');
75
+ console.log('');
76
+ console.log(' 用法:'.gray);
77
+ console.log(' momo app -n <应用名称>'.cyan);
78
+ console.log('');
79
+ process.exit(1);
80
+ }
81
+
82
+ const appName = nameArg.value;
83
+
84
+ // 2. 检查目录是否已存在
85
+ const appDir = path.join(process.cwd(), appName);
86
+ if (fs.existsSync(appDir)) {
87
+ Ec.warn(`⚠ 目录已存在: ${appDir}`);
88
+ console.log('');
89
+ Ec.error('请选择其他应用名称或删除现有目录');
90
+ console.log('');
91
+ process.exit(1);
92
+ }
93
+
94
+ // 3. 检查 ai 命令是否存在
95
+ Ec.waiting('正在检查 ai 命令...');
96
+ const aiAvailable = await _isCommandAvailable('ai');
97
+
98
+ if (!aiAvailable) {
99
+ Ec.error('❌ 未找到 ai 命令');
100
+ console.log('');
101
+ Ec.error('请先安装 zero-ai:');
102
+ console.log(' npm install -g zero-ai'.cyan);
103
+ console.log('');
104
+ process.exit(1);
105
+ }
106
+
107
+ Ec.info('✓ ai 命令已安装');
108
+
109
+ // 4. 显示菜单选择应用类型
110
+ console.log('');
111
+ const menuItems = APP_TYPES.map(type => ({
112
+ name: type.name,
113
+ description: type.description,
114
+ _command: type.command
115
+ }));
116
+
117
+ const selected = await selectSingle(menuItems, '选择应用类型');
118
+
119
+ if (!selected) {
120
+ Ec.waiting('已取消');
121
+ process.exit(0);
122
+ }
123
+
124
+ // 5. 执行 ai 命令
125
+ await _executeAiCommand(selected._command, appName);
126
+
127
+ process.exit(0);
128
+
129
+ } catch (error) {
130
+ Ec.error(`❌ 执行失败: ${error.message}`);
131
+ process.exit(1);
132
+ }
133
+ };