stellavault 0.1.0 → 0.2.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 (385) hide show
  1. package/package.json +1 -1
  2. package/packages/cli/bin/ekh.js +2 -2
  3. package/packages/cli/dist/commands/federate-cmd.js +61 -31
  4. package/packages/core/dist/api/dashboard.d.ts +3 -0
  5. package/packages/core/{src/api/dashboard.ts → dist/api/dashboard.js} +8 -11
  6. package/packages/core/dist/api/graph-data.d.ts +11 -0
  7. package/packages/core/dist/api/graph-data.js +255 -0
  8. package/packages/core/dist/api/pwa.d.ts +3 -0
  9. package/packages/core/{src/api/pwa.ts → dist/api/pwa.js} +27 -32
  10. package/packages/core/dist/api/server.d.ts +16 -0
  11. package/packages/core/dist/api/server.js +647 -0
  12. package/packages/core/dist/capture/voice.d.ts +24 -0
  13. package/packages/core/dist/capture/voice.js +135 -0
  14. package/packages/core/{src/cloud/index.ts → dist/cloud/index.d.ts} +1 -0
  15. package/packages/core/dist/cloud/index.js +2 -0
  16. package/packages/core/dist/cloud/sync.d.ts +29 -0
  17. package/packages/core/dist/cloud/sync.js +137 -0
  18. package/packages/core/dist/config.d.ts +27 -0
  19. package/packages/core/dist/config.js +55 -0
  20. package/packages/core/dist/federation/credits.d.ts +26 -0
  21. package/packages/core/dist/federation/credits.js +56 -0
  22. package/packages/core/dist/federation/identity.d.ts +14 -0
  23. package/packages/core/dist/federation/identity.js +74 -0
  24. package/packages/core/{src/federation/index.ts → dist/federation/index.d.ts} +1 -2
  25. package/packages/core/dist/federation/index.js +5 -0
  26. package/packages/core/dist/federation/node.d.ts +31 -0
  27. package/packages/core/dist/federation/node.js +216 -0
  28. package/packages/core/dist/federation/privacy.d.ts +8 -0
  29. package/packages/core/dist/federation/privacy.js +40 -0
  30. package/packages/core/dist/federation/reputation.d.ts +37 -0
  31. package/packages/core/dist/federation/reputation.js +139 -0
  32. package/packages/core/dist/federation/search.d.ts +19 -0
  33. package/packages/core/dist/federation/search.js +101 -0
  34. package/packages/core/dist/federation/sharing.d.ts +72 -0
  35. package/packages/core/dist/federation/sharing.js +246 -0
  36. package/packages/core/dist/federation/trust.d.ts +15 -0
  37. package/packages/core/dist/federation/trust.js +60 -0
  38. package/packages/core/dist/federation/types.d.ts +40 -0
  39. package/packages/core/dist/federation/types.js +3 -0
  40. package/packages/core/dist/i18n/index.d.ts +6 -0
  41. package/packages/core/dist/i18n/index.js +81 -0
  42. package/packages/core/{src/index.ts → dist/index.d.ts} +48 -67
  43. package/packages/core/dist/index.js +69 -0
  44. package/packages/core/dist/indexer/chunker.d.ts +14 -0
  45. package/packages/core/dist/indexer/chunker.js +148 -0
  46. package/packages/core/dist/indexer/embedder.d.ts +8 -0
  47. package/packages/core/dist/indexer/embedder.js +3 -0
  48. package/packages/core/dist/indexer/index.d.ts +28 -0
  49. package/packages/core/dist/indexer/index.js +74 -0
  50. package/packages/core/dist/indexer/local-embedder.d.ts +3 -0
  51. package/packages/core/dist/indexer/local-embedder.js +29 -0
  52. package/packages/core/dist/indexer/scanner.d.ts +11 -0
  53. package/packages/core/dist/indexer/scanner.js +137 -0
  54. package/packages/core/dist/indexer/watcher.d.ts +19 -0
  55. package/packages/core/dist/indexer/watcher.js +49 -0
  56. package/packages/core/dist/intelligence/contradiction-detector.d.ts +20 -0
  57. package/packages/core/dist/intelligence/contradiction-detector.js +115 -0
  58. package/packages/core/dist/intelligence/decay-engine.d.ts +27 -0
  59. package/packages/core/dist/intelligence/decay-engine.js +190 -0
  60. package/packages/core/dist/intelligence/duplicate-detector.d.ts +20 -0
  61. package/packages/core/dist/intelligence/duplicate-detector.js +55 -0
  62. package/packages/core/dist/intelligence/fsrs.d.ts +43 -0
  63. package/packages/core/dist/intelligence/fsrs.js +70 -0
  64. package/packages/core/dist/intelligence/gap-detector.d.ts +25 -0
  65. package/packages/core/dist/intelligence/gap-detector.js +78 -0
  66. package/packages/core/dist/intelligence/learning-path.d.ts +31 -0
  67. package/packages/core/dist/intelligence/learning-path.js +53 -0
  68. package/packages/core/dist/intelligence/notifications.d.ts +31 -0
  69. package/packages/core/dist/intelligence/notifications.js +65 -0
  70. package/packages/core/dist/intelligence/predictive-gaps.d.ts +14 -0
  71. package/packages/core/dist/intelligence/predictive-gaps.js +74 -0
  72. package/packages/core/dist/intelligence/semantic-versioning.d.ts +37 -0
  73. package/packages/core/dist/intelligence/semantic-versioning.js +68 -0
  74. package/packages/core/dist/intelligence/types.d.ts +28 -0
  75. package/packages/core/dist/intelligence/types.js +3 -0
  76. package/packages/core/dist/mcp/custom-tools.d.ts +29 -0
  77. package/packages/core/dist/mcp/custom-tools.js +70 -0
  78. package/packages/core/{src/mcp/index.ts → dist/mcp/index.d.ts} +1 -0
  79. package/packages/core/dist/mcp/index.js +2 -0
  80. package/packages/core/dist/mcp/server.d.ts +49 -0
  81. package/packages/core/dist/mcp/server.js +133 -0
  82. package/packages/core/dist/mcp/tools/agentic-graph.d.ts +87 -0
  83. package/packages/core/dist/mcp/tools/agentic-graph.js +88 -0
  84. package/packages/core/dist/mcp/tools/brief.d.ts +31 -0
  85. package/packages/core/dist/mcp/tools/brief.js +39 -0
  86. package/packages/core/dist/mcp/tools/decay.d.ts +33 -0
  87. package/packages/core/dist/mcp/tools/decay.js +32 -0
  88. package/packages/core/dist/mcp/tools/decision-journal.d.ts +78 -0
  89. package/packages/core/dist/mcp/tools/decision-journal.js +79 -0
  90. package/packages/core/dist/mcp/tools/export.d.ts +29 -0
  91. package/packages/core/dist/mcp/tools/export.js +60 -0
  92. package/packages/core/dist/mcp/tools/federated-search.d.ts +29 -0
  93. package/packages/core/dist/mcp/tools/federated-search.js +36 -0
  94. package/packages/core/dist/mcp/tools/generate-claude-md.d.ts +35 -0
  95. package/packages/core/dist/mcp/tools/generate-claude-md.js +107 -0
  96. package/packages/core/dist/mcp/tools/get-document.d.ts +35 -0
  97. package/packages/core/dist/mcp/tools/get-document.js +25 -0
  98. package/packages/core/dist/mcp/tools/get-related.d.ts +32 -0
  99. package/packages/core/dist/mcp/tools/get-related.js +33 -0
  100. package/packages/core/dist/mcp/tools/learning-path.d.ts +23 -0
  101. package/packages/core/dist/mcp/tools/learning-path.js +45 -0
  102. package/packages/core/dist/mcp/tools/list-topics.d.ts +15 -0
  103. package/packages/core/dist/mcp/tools/list-topics.js +18 -0
  104. package/packages/core/dist/mcp/tools/search.d.ts +39 -0
  105. package/packages/core/dist/mcp/tools/search.js +29 -0
  106. package/packages/core/dist/mcp/tools/snapshot.d.ts +47 -0
  107. package/packages/core/dist/mcp/tools/snapshot.js +84 -0
  108. package/packages/core/dist/multi-vault/index.d.ts +26 -0
  109. package/packages/core/dist/multi-vault/index.js +80 -0
  110. package/packages/core/dist/pack/creator.d.ts +21 -0
  111. package/packages/core/dist/pack/creator.js +105 -0
  112. package/packages/core/dist/pack/exporter.d.ts +4 -0
  113. package/packages/core/dist/pack/exporter.js +18 -0
  114. package/packages/core/dist/pack/importer.d.ts +10 -0
  115. package/packages/core/dist/pack/importer.js +55 -0
  116. package/packages/core/{src/pack/index.ts → dist/pack/index.d.ts} +1 -0
  117. package/packages/core/dist/pack/index.js +5 -0
  118. package/packages/core/dist/pack/marketplace.d.ts +14 -0
  119. package/packages/core/dist/pack/marketplace.js +90 -0
  120. package/packages/core/dist/pack/pii-masker.d.ts +7 -0
  121. package/packages/core/dist/pack/pii-masker.js +29 -0
  122. package/packages/core/dist/pack/types.d.ts +36 -0
  123. package/packages/core/dist/pack/types.js +3 -0
  124. package/packages/core/dist/plugins/index.d.ts +35 -0
  125. package/packages/core/dist/plugins/index.js +57 -0
  126. package/packages/core/dist/plugins/webhooks.d.ts +30 -0
  127. package/packages/core/dist/plugins/webhooks.js +79 -0
  128. package/packages/core/dist/search/bm25.d.ts +4 -0
  129. package/packages/core/dist/search/bm25.js +10 -0
  130. package/packages/core/dist/search/index.d.ts +13 -0
  131. package/packages/core/dist/search/index.js +63 -0
  132. package/packages/core/dist/search/rrf.d.ts +7 -0
  133. package/packages/core/dist/search/rrf.js +21 -0
  134. package/packages/core/dist/search/semantic.d.ts +5 -0
  135. package/packages/core/dist/search/semantic.js +6 -0
  136. package/packages/core/{src/store/index.ts → dist/store/index.d.ts} +1 -0
  137. package/packages/core/dist/store/index.js +2 -0
  138. package/packages/core/dist/store/sqlite-vec.d.ts +6 -0
  139. package/packages/core/dist/store/sqlite-vec.js +251 -0
  140. package/packages/core/dist/store/types.d.ts +20 -0
  141. package/packages/core/dist/store/types.js +3 -0
  142. package/packages/core/dist/team/index.d.ts +25 -0
  143. package/packages/core/dist/team/index.js +97 -0
  144. package/packages/core/dist/types/chunk.d.ts +23 -0
  145. package/packages/core/dist/types/chunk.js +3 -0
  146. package/packages/core/dist/types/document.d.ts +23 -0
  147. package/packages/core/dist/types/document.js +3 -0
  148. package/packages/core/dist/types/graph.d.ts +39 -0
  149. package/packages/core/dist/types/graph.js +3 -0
  150. package/packages/core/dist/types/index.d.ts +5 -0
  151. package/packages/core/dist/types/index.js +2 -0
  152. package/packages/core/dist/types/search.d.ts +39 -0
  153. package/packages/core/dist/types/search.js +3 -0
  154. package/packages/core/dist/utils/retry.d.ts +25 -0
  155. package/packages/core/dist/utils/retry.js +59 -0
  156. package/memory/MEMORY.md +0 -25
  157. package/packages/cli/dist/commands/brief-cmd.d.ts.map +0 -1
  158. package/packages/cli/dist/commands/brief-cmd.js.map +0 -1
  159. package/packages/cli/dist/commands/capture-cmd.d.ts.map +0 -1
  160. package/packages/cli/dist/commands/capture-cmd.js.map +0 -1
  161. package/packages/cli/dist/commands/card-cmd.d.ts.map +0 -1
  162. package/packages/cli/dist/commands/card-cmd.js.map +0 -1
  163. package/packages/cli/dist/commands/clip-cmd.d.ts.map +0 -1
  164. package/packages/cli/dist/commands/clip-cmd.js.map +0 -1
  165. package/packages/cli/dist/commands/cloud-cmd.d.ts.map +0 -1
  166. package/packages/cli/dist/commands/cloud-cmd.js.map +0 -1
  167. package/packages/cli/dist/commands/contradictions-cmd.d.ts.map +0 -1
  168. package/packages/cli/dist/commands/contradictions-cmd.js.map +0 -1
  169. package/packages/cli/dist/commands/decay-cmd.d.ts.map +0 -1
  170. package/packages/cli/dist/commands/decay-cmd.js.map +0 -1
  171. package/packages/cli/dist/commands/digest-cmd.d.ts.map +0 -1
  172. package/packages/cli/dist/commands/digest-cmd.js.map +0 -1
  173. package/packages/cli/dist/commands/duplicates-cmd.d.ts.map +0 -1
  174. package/packages/cli/dist/commands/duplicates-cmd.js.map +0 -1
  175. package/packages/cli/dist/commands/federate-cmd.d.ts.map +0 -1
  176. package/packages/cli/dist/commands/federate-cmd.js.map +0 -1
  177. package/packages/cli/dist/commands/gaps-cmd.d.ts.map +0 -1
  178. package/packages/cli/dist/commands/gaps-cmd.js.map +0 -1
  179. package/packages/cli/dist/commands/graph-cmd.d.ts.map +0 -1
  180. package/packages/cli/dist/commands/graph-cmd.js.map +0 -1
  181. package/packages/cli/dist/commands/index-cmd.d.ts.map +0 -1
  182. package/packages/cli/dist/commands/index-cmd.js.map +0 -1
  183. package/packages/cli/dist/commands/init-cmd.d.ts.map +0 -1
  184. package/packages/cli/dist/commands/init-cmd.js.map +0 -1
  185. package/packages/cli/dist/commands/learn-cmd.d.ts.map +0 -1
  186. package/packages/cli/dist/commands/learn-cmd.js.map +0 -1
  187. package/packages/cli/dist/commands/pack-cmd.d.ts.map +0 -1
  188. package/packages/cli/dist/commands/pack-cmd.js.map +0 -1
  189. package/packages/cli/dist/commands/review-cmd.d.ts.map +0 -1
  190. package/packages/cli/dist/commands/review-cmd.js.map +0 -1
  191. package/packages/cli/dist/commands/search-cmd.d.ts.map +0 -1
  192. package/packages/cli/dist/commands/search-cmd.js.map +0 -1
  193. package/packages/cli/dist/commands/serve-cmd.d.ts.map +0 -1
  194. package/packages/cli/dist/commands/serve-cmd.js.map +0 -1
  195. package/packages/cli/dist/commands/status-cmd.d.ts.map +0 -1
  196. package/packages/cli/dist/commands/status-cmd.js.map +0 -1
  197. package/packages/cli/dist/commands/sync-cmd.d.ts.map +0 -1
  198. package/packages/cli/dist/commands/sync-cmd.js.map +0 -1
  199. package/packages/cli/dist/commands/vault-cmd.d.ts.map +0 -1
  200. package/packages/cli/dist/commands/vault-cmd.js.map +0 -1
  201. package/packages/cli/dist/index.d.ts.map +0 -1
  202. package/packages/cli/dist/index.js.map +0 -1
  203. package/packages/cli/src/commands/brief-cmd.ts +0 -87
  204. package/packages/cli/src/commands/capture-cmd.ts +0 -34
  205. package/packages/cli/src/commands/card-cmd.ts +0 -29
  206. package/packages/cli/src/commands/clip-cmd.ts +0 -172
  207. package/packages/cli/src/commands/cloud-cmd.ts +0 -75
  208. package/packages/cli/src/commands/contradictions-cmd.ts +0 -41
  209. package/packages/cli/src/commands/decay-cmd.ts +0 -57
  210. package/packages/cli/src/commands/digest-cmd.ts +0 -89
  211. package/packages/cli/src/commands/duplicates-cmd.ts +0 -38
  212. package/packages/cli/src/commands/federate-cmd.ts +0 -236
  213. package/packages/cli/src/commands/gaps-cmd.ts +0 -40
  214. package/packages/cli/src/commands/graph-cmd.ts +0 -88
  215. package/packages/cli/src/commands/index-cmd.ts +0 -65
  216. package/packages/cli/src/commands/init-cmd.ts +0 -145
  217. package/packages/cli/src/commands/learn-cmd.ts +0 -56
  218. package/packages/cli/src/commands/pack-cmd.ts +0 -121
  219. package/packages/cli/src/commands/review-cmd.ts +0 -125
  220. package/packages/cli/src/commands/search-cmd.ts +0 -45
  221. package/packages/cli/src/commands/serve-cmd.ts +0 -17
  222. package/packages/cli/src/commands/status-cmd.ts +0 -37
  223. package/packages/cli/src/commands/sync-cmd.ts +0 -68
  224. package/packages/cli/src/commands/vault-cmd.ts +0 -64
  225. package/packages/cli/src/index.ts +0 -187
  226. package/packages/core/src/api/graph-data.ts +0 -286
  227. package/packages/core/src/api/server.ts +0 -660
  228. package/packages/core/src/capture/voice.ts +0 -168
  229. package/packages/core/src/cloud/sync.ts +0 -167
  230. package/packages/core/src/config.ts +0 -82
  231. package/packages/core/src/federation/credits.ts +0 -80
  232. package/packages/core/src/federation/hyperswarm.d.ts +0 -19
  233. package/packages/core/src/federation/identity.ts +0 -90
  234. package/packages/core/src/federation/node.ts +0 -235
  235. package/packages/core/src/federation/privacy.ts +0 -52
  236. package/packages/core/src/federation/reputation.ts +0 -202
  237. package/packages/core/src/federation/search.ts +0 -129
  238. package/packages/core/src/federation/sharing.ts +0 -165
  239. package/packages/core/src/federation/trust.ts +0 -76
  240. package/packages/core/src/federation/types.ts +0 -25
  241. package/packages/core/src/i18n/index.ts +0 -85
  242. package/packages/core/src/indexer/chunker.ts +0 -180
  243. package/packages/core/src/indexer/embedder.ts +0 -9
  244. package/packages/core/src/indexer/index.ts +0 -113
  245. package/packages/core/src/indexer/local-embedder.ts +0 -35
  246. package/packages/core/src/indexer/scanner.ts +0 -142
  247. package/packages/core/src/indexer/watcher.ts +0 -62
  248. package/packages/core/src/intelligence/contradiction-detector.ts +0 -134
  249. package/packages/core/src/intelligence/decay-engine.ts +0 -229
  250. package/packages/core/src/intelligence/duplicate-detector.ts +0 -71
  251. package/packages/core/src/intelligence/fsrs.ts +0 -79
  252. package/packages/core/src/intelligence/gap-detector.ts +0 -109
  253. package/packages/core/src/intelligence/learning-path.ts +0 -86
  254. package/packages/core/src/intelligence/notifications.ts +0 -106
  255. package/packages/core/src/intelligence/predictive-gaps.ts +0 -94
  256. package/packages/core/src/intelligence/semantic-versioning.ts +0 -97
  257. package/packages/core/src/intelligence/types.ts +0 -28
  258. package/packages/core/src/mcp/custom-tools.ts +0 -97
  259. package/packages/core/src/mcp/server.ts +0 -142
  260. package/packages/core/src/mcp/tools/agentic-graph.ts +0 -96
  261. package/packages/core/src/mcp/tools/brief.ts +0 -49
  262. package/packages/core/src/mcp/tools/decay.ts +0 -40
  263. package/packages/core/src/mcp/tools/decision-journal.ts +0 -95
  264. package/packages/core/src/mcp/tools/export.ts +0 -72
  265. package/packages/core/src/mcp/tools/federated-search.ts +0 -43
  266. package/packages/core/src/mcp/tools/generate-claude-md.ts +0 -130
  267. package/packages/core/src/mcp/tools/get-document.ts +0 -26
  268. package/packages/core/src/mcp/tools/get-related.ts +0 -41
  269. package/packages/core/src/mcp/tools/learning-path.ts +0 -52
  270. package/packages/core/src/mcp/tools/list-topics.ts +0 -20
  271. package/packages/core/src/mcp/tools/search.ts +0 -35
  272. package/packages/core/src/mcp/tools/snapshot.ts +0 -98
  273. package/packages/core/src/multi-vault/index.ts +0 -118
  274. package/packages/core/src/pack/creator.ts +0 -127
  275. package/packages/core/src/pack/exporter.ts +0 -21
  276. package/packages/core/src/pack/importer.ts +0 -82
  277. package/packages/core/src/pack/marketplace.ts +0 -103
  278. package/packages/core/src/pack/pii-masker.ts +0 -38
  279. package/packages/core/src/pack/types.ts +0 -39
  280. package/packages/core/src/plugins/index.ts +0 -100
  281. package/packages/core/src/plugins/webhooks.ts +0 -110
  282. package/packages/core/src/search/bm25.ts +0 -16
  283. package/packages/core/src/search/index.ts +0 -83
  284. package/packages/core/src/search/rrf.ts +0 -31
  285. package/packages/core/src/search/semantic.ts +0 -15
  286. package/packages/core/src/store/sqlite-vec.ts +0 -290
  287. package/packages/core/src/store/types.ts +0 -22
  288. package/packages/core/src/team/index.ts +0 -126
  289. package/packages/core/src/types/chunk.ts +0 -25
  290. package/packages/core/src/types/document.ts +0 -24
  291. package/packages/core/src/types/graph.ts +0 -44
  292. package/packages/core/src/types/index.ts +0 -15
  293. package/packages/core/src/types/search.ts +0 -38
  294. package/packages/core/src/utils/retry.ts +0 -85
  295. package/packages/core/tests/api-card.test.ts +0 -60
  296. package/packages/core/tests/api-routes.test.ts +0 -98
  297. package/packages/core/tests/bm25.test.ts +0 -87
  298. package/packages/core/tests/chunker.test.ts +0 -48
  299. package/packages/core/tests/cluster.test.ts +0 -75
  300. package/packages/core/tests/constellation.test.ts +0 -77
  301. package/packages/core/tests/export-utils.test.ts +0 -97
  302. package/packages/core/tests/fsrs.test.ts +0 -96
  303. package/packages/core/tests/gesture-detector.test.ts +0 -45
  304. package/packages/core/tests/graph-data.test.ts +0 -87
  305. package/packages/core/tests/layout.test.ts +0 -83
  306. package/packages/core/tests/mcp.test.ts +0 -148
  307. package/packages/core/tests/pack.test.ts +0 -127
  308. package/packages/core/tests/pii-masker.test.ts +0 -42
  309. package/packages/core/tests/profile-card.test.ts +0 -62
  310. package/packages/core/tests/rrf.test.ts +0 -29
  311. package/packages/core/tests/search-integration.test.ts +0 -139
  312. package/packages/core/tests/store.test.ts +0 -80
  313. package/packages/graph/click-result.png +0 -0
  314. package/packages/graph/index.html +0 -17
  315. package/packages/graph/package.json +0 -32
  316. package/packages/graph/src/App.tsx +0 -7
  317. package/packages/graph/src/api/client.ts +0 -39
  318. package/packages/graph/src/components/ClusterFilter.tsx +0 -73
  319. package/packages/graph/src/components/ConstellationView.tsx +0 -232
  320. package/packages/graph/src/components/ExportPanel.tsx +0 -177
  321. package/packages/graph/src/components/Graph3D.tsx +0 -230
  322. package/packages/graph/src/components/GraphEdges.tsx +0 -100
  323. package/packages/graph/src/components/GraphNodes.tsx +0 -386
  324. package/packages/graph/src/components/HealthDashboard.tsx +0 -173
  325. package/packages/graph/src/components/Layout.tsx +0 -214
  326. package/packages/graph/src/components/MotionOverlay.tsx +0 -81
  327. package/packages/graph/src/components/MotionToggle.tsx +0 -33
  328. package/packages/graph/src/components/MultiverseView.tsx +0 -286
  329. package/packages/graph/src/components/NodeDetail.tsx +0 -232
  330. package/packages/graph/src/components/PulseParticle.tsx +0 -232
  331. package/packages/graph/src/components/SearchBar.tsx +0 -107
  332. package/packages/graph/src/components/StarField.tsx +0 -197
  333. package/packages/graph/src/components/StatusBar.tsx +0 -53
  334. package/packages/graph/src/components/Timeline.tsx +0 -148
  335. package/packages/graph/src/components/ToolsPanel.tsx +0 -512
  336. package/packages/graph/src/components/Tooltip.tsx +0 -100
  337. package/packages/graph/src/components/TypeFilter.tsx +0 -131
  338. package/packages/graph/src/embed/EmbedGraph.tsx +0 -144
  339. package/packages/graph/src/hooks/useConstellationLOD.ts +0 -76
  340. package/packages/graph/src/hooks/useDecay.ts +0 -37
  341. package/packages/graph/src/hooks/useExport.ts +0 -165
  342. package/packages/graph/src/hooks/useGraph.ts +0 -69
  343. package/packages/graph/src/hooks/useKeyboardNav.ts +0 -122
  344. package/packages/graph/src/hooks/useLayout.ts +0 -45
  345. package/packages/graph/src/hooks/useMotion.ts +0 -120
  346. package/packages/graph/src/hooks/usePulse.ts +0 -58
  347. package/packages/graph/src/hooks/useSearch.ts +0 -71
  348. package/packages/graph/src/lib/constellation.ts +0 -107
  349. package/packages/graph/src/lib/export-utils.ts +0 -48
  350. package/packages/graph/src/lib/gesture-detector.ts +0 -123
  351. package/packages/graph/src/lib/layout.worker.ts +0 -153
  352. package/packages/graph/src/lib/motion-controller.ts +0 -83
  353. package/packages/graph/src/lib/profile-card.ts +0 -122
  354. package/packages/graph/src/main.tsx +0 -4
  355. package/packages/graph/src/stores/graph-store.ts +0 -155
  356. package/packages/graph/success.png +0 -0
  357. package/packages/graph/test-click.mjs +0 -49
  358. package/packages/graph/test-explore.mjs +0 -102
  359. package/packages/graph/test-final.mjs +0 -61
  360. package/packages/graph/test-graph.mjs +0 -139
  361. package/packages/graph/test-hover.mjs +0 -48
  362. package/packages/graph/test-pulse.mjs +0 -68
  363. package/packages/graph/test-screenshot.mjs +0 -56
  364. package/packages/graph/test-v2.mjs +0 -97
  365. package/packages/graph/vite.config.ts +0 -15
  366. package/packages/sync/.env.example +0 -11
  367. package/packages/sync/.sync-state.json +0 -317
  368. package/packages/sync/.upload-state.json +0 -1009
  369. package/packages/sync/create-stella-network-notion.mjs +0 -151
  370. package/packages/sync/create-stellavault-project-notion.mjs +0 -322
  371. package/packages/sync/logs/sync-2026-03-28.log +0 -6
  372. package/packages/sync/logs/sync-2026-03-29.log +0 -12
  373. package/packages/sync/logs/sync-2026-03-30.log +0 -6
  374. package/packages/sync/logs/sync-2026-03-31.log +0 -6
  375. package/packages/sync/logs/sync-2026-04-01.log +0 -6
  376. package/packages/sync/logs/sync-2026-04-02.log +0 -6
  377. package/packages/sync/package-lock.json +0 -373
  378. package/packages/sync/package.json +0 -16
  379. package/packages/sync/run-sync.bat +0 -18
  380. package/packages/sync/run-sync.mjs +0 -46
  381. package/packages/sync/setup-scheduler.mjs +0 -119
  382. package/packages/sync/structured-sync.mjs +0 -187
  383. package/packages/sync/sync-to-obsidian.mjs +0 -264
  384. package/packages/sync/upload-pdca-to-notion.mjs +0 -495
  385. package/tsconfig.base.json +0 -18
