momo-ai 1.0.2 → 1.0.3
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 +25 -25
- package/package.json +1 -1
- package/src/commander/run.json +1 -1
- package/src/executor/executeHelp.js +6 -1
- package/src/executor/executeInit.js +2 -1
- package/src/executor/executePlan.js +17 -2
- package/src/executor/executeRun.js +18 -2
package/README.md
CHANGED
|
@@ -8,22 +8,21 @@
|
|
|
8
8
|
当前工具会在操作系统中安装 `momo` 命令,使用它进行 `SDD - Spec Driven Development` 开发:
|
|
9
9
|
|
|
10
10
|
1. 参考:`OpenSpec / Spec-Kit / Kiro`
|
|
11
|
-
2.
|
|
12
|
-
|
|
11
|
+
2. 工具支持:
|
|
12
|
+
- `Trea`(推荐使用,可支持多Agent模式)
|
|
13
|
+
- `Cursor`(稍贵,可支持多Agent模式)
|
|
14
|
+
- `Lingma`
|
|
15
|
+
- `Kiro`
|
|
16
|
+
3. 中文规范,命令运行之后将 `prompt` 提示词拷贝到剪切板,直接复制到工具中即可使用,提示词生成之后会存储在 `.working` 目录下。
|
|
13
17
|
4. 多个 Agent 协同,实现 Team 团队模式的 AI 开发,无模型限制(推荐使用同一个模型进行任务协同开发)
|
|
14
18
|
|
|
15
19
|
和 `OpenSpec / Spec-Kit / Kiro` 原生工具不同,当前工具以 AI Agent 开发为核心,提供从 Plan -> Deployment
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
`AI 开发 + 人工审核`,本工具的宗旨就是 `prompt` 的模板化。
|
|
20
|
+
完整生命周期的整体开发流程,是 SDD 的一种落地手段——暴力、简单、易懂。由于辅助工具可选择模型,所以本工具不提供模型选择,模型本身取决于你所使用的工具本身,命令行只是一个辅助,核心开发模式为:
|
|
21
|
+
`AI 开发 + 人工审核`,本工具的核心是 `prompt` 的模板化。
|
|
19
22
|
|
|
20
|
-
>
|
|
23
|
+
> 除开 `momo` 命令后续会提供和模型直接交互的 `lain` 命令,近似 `iFlow / openspec` 的功能。
|
|
21
24
|
|
|
22
|
-
## 2.
|
|
23
|
-
|
|
24
|
-
- 执行 `momo repo` 的过程中会依赖一个已经初始化好的项目 `Git` 地址,且当前项目本身依赖一个 `Git`(因为项目是以
|
|
25
|
-
`submodule` 的方式添加到环境中的)。
|
|
26
|
-
- 移除相关命令如 `submodule` 只支持 Linux/Mac 的脚本,这个用独立脚本防止更改丢失。
|
|
25
|
+
## 2. 工具使用
|
|
27
26
|
|
|
28
27
|
### 2.1. 安装
|
|
29
28
|
|
|
@@ -33,9 +32,16 @@ npm install -g momo-ai
|
|
|
33
32
|
momo help
|
|
34
33
|
```
|
|
35
34
|
|
|
36
|
-
### 2.2.
|
|
35
|
+
### 2.2. 操作步骤
|
|
37
36
|
|
|
38
|
-
|
|
37
|
+
1. 使用 `momo init` 初始化协同工程项目(运行之前可使用 `momo env` 检查环境)。
|
|
38
|
+
2. 使用 `momo repo` 添加项目代码库以及工程实例(有多少个 `Agent` 工作就添加多少工程实例),添加完成后可使用 `momo open`
|
|
39
|
+
直接打开工程。
|
|
40
|
+
3. 更新 `project.md / project-model.md / requirement.md` 的细节文档(可用AI帮助拆分和书写)
|
|
41
|
+
4. 使用 `momo add -n 需求名称` 添加细节需求(可用AI帮助拆分和书写:`momo plan -n 需求名称`)
|
|
42
|
+
5. 使用 `momo tasks` 列出所有任务,并且使用 `momo run` 运行任务得到任务提示词
|
|
43
|
+
|
|
44
|
+
> 带 (CV) 标记的命令运行成功后可直接“Ctrl + V”粘贴到 TRAE / Lingma / Cursor / Kiro 中执行。
|
|
39
45
|
|
|
40
46
|
### 2.3. 命令:不定模型
|
|
41
47
|
|
|
@@ -86,30 +92,24 @@ momo actor -a "角色名称" # 添加新角色 -> 交互式命令,
|
|
|
86
92
|
|
|
87
93
|
# momo run ( 生成提示词 -> 剪切板,自动计算空闲的 source-01 )
|
|
88
94
|
momo run -a {actor} -t {task} # 将任务分配给角色,检查执行目录看哪些任务正在执行
|
|
95
|
+
momo run # 从菜单中选择任务
|
|
89
96
|
momo unlock # 解锁任务 -> 任务状态 = 待办
|
|
90
97
|
```
|
|
91
98
|
|
|
92
|
-
|
|
99
|
+
### 2.4. 控制台:定模型
|
|
93
100
|
|
|
94
|
-
|
|
95
|
-
2. 使用 `momo repo` 添加项目代码库以及工程实例(有多少个 `Agent` 工作就添加多少工程实例),添加完成后可使用 `momo open`
|
|
96
|
-
直接打开工程。
|
|
97
|
-
3. 更新 `project.md / project-model.md / requirement.md` 的细节文档(可用AI帮助拆分和书写)
|
|
98
|
-
4. 使用 `momo add -n 需求名称` 添加细节需求(可用AI帮助拆分和书写:`momo plan -n 需求名称`)
|
|
99
|
-
5. 使用 `momo tasks` 列出所有任务,并且使用 `momo run` 运行任务得到任务提示词
|
|
100
|
-
|
|
101
|
-
> 带 (CV) 标记的命令运行成功后可直接“Ctrl + V”粘贴到 TRAE / Lingma / Cursor / Kiro 中执行。
|
|
101
|
+
> 控制台开发中(Lain 模式)
|
|
102
102
|
|
|
103
|
-
##
|
|
103
|
+
## 3. 参考链接
|
|
104
104
|
|
|
105
|
-
###
|
|
105
|
+
### 3.1. 旧版
|
|
106
106
|
|
|
107
107
|
- (后端)Zero Ecotope:<https://www.zerows.io>
|
|
108
108
|
- (前端)Zero UI:<https://www.vertxui.cn>
|
|
109
109
|
- (工具)Zero AI:<https://www.vertxai.cn>
|
|
110
110
|
- (标准)Zero Schema:<https://www.vertx-cloud.cn>
|
|
111
111
|
|
|
112
|
-
###
|
|
112
|
+
### 3.2. 新增
|
|
113
113
|
|
|
114
114
|
- Maven 统一版本管理:<https://gitee.com/silentbalanceyh/rachel-momo>
|
|
115
115
|
- Rapid快速开发框架:<https://gitee.com/silentbalanceyh/r2mo-rapid>
|
package/package.json
CHANGED
package/src/commander/run.json
CHANGED
|
@@ -4,7 +4,12 @@ module.exports = (options) => {
|
|
|
4
4
|
const metadata = Ec.parseMetadata();
|
|
5
5
|
metadata.forEach(runner => {
|
|
6
6
|
Ec.waiting(`命令:` + `momo ${runner.command} [-options]`.green);
|
|
7
|
-
|
|
7
|
+
// 检查描述中是否包含"CV",如果包含则在(CV)和说明之间添加红色高亮emoji
|
|
8
|
+
let description = runner.description;
|
|
9
|
+
if (description.includes("(CV)")) {
|
|
10
|
+
description = description.replace("(CV)", "(CV)📋️ ");
|
|
11
|
+
}
|
|
12
|
+
Ec.waiting(`说明`.yellow + `:${description}`);
|
|
8
13
|
const options = runner.options || [];
|
|
9
14
|
options.forEach(option => {
|
|
10
15
|
if (option.hasOwnProperty('default')) {
|
|
@@ -68,8 +68,9 @@ const _isRequirementExists = (changesDir, requirementName) => {
|
|
|
68
68
|
/**
|
|
69
69
|
* 将内容复制到剪贴板(去除换行符)
|
|
70
70
|
* @param {string} content 要复制的内容
|
|
71
|
+
* @param {string} requirementName 需求名称
|
|
71
72
|
*/
|
|
72
|
-
const _copyToClipboard = async (content) => {
|
|
73
|
+
const _copyToClipboard = async (content, requirementName) => {
|
|
73
74
|
try {
|
|
74
75
|
// 去除换行符,将内容合并为一行后再复制到剪贴板
|
|
75
76
|
const contentWithoutNewlines = content.replace(/\r?\n|\r/g, ' ');
|
|
@@ -77,6 +78,20 @@ const _copyToClipboard = async (content) => {
|
|
|
77
78
|
proc.stdin.write(contentWithoutNewlines);
|
|
78
79
|
proc.stdin.end();
|
|
79
80
|
Ec.waiting('✅ 计划提示词已复制到剪贴板');
|
|
81
|
+
|
|
82
|
+
// 保存内容到 .working 目录
|
|
83
|
+
const workingDir = path.resolve(process.cwd(), '.working');
|
|
84
|
+
const fileName = `REQ-${requirementName}.txt`;
|
|
85
|
+
const filePath = path.join(workingDir, fileName);
|
|
86
|
+
|
|
87
|
+
// 确保 .working 目录存在
|
|
88
|
+
if (!fs.existsSync(workingDir)) {
|
|
89
|
+
await fsAsync.mkdir(workingDir, { recursive: true });
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// 写入文件
|
|
93
|
+
await fsAsync.writeFile(filePath, content);
|
|
94
|
+
Ec.waiting(`📄 计划提示词已保存到文件: ${filePath}`);
|
|
80
95
|
} catch (error) {
|
|
81
96
|
Ec.waiting(`复制到剪贴板失败: ${error.message}`);
|
|
82
97
|
// 在非 macOS 系统上可能没有 pbcopy,提供备选方案
|
|
@@ -123,7 +138,7 @@ module.exports = async (options) => {
|
|
|
123
138
|
const renderedContent = _renderTemplate(templateContent, { NAME: requirementName });
|
|
124
139
|
|
|
125
140
|
// 将提示词复制到剪贴板
|
|
126
|
-
await _copyToClipboard(renderedContent);
|
|
141
|
+
await _copyToClipboard(renderedContent, requirementName);
|
|
127
142
|
|
|
128
143
|
Ec.info(`✅ 成功生成需求 "${requirementName}" 的计划提示词`);
|
|
129
144
|
process.exit(0);
|
|
@@ -58,8 +58,10 @@ const _renderTemplate = (template, data) => {
|
|
|
58
58
|
/**
|
|
59
59
|
* 将内容复制到剪贴板
|
|
60
60
|
* @param {string} content 要复制的内容
|
|
61
|
+
* @param {string} requirementName 需求名称
|
|
62
|
+
* @param {string} taskName 任务名称
|
|
61
63
|
*/
|
|
62
|
-
const _copyToClipboard = async (content) => {
|
|
64
|
+
const _copyToClipboard = async (content, requirementName, taskName) => {
|
|
63
65
|
try {
|
|
64
66
|
const proc = spawn('pbcopy', {stdio: 'pipe'});
|
|
65
67
|
proc.stdin.write(content);
|
|
@@ -78,6 +80,20 @@ const _copyToClipboard = async (content) => {
|
|
|
78
80
|
});
|
|
79
81
|
|
|
80
82
|
Ec.waiting('📄 任务执行提示词已拷贝到剪切板');
|
|
83
|
+
|
|
84
|
+
// 保存内容到 .working 目录
|
|
85
|
+
const workingDir = path.resolve(process.cwd(), '.working');
|
|
86
|
+
const fileName = `REQ-${requirementName}-${taskName}.txt`;
|
|
87
|
+
const filePath = path.join(workingDir, fileName);
|
|
88
|
+
|
|
89
|
+
// 确保 .working 目录存在
|
|
90
|
+
if (!fs.existsSync(workingDir)) {
|
|
91
|
+
await fsAsync.mkdir(workingDir, { recursive: true });
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// 写入文件
|
|
95
|
+
await fsAsync.writeFile(filePath, content);
|
|
96
|
+
Ec.waiting(`📄 任务执行提示词已保存到文件: ${filePath}`);
|
|
81
97
|
} catch (error) {
|
|
82
98
|
Ec.waiting(`⚠️ 无法拷贝到剪切板: ${error.message}`);
|
|
83
99
|
// 备选方案:显示内容
|
|
@@ -507,7 +523,7 @@ module.exports = async (options) => {
|
|
|
507
523
|
});
|
|
508
524
|
|
|
509
525
|
// 将提示词复制到剪贴板
|
|
510
|
-
await _copyToClipboard(renderedContent);
|
|
526
|
+
await _copyToClipboard(renderedContent, requirementName, selectedTask.name);
|
|
511
527
|
Ec.info(`✅ 任务 ${selectedTask.name} 准备完成,请查看剪切板中的提示词`);
|
|
512
528
|
} catch (error) {
|
|
513
529
|
Ec.info(`✅ 任务 ${selectedTask.name} 查找完成`);
|