file-organizer-mcp 2.1.0 โ†’ 3.0.0

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 (210) hide show
  1. package/ARCHITECTURE.md +583 -0
  2. package/CHANGELOG.md +120 -0
  3. package/CONTRIBUTING.md +311 -0
  4. package/MIGRATION.md +358 -0
  5. package/README.md +415 -412
  6. package/dist/config.d.ts +31 -0
  7. package/dist/config.d.ts.map +1 -0
  8. package/dist/config.js +220 -0
  9. package/dist/config.js.map +1 -0
  10. package/dist/constants.d.ts +20 -0
  11. package/dist/constants.d.ts.map +1 -0
  12. package/dist/constants.js +41 -0
  13. package/dist/constants.js.map +1 -0
  14. package/dist/errors.d.ts +9 -0
  15. package/dist/errors.d.ts.map +1 -0
  16. package/dist/errors.js +26 -0
  17. package/dist/errors.js.map +1 -0
  18. package/dist/index.d.ts +12 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +35 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/schemas/common.schemas.d.ts +39 -0
  23. package/dist/schemas/common.schemas.d.ts.map +1 -0
  24. package/dist/schemas/common.schemas.js +34 -0
  25. package/dist/schemas/common.schemas.js.map +1 -0
  26. package/dist/schemas/index.d.ts +9 -0
  27. package/dist/schemas/index.d.ts.map +1 -0
  28. package/dist/schemas/index.js +9 -0
  29. package/dist/schemas/index.js.map +1 -0
  30. package/dist/schemas/organize.schemas.d.ts +14 -0
  31. package/dist/schemas/organize.schemas.d.ts.map +1 -0
  32. package/dist/schemas/organize.schemas.js +13 -0
  33. package/dist/schemas/organize.schemas.js.map +1 -0
  34. package/dist/schemas/scan.schemas.d.ts +46 -0
  35. package/dist/schemas/scan.schemas.d.ts.map +1 -0
  36. package/dist/schemas/scan.schemas.js +31 -0
  37. package/dist/schemas/scan.schemas.js.map +1 -0
  38. package/dist/schemas/security.schemas.d.ts +25 -0
  39. package/dist/schemas/security.schemas.d.ts.map +1 -0
  40. package/dist/schemas/security.schemas.js +24 -0
  41. package/dist/schemas/security.schemas.js.map +1 -0
  42. package/dist/server.d.ts +10 -0
  43. package/dist/server.d.ts.map +1 -0
  44. package/dist/server.js +90 -0
  45. package/dist/server.js.map +1 -0
  46. package/dist/services/categorizer.service.d.ts +29 -0
  47. package/dist/services/categorizer.service.d.ts.map +1 -0
  48. package/dist/services/categorizer.service.js +134 -0
  49. package/dist/services/categorizer.service.js.map +1 -0
  50. package/dist/services/duplicate-finder.service.d.ts +67 -0
  51. package/dist/services/duplicate-finder.service.d.ts.map +1 -0
  52. package/dist/services/duplicate-finder.service.js +290 -0
  53. package/dist/services/duplicate-finder.service.js.map +1 -0
  54. package/dist/services/file-scanner.service.d.ts +23 -0
  55. package/dist/services/file-scanner.service.d.ts.map +1 -0
  56. package/dist/services/file-scanner.service.js +225 -0
  57. package/dist/services/file-scanner.service.js.map +1 -0
  58. package/dist/services/hash-calculator.service.d.ts +28 -0
  59. package/dist/services/hash-calculator.service.d.ts.map +1 -0
  60. package/dist/services/hash-calculator.service.js +104 -0
  61. package/dist/services/hash-calculator.service.js.map +1 -0
  62. package/dist/services/index.d.ts +15 -0
  63. package/dist/services/index.d.ts.map +1 -0
  64. package/dist/services/index.js +16 -0
  65. package/dist/services/index.js.map +1 -0
  66. package/dist/services/organizer.service.d.ts +33 -0
  67. package/dist/services/organizer.service.d.ts.map +1 -0
  68. package/dist/services/organizer.service.js +316 -0
  69. package/dist/services/organizer.service.js.map +1 -0
  70. package/dist/services/path-validator.service.d.ts +45 -0
  71. package/dist/services/path-validator.service.d.ts.map +1 -0
  72. package/dist/services/path-validator.service.js +249 -0
  73. package/dist/services/path-validator.service.js.map +1 -0
  74. package/dist/services/rollback.service.d.ts +29 -0
  75. package/dist/services/rollback.service.d.ts.map +1 -0
  76. package/dist/services/rollback.service.js +147 -0
  77. package/dist/services/rollback.service.js.map +1 -0
  78. package/dist/services/security/rate-limiter.service.d.ts +15 -0
  79. package/dist/services/security/rate-limiter.service.d.ts.map +1 -0
  80. package/dist/services/security/rate-limiter.service.js +43 -0
  81. package/dist/services/security/rate-limiter.service.js.map +1 -0
  82. package/dist/services/streaming-scanner.service.d.ts +12 -0
  83. package/dist/services/streaming-scanner.service.d.ts.map +1 -0
  84. package/dist/services/streaming-scanner.service.js +75 -0
  85. package/dist/services/streaming-scanner.service.js.map +1 -0
  86. package/dist/tests/test-dryrun.d.ts +2 -0
  87. package/dist/tests/test-dryrun.d.ts.map +1 -0
  88. package/dist/tests/test-dryrun.js +56 -0
  89. package/dist/tests/test-dryrun.js.map +1 -0
  90. package/dist/tests/test-duplicate-scoring.d.ts +2 -0
  91. package/dist/tests/test-duplicate-scoring.d.ts.map +1 -0
  92. package/dist/tests/test-duplicate-scoring.js +84 -0
  93. package/dist/tests/test-duplicate-scoring.js.map +1 -0
  94. package/dist/tests/test-edge-cases.d.ts +10 -0
  95. package/dist/tests/test-edge-cases.d.ts.map +1 -0
  96. package/dist/tests/test-edge-cases.js +127 -0
  97. package/dist/tests/test-edge-cases.js.map +1 -0
  98. package/dist/tests/test-filename-conflict.d.ts +2 -0
  99. package/dist/tests/test-filename-conflict.d.ts.map +1 -0
  100. package/dist/tests/test-filename-conflict.js +70 -0
  101. package/dist/tests/test-filename-conflict.js.map +1 -0
  102. package/dist/tests/test-overwrite-bug.d.ts +2 -0
  103. package/dist/tests/test-overwrite-bug.d.ts.map +1 -0
  104. package/dist/tests/test-overwrite-bug.js +73 -0
  105. package/dist/tests/test-overwrite-bug.js.map +1 -0
  106. package/dist/tests/test-pagination.d.ts +7 -0
  107. package/dist/tests/test-pagination.d.ts.map +1 -0
  108. package/dist/tests/test-pagination.js +105 -0
  109. package/dist/tests/test-pagination.js.map +1 -0
  110. package/dist/tests/test-phase1.d.ts +7 -0
  111. package/dist/tests/test-phase1.d.ts.map +1 -0
  112. package/dist/tests/test-phase1.js +47 -0
  113. package/dist/tests/test-phase1.js.map +1 -0
  114. package/dist/tests/test-phase3-advanced.d.ts +2 -0
  115. package/dist/tests/test-phase3-advanced.d.ts.map +1 -0
  116. package/dist/tests/test-phase3-advanced.js +82 -0
  117. package/dist/tests/test-phase3-advanced.js.map +1 -0
  118. package/dist/tests/test-phase3.d.ts +2 -0
  119. package/dist/tests/test-phase3.d.ts.map +1 -0
  120. package/dist/tests/test-phase3.js +84 -0
  121. package/dist/tests/test-phase3.js.map +1 -0
  122. package/dist/tests/test-rollback-fix.d.ts +2 -0
  123. package/dist/tests/test-rollback-fix.d.ts.map +1 -0
  124. package/dist/tests/test-rollback-fix.js +85 -0
  125. package/dist/tests/test-rollback-fix.js.map +1 -0
  126. package/dist/tests/test-security-enhanced.d.ts +2 -0
  127. package/dist/tests/test-security-enhanced.d.ts.map +1 -0
  128. package/dist/tests/test-security-enhanced.js +44 -0
  129. package/dist/tests/test-security-enhanced.js.map +1 -0
  130. package/dist/tests/test-security.d.ts +2 -0
  131. package/dist/tests/test-security.d.ts.map +1 -0
  132. package/dist/tests/test-security.js +59 -0
  133. package/dist/tests/test-security.js.map +1 -0
  134. package/dist/tools/duplicate-management.d.ts +35 -0
  135. package/dist/tools/duplicate-management.d.ts.map +1 -0
  136. package/dist/tools/duplicate-management.js +148 -0
  137. package/dist/tools/duplicate-management.js.map +1 -0
  138. package/dist/tools/file-analysis.d.ts +21 -0
  139. package/dist/tools/file-analysis.d.ts.map +1 -0
  140. package/dist/tools/file-analysis.js +93 -0
  141. package/dist/tools/file-analysis.js.map +1 -0
  142. package/dist/tools/file-categorization.d.ts +20 -0
  143. package/dist/tools/file-categorization.d.ts.map +1 -0
  144. package/dist/tools/file-categorization.js +79 -0
  145. package/dist/tools/file-categorization.js.map +1 -0
  146. package/dist/tools/file-duplicates.d.ts +21 -0
  147. package/dist/tools/file-duplicates.d.ts.map +1 -0
  148. package/dist/tools/file-duplicates.js +102 -0
  149. package/dist/tools/file-duplicates.js.map +1 -0
  150. package/dist/tools/file-listing.d.ts +21 -0
  151. package/dist/tools/file-listing.d.ts.map +1 -0
  152. package/dist/tools/file-listing.js +96 -0
  153. package/dist/tools/file-listing.js.map +1 -0
  154. package/dist/tools/file-management.d.ts +27 -0
  155. package/dist/tools/file-management.d.ts.map +1 -0
  156. package/dist/tools/file-management.js +120 -0
  157. package/dist/tools/file-management.js.map +1 -0
  158. package/dist/tools/file-organization.d.ts +20 -0
  159. package/dist/tools/file-organization.d.ts.map +1 -0
  160. package/dist/tools/file-organization.js +97 -0
  161. package/dist/tools/file-organization.js.map +1 -0
  162. package/dist/tools/file-scanning.d.ts +23 -0
  163. package/dist/tools/file-scanning.d.ts.map +1 -0
  164. package/dist/tools/file-scanning.js +125 -0
  165. package/dist/tools/file-scanning.js.map +1 -0
  166. package/dist/tools/index.d.ts +32 -0
  167. package/dist/tools/index.d.ts.map +1 -0
  168. package/dist/tools/index.js +50 -0
  169. package/dist/tools/index.js.map +1 -0
  170. package/dist/tools/organization-preview.d.ts +19 -0
  171. package/dist/tools/organization-preview.d.ts.map +1 -0
  172. package/dist/tools/organization-preview.js +108 -0
  173. package/dist/tools/organization-preview.js.map +1 -0
  174. package/dist/tools/rollback.d.ts +18 -0
  175. package/dist/tools/rollback.d.ts.map +1 -0
  176. package/dist/tools/rollback.js +75 -0
  177. package/dist/tools/rollback.js.map +1 -0
  178. package/dist/types.d.ts +205 -0
  179. package/dist/types.d.ts.map +1 -0
  180. package/dist/types.js +22 -0
  181. package/dist/types.js.map +1 -0
  182. package/dist/utils/error-handler.d.ts +21 -0
  183. package/dist/utils/error-handler.d.ts.map +1 -0
  184. package/dist/utils/error-handler.js +72 -0
  185. package/dist/utils/error-handler.js.map +1 -0
  186. package/dist/utils/file-utils.d.ts +42 -0
  187. package/dist/utils/file-utils.d.ts.map +1 -0
  188. package/dist/utils/file-utils.js +108 -0
  189. package/dist/utils/file-utils.js.map +1 -0
  190. package/dist/utils/formatters.d.ts +23 -0
  191. package/dist/utils/formatters.d.ts.map +1 -0
  192. package/dist/utils/formatters.js +39 -0
  193. package/dist/utils/formatters.js.map +1 -0
  194. package/dist/utils/index.d.ts +9 -0
  195. package/dist/utils/index.d.ts.map +1 -0
  196. package/dist/utils/index.js +9 -0
  197. package/dist/utils/index.js.map +1 -0
  198. package/dist/utils/logger.d.ts +16 -0
  199. package/dist/utils/logger.d.ts.map +1 -0
  200. package/dist/utils/logger.js +45 -0
  201. package/dist/utils/logger.js.map +1 -0
  202. package/dist/utils/path-security.d.ts +37 -0
  203. package/dist/utils/path-security.d.ts.map +1 -0
  204. package/dist/utils/path-security.js +103 -0
  205. package/dist/utils/path-security.js.map +1 -0
  206. package/package.json +63 -16
  207. package/server.js +0 -668
  208. package/server.json +0 -48
  209. package/start.bat +0 -3
  210. package/test_security.js +0 -205
