docuking-mcp 2.4.0 → 2.5.1

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.
Files changed (2) hide show
  1. package/index.js +68 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -200,7 +200,7 @@ ${marker}
200
200
  - 의미 있는 작업 시작 시 (추적용)
201
201
 
202
202
  ### 규칙
203
- 1. yy_All_Docu/ 폴더만 동기화 대상
203
+ 1. 동기화 대상: yy_All_Docu/ + zz_ai_*/ 폴더 모두
204
204
  2. Push는 사용자 요청 시에만
205
205
  3. **Talk → Todo → Plan → Done** 순서 준수
206
206
  4. Plan 전에 반드시 Talk로 배경 기록
@@ -1561,6 +1561,8 @@ docuking_init을 먼저 실행하세요.`,
1561
1561
  }
1562
1562
  } else {
1563
1563
  // 전체 파일 - 모든 대상 폴더에서 수집
1564
+ const emptyFolders = []; // 빈 폴더 목록
1565
+
1564
1566
  for (const targetFolder of pushTargetFolders) {
1565
1567
  if (!fs.existsSync(targetFolder.localPath)) continue;
1566
1568
 
@@ -1572,6 +1574,16 @@ docuking_init을 먼저 실행하세요.`,
1572
1574
  file.serverPath = `${targetFolder.serverPrefix}/${file.path}`;
1573
1575
  filesToPush.push(file);
1574
1576
  }
1577
+
1578
+ // 빈 폴더 수집
1579
+ const folderEmptyDirs = [];
1580
+ collectEmptyFolders(targetFolder.localPath, '', folderEmptyDirs);
1581
+ for (const emptyDir of folderEmptyDirs) {
1582
+ emptyFolders.push({
1583
+ localPath: emptyDir,
1584
+ serverPath: `${targetFolder.serverPrefix}/${emptyDir}`,
1585
+ });
1586
+ }
1575
1587
  }
1576
1588
 
1577
1589
  // 대용량 파일 경고
@@ -1848,6 +1860,35 @@ docuking_init을 먼저 실행하세요.`,
1848
1860
  }
1849
1861
  }
1850
1862
 
1863
+ // 5. 빈 폴더 생성
1864
+ let createdEmptyFolders = 0;
1865
+ if (typeof emptyFolders !== 'undefined' && emptyFolders.length > 0) {
1866
+ for (const folder of emptyFolders) {
1867
+ try {
1868
+ const folderResponse = await fetch(`${API_ENDPOINT}/files`, {
1869
+ method: 'POST',
1870
+ headers: {
1871
+ 'Content-Type': 'application/json',
1872
+ 'Authorization': `Bearer ${apiKey}`,
1873
+ },
1874
+ body: JSON.stringify({
1875
+ projectId,
1876
+ path: folder.serverPath,
1877
+ type: 'folder',
1878
+ name: folder.localPath.split('/').pop(),
1879
+ }),
1880
+ });
1881
+
1882
+ if (folderResponse.ok) {
1883
+ createdEmptyFolders++;
1884
+ console.error(`[DocuKing] 빈 폴더 생성: ${folder.serverPath}`);
1885
+ }
1886
+ } catch (e) {
1887
+ console.error(`[DocuKing] 빈 폴더 생성 실패: ${folder.serverPath} - ${e.message}`);
1888
+ }
1889
+ }
1890
+ }
1891
+
1851
1892
  // Sync 완료 알림
1852
1893
  try {
1853
1894
  await fetch(`${API_ENDPOINT}/projects/${projectId}/sync/complete`, {
@@ -1869,6 +1910,9 @@ docuking_init을 먼저 실행하세요.`,
1869
1910
 
1870
1911
  // 요약 정보
1871
1912
  let summary = `\n📦 커밋 메시지: "${message}"\n\n📊 처리 결과:\n - 총 파일: ${total}개\n - 업로드: ${successCount}개\n - 이동: ${movedCount}개\n - 삭제: ${deleted}개\n - 스킵 (변경 없음): ${skippedCount}개\n - 실패: ${failCount}개`;
1913
+ if (createdEmptyFolders > 0) {
1914
+ summary += `\n - 빈 폴더 생성: ${createdEmptyFolders}개`;
1915
+ }
1872
1916
  if (excludedCount > 0) {
1873
1917
  summary += `\n - 제외 (압축/설치파일): ${excludedCount}개`;
1874
1918
  }
@@ -2247,6 +2291,29 @@ function hasAllDocuFolder(projectPath) {
2247
2291
  return fs.existsSync(allDocuPath);
2248
2292
  }
2249
2293
 
2294
+ // 유틸: 빈 폴더 수집 (재귀)
2295
+ function collectEmptyFolders(basePath, relativePath, results) {
2296
+ const fullPath = path.join(basePath, relativePath);
2297
+ if (!fs.existsSync(fullPath)) return;
2298
+
2299
+ const entries = fs.readdirSync(fullPath, { withFileTypes: true });
2300
+
2301
+ // 현재 폴더가 비어있으면 (파일 없고, 하위 폴더도 없음)
2302
+ const hasFiles = entries.some(e => e.isFile());
2303
+ const subDirs = entries.filter(e => e.isDirectory());
2304
+
2305
+ if (!hasFiles && subDirs.length === 0) {
2306
+ // 완전히 빈 폴더
2307
+ results.push(relativePath);
2308
+ } else {
2309
+ // 하위 폴더 탐색
2310
+ for (const entry of subDirs) {
2311
+ const entryRelPath = relativePath ? `${relativePath}/${entry.name}` : entry.name;
2312
+ collectEmptyFolders(basePath, entryRelPath, results);
2313
+ }
2314
+ }
2315
+ }
2316
+
2250
2317
  // 유틸: 디렉토리 재귀 탐색 (zz_* 제외 없음, Push용)
2251
2318
  // excludedFiles: 제외된 파일 목록을 수집할 배열 (선택)
2252
2319
  // largeFiles: 대용량 파일 목록을 수집할 배열 (선택)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docuking-mcp",
3
- "version": "2.4.0",
3
+ "version": "2.5.1",
4
4
  "description": "DocuKing MCP Server - AI 시대의 문서 협업 플랫폼",
5
5
  "type": "module",
6
6
  "main": "index.js",