jiangzhenguo/dsh-codegraph

Project Overview项目介绍

This is a native DSH bundle plugin that wraps the independent CodeGraph CLI tool, exposing its pre-indexed code knowledge graph functionality as LLM-callable tools inside DSH sessions. Users can install the plugin directly via DSH's built-in plugin manager by running the command dsh plugin --profile web add github:jiangzhenguo/dsh-codegraph, which automatically registers the plugin and requires no manual configuration edits. Before installation, users must first install DSH itself and install the @colbymchenry/codegraph CLI globally via npm, and confirm that the codegraph executable, version 1.0 or higher, is available in the system PATH.

By default, the plugin only registers 4 core tools: codegraph_status, codegraph_init, codegraph_sync, and codegraph_explore, which keeps the model's tool list clean and focused, aligned with upstream testing that shows codegraph_explore is the most reliably called tool. The plugin injects a high-priority instruction into DSH's system prompt, placed before all built-in file tools, which tells the model it must use codegraph tools instead of grep or read for code search. It also implements a prompt trigger system that automatically injects relevant pre-explored codegraph context into the conversation when the user's prompt matches code query keywords or symbols.

Users can configure the plugin via the DSH profile's combination layer to turn off system prompt injection, switch to full tool surface that exposes all 13 codegraph tools, or turn off the automatic context frontload feature. The repository includes a full test harness that runs end-to-end tests of all plugin functionality, all supported configuration combinations, from tool registration to frontload triggering, to ensure expected behavior before deployment. The plugin is released under the open-source permissive MIT license, and users can modify or redistribute it per the license terms.

这是一款专为 DeepSeek Harness (DSH) 开发的原生插件,用于将 @colbymchenry/codegraph CLI 的预索引代码图谱能力包装为大模型可直接调用的原生工具。默认只注册 4 个核心工具来保持工具列表精简,提升模型调用聚焦度,可通过配置开启全量模式开放全部 13 个工具。

本插件会在 DSH 的系统提示词中注入高优先级(order 98,在内置文件工具之前)指引,让模型优先使用 codegraph 工具搜索代码而非原生的 grep、glob 和读取文件。它还支持基于用户提问的结构化上下文前置注入,匹配代码查询类提问时自动预加载相关代码图谱结果到会话上下文。

使用本插件需要预先安装好 DSH 和全局可访问的 codegraph CLI 工具,可通过 DSH 内置的插件管理命令一键安装到指定 profile,无需手动修改配置文件。本插件使用 MIT 许可证开源,支持对指引、工具集、上下文注入等功能进行自定义配置。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 note1 项提示
  • 12 stars - an early-stage project星标 12,属于早期项目
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add github:jiangzhenguo/dsh-codegraph

把 jiangzhenguo/dsh-codegraph 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-codegraph

让 DSH 会话直接使用 CodeGraph (@colbymchenry/codegraph)的预索引代码知识图谱能力。

这是一个可一键安装的 DSH 插件(bundle):它把 codegraph CLI 包装成 模型可见的原生工具,模型在分析代码时无需 grep/读大量文件,直接按符号、 按区域、按调用链查询索引,并能自举并维护索引(init/index/sync)。

工具面(surface):借鉴上游项目「codegraph_explore 是唯一稳定赢得模型调用的工具」 的实测结论(其官方 MCP server 默认只暴露 explore),本插件默认只注册 4 个核心工具 (codegraph_status / codegraph_init / codegraph_sync / codegraph_explore), 保持模型工具列表精简、引导集中。需要全部 13 个工具时,在组合层配置 surface: 'full'(见下文「配置」)。

提供的工具

工具 对应 CLI 用途
codegraph_status status --json 索引状态(是否已初始化、版本、文件/节点/边数、待同步变更、建议重建等)
codegraph_init init 初始化项目并建立初始索引(.codegraph/)
codegraph_index index 全量(重)索引;status 建议 reindex 时用
codegraph_sync sync 增量同步索引(改代码后调用,让查询反映新代码)
codegraph_uninit uninit -f 删除项目索引
codegraph_query query --json 按名称/子串搜索符号,返回结构化 JSON
codegraph_node node 单个符号源码 + 调用/被调用轨迹,或带行号读文件 + 依赖
codegraph_explore explore 自然语言探索一块代码区域,直接返回相关文件源码与调用路径
codegraph_files files --json 索引内的项目文件结构
codegraph_callers callers --json 谁调用了某个符号
codegraph_callees callees --json 某个符号调用了什么
codegraph_impact impact --json 改动某个符号会波及哪些代码(重构/改名前用)
codegraph_affected affected --json 改动若干源文件后应运行哪些测试文件

工具名与 CodeGraph 官方 MCP 工具同名,模型的使用心智与官方文档一致。

前置要求

  1. 已安装 DSH(本插件为 DSH bundle,随 DSH web 应用装载)。

    支持的 DSH 版本:0.1.x 与 0.2.x(含 0.2.0),两条线共用同一份代码。 插件使用的接口在本插件所覆盖的范围内跨版本稳定:defineTool(name/description/ parameters/output/execute/presentCall/timeoutMs)、tools.register()、 systemPrompt.section()、createUserMessage、ctx.get('subprocess' | 'shell'), 以及 agent/inbox/inserted 事件 + agent.steer()。

    ⚠️ 安装门槛在 peerDependencies 上,不在代码里。 DSH 0.2.0 起会在安装前校验本包 peerDependencies 中每个 @deepseek-ai/dsh* 范围:若当前 DSH 版本不满足 semver.satisfies(v, range, { includePrerelease: true }),dsh plugin add 会直接拒绝安装 (报 incompatible-version)。因此本插件的上限是 <0.3.0-0 而非 <0.2.0-0—— 后者会把所有 0.2.x 预发布版一并排除。若从 1.1.0 及更早版本升级,请一并更新插件。

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-oomol 下一个 Next internalcot →