momo-ai 1.0.20 → 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.
- 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/SKILL.md +101 -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/.trae/skills/algorithmic-art/LICENSE.txt +202 -0
- package/.trae/skills/algorithmic-art/SKILL.md +405 -0
- package/.trae/skills/algorithmic-art/templates/generator_template.js +223 -0
- package/.trae/skills/algorithmic-art/templates/viewer.html +599 -0
- package/.trae/skills/doc-coauthoring/SKILL.md +375 -0
- package/.trae/skills/frontend-design/LICENSE.txt +177 -0
- package/.trae/skills/frontend-design/SKILL.md +42 -0
- package/.trae/skills/r2mo-rad-lain/SKILL.md +101 -0
- package/README.md +12 -148
- package/docs/images/logo.jpeg +0 -0
- package/docs/images/r2mo-lain.png +0 -0
- package/install.sh +1 -0
- package/package.json +15 -11
- package/skills/r2mo-rad-domain/SKILL.md +70 -0
- package/skills/r2mo-rad-lain/SKILL.md +101 -0
- package/src/_mcp/skills-server.mjs +70 -0
- package/src/_skill/repositories.json +22 -0
- package/src/_template/LAIN/.obsidian/app.json +1 -0
- package/src/_template/LAIN/.obsidian/appearance.json +10 -0
- package/src/_template/LAIN/.obsidian/community-plugins.json +7 -0
- package/src/_template/LAIN/.obsidian/core-plugins.json +33 -0
- package/src/_template/LAIN/.obsidian/plugins/dataview/main.js +20876 -0
- package/src/_template/LAIN/.obsidian/plugins/dataview/manifest.json +11 -0
- package/src/_template/LAIN/.obsidian/plugins/dataview/styles.css +141 -0
- package/src/_template/LAIN/.obsidian/plugins/obsidian-excalidraw-plugin/data.json +815 -0
- package/src/_template/LAIN/.obsidian/plugins/obsidian-excalidraw-plugin/main.js +10 -0
- package/src/_template/LAIN/.obsidian/plugins/obsidian-excalidraw-plugin/manifest.json +12 -0
- package/src/_template/LAIN/.obsidian/plugins/obsidian-excalidraw-plugin/styles.css +1 -0
- package/src/_template/LAIN/.obsidian/plugins/obsidian-kanban/main.js +153 -0
- package/src/_template/LAIN/.obsidian/plugins/obsidian-kanban/manifest.json +11 -0
- package/src/_template/LAIN/.obsidian/plugins/obsidian-kanban/styles.css +1 -0
- package/src/_template/LAIN/.obsidian/plugins/obsidian-plantuml/main.js +7732 -0
- package/src/_template/LAIN/.obsidian/plugins/obsidian-plantuml/manifest.json +10 -0
- package/src/_template/LAIN/.obsidian/plugins/obsidian-plantuml/styles.css +38 -0
- package/src/_template/LAIN/.obsidian/plugins/obsidian-tasks-plugin/main.js +504 -0
- package/src/_template/LAIN/.obsidian/plugins/obsidian-tasks-plugin/manifest.json +12 -0
- package/src/_template/LAIN/.obsidian/plugins/obsidian-tasks-plugin/styles.css +1 -0
- package/src/_template/LAIN/.obsidian/snippets/body-font.css +27 -0
- package/src/_template/LAIN/.obsidian/themes/Primary/manifest.json +9 -0
- package/src/_template/LAIN/.obsidian/themes/Primary/theme.css +3878 -0
- package/src/_template/LAIN/.obsidian/themes/Retro Windows/manifest.json +7 -0
- package/src/_template/LAIN/.obsidian/themes/Retro Windows/theme.css +582 -0
- package/src/_template/LAIN/.obsidian/themes/RetroOS 98/manifest.json +9 -0
- package/src/_template/LAIN/.obsidian/themes/RetroOS 98/theme.css +2566 -0
- package/src/_template/LAIN/.obsidian/types.json +28 -0
- package/src/_template/LAIN/.obsidian/workspace.json +184 -0
- package/src/_template/LAIN/AGENTS.md +170 -16
- package/src/_template/R2MO/domain-enhance.md +10 -0
- package/src/commander/app.json +13 -0
- package/src/commander/apply.json +13 -0
- package/src/commander/ask.json +6 -0
- package/src/commander/docs.json +13 -0
- package/src/commander/domain.json +19 -0
- package/src/commander/help.json +5 -0
- package/src/commander/init.json +1 -1
- package/src/commander/mcp.json +13 -0
- package/src/commander/mmr0.json +6 -0
- package/src/commander/mmr2.json +6 -0
- package/src/commander/open.json +8 -2
- package/src/executor/executeApp.js +133 -0
- package/src/executor/executeApply.js +611 -0
- package/src/executor/executeAsk.js +274 -0
- package/src/executor/executeDocs.js +498 -0
- package/src/executor/executeDomain.js +293 -0
- package/src/executor/executeEnv.js +48 -38
- package/src/executor/executeHelp.js +77 -16
- package/src/executor/executeInit.js +176 -346
- package/src/executor/executeMcp.js +363 -0
- package/src/executor/executeMmr0.js +488 -0
- package/src/executor/executeMmr2.js +880 -0
- package/src/executor/executeOpen.js +144 -125
- package/src/executor/index.js +17 -39
- package/src/momo.js +2 -1
- package/src/python/r2mo_proto.py +418 -0
- package/src/python/r2mo_proto_database.py +369 -0
- package/src/python/r2mo_proto_domain.py +458 -0
- package/src/utils/momo-args.js +39 -0
- package/src/utils/momo-file-utils.js +75 -0
- package/src/utils/momo-menu.js +84 -0
- package/src/_template/LAIN/.momo/advanced/actor.md +0 -42
- package/src/_template/LAIN/.momo/advanced/refer.json +0 -46
- package/src/_template/LAIN/.momo/scripts/submodule-clean.sh +0 -56
- package/src/_template/LAIN/changes/proposal.md +0 -39
- package/src/_template/LAIN/changes/tasks/task-detail.md +0 -45
- package/src/_template/LAIN/changes/tasks.md +0 -49
- package/src/_template/LAIN/execute/admin-n-f-dashboard.md +0 -53
- package/src/_template/LAIN/execute/admin-n-f-form.md +0 -51
- package/src/_template/LAIN/execute/admin-n-f-home.md +0 -49
- package/src/_template/LAIN/execute/admin-n-f-list.md +0 -52
- package/src/_template/LAIN/execute/admin-n-f-login.md +0 -56
- package/src/_template/LAIN/specification/project-model.md +0 -13
- package/src/_template/LAIN/specification/project.md +0 -73
- package/src/_template/LAIN/specification/requirement.md +0 -25
- 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 -299
- package/src/executor/executeAgentCfg.js +0 -210
- 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 -313
- 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
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const Ec = require('../epic');
|
|
4
|
+
const { selectSingle } = require('../utils/momo-menu');
|
|
5
|
+
const { parseFile, exists } = require('../utils/momo-file-utils');
|
|
6
|
+
require('colors');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 扫描模板目录,加载所有提示词文件
|
|
10
|
+
* @param {string} templateDir 模板目录路径
|
|
11
|
+
* @returns {Array} 提示词文件列表
|
|
12
|
+
*/
|
|
13
|
+
const _scanTemplates = (templateDir) => {
|
|
14
|
+
if (!exists(templateDir)) {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const files = fs.readdirSync(templateDir);
|
|
19
|
+
const templates = [];
|
|
20
|
+
|
|
21
|
+
for (const file of files) {
|
|
22
|
+
if (!file.endsWith('.md')) {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const filePath = path.join(templateDir, file);
|
|
27
|
+
try {
|
|
28
|
+
if (fs.statSync(filePath).isFile()) {
|
|
29
|
+
const parsed = parseFile(filePath);
|
|
30
|
+
if (parsed && parsed.attributes) {
|
|
31
|
+
// 从 attributes 中提取 title 和 version
|
|
32
|
+
// 注意:parseYaml 返回的值可能包含前后空格
|
|
33
|
+
const title = String(parsed.attributes.title || '').trim() || file.replace('.md', '');
|
|
34
|
+
const version = String(parsed.attributes.version || '').trim() || '1.0.0';
|
|
35
|
+
|
|
36
|
+
// 读取完整文件内容用于提取 BEGIN/END 之间的内容
|
|
37
|
+
const fullContent = fs.readFileSync(filePath, 'utf8');
|
|
38
|
+
|
|
39
|
+
templates.push({
|
|
40
|
+
file: file,
|
|
41
|
+
filePath: filePath,
|
|
42
|
+
title: title,
|
|
43
|
+
version: version,
|
|
44
|
+
content: fullContent // 使用完整内容,而不是 parsed.body
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
// 如果解析失败,尝试直接读取文件内容
|
|
48
|
+
const fullContent = fs.readFileSync(filePath, 'utf8');
|
|
49
|
+
// 尝试手动解析 front-matter
|
|
50
|
+
const frontMatterMatch = fullContent.match(/^---\s*\n([\s\S]+?)\n---/);
|
|
51
|
+
if (frontMatterMatch) {
|
|
52
|
+
const yamlContent = frontMatterMatch[1];
|
|
53
|
+
const lines = yamlContent.split('\n');
|
|
54
|
+
let title = file.replace('.md', '');
|
|
55
|
+
let version = '1.0.0';
|
|
56
|
+
|
|
57
|
+
for (const line of lines) {
|
|
58
|
+
const titleMatch = line.match(/^title:\s*(.+)$/);
|
|
59
|
+
if (titleMatch) {
|
|
60
|
+
title = titleMatch[1].trim();
|
|
61
|
+
}
|
|
62
|
+
const versionMatch = line.match(/^version:\s*(.+)$/);
|
|
63
|
+
if (versionMatch) {
|
|
64
|
+
version = versionMatch[1].trim();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
templates.push({
|
|
69
|
+
file: file,
|
|
70
|
+
filePath: filePath,
|
|
71
|
+
title: title,
|
|
72
|
+
version: version,
|
|
73
|
+
content: fullContent
|
|
74
|
+
});
|
|
75
|
+
} else {
|
|
76
|
+
Ec.warn(`⚠ 无法解析模板文件: ${file} (缺少 front-matter)`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
} catch (error) {
|
|
81
|
+
Ec.warn(`⚠ 读取模板文件失败: ${file} - ${error.message}`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return templates;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* 提取 --- BEGIN 和 --- END 之间的内容
|
|
90
|
+
* @param {string} content 文件内容
|
|
91
|
+
* @returns {string|null} 提取的内容,如果未找到返回 null
|
|
92
|
+
*/
|
|
93
|
+
const _extractPromptContent = (content) => {
|
|
94
|
+
const beginMatch = content.indexOf('--- BEGIN');
|
|
95
|
+
const endMatch = content.indexOf('--- END');
|
|
96
|
+
|
|
97
|
+
if (beginMatch === -1 || endMatch === -1 || endMatch <= beginMatch) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// 提取 BEGIN 之后到 END 之前的内容
|
|
102
|
+
const startPos = content.indexOf('\n', beginMatch) + 1;
|
|
103
|
+
const endPos = endMatch;
|
|
104
|
+
|
|
105
|
+
if (startPos <= 0 || endPos <= startPos) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return content.substring(startPos, endPos).trim();
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* 显示模板列表(表格形式)
|
|
114
|
+
* @param {Array} templates 模板列表
|
|
115
|
+
*/
|
|
116
|
+
const _displayTemplatesTable = (templates) => {
|
|
117
|
+
if (templates.length === 0) {
|
|
118
|
+
Ec.warn('未找到任何提示词模板');
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// 计算列宽
|
|
123
|
+
const titleWidth = Math.max(
|
|
124
|
+
'标题'.length,
|
|
125
|
+
...templates.map(t => t.title.length)
|
|
126
|
+
);
|
|
127
|
+
const versionWidth = Math.max(
|
|
128
|
+
'版本'.length,
|
|
129
|
+
...templates.map(t => t.version.length)
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
// 表头
|
|
133
|
+
console.log('');
|
|
134
|
+
console.log('─'.repeat(60));
|
|
135
|
+
console.log(' 提示词模板列表'.green.bold);
|
|
136
|
+
console.log('─'.repeat(60));
|
|
137
|
+
|
|
138
|
+
// 表头行
|
|
139
|
+
const header = ` ${'标题'.padEnd(titleWidth)} ${'版本'.padEnd(versionWidth)}`;
|
|
140
|
+
console.log(header.cyan);
|
|
141
|
+
console.log('─'.repeat(60));
|
|
142
|
+
|
|
143
|
+
// 数据行
|
|
144
|
+
templates.forEach((template, index) => {
|
|
145
|
+
const title = template.title.padEnd(titleWidth);
|
|
146
|
+
const version = template.version.padEnd(versionWidth);
|
|
147
|
+
console.log(` ${title} ${version}`);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
console.log('─'.repeat(60));
|
|
151
|
+
console.log('');
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* 创建菜单项列表
|
|
156
|
+
* @param {Array} templates 模板列表
|
|
157
|
+
* @returns {Array} 菜单项列表
|
|
158
|
+
*/
|
|
159
|
+
const _createMenuItems = (templates) => {
|
|
160
|
+
return templates.map((template, index) => ({
|
|
161
|
+
name: `${template.title} (${template.version})`,
|
|
162
|
+
description: template.file,
|
|
163
|
+
index: index
|
|
164
|
+
}));
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
module.exports = async (options) => {
|
|
168
|
+
try {
|
|
169
|
+
// 获取主项目根目录(momo 命令所在的目录)
|
|
170
|
+
const mainProjectRoot = path.resolve(__dirname, '../..');
|
|
171
|
+
const templateDir = path.join(mainProjectRoot, 'src', '_template', 'R2MO');
|
|
172
|
+
|
|
173
|
+
// 1. 检查模板目录是否存在
|
|
174
|
+
if (!exists(templateDir)) {
|
|
175
|
+
Ec.error(`❌ 模板目录不存在: ${templateDir}`);
|
|
176
|
+
console.log('');
|
|
177
|
+
Ec.warn('请确保主项目中存在 src/_template/R2MO 目录');
|
|
178
|
+
console.log('');
|
|
179
|
+
process.exit(1);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// 2. 扫描模板文件
|
|
183
|
+
Ec.waiting('正在扫描提示词模板...');
|
|
184
|
+
const templates = _scanTemplates(templateDir);
|
|
185
|
+
|
|
186
|
+
if (templates.length === 0) {
|
|
187
|
+
Ec.warn('未找到任何提示词模板文件');
|
|
188
|
+
console.log('');
|
|
189
|
+
Ec.info(`请确保在 ${templateDir} 目录中存在 .md 格式的模板文件`);
|
|
190
|
+
console.log('');
|
|
191
|
+
process.exit(1);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
Ec.info(`✓ 找到 ${templates.length} 个提示词模板`);
|
|
195
|
+
|
|
196
|
+
// 3. 显示表格
|
|
197
|
+
_displayTemplatesTable(templates);
|
|
198
|
+
|
|
199
|
+
// 4. 创建菜单并让用户选择
|
|
200
|
+
const menuItems = _createMenuItems(templates);
|
|
201
|
+
const selectedItem = await selectSingle(menuItems, '请选择提示词模板');
|
|
202
|
+
|
|
203
|
+
if (selectedItem === null || selectedItem === undefined) {
|
|
204
|
+
Ec.warn('已取消选择');
|
|
205
|
+
process.exit(0);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// 从选中的菜单项中获取索引
|
|
209
|
+
const selectedIndex = selectedItem.index;
|
|
210
|
+
if (selectedIndex === undefined || selectedIndex === null || selectedIndex < 0 || selectedIndex >= templates.length) {
|
|
211
|
+
Ec.error('❌ 无效的选择');
|
|
212
|
+
process.exit(1);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const selectedTemplate = templates[selectedIndex];
|
|
216
|
+
|
|
217
|
+
if (!selectedTemplate || !selectedTemplate.content) {
|
|
218
|
+
Ec.error('❌ 模板数据无效');
|
|
219
|
+
process.exit(1);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// 5. 提取提示词内容
|
|
223
|
+
const promptContent = _extractPromptContent(selectedTemplate.content);
|
|
224
|
+
|
|
225
|
+
if (!promptContent) {
|
|
226
|
+
Ec.error(`❌ 无法从模板中提取提示词内容`);
|
|
227
|
+
console.log('');
|
|
228
|
+
Ec.warn('请确保模板文件包含 --- BEGIN 和 --- END 标记');
|
|
229
|
+
console.log('');
|
|
230
|
+
process.exit(1);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// 6. 复制到剪切板
|
|
234
|
+
try {
|
|
235
|
+
await Ec.outCopy(promptContent);
|
|
236
|
+
Ec.info('✓ 提示词已复制到剪切板');
|
|
237
|
+
} catch (copyError) {
|
|
238
|
+
Ec.warn(`⚠ 复制到剪切板失败: ${copyError.message}`);
|
|
239
|
+
console.log('');
|
|
240
|
+
Ec.info('提示词内容:');
|
|
241
|
+
console.log('─'.repeat(60));
|
|
242
|
+
console.log(promptContent);
|
|
243
|
+
console.log('─'.repeat(60));
|
|
244
|
+
console.log('');
|
|
245
|
+
process.exit(1);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// 7. 显示详细信息
|
|
249
|
+
console.log('');
|
|
250
|
+
console.log('─'.repeat(60));
|
|
251
|
+
console.log(' 模板详细信息'.green.bold);
|
|
252
|
+
console.log('─'.repeat(60));
|
|
253
|
+
console.log(` 文件: ${selectedTemplate.file}`);
|
|
254
|
+
console.log(` 标题: ${selectedTemplate.title}`);
|
|
255
|
+
console.log(` 版本: ${selectedTemplate.version}`);
|
|
256
|
+
console.log(` 路径: ${selectedTemplate.filePath}`);
|
|
257
|
+
console.log('─'.repeat(60));
|
|
258
|
+
console.log('');
|
|
259
|
+
console.log(' 提示词内容:'.cyan);
|
|
260
|
+
console.log('─'.repeat(60));
|
|
261
|
+
console.log(promptContent);
|
|
262
|
+
console.log('─'.repeat(60));
|
|
263
|
+
console.log('');
|
|
264
|
+
|
|
265
|
+
Ec.info('🎉 操作完成!');
|
|
266
|
+
console.log('');
|
|
267
|
+
|
|
268
|
+
process.exit(0);
|
|
269
|
+
} catch (error) {
|
|
270
|
+
Ec.error(`❌ 执行失败: ${error.message}`);
|
|
271
|
+
console.log('');
|
|
272
|
+
process.exit(1);
|
|
273
|
+
}
|
|
274
|
+
};
|