@zvec/zvec-grep 0.1.5 โ†’ 0.1.7

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 (358) hide show
  1. package/README.md +154 -236
  2. package/README_CN.md +142 -233
  3. package/dist/authorization/index.d.ts +7 -0
  4. package/dist/authorization/index.js +7 -0
  5. package/dist/authorization/index.js.map +1 -0
  6. package/dist/authorization/manager.d.ts +8 -0
  7. package/dist/authorization/manager.js +19 -0
  8. package/dist/authorization/manager.js.map +1 -0
  9. package/dist/authorization/operation.d.ts +7 -0
  10. package/dist/authorization/operation.js +50 -0
  11. package/dist/authorization/operation.js.map +1 -0
  12. package/dist/authorization/planner.d.ts +21 -0
  13. package/dist/authorization/planner.js +97 -0
  14. package/dist/authorization/planner.js.map +1 -0
  15. package/dist/authorization/prompt.d.ts +11 -0
  16. package/dist/authorization/prompt.js +62 -0
  17. package/dist/authorization/prompt.js.map +1 -0
  18. package/dist/authorization/store.d.ts +20 -0
  19. package/dist/authorization/store.js +251 -0
  20. package/dist/authorization/store.js.map +1 -0
  21. package/dist/authorization/target.d.ts +15 -0
  22. package/dist/authorization/target.js +49 -0
  23. package/dist/authorization/target.js.map +1 -0
  24. package/dist/authorization/types.d.ts +61 -0
  25. package/dist/authorization/types.js +2 -0
  26. package/dist/authorization/types.js.map +1 -0
  27. package/dist/cli/args.d.ts +1 -1
  28. package/dist/cli/args.js +338 -55
  29. package/dist/cli/args.js.map +1 -1
  30. package/dist/cli/auth.d.ts +21 -0
  31. package/dist/cli/auth.js +209 -0
  32. package/dist/cli/auth.js.map +1 -0
  33. package/dist/cli/commands.js +469 -625
  34. package/dist/cli/commands.js.map +1 -1
  35. package/dist/cli/errors.js +2 -2
  36. package/dist/cli/errors.js.map +1 -1
  37. package/dist/cli/format/context.d.ts +4 -0
  38. package/dist/cli/format/context.js +311 -44
  39. package/dist/cli/format/context.js.map +1 -1
  40. package/dist/cli/format/debug.js +12 -6
  41. package/dist/cli/format/debug.js.map +1 -1
  42. package/dist/cli/format/progress.d.ts +4 -0
  43. package/dist/cli/format/progress.js +219 -46
  44. package/dist/cli/format/progress.js.map +1 -1
  45. package/dist/cli/format/status.d.ts +79 -6
  46. package/dist/cli/format/status.js +341 -111
  47. package/dist/cli/format/status.js.map +1 -1
  48. package/dist/cli/help.js +395 -63
  49. package/dist/cli/help.js.map +1 -1
  50. package/dist/cli/index.d.ts +1 -1
  51. package/dist/cli/index.js +1 -1
  52. package/dist/cli/install.d.ts +4 -0
  53. package/dist/cli/install.js +963 -0
  54. package/dist/cli/install.js.map +1 -0
  55. package/dist/cli/managed-rg.d.ts +10 -0
  56. package/dist/cli/managed-rg.js +329 -0
  57. package/dist/cli/managed-rg.js.map +1 -0
  58. package/dist/cli/server-search.d.ts +3 -0
  59. package/dist/cli/server-search.js +12 -0
  60. package/dist/cli/server-search.js.map +1 -0
  61. package/dist/cli/types.d.ts +23 -6
  62. package/dist/cli/types.js.map +1 -1
  63. package/dist/client/daemon-client.d.ts +31 -0
  64. package/dist/client/daemon-client.js +203 -0
  65. package/dist/client/daemon-client.js.map +1 -0
  66. package/dist/client/mode-router.d.ts +9 -0
  67. package/dist/client/mode-router.js +28 -0
  68. package/dist/client/mode-router.js.map +1 -0
  69. package/dist/client/search-policy.d.ts +11 -0
  70. package/dist/client/search-policy.js +15 -0
  71. package/dist/client/search-policy.js.map +1 -0
  72. package/dist/daemon/backend.d.ts +77 -0
  73. package/dist/daemon/backend.js +1087 -0
  74. package/dist/daemon/backend.js.map +1 -0
  75. package/dist/daemon/change-set.d.ts +25 -0
  76. package/dist/daemon/change-set.js +101 -0
  77. package/dist/daemon/change-set.js.map +1 -0
  78. package/dist/daemon/config.d.ts +24 -0
  79. package/dist/daemon/config.js +88 -0
  80. package/dist/daemon/config.js.map +1 -0
  81. package/dist/daemon/errors.d.ts +5 -0
  82. package/dist/daemon/errors.js +11 -0
  83. package/dist/daemon/errors.js.map +1 -0
  84. package/dist/daemon/http-server.d.ts +30 -0
  85. package/dist/daemon/http-server.js +288 -0
  86. package/dist/daemon/http-server.js.map +1 -0
  87. package/dist/daemon/index-coordinator.d.ts +24 -0
  88. package/dist/daemon/index-coordinator.js +68 -0
  89. package/dist/daemon/index-coordinator.js.map +1 -0
  90. package/dist/daemon/job-scheduler.d.ts +70 -0
  91. package/dist/daemon/job-scheduler.js +366 -0
  92. package/dist/daemon/job-scheduler.js.map +1 -0
  93. package/dist/daemon/logger.d.ts +9 -0
  94. package/dist/daemon/logger.js +53 -0
  95. package/dist/daemon/logger.js.map +1 -0
  96. package/dist/daemon/model-pool.d.ts +45 -0
  97. package/dist/daemon/model-pool.js +187 -0
  98. package/dist/daemon/model-pool.js.map +1 -0
  99. package/dist/daemon/root-lease.d.ts +14 -0
  100. package/dist/daemon/root-lease.js +188 -0
  101. package/dist/daemon/root-lease.js.map +1 -0
  102. package/dist/daemon/root-runtime.d.ts +78 -0
  103. package/dist/daemon/root-runtime.js +333 -0
  104. package/dist/daemon/root-runtime.js.map +1 -0
  105. package/dist/daemon/runtime-manager.d.ts +46 -0
  106. package/dist/daemon/runtime-manager.js +246 -0
  107. package/dist/daemon/runtime-manager.js.map +1 -0
  108. package/dist/daemon/runtime.d.ts +12 -0
  109. package/dist/daemon/runtime.js +102 -0
  110. package/dist/daemon/runtime.js.map +1 -0
  111. package/dist/daemon/server-controller.d.ts +39 -0
  112. package/dist/daemon/server-controller.js +254 -0
  113. package/dist/daemon/server-controller.js.map +1 -0
  114. package/dist/daemon/watch-manager.d.ts +50 -0
  115. package/dist/daemon/watch-manager.js +293 -0
  116. package/dist/daemon/watch-manager.js.map +1 -0
  117. package/dist/daemon/workspace-read-session-cache.d.ts +31 -0
  118. package/dist/daemon/workspace-read-session-cache.js +115 -0
  119. package/dist/daemon/workspace-read-session-cache.js.map +1 -0
  120. package/dist/engine/code-formats.d.ts +3 -0
  121. package/dist/engine/code-formats.js +14 -0
  122. package/dist/engine/code-formats.js.map +1 -0
  123. package/dist/engine/config.d.ts +30 -8
  124. package/dist/engine/config.js +171 -45
  125. package/dist/engine/config.js.map +1 -1
  126. package/dist/engine/{errors/index.d.ts โ†’ errors.d.ts} +6 -1
  127. package/dist/engine/{errors/details.js โ†’ errors.js} +17 -4
  128. package/dist/engine/errors.js.map +1 -0
  129. package/dist/engine/extraction/code/adapter.d.ts +1 -1
  130. package/dist/engine/extraction/code/adapter.js +1 -1
  131. package/dist/engine/extraction/code/adapter.js.map +1 -1
  132. package/dist/engine/extraction/code/extractor.d.ts +5 -11
  133. package/dist/engine/extraction/code/extractor.js +116 -48
  134. package/dist/engine/extraction/code/extractor.js.map +1 -1
  135. package/dist/engine/extraction/code/families/c-family.js +1 -1
  136. package/dist/engine/extraction/code/families/c-family.js.map +1 -1
  137. package/dist/engine/extraction/code/families/js-ts.d.ts +1 -1
  138. package/dist/engine/extraction/code/families/metadata.d.ts +1 -1
  139. package/dist/engine/extraction/code/tree-sitter/grammar.js.map +1 -0
  140. package/dist/engine/extraction/code/tree-sitter/nodes.js.map +1 -0
  141. package/dist/engine/extraction/code/tree-sitter/parser.js.map +1 -0
  142. package/dist/engine/extraction/image/extractor.d.ts +5 -0
  143. package/dist/engine/extraction/image/extractor.js +35 -0
  144. package/dist/engine/extraction/image/extractor.js.map +1 -0
  145. package/dist/engine/extraction/index.d.ts +4 -44
  146. package/dist/engine/extraction/index.js +2 -280
  147. package/dist/engine/extraction/index.js.map +1 -1
  148. package/dist/engine/extraction/markdown/extractor.d.ts +5 -11
  149. package/dist/engine/extraction/markdown/extractor.js +38 -17
  150. package/dist/engine/extraction/markdown/extractor.js.map +1 -1
  151. package/dist/engine/extraction/runtime.d.ts +4 -0
  152. package/dist/engine/extraction/runtime.js +26 -0
  153. package/dist/engine/extraction/runtime.js.map +1 -0
  154. package/dist/engine/extraction/source.d.ts +18 -0
  155. package/dist/engine/extraction/source.js +22 -0
  156. package/dist/engine/extraction/source.js.map +1 -0
  157. package/dist/engine/extraction/text/extractor.d.ts +7 -0
  158. package/dist/engine/extraction/text/extractor.js +168 -0
  159. package/dist/engine/extraction/text/extractor.js.map +1 -0
  160. package/dist/engine/extraction/types.d.ts +4 -0
  161. package/dist/engine/{models โ†’ extraction}/types.js.map +1 -1
  162. package/dist/engine/extraction/vector-content.d.ts +5 -0
  163. package/dist/engine/extraction/vector-content.js +95 -0
  164. package/dist/engine/extraction/vector-content.js.map +1 -0
  165. package/dist/engine/file-size-policy.d.ts +6 -0
  166. package/dist/engine/file-size-policy.js +20 -0
  167. package/dist/engine/file-size-policy.js.map +1 -0
  168. package/dist/engine/file-type.d.ts +15 -0
  169. package/dist/engine/file-type.js +152 -0
  170. package/dist/engine/file-type.js.map +1 -0
  171. package/dist/engine/index-status.d.ts +9 -0
  172. package/dist/engine/index-status.js +38 -0
  173. package/dist/engine/index-status.js.map +1 -0
  174. package/dist/engine/manifest.d.ts +13 -0
  175. package/dist/engine/manifest.js +124 -0
  176. package/dist/engine/manifest.js.map +1 -0
  177. package/dist/engine/models/{providers/llama-cpp/embedding.d.ts โ†’ backends/llama-cpp.d.ts} +25 -20
  178. package/dist/engine/models/{providers/llama-cpp/embedding.js โ†’ backends/llama-cpp.js} +127 -106
  179. package/dist/engine/models/backends/llama-cpp.js.map +1 -0
  180. package/dist/engine/models/backends/model2vec-runtime.d.ts +63 -0
  181. package/dist/engine/models/backends/model2vec-runtime.js +112 -0
  182. package/dist/engine/models/backends/model2vec-runtime.js.map +1 -0
  183. package/dist/engine/models/backends/model2vec-tokenizer.d.ts +2 -0
  184. package/dist/engine/models/backends/model2vec-tokenizer.js +42 -0
  185. package/dist/engine/models/backends/model2vec-tokenizer.js.map +1 -0
  186. package/dist/engine/models/backends/model2vec-worker-pool.d.ts +25 -0
  187. package/dist/engine/models/backends/model2vec-worker-pool.js +264 -0
  188. package/dist/engine/models/backends/model2vec-worker-pool.js.map +1 -0
  189. package/dist/engine/models/backends/model2vec-worker.d.ts +1 -0
  190. package/dist/engine/models/backends/model2vec-worker.js +41 -0
  191. package/dist/engine/models/backends/model2vec-worker.js.map +1 -0
  192. package/dist/engine/models/backends/model2vec.d.ts +40 -0
  193. package/dist/engine/models/backends/model2vec.js +311 -0
  194. package/dist/engine/models/backends/model2vec.js.map +1 -0
  195. package/dist/engine/models/backends/qwen.d.ts +44 -0
  196. package/dist/engine/models/{providers/qwen/embedding.js โ†’ backends/qwen.js} +155 -94
  197. package/dist/engine/models/backends/qwen.js.map +1 -0
  198. package/dist/engine/models/backends/transformers-js.d.ts +87 -0
  199. package/dist/engine/models/backends/transformers-js.js +316 -0
  200. package/dist/engine/models/backends/transformers-js.js.map +1 -0
  201. package/dist/engine/models/catalog.d.ts +207 -23
  202. package/dist/engine/models/catalog.js +191 -25
  203. package/dist/engine/models/catalog.js.map +1 -1
  204. package/dist/engine/models/download-progress.d.ts +15 -0
  205. package/dist/engine/models/download-progress.js +48 -0
  206. package/dist/engine/models/download-progress.js.map +1 -0
  207. package/dist/engine/models/embeddings.d.ts +59 -18
  208. package/dist/engine/models/embeddings.js +52 -28
  209. package/dist/engine/models/embeddings.js.map +1 -1
  210. package/dist/engine/models/factory.d.ts +2 -5
  211. package/dist/engine/models/factory.js +41 -56
  212. package/dist/engine/models/factory.js.map +1 -1
  213. package/dist/engine/models/index.d.ts +4 -6
  214. package/dist/engine/models/index.js +4 -4
  215. package/dist/engine/models/index.js.map +1 -1
  216. package/dist/engine/models/ranking.d.ts +7 -3
  217. package/dist/engine/models/resolution.d.ts +8 -0
  218. package/dist/engine/models/resolution.js +22 -0
  219. package/dist/engine/models/resolution.js.map +1 -0
  220. package/dist/engine/pipeline/indexing/index.d.ts +9 -7
  221. package/dist/engine/pipeline/indexing/index.js +409 -165
  222. package/dist/engine/pipeline/indexing/index.js.map +1 -1
  223. package/dist/engine/pipeline/indexing/input-budget.d.ts +2 -0
  224. package/dist/engine/pipeline/indexing/input-budget.js +51 -0
  225. package/dist/engine/pipeline/indexing/input-budget.js.map +1 -0
  226. package/dist/engine/pipeline/indexing/root-paths.js +6 -6
  227. package/dist/engine/pipeline/indexing/root-paths.js.map +1 -1
  228. package/dist/engine/pipeline/indexing/scanner/index.d.ts +9 -2
  229. package/dist/engine/pipeline/indexing/scanner/index.js +291 -35
  230. package/dist/engine/pipeline/indexing/scanner/index.js.map +1 -1
  231. package/dist/engine/pipeline/search/index.d.ts +6 -6
  232. package/dist/engine/pipeline/search/index.js +8 -10
  233. package/dist/engine/pipeline/search/index.js.map +1 -1
  234. package/dist/engine/service/index.d.ts +3 -2
  235. package/dist/engine/service/index.js +1 -1
  236. package/dist/engine/service/index.js.map +1 -1
  237. package/dist/engine/service/root.d.ts +10 -12
  238. package/dist/engine/service/root.js +29 -25
  239. package/dist/engine/service/root.js.map +1 -1
  240. package/dist/engine/service/structure-enrichment.d.ts +1 -1
  241. package/dist/engine/service/structure-enrichment.js +20 -22
  242. package/dist/engine/service/structure-enrichment.js.map +1 -1
  243. package/dist/engine/service/types.d.ts +40 -38
  244. package/dist/engine/service/workspace-index.d.ts +26 -0
  245. package/dist/engine/service/workspace-index.js +157 -0
  246. package/dist/engine/service/workspace-index.js.map +1 -0
  247. package/dist/engine/service/zvec-grep.d.ts +12 -1
  248. package/dist/engine/service/zvec-grep.js +698 -489
  249. package/dist/engine/service/zvec-grep.js.map +1 -1
  250. package/dist/engine/storage/index.d.ts +30 -20
  251. package/dist/engine/storage/index.js +2 -1
  252. package/dist/engine/storage/index.js.map +1 -1
  253. package/dist/engine/storage/layout.d.ts +10 -0
  254. package/dist/engine/storage/layout.js +29 -0
  255. package/dist/engine/storage/layout.js.map +1 -0
  256. package/dist/engine/storage/zvec.d.ts +4 -67
  257. package/dist/engine/storage/zvec.js +115 -85
  258. package/dist/engine/storage/zvec.js.map +1 -1
  259. package/dist/engine/types.d.ts +29 -23
  260. package/dist/engine/types.js +1 -1
  261. package/dist/engine/types.js.map +1 -1
  262. package/dist/engine/utils/daemon-lease.d.ts +17 -0
  263. package/dist/engine/utils/daemon-lease.js +175 -0
  264. package/dist/engine/utils/daemon-lease.js.map +1 -0
  265. package/dist/engine/utils/file-selection.js +38 -1
  266. package/dist/engine/utils/file-selection.js.map +1 -1
  267. package/dist/engine/utils/lock.js +1 -1
  268. package/dist/engine/utils/lock.js.map +1 -1
  269. package/dist/index-progress.d.ts +10 -0
  270. package/dist/index-progress.js +159 -0
  271. package/dist/index-progress.js.map +1 -0
  272. package/dist/index.d.ts +4 -4
  273. package/dist/index.js +1 -1
  274. package/dist/index.js.map +1 -1
  275. package/dist/mcp/http-transport.d.ts +27 -0
  276. package/dist/mcp/http-transport.js +182 -0
  277. package/dist/mcp/http-transport.js.map +1 -0
  278. package/dist/mcp/input-normalization.d.ts +38 -0
  279. package/dist/mcp/input-normalization.js +104 -0
  280. package/dist/mcp/input-normalization.js.map +1 -0
  281. package/dist/mcp/progress-heartbeat.d.ts +17 -0
  282. package/dist/mcp/progress-heartbeat.js +46 -0
  283. package/dist/mcp/progress-heartbeat.js.map +1 -0
  284. package/dist/mcp/request-metadata.d.ts +2 -0
  285. package/dist/mcp/request-metadata.js +11 -0
  286. package/dist/mcp/request-metadata.js.map +1 -0
  287. package/dist/mcp/request-state.d.ts +40 -0
  288. package/dist/mcp/request-state.js +210 -0
  289. package/dist/mcp/request-state.js.map +1 -0
  290. package/dist/mcp/result-format.d.ts +13 -0
  291. package/dist/mcp/result-format.js +75 -0
  292. package/dist/mcp/result-format.js.map +1 -0
  293. package/dist/mcp/schemas.d.ts +672 -0
  294. package/dist/mcp/schemas.js +506 -0
  295. package/dist/mcp/schemas.js.map +1 -0
  296. package/dist/mcp/stdio-bridge.d.ts +9 -0
  297. package/dist/mcp/stdio-bridge.js +131 -0
  298. package/dist/mcp/stdio-bridge.js.map +1 -0
  299. package/dist/mcp/tools.d.ts +153 -0
  300. package/dist/mcp/tools.js +482 -0
  301. package/dist/mcp/tools.js.map +1 -0
  302. package/dist/mcp/toolset.d.ts +5 -0
  303. package/dist/mcp/toolset.js +12 -0
  304. package/dist/mcp/toolset.js.map +1 -0
  305. package/dist/observability/trace-context.d.ts +11 -0
  306. package/dist/observability/trace-context.js +138 -0
  307. package/dist/observability/trace-context.js.map +1 -0
  308. package/dist/prompts/zvec-grep-guidance.d.ts +2 -0
  309. package/dist/prompts/zvec-grep-guidance.js +9 -0
  310. package/dist/prompts/zvec-grep-guidance.js.map +1 -0
  311. package/docs/01-agents.md +132 -0
  312. package/docs/02-cli.md +239 -0
  313. package/docs/03-mcp.md +185 -0
  314. package/docs/04-pipeline.md +226 -0
  315. package/docs/05-architecture.md +86 -0
  316. package/docs/06-server.md +215 -0
  317. package/docs/07-embedding.md +182 -0
  318. package/docs/08-roadmap.md +85 -0
  319. package/docs/README.md +53 -0
  320. package/package.json +20 -11
  321. package/dist/cli/mcp.d.ts +0 -2
  322. package/dist/cli/mcp.js +0 -354
  323. package/dist/cli/mcp.js.map +0 -1
  324. package/dist/engine/collection/index.d.ts +0 -55
  325. package/dist/engine/collection/index.js +0 -710
  326. package/dist/engine/collection/index.js.map +0 -1
  327. package/dist/engine/errors/details.d.ts +0 -6
  328. package/dist/engine/errors/details.js.map +0 -1
  329. package/dist/engine/errors/index.js +0 -16
  330. package/dist/engine/errors/index.js.map +0 -1
  331. package/dist/engine/extraction/tree-sitter/grammar.js.map +0 -1
  332. package/dist/engine/extraction/tree-sitter/nodes.js.map +0 -1
  333. package/dist/engine/extraction/tree-sitter/parser.js.map +0 -1
  334. package/dist/engine/files/file-type.d.ts +0 -5
  335. package/dist/engine/files/file-type.js +0 -119
  336. package/dist/engine/files/file-type.js.map +0 -1
  337. package/dist/engine/models/providers/index.d.ts +0 -2
  338. package/dist/engine/models/providers/index.js +0 -3
  339. package/dist/engine/models/providers/index.js.map +0 -1
  340. package/dist/engine/models/providers/llama-cpp/embedding.js.map +0 -1
  341. package/dist/engine/models/providers/llama-cpp/index.d.ts +0 -1
  342. package/dist/engine/models/providers/llama-cpp/index.js +0 -2
  343. package/dist/engine/models/providers/llama-cpp/index.js.map +0 -1
  344. package/dist/engine/models/providers/qwen/embedding.d.ts +0 -42
  345. package/dist/engine/models/providers/qwen/embedding.js.map +0 -1
  346. package/dist/engine/models/providers/qwen/index.d.ts +0 -1
  347. package/dist/engine/models/providers/qwen/index.js +0 -2
  348. package/dist/engine/models/providers/qwen/index.js.map +0 -1
  349. package/dist/engine/models/types.d.ts +0 -30
  350. package/skills/zvec-grep/SKILL.md +0 -151
  351. package/skills/zvec-grep/agents/openai.yaml +0 -4
  352. /package/dist/engine/extraction/{tree-sitter โ†’ code/tree-sitter}/grammar.d.ts +0 -0
  353. /package/dist/engine/extraction/{tree-sitter โ†’ code/tree-sitter}/grammar.js +0 -0
  354. /package/dist/engine/extraction/{tree-sitter โ†’ code/tree-sitter}/nodes.d.ts +0 -0
  355. /package/dist/engine/extraction/{tree-sitter โ†’ code/tree-sitter}/nodes.js +0 -0
  356. /package/dist/engine/extraction/{tree-sitter โ†’ code/tree-sitter}/parser.d.ts +0 -0
  357. /package/dist/engine/extraction/{tree-sitter โ†’ code/tree-sitter}/parser.js +0 -0
  358. /package/dist/engine/{models โ†’ extraction}/types.js +0 -0