@@ -0,0 +1,583 @@
1
+ # Architecture Documentation
2
+
3
+ ## ๐Ÿ—๏ธ System Overview
4
+
5
+ File Organizer MCP is a security-hardened Model Context Protocol (MCP) server that provides intelligent file organization capabilities to Large Language Models (LLMs). The architecture follows a layered service pattern with comprehensive security validation at every level.
6
+
7
+ ### Core Principles
8
+
9
+ 1. **Security First** - Multi-layer validation and sanitization
10
+ 2. **Service Isolation** - Clear separation of concerns
11
+ 3. **Type Safety** - Strict TypeScript with Zod validation
12
+ 4. **Testability** - Dependency injection and modular design
13
+ 5. **Performance** - Streaming operations and resource limits
14
+
15
+ ## ๐Ÿ“ Architecture Layers
16
+
17
+ ```
18
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
19
+ โ”‚ MCP Client (LLM) โ”‚
20
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
21
+ โ”‚ JSON-RPC 2.0
22
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
23
+ โ”‚ MCP Server Layer โ”‚
24
+ โ”‚ (server.ts - Protocol Handler) โ”‚
25
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
26
+ โ”‚
27
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
28
+ โ”‚ Tools Layer โ”‚
29
+ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
30
+ โ”‚ โ”‚ Scan โ”‚ Organize โ”‚ Duplicate โ”‚ Categorize โ”‚ โ”‚
31
+ โ”‚ โ”‚ Files โ”‚ Files โ”‚ Find โ”‚ Files โ”‚ โ”‚
32
+ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
33
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
34
+ โ”‚
35
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
36
+ โ”‚ Services Layer โ”‚
37
+ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
38
+ โ”‚ โ”‚ Path โ”‚ Organizer โ”‚ Hash โ”‚ Scanner โ”‚ โ”‚
39
+ โ”‚ โ”‚ Validator โ”‚ Service โ”‚ Calculator โ”‚ Service โ”‚ โ”‚
40
+ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
41
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
42
+ โ”‚
43
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
44
+ โ”‚ Utils Layer โ”‚
45
+ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
46
+ โ”‚ โ”‚ Logger โ”‚ Error โ”‚ File โ”‚ Format- โ”‚ โ”‚
47
+ โ”‚ โ”‚ โ”‚ Handler โ”‚ Utils โ”‚ ters โ”‚ โ”‚
48
+ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
49
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
50
+ โ”‚
51
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
52
+ โ”‚ File System โ”‚
53
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
54
+ ```
55
+
56
+ ## ๐Ÿ” Security Architecture
57
+
58
+ ### 8-Layer Path Validation Pipeline
59
+
60
+ Every file path goes through these validation layers:
61
+
62
+ ```typescript
63
+ Input Path
64
+ โ†“
65
+ 1. Type Validation (Zod Schema)
66
+ โ†“
67
+ 2. Null Byte & Basic Sanitization
68
+ โ†“
69
+ 3. Path Normalization & Windows Case Adjustment
70
+ โ†“
71
+ 4. Traversal Sequence Prevention (../)
72
+ โ†“
73
+ 5. Absolute Path Resolution
74
+ โ†“
75
+ 6. Security Check (Whitelist & Blacklist)
76
+ โ†“
77
+ 7. Symlink Resolution & Target Validation
78
+ โ†“
79
+ 8. Existence & Access Check
80
+ โ†“
81
+ Validated Path โœ…
82
+ ```
83
+
84
+ **Implementation:** [`src/services/path-validator.service.ts`](file:///c:/Users/NewAdmin/Desktop/File-Organizer-MCP/src/services/path-validator.service.ts)
85
+
86
+ ### Race Condition Mitigation (TOCTOU Protection)
87
+
88
+ **Problem:** Time-of-Check-Time-of-Use vulnerabilities can occur when a file is checked, then used later, allowing an attacker to swap the file between operations.
89
+
90
+ **Solution:** Multi-layered approach:
91
+
92
+ ```typescript
93
+ // Layer 1: File Descriptor Validation
94
+ // Open file with O_NOFOLLOW to prevent symlink following
95
+ const handle = await fs.open(path, constants.O_RDONLY | constants.O_NOFOLLOW);
96
+
97
+ // Layer 2: Atomic Copy Operations
98
+ // Use COPYFILE_EXCL to ensure destination doesn't exist
99
+ await fs.copyFile(source, dest, constants.COPYFILE_EXCL);
100
+
101
+ // Layer 3: Safe Overwrites
102
+ // Move existing file to backup before replacing
103
+ const backupPath = path.join('.file-organizer-backups', `${Date.now()}_overwrite_${basename}`);
104
+ await fs.rename(existingFile, backupPath);
105
+ ```
106
+
107
+ **Limitations:**
108
+ - File deletion on Windows uses path-based locking (not file descriptor)
109
+ - Symlinks are blocked for security but may limit legitimate use cases
110
+
111
+ ### Resource Protection
112
+
113
+ ```typescript
114
+ // Security Constants
115
+ const SECURITY_LIMITS = {
116
+ MAX_FILE_SIZE: 100 * 1024 * 1024, // 100 MB
117
+ MAX_FILES: 10000, // Per operation
118
+ MAX_DEPTH: 10, // Directory recursion
119
+ MAX_PATH_LENGTH: 4096 // Characters
120
+ };
121
+ ```
122
+
123
+ ## ๐Ÿ“ฆ Core Components
124
+
125
+ ### 1. Server Layer (`server.ts`)
126
+
127
+ **Responsibility:** MCP protocol handling and tool registration
128
+
129
+ ```typescript
130
+ // Key responsibilities:
131
+ - Initialize MCP server
132
+ - Register tools with schemas
133
+ - Handle tool invocations
134
+ - Manage error responses
135
+ - Coordinate with services
136
+ ```
137
+
138
+ **Key Features:**
139
+ - Automatic tool discovery from `tools/` directory
140
+ - Structured response formatting (JSON/Markdown)
141
+ - Centralized error handling
142
+
143
+ ### 2. Tools Layer (`tools/`)
144
+
145
+ **Responsibility:** MCP tool implementations (user-facing API)
146
+
147
+ Each tool follows this pattern:
148
+
149
+ ```typescript
150
+ export const toolDefinition: ToolDefinition = {
151
+ name: 'tool_name',
152
+ description: 'What it does',
153
+ inputSchema: ZodSchema // Validation
154
+ };
155
+
156
+ export async function handleTool(args: ToolArgs): Promise<ToolResponse> {
157
+ // 1. Validate inputs (Zod)
158
+ // 2. Validate security (PathValidator)
159
+ // 3. Call service layer
160
+ // 4. Format response
161
+ // 5. Handle errors
162
+ }
163
+ ```
164
+
165
+ **Available Tools:**
166
+ 1. **List Files in Directory** (`file_organizer_list_files`)
167
+ 2. **Scan Directory for Detailed Info** (`file_organizer_scan_directory`)
168
+ 3. **Categorize Files by Type** (`file_organizer_categorize_files`)
169
+ 4. **Find Largest Files** (`file_organizer_find_largest_files`)
170
+ 5. **Find Duplicate Files** (`file_organizer_find_duplicate_files`)
171
+ 6. **Preview File Organization Plan** (`file_organizer_preview_organization`)
172
+ 7. **Get Available File Categories** (`file_organizer_get_categories`)
173
+ 8. **Analyze Duplicate Files with Smart Recommendations** (`file_organizer_analyze_duplicates`)
174
+ 9. **Organize Files** (`file_organizer_organize_files`)
175
+ 10. **Set Custom Organization Rules** (`file_organizer_set_custom_rules`)
176
+ 11. **Delete Duplicate Files** (`file_organizer_delete_duplicates`)
177
+ 12. **Undo Last Organization Operation** (`file_organizer_undo_last_operation`)
178
+
179
+ ### 3. Services Layer (`services/`)
180
+
181
+ **Responsibility:** Core business logic
182
+
183
+ #### PathValidatorService
184
+ ```typescript
185
+ class PathValidatorService {
186
+ // Multi-layer path validation
187
+ async validateStrictPath(inputPath: unknown, options?: ValidatePathOptions): Promise<string>
188
+
189
+ // Symlink resolution
190
+ async resolvePath(path: string): Promise<string>
191
+
192
+ // Containment checking
193
+ isPathWithinRoots(path: string, roots: string[]): boolean
194
+ }
195
+ ```
196
+
197
+ #### OrganizerService
198
+ ```typescript
199
+ class OrganizerService {
200
+ // Generate organization plan
201
+ async generateOrganizationPlan(
202
+ directory: string,
203
+ files: FileWithSize[],
204
+ strategy?: ConflictStrategy // 'rename' | 'skip' | 'overwrite' | 'overwrite_if_newer'
205
+ ): Promise<OrganizationPlan>
206
+
207
+ // Execute organization with safety guarantees
208
+ async organize(
209
+ directory: string,
210
+ files: FileWithSize[],
211
+ options?: OrganizeOptions
212
+ ): Promise<OrganizeResult>
213
+
214
+ // Safety mechanisms:
215
+ // 1. File descriptor validation before move
216
+ // 2. Atomic copy with COPYFILE_EXCL (race-safe)
217
+ // 3. Automatic backup to .file-organizer-backups/ on overwrite
218
+ // 4. Retry loop for race condition recovery
219
+ }
220
+ ```
221
+
222
+ #### HashCalculatorService
223
+ ```typescript
224
+ class HashCalculatorService {
225
+ // Streaming hash calculation
226
+ async calculateHash(filePath: string): Promise<string>
227
+
228
+ // Find duplicates (memory-safe)
229
+ async findDuplicates(files: FileWithSize[]): Promise<DuplicateGroup[]>
230
+ }
231
+ ```
232
+
233
+ #### FileScannerService
234
+ ```typescript
235
+ class FileScannerService {
236
+ // Recursive directory scanning
237
+ async getAllFiles(
238
+ directory: string,
239
+ options?: ScanOptions
240
+ ): Promise<FileWithSize[]>
241
+
242
+ // Size calculation
243
+ async calculateDirectorySize(directory: string): Promise<number>
244
+ }
245
+ ```
246
+
247
+ #### CategorizerService
248
+ ```typescript
249
+ class CategorizerService {
250
+ // File categorization
251
+ getCategory(fileName: string): CategoryName
252
+
253
+ // Custom rules support
254
+ setCustomRules(rules: CategoryRule[]): void
255
+
256
+ // Category statistics
257
+ categorizeFiles(files: FileWithSize[]): CategoryBreakdown
258
+ }
259
+ ```
260
+
261
+ #### RollbackService
262
+ ```typescript
263
+ class RollbackService {
264
+ // Create rollback manifest
265
+ async createManifest(actions: OrganizeAction[]): Promise<string>
266
+
267
+ // Execute rollback
268
+ async rollback(manifestId: string): Promise<RollbackResult>
269
+
270
+ // List available rollbacks
271
+ async listRollbacks(): Promise<RollbackManifest[]>
272
+ }
273
+ ```
274
+
275
+ ### 4. Utils Layer (`utils/`)
276
+
277
+ **Responsibility:** Shared utility functions
278
+
279
+ #### Logger
280
+ ```typescript
281
+ class Logger {
282
+ // Structured JSON logging to stderr (MCP stdio protocol)
283
+ debug(message: string, context?: Record<string, any>): void
284
+ info(message: string, context?: Record<string, any>): void
285
+ warn(message: string, context?: Record<string, any>): void
286
+ error(message: string, error?: Error, context?: Record<string, any>): void
287
+
288
+ // Features:
289
+ // - ISO 8601 timestamps
290
+ // - Configurable log levels (debug/info/warn/error)
291
+ // - Error stack traces for error logs
292
+ // - JSON format for machine parsing
293
+ }
294
+ ```
295
+
296
+ - **error-handler.ts** - Centralized error handling
297
+ - **file-utils.ts** - File system helpers
298
+ - **formatters.ts** - Data formatting (bytes, dates, etc.)
299
+
300
+ ### 5. Schemas Layer (`schemas/`)
301
+
302
+ **Responsibility:** Input validation using Zod
303
+
304
+ ```typescript
305
+ // Example: Path validation
306
+ export const PathSchema = z.string()
307
+ .min(1, 'Path cannot be empty')
308
+ .max(4096, 'Path exceeds maximum length')
309
+ .refine(
310
+ (path) => !path.includes('\0'),
311
+ 'Path contains null bytes'
312
+ );
313
+ ```
314
+
315
+ ## ๐Ÿ”„ Data Flow
316
+
317
+ ### Example: Organize Files Operation
318
+
319
+ ```
320
+ 1. LLM Request
321
+ โ†“
322
+ 2. MCP Server (server.ts)
323
+ - Parse JSON-RPC request
324
+ - Route to organize tool
325
+ โ†“
326
+ 3. Tool Handler (tools/file-organization.ts)
327
+ - Validate args with Zod
328
+ - Call PathValidatorService
329
+ โ†“
330
+ 4. PathValidatorService
331
+ - 7-layer validation
332
+ - Return validated path
333
+ โ†“
334
+ 5. FileScannerService
335
+ - Scan directory
336
+ - Apply resource limits
337
+ โ†“
338
+ 6. CategorizerService
339
+ - Categorize each file
340
+ โ†“
341
+ 7. OrganizerService
342
+ - Generate organization plan
343
+ - Check conflicts
344
+ - Execute moves (if not dry run)
345
+ โ†“
346
+ 8. RollbackService
347
+ - Create rollback manifest
348
+ โ†“
349
+ 9. Tool Handler
350
+ - Format response (JSON/Markdown)
351
+ โ†“
352
+ 10. MCP Server
353
+ - Send JSON-RPC response
354
+ โ†“
355
+ 11. LLM receives result
356
+ ```
357
+
358
+ ## ๐Ÿ’พ File Organization
359
+
360
+ ### Source Structure
361
+
362
+ ```
363
+ src/
364
+ โ”œโ”€โ”€ server.ts # MCP server entry point
365
+ โ”œโ”€โ”€ index.ts # Main entry point
366
+ โ”œโ”€โ”€ types.ts # TypeScript type definitions
367
+ โ”œโ”€โ”€ constants.ts # Application constants
368
+ โ”œโ”€โ”€ config.ts # Configuration management
369
+ โ”‚
370
+ โ”œโ”€โ”€ services/ # Core business logic
371
+ โ”‚ โ”œโ”€โ”€ path-validator.service.ts
372
+ โ”‚ โ”œโ”€โ”€ organizer.service.ts
373
+ โ”‚ โ”œโ”€โ”€ hash-calculator.service.ts
374
+ โ”‚ โ”œโ”€โ”€ file-scanner.service.ts
375
+ โ”‚ โ”œโ”€โ”€ categorizer.service.ts
376
+ โ”‚ โ””โ”€โ”€ rollback.service.ts
377
+ โ”‚
378
+ โ”œโ”€โ”€ tools/ # MCP tool implementations
379
+ โ”‚ โ”œโ”€โ”€ file-scanning.ts
380
+ โ”‚ โ”œโ”€โ”€ file-organization.ts
381
+ โ”‚ โ”œโ”€โ”€ file-duplicates.ts
382
+ โ”‚ โ”œโ”€โ”€ file-categorization.ts
383
+ โ”‚ โ””โ”€โ”€ ...
384
+ โ”‚
385
+ โ”œโ”€โ”€ schemas/ # Zod validation schemas
386
+ โ”‚ โ”œโ”€โ”€ security.schemas.ts
387
+ โ”‚ โ”œโ”€โ”€ common.schemas.ts
388
+ โ”‚ โ”œโ”€โ”€ scan.schemas.ts
389
+ โ”‚ โ””โ”€โ”€ organize.schemas.ts
390
+ โ”‚
391
+ โ””โ”€โ”€ utils/ # Shared utilities
392
+ โ”œโ”€โ”€ logger.ts
393
+ โ”œโ”€โ”€ error-handler.ts
394
+ โ”œโ”€โ”€ file-utils.ts
395
+ โ””โ”€โ”€ formatters.ts
396
+ ```
397
+
398
+ ## ๐Ÿงช Testing Architecture
399
+
400
+ ### Test Structure
401
+
402
+ ```
403
+ tests/
404
+ โ”œโ”€โ”€ unit/ # Unit tests for services
405
+ โ”‚ โ”œโ”€โ”€ services/
406
+ โ”‚ โ”‚ โ”œโ”€โ”€ path-validator.test.ts
407
+ โ”‚ โ”‚ โ”œโ”€โ”€ organizer.test.ts
408
+ โ”‚ โ”‚ โ””โ”€โ”€ ...
409
+ โ”‚ โ””โ”€โ”€ utils/
410
+ โ”‚
411
+ โ”œโ”€โ”€ integration/ # Integration tests for tools
412
+ โ”‚ โ”œโ”€โ”€ tools/
413
+ โ”‚ โ”‚ โ””โ”€โ”€ organize.test.ts
414
+ โ”‚ โ””โ”€โ”€ edge-cases.test.ts
415
+ โ”‚
416
+ โ””โ”€โ”€ performance/ # Performance benchmarks
417
+ โ””โ”€โ”€ performance.test.ts
418
+ ```
419
+
420
+ ### Test Philosophy
421
+
422
+ 1. **Unit Tests** - Test services in isolation
423
+ 2. **Integration Tests** - Test complete workflows
424
+ 3. **Security Tests** - Validate all security controls
425
+ 4. **Performance Tests** - Ensure scalability
426
+
427
+ ## ๐Ÿš€ Performance Considerations
428
+
429
+ ### Streaming Operations
430
+
431
+ Large files are processed using streams to avoid memory exhaustion:
432
+
433
+ ```typescript
434
+ // Hash calculation uses streams
435
+ const hash = crypto.createHash('sha256');
436
+ const stream = createReadStream(filePath, { highWaterMark: 64 * 1024 });
437
+ stream.on('data', (chunk) => hash.update(chunk));
438
+ ```
439
+
440
+ ### Resource Limits
441
+
442
+ ```typescript
443
+ // Enforced at multiple levels:
444
+ - File size: Skip files > 100MB for hashing
445
+ - File count: Max 10,000 files per operation
446
+ - Recursion depth: Max 10 levels
447
+ - Path length: Max 4,096 characters
448
+ ```
449
+
450
+ ### Caching Strategy
451
+
452
+ - Category mappings cached in-memory
453
+ - File stats cached during single operation
454
+ - No persistent caching (stateless design)
455
+
456
+ ## ๐Ÿ”ง Configuration
457
+
458
+ ### Configuration System (`config.ts`)
459
+
460
+ The server uses a platform-aware configuration system that combines hardcoded defaults with user customization.
461
+
462
+ **Structure:**
463
+ ```typescript
464
+ export const CONFIG = {
465
+ VERSION: '3.0.0',
466
+
467
+ security: {
468
+ enablePathValidation: true,
469
+ allowCustomDirectories: true,
470
+ logAccess: true,
471
+ maxScanDepth: 10,
472
+ maxFilesPerOperation: 10000
473
+ },
474
+
475
+ paths: {
476
+ defaultAllowed: getDefaultAllowedDirs(), // Platform-aware safe directories
477
+ customAllowed: loadCustomAllowedDirs(), // User-defined from config.json
478
+ alwaysBlocked: getAlwaysBlockedPatterns() // System protection patterns
479
+ }
480
+ };
481
+ ```
482
+
483
+ **Default Allowed Directories:**
484
+ - **Windows:** Desktop, Documents, Downloads, Pictures, Videos, Music, OneDrive, Projects
485
+ - **macOS:** Desktop, Documents, Downloads, Movies, Music, Pictures, iCloud Drive, Projects
486
+ - **Linux:** Desktop, Documents, Downloads, Music, Pictures, Videos, ~/dev, ~/workspace
487
+
488
+ **User Configuration:**
489
+ - **Windows:** `%APPDATA%\file-organizer-mcp\config.json`
490
+ - **macOS:** `~/Library/Application Support/file-organizer-mcp/config.json`
491
+ - **Linux:** `~/.config/file-organizer-mcp/config.json`
492
+
493
+ **Config File Format:**
494
+ ```json
495
+ {
496
+ "customAllowedDirectories": [
497
+ "C:\\Users\\Name\\CustomFolder",
498
+ "D:\\Projects"
499
+ ],
500
+ "settings": {
501
+ "maxScanDepth": 10,
502
+ "logAccess": true
503
+ }
504
+ }
505
+ ```
506
+
507
+ ## ๐ŸŽฏ Design Patterns
508
+
509
+ ### Dependency Injection
510
+
511
+ ```typescript
512
+ // Services receive dependencies via constructor
513
+ class OrganizerService {
514
+ constructor(
515
+ private categorizer: CategorizerService,
516
+ private rollback?: RollbackService
517
+ ) {}
518
+ }
519
+ ```
520
+
521
+ ### Error Handling
522
+
523
+ ```typescript
524
+ // Centralized error handling
525
+ try {
526
+ const result = await operation();
527
+ } catch (error) {
528
+ return createErrorResponse(error);
529
+ }
530
+ ```
531
+
532
+ ### Type Safety
533
+
534
+ ```typescript
535
+ // Strict types with Zod runtime validation
536
+ const ArgsSchema = z.object({
537
+ directory: PathSchema,
538
+ dry_run: z.boolean().optional()
539
+ });
540
+
541
+ type Args = z.infer<typeof ArgsSchema>;
542
+ ```
543
+
544
+ ## ๐Ÿ“Š Monitoring & Logging
545
+
546
+ ### Structured Logging
547
+
548
+ ```json
549
+ {
550
+ "timestamp": "2026-02-02T14:09:04.413Z",
551
+ "level": "info",
552
+ "message": "Created rollback manifest: uuid (6 actions)"
553
+ }
554
+ ```
555
+
556
+ ### Log Levels
557
+
558
+ - `error` - Critical failures
559
+ - `warn` - Recoverable issues (e.g., skipped files)
560
+ - `info` - Operation milestones
561
+ - `debug` - Detailed diagnostics
562
+
563
+ ## ๐Ÿ”ฎ Future Architecture Changes
564
+
565
+ ### Planned Improvements
566
+
567
+ 1. **Plugin System** - Allow custom categorization rules
568
+ 2. **Database Layer** - Persistent state for large operations
569
+ 3. **Queue System** - Background processing for large directories
570
+ 4. **Metrics Collection** - Performance monitoring
571
+ 5. **Multi-language Support** - i18n infrastructure
572
+
573
+ ## ๐Ÿ“š References
574
+
575
+ - [Model Context Protocol Spec](https://modelcontextprotocol.io)
576
+ - [Zod Documentation](https://zod.dev)
577
+ - [TypeScript Handbook](https://www.typescriptlang.org/docs)
578
+
579
+ ---
580
+
581
+ **Last Updated:** February 3, 2026
582
+ **Version:** 3.0.0
583
+
package/CHANGELOG.md ADDED
@@ -0,0 +1,120 @@
1
+ # Changelog
2
+
3
+ ## [3.0.0] - 2026-02-02
4
+
5
+ ### ๐Ÿš€ Major: Full TypeScript Migration
6
+
7
+ Complete rewrite from monolithic JavaScript to modular TypeScript architecture.
8
+
9
+ ### โœจ Added
10
+
11
+ **Architecture**
12
+ - New `src/` directory structure with layered architecture
13
+ - TypeScript strict mode with full type safety
14
+ - ESLint + Prettier configuration for code quality
15
+
16
+ **Services Layer** (`src/services/`)
17
+ - `PathValidatorService` - 8-layer path validation with Zod schemas
18
+ - `FileScannerService` - Recursive file scanning with depth/count limits
19
+ - `HashCalculatorService` - SHA-256 hashing for duplicate detection
20
+ - `CategorizerService` - File type categorization by extension
21
+ - `OrganizerService` - File organization with dry-run support
22
+ - `RollbackService` - Undo file operations with manifest tracking
23
+
24
+ **Tools Layer** (`src/tools/`)
25
+ - Each tool in its own file with Zod input validation
26
+ - Comprehensive JSDoc documentation with examples
27
+ - Exported TypeScript types inferred from Zod schemas
28
+
29
+ **Utilities** (`src/utils/`)
30
+ - `formatters.ts` - Byte/date/duration formatting
31
+ - `file-utils.ts` - Path normalization, expansion, validation
32
+ - `error-handler.ts` - Centralized error handling with sanitization
33
+ - `logger.ts` - Structured JSON logging with configurable log levels (debug/info/warn/error)
34
+
35
+ **Configuration** (`src/config.ts`)
36
+ - Platform-aware default directory detection (Windows/macOS/Linux)
37
+ - User configuration loading from platform-specific locations
38
+ - Whitelist/blacklist system for directory access control
39
+ - Auto-initialization of user config file
40
+
41
+ **Schemas** (`src/schemas/`)
42
+ - Zod schemas for all tool inputs
43
+ - Runtime validation with descriptive error messages
44
+ - Type inference from schemas
45
+
46
+ **Testing**
47
+ - Comprehensive unit tests for all services
48
+ - Integration tests for complete workflows
49
+ - Performance benchmarks
50
+ - 100+ tests passing across unit, integration, and performance suites
51
+ - `TESTS.md` - Complete test documentation
52
+
53
+ ### ๐Ÿ”ง Changed
54
+ - Entry point: `dist/index.js` (compiled from TypeScript)
55
+ - Build: `npm run build` compiles TypeScript
56
+ - Tests: `npm test` runs complete test suite
57
+ - Improved error messages with sanitized paths
58
+ - Enhanced security with TOCTOU mitigation using file descriptors
59
+
60
+ ### ๐Ÿ› Fixed
61
+ - Path traversal vulnerability (8-layer validation pipeline)
62
+ - Race conditions in file operations (atomic copy with `COPYFILE_EXCL`)
63
+ - Data loss during overwrites (automatic backups to `.file-organizer-backups/`)
64
+ - Windows path case-sensitivity issues
65
+ - Multiple test failures in duplicate management, organization flow, and file inspection
66
+
67
+ ### ๐Ÿ—‘๏ธ Removed
68
+ - `server.js` (672-line monolith) โ†’ replaced by `src/` modules
69
+ - `lib/` folder โ†’ migrated to `src/services/`
70
+ - JavaScript test files โ†’ migrated to TypeScript
71
+
72
+ ### ๐Ÿ“ฆ Dependencies Added
73
+ - `typescript` ^5.3.2
74
+ - `zod` ^3.22.4
75
+ - `@types/node` ^20.10.0
76
+ - `eslint`, `prettier`, `rimraf`
77
+ - `jest` for testing
78
+
79
+
80
+ ---
81
+
82
+ ## [3.0.0-beta.1] - 2026-02-02
83
+
84
+ ### ๐Ÿ”’ Security (CRITICAL)
85
+ - **FIXED**: Path traversal vulnerability (CVE-pending)
86
+ - Previous versions allowed `../` to access parent directories
87
+ - Now implements 8-layer validation pipeline
88
+ - All paths restricted to current working directory in strict mode
89
+ - **FIXED**: Windows Path Case-Sensitivity
90
+ - Resolves access denial for paths like `c:\Users` vs `C:\Users`
91
+ - Ensures robust whitelist matching on Windows platforms
92
+
93
+ ### โœจ Added
94
+ - New 8-layer path validation system
95
+ - Custom error classes (AccessDeniedError, ValidationError)
96
+ - Comprehensive security test suite (5/5 passing)
97
+ - Forward compatibility for Phase 2 (config system)
98
+
99
+ ### ๐Ÿ”ง Changed
100
+ - Updated to v3.0.0 architecture
101
+ - Path validation now uses base-validator.js
102
+ - Improved error messages with sanitized paths
103
+
104
+ ### โš ๏ธ Breaking Changes
105
+ - **NONE** - Fully backward compatible with v2.x for valid use cases
106
+ - Only breaking for invalid use cases (accessing parent directories)
107
+
108
+ ### ๐Ÿ“ฆ Migration from v2.x
109
+ No changes needed! All existing workflows continue to work.
110
+ If you were using `../` paths (which was a security bug), those now correctly fail.
111
+
112
+ ### ๐Ÿงช Testing
113
+ - 5/5 critical security tests passing
114
+ - All 6 original MCP tools tested and working
115
+ - Cross-platform tested (Windows, macOS, Linux)
116
+
117
+ ---
118
+
119
+ ## [2.1.0] - 2026-02-01
120
+ (Previous version with path traversal vulnerability - UPGRADE IMMEDIATELY)