momo-ai 1.0.65 → 1.0.67

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.
@@ -1,8 +1,5 @@
1
1
  {
2
2
  "permissions": {
3
- "allow": [
4
- "Bash(git add:*)",
5
- "Bash(git push:*)"
6
- ]
3
+ "defaultMode": "bypassPermissions"
7
4
  }
8
- }
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "momo-ai",
3
- "version": "1.0.65",
3
+ "version": "1.0.67",
4
4
  "description": "Rachel Momo ( OpenSpec )",
5
5
  "main": "src/momo.js",
6
6
  "bin": {
@@ -143,7 +143,17 @@ module.exports = async () => {
143
143
  const {stdout} = await execAsync(`${tool.cmd} --version`);
144
144
  const versionLines = stdout.split("\n");
145
145
  const currentVersion = versionLines[0].trim();
146
- Ec.waiting(`----> ${tool.emoji} ${tool.label}: ${currentVersion.cyan}`);
146
+ if (tool.cmd === 'codex') {
147
+ try {
148
+ const {stdout: latestOut} = await execAsync('npm view @openai/codex version');
149
+ const latestVersion = latestOut.trim();
150
+ Ec.waiting(`----> ${tool.emoji} ${tool.label}: ${currentVersion.cyan}(最新: ${latestVersion.green})`);
151
+ } catch (_) {
152
+ Ec.waiting(`----> ${tool.emoji} ${tool.label}: ${currentVersion.cyan}`);
153
+ }
154
+ } else {
155
+ Ec.waiting(`----> ${tool.emoji} ${tool.label}: ${currentVersion.cyan}`);
156
+ }
147
157
  } catch (error) {
148
158
  const name = tool.label.trim().replace(' 版本', '');
149
159
  Ec.waiting(`⚠️ ${name} 未安装或无法获取版本信息(可选工具)`);
@@ -1,6 +1,6 @@
1
1
  const path = require('path');
2
2
  const fs = require('fs').promises;
3
- const readline = require('readline');
3
+
4
4
  const Ec = require('../epic');
5
5
  const { exists } = require('../utils/momo-file-utils');
6
6
 
@@ -72,41 +72,6 @@ const _listTaskFiles = async (taskDir) => {
72
72
  /** 提示词模板:阅读后为所选 md 的相对路径 */
73
73
  const _promptForTask = (relativePath) => `执行任务:读取当前工作目录下 ${relativePath} 的正文(frontmatter 之后),按其中要求完成任务。`;
74
74
 
75
- /**
76
- * 在打印内容下方直接询问是否执行(同一屏,单键 y/n)
77
- * Raw 模式下由我们只写换行,不写字符,避免终端已回显时出现 yy
78
- */
79
- const _confirmExecute = () =>
80
- new Promise((resolve) => {
81
- process.stdout.write('\n是否执行此任务? (y/n): ');
82
- const cleanup = () => {
83
- process.stdin.removeListener('keypress', onKey);
84
- if (process.stdin.isTTY && process.stdin.setRawMode) process.stdin.setRawMode(false);
85
- };
86
- const done = (result) => {
87
- cleanup();
88
- process.stdout.write('\n');
89
- resolve(result);
90
- };
91
- const onKey = (str, key) => {
92
- if (!key) return;
93
- if (key.ctrl && key.name === 'c') {
94
- done(false);
95
- return;
96
- }
97
- if (key.name === 'return' || key.name === 'enter') {
98
- done(false);
99
- return;
100
- }
101
- const c = (str || '').toLowerCase();
102
- if (c === 'y' || c === 'n' || key.name === 'escape') {
103
- done(c === 'y');
104
- }
105
- };
106
- readline.emitKeypressEvents(process.stdin);
107
- if (process.stdin.isTTY && process.stdin.setRawMode) process.stdin.setRawMode(true);
108
- process.stdin.on('keypress', onKey);
109
- });
110
75
 
111
76
  module.exports = async () => {
112
77
  const cwd = process.cwd();
@@ -116,26 +81,28 @@ module.exports = async () => {
116
81
  require('colors');
117
82
  const { selectSingle } = require('../utils/momo-menu');
118
83
 
119
- const modeSelected = await selectSingle(
120
- [
121
- { name: 'task', description: '当前目录 .r2mo/task 中的任务' },
122
- { name: 'focus', description: 'focus 配置中的后端/前端/集体任务' }
123
- ],
124
- '选择执行模式'
125
- );
126
- if (!modeSelected) {
127
- Ec.warn('已取消');
128
- process.exit(0);
129
- }
130
-
131
- if (modeSelected.name === 'focus') {
132
- const inParent = await _isDpaParent(cwd);
133
- if (!inParent) {
134
- Ec.warn('当前不在 DPA 父项目,将使用 task 模式');
135
- modeSelected.name = 'task';
84
+ const inParent = await _isDpaParent(cwd);
85
+ let modeName;
86
+
87
+ if (inParent) {
88
+ const modeSelected = await selectSingle(
89
+ [
90
+ { name: 'task', description: '当前目录 .r2mo/task 中的任务' },
91
+ { name: 'focus', description: 'focus 配置中的后端/前端/集体任务' }
92
+ ],
93
+ '选择执行模式'
94
+ );
95
+ if (!modeSelected) {
96
+ Ec.warn('已取消');
97
+ process.exit(0);
136
98
  }
99
+ modeName = modeSelected.name;
100
+ } else {
101
+ modeName = 'task';
137
102
  }
138
103
 
104
+ const modeSelected = { name: modeName };
105
+
139
106
  let taskPath; // 最终选中的任务文件绝对路径
140
107
  let displayPath; // 相对 cwd 的路径,用于提示词
141
108
 
@@ -211,12 +178,6 @@ module.exports = async () => {
211
178
  console.log(body);
212
179
  Ec.waiting('------------------------');
213
180
 
214
- const ok = await _confirmExecute();
215
- if (!ok) {
216
- Ec.warn('已取消执行');
217
- process.exit(0);
218
- }
219
-
220
181
  const prompt = _promptForTask(displayPath);
221
182
  await Ec.outCopy(prompt);
222
183
  Ec.info('已写入剪贴板: ' + prompt);