@zvec/zvec-grep 0.1.5 → 0.1.6
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 +88 -249
- package/README_CN.md +82 -246
- package/dist/authorization/index.d.ts +7 -0
- package/dist/authorization/index.js +7 -0
- package/dist/authorization/index.js.map +1 -0
- package/dist/authorization/manager.d.ts +8 -0
- package/dist/authorization/manager.js +19 -0
- package/dist/authorization/manager.js.map +1 -0
- package/dist/authorization/operation.d.ts +7 -0
- package/dist/authorization/operation.js +50 -0
- package/dist/authorization/operation.js.map +1 -0
- package/dist/authorization/planner.d.ts +21 -0
- package/dist/authorization/planner.js +97 -0
- package/dist/authorization/planner.js.map +1 -0
- package/dist/authorization/prompt.d.ts +11 -0
- package/dist/authorization/prompt.js +62 -0
- package/dist/authorization/prompt.js.map +1 -0
- package/dist/authorization/store.d.ts +20 -0
- package/dist/authorization/store.js +251 -0
- package/dist/authorization/store.js.map +1 -0
- package/dist/authorization/target.d.ts +15 -0
- package/dist/authorization/target.js +49 -0
- package/dist/authorization/target.js.map +1 -0
- package/dist/authorization/types.d.ts +61 -0
- package/dist/authorization/types.js +2 -0
- package/dist/authorization/types.js.map +1 -0
- package/dist/cli/args.d.ts +1 -1
- package/dist/cli/args.js +304 -54
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/auth.d.ts +21 -0
- package/dist/cli/auth.js +212 -0
- package/dist/cli/auth.js.map +1 -0
- package/dist/cli/commands.js +433 -618
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/errors.js +2 -2
- package/dist/cli/errors.js.map +1 -1
- package/dist/cli/format/context.d.ts +1 -0
- package/dist/cli/format/context.js +241 -45
- package/dist/cli/format/context.js.map +1 -1
- package/dist/cli/format/debug.js +2 -2
- package/dist/cli/format/debug.js.map +1 -1
- package/dist/cli/format/progress.d.ts +4 -0
- package/dist/cli/format/progress.js +219 -46
- package/dist/cli/format/progress.js.map +1 -1
- package/dist/cli/format/status.d.ts +77 -6
- package/dist/cli/format/status.js +302 -106
- package/dist/cli/format/status.js.map +1 -1
- package/dist/cli/help.js +258 -59
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/index.js +0 -0
- package/dist/cli/install.d.ts +4 -0
- package/dist/cli/install.js +845 -0
- package/dist/cli/install.js.map +1 -0
- package/dist/cli/managed-rg.d.ts +10 -0
- package/dist/cli/managed-rg.js +329 -0
- package/dist/cli/managed-rg.js.map +1 -0
- package/dist/cli/types.d.ts +20 -6
- package/dist/cli/types.js.map +1 -1
- package/dist/client/daemon-client.d.ts +19 -0
- package/dist/client/daemon-client.js +180 -0
- package/dist/client/daemon-client.js.map +1 -0
- package/dist/client/mode-router.d.ts +9 -0
- package/dist/client/mode-router.js +28 -0
- package/dist/client/mode-router.js.map +1 -0
- package/dist/client/search-policy.d.ts +11 -0
- package/dist/client/search-policy.js +15 -0
- package/dist/client/search-policy.js.map +1 -0
- package/dist/daemon/backend.d.ts +76 -0
- package/dist/daemon/backend.js +1049 -0
- package/dist/daemon/backend.js.map +1 -0
- package/dist/daemon/change-set.d.ts +25 -0
- package/dist/daemon/change-set.js +101 -0
- package/dist/daemon/change-set.js.map +1 -0
- package/dist/daemon/config.d.ts +24 -0
- package/dist/daemon/config.js +88 -0
- package/dist/daemon/config.js.map +1 -0
- package/dist/daemon/errors.d.ts +5 -0
- package/dist/daemon/errors.js +11 -0
- package/dist/daemon/errors.js.map +1 -0
- package/dist/daemon/http-server.d.ts +30 -0
- package/dist/daemon/http-server.js +287 -0
- package/dist/daemon/http-server.js.map +1 -0
- package/dist/daemon/index-coordinator.d.ts +23 -0
- package/dist/daemon/index-coordinator.js +68 -0
- package/dist/daemon/index-coordinator.js.map +1 -0
- package/dist/daemon/job-scheduler.d.ts +70 -0
- package/dist/daemon/job-scheduler.js +366 -0
- package/dist/daemon/job-scheduler.js.map +1 -0
- package/dist/daemon/logger.d.ts +9 -0
- package/dist/daemon/logger.js +53 -0
- package/dist/daemon/logger.js.map +1 -0
- package/dist/daemon/model-pool.d.ts +45 -0
- package/dist/daemon/model-pool.js +187 -0
- package/dist/daemon/model-pool.js.map +1 -0
- package/dist/daemon/root-lease.d.ts +14 -0
- package/dist/daemon/root-lease.js +188 -0
- package/dist/daemon/root-lease.js.map +1 -0
- package/dist/daemon/root-runtime.d.ts +78 -0
- package/dist/daemon/root-runtime.js +333 -0
- package/dist/daemon/root-runtime.js.map +1 -0
- package/dist/daemon/runtime-manager.d.ts +45 -0
- package/dist/daemon/runtime-manager.js +243 -0
- package/dist/daemon/runtime-manager.js.map +1 -0
- package/dist/daemon/runtime.d.ts +12 -0
- package/dist/daemon/runtime.js +102 -0
- package/dist/daemon/runtime.js.map +1 -0
- package/dist/daemon/server-controller.d.ts +39 -0
- package/dist/daemon/server-controller.js +203 -0
- package/dist/daemon/server-controller.js.map +1 -0
- package/dist/daemon/watch-manager.d.ts +50 -0
- package/dist/daemon/watch-manager.js +293 -0
- package/dist/daemon/watch-manager.js.map +1 -0
- package/dist/daemon/workspace-read-session-cache.d.ts +31 -0
- package/dist/daemon/workspace-read-session-cache.js +115 -0
- package/dist/daemon/workspace-read-session-cache.js.map +1 -0
- package/dist/engine/config.d.ts +30 -8
- package/dist/engine/config.js +171 -45
- package/dist/engine/config.js.map +1 -1
- package/dist/engine/{errors/index.d.ts → errors.d.ts} +6 -1
- package/dist/engine/{errors/details.js → errors.js} +17 -4
- package/dist/engine/errors.js.map +1 -0
- package/dist/engine/extraction/code/adapter.d.ts +1 -1
- package/dist/engine/extraction/code/extractor.d.ts +5 -11
- package/dist/engine/extraction/code/extractor.js +105 -44
- package/dist/engine/extraction/code/extractor.js.map +1 -1
- package/dist/engine/extraction/code/families/c-family.js +1 -1
- package/dist/engine/extraction/code/families/c-family.js.map +1 -1
- package/dist/engine/extraction/code/families/js-ts.d.ts +1 -1
- package/dist/engine/extraction/code/families/metadata.d.ts +1 -1
- package/dist/engine/extraction/code/tree-sitter/grammar.js.map +1 -0
- package/dist/engine/extraction/code/tree-sitter/nodes.js.map +1 -0
- package/dist/engine/extraction/code/tree-sitter/parser.js.map +1 -0
- package/dist/engine/extraction/image/extractor.d.ts +5 -0
- package/dist/engine/extraction/image/extractor.js +35 -0
- package/dist/engine/extraction/image/extractor.js.map +1 -0
- package/dist/engine/extraction/index.d.ts +3 -44
- package/dist/engine/extraction/index.js +1 -280
- package/dist/engine/extraction/index.js.map +1 -1
- package/dist/engine/extraction/markdown/extractor.d.ts +5 -11
- package/dist/engine/extraction/markdown/extractor.js +35 -16
- package/dist/engine/extraction/markdown/extractor.js.map +1 -1
- package/dist/engine/extraction/runtime.d.ts +4 -0
- package/dist/engine/extraction/runtime.js +26 -0
- package/dist/engine/extraction/runtime.js.map +1 -0
- package/dist/engine/extraction/source.d.ts +18 -0
- package/dist/engine/extraction/source.js +22 -0
- package/dist/engine/extraction/source.js.map +1 -0
- package/dist/engine/extraction/text/extractor.d.ts +7 -0
- package/dist/engine/extraction/text/extractor.js +168 -0
- package/dist/engine/extraction/text/extractor.js.map +1 -0
- package/dist/engine/extraction/types.d.ts +4 -0
- package/dist/engine/{models → extraction}/types.js.map +1 -1
- package/dist/engine/{files/file-type.d.ts → file-type.d.ts} +1 -1
- package/dist/engine/file-type.js.map +1 -0
- package/dist/engine/index-status.d.ts +9 -0
- package/dist/engine/index-status.js +38 -0
- package/dist/engine/index-status.js.map +1 -0
- package/dist/engine/manifest.d.ts +12 -0
- package/dist/engine/manifest.js +120 -0
- package/dist/engine/manifest.js.map +1 -0
- package/dist/engine/models/{providers/llama-cpp/embedding.d.ts → backends/llama-cpp.d.ts} +25 -20
- package/dist/engine/models/{providers/llama-cpp/embedding.js → backends/llama-cpp.js} +127 -106
- package/dist/engine/models/backends/llama-cpp.js.map +1 -0
- package/dist/engine/models/backends/model2vec.d.ts +57 -0
- package/dist/engine/models/backends/model2vec.js +332 -0
- package/dist/engine/models/backends/model2vec.js.map +1 -0
- package/dist/engine/models/backends/qwen.d.ts +44 -0
- package/dist/engine/models/{providers/qwen/embedding.js → backends/qwen.js} +155 -94
- package/dist/engine/models/backends/qwen.js.map +1 -0
- package/dist/engine/models/backends/transformers-js.d.ts +87 -0
- package/dist/engine/models/backends/transformers-js.js +316 -0
- package/dist/engine/models/backends/transformers-js.js.map +1 -0
- package/dist/engine/models/catalog.d.ts +188 -23
- package/dist/engine/models/catalog.js +172 -25
- package/dist/engine/models/catalog.js.map +1 -1
- package/dist/engine/models/download-progress.d.ts +15 -0
- package/dist/engine/models/download-progress.js +48 -0
- package/dist/engine/models/download-progress.js.map +1 -0
- package/dist/engine/models/embeddings.d.ts +58 -18
- package/dist/engine/models/embeddings.js +52 -28
- package/dist/engine/models/embeddings.js.map +1 -1
- package/dist/engine/models/factory.d.ts +2 -5
- package/dist/engine/models/factory.js +41 -56
- package/dist/engine/models/factory.js.map +1 -1
- package/dist/engine/models/index.d.ts +4 -6
- package/dist/engine/models/index.js +4 -4
- package/dist/engine/models/index.js.map +1 -1
- package/dist/engine/models/ranking.d.ts +7 -3
- package/dist/engine/models/resolution.d.ts +8 -0
- package/dist/engine/models/resolution.js +22 -0
- package/dist/engine/models/resolution.js.map +1 -0
- package/dist/engine/pipeline/indexing/index.d.ts +9 -7
- package/dist/engine/pipeline/indexing/index.js +360 -121
- package/dist/engine/pipeline/indexing/index.js.map +1 -1
- package/dist/engine/pipeline/indexing/root-paths.js +6 -6
- package/dist/engine/pipeline/indexing/root-paths.js.map +1 -1
- package/dist/engine/pipeline/indexing/scanner/index.d.ts +6 -1
- package/dist/engine/pipeline/indexing/scanner/index.js +233 -29
- package/dist/engine/pipeline/indexing/scanner/index.js.map +1 -1
- package/dist/engine/pipeline/search/index.d.ts +6 -6
- package/dist/engine/pipeline/search/index.js +8 -10
- package/dist/engine/pipeline/search/index.js.map +1 -1
- package/dist/engine/service/index.d.ts +3 -2
- package/dist/engine/service/index.js +1 -1
- package/dist/engine/service/index.js.map +1 -1
- package/dist/engine/service/root.d.ts +13 -12
- package/dist/engine/service/root.js +35 -24
- package/dist/engine/service/root.js.map +1 -1
- package/dist/engine/service/structure-enrichment.js +12 -14
- package/dist/engine/service/structure-enrichment.js.map +1 -1
- package/dist/engine/service/types.d.ts +32 -37
- package/dist/engine/service/workspace-index.d.ts +24 -0
- package/dist/engine/service/workspace-index.js +151 -0
- package/dist/engine/service/workspace-index.js.map +1 -0
- package/dist/engine/service/zvec-grep.d.ts +12 -1
- package/dist/engine/service/zvec-grep.js +677 -486
- package/dist/engine/service/zvec-grep.js.map +1 -1
- package/dist/engine/storage/index.d.ts +8 -4
- package/dist/engine/storage/index.js +1 -1
- package/dist/engine/storage/index.js.map +1 -1
- package/dist/engine/storage/zvec.d.ts +10 -33
- package/dist/engine/storage/zvec.js +95 -38
- package/dist/engine/storage/zvec.js.map +1 -1
- package/dist/engine/types.d.ts +15 -23
- package/dist/engine/types.js +1 -1
- package/dist/engine/types.js.map +1 -1
- package/dist/engine/utils/daemon-lease.d.ts +17 -0
- package/dist/engine/utils/daemon-lease.js +175 -0
- package/dist/engine/utils/daemon-lease.js.map +1 -0
- package/dist/engine/utils/file-selection.js +38 -1
- package/dist/engine/utils/file-selection.js.map +1 -1
- package/dist/engine/utils/lock.js +1 -1
- package/dist/engine/utils/lock.js.map +1 -1
- package/dist/index-progress.d.ts +10 -0
- package/dist/index-progress.js +159 -0
- package/dist/index-progress.js.map +1 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/http-transport.d.ts +27 -0
- package/dist/mcp/http-transport.js +182 -0
- package/dist/mcp/http-transport.js.map +1 -0
- package/dist/mcp/input-normalization.d.ts +38 -0
- package/dist/mcp/input-normalization.js +95 -0
- package/dist/mcp/input-normalization.js.map +1 -0
- package/dist/mcp/progress-heartbeat.d.ts +17 -0
- package/dist/mcp/progress-heartbeat.js +46 -0
- package/dist/mcp/progress-heartbeat.js.map +1 -0
- package/dist/mcp/request-metadata.d.ts +2 -0
- package/dist/mcp/request-metadata.js +11 -0
- package/dist/mcp/request-metadata.js.map +1 -0
- package/dist/mcp/request-state.d.ts +40 -0
- package/dist/mcp/request-state.js +210 -0
- package/dist/mcp/request-state.js.map +1 -0
- package/dist/mcp/result-format.d.ts +13 -0
- package/dist/mcp/result-format.js +75 -0
- package/dist/mcp/result-format.js.map +1 -0
- package/dist/mcp/schemas.d.ts +430 -0
- package/dist/mcp/schemas.js +447 -0
- package/dist/mcp/schemas.js.map +1 -0
- package/dist/mcp/tools.d.ts +150 -0
- package/dist/mcp/tools.js +448 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/mcp/toolset.d.ts +5 -0
- package/dist/mcp/toolset.js +12 -0
- package/dist/mcp/toolset.js.map +1 -0
- package/dist/observability/trace-context.d.ts +11 -0
- package/dist/observability/trace-context.js +138 -0
- package/dist/observability/trace-context.js.map +1 -0
- package/docs/01-agents.md +111 -0
- package/docs/02-cli.md +229 -0
- package/docs/03-mcp.md +167 -0
- package/docs/04-pipeline.md +218 -0
- package/docs/05-architecture.md +86 -0
- package/docs/06-server.md +210 -0
- package/docs/07-embedding.md +179 -0
- package/docs/08-roadmap.md +85 -0
- package/docs/README.md +53 -0
- package/package.json +17 -8
- package/skills/zvec-grep/SKILL.md +43 -133
- package/skills/zvec-grep/agents/openai.yaml +2 -2
- package/skills/zvec-grep/references/cli-fallback.md +85 -0
- package/dist/cli/mcp.d.ts +0 -2
- package/dist/cli/mcp.js +0 -354
- package/dist/cli/mcp.js.map +0 -1
- package/dist/engine/collection/index.d.ts +0 -55
- package/dist/engine/collection/index.js +0 -710
- package/dist/engine/collection/index.js.map +0 -1
- package/dist/engine/errors/details.d.ts +0 -6
- package/dist/engine/errors/details.js.map +0 -1
- package/dist/engine/errors/index.js +0 -16
- package/dist/engine/errors/index.js.map +0 -1
- package/dist/engine/extraction/tree-sitter/grammar.js.map +0 -1
- package/dist/engine/extraction/tree-sitter/nodes.js.map +0 -1
- package/dist/engine/extraction/tree-sitter/parser.js.map +0 -1
- package/dist/engine/files/file-type.js.map +0 -1
- package/dist/engine/models/providers/index.d.ts +0 -2
- package/dist/engine/models/providers/index.js +0 -3
- package/dist/engine/models/providers/index.js.map +0 -1
- package/dist/engine/models/providers/llama-cpp/embedding.js.map +0 -1
- package/dist/engine/models/providers/llama-cpp/index.d.ts +0 -1
- package/dist/engine/models/providers/llama-cpp/index.js +0 -2
- package/dist/engine/models/providers/llama-cpp/index.js.map +0 -1
- package/dist/engine/models/providers/qwen/embedding.d.ts +0 -42
- package/dist/engine/models/providers/qwen/embedding.js.map +0 -1
- package/dist/engine/models/providers/qwen/index.d.ts +0 -1
- package/dist/engine/models/providers/qwen/index.js +0 -2
- package/dist/engine/models/providers/qwen/index.js.map +0 -1
- package/dist/engine/models/types.d.ts +0 -30
- /package/dist/engine/extraction/{tree-sitter → code/tree-sitter}/grammar.d.ts +0 -0
- /package/dist/engine/extraction/{tree-sitter → code/tree-sitter}/grammar.js +0 -0
- /package/dist/engine/extraction/{tree-sitter → code/tree-sitter}/nodes.d.ts +0 -0
- /package/dist/engine/extraction/{tree-sitter → code/tree-sitter}/nodes.js +0 -0
- /package/dist/engine/extraction/{tree-sitter → code/tree-sitter}/parser.d.ts +0 -0
- /package/dist/engine/extraction/{tree-sitter → code/tree-sitter}/parser.js +0 -0
- /package/dist/engine/{models → extraction}/types.js +0 -0
- /package/dist/engine/{files/file-type.js → file-type.js} +0 -0
package/dist/cli/args.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { VALID_SYMBOL_TYPES } from "./types.js";
|
|
2
|
+
import { parseMcpToolset } from "../mcp/toolset.js";
|
|
2
3
|
const RG_OPTIONS_WITH_VALUE = new Set([
|
|
3
4
|
"--dfa-size-limit",
|
|
4
5
|
"--encoding",
|
|
@@ -89,7 +90,32 @@ export function parseArgs(args) {
|
|
|
89
90
|
}
|
|
90
91
|
const options = {};
|
|
91
92
|
const positionals = [];
|
|
92
|
-
|
|
93
|
+
let startIndex = 1;
|
|
94
|
+
if (commandInput.command === "config") {
|
|
95
|
+
if (args[1] === "model" && args[2] === "set") {
|
|
96
|
+
options.configAction = "model-set";
|
|
97
|
+
startIndex = 3;
|
|
98
|
+
}
|
|
99
|
+
else if (args[1] === "provider" && args[2] === "set") {
|
|
100
|
+
options.configAction = "provider-set";
|
|
101
|
+
startIndex = 3;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
else if (commandInput.command === "auth") {
|
|
105
|
+
if (args[1] === "grant" || args[1] === "status" || args[1] === "revoke") {
|
|
106
|
+
options.authAction = args[1];
|
|
107
|
+
startIndex = 2;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else if (commandInput.command === "server") {
|
|
111
|
+
if (args[1] === "on" ||
|
|
112
|
+
args[1] === "off" ||
|
|
113
|
+
args[1] === "status" ||
|
|
114
|
+
args[1] === "run") {
|
|
115
|
+
options.serverAction = args[1];
|
|
116
|
+
startIndex = 2;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
93
119
|
for (let index = startIndex; index < args.length; index++) {
|
|
94
120
|
const arg = args[index];
|
|
95
121
|
if (arg === "--") {
|
|
@@ -111,8 +137,32 @@ export function parseArgs(args) {
|
|
|
111
137
|
else if (arg === "--version") {
|
|
112
138
|
throw new Error(`${arg} must be used without a command`);
|
|
113
139
|
}
|
|
114
|
-
else if (arg
|
|
115
|
-
options.
|
|
140
|
+
else if (isLongOptionWithValue(arg, "--mode")) {
|
|
141
|
+
options.mode = parseClientMode(valueFromLongOption(arg));
|
|
142
|
+
}
|
|
143
|
+
else if (arg === "--mode") {
|
|
144
|
+
options.mode = parseClientMode(readOptionValue(args, ++index, arg));
|
|
145
|
+
}
|
|
146
|
+
else if (arg === "--force-direct") {
|
|
147
|
+
options.forceDirect = true;
|
|
148
|
+
}
|
|
149
|
+
else if (isLongOptionWithValue(arg, "--mcp-toolset")) {
|
|
150
|
+
options.mcpToolset = parseMcpToolset(valueFromLongOption(arg));
|
|
151
|
+
}
|
|
152
|
+
else if (arg === "--mcp-toolset") {
|
|
153
|
+
options.mcpToolset = parseMcpToolset(readOptionValue(args, ++index, arg));
|
|
154
|
+
}
|
|
155
|
+
else if (isLongOptionWithValue(arg, "--listen")) {
|
|
156
|
+
options.listen = valueFromLongOption(arg);
|
|
157
|
+
}
|
|
158
|
+
else if (arg === "--listen") {
|
|
159
|
+
options.listen = readOptionValue(args, ++index, arg);
|
|
160
|
+
}
|
|
161
|
+
else if (isLongOptionWithValue(arg, "--token-file")) {
|
|
162
|
+
options.serverTokenFile = valueFromLongOption(arg);
|
|
163
|
+
}
|
|
164
|
+
else if (arg === "--token-file") {
|
|
165
|
+
options.serverTokenFile = readOptionValue(args, ++index, arg);
|
|
116
166
|
}
|
|
117
167
|
else if (isLongOptionWithValue(arg, "--target")) {
|
|
118
168
|
options.installTargets = appendInstallTargets(options.installTargets, valueFromLongOption(arg));
|
|
@@ -126,9 +176,37 @@ export function parseArgs(args) {
|
|
|
126
176
|
else if (arg === "--mcp-tool-timeout") {
|
|
127
177
|
options.installMcpToolTimeoutSeconds = parsePositiveInteger(readOptionValue(args, ++index, arg), arg);
|
|
128
178
|
}
|
|
179
|
+
else if (isLongOptionWithValue(arg, "--mcp-token-env")) {
|
|
180
|
+
options.installMcpTokenEnv = parseEnvironmentVariable(valueFromLongOption(arg), "--mcp-token-env");
|
|
181
|
+
}
|
|
182
|
+
else if (arg === "--mcp-token-env") {
|
|
183
|
+
options.installMcpTokenEnv = parseEnvironmentVariable(readOptionValue(args, ++index, arg), arg);
|
|
184
|
+
}
|
|
129
185
|
else if (arg === "--yes") {
|
|
130
186
|
options.yes = true;
|
|
131
187
|
}
|
|
188
|
+
else if (isLongOptionWithValue(arg, "--allow-remote")) {
|
|
189
|
+
throw allowRemoteValueError();
|
|
190
|
+
}
|
|
191
|
+
else if (arg === "--allow-remote") {
|
|
192
|
+
const legacyScope = args[index + 1];
|
|
193
|
+
if (legacyScope === "once" || legacyScope === "workspace") {
|
|
194
|
+
throw allowRemoteValueError();
|
|
195
|
+
}
|
|
196
|
+
options.allowRemote = true;
|
|
197
|
+
}
|
|
198
|
+
else if (isLongOptionWithValue(arg, "--capability")) {
|
|
199
|
+
options.authorizationCapability = parseAuthorizationCapability(valueFromLongOption(arg));
|
|
200
|
+
}
|
|
201
|
+
else if (arg === "--capability") {
|
|
202
|
+
options.authorizationCapability = parseAuthorizationCapability(readOptionValue(args, ++index, arg));
|
|
203
|
+
}
|
|
204
|
+
else if (isLongOptionWithValue(arg, "--scope")) {
|
|
205
|
+
options.authorizationScope = parseAuthorizationScope(valueFromLongOption(arg));
|
|
206
|
+
}
|
|
207
|
+
else if (arg === "--scope") {
|
|
208
|
+
options.authorizationScope = parseAuthorizationScope(readOptionValue(args, ++index, arg));
|
|
209
|
+
}
|
|
132
210
|
else if (arg === "--rg") {
|
|
133
211
|
options.rg = true;
|
|
134
212
|
}
|
|
@@ -141,6 +219,9 @@ export function parseArgs(args) {
|
|
|
141
219
|
else if (arg === "--human") {
|
|
142
220
|
options.human = true;
|
|
143
221
|
}
|
|
222
|
+
else if (arg === "--check-ready") {
|
|
223
|
+
options.checkReady = true;
|
|
224
|
+
}
|
|
144
225
|
else if (isLongOptionWithValue(arg, "--preview")) {
|
|
145
226
|
options.preview = parsePreviewMode(valueFromLongOption(arg));
|
|
146
227
|
}
|
|
@@ -165,15 +246,18 @@ export function parseArgs(args) {
|
|
|
165
246
|
else if (arg === "--reset-paths") {
|
|
166
247
|
options.resetPaths = true;
|
|
167
248
|
}
|
|
168
|
-
else if (arg === "--
|
|
169
|
-
options.
|
|
249
|
+
else if (arg === "--default") {
|
|
250
|
+
options.defaultModel = true;
|
|
251
|
+
}
|
|
252
|
+
else if (isLongOptionWithValue(arg, "--refresh")) {
|
|
253
|
+
options.refresh = parseQueryRefreshMode(valueFromLongOption(arg));
|
|
254
|
+
}
|
|
255
|
+
else if (arg === "--refresh") {
|
|
256
|
+
options.refresh = parseQueryRefreshMode(readOptionValue(args, ++index, arg));
|
|
170
257
|
}
|
|
171
258
|
else if (arg === "--prefer-symbol") {
|
|
172
259
|
options.preferSymbol = true;
|
|
173
260
|
}
|
|
174
|
-
else if (arg === "--collection") {
|
|
175
|
-
options.collection = readOptionValue(args, ++index, arg);
|
|
176
|
-
}
|
|
177
261
|
else if (arg === "--home") {
|
|
178
262
|
options.home = readOptionValue(args, ++index, arg);
|
|
179
263
|
}
|
|
@@ -183,17 +267,8 @@ export function parseArgs(args) {
|
|
|
183
267
|
else if (arg === "--model-cache") {
|
|
184
268
|
options.modelCacheDir = readOptionValue(args, ++index, arg);
|
|
185
269
|
}
|
|
186
|
-
else if (arg === "--
|
|
187
|
-
options.
|
|
188
|
-
}
|
|
189
|
-
else if (arg === "--no-gpu") {
|
|
190
|
-
options.llamaGpu = false;
|
|
191
|
-
}
|
|
192
|
-
else if (arg === "--llama-gpu") {
|
|
193
|
-
options.llamaGpu = parseLlamaGpu(readOptionValue(args, ++index, arg));
|
|
194
|
-
}
|
|
195
|
-
else if (arg === "--embedding-parallelism") {
|
|
196
|
-
options.embeddingParallelism = parsePositiveInteger(readOptionValue(args, ++index, arg), arg);
|
|
270
|
+
else if (arg === "--device") {
|
|
271
|
+
options.device = parseDevice(readOptionValue(args, ++index, arg));
|
|
197
272
|
}
|
|
198
273
|
else if (arg === "--api-key") {
|
|
199
274
|
options.apiKey = readOptionValue(args, ++index, arg);
|
|
@@ -393,7 +468,7 @@ function parseCommand(args) {
|
|
|
393
468
|
throw new Error(`${first} does not accept arguments`);
|
|
394
469
|
}
|
|
395
470
|
if (first === "help" && rest.length > 1) {
|
|
396
|
-
throw new Error("zg help accepts at most one command
|
|
471
|
+
throw new Error("zg help accepts at most one command or topic");
|
|
397
472
|
}
|
|
398
473
|
return {
|
|
399
474
|
command: "help",
|
|
@@ -412,15 +487,37 @@ function parseCommand(args) {
|
|
|
412
487
|
if (first === "query" ||
|
|
413
488
|
first === "index" ||
|
|
414
489
|
first === "status" ||
|
|
415
|
-
first === "collections" ||
|
|
416
490
|
first === "install" ||
|
|
417
491
|
first === "uninstall" ||
|
|
418
|
-
first === "
|
|
492
|
+
first === "config" ||
|
|
493
|
+
first === "auth" ||
|
|
494
|
+
first === "server") {
|
|
419
495
|
return { command: first };
|
|
420
496
|
}
|
|
497
|
+
if (first === "serve") {
|
|
498
|
+
throw new Error("zg serve has been removed; use zg server on and Streamable HTTP MCP");
|
|
499
|
+
}
|
|
421
500
|
throw new Error(`Unknown command: ${first}`);
|
|
422
501
|
}
|
|
423
502
|
function validateCliShape(command, options, positionals) {
|
|
503
|
+
if (command === "auth") {
|
|
504
|
+
if (!options.authAction) {
|
|
505
|
+
throw new Error("zg auth requires grant, status, or revoke");
|
|
506
|
+
}
|
|
507
|
+
if (positionals.length > 1) {
|
|
508
|
+
throw new Error(`zg auth ${options.authAction} accepts at most one root`);
|
|
509
|
+
}
|
|
510
|
+
if (options.authAction !== "grant" &&
|
|
511
|
+
(options.authorizationCapability || options.authorizationScope)) {
|
|
512
|
+
throw new Error(`--capability and --scope can only be used with zg auth grant`);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
else if (options.authorizationCapability || options.authorizationScope) {
|
|
516
|
+
throw new Error("--capability and --scope can only be used with zg auth");
|
|
517
|
+
}
|
|
518
|
+
if (options.allowRemote && command !== "query" && command !== "index") {
|
|
519
|
+
throw new Error("--allow-remote can only be used with query or index commands");
|
|
520
|
+
}
|
|
424
521
|
const queryOnly = firstEnabledOption([
|
|
425
522
|
[options.rg, "--rg"],
|
|
426
523
|
[options.hybridQueries?.length, "--hybrid"],
|
|
@@ -431,12 +528,11 @@ function validateCliShape(command, options, positionals) {
|
|
|
431
528
|
[options.human, "--human"],
|
|
432
529
|
[options.preview, "--preview"],
|
|
433
530
|
[options.limit, "--limit"],
|
|
434
|
-
[options.
|
|
531
|
+
[options.refresh, "--refresh"],
|
|
435
532
|
[options.preferSymbol, "--prefer-symbol"],
|
|
436
533
|
[options.symbolTypes?.length, "--symbol-type"],
|
|
437
534
|
[options.modifiedAfter, "--modified-after"],
|
|
438
535
|
[options.modifiedBefore, "--modified-before"],
|
|
439
|
-
[options.collection, "--collection"],
|
|
440
536
|
[options.rgCompatibilityOptions?.length, "ripgrep options"],
|
|
441
537
|
]);
|
|
442
538
|
if (command !== "query" && queryOnly) {
|
|
@@ -448,10 +544,7 @@ function validateCliShape(command, options, positionals) {
|
|
|
448
544
|
[options.fileTypes?.length, "--type"],
|
|
449
545
|
[options.excludedFileTypes?.length, "--type-not"],
|
|
450
546
|
]);
|
|
451
|
-
if (sharedSelection &&
|
|
452
|
-
command !== "query" &&
|
|
453
|
-
command !== "index" &&
|
|
454
|
-
command !== "collections") {
|
|
547
|
+
if (sharedSelection && command !== "query" && command !== "index") {
|
|
455
548
|
throw new Error(`${sharedSelection} can only be used with query or index commands`);
|
|
456
549
|
}
|
|
457
550
|
const discoveryOption = firstEnabledOption([
|
|
@@ -464,10 +557,72 @@ function validateCliShape(command, options, positionals) {
|
|
|
464
557
|
]);
|
|
465
558
|
if (discoveryOption &&
|
|
466
559
|
command !== "index" &&
|
|
467
|
-
command !== "collections" &&
|
|
468
560
|
!(command === "query" && options.rg)) {
|
|
469
561
|
throw new Error(`${discoveryOption} can only be used with index commands or zg query --rg`);
|
|
470
562
|
}
|
|
563
|
+
if (command === "config") {
|
|
564
|
+
if (!options.configAction) {
|
|
565
|
+
throw new Error("zg config requires provider set or model set");
|
|
566
|
+
}
|
|
567
|
+
const unsupported = firstEnabledOption([
|
|
568
|
+
[options.installTargets?.length, "--target"],
|
|
569
|
+
[options.installMcpToolTimeoutSeconds, "--mcp-tool-timeout"],
|
|
570
|
+
[options.installMcpTokenEnv, "--mcp-token-env"],
|
|
571
|
+
[options.yes, "--yes"],
|
|
572
|
+
[options.rg, "--rg"],
|
|
573
|
+
[options.home, "--home"],
|
|
574
|
+
[options.embedding, "--embedding"],
|
|
575
|
+
[
|
|
576
|
+
options.configAction === "model-set" ? options.apiKey : undefined,
|
|
577
|
+
"--api-key",
|
|
578
|
+
],
|
|
579
|
+
[
|
|
580
|
+
options.configAction === "provider-set" ? options.endpoint : undefined,
|
|
581
|
+
"--endpoint",
|
|
582
|
+
],
|
|
583
|
+
[
|
|
584
|
+
options.configAction === "provider-set" ? options.device : undefined,
|
|
585
|
+
"--device",
|
|
586
|
+
],
|
|
587
|
+
[
|
|
588
|
+
options.configAction === "provider-set"
|
|
589
|
+
? options.defaultModel
|
|
590
|
+
: undefined,
|
|
591
|
+
"--default",
|
|
592
|
+
],
|
|
593
|
+
[options.mode, "--mode"],
|
|
594
|
+
[options.listen, "--listen"],
|
|
595
|
+
[options.serverTokenFile, "--token-file"],
|
|
596
|
+
]);
|
|
597
|
+
if (unsupported) {
|
|
598
|
+
throw new Error(`zg config ${options.configAction === "model-set" ? "model" : "provider"} set does not accept ${unsupported}`);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
else if (options.defaultModel) {
|
|
602
|
+
throw new Error("--default can only be used with zg config model set");
|
|
603
|
+
}
|
|
604
|
+
if (command === "server") {
|
|
605
|
+
if (!options.serverAction) {
|
|
606
|
+
throw new Error("zg server requires on, off, status, or run");
|
|
607
|
+
}
|
|
608
|
+
if (options.listen !== undefined &&
|
|
609
|
+
options.serverAction !== "run" &&
|
|
610
|
+
options.serverAction !== "on") {
|
|
611
|
+
throw new Error("--listen can only be used with zg server on or run");
|
|
612
|
+
}
|
|
613
|
+
if (options.serverTokenFile !== undefined &&
|
|
614
|
+
options.serverAction === "status") {
|
|
615
|
+
throw new Error("--token-file cannot be used with zg server status");
|
|
616
|
+
}
|
|
617
|
+
if (options.mcpToolset !== undefined &&
|
|
618
|
+
options.serverAction !== "on" &&
|
|
619
|
+
options.serverAction !== "run") {
|
|
620
|
+
throw new Error("--mcp-toolset can only be used with zg server on or run");
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
else if (options.mcpToolset !== undefined) {
|
|
624
|
+
throw new Error("--mcp-toolset can only be used with zg server on or run");
|
|
625
|
+
}
|
|
471
626
|
if (options.rg &&
|
|
472
627
|
(hasExplicitRoutes(options) || options.hybridQueries?.length)) {
|
|
473
628
|
throw new Error("--rg cannot be combined with --hybrid, --fts, or --vector");
|
|
@@ -475,8 +630,8 @@ function validateCliShape(command, options, positionals) {
|
|
|
475
630
|
if (options.rg && options.fuse) {
|
|
476
631
|
throw new Error("--rg cannot be combined with --fuse");
|
|
477
632
|
}
|
|
478
|
-
if (options.
|
|
479
|
-
throw new Error("--
|
|
633
|
+
if (options.forceDirect && options.mode !== "direct") {
|
|
634
|
+
throw new Error("--force-direct requires --mode direct");
|
|
480
635
|
}
|
|
481
636
|
if (options.rg && options.preview) {
|
|
482
637
|
throw new Error("--preview is not supported with --rg; use -A/-B/-C for rg context");
|
|
@@ -488,18 +643,29 @@ function validateCliShape(command, options, positionals) {
|
|
|
488
643
|
throw new Error("--rg cannot be combined with indexed symbol options");
|
|
489
644
|
}
|
|
490
645
|
if (options.rg &&
|
|
491
|
-
(options.
|
|
646
|
+
(options.refresh || options.embeddingConcurrency !== undefined)) {
|
|
492
647
|
throw new Error("--rg cannot be combined with indexed refresh options");
|
|
493
648
|
}
|
|
494
649
|
if (!options.rg && (options.rgCompatibilityOptions?.length ?? 0) > 0) {
|
|
495
650
|
const [option] = options.rgCompatibilityOptions;
|
|
496
651
|
throw new Error(`${option} can only be used with --rg`);
|
|
497
652
|
}
|
|
498
|
-
if (options.
|
|
499
|
-
|
|
653
|
+
if (options.mode !== undefined &&
|
|
654
|
+
command !== "query" &&
|
|
655
|
+
command !== "index" &&
|
|
656
|
+
command !== "status") {
|
|
657
|
+
throw new Error("--mode can only be used with query, index, or status");
|
|
500
658
|
}
|
|
501
|
-
if (
|
|
502
|
-
|
|
659
|
+
if (options.checkReady &&
|
|
660
|
+
command !== "status" &&
|
|
661
|
+
!(command === "server" && options.serverAction === "status")) {
|
|
662
|
+
throw new Error("--check-ready can only be used with zg status or zg server status");
|
|
663
|
+
}
|
|
664
|
+
if (options.listen !== undefined && command !== "server") {
|
|
665
|
+
throw new Error("--listen can only be used with zg server on or run");
|
|
666
|
+
}
|
|
667
|
+
if (options.serverTokenFile !== undefined && command !== "server") {
|
|
668
|
+
throw new Error("--token-file can only be used with zg server");
|
|
503
669
|
}
|
|
504
670
|
if (options.installTargets?.length &&
|
|
505
671
|
command !== "install" &&
|
|
@@ -510,18 +676,19 @@ function validateCliShape(command, options, positionals) {
|
|
|
510
676
|
command !== "install") {
|
|
511
677
|
throw new Error("--mcp-tool-timeout can only be used with zg install");
|
|
512
678
|
}
|
|
679
|
+
if (options.installMcpTokenEnv !== undefined && command !== "install") {
|
|
680
|
+
throw new Error("--mcp-token-env can only be used with zg install");
|
|
681
|
+
}
|
|
513
682
|
if (options.force && command !== "install") {
|
|
514
683
|
throw new Error("--force can only be used with zg install");
|
|
515
684
|
}
|
|
516
685
|
if (command === "install" || command === "uninstall") {
|
|
517
686
|
const unsupported = firstEnabledOption([
|
|
518
|
-
[options.mcp, "--mcp"],
|
|
519
687
|
[options.color, "--color"],
|
|
520
688
|
[options.home, "--home"],
|
|
521
689
|
[options.embedding, "--embedding"],
|
|
522
690
|
[options.modelCacheDir, "--model-cache"],
|
|
523
|
-
[options.
|
|
524
|
-
[options.embeddingParallelism, "--embedding-parallelism"],
|
|
691
|
+
[options.device, "--device"],
|
|
525
692
|
[options.apiKey, "--api-key"],
|
|
526
693
|
[options.endpoint, "--endpoint"],
|
|
527
694
|
[options.rebuild, "--rebuild"],
|
|
@@ -552,11 +719,11 @@ function validateCliShape(command, options, positionals) {
|
|
|
552
719
|
if (options.drop && command !== "index") {
|
|
553
720
|
throw new Error("--drop can only be used with zg index");
|
|
554
721
|
}
|
|
555
|
-
if (options.rebuild && command !== "index"
|
|
556
|
-
throw new Error("--rebuild can only be used with zg index
|
|
722
|
+
if (options.rebuild && command !== "index") {
|
|
723
|
+
throw new Error("--rebuild can only be used with zg index");
|
|
557
724
|
}
|
|
558
|
-
if (options.resetPaths && command !== "index"
|
|
559
|
-
throw new Error("--reset-paths can only be used with zg index
|
|
725
|
+
if (options.resetPaths && command !== "index") {
|
|
726
|
+
throw new Error("--reset-paths can only be used with zg index");
|
|
560
727
|
}
|
|
561
728
|
if (options.drop &&
|
|
562
729
|
(options.rebuild ||
|
|
@@ -564,8 +731,7 @@ function validateCliShape(command, options, positionals) {
|
|
|
564
731
|
options.home ||
|
|
565
732
|
options.embedding ||
|
|
566
733
|
options.modelCacheDir ||
|
|
567
|
-
options.
|
|
568
|
-
options.embeddingParallelism ||
|
|
734
|
+
options.device !== undefined ||
|
|
569
735
|
options.apiKey ||
|
|
570
736
|
options.endpoint ||
|
|
571
737
|
options.globs?.length ||
|
|
@@ -581,6 +747,16 @@ function validateCliShape(command, options, positionals) {
|
|
|
581
747
|
options.embeddingConcurrency)) {
|
|
582
748
|
throw new Error("zg index --drop cannot be combined with indexing options");
|
|
583
749
|
}
|
|
750
|
+
if (command === "query") {
|
|
751
|
+
const unsupported = firstEnabledOption([
|
|
752
|
+
[options.embedding, "--embedding"],
|
|
753
|
+
[options.endpoint, "--endpoint"],
|
|
754
|
+
[options.embeddingConcurrency, "--embedding-concurrency"],
|
|
755
|
+
]);
|
|
756
|
+
if (unsupported) {
|
|
757
|
+
throw new Error(`${unsupported} is not supported with zg query`);
|
|
758
|
+
}
|
|
759
|
+
}
|
|
584
760
|
if (command === "query" && !options.rg) {
|
|
585
761
|
const queryCount = positionals.length +
|
|
586
762
|
(options.hybridQueries?.length ?? 0) +
|
|
@@ -593,6 +769,35 @@ function validateCliShape(command, options, positionals) {
|
|
|
593
769
|
function firstEnabledOption(candidates) {
|
|
594
770
|
return candidates.find(([value]) => Array.isArray(value) ? value.length > 0 : value !== undefined)?.[1];
|
|
595
771
|
}
|
|
772
|
+
function parseClientMode(value) {
|
|
773
|
+
if (value === "direct" || value === "server" || value === "auto")
|
|
774
|
+
return value;
|
|
775
|
+
throw new Error("--mode must be direct, server, or auto");
|
|
776
|
+
}
|
|
777
|
+
function parseQueryRefreshMode(value) {
|
|
778
|
+
if (value === "background" || value === "wait" || value === "off") {
|
|
779
|
+
return value;
|
|
780
|
+
}
|
|
781
|
+
throw new Error("--refresh must be background, wait, or off");
|
|
782
|
+
}
|
|
783
|
+
function allowRemoteValueError() {
|
|
784
|
+
return new Error([
|
|
785
|
+
"--allow-remote does not accept a value.",
|
|
786
|
+
"It authorizes Remote Embedding for the current command only.",
|
|
787
|
+
"For persistent authorization, use:",
|
|
788
|
+
" zg auth grant --capability embedding --scope workspace",
|
|
789
|
+
].join("\n"));
|
|
790
|
+
}
|
|
791
|
+
function parseAuthorizationCapability(value) {
|
|
792
|
+
if (value === "embedding")
|
|
793
|
+
return value;
|
|
794
|
+
throw new Error("--capability currently supports only embedding");
|
|
795
|
+
}
|
|
796
|
+
function parseAuthorizationScope(value) {
|
|
797
|
+
if (value === "workspace")
|
|
798
|
+
return value;
|
|
799
|
+
throw new Error("zg auth supports only workspace scope");
|
|
800
|
+
}
|
|
596
801
|
function readOptionValue(args, index, option) {
|
|
597
802
|
const value = args[index];
|
|
598
803
|
if (value === undefined || value.length === 0) {
|
|
@@ -803,6 +1008,12 @@ function parsePositiveInteger(value, option) {
|
|
|
803
1008
|
}
|
|
804
1009
|
return parsed;
|
|
805
1010
|
}
|
|
1011
|
+
function parseEnvironmentVariable(value, option) {
|
|
1012
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(value)) {
|
|
1013
|
+
throw new Error(`${option} requires a valid environment variable name`);
|
|
1014
|
+
}
|
|
1015
|
+
return value;
|
|
1016
|
+
}
|
|
806
1017
|
function parseByteSize(value, option) {
|
|
807
1018
|
const match = value.trim().match(/^(\d+)([KMGT])?$/i);
|
|
808
1019
|
if (!match) {
|
|
@@ -847,18 +1058,16 @@ function parsePreviewMode(value) {
|
|
|
847
1058
|
}
|
|
848
1059
|
throw new Error(`Unsupported preview mode: ${value}`);
|
|
849
1060
|
}
|
|
850
|
-
export function
|
|
1061
|
+
export function parseDevice(value) {
|
|
851
1062
|
const normalized = value.trim().toLowerCase();
|
|
852
1063
|
if (normalized === "auto" ||
|
|
1064
|
+
normalized === "cpu" ||
|
|
853
1065
|
normalized === "metal" ||
|
|
854
1066
|
normalized === "vulkan" ||
|
|
855
1067
|
normalized === "cuda") {
|
|
856
1068
|
return normalized;
|
|
857
1069
|
}
|
|
858
|
-
|
|
859
|
-
return false;
|
|
860
|
-
}
|
|
861
|
-
throw new Error(`Unsupported llama GPU mode: ${value}`);
|
|
1070
|
+
throw new Error(`Unsupported device: ${value}`);
|
|
862
1071
|
}
|
|
863
1072
|
function hasExplicitRoutes(options) {
|
|
864
1073
|
return (options.routes?.length ?? 0) > 0;
|
|
@@ -884,10 +1093,51 @@ function parseSymbolType(value) {
|
|
|
884
1093
|
throw new Error(`Unsupported symbol type: ${value}`);
|
|
885
1094
|
}
|
|
886
1095
|
export function splitPathFilters(value) {
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
1096
|
+
const filters = [];
|
|
1097
|
+
let start = 0;
|
|
1098
|
+
let braceDepth = 0;
|
|
1099
|
+
let bracketDepth = 0;
|
|
1100
|
+
let escaped = false;
|
|
1101
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
1102
|
+
const character = value[index];
|
|
1103
|
+
if (escaped) {
|
|
1104
|
+
escaped = false;
|
|
1105
|
+
continue;
|
|
1106
|
+
}
|
|
1107
|
+
if (character === "\\") {
|
|
1108
|
+
escaped = true;
|
|
1109
|
+
continue;
|
|
1110
|
+
}
|
|
1111
|
+
if (character === "[") {
|
|
1112
|
+
bracketDepth += 1;
|
|
1113
|
+
continue;
|
|
1114
|
+
}
|
|
1115
|
+
if (character === "]" && bracketDepth > 0) {
|
|
1116
|
+
bracketDepth -= 1;
|
|
1117
|
+
continue;
|
|
1118
|
+
}
|
|
1119
|
+
if (bracketDepth === 0 && character === "{") {
|
|
1120
|
+
braceDepth += 1;
|
|
1121
|
+
continue;
|
|
1122
|
+
}
|
|
1123
|
+
if (bracketDepth === 0 && character === "}" && braceDepth > 0) {
|
|
1124
|
+
braceDepth -= 1;
|
|
1125
|
+
continue;
|
|
1126
|
+
}
|
|
1127
|
+
if (character !== "," || braceDepth > 0 || bracketDepth > 0) {
|
|
1128
|
+
continue;
|
|
1129
|
+
}
|
|
1130
|
+
const filter = value.slice(start, index).trim();
|
|
1131
|
+
if (filter.length > 0) {
|
|
1132
|
+
filters.push(filter);
|
|
1133
|
+
}
|
|
1134
|
+
start = index + 1;
|
|
1135
|
+
}
|
|
1136
|
+
const finalFilter = value.slice(start).trim();
|
|
1137
|
+
if (finalFilter.length > 0) {
|
|
1138
|
+
filters.push(finalFilter);
|
|
1139
|
+
}
|
|
1140
|
+
return filters;
|
|
891
1141
|
}
|
|
892
1142
|
function appendValue(existing, value, option) {
|
|
893
1143
|
const normalized = value.trim();
|