momo-ai 1.0.19 → 1.0.21
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/.claude/skills/algorithmic-art/LICENSE.txt +202 -0
- package/.claude/skills/algorithmic-art/SKILL.md +405 -0
- package/.claude/skills/algorithmic-art/templates/generator_template.js +223 -0
- package/.claude/skills/algorithmic-art/templates/viewer.html +599 -0
- package/.claude/skills/r2mo-rad-lain/PROMPT.md +281 -0
- package/.claude/skills/r2mo-rad-lain/README.md +192 -0
- package/.claude/skills/r2mo-rad-lain/SKILL.md +412 -0
- package/.claude/skills/r2mo-rad-lain/examples/argument-parsing.js +154 -0
- package/.claude/skills/r2mo-rad-lain/examples/file-operations.js +182 -0
- package/.claude/skills/r2mo-rad-lain/file-utils-api.md +281 -0
- package/.claude/skills/r2mo-rad-lain/menu-api.md +187 -0
- package/.claude/skills/r2mo-rad-lain/scripts/file-utils.js +223 -0
- package/.claude/skills/r2mo-rad-lain/scripts/menu.js +289 -0
- package/.claude/skills/r2mo-rad-lain/scripts/yaml-parser.js +209 -0
- package/.claude/skills/r2mo-rad-lain/templates/command.json.template +13 -0
- package/.claude/skills/r2mo-rad-lain/templates/executor.js.template +32 -0
- package/.claude/skills/r2mo-rad-lain/templates/interactive-menu.js.template +221 -0
- package/.cursor/mcp.json +17 -0
- package/.obsidian/app.json +1 -0
- package/.obsidian/appearance.json +4 -0
- package/.obsidian/community-plugins.json +4 -0
- package/.obsidian/core-plugins.json +33 -0
- package/.obsidian/plugins/ai-agent/main.js +98495 -0
- package/.obsidian/plugins/ai-agent/manifest.json +11 -0
- package/.obsidian/plugins/ai-agent/styles.css +806 -0
- package/.obsidian/plugins/dataview/main.js +20876 -0
- package/.obsidian/plugins/dataview/manifest.json +11 -0
- package/.obsidian/plugins/dataview/styles.css +141 -0
- package/.obsidian/plugins/obsidian-excalidraw-plugin/main.js +10 -0
- package/.obsidian/plugins/obsidian-excalidraw-plugin/manifest.json +12 -0
- package/.obsidian/plugins/obsidian-excalidraw-plugin/styles.css +1 -0
- package/.obsidian/plugins/templater-obsidian/main.js +45 -0
- package/.obsidian/plugins/templater-obsidian/manifest.json +11 -0
- package/.obsidian/plugins/templater-obsidian/styles.css +226 -0
- package/.obsidian/plugins/terminal/main.js +200 -0
- package/.obsidian/plugins/terminal/manifest.json +14 -0
- package/.obsidian/plugins/terminal/styles.css +32 -0
- package/.obsidian/themes/AnuPpuccin/manifest.json +7 -0
- package/.obsidian/themes/AnuPpuccin/theme.css +9080 -0
- package/.obsidian/themes/Things/manifest.json +7 -0
- package/.obsidian/themes/Things/theme.css +1628 -0
- package/.obsidian/workspace.json +196 -0
- package/README.md +10 -123
- package/docs/images/logo.jpeg +0 -0
- package/install.sh +1 -0
- package/package.json +6 -2
- package/skills/r2mo-rad-lain/SKILL.md +101 -0
- package/src/_agent/trae/momo-datamodel.json +2 -1
- package/src/_agent/trae/momo-module-req.json +2 -1
- package/src/_agent/trae/momo-system-req.json +2 -1
- package/src/_agent/trae/momo-task.json +2 -1
- package/src/_agent/trae/momo-taskplan.json +2 -1
- package/src/_mcp/skills-server.mjs +70 -0
- package/src/_skill/repositories.json +16 -0
- package/src/_template/LAIN/.momo/advanced/refer.json +0 -4
- package/src/commander/help.json +5 -0
- package/src/commander/mcp.json +13 -0
- package/src/commander/open.json +8 -2
- package/src/commander/skills.json +20 -0
- package/src/executor/executeEnv.js +48 -38
- package/src/executor/executeHelp.js +77 -16
- package/src/executor/executeInit.js +203 -149
- package/src/executor/executeMcp.js +290 -0
- package/src/executor/executeOpen.js +144 -125
- package/src/executor/executeSkills.js +747 -0
- package/src/executor/index.js +5 -39
- package/src/momo.js +2 -1
- package/src/utils/momo-args.js +39 -0
- package/src/utils/momo-file-utils.js +75 -0
- package/src/utils/momo-menu.js +54 -0
- package/src/commander/actor.json +0 -12
- package/src/commander/actors.json +0 -6
- package/src/commander/add.json +0 -12
- package/src/commander/agent.json +0 -12
- package/src/commander/agentcfg.json +0 -5
- package/src/commander/archive.json +0 -12
- package/src/commander/commit.json +0 -12
- package/src/commander/console.json +0 -7
- package/src/commander/lain.json +0 -7
- package/src/commander/list.json +0 -7
- package/src/commander/plan.json +0 -12
- package/src/commander/project.json +0 -12
- package/src/commander/pull.json +0 -6
- package/src/commander/push.json +0 -6
- package/src/commander/repo.json +0 -18
- package/src/commander/run.json +0 -18
- package/src/commander/show.json +0 -12
- package/src/commander/tasks.json +0 -18
- package/src/commander/unlock.json +0 -6
- package/src/commander/validate.json +0 -12
- package/src/executor/executeActor.js +0 -133
- package/src/executor/executeActors.js +0 -58
- package/src/executor/executeAdd.js +0 -307
- package/src/executor/executeAgent.js +0 -224
- package/src/executor/executeAgentCfg.js +0 -195
- package/src/executor/executeArchive.js +0 -124
- package/src/executor/executeCommit.js +0 -202
- package/src/executor/executeConsole.js +0 -142
- package/src/executor/executeList.js +0 -133
- package/src/executor/executePlan.js +0 -164
- package/src/executor/executeProject.js +0 -312
- package/src/executor/executePull.js +0 -127
- package/src/executor/executePush.js +0 -243
- package/src/executor/executeRepo.js +0 -238
- package/src/executor/executeRun.js +0 -644
- package/src/executor/executeShow.js +0 -164
- package/src/executor/executeTasks.js +0 -384
- package/src/executor/executeUnlock.js +0 -110
- package/src/executor/executeValidate.js +0 -210
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const Ec = require('../epic');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 获取模板中的标题结构
|
|
7
|
-
* @param {string} templatePath 模板文件路径
|
|
8
|
-
* @returns {Array} 标题结构数组
|
|
9
|
-
*/
|
|
10
|
-
const _getTemplateStructure = (templatePath) => {
|
|
11
|
-
if (!fs.existsSync(templatePath)) {
|
|
12
|
-
throw new Error(`模板文件不存在: ${templatePath}`);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const content = fs.readFileSync(templatePath, 'utf8');
|
|
16
|
-
const lines = content.split('\n');
|
|
17
|
-
const headings = [];
|
|
18
|
-
|
|
19
|
-
lines.forEach(line => {
|
|
20
|
-
// 直接计算 # 符号数量确定层级
|
|
21
|
-
const headingMatch = line.match(/^(#{1,6})\s+(.+)$/);
|
|
22
|
-
if (headingMatch) {
|
|
23
|
-
const level = headingMatch[1].length;
|
|
24
|
-
const title = headingMatch[2].trim();
|
|
25
|
-
// 移除标题中的占位符内容(如 [xxx])
|
|
26
|
-
const cleanTitle = title.replace(/\[.*?\]/g, '').trim();
|
|
27
|
-
if (cleanTitle) {
|
|
28
|
-
headings.push({level, title: cleanTitle});
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
return headings;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* 获取需求文件中的标题结构
|
|
38
|
-
* @param {string} filePath 需求文件路径
|
|
39
|
-
* @returns {Array} 标题结构数组
|
|
40
|
-
*/
|
|
41
|
-
const _getFileStructure = (filePath) => {
|
|
42
|
-
if (!fs.existsSync(filePath)) {
|
|
43
|
-
throw new Error(`需求文件不存在: ${filePath}`);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const content = fs.readFileSync(filePath, 'utf8');
|
|
47
|
-
const lines = content.split('\n');
|
|
48
|
-
const headings = [];
|
|
49
|
-
|
|
50
|
-
lines.forEach(line => {
|
|
51
|
-
// 直接计算 # 符号数量确定层级
|
|
52
|
-
const headingMatch = line.match(/^(#{1,6})\s+(.+)$/);
|
|
53
|
-
if (headingMatch) {
|
|
54
|
-
const level = headingMatch[1].length;
|
|
55
|
-
const title = headingMatch[2].trim();
|
|
56
|
-
headings.push({level, title});
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
return headings;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* 构建完整的树型结构
|
|
65
|
-
* @param {Array} headings 标题数组
|
|
66
|
-
* @returns {Array} 树型结构
|
|
67
|
-
*/
|
|
68
|
-
const _buildTreeStructure = (headings) => {
|
|
69
|
-
const structure = [];
|
|
70
|
-
const stack = [];
|
|
71
|
-
|
|
72
|
-
headings.forEach(heading => {
|
|
73
|
-
const {level, title} = heading;
|
|
74
|
-
|
|
75
|
-
// 调整栈以匹配当前层级
|
|
76
|
-
while (stack.length >= level) {
|
|
77
|
-
stack.pop();
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const item = {level, title, children: []};
|
|
81
|
-
|
|
82
|
-
if (stack.length > 0) {
|
|
83
|
-
stack[stack.length - 1].children.push(item);
|
|
84
|
-
} else {
|
|
85
|
-
structure.push(item);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
stack.push(item);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
return structure;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* 打印树型结构
|
|
96
|
-
* @param {Array} items 结构项数组
|
|
97
|
-
* @param {number} indent 缩进级别
|
|
98
|
-
*/
|
|
99
|
-
const _printTree = (items, indent = 0) => {
|
|
100
|
-
items.forEach(item => {
|
|
101
|
-
const prefix = ' '.repeat(indent);
|
|
102
|
-
Ec.waiting(`${prefix}├─ ${item.title}`);
|
|
103
|
-
|
|
104
|
-
if (item.children && item.children.length > 0) {
|
|
105
|
-
_printTree(item.children, indent + 1);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* 打印带高亮的树型结构
|
|
112
|
-
* @param {Array} items 结构项数组
|
|
113
|
-
* @param {Set} missingTitles 缺失的标题集合
|
|
114
|
-
* @param {number} indent 缩进级别
|
|
115
|
-
*/
|
|
116
|
-
const _printTreeWithHighlight = (items, missingTitles, indent = 0) => {
|
|
117
|
-
items.forEach(item => {
|
|
118
|
-
const prefix = ' '.repeat(indent);
|
|
119
|
-
if (missingTitles.has(item.title)) {
|
|
120
|
-
// 缺失的章节用红色高亮并添加emoji标识
|
|
121
|
-
Ec.error(`${prefix}├─ ❌ ${item.title}`);
|
|
122
|
-
} else {
|
|
123
|
-
// 正常章节用白色显示
|
|
124
|
-
Ec.waiting(`${prefix}├─ ${item.title}`);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (item.children && item.children.length > 0) {
|
|
128
|
-
_printTreeWithHighlight(item.children, missingTitles, indent + 1);
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* 查找缺失的章节
|
|
135
|
-
* @param {Array} templateStructure 模板结构
|
|
136
|
-
* @param {Array} fileStructure 文件结构
|
|
137
|
-
* @returns {Array} 缺失的章节列表
|
|
138
|
-
*/
|
|
139
|
-
const _findMissingSections = (templateStructure, fileStructure) => {
|
|
140
|
-
const templateTitles = templateStructure.map(item => item.title);
|
|
141
|
-
const fileTitles = fileStructure.map(item => item.title);
|
|
142
|
-
|
|
143
|
-
// 找出在模板中存在但在文件中缺失的章节
|
|
144
|
-
return templateStructure.filter(item =>
|
|
145
|
-
!fileTitles.includes(item.title)
|
|
146
|
-
);
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
module.exports = (options) => {
|
|
150
|
-
// 参数提取
|
|
151
|
-
const parsed = Ec.parseArgument(options);
|
|
152
|
-
const requirementName = parsed.name || parsed.n;
|
|
153
|
-
|
|
154
|
-
// 验证参数
|
|
155
|
-
if (!requirementName) {
|
|
156
|
-
Ec.error("❌ 请提供需求名称 (-n, --name)");
|
|
157
|
-
process.exit(1);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
try {
|
|
161
|
-
// 构建路径
|
|
162
|
-
const projectDir = process.cwd();
|
|
163
|
-
const changesDir = path.join(projectDir, 'specification', 'changes');
|
|
164
|
-
const requirementDir = path.join(changesDir, requirementName);
|
|
165
|
-
const proposalFile = path.join(requirementDir, 'proposal.md');
|
|
166
|
-
const templateFile = path.join(__dirname, '../_template/LAIN/changes/proposal.md');
|
|
167
|
-
|
|
168
|
-
// 检查需求目录是否存在
|
|
169
|
-
if (!fs.existsSync(requirementDir)) {
|
|
170
|
-
Ec.error(`❌ 需求 "${requirementName}" 不存在`);
|
|
171
|
-
process.exit(1);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// 检查 proposal.md 文件是否存在
|
|
175
|
-
if (!fs.existsSync(proposalFile)) {
|
|
176
|
-
Ec.error(`❌ 需求 "${requirementName}" 中未找到 proposal.md 文件`);
|
|
177
|
-
process.exit(1);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// 获取模板和文件的结构
|
|
181
|
-
const templateStructure = _getTemplateStructure(templateFile);
|
|
182
|
-
const fileStructure = _getFileStructure(proposalFile);
|
|
183
|
-
|
|
184
|
-
// 查找缺失的章节
|
|
185
|
-
const missingSections = _findMissingSections(templateStructure, fileStructure);
|
|
186
|
-
|
|
187
|
-
// 构建模板的树型结构
|
|
188
|
-
const templateTree = _buildTreeStructure(templateStructure);
|
|
189
|
-
|
|
190
|
-
if (missingSections.length === 0) {
|
|
191
|
-
Ec.info(`✅ 需求 "${requirementName}" 格式验证通过`);
|
|
192
|
-
process.exit(0);
|
|
193
|
-
} else {
|
|
194
|
-
Ec.waiting(`需求名称: ${requirementName}`);
|
|
195
|
-
Ec.waiting('文档结构验证结果:');
|
|
196
|
-
|
|
197
|
-
// 创建缺失标题的集合
|
|
198
|
-
const missingTitles = new Set(missingSections.map(section => section.title));
|
|
199
|
-
|
|
200
|
-
// 以模板结构为基准打印树型结构,并高亮缺失的章节
|
|
201
|
-
_printTreeWithHighlight(templateTree, missingTitles);
|
|
202
|
-
|
|
203
|
-
Ec.error(`\n❌ 需求 "${requirementName}" 格式验证失败,缺失 ${missingSections.length} 个章节`);
|
|
204
|
-
process.exit(1);
|
|
205
|
-
}
|
|
206
|
-
} catch (error) {
|
|
207
|
-
Ec.error(`❌ 执行过程中发生错误: ${error.message}`);
|
|
208
|
-
process.exit(1);
|
|
209
|
-
}
|
|
210
|
-
};
|