momo-ai 1.0.4 → 1.0.5
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/package.json
CHANGED
package/src/epic/momo.fn.out.js
CHANGED
|
@@ -22,6 +22,8 @@ const outString = (paths, content, sync = false) => __FX.fxContinue(!!content, (
|
|
|
22
22
|
const outCopy = (data) => new Promise(function (resolve, reject) {
|
|
23
23
|
const platform = os.platform();
|
|
24
24
|
let cmd = '';
|
|
25
|
+
let args = [];
|
|
26
|
+
|
|
25
27
|
if (platform === 'win32') {
|
|
26
28
|
cmd = 'clip';
|
|
27
29
|
} else if (platform === 'darwin') {
|
|
@@ -29,14 +31,19 @@ const outCopy = (data) => new Promise(function (resolve, reject) {
|
|
|
29
31
|
} else {
|
|
30
32
|
// 对于Linux和其他Unix-like系统,尝试使用xclip
|
|
31
33
|
cmd = 'xclip';
|
|
34
|
+
args = ['-selection', 'clipboard'];
|
|
32
35
|
}
|
|
33
36
|
|
|
34
|
-
const proc = require('child_process').spawn(cmd,
|
|
37
|
+
const proc = require('child_process').spawn(cmd, args);
|
|
35
38
|
proc.on('error', function (err) {
|
|
36
39
|
reject(err);
|
|
37
40
|
});
|
|
38
|
-
proc.on('close', function (
|
|
39
|
-
|
|
41
|
+
proc.on('close', function (code) {
|
|
42
|
+
if (code === 0) {
|
|
43
|
+
resolve();
|
|
44
|
+
} else {
|
|
45
|
+
reject(new Error(`剪贴板进程退出码: ${code}`));
|
|
46
|
+
}
|
|
40
47
|
});
|
|
41
48
|
proc.stdin.write(data);
|
|
42
49
|
proc.stdin.end();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const util = require('util');
|
|
4
|
-
const { spawn } = require('child_process');
|
|
5
4
|
const Ec = require('../epic');
|
|
6
5
|
const fsAsync = require('fs').promises;
|
|
6
|
+
const { outCopy } = require('../epic/momo.fn.out');
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* 读取模板文件并提取 <!-- BEGIN --> 到 <!-- END --> 之间的内容
|
|
@@ -174,27 +174,17 @@ const _copyToClipboard = async (content) => {
|
|
|
174
174
|
// 去除换行符,将内容合并为一行
|
|
175
175
|
const contentWithoutNewlines = content.replace(/\r?\n|\r/g, ' ');
|
|
176
176
|
|
|
177
|
-
//
|
|
178
|
-
|
|
179
|
-
if (process.platform === 'darwin') {
|
|
180
|
-
// macOS
|
|
181
|
-
proc = spawn('pbcopy', { stdio: 'pipe' });
|
|
182
|
-
} else if (process.platform === 'win32') {
|
|
183
|
-
// Windows
|
|
184
|
-
proc = spawn('clip', { stdio: 'pipe' });
|
|
185
|
-
} else {
|
|
186
|
-
// Linux/其他系统,尝试使用xclip
|
|
187
|
-
proc = spawn('xclip', ['-selection', 'clipboard'], { stdio: 'pipe' });
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
proc.stdin.write(contentWithoutNewlines);
|
|
191
|
-
proc.stdin.end();
|
|
177
|
+
// 使用统一的剪贴板函数
|
|
178
|
+
await outCopy(contentWithoutNewlines);
|
|
192
179
|
Ec.waiting('✅ 提示词已复制到剪贴板');
|
|
193
180
|
} catch (error) {
|
|
194
181
|
Ec.waiting(`复制到剪贴板失败: ${error.message}`);
|
|
195
182
|
// 提供备选方案
|
|
196
183
|
Ec.waiting('提示词内容:');
|
|
197
184
|
console.log(content);
|
|
185
|
+
if (process.platform === 'win32') {
|
|
186
|
+
Ec.waiting('💡 Windows 用户提示: 请确保您在具有足够权限的命令行中运行此命令');
|
|
187
|
+
}
|
|
198
188
|
}
|
|
199
189
|
};
|
|
200
190
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
|
-
const { spawn } = require('child_process');
|
|
4
3
|
const Ec = require('../epic');
|
|
5
4
|
const fsAsync = require('fs').promises;
|
|
5
|
+
const { outCopy } = require('../epic/momo.fn.out');
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* 读取模板文件并提取 <!-- BEGIN --> 到 <!-- END --> 之间的内容
|
|
@@ -75,21 +75,8 @@ const _copyToClipboard = async (content, requirementName) => {
|
|
|
75
75
|
// 去除换行符,将内容合并为一行
|
|
76
76
|
const contentWithoutNewlines = content.replace(/\r?\n|\r/g, ' ');
|
|
77
77
|
|
|
78
|
-
//
|
|
79
|
-
|
|
80
|
-
if (process.platform === 'darwin') {
|
|
81
|
-
// macOS
|
|
82
|
-
proc = spawn('pbcopy', { stdio: 'pipe' });
|
|
83
|
-
} else if (process.platform === 'win32') {
|
|
84
|
-
// Windows
|
|
85
|
-
proc = spawn('clip', { stdio: 'pipe' });
|
|
86
|
-
} else {
|
|
87
|
-
// Linux/其他系统,尝试使用xclip
|
|
88
|
-
proc = spawn('xclip', ['-selection', 'clipboard'], { stdio: 'pipe' });
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
proc.stdin.write(contentWithoutNewlines);
|
|
92
|
-
proc.stdin.end();
|
|
78
|
+
// 使用统一的剪贴板函数
|
|
79
|
+
await outCopy(contentWithoutNewlines);
|
|
93
80
|
Ec.waiting('✅ 计划提示词已复制到剪贴板');
|
|
94
81
|
|
|
95
82
|
// 保存内容到 .working 目录
|
|
@@ -2,7 +2,7 @@ const Ec = require('../epic');
|
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
const path = require('path');
|
|
4
4
|
const util = require('util');
|
|
5
|
-
const {
|
|
5
|
+
const { outCopy } = require('../epic/momo.fn.out');
|
|
6
6
|
const fsAsync = require('fs').promises;
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -63,34 +63,8 @@ const _renderTemplate = (template, data) => {
|
|
|
63
63
|
*/
|
|
64
64
|
const _copyToClipboard = async (content, requirementName, taskName) => {
|
|
65
65
|
try {
|
|
66
|
-
//
|
|
67
|
-
|
|
68
|
-
if (process.platform === 'darwin') {
|
|
69
|
-
// macOS
|
|
70
|
-
proc = spawn('pbcopy', {stdio: 'pipe'});
|
|
71
|
-
} else if (process.platform === 'win32') {
|
|
72
|
-
// Windows
|
|
73
|
-
proc = spawn('clip', {stdio: 'pipe'});
|
|
74
|
-
} else {
|
|
75
|
-
// Linux/其他系统,尝试使用xclip
|
|
76
|
-
proc = spawn('xclip', ['-selection', 'clipboard'], {stdio: 'pipe'});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
proc.stdin.write(content);
|
|
80
|
-
proc.stdin.end();
|
|
81
|
-
|
|
82
|
-
// 等待复制操作完成
|
|
83
|
-
await new Promise((resolve, reject) => {
|
|
84
|
-
proc.on('close', (code) => {
|
|
85
|
-
if (code === 0) {
|
|
86
|
-
resolve();
|
|
87
|
-
} else {
|
|
88
|
-
reject(new Error(`剪贴板进程退出码: ${code}`));
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
proc.on('error', reject);
|
|
92
|
-
});
|
|
93
|
-
|
|
66
|
+
// 使用统一的剪贴板函数
|
|
67
|
+
await outCopy(content);
|
|
94
68
|
Ec.waiting('📄 任务执行提示词已拷贝到剪切板');
|
|
95
69
|
|
|
96
70
|
// 保存内容到 .working 目录
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const util = require('util');
|
|
4
|
-
const { spawn } = require('child_process');
|
|
5
4
|
const Ec = require('../epic');
|
|
6
5
|
const fsAsync = require('fs').promises;
|
|
6
|
+
const { outCopy } = require('../epic/momo.fn.out');
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* 读取模板文件并提取 <!-- BEGIN --> 到 <!-- END --> 之间的内容
|
|
@@ -61,34 +61,8 @@ const _renderTemplate = (template, data) => {
|
|
|
61
61
|
*/
|
|
62
62
|
const _copyToClipboard = async (content) => {
|
|
63
63
|
try {
|
|
64
|
-
//
|
|
65
|
-
|
|
66
|
-
if (process.platform === 'darwin') {
|
|
67
|
-
// macOS
|
|
68
|
-
proc = spawn('pbcopy', { stdio: 'pipe' });
|
|
69
|
-
} else if (process.platform === 'win32') {
|
|
70
|
-
// Windows
|
|
71
|
-
proc = spawn('clip', { stdio: 'pipe' });
|
|
72
|
-
} else {
|
|
73
|
-
// Linux/其他系统,尝试使用xclip
|
|
74
|
-
proc = spawn('xclip', ['-selection', 'clipboard'], { stdio: 'pipe' });
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
proc.stdin.write(content);
|
|
78
|
-
proc.stdin.end();
|
|
79
|
-
|
|
80
|
-
// 等待复制操作完成
|
|
81
|
-
await new Promise((resolve, reject) => {
|
|
82
|
-
proc.on('close', (code) => {
|
|
83
|
-
if (code === 0) {
|
|
84
|
-
resolve();
|
|
85
|
-
} else {
|
|
86
|
-
reject(new Error(`剪贴板进程退出码: ${code}`));
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
proc.on('error', reject);
|
|
90
|
-
});
|
|
91
|
-
|
|
64
|
+
// 使用统一的剪贴板函数
|
|
65
|
+
await outCopy(content);
|
|
92
66
|
Ec.waiting('📄 任务检查提示词已拷贝到剪切板');
|
|
93
67
|
} catch (error) {
|
|
94
68
|
Ec.waiting(`⚠️ 无法拷贝到剪切板: ${error.message}`);
|