JohnXu22786/codegraph
用于代理工具(dsh)的代码知识图谱插件:将符号、调用点和导入索引到SQLite中,通过CLI或stdio MCP工具服务器回答调用/依赖问题。
Project Overview项目介绍
CodeGraph is a code knowledge graph tool that parses a target codebase into a queryable on-disk index. It enables AI agents to answer structural code questions like which functions call a given target, or what modules a given file depends on. It is distributed as a Python package that you can install via pip, either as an editable install for local development or directly run from the repository without installing. It ships with a command-line interface, a Python API, and an MCP-style stdio JSON-RPC 2.0 server that works with any plugin-based agent harness, including DeepSeek Harness.
To use CodeGraph, first navigate to your project directory, run codegraph init to create a starter configuration file, then run codegraph index to build or refresh the graph index. By default, it uses incremental indexing that only re-parses files that have changed since the last build, so it’s very fast for incremental updates. After building the index, you can run queries directly from the CLI to get callers, callees, dependencies, dependents, run full-text searches over code symbols, or get a full transitive impact analysis for any symbol. It is designed for AI coding agents that need structural code context, and developers who want to explore unfamiliar large codebases.
CodeGraph requires Python 3.10 or newer, and has no mandatory third-party dependencies outside the Python standard library and SQLite, which ships with most Python installations. You can optionally install the tree-sitter engine for more precise parse results, which is done by running pip install -e ".[treesitter]" after cloning the repository. It currently supports six popular programming languages: Python, JavaScript, TypeScript, Go, Java, and Rust. It is released under the open-source MIT license, and has a few minor known limitations that only affect edge cases, like the regex engine not distinguishing between code and strings in comments.
CodeGraph 是一个独立的代码知识图谱工具,可将代码库解析为可查询的索引,支持代理回答诸如「谁调用了这个函数」「该模块依赖哪些内容」这类结构性问题,帮助开发者快速理解大型代码库,也可在修改代码前做变更风险筛查。它提供 CLI、Python API 和 MCP 风格的 JSON-RPC 2.0 标准输入输出工具服务端,可被任意基于插件的代理框架加载,同时支持 DSH 集成。
典型使用流程为,先在目标项目根目录初始化配置,然后构建索引,它默认开启增量索引,仅重新解析修改过的文件,删除的文件也会自动清理,之后就可以通过调用图谱查询接口,获取调用关系、依赖关系、全文搜索和变更影响分析结果,也可导出 DOT 或 JSON 格式的图谱用于可视化。适合需要梳理大型项目结构的开发人员,或是需要代码结构信息的 AI 开发代理使用。
CodeGraph 基于 Python 开发,要求 Python 版本不低于 3.10,仅依赖 Python 标准库和 SQLite,可选安装 tree-sitter 获得更精确的解析结果,目前支持 Python、JS/TS、Go、Java、Rust 六种语言,采用 MIT 开源许可。它存在一些已知限制,比如正则解析引擎不区分字符串和注释,跨文件调用解析依赖启发式规则,部分动态调用无法解析。
请帮我安装这个 DSH 插件。安装前先完成【兼容性检查 + 安全性检查】,检查通过再动手。
插件:codegraph(JohnXu22786/codegraph)
仓库:https://github.com/JohnXu22786/codegraph
本站详情页:https://www.yhbd.top/plugins/johnxu22786-codegraph/
本站登记:类型 plugin · 归类 原生 DSH 插件 · 许可证 MIT · ⭐ 3 · 最近提交 2026-09-29 · 主语言 Python
按下面顺序执行,每步先把结论告诉我,再进入下一步:
【1 兼容性检查】
① 我这边:DSH 版本、Node 版本、操作系统、当前 profile(web / desktop)。
② 读它的 README、package.json、插件 manifest,列出它要求的 DSH 版本 / Node 版本 / 操作系统 / 外部依赖 / 需要另外先装的运行时。
③ 逐条比对,结论只写「满足 / 不满足 / 未知」三种;不满足的给出可行替代方案。
④ 检查是否和我已装的插件冲突:命令名重复、skill / tool 重名、端口占用、重复注册的 MCP server。
【2 安全性检查】
① 仓库可信度:和上面「本站登记」是否一致;star / fork 数、创建时间、最近提交,是否归档或长期停更。
② 安装脚本:逐行看 package.json 的 preinstall / install / postinstall,以及 install.sh、setup.ps1 之类脚本。出现 curl|bash、下载后直接执行、混淆代码、访问与插件功能无关的域名,立刻停下来告诉我,不要继续装。
③ 依赖:列出新增依赖,标出无人维护、或与知名包拼写近似的可疑包(typosquatting)。
④ 权限与副作用:它会读写哪些目录、访问哪些域名、需要哪些 DSH 权限(filesystem / network / shell / clipboard 等),以及怎么卸载和回滚。
⑤ 如果它要求 sudo / 管理员权限,或权限明显超出功能所需,先停下来问我。
【3 安装】
上面两步没有「不满足」和「高危项」时才执行;用官方推荐方式安装,不要自行提权。
【4 汇报】
用表格输出:检查项 / 结论 / 依据 / 是否需要我决策。拿不准的一律写「未知」并说明要我怎么确认——不要猜,也不要替我决定。
Send this message to DSH in your current session: it verifies compatibility and security first (answering met / not met / unknown item by item) and only installs once everything checks out — it will stop and ask you if it finds a high-risk item. The box scrolls; the copy is the full prompt. CLI install commands may not be accurate across systems, so DSH is the safer route.把上面这条消息直接发给当前会话里的 DSH:它会先核对兼容性与安全性(逐条给「满足 / 不满足 / 未知」),确认没问题再安装,有高危项会停下来问你。框内可滚动,复制到的是完整提示词;安装命令不一定准确,发给 DSH 更稳。
- Only 3 stars - very few users, little community feedback星标只有 3,几乎没人在用,遇到问题缺少社区反馈
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 demo add github:JohnXu22786/codegraph
把 JohnXu22786/codegraph 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
CodeGraph
A code knowledge graph plugin: parses a codebase into a queryable index, so agents can answer structural questions like "who calls this function" or "what does this module depend on". Good for quickly understanding large codebases, or as a risk-screening tool before making changes.
Self-contained implementation: Python standard library + SQLite, no mandatory third-party dependencies. Ships a CLI, a Python API, and a stdio tool server (MCP-style JSON-RPC 2.0) that any plugin-based harness can load as a subprocess.
Features
- Call graph:
callers/callees— who calls a given function/method, and what it calls - Dependency graph:
deps/dependents— what a module or file imports and who imports it (internal resolution vs. external dependencies) - Full-text search:
search— local full-text search over symbol names, docstrings and signatures (SQLite FTS5, no external service) - Impact analysis:
impact— transitive closure listing "who would be affected if this symbol changed" - Incremental indexing: content-hash comparison re-parses only changed files; deleted files are cleaned up automatically
- Visualization export:
export dot|json— Graphviz DOT / JSON, ready to drop into visualization tools - Query cache: the tool server caches read-only queries with a 30-second TTL
- Two parse engines: tree-sitter (precise, optional install) and a regex scanner (zero-dependency fallback), chosen automatically
How it works
file discovery (include/exclude/size limit)
→ syntax extraction (symbols, call sites, import statements)
→ SQLite storage (files / symbols / calls / imports + FTS5)
→ cross-file resolution (call targets → symbols, imports → files)
→ queries (CLI / tool server / Python API)
Cross-file resolution is heuristic and tries, in priority order: exact match in the same file → files reachable by import → same package/module family → globally unique name. Call sites that fail to resolve keep their raw text and are marked unresolved (external code, standard library, third-party packages).
Installation
# Option A: install as a Python package (provides the codegraph command)
pip install -e .
# Optional: install tree-sitter grammar packages for markedly better parse precision
pip install -e ".[treesitter]"
Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →
ruvnet/ruflo
mnemon-dev/mnemon
syncable-dev/memtrace-public
huiliyi37/dsh-tianshu-tui
xiehuan123/dsh-deepread
PerryLink/dsh-plugin-guide
MnemosyneOS/mnemosyne
geml-spec/geml