package/README.md CHANGED
@@ -3,305 +3,223 @@
3
3
  </p>
4
4
 
5
5
  <div align="center">
6
+ <p>
7
+ <a href="./docs/08-roadmap.md"><img src="https://img.shields.io/badge/status-work%20in%20progress-F59E0B?style=for-the-badge" alt="Work in progress" /></a>
8
+ </p>
6
9
  <picture>
7
- <source media="(prefers-color-scheme: dark)" srcset="https://zvec.oss-cn-hongkong.aliyuncs.com/logo/github_log_2.svg" />
8
- <img src="https://zvec.oss-cn-hongkong.aliyuncs.com/logo/github_logo_1.svg" width="400" alt="zvec logo" />
10
+ <source media="(prefers-color-scheme: dark)" srcset="./.github/assets/zg-logo-dark.svg">
11
+ <img src="./.github/assets/zg-logo.svg" width="150" alt="zg logo" />
9
12
  </picture>
13
+ <p><strong>Know the wordsโ€”or donโ€™t. Just zg.</strong></p>
14
+ <p>The local-first search layer for humans and agents.</p>
15
+
16
+ <p>
17
+ <a href="https://www.npmjs.com/package/@zvec/zvec-grep"><img src="https://img.shields.io/npm/v/@zvec/zvec-grep.svg" alt="npm version" /></a>
18
+ <a href="https://github.com/zvec-ai/zvec-grep/actions/workflows/ci.yml"><img src="https://github.com/zvec-ai/zvec-grep/actions/workflows/ci.yml/badge.svg" alt="CI" /></a>
19
+ <a href="./LICENSE"><img src="https://img.shields.io/badge/license-Apache%202.0-blue.svg" alt="Apache 2.0 license" /></a>
20
+ <img src="https://img.shields.io/badge/node-%3E%3D22-blue.svg" alt="Node.js 22 or newer" />
21
+ </p>
22
+
23
+ <p>
24
+ <a href="#tour">๐ŸŽฌ <strong>Tour</strong></a> |
25
+ <a href="#features">๐Ÿ’ซ <strong>Features</strong></a> |
26
+ <a href="#try-it-yourself">๐Ÿš€ <strong>Try it yourself</strong></a> |
27
+ <a href="./docs/README.md">๐Ÿ“š <strong>Docs</strong></a> |
28
+ <a href="#benchmarks">๐Ÿ“Š <strong>Benchmarks</strong></a> |
29
+ <a href="#community">๐Ÿค <strong>Community</strong></a>
30
+ </p>
10
31
  </div>
