momo-ai 1.0.8 → 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/package.json +1 -1
- package/src/executor/executeInit.js +13 -5
package/package.json
CHANGED
|
@@ -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
|
-
|
|
109
|
-
|
|
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 (
|
|
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
|
// 退出程序
|