@hilariouhiss/dsh-colgrep 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/lib/index.js +12 -3
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
行为要点:
|
|
29
29
|
|
|
30
|
-
- 结果以 `--json` 解析后折叠为紧凑可读文本(`文件:行-行 [语言, 类型, 名称] (score)` + 首行签名),不倾倒整段代码;模型可再 `read`
|
|
30
|
+
- 结果以 `--json` 解析后折叠为紧凑可读文本(`文件:行-行 [语言, 类型, 名称] (score)` + 首行签名),不倾倒整段代码;模型可再 `read` 具体文件。解析兼容顶层数组与 `{results:[...]}` 两种 JSON 形状;`query` 为空或纯空白时返回明确错误。
|
|
31
31
|
- **索引重定位**:DSH 文件沙箱禁止写工作区之外,而 colgrep 检索需要写索引锁文件。插件把索引目录重定位到 `<工作区>/.colgrep-data`(通过 `COLGREP_DATA_DIR`),使全部写入落在沙箱允许范围内。ColBERT 模型与 ONNX runtime 从 `~/.cache` 只读加载,无需联网。
|
|
32
32
|
- 首次检索会自动建立索引(CPU 上大仓库可能需数分钟);可用 `command:"init"` 显式建索引,`no_update:true` 走现有索引。
|
|
33
33
|
|
|
@@ -90,4 +90,4 @@ npm publish # publishConfig.access 已设为 public
|
|
|
90
90
|
|
|
91
91
|
本插件为 MIT 许可。它只调用外部的 `colgrep` CLI,未内置 colgrep 源码;colgrep 本身来自 [lightonai/next-plaid](https://github.com/lightonai/next-plaid)(© LightOn,其自身许可见上游仓库)。
|
|
92
92
|
|
|
93
|
-
>
|
|
93
|
+
> `@deepseek-ai/dsh-tools` 由**正在运行的 dsh 安装**提供,本包只在 `peerDependencies` 里声明(`devDependencies` 供本仓测试)。**不要**把它写进 `dependencies` —— 那会让 pnpm 往 profile 里塞一份自己的副本,遮蔽安装目录里的同名包,两代混装会让整棵插件树启动失败。升级 dsh 后先跑 `node ../scripts/smoke-profile.mjs` 再发版。
|
package/lib/index.js
CHANGED
|
@@ -20,6 +20,9 @@ export function buildArgs(args) {
|
|
|
20
20
|
const command = args.command || "search";
|
|
21
21
|
const argv = ["colgrep"];
|
|
22
22
|
if (command === "search") {
|
|
23
|
+
if (typeof args.query !== "string" || args.query.trim() === "") {
|
|
24
|
+
throw new Error("query must be a non-empty string");
|
|
25
|
+
}
|
|
23
26
|
argv.push("--json", "--color", "never", "-y");
|
|
24
27
|
if (args.no_update) argv.push("--no-update");
|
|
25
28
|
argv.push("-k", String(args.top_k ? Number(args.top_k) : 15));
|
|
@@ -77,7 +80,7 @@ export function renderOutput(value) {
|
|
|
77
80
|
}
|
|
78
81
|
});
|
|
79
82
|
} else if (value.command === "search") {
|
|
80
|
-
lines.push(
|
|
83
|
+
lines.push(value.ok ? "colgrep search returned unparseable output (ok=true)" : "colgrep search failed (ok=false)");
|
|
81
84
|
if (value.stderr) lines.push(`[stderr]\n${value.stderr}`);
|
|
82
85
|
else if (value.stdout) lines.push(`[stdout]\n${value.stdout}`);
|
|
83
86
|
} else {
|
|
@@ -144,10 +147,16 @@ export function apply(ctx) {
|
|
|
144
147
|
} catch {
|
|
145
148
|
parsed = null;
|
|
146
149
|
}
|
|
150
|
+
let results = null;
|
|
147
151
|
if (Array.isArray(parsed)) {
|
|
148
|
-
|
|
152
|
+
results = normalizeResults(parsed);
|
|
153
|
+
} else if (parsed && typeof parsed === "object" && Array.isArray(parsed.results)) {
|
|
154
|
+
results = normalizeResults(parsed.results);
|
|
149
155
|
}
|
|
150
|
-
|
|
156
|
+
if (results === null) {
|
|
157
|
+
return { ...common, query: args.query, results: null, stdout, stderr };
|
|
158
|
+
}
|
|
159
|
+
return { ...common, query: args.query, count: results.length, results };
|
|
151
160
|
},
|
|
152
161
|
}));
|
|
153
162
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hilariouhiss/dsh-colgrep",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "colgrep — semantic code search (ColBERT multi-vector) for DeepSeek Harness. Adds a `colgrep` tool that finds code by meaning, not exact text.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|
|
@@ -36,8 +36,11 @@
|
|
|
36
36
|
"README.md",
|
|
37
37
|
"LICENSE"
|
|
38
38
|
],
|
|
39
|
-
"
|
|
40
|
-
"@deepseek-ai/dsh-tools": "0.1.
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"@deepseek-ai/dsh-tools": "^0.1.5-rc.2"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@deepseek-ai/dsh-tools": "0.1.5-rc.2"
|
|
41
44
|
},
|
|
42
45
|
"dsh": {
|
|
43
46
|
"bundle": {
|