11
32
 
12
- <p align="center">
13
- <a href="https://www.npmjs.com/package/@zvec/zvec-grep"><img src="https://img.shields.io/npm/v/@zvec/zvec-grep.svg" alt="npm Release"/></a>
14
- <a href="https://github.com/zvec-ai/zvec-grep/actions/workflows/ci.yml"><img src="https://github.com/zvec-ai/zvec-grep/actions/workflows/ci.yml/badge.svg" alt="CI"/></a>
15
- <a href="./LICENSE"><img src="https://img.shields.io/badge/license-Apache%202.0-blue.svg" alt="License"/></a>
16
- <img src="https://img.shields.io/badge/node-%3E%3D22-blue.svg" alt="Node.js >=22"/>
17
- <img src="https://img.shields.io/badge/CLI-zg-2ea44f.svg" alt="zg CLI"/>
18
- </p>
19
-
20
- <p align="center">
21
- <a href="#quickstart">๐Ÿš€ <strong>Quickstart</strong></a> |
22
- <a href="#features">๐Ÿ’ซ <strong>Features</strong></a> |
23
- <a href="#installation">๐Ÿ“ฆ <strong>Installation</strong></a> |
24
- <a href="#models">๐Ÿง  <strong>Models</strong></a> |
25
- <a href="#library-api">๐Ÿ› ๏ธ <strong>Library API</strong></a>
26
- </p>
27
-
28
- **zvec-grep** is an agent-friendly hybrid code search tool built on Zvec. It gives repositories a root-local semantic index, combines vector search with full-text search, and keeps CLI output compact enough for AI agents while still offering rich terminal output for humans.
29
-
30
- The command is intentionally short:
31
-
32
- ```bash
33
- zg query "where query auto update happens"
34
- ```
35
-
36
- > [!IMPORTANT]
37
- > **Command interface**
38
- >
39
- > - **Hybrid Code Search**: Query code with natural language, exact terms, or both in one command.
40
- > - **Explicit Index Lifecycle**: New repositories require `zg index --embedding <model>`; agents do not silently create indexes.
41
- > - **Automatic Refresh**: Existing anonymous indexes are checked and incrementally updated before normal queries.
42
- > - **Token-Efficient Output**: Agent output defaults to `--preview none`; `--human` defaults to full source previews.
43
- > - **No-Index Lexical Search**: `zg query --rg` provides managed ripgrep search without requiring an index.
44
-
45
- ## <a id="features"></a>๐Ÿ’ซ Features
46
-
47
- - **Semantic + Lexical Retrieval**: Blend vector search and full-text search for code, docs, tests, scripts, and configuration.
48
- - **Root-Local Indexes**: Anonymous indexes live under `<repo>/.zvec-grep/`, so repository state stays with the repository.
49
- - **Agent-Ready Output**: Default output is grouped by file and keeps previews small to save tokens.
50
- - **Human Output Mode**: Add `--human` for a terminal-friendly summary with full previews by default.
51
- - **Managed ripgrep Route**: `zg query --rg` supports common `rg` flags and works even before a repository is indexed.
52
- - **Explicit Model Choice**: The first index build requires a model such as `local/embeddinggemma-300m`, `local/qwen3-embedding-0.6b`, or `qwen/text-embedding-v4`.
53
- - **Schema Reuse**: Re-running `zg index` on an existing index reuses the stored embedding schema unless you explicitly change it.
54
- - **MCP Server**: Run `zg serve --mcp` to expose indexed and no-index lexical search tools to MCP clients. Indexing and status remain CLI-only operations.
55
- - **Library API**: Use `createZvecGrep()` directly from Node.js tools, agents, or MCP servers.
56
-
57
- ## <a id="installation"></a>๐Ÿ“ฆ Installation
58
-
59
- Install the CLI from npm:
60
-
61
- ```bash
62
- npm install -g @zvec/zvec-grep
63
- zg version
64
- ```
65
-
66
- Or run it without a global install:
67
-
68
- ```bash
69
- npx @zvec/zvec-grep help
70
- ```
71
-
72
- Install the latest source checkout as a global `zg` command:
73
-
74
- ```bash
75
- git clone https://github.com/zvec-ai/zvec-grep.git
76
- cd zvec-grep
77
- npm ci
78
- npm run build
79
- npm install -g .
80
- zg version
81
- ```
82
-
83
- Run the stdio MCP server:
84
-
85
- ```bash
86
- zg serve --mcp
87
- ```
88
-
89
- Install the Codex MCP integration:
90
-
91
- ```bash
92
- zg install --target codex --yes
93
- ```
94
-
95
- Codex MCP tool calls default to a 600-second timeout. Override it during installation with `--mcp-tool-timeout <seconds>`.
33
+ **zg** (**z**vec-**g**rep) unifies ripgrep, BM25, and vector search behind
34
+ [one local-first interface](./docs/05-architecture.md). Use it directly from the
35
+ terminal, or let your agent use it for you.
96
36
 
