@hilariouhiss/dsh-codegraph 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 +3 -11
- package/lib/index.js +14 -4
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -50,22 +50,14 @@ dsh plugin --profile web remove @hilariouhiss/dsh-codegraph
|
|
|
50
50
|
|
|
51
51
|
## 已知问题与限制
|
|
52
52
|
|
|
53
|
-
当前实现是「MCP server 直连 +
|
|
53
|
+
当前实现是「MCP server 直连 + 动态引导」的最小可行集成,已知有以下问题:
|
|
54
54
|
|
|
55
|
-
1.
|
|
55
|
+
1. **模型仍需手动传 `projectPath`(部分缓解)**:DSH 宿主是单实例、多会话(多工作区),而 mcp-client 的 `cwd` 是宿主面静态配置(`process.cwd()`)。`codegraph_explore` 无法默认指向「当前会话工作区」,模型每次调用仍要自己填 `projectPath`。引导文本现已**动态注入当前会话工作区的绝对路径**,降低漏填/填错概率;但工具本身仍未自动注入。理想做法是包装一个能自动注入会话 `cwd` 的工具,或让 server 按会话定位项目。
|
|
56
56
|
|
|
57
57
|
2. **自动同步只覆盖 server 默认目录的项目**:codegraph 的文件 watcher 只持续监视 MCP server 启动 `cwd` 对应的项目;经 `projectPath` 查询的其它项目没有持续 watcher,索引不会随编辑自动刷新,需手动 `codegraph sync` 保持最新(本插件未做任何同步封装)。
|
|
58
58
|
|
|
59
59
|
3. **不自动建索引**:每个项目必须手动 `codegraph init` 一次;插件不代建。未初始化时工具返回「无索引」引导而非真实结果。
|
|
60
60
|
|
|
61
|
-
4. **依赖全局 `codegraph` CLI**:插件只负责连 MCP,不安装、不校验 `codegraph`。若未全局安装,mcp-client 启动失败并重试后静默注销工具,模型看不到原因(只能查 DSH 日志)。
|
|
62
|
-
|
|
63
|
-
5. **引导是静态文本**:`systemPrompt.section` 只能写死「传 `projectPath` = 你的工作区」,无法把当前工作区的绝对路径动态注入提示词。
|
|
64
|
-
|
|
65
|
-
6. **未端到端验证**:尚未在真实 profile 里走完 `dsh plugin add` → 重启 → 实际调用 `mcp__codegraph__codegraph_explore` 的闭环(当前仅单元测试 + 按 codegraph 官方 stdio 配置对齐)。
|
|
66
|
-
|
|
67
|
-
7. **遥测默认开启**:codegraph 的匿名遥测默认开(不采集代码/路径/查询内容);本插件未关闭。可用 `codegraph telemetry off` 或环境变量 `CODEGRAPH_TELEMETRY=0` 关闭。
|
|
68
|
-
|
|
69
61
|
## 开发
|
|
70
62
|
|
|
71
63
|
```powershell
|
|
@@ -97,4 +89,4 @@ npm publish # publishConfig.access 已设为 public
|
|
|
97
89
|
|
|
98
90
|
本插件为 MIT 许可。它只通过 MCP 连接外部的 `codegraph` CLI,未内置 codegraph 源码;codegraph 本身来自 [colbymchenry/codegraph](https://github.com/colbymchenry/codegraph)(© Colby McHenry,MIT,其自身许可见上游仓库)。
|
|
99
91
|
|
|
100
|
-
>
|
|
92
|
+
> `@deepseek-ai/dsh-mcp-client` 由**正在运行的 dsh 安装**提供,本包只在 `peerDependencies` 里声明(`devDependencies` 供本仓测试)。**不要**把它写进 `dependencies` —— 那会让 pnpm 往 profile 里塞一份自己的副本,遮蔽安装目录里的同名包,两代混装会让整棵插件树启动失败。升级 dsh 后先跑 `node ../scripts/smoke-profile.mjs` 再发版。
|
package/lib/index.js
CHANGED
|
@@ -9,9 +9,14 @@ const GUIDANCE = [
|
|
|
9
9
|
"call `mcp__codegraph__codegraph_explore` directly instead of grepping or reading files one by one; ",
|
|
10
10
|
"it returns the relevant symbols' source, call paths, and impact in one call. ",
|
|
11
11
|
"Always pass `projectPath` as the workspace directory you are working in (or a subdirectory that has a `.codegraph/` index). ",
|
|
12
|
-
"If the tool reports no index, tell the user to run `codegraph init` in that project first.",
|
|
12
|
+
"If the tool reports no index, tell the user to run `codegraph init` in that project first. ",
|
|
13
|
+
"If the `mcp__codegraph__*` tool is not listed, the codegraph CLI is not installed or failed to start — check the DSH host logs.",
|
|
13
14
|
].join("");
|
|
14
15
|
|
|
16
|
+
function guidanceFor(cwd) {
|
|
17
|
+
return `${GUIDANCE} Current workspace: ${cwd}; pass it as \`projectPath\`.`;
|
|
18
|
+
}
|
|
19
|
+
|
|
15
20
|
/**
|
|
16
21
|
* Stdio config for the CodeGraph MCP server. `command` resolves `codegraph`
|
|
17
22
|
* from the DSH host process's PATH (installed globally), and `cwd` is only the
|
|
@@ -36,10 +41,15 @@ export function codegraphConfig(cwd = process.cwd()) {
|
|
|
36
41
|
|
|
37
42
|
/**
|
|
38
43
|
* DSH plugin entry point. Loads the DSH MCP client bridge for the CodeGraph
|
|
39
|
-
* server (registering `mcp__codegraph__*` tools globally) and injects
|
|
40
|
-
*
|
|
44
|
+
* server (registering `mcp__codegraph__*` tools globally) and injects usage
|
|
45
|
+
* guidance whose text carries the current session's workspace path, so agents
|
|
46
|
+
* prefer it and pass the right `projectPath`.
|
|
41
47
|
*/
|
|
42
48
|
export function apply(ctx) {
|
|
43
49
|
ctx.plugin({ inject: mcpClientInject, apply: mcpClientApply }, codegraphConfig());
|
|
44
|
-
ctx.systemPrompt.section({
|
|
50
|
+
ctx.systemPrompt.section({
|
|
51
|
+
name: "codegraph:guidance",
|
|
52
|
+
order: 100,
|
|
53
|
+
text: (context) => guidanceFor(context.scope?.session?.header?.cwd ?? process.cwd()),
|
|
54
|
+
});
|
|
45
55
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hilariouhiss/dsh-codegraph",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "CodeGraph — semantic code intelligence (MCP) for DeepSeek Harness. Adds codegraph_explore so agents answer structural code questions from a pre-built code graph.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|
|
@@ -36,8 +36,11 @@
|
|
|
36
36
|
"README.md",
|
|
37
37
|
"LICENSE"
|
|
38
38
|
],
|
|
39
|
-
"
|
|
40
|
-
"@deepseek-ai/dsh-mcp-client": "0.1.
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"@deepseek-ai/dsh-mcp-client": "^0.1.5-rc.2"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@deepseek-ai/dsh-mcp-client": "0.1.5-rc.2"
|
|
41
44
|
},
|
|
42
45
|
"dsh": {
|
|
43
46
|
"bundle": {
|