momo-ai 1.0.7 → 1.0.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  # Momo SDD - Spec Driven Development 工具
2
2
 
3
3
  ![npm version](https://img.shields.io/npm/v/momo-ai.svg) | [![Downloads](https://img.shields.io/npm/dm/momo-ai.svg)](https://www.npmjs.com/package/momo-ai)
4
- > For Rachel Momo
4
+ > For [Rachel Momo](https://www.weibo.com/maoxiaotong0216) / Serial Experiments Lain
5
5
 
6
6
  ## 1. 介绍
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "momo-ai",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Rachel Momo ( OpenSpec )",
5
5
  "main": "src/momo.js",
6
6
  "bin": {
@@ -79,7 +79,8 @@ const _ioFile = async (baseDir) => {
79
79
  const templateFiles = [
80
80
  {
81
81
  source: "specification/project.md",
82
- target: "specification/project.md"
82
+ target: "specification/project.md",
83
+ protect: true // 标记为受保护文件
83
84
  },
84
85
  {
85
86
  source: "specification/project-model.md",
@@ -105,8 +106,11 @@ const _ioFile = async (baseDir) => {
105
106
 
106
107
  // 检查源文件是否存在且目标文件已存在
107
108
  if (fs.existsSync(sourcePath) && fs.existsSync(targetPath)) {
108
- hasExistingFiles = true;
109
- break;
109
+ // 对于受保护文件,总是标记为有已存在文件
110
+ if (file.protect || !file.protect === undefined) {
111
+ hasExistingFiles = true;
112
+ break;
113
+ }
110
114
  }
111
115
  }
112
116
 
@@ -261,8 +265,11 @@ const _ioFile = async (baseDir) => {
261
265
 
262
266
  // 检查目标文件是否已存在
263
267
  if (fs.existsSync(targetPath)) {
264
- // 目标文件已存在,根据用户选择决定是否覆盖
265
- if (shouldOverwrite) {
268
+ // 对于受保护文件,永不覆盖
269
+ if (file.protect) {
270
+ Ec.waiting("跳过受保护文件:" + file.target + "(此文件需要人工填写项目基本信息和需求信息)");
271
+ } else if (shouldOverwrite) {
272
+ // 目标文件已存在,根据用户选择决定是否覆盖(非受保护文件)
266
273
  Ec.waiting("覆盖模板文件:" + file.target);
267
274
  await fsAsync.copyFile(sourcePath, targetPath);
268
275
  } else {
@@ -409,6 +416,7 @@ module.exports = (options) => {
409
416
  .then(() => _ioFile(basePath))
410
417
  .then(() => {
411
418
  Ec.info('✅ SPEC / 项目初始化完成!');
419
+ Ec.waiting('💡 注意:specification/project.md 文件需要人工填写项目基本信息和需求信息');
412
420
  // 关闭 readline 接口
413
421
  Ec.askClose();
414
422
  // 退出程序
package/src/lain.js CHANGED
@@ -28,34 +28,33 @@ colors.setTheme({
28
28
  const showMenu = () => {
29
29
  // 清屏
30
30
  process.stdout.write('\x1Bc');
31
-
31
+
32
32
  // 显示标准头部信息
33
33
  showHeader();
34
-
34
+
35
35
  // 使用96个字符宽度
36
36
  const width = 96;
37
37
  const headerBorder = '='.repeat(width).blue;
38
38
  const footerBorder = '-'.repeat(width).blue;
39
-
39
+
40
40
  console.log('');
41
41
  console.log(headerBorder);
42
42
  const title = 'Momo AI / Lain Console';
43
43
  const padding = ' '.repeat(Math.floor((width - title.length) / 2) - 1);
44
44
  console.log(`${padding}${title}`.bold.brightCyan);
45
45
  console.log(headerBorder);
46
-
46
+
47
47
  console.log('');
48
48
  console.log('欢迎使用 Momo AI / Lain 控制台!'.green);
49
49
  console.log('这是一个交互式命令行界面。'.yellow);
50
50
  console.log('');
51
-
51
+
52
52
  console.log('可用命令:'.bold);
53
53
  console.log(' help - 显示帮助信息'.white);
54
- console.log(' test - 执行测试命令'.white);
55
54
  console.log(' llm - 查看大模型配置信息'.white);
56
55
  console.log(' quit - 退出控制台'.white);
57
56
  console.log('');
58
-
57
+
59
58
  console.log('请在提示符后输入命令。'.gray);
60
59
  console.log(footerBorder);
61
60
  };
@@ -63,7 +62,7 @@ const showMenu = () => {
63
62
  // 显示标准头部信息
64
63
  const showHeader = () => {
65
64
  const appInfo = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../package.json'), 'utf8'));
66
-
65
+
67
66
  console.log(`[Momo AI]`.green.bold + ` ----------------- Rachel Momo / AI工具项 ------------------`.rainbow);
68
67
  console.log(`[Momo AI]`.green.bold + ' 应用名称: '.bold + 'Rachel Momo / SDD');
69
68
  console.log(`[Momo AI]`.green.bold + ' 工具主页: '.bold + appInfo.homepage.blue);
@@ -75,12 +74,12 @@ const showHeader = () => {
75
74
  // 处理用户输入
76
75
  const handleInput = (input, commands) => {
77
76
  const command = input.trim().toLowerCase();
78
-
77
+
79
78
  // 创建命令上下文
80
79
  const context = {
81
80
  commands: commands
82
81
  };
83
-
82
+
84
83
  switch (command) {
85
84
  case '':
86
85
  // 空命令,不处理
@@ -108,16 +107,16 @@ const handleInput = (input, commands) => {
108
107
  // 主函数
109
108
  const main = async () => {
110
109
  showMenu();
111
-
110
+
112
111
  // 创建 readline 接口
113
112
  const rl = readline.createInterface({
114
113
  input: process.stdin,
115
114
  output: process.stdout,
116
115
  prompt: '[Lain AI] > '.cyan.bold
117
116
  });
118
-
117
+
119
118
  rl.prompt();
120
-
119
+
121
120
  rl.on('line', (line) => {
122
121
  const input = line.trim();
123
122
  handleInput(input, terminalCommands);
@@ -126,7 +125,7 @@ const main = async () => {
126
125
  console.log('\n' + '感谢使用 Momo AI / Lain 控制台,再见!'.brightGreen + '\n');
127
126
  process.exit(0);
128
127
  });
129
-
128
+
130
129
  // 处理 Ctrl+C
131
130
  process.on('SIGINT', () => {
132
131
  console.log('\n\n' + '感谢使用 Momo AI / Lain 控制台,再见!'.brightGreen + '\n');
@@ -7,7 +7,6 @@ const helpCommand = (context) => {
7
7
  console.log('帮助信息:'.bold.brightYellow);
8
8
 
9
9
  console.log(' help - 显示此帮助信息'.white);
10
- console.log(' test - 执行测试命令'.white);
11
10
  console.log(' llm - 查看大模型配置信息'.white);
12
11
  console.log(' quit - 退出控制台'.white);
13
12
  console.log('');
@@ -10,7 +10,6 @@ const helpCommand = require('./commandHelp');
10
10
  const quitCommand = require('./commandQuit');
11
11
 
12
12
  // 在此处添加新命令的导入
13
- const testCommand = require('./commandTest');
14
13
  const llmCommand = require('./commandLlm');
15
14
 
16
15
  // 导出所有命令
@@ -20,6 +19,5 @@ module.exports = {
20
19
  quit: quitCommand,
21
20
 
22
21
  // 在此处添加新命令的导出
23
- test: testCommand,
24
22
  llm: llmCommand
25
23
  };