97
- ### โœ… Requirements
37
+ <a id="tour"></a>
98
38
 
99
- - Node.js 22 or newer
100
- - macOS, Linux, or Windows
101
- - A supported embedding model for indexed search
39
+ ## ๐ŸŽฌ See it in action
102
40
 
103
- `zg query --rg` works without any embedding model or index.
41
+ <div align="center">
42
+ <img src="./.github/assets/zvec-grep-tour.gif" width="1000" alt="Install the agent integration, index a workspace, and let the agent search it with zvec-grep" />
43
+ </div>
104
44
 
105
- ## <a id="quickstart"></a>โšก Quickstart
45
+ Install the integration once, index the workspace, then search from the terminal
46
+ or ask your agent naturally.
106
47
 
107
- Index a repository with an explicit embedding model:
48
+ <a id="features"></a>
108
49
 
109
- ```bash
110
- zg index \
111
- --embedding local/embeddinggemma-300m \
112
- -g "src/**" \
113
- -g "docs/**" \
114
- -g "test/**" \
115
- -g "!dist/**" \
116
- -g "!node_modules/**" \
117
- -g "!coverage/**"
118
- ```
50
+ ## ๐Ÿ’ซ Why zg?
119
51
 
120
- Check index state:
52
+ - **Ready for humans and agents** โ€” install once, index once, then use the same
53
+ workspace from the CLI or your agent on macOS, Linux, and Windows.
54
+ - **Search beyond keywords** โ€” discover by meaning, rank by relevance, then
55
+ verify with exact text or regex when needed.
56
+ - **Multi-format search** โ€” search source code, documents, and structured data
57
+ while preserving useful structure and source locations.
58
+ - **Less searching, less context** โ€” ranked, source-linked results surface the
59
+ right evidence with fewer tool calls, fewer tokens, and less noise.
60
+ - **Local by default** โ€” files, indexes, and local models stay on your machine;
61
+ remote embeddings receive data only with your permission.
121
62
 
