glancey 2.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 (336) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +435 -0
  3. package/dist/__tests__/ast-chunker.test.d.ts +2 -0
  4. package/dist/__tests__/ast-chunker.test.d.ts.map +1 -0
  5. package/dist/__tests__/ast-chunker.test.js +307 -0
  6. package/dist/__tests__/ast-chunker.test.js.map +1 -0
  7. package/dist/__tests__/config.test.d.ts +2 -0
  8. package/dist/__tests__/config.test.d.ts.map +1 -0
  9. package/dist/__tests__/config.test.js +242 -0
  10. package/dist/__tests__/config.test.js.map +1 -0
  11. package/dist/__tests__/dashboard/beads.test.d.ts +2 -0
  12. package/dist/__tests__/dashboard/beads.test.d.ts.map +1 -0
  13. package/dist/__tests__/dashboard/beads.test.js +151 -0
  14. package/dist/__tests__/dashboard/beads.test.js.map +1 -0
  15. package/dist/__tests__/dashboard/index.test.d.ts +2 -0
  16. package/dist/__tests__/dashboard/index.test.d.ts.map +1 -0
  17. package/dist/__tests__/dashboard/index.test.js +116 -0
  18. package/dist/__tests__/dashboard/index.test.js.map +1 -0
  19. package/dist/__tests__/dashboard/routes.test.d.ts +2 -0
  20. package/dist/__tests__/dashboard/routes.test.d.ts.map +1 -0
  21. package/dist/__tests__/dashboard/routes.test.js +125 -0
  22. package/dist/__tests__/dashboard/routes.test.js.map +1 -0
  23. package/dist/__tests__/dashboard/server.test.d.ts +2 -0
  24. package/dist/__tests__/dashboard/server.test.d.ts.map +1 -0
  25. package/dist/__tests__/dashboard/server.test.js +75 -0
  26. package/dist/__tests__/dashboard/server.test.js.map +1 -0
  27. package/dist/__tests__/dashboard/state.test.d.ts +2 -0
  28. package/dist/__tests__/dashboard/state.test.d.ts.map +1 -0
  29. package/dist/__tests__/dashboard/state.test.js +124 -0
  30. package/dist/__tests__/dashboard/state.test.js.map +1 -0
  31. package/dist/__tests__/dashboard/token-tracking.test.d.ts +2 -0
  32. package/dist/__tests__/dashboard/token-tracking.test.d.ts.map +1 -0
  33. package/dist/__tests__/dashboard/token-tracking.test.js +315 -0
  34. package/dist/__tests__/dashboard/token-tracking.test.js.map +1 -0
  35. package/dist/__tests__/embeddings/factory.test.d.ts +2 -0
  36. package/dist/__tests__/embeddings/factory.test.d.ts.map +1 -0
  37. package/dist/__tests__/embeddings/factory.test.js +157 -0
  38. package/dist/__tests__/embeddings/factory.test.js.map +1 -0
  39. package/dist/__tests__/embeddings/gemini.test.d.ts +2 -0
  40. package/dist/__tests__/embeddings/gemini.test.d.ts.map +1 -0
  41. package/dist/__tests__/embeddings/gemini.test.js +178 -0
  42. package/dist/__tests__/embeddings/gemini.test.js.map +1 -0
  43. package/dist/__tests__/embeddings/ollama.test.d.ts +2 -0
  44. package/dist/__tests__/embeddings/ollama.test.d.ts.map +1 -0
  45. package/dist/__tests__/embeddings/ollama.test.js +273 -0
  46. package/dist/__tests__/embeddings/ollama.test.js.map +1 -0
  47. package/dist/__tests__/embeddings/rate-limiter.test.d.ts +2 -0
  48. package/dist/__tests__/embeddings/rate-limiter.test.d.ts.map +1 -0
  49. package/dist/__tests__/embeddings/rate-limiter.test.js +163 -0
  50. package/dist/__tests__/embeddings/rate-limiter.test.js.map +1 -0
  51. package/dist/__tests__/embeddings/retry.test.d.ts +2 -0
  52. package/dist/__tests__/embeddings/retry.test.d.ts.map +1 -0
  53. package/dist/__tests__/embeddings/retry.test.js +334 -0
  54. package/dist/__tests__/embeddings/retry.test.js.map +1 -0
  55. package/dist/__tests__/embeddings/types.test.d.ts +2 -0
  56. package/dist/__tests__/embeddings/types.test.d.ts.map +1 -0
  57. package/dist/__tests__/embeddings/types.test.js +31 -0
  58. package/dist/__tests__/embeddings/types.test.js.map +1 -0
  59. package/dist/__tests__/mocks/embedding-backend.mock.d.ts +10 -0
  60. package/dist/__tests__/mocks/embedding-backend.mock.d.ts.map +1 -0
  61. package/dist/__tests__/mocks/embedding-backend.mock.js +39 -0
  62. package/dist/__tests__/mocks/embedding-backend.mock.js.map +1 -0
  63. package/dist/__tests__/mocks/fetch.mock.d.ts +49 -0
  64. package/dist/__tests__/mocks/fetch.mock.d.ts.map +1 -0
  65. package/dist/__tests__/mocks/fetch.mock.js +102 -0
  66. package/dist/__tests__/mocks/fetch.mock.js.map +1 -0
  67. package/dist/__tests__/mocks/lancedb.mock.d.ts +38 -0
  68. package/dist/__tests__/mocks/lancedb.mock.d.ts.map +1 -0
  69. package/dist/__tests__/mocks/lancedb.mock.js +63 -0
  70. package/dist/__tests__/mocks/lancedb.mock.js.map +1 -0
  71. package/dist/__tests__/search/clustering.test.d.ts +2 -0
  72. package/dist/__tests__/search/clustering.test.d.ts.map +1 -0
  73. package/dist/__tests__/search/clustering.test.js +230 -0
  74. package/dist/__tests__/search/clustering.test.js.map +1 -0
  75. package/dist/__tests__/search/hybrid-search.test.d.ts +2 -0
  76. package/dist/__tests__/search/hybrid-search.test.d.ts.map +1 -0
  77. package/dist/__tests__/search/hybrid-search.test.js +279 -0
  78. package/dist/__tests__/search/hybrid-search.test.js.map +1 -0
  79. package/dist/__tests__/search/indexer.test.d.ts +2 -0
  80. package/dist/__tests__/search/indexer.test.d.ts.map +1 -0
  81. package/dist/__tests__/search/indexer.test.js +1305 -0
  82. package/dist/__tests__/search/indexer.test.js.map +1 -0
  83. package/dist/__tests__/search/tree-sitter-chunker.test.d.ts +2 -0
  84. package/dist/__tests__/search/tree-sitter-chunker.test.d.ts.map +1 -0
  85. package/dist/__tests__/search/tree-sitter-chunker.test.js +228 -0
  86. package/dist/__tests__/search/tree-sitter-chunker.test.js.map +1 -0
  87. package/dist/__tests__/setup.d.ts +2 -0
  88. package/dist/__tests__/setup.d.ts.map +1 -0
  89. package/dist/__tests__/setup.js +11 -0
  90. package/dist/__tests__/setup.js.map +1 -0
  91. package/dist/__tests__/tools/clustering-handlers.test.d.ts +2 -0
  92. package/dist/__tests__/tools/clustering-handlers.test.d.ts.map +1 -0
  93. package/dist/__tests__/tools/clustering-handlers.test.js +286 -0
  94. package/dist/__tests__/tools/clustering-handlers.test.js.map +1 -0
  95. package/dist/__tests__/tools/commit-handlers.test.d.ts +2 -0
  96. package/dist/__tests__/tools/commit-handlers.test.d.ts.map +1 -0
  97. package/dist/__tests__/tools/commit-handlers.test.js +153 -0
  98. package/dist/__tests__/tools/commit-handlers.test.js.map +1 -0
  99. package/dist/__tests__/tools/index-handlers.test.d.ts +2 -0
  100. package/dist/__tests__/tools/index-handlers.test.d.ts.map +1 -0
  101. package/dist/__tests__/tools/index-handlers.test.js +184 -0
  102. package/dist/__tests__/tools/index-handlers.test.js.map +1 -0
  103. package/dist/__tests__/tools/instructions-handlers.test.d.ts +2 -0
  104. package/dist/__tests__/tools/instructions-handlers.test.d.ts.map +1 -0
  105. package/dist/__tests__/tools/instructions-handlers.test.js +53 -0
  106. package/dist/__tests__/tools/instructions-handlers.test.js.map +1 -0
  107. package/dist/__tests__/tools/memory-handlers.test.d.ts +2 -0
  108. package/dist/__tests__/tools/memory-handlers.test.d.ts.map +1 -0
  109. package/dist/__tests__/tools/memory-handlers.test.js +175 -0
  110. package/dist/__tests__/tools/memory-handlers.test.js.map +1 -0
  111. package/dist/__tests__/tools/search-handlers.test.d.ts +2 -0
  112. package/dist/__tests__/tools/search-handlers.test.d.ts.map +1 -0
  113. package/dist/__tests__/tools/search-handlers.test.js +229 -0
  114. package/dist/__tests__/tools/search-handlers.test.js.map +1 -0
  115. package/dist/__tests__/tools/symbol-handlers.test.d.ts +2 -0
  116. package/dist/__tests__/tools/symbol-handlers.test.d.ts.map +1 -0
  117. package/dist/__tests__/tools/symbol-handlers.test.js +348 -0
  118. package/dist/__tests__/tools/symbol-handlers.test.js.map +1 -0
  119. package/dist/__tests__/tools/worktree-handlers.test.d.ts +2 -0
  120. package/dist/__tests__/tools/worktree-handlers.test.d.ts.map +1 -0
  121. package/dist/__tests__/tools/worktree-handlers.test.js +297 -0
  122. package/dist/__tests__/tools/worktree-handlers.test.js.map +1 -0
  123. package/dist/__tests__/utils/cache.test.d.ts +2 -0
  124. package/dist/__tests__/utils/cache.test.d.ts.map +1 -0
  125. package/dist/__tests__/utils/cache.test.js +147 -0
  126. package/dist/__tests__/utils/cache.test.js.map +1 -0
  127. package/dist/__tests__/utils/concurrency.test.d.ts +2 -0
  128. package/dist/__tests__/utils/concurrency.test.d.ts.map +1 -0
  129. package/dist/__tests__/utils/concurrency.test.js +83 -0
  130. package/dist/__tests__/utils/concurrency.test.js.map +1 -0
  131. package/dist/__tests__/utils/errors.test.d.ts +2 -0
  132. package/dist/__tests__/utils/errors.test.d.ts.map +1 -0
  133. package/dist/__tests__/utils/errors.test.js +136 -0
  134. package/dist/__tests__/utils/errors.test.js.map +1 -0
  135. package/dist/__tests__/utils/logger.test.d.ts +2 -0
  136. package/dist/__tests__/utils/logger.test.d.ts.map +1 -0
  137. package/dist/__tests__/utils/logger.test.js +131 -0
  138. package/dist/__tests__/utils/logger.test.js.map +1 -0
  139. package/dist/__tests__/utils/type-guards.test.d.ts +2 -0
  140. package/dist/__tests__/utils/type-guards.test.d.ts.map +1 -0
  141. package/dist/__tests__/utils/type-guards.test.js +80 -0
  142. package/dist/__tests__/utils/type-guards.test.js.map +1 -0
  143. package/dist/__tests__/worktree/worktree-manager.test.d.ts +2 -0
  144. package/dist/__tests__/worktree/worktree-manager.test.d.ts.map +1 -0
  145. package/dist/__tests__/worktree/worktree-manager.test.js +403 -0
  146. package/dist/__tests__/worktree/worktree-manager.test.js.map +1 -0
  147. package/dist/config.d.ts +191 -0
  148. package/dist/config.d.ts.map +1 -0
  149. package/dist/config.js +788 -0
  150. package/dist/config.js.map +1 -0
  151. package/dist/dashboard/beads.d.ts +35 -0
  152. package/dist/dashboard/beads.d.ts.map +1 -0
  153. package/dist/dashboard/beads.js +102 -0
  154. package/dist/dashboard/beads.js.map +1 -0
  155. package/dist/dashboard/events.d.ts +64 -0
  156. package/dist/dashboard/events.d.ts.map +1 -0
  157. package/dist/dashboard/events.js +211 -0
  158. package/dist/dashboard/events.js.map +1 -0
  159. package/dist/dashboard/index.d.ts +69 -0
  160. package/dist/dashboard/index.d.ts.map +1 -0
  161. package/dist/dashboard/index.js +93 -0
  162. package/dist/dashboard/index.js.map +1 -0
  163. package/dist/dashboard/routes.d.ts +6 -0
  164. package/dist/dashboard/routes.d.ts.map +1 -0
  165. package/dist/dashboard/routes.js +505 -0
  166. package/dist/dashboard/routes.js.map +1 -0
  167. package/dist/dashboard/server.d.ts +27 -0
  168. package/dist/dashboard/server.d.ts.map +1 -0
  169. package/dist/dashboard/server.js +72 -0
  170. package/dist/dashboard/server.js.map +1 -0
  171. package/dist/dashboard/state.d.ts +172 -0
  172. package/dist/dashboard/state.d.ts.map +1 -0
  173. package/dist/dashboard/state.js +362 -0
  174. package/dist/dashboard/state.js.map +1 -0
  175. package/dist/dashboard/token-tracking.d.ts +143 -0
  176. package/dist/dashboard/token-tracking.d.ts.map +1 -0
  177. package/dist/dashboard/token-tracking.js +363 -0
  178. package/dist/dashboard/token-tracking.js.map +1 -0
  179. package/dist/dashboard/ui.d.ts +6 -0
  180. package/dist/dashboard/ui.d.ts.map +1 -0
  181. package/dist/dashboard/ui.js +2710 -0
  182. package/dist/dashboard/ui.js.map +1 -0
  183. package/dist/embeddings/gemini.d.ts +28 -0
  184. package/dist/embeddings/gemini.d.ts.map +1 -0
  185. package/dist/embeddings/gemini.js +165 -0
  186. package/dist/embeddings/gemini.js.map +1 -0
  187. package/dist/embeddings/index.d.ts +34 -0
  188. package/dist/embeddings/index.d.ts.map +1 -0
  189. package/dist/embeddings/index.js +120 -0
  190. package/dist/embeddings/index.js.map +1 -0
  191. package/dist/embeddings/ollama.d.ts +22 -0
  192. package/dist/embeddings/ollama.d.ts.map +1 -0
  193. package/dist/embeddings/ollama.js +179 -0
  194. package/dist/embeddings/ollama.js.map +1 -0
  195. package/dist/embeddings/rate-limiter.d.ts +75 -0
  196. package/dist/embeddings/rate-limiter.d.ts.map +1 -0
  197. package/dist/embeddings/rate-limiter.js +145 -0
  198. package/dist/embeddings/rate-limiter.js.map +1 -0
  199. package/dist/embeddings/retry.d.ts +20 -0
  200. package/dist/embeddings/retry.d.ts.map +1 -0
  201. package/dist/embeddings/retry.js +227 -0
  202. package/dist/embeddings/retry.js.map +1 -0
  203. package/dist/embeddings/types.d.ts +103 -0
  204. package/dist/embeddings/types.d.ts.map +1 -0
  205. package/dist/embeddings/types.js +23 -0
  206. package/dist/embeddings/types.js.map +1 -0
  207. package/dist/index.d.ts +12 -0
  208. package/dist/index.d.ts.map +1 -0
  209. package/dist/index.js +2028 -0
  210. package/dist/index.js.map +1 -0
  211. package/dist/memory/index.d.ts +63 -0
  212. package/dist/memory/index.d.ts.map +1 -0
  213. package/dist/memory/index.js +168 -0
  214. package/dist/memory/index.js.map +1 -0
  215. package/dist/search/ast-chunker.d.ts +29 -0
  216. package/dist/search/ast-chunker.d.ts.map +1 -0
  217. package/dist/search/ast-chunker.js +236 -0
  218. package/dist/search/ast-chunker.js.map +1 -0
  219. package/dist/search/chunk-utils.d.ts +24 -0
  220. package/dist/search/chunk-utils.d.ts.map +1 -0
  221. package/dist/search/chunk-utils.js +41 -0
  222. package/dist/search/chunk-utils.js.map +1 -0
  223. package/dist/search/clustering.d.ts +77 -0
  224. package/dist/search/clustering.d.ts.map +1 -0
  225. package/dist/search/clustering.js +455 -0
  226. package/dist/search/clustering.js.map +1 -0
  227. package/dist/search/indexer.d.ts +377 -0
  228. package/dist/search/indexer.d.ts.map +1 -0
  229. package/dist/search/indexer.js +1557 -0
  230. package/dist/search/indexer.js.map +1 -0
  231. package/dist/search/tree-sitter-chunker.d.ts +64 -0
  232. package/dist/search/tree-sitter-chunker.d.ts.map +1 -0
  233. package/dist/search/tree-sitter-chunker.js +412 -0
  234. package/dist/search/tree-sitter-chunker.js.map +1 -0
  235. package/dist/symbols/index.d.ts +14 -0
  236. package/dist/symbols/index.d.ts.map +1 -0
  237. package/dist/symbols/index.js +19 -0
  238. package/dist/symbols/index.js.map +1 -0
  239. package/dist/symbols/name-path.d.ts +113 -0
  240. package/dist/symbols/name-path.d.ts.map +1 -0
  241. package/dist/symbols/name-path.js +194 -0
  242. package/dist/symbols/name-path.js.map +1 -0
  243. package/dist/symbols/pattern-search.d.ts +14 -0
  244. package/dist/symbols/pattern-search.d.ts.map +1 -0
  245. package/dist/symbols/pattern-search.js +224 -0
  246. package/dist/symbols/pattern-search.js.map +1 -0
  247. package/dist/symbols/reference-finder.d.ts +38 -0
  248. package/dist/symbols/reference-finder.d.ts.map +1 -0
  249. package/dist/symbols/reference-finder.js +376 -0
  250. package/dist/symbols/reference-finder.js.map +1 -0
  251. package/dist/symbols/symbol-editor.d.ts +81 -0
  252. package/dist/symbols/symbol-editor.d.ts.map +1 -0
  253. package/dist/symbols/symbol-editor.js +257 -0
  254. package/dist/symbols/symbol-editor.js.map +1 -0
  255. package/dist/symbols/symbol-extractor.d.ts +49 -0
  256. package/dist/symbols/symbol-extractor.d.ts.map +1 -0
  257. package/dist/symbols/symbol-extractor.js +593 -0
  258. package/dist/symbols/symbol-extractor.js.map +1 -0
  259. package/dist/symbols/symbol-renamer.d.ts +81 -0
  260. package/dist/symbols/symbol-renamer.d.ts.map +1 -0
  261. package/dist/symbols/symbol-renamer.js +204 -0
  262. package/dist/symbols/symbol-renamer.js.map +1 -0
  263. package/dist/symbols/types.d.ts +234 -0
  264. package/dist/symbols/types.d.ts.map +1 -0
  265. package/dist/symbols/types.js +106 -0
  266. package/dist/symbols/types.js.map +1 -0
  267. package/dist/tools/clustering-handlers.d.ts +70 -0
  268. package/dist/tools/clustering-handlers.d.ts.map +1 -0
  269. package/dist/tools/clustering-handlers.js +150 -0
  270. package/dist/tools/clustering-handlers.js.map +1 -0
  271. package/dist/tools/commit-handlers.d.ts +77 -0
  272. package/dist/tools/commit-handlers.d.ts.map +1 -0
  273. package/dist/tools/commit-handlers.js +251 -0
  274. package/dist/tools/commit-handlers.js.map +1 -0
  275. package/dist/tools/index-handlers.d.ts +31 -0
  276. package/dist/tools/index-handlers.d.ts.map +1 -0
  277. package/dist/tools/index-handlers.js +53 -0
  278. package/dist/tools/index-handlers.js.map +1 -0
  279. package/dist/tools/instructions-handlers.d.ts +25 -0
  280. package/dist/tools/instructions-handlers.d.ts.map +1 -0
  281. package/dist/tools/instructions-handlers.js +36 -0
  282. package/dist/tools/instructions-handlers.js.map +1 -0
  283. package/dist/tools/memory-handlers.d.ts +95 -0
  284. package/dist/tools/memory-handlers.d.ts.map +1 -0
  285. package/dist/tools/memory-handlers.js +126 -0
  286. package/dist/tools/memory-handlers.js.map +1 -0
  287. package/dist/tools/search-handlers.d.ts +51 -0
  288. package/dist/tools/search-handlers.d.ts.map +1 -0
  289. package/dist/tools/search-handlers.js +128 -0
  290. package/dist/tools/search-handlers.js.map +1 -0
  291. package/dist/tools/symbol-handlers.d.ts +171 -0
  292. package/dist/tools/symbol-handlers.d.ts.map +1 -0
  293. package/dist/tools/symbol-handlers.js +456 -0
  294. package/dist/tools/symbol-handlers.js.map +1 -0
  295. package/dist/tools/types.d.ts +32 -0
  296. package/dist/tools/types.d.ts.map +1 -0
  297. package/dist/tools/types.js +17 -0
  298. package/dist/tools/types.js.map +1 -0
  299. package/dist/tools/worktree-handlers.d.ts +96 -0
  300. package/dist/tools/worktree-handlers.d.ts.map +1 -0
  301. package/dist/tools/worktree-handlers.js +186 -0
  302. package/dist/tools/worktree-handlers.js.map +1 -0
  303. package/dist/utils/cache.d.ts +77 -0
  304. package/dist/utils/cache.d.ts.map +1 -0
  305. package/dist/utils/cache.js +134 -0
  306. package/dist/utils/cache.js.map +1 -0
  307. package/dist/utils/concurrency.d.ts +32 -0
  308. package/dist/utils/concurrency.d.ts.map +1 -0
  309. package/dist/utils/concurrency.js +57 -0
  310. package/dist/utils/concurrency.js.map +1 -0
  311. package/dist/utils/errors.d.ts +36 -0
  312. package/dist/utils/errors.d.ts.map +1 -0
  313. package/dist/utils/errors.js +91 -0
  314. package/dist/utils/errors.js.map +1 -0
  315. package/dist/utils/logger.d.ts +37 -0
  316. package/dist/utils/logger.d.ts.map +1 -0
  317. package/dist/utils/logger.js +114 -0
  318. package/dist/utils/logger.js.map +1 -0
  319. package/dist/utils/type-guards.d.ts +17 -0
  320. package/dist/utils/type-guards.d.ts.map +1 -0
  321. package/dist/utils/type-guards.js +25 -0
  322. package/dist/utils/type-guards.js.map +1 -0
  323. package/dist/worktree/index.d.ts +6 -0
  324. package/dist/worktree/index.d.ts.map +1 -0
  325. package/dist/worktree/index.js +6 -0
  326. package/dist/worktree/index.js.map +1 -0
  327. package/dist/worktree/types.d.ts +101 -0
  328. package/dist/worktree/types.d.ts.map +1 -0
  329. package/dist/worktree/types.js +6 -0
  330. package/dist/worktree/types.js.map +1 -0
  331. package/dist/worktree/worktree-manager.d.ts +80 -0
  332. package/dist/worktree/worktree-manager.d.ts.map +1 -0
  333. package/dist/worktree/worktree-manager.js +407 -0
  334. package/dist/worktree/worktree-manager.js.map +1 -0
  335. package/package.json +87 -0
  336. package/scripts/postinstall.js +48 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Nicholas Smith
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,435 @@
1
+ <p align="center">
2
+ <img src="logo.png" alt="glancey logo" width="150" height="150">
3
+ </p>
4
+
5
+ <p align="center">
6
+ <a href="https://github.com/nicholaspsmith/glancey/actions/workflows/ci.yml"><img src="https://github.com/nicholaspsmith/glancey/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
7
+ <a href="https://www.npmjs.com/package/glancey"><img src="https://img.shields.io/npm/v/glancey.svg" alt="npm version"></a>
8
+ <a href="https://github.com/nicholaspsmith/glancey/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License: MIT"></a>
9
+ <img src="https://img.shields.io/badge/node-%3E%3D20.0.0-brightgreen.svg" alt="Node.js version">
10
+ </p>
11
+
12
+ # glancey
13
+
14
+ An MCP plugin that adds semantic code search to Claude Code and other AI coding agents, giving them deep context from your entire codebase.
15
+
16
+ ## Features
17
+
18
+ - **Semantic Code Search**: Natural language queries locate relevant code across your entire codebase
19
+ - **Token Savings**: Dramatically reduces context usage by returning only relevant code chunks
20
+ - **Multiple Embedding Backends**: Google Gemini (free) or Ollama (local)
21
+ - **LanceDB Vector Storage**: Fast, efficient vector search with hybrid BM25 + dense matching
22
+ - **MCP Compatible**: Works with Claude Code, Cursor, and other MCP-compatible tools
23
+ - **Web Dashboard**: Real-time monitoring of index status, token savings, and usage statistics
24
+ - **Beads Integration**: Shows issue tracker data if your project uses [beads](https://github.com/steveyegge/beads)
25
+
26
+ ## How glancey Saves Tokens
27
+
28
+ AI coding agents typically need to read entire files to understand your codebase, which consumes significant context tokens. glancey dramatically reduces token usage by:
29
+
30
+ | Without glancey | With glancey | Savings |
31
+ |-----------------------|-------------------|---------|
32
+ | Read 5-10 files to find auth code (~5000 lines) | `search_code` returns 3 chunks (~150 lines) | ~97% |
33
+ | Read entire file to understand structure | `get_symbols_overview` returns compact list | ~80-90% |
34
+ | Explore many files to understand codebase | `summarize_codebase` + `list_concepts` | ~95% |
35
+ | Read and compare files for duplicates | `search_similar` returns targeted results | ~90% |
36
+
37
+ ### Token Savings Dashboard
38
+
39
+ The web dashboard displays real-time token savings statistics:
40
+ - **Estimated Tokens Saved**: Total tokens avoided by using semantic search
41
+ - **Efficiency**: Percentage of potential tokens saved
42
+ - **Files Not Read**: Count of files skipped due to targeted search
43
+ - **Operations Tracked**: Number of search operations contributing to savings
44
+
45
+ ### How It Works
46
+
47
+ 1. **Chunking**: Your codebase is split into semantic chunks (functions, classes, etc.)
48
+ 2. **Embedding**: Each chunk is converted to a vector embedding
49
+ 3. **Search**: Queries find only the most relevant chunks, not entire files
50
+ 4. **Return**: Only the matching chunks are sent to the AI, saving context tokens
51
+
52
+ ## Installation
53
+
54
+ ### Quick Install (Recommended)
55
+
56
+ Add glancey to Claude Code:
57
+
58
+ ```bash
59
+ claude mcp add --scope user --transport stdio glancey -- npx -y glancey
60
+ ```
61
+
62
+ Restart Claude Code to start using semantic search.
63
+
64
+ ### Global Install (Alternative)
65
+
66
+ For faster startup (no npm check on each run):
67
+
68
+ ```bash
69
+ npm install -g glancey
70
+ ```
71
+
72
+ This automatically registers glancey with Claude Code. Update manually with `npm update -g glancey`.
73
+
74
+ ### Manual Registration
75
+
76
+ If automatic registration didn't work, manually add to Claude Code:
77
+
78
+ ```bash
79
+ claude mcp add --scope user --transport stdio glancey -- npx -y glancey@latest
80
+ ```
81
+
82
+ ### Verify Installation
83
+
84
+ In Claude Code, run `/mcp` to see glancey in the list of MCP servers.
85
+
86
+ ### Project-Level Installation
87
+
88
+ For project-specific MCP configuration, add a `.mcp.json` to your project root:
89
+
90
+ ```json
91
+ {
92
+ "mcpServers": {
93
+ "glancey": {
94
+ "command": "npx",
95
+ "args": ["-y", "glancey@latest"]
96
+ }
97
+ }
98
+ }
99
+ ```
100
+
101
+ ### Project Configuration
102
+
103
+ Create a `.glancey.json` file in your project root to customize indexing behavior. All options are optional - glancey works out of the box with sensible defaults.
104
+
105
+ #### Minimal Configuration
106
+
107
+ For most projects, you only need to specify what to include:
108
+
109
+ ```json
110
+ {
111
+ "patterns": ["**/*.ts", "**/*.js"],
112
+ "instructions": "This is a TypeScript monorepo. Use semantic search to find relevant utilities."
113
+ }
114
+ ```
115
+
116
+ #### Full Configuration Example
117
+
118
+ ```json
119
+ {
120
+ "patterns": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
121
+ "excludePatterns": ["**/node_modules/**", "**/dist/**", "**/*.test.ts"],
122
+ "embedding": {
123
+ "backend": "gemini"
124
+ },
125
+ "chunking": {
126
+ "maxLines": 100,
127
+ "overlap": 20
128
+ },
129
+ "search": {
130
+ "semanticWeight": 0.7,
131
+ "keywordWeight": 0.3
132
+ },
133
+ "dashboard": {
134
+ "enabled": true,
135
+ "port": 24300,
136
+ "openBrowser": true
137
+ },
138
+ "instructions": "Project-specific instructions for AI agents working with this codebase."
139
+ }
140
+ ```
141
+
142
+ #### Configuration Options Reference
143
+
144
+ | Option | Description | Default |
145
+ |--------|-------------|---------|
146
+ | `patterns` | Glob patterns for files to index | `["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "**/*.py", "**/*.go", "**/*.rs", "**/*.java", "**/*.rb", "**/*.php", "**/*.c", "**/*.cpp", "**/*.h", "**/*.hpp", "**/*.cs", "**/*.swift", "**/*.kt"]` |
147
+ | `excludePatterns` | Glob patterns for files to exclude | `["**/node_modules/**", "**/dist/**", "**/.git/**", "**/build/**", "**/target/**", "**/__pycache__/**", "**/venv/**", "**/.venv/**", "**/vendor/**", "**/*.min.js", "**/*.min.css"]` |
148
+ | `embedding.backend` | Embedding provider: `"gemini"` or `"ollama"` | Auto-detect based on available API keys |
149
+ | `embedding.model` | Override the default embedding model | Backend default |
150
+ | `embedding.ollamaConcurrency` | Max concurrent Ollama requests (1-200) | `100` |
151
+ | `indexing.batchSize` | Texts per embedding batch request (1-1000) | `200` |
152
+ | `chunking.maxLines` | Maximum lines per chunk | `100` |
153
+ | `chunking.overlap` | Overlapping lines between chunks for context continuity | `20` |
154
+ | `search.semanticWeight` | Weight for semantic (vector) similarity (0-1) | `0.7` |
155
+ | `search.keywordWeight` | Weight for BM25 keyword matching (0-1) | `0.3` |
156
+ | `dashboard.enabled` | Enable the web dashboard | `true` |
157
+ | `dashboard.port` | Port for the dashboard server | `24300` |
158
+ | `dashboard.openBrowser` | Auto-open browser when dashboard starts | `true` |
159
+ | `instructions` | Project-specific instructions returned by `get_project_instructions` | None |
160
+
161
+ #### Default Behavior
162
+
163
+ Without a `.glancey.json` file, glancey will:
164
+
165
+ - Index common source code files (TypeScript, JavaScript, Python, Go, Rust, Java, Ruby, PHP, C/C++, C#, Swift, Kotlin)
166
+ - Exclude build artifacts, dependencies, and generated files
167
+ - Use Gemini embeddings if `GEMINI_API_KEY` is set, otherwise use local Ollama with `qwen3-embedding:0.6b`
168
+ - Split code into 100-line chunks with 20-line overlap
169
+ - Use hybrid search with 70% semantic / 30% keyword weighting
170
+ - Start the dashboard on port 24300
171
+
172
+ #### Environment Variables
173
+
174
+ Set these environment variables to configure embedding backends:
175
+
176
+ | Variable | Description | Default |
177
+ |----------|-------------|---------|
178
+ | `GEMINI_API_KEY` | Google Gemini API key for cloud embeddings ([free tier available](https://aistudio.google.com/app/apikey)) | None |
179
+ | `OLLAMA_URL` | Custom Ollama server URL for local embeddings | `http://localhost:11434` |
180
+ | `GLANCEY_PROJECT` | Override the project path to index | Current working directory |
181
+
182
+ **Backend Selection Priority:**
183
+
184
+ 1. If `embedding.backend` is set in config, use that backend
185
+ 2. If `GEMINI_API_KEY` is set, use Gemini
186
+ 3. Fall back to Ollama (must be running locally)
187
+
188
+ ## Architecture
189
+
190
+ ```
191
+ ┌─────────────────────────────────────────────────────────────┐
192
+ │ MCP Server (index.ts) │
193
+ │ Exposes tools: index_codebase, search_code │
194
+ └─────────────────┬───────────────────────────────────────────┘
195
+
196
+ ┌─────────────────▼───────────────────────────────────────────┐
197
+ │ CodeIndexer (indexer.ts) │
198
+ │ - AST-aware chunking for supported languages │
199
+ │ - Incremental indexing (only re-index changed files) │
200
+ │ - Hybrid search (semantic + keyword scoring) │
201
+ └─────────────────┬───────────────────────────────────────────┘
202
+
203
+ ┌─────────────────▼───────────────────────────────────────────┐
204
+ │ Embedding Backends (embeddings/) │
205
+ │ Gemini │ Ollama (local) │
206
+ └─────────────────┬───────────────────────────────────────────┘
207
+
208
+ ┌─────────────────▼───────────────────────────────────────────┐
209
+ │ LanceDB Vector Store │
210
+ │ Stored in .glancey/ directory │
211
+ └─────────────────────────────────────────────────────────────┘
212
+ ```
213
+
214
+ ## Embedding Backend Setup
215
+
216
+ glancey automatically selects the best available backend (in priority order):
217
+
218
+ 1. **Google Gemini** (if `GEMINI_API_KEY` is set, free tier available)
219
+ ```bash
220
+ export GEMINI_API_KEY=AIza...
221
+ ```
222
+
223
+ 2. **Ollama** (recommended for most users - free, local, no rate limits)
224
+
225
+ ### Ollama Setup (Recommended)
226
+
227
+ Ollama provides free, local embeddings with no API rate limits. Perfect for indexing large codebases.
228
+
229
+ **Requirements:** Ollama 0.2.0 or newer (for batch embedding API)
230
+
231
+ 1. **Install Ollama** from [ollama.com](https://ollama.com)
232
+
233
+ 2. **Verify version** (must be 0.2.0+):
234
+ ```bash
235
+ ollama --version
236
+ ```
237
+
238
+ 3. **Pull the embedding model:**
239
+ ```bash
240
+ ollama pull qwen3-embedding:0.6b
241
+ ```
242
+
243
+ 4. **Verify it's working:**
244
+ ```bash
245
+ ollama run qwen3-embedding:0.6b "test"
246
+ ```
247
+
248
+ That's it! glancey will automatically use Ollama when no Gemini API key is set.
249
+
250
+ #### Model Options
251
+
252
+ | Model | Size | Quality | Best For |
253
+ |-------|------|---------|----------|
254
+ | `qwen3-embedding:0.6b` | 639MB | Good | Most users (default) |
255
+ | `qwen3-embedding:4b` | 2.5GB | Better | Users with 16GB+ RAM |
256
+ | `qwen3-embedding:8b` | 4.7GB | Best | Users with 32GB+ RAM |
257
+
258
+ To use a different model, add to your `.glancey.json`:
259
+ ```json
260
+ {
261
+ "embedding": {
262
+ "backend": "ollama",
263
+ "model": "qwen3-embedding:4b"
264
+ }
265
+ }
266
+ ```
267
+
268
+ See [Project Configuration](#project-configuration) for all configuration options including how to specify a backend.
269
+
270
+ ## Usage
271
+
272
+ Once installed, you'll have access to these tools:
273
+
274
+ ### `index_codebase`
275
+
276
+ Index your codebase for semantic search:
277
+
278
+ ```
279
+ > index_codebase
280
+ Indexed 150 files, created 800 chunks.
281
+ ```
282
+
283
+ With custom patterns:
284
+
285
+ ```
286
+ > index_codebase(patterns: ["**/*.py"], excludePatterns: ["**/tests/**"])
287
+ ```
288
+
289
+ ### `search_code`
290
+
291
+ Search using natural language:
292
+
293
+ ```
294
+ > search_code(query: "authentication middleware")
295
+
296
+ ## Result 1: src/middleware/auth.ts:1-50
297
+ ...
298
+ ```
299
+
300
+ ### `get_index_status`
301
+
302
+ Check index status:
303
+
304
+ ```
305
+ > get_index_status
306
+ {
307
+ "indexed": true,
308
+ "fileCount": 150,
309
+ "chunkCount": 800,
310
+ "lastUpdated": "2024-12-27T12:00:00Z"
311
+ }
312
+ ```
313
+
314
+ ### `clear_index`
315
+
316
+ Clear the index:
317
+
318
+ ```
319
+ > clear_index
320
+ Index cleared.
321
+ ```
322
+
323
+ ### `get_project_instructions`
324
+
325
+ Get project-specific instructions from the config:
326
+
327
+ ```
328
+ > get_project_instructions
329
+ Use semantic search for exploring this codebase. Always run tests before committing.
330
+ ```
331
+
332
+ ## Dashboard
333
+
334
+ glancey includes a web dashboard for monitoring index status and usage.
335
+
336
+ ### Accessing the Dashboard
337
+
338
+ The dashboard starts automatically when the MCP server runs and is available at:
339
+
340
+ ```
341
+ http://127.0.0.1:24300
342
+ ```
343
+
344
+ The browser opens automatically on startup (configurable).
345
+
346
+ ### Dashboard Features
347
+
348
+ - **Index Status**: Files indexed, chunks created, last updated time
349
+ - **Embedding Backend**: Current backend and index path
350
+ - **Configuration**: Project path, chunk settings, search weights
351
+ - **File Patterns**: Include/exclude patterns being used
352
+ - **Command Usage**: Real-time chart of MCP tool usage (using [charts.css](https://chartscss.org/))
353
+ - **Beads Integration**: Issue tracker status and ready tasks (if beads is configured)
354
+
355
+ ### Dashboard Configuration
356
+
357
+ Configure the dashboard via the `dashboard` options in `.glancey.json`. See [Configuration Options Reference](#configuration-options-reference) for details.
358
+
359
+ ## How It Works
360
+
361
+ 1. **Indexing**: Code files are chunked into ~100-line segments with overlap
362
+ 2. **Embedding**: Each chunk is converted to a vector using your chosen backend
363
+ 3. **Storage**: Vectors are stored in LanceDB (`.glancey/` directory)
364
+ 4. **Search**: Natural language queries are embedded and matched against stored vectors
365
+
366
+ ## Supported Languages
367
+
368
+ TypeScript, JavaScript, Python, Go, Rust, Java, Ruby, PHP, C/C++, C#, Swift, Kotlin, and more.
369
+
370
+ ## Troubleshooting
371
+
372
+ ### "No embedding backend available"
373
+
374
+ This error means no API keys are set and Ollama is not running/accessible.
375
+
376
+ **Solutions:**
377
+ 1. Set up Ollama (recommended):
378
+ ```bash
379
+ # Install from https://ollama.com, then:
380
+ ollama pull qwen3-embedding:0.6b
381
+ ```
382
+ 2. Or set a Gemini API key: `export GEMINI_API_KEY=AIza...`
383
+
384
+ ### "Embedding dimension mismatch"
385
+
386
+ This occurs when switching between embedding backends (e.g., from Gemini to Ollama). Each backend produces different vector dimensions.
387
+
388
+ **Solution:** Force a full reindex:
389
+ ```
390
+ > index_codebase(forceReindex: true)
391
+ ```
392
+
393
+ ### Slow Indexing
394
+
395
+ Large codebases may take time to index initially.
396
+
397
+ **Tips:**
398
+ 1. Use `excludePatterns` to skip unnecessary directories (tests, generated code)
399
+ 2. Ollama is faster for local use but requires more resources
400
+ 3. Subsequent runs use incremental indexing (only changed files)
401
+
402
+ ### Index Corruption
403
+
404
+ If you encounter strange search results or errors:
405
+
406
+ **Solution:** Clear and rebuild the index:
407
+ ```
408
+ > clear_index
409
+ > index_codebase
410
+ ```
411
+
412
+ Or manually delete the `.glancey/` directory and re-index.
413
+
414
+ ## License
415
+
416
+ MIT - See [LICENSE](LICENSE) for details.
417
+
418
+ ## Contributing
419
+
420
+ Contributions welcome! Please read our [Contributing Guide](CONTRIBUTING.md) before submitting PRs.
421
+
422
+ ## Related Projects
423
+
424
+ - [claude-context](https://github.com/zilliztech/claude-context) - Similar tool using Zilliz Cloud
425
+ - [Serena](https://github.com/oraios/serena) - Symbol-level code navigation
426
+
427
+ ## Credits
428
+
429
+ Built with:
430
+ - [LanceDB](https://lancedb.github.io/lancedb/) - Vector database
431
+ - [MCP SDK](https://github.com/modelcontextprotocol/sdk) - Model Context Protocol
432
+ - [Google AI Studio](https://aistudio.google.com/) - Gemini Embedding API
433
+
434
+ Inspired by:
435
+ - [Serena](https://github.com/oraios/serena) by [Oraios](https://github.com/oraios) - Symbol-level code navigation and editing
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ast-chunker.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast-chunker.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/ast-chunker.test.ts"],"names":[],"mappings":""}