docuking-mcp 2.0.1 → 2.0.2
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/index.js +45 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -37,6 +37,10 @@ import crypto from 'crypto';
|
|
|
37
37
|
// 환경변수에서 API 엔드포인트 설정 (키는 로컬 config에서 읽음)
|
|
38
38
|
const API_ENDPOINT = process.env.DOCUKING_API_ENDPOINT || 'https://docuking.ai/api';
|
|
39
39
|
|
|
40
|
+
// 파일 크기 제한 (50MB) - Base64 인코딩 시 66MB, 서버 제한 200MB 이내
|
|
41
|
+
const MAX_FILE_SIZE_MB = 50;
|
|
42
|
+
const MAX_FILE_SIZE_BYTES = MAX_FILE_SIZE_MB * 1024 * 1024;
|
|
43
|
+
|
|
40
44
|
/**
|
|
41
45
|
* 로컬 프로젝트의 .docuking/config.json에서 설정 읽기
|
|
42
46
|
*
|
|
@@ -1325,8 +1329,9 @@ docuking_init을 먼저 실행하세요.`,
|
|
|
1325
1329
|
filesToPush.push({ path: filePath, serverPath: serverFilePath, fullPath, fileType });
|
|
1326
1330
|
}
|
|
1327
1331
|
} else {
|
|
1328
|
-
// 전체 파일 - 제외된 파일 목록도 수집
|
|
1329
|
-
|
|
1332
|
+
// 전체 파일 - 제외된 파일 및 대용량 파일 목록도 수집
|
|
1333
|
+
const largeFiles = [];
|
|
1334
|
+
collectFiles(workingPath, '', filesToPush, excludedFiles, largeFiles);
|
|
1330
1335
|
|
|
1331
1336
|
// 서버 경로 추가
|
|
1332
1337
|
for (const file of filesToPush) {
|
|
@@ -1336,6 +1341,15 @@ docuking_init을 먼저 실행하세요.`,
|
|
|
1336
1341
|
if (isCoworker) {
|
|
1337
1342
|
console.log(`[DocuKing] 코워커 Push: ${filesToPush.length}개 파일 (${coworkerFolderName}/)`);
|
|
1338
1343
|
}
|
|
1344
|
+
|
|
1345
|
+
// 대용량 파일 경고
|
|
1346
|
+
if (largeFiles.length > 0) {
|
|
1347
|
+
console.error(`\n[DocuKing] ⚠️ 대용량 파일 ${largeFiles.length}개 제외됨 (${MAX_FILE_SIZE_MB}MB 초과):`);
|
|
1348
|
+
for (const f of largeFiles) {
|
|
1349
|
+
console.error(` - ${f.path} (${f.sizeMB}MB)`);
|
|
1350
|
+
}
|
|
1351
|
+
console.error(`💡 대용량 파일은 Google Drive, NAS 등 별도 방법으로 공유하세요.\n`);
|
|
1352
|
+
}
|
|
1339
1353
|
}
|
|
1340
1354
|
|
|
1341
1355
|
if (filesToPush.length === 0) {
|
|
@@ -1349,6 +1363,9 @@ docuking_init을 먼저 실행하세요.`,
|
|
|
1349
1363
|
};
|
|
1350
1364
|
}
|
|
1351
1365
|
|
|
1366
|
+
// 총 용량 계산
|
|
1367
|
+
const totalSizeMB = filesToPush.reduce((sum, f) => sum + (f.sizeMB || 0), 0);
|
|
1368
|
+
|
|
1352
1369
|
// 파일 업로드 (진행률 표시)
|
|
1353
1370
|
const results = [];
|
|
1354
1371
|
const total = filesToPush.length;
|
|
@@ -1356,7 +1373,7 @@ docuking_init을 먼저 실행하세요.`,
|
|
|
1356
1373
|
let skipped = 0;
|
|
1357
1374
|
|
|
1358
1375
|
// 시작 안내 메시지 출력 (AI가 사용자에게 전달할 수 있도록)
|
|
1359
|
-
console.error(`[DocuKing] Push 시작: ${total}개
|
|
1376
|
+
console.error(`[DocuKing] Push 시작: ${total}개 파일 (총 ${totalSizeMB.toFixed(1)}MB)`);
|
|
1360
1377
|
console.error(`[DocuKing] 💡 실시간 진행상황은 DocuKing 웹(https://docuking.ai)에서 확인하세요`);
|
|
1361
1378
|
|
|
1362
1379
|
// Sync 시작 알림 (웹에서 프로그레스바 표시용)
|
|
@@ -1404,8 +1421,14 @@ docuking_init을 먼저 실행하세요.`,
|
|
|
1404
1421
|
for (const file of filesToPush) {
|
|
1405
1422
|
current++;
|
|
1406
1423
|
const progress = `${current}/${total}`;
|
|
1424
|
+
const sizeInfo = file.sizeMB >= 1 ? ` (${file.sizeMB.toFixed(1)}MB)` : '';
|
|
1407
1425
|
processedLocalPaths.add(file.serverPath);
|
|
1408
1426
|
|
|
1427
|
+
// 1MB 이상 파일은 업로드 시작 시 로그 출력 (사용자가 진행 상황 파악 가능)
|
|
1428
|
+
if (file.sizeMB >= 1) {
|
|
1429
|
+
console.error(`[DocuKing] ${progress} 업로드 중: ${file.path}${sizeInfo}`);
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1409
1432
|
try {
|
|
1410
1433
|
// 파일 해시 계산 (변경 감지)
|
|
1411
1434
|
let fileHash;
|
|
@@ -1978,8 +2001,9 @@ function hasAllDocuFolder(projectPath) {
|
|
|
1978
2001
|
|
|
1979
2002
|
// 유틸: 디렉토리 재귀 탐색
|
|
1980
2003
|
// excludedFiles: 제외된 파일 목록을 수집할 배열 (선택)
|
|
2004
|
+
// largeFiles: 대용량 파일 목록을 수집할 배열 (선택)
|
|
1981
2005
|
// zz_* 폴더는 로컬 전용이므로 동기화에서 제외
|
|
1982
|
-
function collectFiles(basePath, relativePath, results, excludedFiles = null) {
|
|
2006
|
+
function collectFiles(basePath, relativePath, results, excludedFiles = null, largeFiles = null) {
|
|
1983
2007
|
const fullPath = path.join(basePath, relativePath);
|
|
1984
2008
|
const entries = fs.readdirSync(fullPath, { withFileTypes: true });
|
|
1985
2009
|
|
|
@@ -1992,7 +2016,7 @@ function collectFiles(basePath, relativePath, results, excludedFiles = null) {
|
|
|
1992
2016
|
console.error(`[DocuKing] 제외됨: ${entryRelPath}/ (zz_* 폴더 - 로컬 전용)`);
|
|
1993
2017
|
continue;
|
|
1994
2018
|
}
|
|
1995
|
-
collectFiles(basePath, entryRelPath, results, excludedFiles);
|
|
2019
|
+
collectFiles(basePath, entryRelPath, results, excludedFiles, largeFiles);
|
|
1996
2020
|
} else if (entry.isFile()) {
|
|
1997
2021
|
const fileType = getFileType(entry.name);
|
|
1998
2022
|
|
|
@@ -2005,10 +2029,25 @@ function collectFiles(basePath, relativePath, results, excludedFiles = null) {
|
|
|
2005
2029
|
continue;
|
|
2006
2030
|
}
|
|
2007
2031
|
|
|
2032
|
+
// 파일 크기 확인
|
|
2033
|
+
const fileFullPath = path.join(fullPath, entry.name);
|
|
2034
|
+
const stats = fs.statSync(fileFullPath);
|
|
2035
|
+
const fileSizeMB = stats.size / (1024 * 1024);
|
|
2036
|
+
|
|
2037
|
+
// 대용량 파일은 별도 추적
|
|
2038
|
+
if (stats.size > MAX_FILE_SIZE_BYTES) {
|
|
2039
|
+
console.error(`[DocuKing] ⚠️ 대용량 파일 제외: ${entryRelPath} (${fileSizeMB.toFixed(1)}MB > ${MAX_FILE_SIZE_MB}MB)`);
|
|
2040
|
+
if (largeFiles) {
|
|
2041
|
+
largeFiles.push({ path: entryRelPath, sizeMB: fileSizeMB.toFixed(1) });
|
|
2042
|
+
}
|
|
2043
|
+
continue;
|
|
2044
|
+
}
|
|
2045
|
+
|
|
2008
2046
|
results.push({
|
|
2009
2047
|
path: entryRelPath,
|
|
2010
|
-
fullPath:
|
|
2048
|
+
fullPath: fileFullPath,
|
|
2011
2049
|
fileType, // 'text' 또는 'binary'
|
|
2050
|
+
sizeMB: fileSizeMB, // 진행률 표시용
|
|
2012
2051
|
});
|
|
2013
2052
|
}
|
|
2014
2053
|
}
|