122
- ```bash
123
- zg status
124
- ```
63
+ <a id="try-it-yourself"></a>
125
64
 
126
- Search with natural language:
65
+ ## ๐Ÿš€ Try it yourself
127
66
 
128
- ```bash
129
- zg query "where query auto update happens"
130
- ```
67
+ Requires Node.js 22 or newer and a configured
68
+ [OpenCode](https://opencode.ai/) installation. The agent example explicitly
69
+ selects a free model, so it does not depend on your default provider.
131
70
 
132
- Combine semantic intent with exact anchors:
71
+ ### 1. Set up a sample bookshelf
133
72
 
134
73
  ```bash
135
- zg query "GPU fallback" --fts "usingCpuFallback" -g "src/**" -t ts --limit 5
136
- ```
74
+ npm install -g @zvec/zvec-grep
75
+ zg install --target opencode --yes
137
76
 
138
- Use exhaustive lexical search without an index:
77
+ mkdir zg-mystery && cd zg-mystery
78
+ curl -L https://www.gutenberg.org/files/11/11-0.txt -o alice-in-wonderland.txt
79
+ curl -L https://www.gutenberg.org/files/345/345-0.txt -o dracula.txt
80
+ curl -L https://www.gutenberg.org/files/84/84-0.txt -o frankenstein.txt
81
+ curl -L https://www.gutenberg.org/files/834/834-0.txt -o sherlock-holmes.txt
139
82
 
140
- ```bash
141
- zg query --rg -F "ZVEC_GREP_HOME" src
83
+ zg index --embedding local/potion-retrieval-32m
142
84
  ```
143
85
 
144
- Switch to human-readable output:
86
+ This creates a small bookshelf of four public-domain novels and indexes it
87
+ locally with Potion Retrieval.
145
88
 
146
- ```bash
147
- zg query --human "root local index discovery" --limit 3
148
- ```
89
+ Installation starts the shared daemon immediately. The default MCP transport is
90
+ stdio: the agent runs `zg server --stdio`, which safely starts or reuses it
91
+ again after a reboot. Advanced users can keep direct HTTP configuration with
92
+ `zg install --mcp-transport http` and `zg server on`.
149
93
 
150
- Use from an MCP client with `zvec_grep_search` and `zvec_grep_rg`. MCP inputs use JSON-friendly fields such as `include: ["src/**"]`; use the CLI for `zg status` and `zg index`. The Codex installer writes managed zvec-grep blocks to `${CODEX_HOME:-$HOME/.codex}/config.toml` and `${CODEX_HOME:-$HOME/.codex}/AGENTS.md`.
94
+ Use `zg install --mcp-toolset full` when the installed MCP integration should
95
+ also expose managed rg, index, and status tools. The default is `agent`.
151
96
 
152
- ## <a id="models"></a>๐Ÿง  Models
97
+ ### 2. Choose how to search
153
98
 
154
- Local models run through `node-llama-cpp` and keep code search private to your machine:
99
+ #### For agents: ask with OpenCode
155
100
 
156
101
  ```bash
157
- zg index --embedding local/embeddinggemma-300m
158
- zg index --embedding local/qwen3-embedding-0.6b
102
+ opencode run --model opencode/deepseek-v4-flash-free \
103
+ "An unseen creature left a few marks. What did the detective infer? Cite local evidence."
159
104
  ```
160
105
 
161
- On Apple Silicon, local builds use quiet llama.cpp CMake defaults to avoid harmless OpenMP and ARM native-detection warnings. Override any llama.cpp CMake option with `NODE_LLAMA_CPP_CMAKE_OPTION_<name>`, for example `NODE_LLAMA_CPP_CMAKE_OPTION_GGML_NATIVE=ON` to opt back into native CPU tuning.
106
+ OpenCode chooses zg on its ownโ€”the prompt does not name a tool. Query rewrites
107
+ may vary by model, but a typical run looks like this:
162
108
 
163
- Remote Qwen embeddings are useful when you prefer a managed embedding service or want to avoid local model setup:
109
+ ```text
110
+ โš™ zvec_grep_zvec_grep_search {"root":".../zg-mystery","query":"An unseen creature left a few marks. What did the detective infer?","fts":["marks","unseen creature","inferred","detective"],"fuse":true}
111
+ โ†’ Read sherlock-holmes.txt [offset=5440, limit=120]
164
112
 
165
- ```bash
166
- zg index \
167
- --embedding qwen/text-embedding-v4 \
168
- --api-key "$DASHSCOPE_API_KEY"
169
- ```
170
-
171
- After a successful index, explicitly passed global model and provider options are saved to `~/.zvec-grep/config.json` with user-only permissions. This lets an already-running `zg` MCP server load a newly configured remote API key on its next model request without restarting Codex. Values read only from environment variables are not persisted.
172
-
173
- ```json
174
- {
175
- "version": 1,
176
- "defaults": {
177
- "embedding": "qwen/text-embedding-v4"
178
- },
179
- "providers": {
180
- "qwen": {
181
- "apiKey": "...",
182
- "endpoint": "https://dashscope.aliyuncs.com/compatible-mode/v1/embeddings"
183
- }
184
- }
185
- }
186
- ```
113
+ Answer:
114
+ The detective is Sherlock Holmes in *The Adventure of the Crooked Man*.
115
+ From the animal's foot-marks, he inferred:
187
116
 
188
- Resolution order is explicit CLI or library options, then environment variables, then global config, then built-in defaults. Repository roots and file-selection settings remain in each repository's `.zvec-grep` metadata rather than global config.
117
+ - It was not a dog, cat, monkey, or other familiar creature: its print had
118
+ five foot-pads, long nails, and was nearly as large as a dessert-spoon
119
+ (sherlock-holmes.txt:5479-5486).
120
+ - It had a long body and very short legs: nearly two feet long, but with a
121
+ stride of only about three inches (sherlock-holmes.txt:5497-5502).
122
+ - It was carnivorous because it climbed the curtain toward a canary's cage
123
+ (sherlock-holmes.txt:5509-5510).
124
+ - It was probably from the weasel or stoat tribe, though unusually large
125
+ (sherlock-holmes.txt:5514-5516).
189
126
 
190
- For existing indexes, `zg index` without `--embedding` reuses the stored schema. Use `--rebuild --embedding <model>` only when you intentionally want to rebuild with a different model:
191
-
192
- ```bash
193
- zg index --rebuild --embedding local/qwen3-embedding-0.6b
127
+ Holmes also inferred that a man entered through the window with it and later
128
+ left with the key (sherlock-holmes.txt:5464-5470, 5527-5528).
194
129
  ```
195
130
 
196
- ## ๐Ÿ”Ž Query Patterns
131
+ #### For humans: search directly
197
132
 
198
- Multiple quoted queries are treated as separate search groups:
133
+ Search the same bookshelf directly, without an agent:
199
134
 
200
135
  ```bash
201
- zg query "request validation" "error handling" --limit 5
136
+ zg query --human "An unseen creature left a few marks. What did the detective infer?" --limit 3
202
137
  ```
203
138
 
204
- Route options each consume one query and can be repeated. Add `--fuse` when
205
- you want all groups combined into one ranked result list:
206
-
207
- ```bash
208
- zg query \
209
- --hybrid "authentication flow" \
210
- --fts "AuthService" \
211
- --vector "where credentials are validated" \
212
- --fuse \
213
- --limit 10
214
- ```
139
+ zg returns the relevant passages from `sherlock-holmes.txt`, ranked ahead of the
140
+ other novels.
215
141
 
216
- Use ripgrep-style path and file-type filters early to keep results focused.
217
- Positive globs include paths and globs beginning with `!` exclude them:
142
+ <a id="benchmarks"></a>
218
143
 
219
- ```bash
220
- zg query "cache invalidation" \
221
- -g "src/**" \
222
- -g "!test/**" \
223
- -g "!tests/**" \
224
- -g "!fixtures/**" \
225
- -g "!dist/**" \
226
- -t ts
227
- ```
144
+ ## ๐Ÿ“Š Benchmarks
228
145
 
229
- File-type filters are applied in addition to glob filters. For example,
230
- `-g "docs/**" -t ts` selects TypeScript files under `docs`, not every file in
231
- that directory.
146
+ zg is a general-purpose retrieval tool. Current benchmarks cover code and text
147
+ retrieval.
232
148
 
233
- Use `--preview` to control indexed source previews:
149
+ ### Repository code retrieval
234
150
 
235
- ```bash
236
- zg query "plugin lifecycle" --preview none
237
- zg query "plugin lifecycle" --preview short --limit 5
238
- zg query "plugin lifecycle" --preview full --limit 2
239
- ```
151
+ We use [SWE-QA-Bench](https://github.com/peng-weihan/SWE-QA-Bench), which
152
+ requires cross-file and multi-hop reasoning over real-world codebases.
240
153
 
241
- For exact text, symbols, flags, or error codes, use `--fts` or `--rg`:
154
+ - **Coverage:** 20 retrieval-intensive tasks covering the paper's four
155
+ top-level categoriesโ€”**What, Where, How, and Why**โ€”across 8 intentions and
156
+ 11 repositories.
157
+ - **Agent:** Claude Code with **Claude Opus 5**.
158
+ - **Embedding:** **Qwen3.7 Text Embedding** for the zg profile.
159
+ - **Protocol:** 3 runs per task and profile.
242
160
 
243
- ```bash
244
- zg query "authentication flow" --fts "AuthService" --fts "ForbiddenError"
245
- zg query --rg -i -C 2 -g "*.ts" "needle text" src
246
- ```
161
+ | Profile | Judge /100 โ†‘ | Input tokens โ†“ | Tool calls โ†“ | Time (s) โ†“ | Cost โ†“ |
162
+ | --- | ---: | ---: | ---: | ---: | ---: |
163
+ | Native tools | 80.42 | 558,651 | 23.42 | 127.5 | $0.905 |
164
+ | Native tools + zg | 81.92 | 294,262 | 9.70 | 79.7 | $0.558 |
165
+ | Change | **+1.50 pp** | **โˆ’47.3%** | **โˆ’58.6%** | **โˆ’37.5%** | **โˆ’38.3%** |
247
166
 
248
- Managed rg mode accepts common ripgrep matching, context, type, glob, ignore,
249
- depth, size, symlink, encoding, and regex-engine options. Zvec-grep owns the
250
- result format, so output-changing modes such as `--json`, `--count`, `--files`,
251
- `-l`, `-o`, `--replace`, and `--vimgrep` are rejected. `.git/**` and
252
- `.zvec-grep/**` remain excluded.
167
+ Across 20 tasks ร— 3 runs, zg increased the Judge score by 1.50 points while
168
+ reducing input tokens by 47.3%, tool calls by 58.6%, execution time by 37.5%,
169
+ and cost by 38.3%.
253
170
 
254
- ## <a id="library-api"></a>๐Ÿ› ๏ธ Library API
171
+ ### Large-scale text retrieval
255
172
 
256
- ```ts
257
- import { createZvecGrep } from "@zvec/zvec-grep";
173
+ We use [BrowseComp-Plus](https://github.com/texttron/BrowseComp-Plus), which
174
+ requires multi-document evidence retrieval over a fixed web corpus. The
175
+ evaluation includes 30 queries covering 10 mapped topics and three
176
+ evidence-breadth levels, with 3 runs per profile.
258
177
 
259
- const zvecGrep = await createZvecGrep({
260
- root: process.cwd(),
261
- });
178
+ | Profile | Accuracy โ†‘ | Evidence recall โ†‘ | Search calls โ†“ | Input tokens โ†“ | Time (s) โ†“ | Cost โ†“ |
179
+ | --- | ---: | ---: | ---: | ---: | ---: | ---: |
180
+ | Agent + BM25 | TBD | TBD | TBD | TBD | TBD | TBD |
181
+ | Agent + zg | TBD | TBD | TBD | TBD | TBD | TBD |
182
+ | Change | TBD | TBD | TBD | TBD | TBD | TBD |
262
183
 
263
- const result = await zvecGrep.context({
264
- query: "ranking implementation",
265
- limit: 5,
266
- });
184
+ Across 30 queries ร— 3 runs, zg changed accuracy by TBD pp, evidence recall by
185
+ TBD pp, search calls by TBD%, input tokens by TBD%, time by TBD%, and cost by
186
+ TBD%.
267
187
 
268
- for (const item of result.items) {
269
- const location =
270
- item.range.kind === "text"
271
- ? `${item.file.relativePath}:${item.range.startLine}`
272
- : item.file.relativePath;
273
- console.log(location);
274
- }
188
+ To reproduce the evaluation, follow the
189
+ [benchmark guide](./benchmarks/README.md) for environment setup, pinned
190
+ revisions, task manifests, baseline configuration, exact commands, and result
191
+ aggregation. All profiles use the same agent, model, prompt, tool budget, and
192
+ three-run protocol.
275
193
 
276
- await zvecGrep.close();
277
- ```
194
+ ## ๐Ÿ“š Documentation
278
195
 
279
- For explicit no-index lexical search:
196
+ | Guide | What you can do |
197
+ | :--- | :--- |
198
+ | [Agent integrations](./docs/01-agents.md) | Connect zg to Codex, Claude Code, Cursor, or OpenCode and verify that it works. |
199
+ | [CLI guide](./docs/02-cli.md) | Search, index, and manage your local workspaces from the terminal. |
200
+ | [MCP guide](./docs/03-mcp.md) | Understand which zg tools your agent can use and how access is secured. |
201
+ | [Retrieval pipeline](./docs/04-pipeline.md) | Choose what to index, keep it fresh, and get better search results. |
202
+ | [Architecture](./docs/05-architecture.md) | See how zg handles your query and where your data stays. |
203
+ | [Server and execution modes](./docs/06-server.md) | Choose between one-off commands and a long-running local server. |
204
+ | [Embedding models](./docs/07-embedding.md) | Pick the right model for speed, search quality, privacy, and your hardware. |
205
+ | [Roadmap](./docs/08-roadmap.md) | See what is coming next and help shape zg's priorities. |
280
206
 
281
- ```ts
282
- const result = await zvecGrep.context({
283
- query: "ZVEC_GREP_HOME",
284
- rg: true,
285
- });
286
- ```
207
+ <a id="community"></a>
287
208
 
288
- ## ๐Ÿค Join the Zvec Community
209
+ ## ๐Ÿค Join Our Community
289
210
 
290
211
  <div align="center">
291
212
 
292
- | ๐Ÿ’ฌ DingTalk | ๐Ÿ“ฑ WeChat | ๐ŸŽฎ Discord | X (Twitter) |
293
- | :-----------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------: |
294
- | <img src="https://zvec.oss-cn-hongkong.aliyuncs.com/qrcode/dingding.png" width="150" alt="DingTalk QR Code"/> | <img src="https://zvec.oss-cn-hongkong.aliyuncs.com/qrcode/wechat.png?v=6" width="150" alt="WeChat QR Code"/> | [![Discord](https://img.shields.io/badge/Discord-Join%20Server-5865F2?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/rKddFBBu9z) | [![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/ZvecAI)](https://x.com/ZvecAI) |
295
- | Scan to join | Scan to join | Click to join | Click to follow |
213
+ | ๐Ÿ’ฌ DingTalk | ๐Ÿ“ฑ WeChat | ๐ŸŽฎ Discord | X (Twitter) |
214
+ | :---: | :---: | :---: | :---: |
215
+ | <img src="https://zvec.oss-cn-hongkong.aliyuncs.com/qrcode/dingding.png" width="150" alt="DingTalk QR Code"/> | <img src="https://zvec.oss-cn-hongkong.aliyuncs.com/qrcode/wechat.png?v1" width="150" alt="WeChat QR Code"/> | [![Discord](https://img.shields.io/badge/Discord-Join%20Server-5865F2?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/rKddFBBu9z) | [![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/ZvecAI)](<https://x.com/ZvecAI>) |
216
+ | Scan to join | Scan to join | Click to join | Click to follow |
296
217
 
297
218
  </div>
298
219
 
299
220
  ## โค๏ธ Contributing
300
221
 
301
- Issues and pull requests are welcome. Please keep changes focused, add tests for behavior changes, and run:
302
-
303
- ```bash
304
- npm run check
305
- ```
222
+ Community contributions are always welcomeโ€”bug fixes, features, and
223
+ documentation improvements all help make zvec-grep better.
306
224
 
307
- Pull request titles use Conventional Commits syntax.
225
+ Check out our [Contributing Guide](./CONTRIBUTING.md) to get started!