codegraph # 跑互動安裝器
codegraph install # 跑安裝器(明確指令)
codegraph uninstall # 從你的 agent 移除 CodeGraph,也移除 CLI(--keep-cli 只移除設定)
codegraph init [path] # 初始化專案 + 建圖(一步完成)
codegraph uninit [path] # 從專案移除 CodeGraph(--force 略過確認)
codegraph index [path] # 全量索引(--force 重跑,--quiet 少輸出)
codegraph sync [path] # 增量更新
codegraph status [path] # 顯示統計
codegraph unlock [path] # 移除阻擋索引的過期 lock 檔
codegraph query <search> # 依名稱搜尋符號(--kind、--limit、--json)
codegraph explore <query> # 相關符號原始碼 + 呼叫路徑一次拿(= codegraph_explore MCP 工具)
codegraph node <symbol|file> # 單一符號原始碼 + caller,或帶行號讀檔
codegraph files [path] # 顯示檔案結構(--format、--filter、--max-depth、--json)
codegraph callers <symbol> # 找誰呼叫某函式(--limit、--json)
codegraph callees <symbol> # 找某函式呼叫誰(--limit、--json)
codegraph impact <symbol> # 分析改動影響(--depth、--json)
codegraph affected [files...] # 找受改動影響的測試檔
codegraph daemon # 管理背景 daemon(別名:daemons)
codegraph telemetry [on|off] # 顯示或改匿名使用統計
codegraph upgrade [version] # 更新到最新(--check、--force)
codegraph version # 印出版本(-v、--version)
codegraph help [command] # 顯示說明
傳遞式追蹤 import 依賴,找出「改動的原始檔」影響哪些測試檔:
codegraph affected src/utils.ts src/api.ts # 傳檔名
git diff --name-only | codegraph affected --stdin # 從 git diff 管線輸入
codegraph affected src/auth.ts --filter "e2e/*" # 自訂測試檔 pattern
| Option | 說明 | 預設 |
|---|---|---|
--stdin | 從 stdin 讀檔名清單 | false |
-d, --depth <n> | 最大依賴遍歷深度 | 5 |
-f, --filter <glob> | 自訂識別測試檔的 glob | auto-detect |
-j, --json | 輸出 JSON | false |
-q, --quiet | 只輸出檔路徑 | false |
#!/usr/bin/env bash
AFFECTED=$(git diff --name-only HEAD | codegraph affected --stdin --quiet)
if [ -n "$AFFECTED" ]; then
npx vitest run $AFFECTED
fiSearch Results for "ExtractionOrchestrator":
class ExtractionOrchestrator
src/extraction/index.ts:1435
method constructor
src/extraction/index.ts:1446
(rootDir: string, queries: QueryBuilder)
method indexFiles
src/extraction/index.ts:2114
(filePaths: string[]): Promise<IndexResult>
method indexFile
src/extraction/index.ts:2161
(relativePath: string): Promise<ExtractionResult>
Callers of "buildContext" (3):
method buildContext
src/index.ts:1842
file context-ranking.test.ts
__tests__/context-ranking.test.ts:1
file context.test.ts
__tests__/context.test.ts:1
Impact of changing "GraphTraverser" — 39 affected symbols:
src/graph/traversal.ts
class GraphTraverser:34
method traverseBFS:48
method traverseDFS:154
method getCallers:261
method getCallersRecursive:270
method getCallees:319
method getTypeHierarchy:412
method getImpactRadius:520
method findPath:617
...(共 39 個受影響符號)
Project Structure (570 files):
├── __tests__
├── .github
├── assets
├── codegraph-kernel
├── scripts
├── site
├── src
├── telemetry-dashboard
├── telemetry-worker
└── vitest.config.ts (typescript, 2 symbols)