@zvec/zvec-grep 0.1.6 → 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.
- package/README.md +128 -49
- package/README_CN.md +116 -43
- package/dist/cli/args.js +40 -7
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/auth.js +1 -4
- package/dist/cli/auth.js.map +1 -1
- package/dist/cli/commands.js +53 -24
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/format/context.d.ts +3 -0
- package/dist/cli/format/context.js +93 -22
- package/dist/cli/format/context.js.map +1 -1
- package/dist/cli/format/debug.js +10 -4
- package/dist/cli/format/debug.js.map +1 -1
- package/dist/cli/format/status.d.ts +3 -1
- package/dist/cli/format/status.js +34 -0
- package/dist/cli/format/status.js.map +1 -1
- package/dist/cli/help.js +149 -16
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/install.js +174 -56
- package/dist/cli/install.js.map +1 -1
- package/dist/cli/server-search.d.ts +3 -0
- package/dist/cli/server-search.js +12 -0
- package/dist/cli/server-search.js.map +1 -0
- package/dist/cli/types.d.ts +3 -0
- package/dist/cli/types.js.map +1 -1
- package/dist/client/daemon-client.d.ts +12 -0
- package/dist/client/daemon-client.js +23 -0
- package/dist/client/daemon-client.js.map +1 -1
- package/dist/daemon/backend.d.ts +1 -0
- package/dist/daemon/backend.js +56 -18
- package/dist/daemon/backend.js.map +1 -1
- package/dist/daemon/http-server.js +1 -0
- package/dist/daemon/http-server.js.map +1 -1
- package/dist/daemon/index-coordinator.d.ts +2 -1
- package/dist/daemon/index-coordinator.js.map +1 -1
- package/dist/daemon/runtime-manager.d.ts +1 -0
- package/dist/daemon/runtime-manager.js +4 -1
- package/dist/daemon/runtime-manager.js.map +1 -1
- package/dist/daemon/server-controller.js +55 -4
- package/dist/daemon/server-controller.js.map +1 -1
- package/dist/engine/code-formats.d.ts +3 -0
- package/dist/engine/code-formats.js +14 -0
- package/dist/engine/code-formats.js.map +1 -0
- package/dist/engine/extraction/code/adapter.js +1 -1
- package/dist/engine/extraction/code/adapter.js.map +1 -1
- package/dist/engine/extraction/code/extractor.js +12 -5
- package/dist/engine/extraction/code/extractor.js.map +1 -1
- package/dist/engine/extraction/index.d.ts +1 -0
- package/dist/engine/extraction/index.js +1 -0
- package/dist/engine/extraction/index.js.map +1 -1
- package/dist/engine/extraction/markdown/extractor.js +5 -3
- package/dist/engine/extraction/markdown/extractor.js.map +1 -1
- package/dist/engine/extraction/vector-content.d.ts +5 -0
- package/dist/engine/extraction/vector-content.js +95 -0
- package/dist/engine/extraction/vector-content.js.map +1 -0
- package/dist/engine/file-size-policy.d.ts +6 -0
- package/dist/engine/file-size-policy.js +20 -0
- package/dist/engine/file-size-policy.js.map +1 -0
- package/dist/engine/file-type.d.ts +10 -0
- package/dist/engine/file-type.js +71 -38
- package/dist/engine/file-type.js.map +1 -1
- package/dist/engine/manifest.d.ts +1 -0
- package/dist/engine/manifest.js +4 -0
- package/dist/engine/manifest.js.map +1 -1
- package/dist/engine/models/backends/model2vec-runtime.d.ts +63 -0
- package/dist/engine/models/backends/model2vec-runtime.js +112 -0
- package/dist/engine/models/backends/model2vec-runtime.js.map +1 -0
- package/dist/engine/models/backends/model2vec-tokenizer.d.ts +2 -0
- package/dist/engine/models/backends/model2vec-tokenizer.js +42 -0
- package/dist/engine/models/backends/model2vec-tokenizer.js.map +1 -0
- package/dist/engine/models/backends/model2vec-worker-pool.d.ts +25 -0
- package/dist/engine/models/backends/model2vec-worker-pool.js +264 -0
- package/dist/engine/models/backends/model2vec-worker-pool.js.map +1 -0
- package/dist/engine/models/backends/model2vec-worker.d.ts +1 -0
- package/dist/engine/models/backends/model2vec-worker.js +41 -0
- package/dist/engine/models/backends/model2vec-worker.js.map +1 -0
- package/dist/engine/models/backends/model2vec.d.ts +3 -20
- package/dist/engine/models/backends/model2vec.js +107 -128
- package/dist/engine/models/backends/model2vec.js.map +1 -1
- package/dist/engine/models/catalog.d.ts +26 -7
- package/dist/engine/models/catalog.js +26 -7
- package/dist/engine/models/catalog.js.map +1 -1
- package/dist/engine/models/embeddings.d.ts +1 -0
- package/dist/engine/models/embeddings.js.map +1 -1
- package/dist/engine/models/resolution.js +1 -1
- package/dist/engine/models/resolution.js.map +1 -1
- package/dist/engine/pipeline/indexing/index.js +83 -78
- package/dist/engine/pipeline/indexing/index.js.map +1 -1
- package/dist/engine/pipeline/indexing/input-budget.d.ts +2 -0
- package/dist/engine/pipeline/indexing/input-budget.js +51 -0
- package/dist/engine/pipeline/indexing/input-budget.js.map +1 -0
- package/dist/engine/pipeline/indexing/scanner/index.d.ts +3 -1
- package/dist/engine/pipeline/indexing/scanner/index.js +70 -18
- package/dist/engine/pipeline/indexing/scanner/index.js.map +1 -1
- package/dist/engine/pipeline/search/index.js.map +1 -1
- package/dist/engine/service/index.d.ts +1 -1
- package/dist/engine/service/root.d.ts +1 -4
- package/dist/engine/service/root.js +15 -22
- package/dist/engine/service/root.js.map +1 -1
- package/dist/engine/service/structure-enrichment.d.ts +1 -1
- package/dist/engine/service/structure-enrichment.js +10 -10
- package/dist/engine/service/structure-enrichment.js.map +1 -1
- package/dist/engine/service/types.d.ts +8 -1
- package/dist/engine/service/workspace-index.d.ts +6 -4
- package/dist/engine/service/workspace-index.js +18 -12
- package/dist/engine/service/workspace-index.js.map +1 -1
- package/dist/engine/service/zvec-grep.js +47 -29
- package/dist/engine/service/zvec-grep.js.map +1 -1
- package/dist/engine/storage/index.d.ts +27 -21
- package/dist/engine/storage/index.js +2 -1
- package/dist/engine/storage/index.js.map +1 -1
- package/dist/engine/storage/layout.d.ts +10 -0
- package/dist/engine/storage/layout.js +29 -0
- package/dist/engine/storage/layout.js.map +1 -0
- package/dist/engine/storage/zvec.d.ts +2 -42
- package/dist/engine/storage/zvec.js +40 -67
- package/dist/engine/storage/zvec.js.map +1 -1
- package/dist/engine/types.d.ts +14 -0
- package/dist/engine/types.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/dist/mcp/input-normalization.d.ts +2 -2
- package/dist/mcp/input-normalization.js +14 -5
- package/dist/mcp/input-normalization.js.map +1 -1
- package/dist/mcp/schemas.d.ts +242 -0
- package/dist/mcp/schemas.js +73 -14
- package/dist/mcp/schemas.js.map +1 -1
- package/dist/mcp/stdio-bridge.d.ts +9 -0
- package/dist/mcp/stdio-bridge.js +131 -0
- package/dist/mcp/stdio-bridge.js.map +1 -0
- package/dist/mcp/tools.d.ts +4 -1
- package/dist/mcp/tools.js +78 -44
- package/dist/mcp/tools.js.map +1 -1
- package/dist/prompts/zvec-grep-guidance.d.ts +2 -0
- package/dist/prompts/zvec-grep-guidance.js +9 -0
- package/dist/prompts/zvec-grep-guidance.js.map +1 -0
- package/docs/01-agents.md +26 -5
- package/docs/02-cli.md +11 -1
- package/docs/03-mcp.md +29 -11
- package/docs/04-pipeline.md +10 -2
- package/docs/06-server.md +5 -0
- package/docs/07-embedding.md +6 -3
- package/package.json +4 -4
- package/skills/zvec-grep/SKILL.md +0 -61
- package/skills/zvec-grep/agents/openai.yaml +0 -4
- package/skills/zvec-grep/references/cli-fallback.md +0 -85
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: zvec-grep
|
|
3
|
-
description: Repository code search and indexing with zvec-grep. Use when exploring a codebase, locating symbols, references, or exact text, creating or inspecting a repository index, diagnosing the daemon, or whenever repository investigation would otherwise use grep, rg, or broad file reads.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# zvec-grep
|
|
7
|
-
|
|
8
|
-
## Select the transport
|
|
9
|
-
|
|
10
|
-
Use zvec-grep indexed search for conceptual repository investigation. Use native
|
|
11
|
-
`grep` or `rg` for exact lexical searches unless the optional managed-rg MCP tool
|
|
12
|
-
is explicitly available.
|
|
13
|
-
|
|
14
|
-
Use the public native HTTP MCP search tools as the primary interface when the matching `zvec_grep_*` tool is present. Call them directly; do not run `zg`, probe the daemon through shell, or choose CLI for convenience.
|
|
15
|
-
|
|
16
|
-
Use CLI fallback only when one of these conditions is true:
|
|
17
|
-
|
|
18
|
-
- The task requires index lifecycle or daemon diagnostics, which are intentionally
|
|
19
|
-
kept out of the default agent MCP toolset.
|
|
20
|
-
- An available MCP search tool cannot perform the required operation.
|
|
21
|
-
- MCP initialization, authentication, connection, or the required search call has
|
|
22
|
-
failed.
|
|
23
|
-
- The repository has no index, the user has not authorized indexing, and an explicit no-index lexical search is needed.
|
|
24
|
-
|
|
25
|
-
Do not retry a submitted indexing write through another transport after a connection interruption.
|
|
26
|
-
|
|
27
|
-
## Use the MCP workflow
|
|
28
|
-
|
|
29
|
-
Pass the repository's daemon-visible absolute path as `root` on every repository call.
|
|
30
|
-
|
|
31
|
-
1. Use native `grep` or `rg` when an exact keyword, text, symbol, filename,
|
|
32
|
-
path, configuration key, error message, source fragment, literal, or regex
|
|
33
|
-
anchor is known and locating it is sufficient to answer the question.
|
|
34
|
-
2. Call `zvec_grep_search` when the answer requires conceptual discovery,
|
|
35
|
-
architecture, lifecycle, data or control flow, comparison, design rationale,
|
|
36
|
-
or performance analysis. Search defaults to `freshness: "eventual"`; use
|
|
37
|
-
`freshness: "wait_for_fresh"` only when the result must include all pending
|
|
38
|
-
changes. Use hybrid `queries` for concepts plus known lexical constraints,
|
|
39
|
-
`fts` for indexed lexical-only intent, and `vector` for semantic-only intent.
|
|
40
|
-
3. When exact symbols are present but the answer spans multiple components,
|
|
41
|
-
files, stages, or implementations, call `zvec_grep_search` first with the
|
|
42
|
-
concept and known symbols, then use native `grep` or `rg` for focused follow-up.
|
|
43
|
-
4. Read the indexed search response's `freshness` and `indexing` fields. Use
|
|
44
|
-
`possibly_stale` results immediately when they are sufficient; do not call
|
|
45
|
-
status merely because a background update is active.
|
|
46
|
-
5. Apply focused path and file-type filters early. Exclude dependencies,
|
|
47
|
-
generated output, caches, build artifacts, fixtures, and logs unless the
|
|
48
|
-
task concerns them.
|
|
49
|
-
|
|
50
|
-
The default public MCP endpoint intentionally exposes only indexed search. If the
|
|
51
|
-
index is missing, explain that indexed search requires an index and ask before
|
|
52
|
-
creating one. After authorization, use the CLI lifecycle workflow; never silently
|
|
53
|
-
create, rebuild, or drop an index. The optional full MCP toolset exposes
|
|
54
|
-
`zvec_grep_rg`; the CLI `zg query --rg` route remains available for explicit
|
|
55
|
-
managed-ripgrep fallback.
|
|
56
|
-
|
|
57
|
-
Use multiple queries when comparing related concepts.
|
|
58
|
-
|
|
59
|
-
## Use CLI fallback
|
|
60
|
-
|
|
61
|
-
Read [references/cli-fallback.md](references/cli-fallback.md) only after a fallback condition above is satisfied. Leave CLI mode unset for status, fallback search, and authorized indexing commands so the default Auto mode can select Server or Direct; do not probe forced Server mode and then retry forced Direct mode. Keep the selected transport consistent for the investigation unless its availability changes.
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
interface:
|
|
2
|
-
display_name: "zvec-grep"
|
|
3
|
-
short_description: "Repository search with explicit index lifecycle"
|
|
4
|
-
default_prompt: "Use $zvec-grep to investigate this repository before raw grep or rg. Prefer the public MCP search tools, and use the zg CLI only for authorized index lifecycle or daemon diagnostics."
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
# CLI fallback
|
|
2
|
-
|
|
3
|
-
Use these commands only when the native MCP tools are unavailable or when an explicit no-index lexical search is required.
|
|
4
|
-
|
|
5
|
-
## Choose the route
|
|
6
|
-
|
|
7
|
-
Leave `--mode` unset for ordinary status and query commands. The default Auto mode uses the daemon when reachable and Direct mode otherwise:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
zg status
|
|
11
|
-
zg query "authentication flow" --fts "AuthService" -g "src/**" -g "!tests/**" -g "!dist/**"
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
Do not probe with `--mode server` and then retry with `--mode direct`. Use an explicit mode only when diagnosing routing or when the user requests one. Do not force Direct writes while a daemon lease is active.
|
|
15
|
-
|
|
16
|
-
## Check index state
|
|
17
|
-
|
|
18
|
-
Check status once per repository investigation and reuse it:
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
zg status
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
If the index is missing, do not build it automatically. Mention `zg index` and wait for the user to authorize persistent indexing.
|
|
25
|
-
|
|
26
|
-
## Search an existing index
|
|
27
|
-
|
|
28
|
-
Start with indexed hybrid search, then add exact or semantic routes as needed:
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
zg query "request validation" "error handling" -g "src/**" -g "!tests/**" -g "!dist/**" --limit 10 --preview short
|
|
32
|
-
zg query "authentication flow" --fts "AuthService" --fts "ForbiddenError" -g "src/**"
|
|
33
|
-
zg query --vector "where incoming requests are authorized" -g "src/**"
|
|
34
|
-
zg query "changes that must be indexed before search" --refresh wait
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
When Auto selects Server, queries return the current index and refresh stale data in the background by default. Direct queries do not refresh by default. Add `--refresh wait` when the query must wait for pending index changes, or `--refresh off` to disable refresh explicitly. Use `--preview none` for broad candidate scans, `--preview short` for a small deterministic window, and `--preview full` only after narrowing.
|
|
38
|
-
|
|
39
|
-
## Recover from a Direct model failure
|
|
40
|
-
|
|
41
|
-
Direct mode already attempts CPU fallback when local GPU initialization fails. Do not repeat the query with an explicit CPU override.
|
|
42
|
-
|
|
43
|
-
If the local model or embedding context remains unavailable and exact anchors are available, remove positional hybrid and vector queries and search those anchors through the existing indexed FTS route. Indexed FTS does not require an embedding model:
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
zg query --fts "AuthService" --fts "ForbiddenError" -g "src/**" --limit 20 --preview short
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Do not switch to managed ripgrep merely because semantic search is unavailable. Use it only when the task requires exhaustive literal or regex matching, or when no index exists and the user has not authorized creating one.
|
|
50
|
-
|
|
51
|
-
## Search exhaustively with managed ripgrep
|
|
52
|
-
|
|
53
|
-
Use managed ripgrep only for exhaustive literal or regex matching; it does not require an index:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
zg query --rg "SymbolName|LogMessage"
|
|
57
|
-
zg query --rg -F "ExactSymbolOrText" src
|
|
58
|
-
zg query --rg -i -C 2 -g "*.ts" -g "!dist/**" "needle text" src
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Managed ripgrep always runs locally. It remains available while the daemon is running or an index writer is active; do not stop the daemon or switch client mode before using it.
|
|
62
|
-
|
|
63
|
-
Use `-e` or `--regexp` when the pattern begins with `-`. Common ripgrep flags include `-n`, `-H`, `-F`, `-i`, `-w`, `-A`, `-B`, `-C`, `-g`, `--hidden`, `--type`, `--type-not`, `--no-ignore`, `--smart-case`, and `--pcre2`.
|
|
64
|
-
|
|
65
|
-
## Index only with authorization
|
|
66
|
-
|
|
67
|
-
When a server default model is known, let Auto submit the index without repeating the model:
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
zg index
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
Otherwise, use the embedding model selected by the user:
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
zg index --embedding local/embeddinggemma-300m
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
Use focused path filters for a new index:
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
zg index --embedding local/embeddinggemma-300m -g "src/**" -g "docs/**" -g "test/**" -g "!dist/**" -g "!node_modules/**" -g "!coverage/**"
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Rebuild only when an incompatible embedding schema or index version requires it. Existing indexes reuse their stored embedding schema unless the user intentionally changes it.
|