@sdsrs/code-graph 0.73.1 → 0.74.1
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/claude-plugin/.claude-plugin/plugin.json +1 -1
- package/claude-plugin/scripts/adopt.js +268 -223
- package/claude-plugin/scripts/adopt.test.js +357 -648
- package/claude-plugin/scripts/session-init.js +18 -10
- package/claude-plugin/templates/plugin_code_graph_mcp.md +12 -9
- package/package.json +6 -6
|
@@ -33,17 +33,17 @@ function computeQuietHooks({ env = {} } = {}) {
|
|
|
33
33
|
// SessionStart project-map injection gate. Beyond the (already default-quiet)
|
|
34
34
|
// verbose opt-in, the map is now also ADOPTED-ONLY: cross-project measurement
|
|
35
35
|
// (memory cross-project-interference) found the ≈2 KB dump is zero-referenced
|
|
36
|
-
// in projects the user hasn't adopted
|
|
37
|
-
// earns its standing-context cost for adopted projects. Unadopted projects
|
|
38
|
-
// no map even under CODE_GRAPH_VERBOSE_HOOKS / legacy QUIET_HOOKS=0.
|
|
36
|
+
// in projects the user hasn't adopted (no code-graph block in CLAUDE.md), so it
|
|
37
|
+
// only earns its standing-context cost for adopted projects. Unadopted projects
|
|
38
|
+
// get no map even under CODE_GRAPH_VERBOSE_HOOKS / legacy QUIET_HOOKS=0.
|
|
39
39
|
function shouldInjectMap({ available, quietHooks, adopted } = {}) {
|
|
40
40
|
return !!(available && !quietHooks && adopted);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
// v0.63 — SessionStart "live context": the recent-change blast radius from the
|
|
44
44
|
// AST index. UNLIKE injectProjectMap (default-OFF because the static module map
|
|
45
|
-
// duplicates
|
|
46
|
-
// derived — it changes every session and
|
|
45
|
+
// duplicates the CLAUDE.md block + the on-demand project_map tool), this is git-delta-
|
|
46
|
+
// derived — it changes every session and the static CLAUDE.md block cannot carry it, so it earns
|
|
47
47
|
// being ON by default for adopted projects. It is the graph-unique, actionable
|
|
48
48
|
// counterpart to mem's SessionStart dashboard (which pushes recent activity to
|
|
49
49
|
// create engagement). Selectivity is automatic: a session with no recently
|
|
@@ -455,19 +455,27 @@ function runSessionInit({ source } = {}) {
|
|
|
455
455
|
const autoUpdateLaunched = launchBackgroundAutoUpdate();
|
|
456
456
|
const indexFreshness = binaryCheck.available ? ensureIndexFresh() : 'skipped';
|
|
457
457
|
|
|
458
|
-
//
|
|
459
|
-
//
|
|
460
|
-
//
|
|
458
|
+
// 上下文感知默认:插件模式下首次 SessionStart 自动安装(创建/注入 CLAUDE.md 块 +
|
|
459
|
+
// .claude/ detail 文件),并清理旧 memory-dir 制品(升级自动迁移)。shipped 漂移
|
|
460
|
+
// 时刷新。三种情况发一次 stderr 提示,让用户知道发生了什么 + 如何回退。
|
|
461
461
|
const autoAdopt = isRelic ? { attempted: false, result: null } : maybeAutoAdopt({ scriptPath: __dirname });
|
|
462
|
+
const migrated = autoAdopt.migrated || {};
|
|
463
|
+
if (migrated.memoryIndexPruned || migrated.legacyDetailRemoved) {
|
|
464
|
+
process.stderr.write(
|
|
465
|
+
'[code-graph] Migrated to CLAUDE.md steering — cleaned legacy memory-dir artifacts\n' +
|
|
466
|
+
' (MEMORY.md sentinel + detail file). Your other memories are untouched.\n'
|
|
467
|
+
);
|
|
468
|
+
}
|
|
462
469
|
if (autoAdopt.attempted && autoAdopt.result && autoAdopt.result.ok) {
|
|
463
470
|
if (autoAdopt.reason === 'refreshed') {
|
|
464
471
|
process.stderr.write(
|
|
465
|
-
'[code-graph] Refreshed decision
|
|
472
|
+
'[code-graph] Refreshed CLAUDE.md decision block to latest shipped version.\n' +
|
|
466
473
|
' Lock file: CODE_GRAPH_NO_TEMPLATE_REFRESH=1 in ~/.claude/settings.json env\n'
|
|
467
474
|
);
|
|
468
475
|
} else {
|
|
469
476
|
process.stderr.write(
|
|
470
|
-
'[code-graph]
|
|
477
|
+
'[code-graph] Installed code-graph block into project CLAUDE.md (plugin install → knowing consent).\n' +
|
|
478
|
+
' Detail table: .claude/plugin_code_graph_mcp.md (generated; safe to gitignore)\n' +
|
|
471
479
|
' Opt out: CODE_GRAPH_NO_AUTO_ADOPT=1 in ~/.claude/settings.json env\n' +
|
|
472
480
|
' Reverse: code-graph-mcp unadopt\n'
|
|
473
481
|
);
|
|
@@ -5,15 +5,18 @@ type: reference
|
|
|
5
5
|
---
|
|
6
6
|
# code-graph-mcp 插件契约
|
|
7
7
|
|
|
8
|
-
>
|
|
8
|
+
> 本文件是 code-graph 工具调度细则。项目根 `CLAUDE.md` 里有一个精炼的 managed
|
|
9
|
+
> 块(sentinel 包裹)做路由摘要 + 指针;本完整决策表按需打开,不每会话常驻。
|
|
9
10
|
>
|
|
10
|
-
> **v0.
|
|
11
|
-
>
|
|
11
|
+
> **v0.74 起**:插件(`/plugin install`)模式下首次 SessionStart 自动安装——
|
|
12
|
+
> 在项目根 `CLAUDE.md` 注入/创建 managed 块,并把本文件写到 `.claude/plugin_code_graph_mcp.md`。
|
|
13
|
+
> 旧版(≤v0.73)写到 `~/.claude/projects/<slug>/memory/`(MEMORY.md sentinel + 本文件),
|
|
14
|
+
> 升级后首次 SessionStart 自动清理那些遗留制品(你的其它 memory 不受影响)。
|
|
12
15
|
> 退出:`CODE_GRAPH_NO_AUTO_ADOPT=1` 阻止,`code-graph-mcp unadopt` 回退。
|
|
13
16
|
>
|
|
14
|
-
>
|
|
15
|
-
>
|
|
16
|
-
> 要锁定自己的版本,设 `CODE_GRAPH_NO_TEMPLATE_REFRESH=1
|
|
17
|
+
> 已安装的项目在下次 SessionStart 会自动对齐到插件 shipped 的最新决策表
|
|
18
|
+
> (本文件 / CLAUDE.md 块与 shipped 差异时覆盖)。手动编辑会被覆盖——
|
|
19
|
+
> 要锁定自己的版本,设 `CODE_GRAPH_NO_TEMPLATE_REFRESH=1`(不影响首次安装)。
|
|
17
20
|
>
|
|
18
21
|
> **Hook 默认值(两个 hook,默认不同 —— 故意的)**:
|
|
19
22
|
> - **SessionStart `project_map` 注入:默认 OFF**(v0.17.0 起)。本文件 + 7 个
|
|
@@ -139,9 +142,9 @@ code-graph-mcp health-check # 索引健康
|
|
|
139
142
|
|
|
140
143
|
## 卸载 / 回退
|
|
141
144
|
|
|
142
|
-
- `code-graph-mcp unadopt` — 精确移除
|
|
143
|
-
- `CODE_GRAPH_NO_AUTO_ADOPT=1`(`~/.claude/settings.json` env) —
|
|
144
|
-
- `CODE_GRAPH_NO_TEMPLATE_REFRESH=1
|
|
145
|
+
- `code-graph-mcp unadopt` — 精确移除 CLAUDE.md 里的 managed 块 + `.claude/plugin_code_graph_mcp.md`(块移光后若 CLAUDE.md 只剩我们的内容则连文件一起删,否则保留你的正文);并清理任何遗留 memory-dir 制品。
|
|
146
|
+
- `CODE_GRAPH_NO_AUTO_ADOPT=1`(`~/.claude/settings.json` env) — 阻止未来自动安装,不影响已安装状态。
|
|
147
|
+
- `CODE_GRAPH_NO_TEMPLATE_REFRESH=1` — 锁定 CLAUDE.md 块 + 本文件不随插件升级刷新;允许手动编辑长久保留。
|
|
145
148
|
- `CODE_GRAPH_VERBOSE_HOOKS=1`(v0.17.0+) — opt in 到 SessionStart `project_map` 注入(默认 OFF)。
|
|
146
149
|
- `CODE_GRAPH_QUIET_HOOKS=1` — UserPromptSubmit context push 的 escape hatch(默认 ON);同时强制 SessionStart `project_map` quiet。
|
|
147
150
|
- `CODE_GRAPH_QUIET_HOOKS=0` — 强制恢复 SessionStart `project_map` 注入(向后兼容路径)。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdsrs/code-graph",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.74.1",
|
|
4
4
|
"description": "MCP server that indexes codebases into an AST knowledge graph with semantic search, call graph traversal, and HTTP route tracing",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"node": ">=16"
|
|
36
36
|
},
|
|
37
37
|
"optionalDependencies": {
|
|
38
|
-
"@sdsrs/code-graph-linux-x64": "0.
|
|
39
|
-
"@sdsrs/code-graph-linux-arm64": "0.
|
|
40
|
-
"@sdsrs/code-graph-darwin-x64": "0.
|
|
41
|
-
"@sdsrs/code-graph-darwin-arm64": "0.
|
|
42
|
-
"@sdsrs/code-graph-win32-x64": "0.
|
|
38
|
+
"@sdsrs/code-graph-linux-x64": "0.74.1",
|
|
39
|
+
"@sdsrs/code-graph-linux-arm64": "0.74.1",
|
|
40
|
+
"@sdsrs/code-graph-darwin-x64": "0.74.1",
|
|
41
|
+
"@sdsrs/code-graph-darwin-arm64": "0.74.1",
|
|
42
|
+
"@sdsrs/code-graph-win32-x64": "0.74.1"
|
|
43
43
|
}
|
|
44
44
|
}
|