graphify
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesegraphify — Code Navigation Layer
graphify — 代码导航层
Structural index of the codebase. Know what exists, where, and how it connects — before you grep.
Requires CLI: (uses Bun runtime).
npm i -g graphify-tsAuto-update recommended: Run once. After that, the graph updates automatically at the end of every Claude Code session via a Stop hook — the agent never needs to remember.
graphify hook install代码库的结构化索引。在你使用grep搜索前,就能了解存在什么代码、位置在哪里、代码之间如何关联。
需要安装CLI: (使用Bun运行时)。
npm i -g graphify-ts推荐开启自动更新: 只需运行一次,之后每次Claude Code会话结束时,Stop钩子会自动更新图结构,Agent无需手动执行更新操作。
graphify hook installFirst-time setup (one-time per machine)
首次设置(每台机器仅需一次)
bash
npm i -g graphify-ts # install CLI
graphify hook install # install Stop hook for auto-updateThen, once per project:
bash
graphify build .After that, the graph stays in sync automatically. The agent just needs to query it.
bash
npm i -g graphify-ts # 安装CLI
graphify hook install # 安装Stop钩子实现自动更新之后每个项目首次执行:
bash
graphify build .执行完成后,图结构会自动保持同步,Agent只需查询即可。
Commands
命令
/graphify build
— Build index (first time only)
/graphify build/graphify build
— 构建索引(仅首次使用)
/graphify buildbash
graphify build .Scans all source files, extracts AST structure, saves to .
graphify-out/graph.jsonReport: "Indexed {files} files, {nodes} symbols, {edges} relationships"
bash
graphify build .扫描所有源文件,提取AST结构,保存到。
graphify-out/graph.json报告信息:"已索引 {files} 个文件,{nodes} 个符号,{edges} 个关联关系"
/graphify query <name>
— Search for symbols
/graphify query <name>/graphify query <name>
— 搜索符号
/graphify query <name>bash
graphify query graphify-out/graph.json <name>Case-insensitive search. Returns matching symbols with file locations.
bash
graphify query graphify-out/graph.json <name>不区分大小写的搜索,返回匹配的符号及其文件位置。
/graphify update <files...>
— Manual incremental update
/graphify update <files...>/graphify update <files...>
— 手动增量更新
/graphify update <files...>bash
graphify update graphify-out/graph.json <file1> [file2...]Re-extract only the specified files. You usually don't need this — the Stop hook handles updates automatically. Use this only when the hook isn't installed or you want to force a sync mid-session.
bash
graphify update graphify-out/graph.json <file1> [file2...]仅重新提取指定文件的结构。通常不需要使用此命令 — Stop钩子会自动处理更新。仅当未安装钩子或需要在会话中途强制同步时使用。
/graphify auto-update
— Auto-update (hook internal)
/graphify auto-update/graphify auto-update
— 自动更新(钩子内部调用)
/graphify auto-updatebash
graphify auto-update [dir]Computes changed code files via + untracked files, then calls . Silent when there's nothing to do. This is what the Stop hook runs — you don't call it directly.
git diffupdateIndexbash
graphify auto-update [dir]通过计算变更的代码文件+未跟踪文件,然后调用,无变更时静默执行。这是Stop钩子运行的命令,无需直接调用。
git diffupdateIndex/graphify hook install | uninstall | status
— Manage the Stop hook
/graphify hook install | uninstall | status/graphify hook install | uninstall | status
— 管理Stop钩子
/graphify hook install | uninstall | statusbash
graphify hook install # enable auto-update at session end
graphify hook uninstall # disable
graphify hook status # check current stateThe hook writes to , preserving all existing config.
~/.claude/settings.jsonbash
graphify hook install # 开启会话结束时自动更新
graphify hook uninstall # 关闭自动更新
graphify hook status # 查看当前钩子状态钩子会写入,保留所有现有配置。
~/.claude/settings.jsonWhen to Use
使用场景
Before searching code: If exists, query it before Glob or Grep. The graph tells you which files contain which symbols. This is the main value — replace blind keyword search with structured lookup.
graphify-out/graph.jsonYou do NOT need to manually update after editing. The Stop hook handles it. Just do your work — the graph will be current next time you query it.
Exploring unfamiliar code: Run to find entry points without guessing filenames.
/graphify query <concept>搜索代码前: 如果存在,先查询该文件再使用Glob或Grep。图结构会告知你哪些文件包含哪些符号,核心价值是用结构化查找替代盲目的关键词搜索。
graphify-out/graph.json编辑文件后无需手动更新: Stop钩子会处理更新,正常工作即可,下次查询时图结构已是最新版本。
探索不熟悉的代码库: 运行即可找到入口点,无需猜测文件名。
/graphify query <概念>Supported Languages
支持的语言
Python, JavaScript, TypeScript (JSX/TSX), Go, Rust, Java, C, C++, Ruby, C#, Kotlin, Scala, PHP
Python, JavaScript, TypeScript (JSX/TSX), Go, Rust, Java, C, C++, Ruby, C#, Kotlin, Scala, PHP
Graph Output
图输出结果
Saved as :
graphify-out/graph.jsonjson
{
"nodes": [{ "id": "main::app", "label": "App", "sourceFile": "main.py", "sourceLocation": "main.py:5" }],
"edges": [{ "source": "file::main", "target": "main::app", "relation": "contains", "confidence": "EXTRACTED" }],
"metadata": { "files": 10, "nodes": 45, "edges": 62 }
}Edge relations: , , , , (INFERRED),
containsmethodimportsimports_fromcallsinherits保存为:
graphify-out/graph.jsonjson
{
"nodes": [{ "id": "main::app", "label": "App", "sourceFile": "main.py", "sourceLocation": "main.py:5" }],
"edges": [{ "source": "file::main", "target": "main::app", "relation": "contains", "confidence": "EXTRACTED" }],
"metadata": { "files": 10, "nodes": 45, "edges": 62 }
}边关联类型:, , , , (INFERRED),
containsmethodimportsimports_fromcallsinherits