@@ -1,87 +0,0 @@
1
- import { describe, it, expect, beforeEach, afterEach } from 'vitest';
2
- import { createSqliteVecStore } from '../src/store/sqlite-vec.js';
3
- import type { VectorStore } from '../src/store/types.js';
4
- import { buildGraphData } from '../src/api/graph-data.js';
5
-
6
- const DIMS = 4;
7
- let store: VectorStore;
8
-
9
- beforeEach(async () => {
10
- store = createSqliteVecStore(':memory:', DIMS);
11
- await store.initialize();
12
-
13
- // 3개 문서 삽입
14
- for (let i = 0; i < 3; i++) {
15
- await store.upsertDocument({
16
- id: `doc${i}`, filePath: `folder${i}/test.md`, title: `Doc ${i}`,
17
- content: `Content ${i}`, frontmatter: {}, tags: ['test'],
18
- lastModified: '2026-01-01', contentHash: `hash${i}`,
19
- });
20
- await store.upsertChunks([{
21
- id: `doc${i}#0`, documentId: `doc${i}`, content: `Content ${i}`,
22
- heading: `Doc ${i}`, startLine: 1, endLine: 1, tokenCount: 2,
23
- embedding: [i === 0 ? 1 : 0, i === 1 ? 1 : 0, i === 2 ? 1 : 0, 0.5],
24
- }]);
25
- }
26
- });
27
-
28
- afterEach(async () => { await store.close(); });
29
-
30
- describe('buildGraphData', () => {
31
- it('semantic 모드: 노드 수 = 문서 수', async () => {
32
- const data = await buildGraphData(store, { mode: 'semantic' });
33
- expect(data.nodes.length).toBe(3);
34
- expect(data.stats.nodeCount).toBe(3);
35
- });
36
-
37
- it('노드에 필수 필드 존재', async () => {
38
- const data = await buildGraphData(store);
39
- const node = data.nodes[0];
40
- expect(node.id).toBeDefined();
41
- expect(node.label).toBeDefined();
42
- expect(node.filePath).toBeDefined();
43
- expect(node.clusterId).toBeTypeOf('number');
44
- expect(node.size).toBeGreaterThan(0);
45
- });
46
-
47
- it('엣지 threshold 이상만 생성', async () => {
48
- const data = await buildGraphData(store, { edgeThreshold: 0.99 });
49
- // 직교 벡터라 유사도 < 0.99 → 엣지 없음
50
- expect(data.edges.length).toBe(0);
51
- });
52
-
53
- it('엣지 threshold 낮으면 연결 생성', async () => {
54
- const data = await buildGraphData(store, { edgeThreshold: 0.0 });
55
- expect(data.edges.length).toBeGreaterThan(0);
56
- for (const edge of data.edges) {
57
- expect(edge.source).toBeDefined();
58
- expect(edge.target).toBeDefined();
59
- expect(edge.weight).toBeGreaterThanOrEqual(0);
60
- }
61
- });
62
-
63
- it('folder 모드: 폴더별 클러스터', async () => {
64
- const data = await buildGraphData(store, { mode: 'folder' });
65
- expect(data.clusters.length).toBe(3); // folder0, folder1, folder2
66
- for (const c of data.clusters) {
67
- expect(c.label).toBeDefined();
68
- expect(c.nodeCount).toBeGreaterThan(0);
69
- expect(c.color).toMatch(/^#/);
70
- }
71
- });
72
-
73
- it('클러스터에 컬러와 라벨 존재', async () => {
74
- const data = await buildGraphData(store);
75
- for (const c of data.clusters) {
76
- expect(c.color).toMatch(/^#/);
77
- expect(c.label.length).toBeGreaterThan(0);
78
- }
79
- });
80
-
81
- it('stats 정확', async () => {
82
- const data = await buildGraphData(store);
83
- expect(data.stats.nodeCount).toBe(data.nodes.length);
84
- expect(data.stats.edgeCount).toBe(data.edges.length);
85
- expect(data.stats.clusterCount).toBe(data.clusters.length);
86
- });
87
- });
@@ -1,83 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
-
3
- // layout.worker는 브라우저 Web Worker이므로 직접 테스트 불가
4
- // graph-data의 buildGraphData로 노드 위치/엣지 생성을 간접 검증
5
-
6
- import { buildGraphData } from '../src/api/graph-data.js';
7
- import { createSqliteVecStore } from '../src/store/sqlite-vec.js';
8
- import type { VectorStore } from '../src/store/types.js';
9
-
10
- const DIMS = 4;
11
-
12
- async function setup(n: number): Promise<VectorStore> {
13
- const store = createSqliteVecStore(':memory:', DIMS);
14
- await store.initialize();
15
- for (let i = 0; i < n; i++) {
16
- const vec = [Math.random(), Math.random(), Math.random(), Math.random()];
17
- await store.upsertDocument({
18
- id: `d${i}`, filePath: `test/d${i}.md`, title: `Doc ${i}`,
19
- content: `Content ${i}`, frontmatter: {}, tags: [],
20
- lastModified: '2026-01-01', contentHash: `h${i}`,
21
- });
22
- await store.upsertChunks([{
23
- id: `d${i}#0`, documentId: `d${i}`, content: `Content ${i}`,
24
- heading: `Doc ${i}`, startLine: 1, endLine: 1, tokenCount: 2,
25
- embedding: vec,
26
- }]);
27
- }
28
- return store;
29
- }
30
-
31
- describe('Graph Layout Data Generation', () => {
32
- it('노드 수 = 문서 수', async () => {
33
- const store = await setup(10);
34
- const data = await buildGraphData(store);
35
- expect(data.nodes.length).toBe(10);
36
- await store.close();
37
- });
38
-
39
- it('엣지 source/target이 유효한 노드 ID', async () => {
40
- const store = await setup(10);
41
- const data = await buildGraphData(store, { edgeThreshold: 0 });
42
- const nodeIds = new Set(data.nodes.map(n => n.id));
43
- for (const edge of data.edges) {
44
- expect(nodeIds.has(edge.source)).toBe(true);
45
- expect(nodeIds.has(edge.target)).toBe(true);
46
- }
47
- await store.close();
48
- });
49
-
50
- it('maxEdgesPerNode 제한 동작', async () => {
51
- const store = await setup(10);
52
- const data = await buildGraphData(store, { edgeThreshold: 0, maxEdgesPerNode: 2 });
53
- // 각 노드의 엣지 수가 maxEdgesPerNode 이하
54
- const edgeCounts = new Map<string, number>();
55
- for (const e of data.edges) {
56
- edgeCounts.set(e.source, (edgeCounts.get(e.source) ?? 0) + 1);
57
- edgeCounts.set(e.target, (edgeCounts.get(e.target) ?? 0) + 1);
58
- }
59
- // 중복 엣지 방지로 실제 카운트는 다를 수 있지만, 합리적 범위
60
- for (const count of edgeCounts.values()) {
61
- expect(count).toBeLessThanOrEqual(20); // 넉넉한 상한
62
- }
63
- await store.close();
64
- });
65
-
66
- it('노드 size가 양수', async () => {
67
- const store = await setup(5);
68
- const data = await buildGraphData(store);
69
- for (const n of data.nodes) {
70
- expect(n.size).toBeGreaterThan(0);
71
- }
72
- await store.close();
73
- });
74
-
75
- it('빈 store → 빈 그래프', async () => {
76
- const store = createSqliteVecStore(':memory:', DIMS);
77
- await store.initialize();
78
- const data = await buildGraphData(store);
79
- expect(data.nodes.length).toBe(0);
80
- expect(data.edges.length).toBe(0);
81
- await store.close();
82
- });
83
- });
@@ -1,148 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { handleSearch, searchToolDef } from '../src/mcp/tools/search.js';
3
- import { handleGetDocument, getDocumentToolDef } from '../src/mcp/tools/get-document.js';
4
- import { handleListTopics, listTopicsToolDef } from '../src/mcp/tools/list-topics.js';
5
- import { handleGetRelated, getRelatedToolDef } from '../src/mcp/tools/get-related.js';
6
- import type { VectorStore } from '../src/store/types.js';
7
- import type { SearchEngine } from '../src/search/index.js';
8
- import type { Document } from '../src/types/document.js';
9
-
10
- // Mock data
11
- const mockDoc: Document = {
12
- id: 'doc1', filePath: 'test.md', title: 'Test Document',
13
- content: 'Test content about React patterns',
14
- frontmatter: { category: 'tech' }, tags: ['react', 'test'],
15
- lastModified: '2026-01-01', contentHash: 'abc123',
16
- };
17
-
18
- function createMockStore(): VectorStore {
19
- return {
20
- getDocument: async (id: string) => id === 'doc1' ? mockDoc : null,
21
- getChunk: async () => null,
22
- getTopics: async () => [
23
- { topic: 'react', count: 5, recentDocuments: [{ id: 'doc1', title: 'Test' }] },
24
- { topic: 'security', count: 3, recentDocuments: [] },
25
- ],
26
- getStats: async () => ({
27
- documentCount: 10, chunkCount: 50, dbSizeBytes: 1024, lastIndexed: '2026-01-01',
28
- }),
29
- initialize: async () => {},
30
- close: async () => {},
31
- upsertDocument: async () => {},
32
- upsertChunks: async () => {},
33
- deleteByDocumentId: async () => {},
34
- searchSemantic: async () => [],
35
- searchKeyword: async () => [],
36
- getAllDocumentHashes: async () => new Map(),
37
- } as VectorStore;
38
- }
39
-
40
- function createMockSearchEngine(): SearchEngine {
41
- return {
42
- search: async ({ query, limit }) => [{
43
- chunk: {
44
- id: 'doc1#0', documentId: 'doc1', content: 'React patterns content',
45
- heading: 'Patterns', startLine: 1, endLine: 3, tokenCount: 5,
46
- },
47
- document: mockDoc,
48
- score: 0.85,
49
- highlights: ['React patterns content'],
50
- }].slice(0, limit ?? 5),
51
- };
52
- }
53
-
54
- describe('MCP Tool Definitions', () => {
55
- it('search tool schema 유효', () => {
56
- expect(searchToolDef.name).toBe('search');
57
- expect(searchToolDef.inputSchema.required).toContain('query');
58
- expect(searchToolDef.inputSchema.properties.query).toBeDefined();
59
- expect(searchToolDef.inputSchema.properties.limit).toBeDefined();
60
- expect(searchToolDef.inputSchema.properties.tags).toBeDefined();
61
- });
62
-
63
- it('get-document tool schema 유효', () => {
64
- expect(getDocumentToolDef.name).toBe('get-document');
65
- expect(getDocumentToolDef.inputSchema.required).toContain('id');
66
- });
67
-
68
- it('list-topics tool schema 유효', () => {
69
- expect(listTopicsToolDef.name).toBe('list-topics');
70
- expect(listTopicsToolDef.inputSchema.properties).toBeDefined();
71
- });
72
-
73
- it('get-related tool schema 유효', () => {
74
- expect(getRelatedToolDef.name).toBe('get-related');
75
- expect(getRelatedToolDef.inputSchema.required).toContain('id');
76
- });
77
- });
78
-
79
- describe('handleSearch', () => {
80
- it('검색 결과를 올바른 형식으로 반환', async () => {
81
- const engine = createMockSearchEngine();
82
- const results = await handleSearch(engine, { query: 'React' });
83
-
84
- expect(results.length).toBeGreaterThan(0);
85
- const r = results[0];
86
- expect(r.title).toBe('Test Document');
87
- expect(r.filePath).toBe('test.md');
88
- expect(r.heading).toBe('Patterns');
89
- expect(r.content).toBe('React patterns content');
90
- expect(r.score).toBe(0.85);
91
- expect(r.tags).toEqual(['react', 'test']);
92
- });
93
-
94
- it('limit 전달', async () => {
95
- const engine = createMockSearchEngine();
96
- const results = await handleSearch(engine, { query: 'React', limit: 1 });
97
- expect(results.length).toBeLessThanOrEqual(1);
98
- });
99
- });
100
-
101
- describe('handleGetDocument', () => {
102
- it('존재하는 문서 반환', async () => {
103
- const store = createMockStore();
104
- const result = await handleGetDocument(store, { id: 'doc1' });
105
-
106
- expect(result).not.toHaveProperty('error');
107
- expect((result as any).title).toBe('Test Document');
108
- expect((result as any).filePath).toBe('test.md');
109
- expect((result as any).content).toBe('Test content about React patterns');
110
- expect((result as any).tags).toEqual(['react', 'test']);
111
- });
112
-
113
- it('존재하지 않는 문서는 error 반환', async () => {
114
- const store = createMockStore();
115
- const result = await handleGetDocument(store, { id: 'nonexistent' });
116
- expect(result).toHaveProperty('error');
117
- });
118
- });
119
-
120
- describe('handleListTopics', () => {
121
- it('토픽 목록과 통계 반환', async () => {
122
- const store = createMockStore();
123
- const result = await handleListTopics(store);
124
-
125
- expect(result.topics).toHaveLength(2);
126
- expect(result.topics[0].topic).toBe('react');
127
- expect(result.totalDocuments).toBe(10);
128
- expect(result.totalChunks).toBe(50);
129
- });
130
- });
131
-
132
- describe('handleGetRelated', () => {
133
- it('관련 문서 반환 (자기 자신 제외)', async () => {
134
- const store = createMockStore();
135
- const engine = createMockSearchEngine();
136
- const results = await handleGetRelated(store, engine, { id: 'doc1' });
137
-
138
- // doc1 자체는 필터링되므로 빈 결과 가능
139
- expect(Array.isArray(results)).toBe(true);
140
- });
141
-
142
- it('존재하지 않는 문서 ID는 error 반환', async () => {
143
- const store = createMockStore();
144
- const engine = createMockSearchEngine();
145
- const result = await handleGetRelated(store, engine, { id: 'nonexistent' });
146
- expect(result).toHaveProperty('error');
147
- });
148
- });
@@ -1,127 +0,0 @@
1
- import { describe, it, expect, beforeEach, afterEach } from 'vitest';
2
- import { createSqliteVecStore } from '../src/store/sqlite-vec.js';
3
- import { createSearchEngine } from '../src/search/index.js';
4
- import { createPack, exportPack, importPack } from '../src/pack/index.js';
5
- import type { VectorStore } from '../src/store/types.js';
6
- import type { Embedder } from '../src/indexer/embedder.js';
7
- import { join } from 'node:path';
8
- import { tmpdir } from 'node:os';
9
- import { existsSync, unlinkSync } from 'node:fs';
10
-
11
- const DIMS = 4;
12
- let store: VectorStore;
13
- let embedder: Embedder;
14
-
15
- function mockEmbedder(): Embedder {
16
- return {
17
- dimensions: DIMS, modelName: 'test-model',
18
- initialize: async () => {},
19
- embed: async (text) => {
20
- const h = text.length;
21
- return [h % 3 / 3, h % 5 / 5, h % 7 / 7, h % 11 / 11];
22
- },
23
- embedBatch: async (texts) => texts.map(t => {
24
- const h = t.length;
25
- return [h % 3 / 3, h % 5 / 5, h % 7 / 7, h % 11 / 11];
26
- }),
27
- };
28
- }
29
-
30
- beforeEach(async () => {
31
- store = createSqliteVecStore(':memory:', DIMS);
32
- await store.initialize();
33
- embedder = mockEmbedder();
34
-
35
- await store.upsertDocument({
36
- id: 'doc1', filePath: '08_Patterns/auth.md', title: 'Auth Pattern',
37
- content: 'OAuth patterns for authentication. Contact admin@test.com',
38
- frontmatter: {}, tags: ['auth'], lastModified: '2026-01-01', contentHash: 'h1',
39
- });
40
- await store.upsertChunks([{
41
- id: 'doc1#0', documentId: 'doc1',
42
- content: 'OAuth patterns for authentication. Contact admin@test.com',
43
- heading: 'Auth Pattern', startLine: 1, endLine: 1, tokenCount: 8,
44
- embedding: [0.5, 0.5, 0.5, 0.5],
45
- }]);
46
- });
47
-
48
- afterEach(async () => { await store.close(); });
49
-
50
- describe('Knowledge Pack', () => {
51
- it('검색 기반 팩 생성', async () => {
52
- const searchEngine = createSearchEngine({ store, embedder });
53
- const { pack, piiReport } = await createPack(store, searchEngine, embedder, {
54
- name: 'auth-patterns',
55
- fromSearch: 'OAuth',
56
- });
57
-
58
- expect(pack.name).toBe('auth-patterns');
59
- expect(pack.chunks.length).toBeGreaterThan(0);
60
- expect(pack.embeddingModel).toBe('test-model');
61
- expect(pack.schemaVersion).toBe('1.0');
62
- });
63
-
64
- it('PII 자동 마스킹', async () => {
65
- const searchEngine = createSearchEngine({ store, embedder });
66
- const { pack, piiReport } = await createPack(store, searchEngine, embedder, {
67
- name: 'test-pii',
68
- fromSearch: 'OAuth',
69
- });
70
-
71
- // 이메일이 마스킹되어야 함
72
- for (const chunk of pack.chunks) {
73
- expect(chunk.content).not.toContain('admin@test.com');
74
- }
75
- expect(piiReport.redactedCount).toBeGreaterThan(0);
76
- });
77
-
78
- it('내보내기 + 가져오기 라운드트립', async () => {
79
- const searchEngine = createSearchEngine({ store, embedder });
80
- const { pack } = await createPack(store, searchEngine, embedder, {
81
- name: 'roundtrip-test',
82
- fromSearch: 'OAuth',
83
- });
84
-
85
- const tmpPath = join(tmpdir(), 'test-roundtrip.sv-pack');
86
- exportPack(pack, tmpPath);
87
- expect(existsSync(tmpPath)).toBe(true);
88
-
89
- // 새 store에 import
90
- const store2 = createSqliteVecStore(':memory:', DIMS);
91
- await store2.initialize();
92
-
93
- const result = await importPack(store2, embedder, tmpPath);
94
- expect(result.imported).toBeGreaterThan(0);
95
- expect(result.modelMismatch).toBe(false);
96
-
97
- // import된 청크 검색 가능
98
- const stats = await store2.getStats();
99
- expect(stats.chunkCount).toBeGreaterThan(0);
100
-
101
- await store2.close();
102
- try { unlinkSync(tmpPath); } catch {}
103
- });
104
-
105
- it('모델 불일치 시 재임베딩', async () => {
106
- const searchEngine = createSearchEngine({ store, embedder });
107
- const { pack } = await createPack(store, searchEngine, embedder, {
108
- name: 'mismatch-test',
109
- fromSearch: 'OAuth',
110
- });
111
-
112
- const tmpPath = join(tmpdir(), 'test-mismatch.sv-pack');
113
- exportPack(pack, tmpPath);
114
-
115
- // 다른 모델명의 embedder로 import
116
- const otherEmbedder = { ...mockEmbedder(), modelName: 'other-model' };
117
- const store2 = createSqliteVecStore(':memory:', DIMS);
118
- await store2.initialize();
119
-
120
- const result = await importPack(store2, otherEmbedder, tmpPath);
121
- expect(result.modelMismatch).toBe(true);
122
- expect(result.reEmbedded).toBeGreaterThan(0);
123
-
124
- await store2.close();
125
- try { unlinkSync(tmpPath); } catch {}
126
- });
127
- });
@@ -1,42 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { maskPII } from '../src/pack/pii-masker.js';
3
-
4
- describe('PII Masker', () => {
5
- it('이메일 마스킹', () => {
6
- const { masked, redactedCount } = maskPII('Contact user@example.com for help');
7
- expect(masked).not.toContain('user@example.com');
8
- expect(masked).toContain('[REDACTED:email]');
9
- expect(redactedCount).toBe(1);
10
- });
11
-
12
- it('API 키 마스킹', () => {
13
- const { masked } = maskPII('Use sk_live_1234567890abcdefghij for auth');
14
- expect(masked).toContain('[REDACTED:api_key]');
15
- });
16
-
17
- it('AWS 키 마스킹', () => {
18
- const { masked } = maskPII('AWS key: AKIAIOSFODNN7EXAMPLE');
19
- expect(masked).toContain('[REDACTED:aws_key]');
20
- });
21
-
22
- it('JWT 마스킹', () => {
23
- const { masked } = maskPII('token: eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.dozjgNryP4J3jVmNHl0w5N_XgL0n3I9PlFUP0THsR8U');
24
- expect(masked).toContain('[REDACTED:jwt]');
25
- });
26
-
27
- it('PII 없으면 변경 없음', () => {
28
- const text = 'React 컴포넌트 패턴에 대한 가이드';
29
- const { masked, redactedCount } = maskPII(text);
30
- expect(masked).toBe(text);
31
- expect(redactedCount).toBe(0);
32
- });
33
-
34
- it('복수 PII 동시 마스킹', () => {
35
- const { masked, redactedCount, redactedTypes } = maskPII(
36
- 'admin@test.com has key sk_test_abcdefghijklmnopqrstuvwxyz1234'
37
- );
38
- expect(redactedCount).toBeGreaterThanOrEqual(2);
39
- expect(redactedTypes).toContain('email');
40
- expect(redactedTypes).toContain('api_key');
41
- });
42
- });
@@ -1,62 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
-
3
- // profile-card SVG 생성 로직 검증
4
- // 실제 함수는 graph 패키지이므로 SVG 구조 검증용 단위 테스트
5
-
6
- function generateSimpleSVG(data: {
7
- documentCount: number;
8
- clusterCount: number;
9
- edgeCount: number;
10
- clusters: Array<{ label: string; nodeCount: number; color: string }>;
11
- tags: Array<{ tag: string; count: number }>;
12
- }): string {
13
- const W = 800, H = 420;
14
- const esc = (s: string) => s.replace(/&/g, '&amp;').replace(/</g, '&lt;');
15
- return `<svg xmlns="http://www.w3.org/2000/svg" width="${W}" height="${H}">
16
- <text>${data.documentCount} docs</text>
17
- ${data.clusters.map(c => `<circle fill="${c.color}"/>`).join('')}
18
- ${data.tags.map(t => `<text>#${esc(t.tag)}</text>`).join('')}
19
- </svg>`;
20
- }
21
-
22
- describe('Profile Card SVG', () => {
23
- it('유효한 SVG 생성', () => {
24
- const svg = generateSimpleSVG({
25
- documentCount: 100, clusterCount: 5, edgeCount: 200,
26
- clusters: [{ label: 'AI', nodeCount: 50, color: '#6366f1' }],
27
- tags: [{ tag: 'react', count: 10 }],
28
- });
29
- expect(svg).toContain('<svg');
30
- expect(svg).toContain('100 docs');
31
- });
32
-
33
- it('클러스터 컬러 포함', () => {
34
- const svg = generateSimpleSVG({
35
- documentCount: 10, clusterCount: 2, edgeCount: 5,
36
- clusters: [
37
- { label: 'A', nodeCount: 5, color: '#ff0000' },
38
- { label: 'B', nodeCount: 5, color: '#00ff00' },
39
- ],
40
- tags: [],
41
- });
42
- expect(svg).toContain('#ff0000');
43
- expect(svg).toContain('#00ff00');
44
- });
45
-
46
- it('태그 이스케이프', () => {
47
- const svg = generateSimpleSVG({
48
- documentCount: 1, clusterCount: 1, edgeCount: 0,
49
- clusters: [], tags: [{ tag: '<script>', count: 1 }],
50
- });
51
- expect(svg).not.toContain('<script>');
52
- expect(svg).toContain('&lt;script');
53
- });
54
-
55
- it('빈 데이터도 에러 없이 생성', () => {
56
- const svg = generateSimpleSVG({
57
- documentCount: 0, clusterCount: 0, edgeCount: 0,
58
- clusters: [], tags: [],
59
- });
60
- expect(svg).toContain('<svg');
61
- });
62
- });
@@ -1,29 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { rrfFusion } from '../src/search/rrf.js';
3
-
4
- describe('rrfFusion', () => {
5
- it('양쪽 리스트에 있는 항목이 상위', () => {
6
- const listA = [{ chunkId: 'a', score: 0.9 }, { chunkId: 'b', score: 0.8 }];
7
- const listB = [{ chunkId: 'b', score: 0.95 }, { chunkId: 'c', score: 0.7 }];
8
- const result = rrfFusion(listA, listB, 60, 10);
9
- expect(result[0].chunkId).toBe('b'); // 양쪽 모두 등장
10
- });
11
-
12
- it('limit 적용', () => {
13
- const listA = [{ chunkId: 'a', score: 1 }, { chunkId: 'b', score: 0.9 }, { chunkId: 'c', score: 0.8 }];
14
- const result = rrfFusion(listA, [], 60, 2);
15
- expect(result.length).toBe(2);
16
- });
17
-
18
- it('빈 리스트 처리', () => {
19
- const result = rrfFusion([], [], 60, 10);
20
- expect(result).toEqual([]);
21
- });
22
-
23
- it('k 값에 따라 점수 변동', () => {
24
- const list = [{ chunkId: 'a', score: 1 }];
25
- const r1 = rrfFusion(list, [], 10, 10); // 1/(10+1) = 0.0909
26
- const r2 = rrfFusion(list, [], 60, 10); // 1/(60+1) = 0.0164
27
- expect(r1[0].score).toBeGreaterThan(r2[0].score);
28
- });
29
- });