@ninebone/mcp 0.1.29 → 0.1.30
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/core/init.js +31 -26
package/package.json
CHANGED
package/src/core/init.js
CHANGED
|
@@ -57,42 +57,47 @@ async function createEnvFile(rl) {
|
|
|
57
57
|
* 2. 프롬프트 파일(.md) 자동 복사 함수 (개선됨)
|
|
58
58
|
*/
|
|
59
59
|
function createPromptFiles() {
|
|
60
|
-
// 사용자가 명령어를 실행한 현재 터미널 위치(작업 디렉토리) 아래에 prompts 폴더를 만듭니다.
|
|
61
60
|
const targetDir = path.join(process.cwd(), 'prompts');
|
|
62
61
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
// 하위 폴더 구조까지 통째로 복사하기 위한 재귀 함수
|
|
63
|
+
function copyFolderRecursive(source, target) {
|
|
64
|
+
if (!fs.existsSync(target)) {
|
|
65
|
+
fs.mkdirSync(target, { recursive: true });
|
|
66
|
+
}
|
|
66
67
|
|
|
67
|
-
|
|
68
|
-
console.log(`\n🔍 원본 프롬프트 탐색 경로: ${SOURCE_PROMPT_DIR}`);
|
|
69
|
-
console.log(`📂 복사될 대상 경로: ${targetDir}`);
|
|
68
|
+
if (!fs.existsSync(source)) return;
|
|
70
69
|
|
|
71
|
-
|
|
72
|
-
if (fs.existsSync(SOURCE_PROMPT_DIR)) {
|
|
73
|
-
const files = fs.readdirSync(SOURCE_PROMPT_DIR);
|
|
70
|
+
const items = fs.readdirSync(source);
|
|
74
71
|
|
|
75
|
-
|
|
76
|
-
const
|
|
72
|
+
items.forEach((item) => {
|
|
73
|
+
const sourcePath = path.join(source, item);
|
|
74
|
+
const targetPath = path.join(target, item);
|
|
75
|
+
const stat = fs.statSync(sourcePath);
|
|
76
|
+
|
|
77
|
+
if (stat.isDirectory()) {
|
|
78
|
+
// 하위 폴더인 경우 재귀 호출 (예: prompts/system)
|
|
79
|
+
copyFolderRecursive(sourcePath, targetPath);
|
|
80
|
+
} else if (stat.isFile() && item.endsWith('.md')) {
|
|
81
|
+
// 마크다운 파일인 경우 복사 실행
|
|
82
|
+
const content = fs.readFileSync(sourcePath, 'utf-8');
|
|
83
|
+
fs.writeFileSync(targetPath, content.trim() + '\n', 'utf-8');
|
|
77
84
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
85
|
+
// 복사되는 상대 경로 이쁘게 출력하기
|
|
86
|
+
const relativePath = path.relative(SOURCE_PROMPT_DIR, sourcePath);
|
|
87
|
+
console.log(` └📄 ${relativePath} 생성 완료`);
|
|
81
88
|
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
82
91
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
92
|
+
try {
|
|
93
|
+
console.log(`\n🔍 원본 프롬프트 탐색 경로: ${SOURCE_PROMPT_DIR}`);
|
|
94
|
+
console.log(`📂 복사될 대상 경로: ${targetDir}`);
|
|
86
95
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
});
|
|
91
|
-
console.log('✨ 프롬프트 파일(prompts/*.md) 배포가 성공적으로 완료되었습니다.');
|
|
96
|
+
if (fs.existsSync(SOURCE_PROMPT_DIR)) {
|
|
97
|
+
copyFolderRecursive(SOURCE_PROMPT_DIR, targetDir);
|
|
98
|
+
console.log('✨ 프롬프트 파일 및 폴더 구조 배포가 모두 완료되었습니다.');
|
|
92
99
|
} else {
|
|
93
|
-
|
|
94
|
-
console.error(`❌ [오류] 원본 템플릿 경로를 찾을 수 없습니다.`);
|
|
95
|
-
console.error(` 현재 배포된 패키지 내부 구조를 확인하세요.`);
|
|
100
|
+
console.error(`❌ [경로 오류] 원본 템플릿 위치를 찾을 수 없습니다: ${SOURCE_PROMPT_DIR}`);
|
|
96
101
|
}
|
|
97
102
|
} catch (err) {
|
|
98
103
|
console.error(`❌ 프롬프트 생성 중 오류 발생:`, err.message);
|