minode-mcp-setup 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/bin/cli.js +24 -7
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -30,7 +30,13 @@ function getDesktopPath() {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
const DESKTOP = getDesktopPath();
|
|
33
|
-
const DEST
|
|
33
|
+
const DEST = path.join(process.env.USERPROFILE, 'Desktop', 'cheatengine-mcp-bridge'); // 바탕화면의 특정 폴더로 고정
|
|
34
|
+
|
|
35
|
+
function checkInstalled() {
|
|
36
|
+
// 바탕화면 전체가 아니라, 우리가 정한 폴더 안의 핵심 파일(예: main.py 또는 server.py)을 확인
|
|
37
|
+
const pyScript = path.join(DEST, 'main.py');
|
|
38
|
+
return fs.existsSync(pyScript);
|
|
39
|
+
}
|
|
34
40
|
|
|
35
41
|
/* ── 컬러 출력 */
|
|
36
42
|
const c = {
|
|
@@ -70,17 +76,18 @@ function download(url, dest) {
|
|
|
70
76
|
}
|
|
71
77
|
|
|
72
78
|
function extractZip(zipPath, outDir) {
|
|
73
|
-
// 로그 출력
|
|
74
79
|
console.log(`압축 해제 시도: ${zipPath} -> ${outDir}`);
|
|
75
80
|
|
|
76
|
-
// -Force:
|
|
77
|
-
|
|
81
|
+
// -Force: 덮어쓰기
|
|
82
|
+
// -ErrorAction Stop: 에러 발생 시 즉시 중단
|
|
83
|
+
const cmd = `powershell -Command "Expand-Archive -Path '${zipPath}' -DestinationPath '${outDir}' -Force"`;
|
|
78
84
|
|
|
79
85
|
try {
|
|
80
86
|
run(cmd, { silent: false });
|
|
81
87
|
console.log("압축 해제 명령 실행 완료");
|
|
82
88
|
} catch (e) {
|
|
83
89
|
console.error("압축 해제 실패:", e);
|
|
90
|
+
process.exit(1); // 에러 발생 시 프로세스를 종료하여 설치 중단
|
|
84
91
|
}
|
|
85
92
|
}
|
|
86
93
|
|
|
@@ -135,13 +142,22 @@ async function installCE() {
|
|
|
135
142
|
ok(`Python: ${execSync('python --version', { encoding: 'utf8' }).trim()}`);
|
|
136
143
|
|
|
137
144
|
const pyScript = path.join(DEST, 'MCP_Server', 'mcp_cheatengine.py');
|
|
145
|
+
|
|
146
|
+
// 파일이 없으면 설치 진행
|
|
138
147
|
if (!fs.existsSync(pyScript)) {
|
|
139
148
|
info(`다운로드 중: ${ZIP_URL}`);
|
|
140
149
|
await download(ZIP_URL, ZIP_TMP);
|
|
141
150
|
ok('다운로드 완료');
|
|
151
|
+
|
|
142
152
|
info('압축 해제 중...');
|
|
143
|
-
|
|
144
|
-
|
|
153
|
+
// 폴더를 확실히 생성하고
|
|
154
|
+
if (!fs.existsSync(DEST)) {
|
|
155
|
+
fs.mkdirSync(DEST, { recursive: true });
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// [수정] 압축 해제 경로를 DESKTOP이 아닌 DEST로 변경
|
|
159
|
+
extractZip(ZIP_TMP, DEST);
|
|
160
|
+
|
|
145
161
|
ok('압축 해제 완료');
|
|
146
162
|
} else {
|
|
147
163
|
ok('패키지 이미 설치됨');
|
|
@@ -150,7 +166,8 @@ async function installCE() {
|
|
|
150
166
|
const req = path.join(DEST, 'MCP_Server', 'requirements.txt');
|
|
151
167
|
if (fs.existsSync(req)) {
|
|
152
168
|
info('Python 의존성 설치 중...');
|
|
153
|
-
|
|
169
|
+
// 권장: python -m pip 사용
|
|
170
|
+
run(`python -m pip install -r "${req}"`);
|
|
154
171
|
ok('설치 완료');
|
|
155
172
|
}
|
|
156
173
|
|