Skip to content

Commit 1f328b9

Browse files
committed
merge: preserve published CodeGraph implementation and native integration specifications
2 parents 56e1e5e + 8c0902f commit 1f328b9

51 files changed

Lines changed: 453 additions & 233 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.agents/plugins/marketplace.json‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@
99
"source": {
1010
"source": "url",
1111
"url": "https://github.com/full-stack-plugins/codegraph-plugin.git",
12-
"ref": "v0.1.6"
12+
"ref": "v0.2.0"
1313
},
1414
"policy": {
1515
"installation": "AVAILABLE",
1616
"authentication": "ON_USE"
1717
},
1818
"category": "Developer Tools",
19-
"version": "0.1.6",
20-
"description": "Inject the official CodeGraph prompt at session start (only when a `.codegraph/` directory exists) and expose all 20 codegraph CLI commands as slash commands for Codex/ZCode/Kimi/Claude Code. Pure Python stdlib.",
21-
"icon": "https://cdn.jsdelivr.net/gh/full-stack-plugins/codegraph-plugin@v0.1.6/assets/official-logo.png",
19+
"version": "0.2.0",
20+
"description": "Inject the official CodeGraph prompt at session start (only when a `.codegraph/` directory exists) and expose 21 of codegraph's 23 CLI commands as slash commands for Codex/ZCode/Kimi/Claude Code. Pure Python stdlib.",
21+
"icon": "https://cdn.jsdelivr.net/gh/full-stack-plugins/codegraph-plugin@v0.2.0/assets/official-logo.png",
2222
"interface": {
2323
"displayName": "CodeGraph",
24-
"shortDescription": "Discoverable codegraph — official prompt + all CLI commands",
25-
"logo": "https://cdn.jsdelivr.net/gh/full-stack-plugins/codegraph-plugin@v0.1.6/assets/official-logo.png"
24+
"shortDescription": "Discoverable codegraph — official prompt + 21 CLI commands",
25+
"logo": "https://cdn.jsdelivr.net/gh/full-stack-plugins/codegraph-plugin@v0.2.0/assets/official-logo.png"
2626
}
2727
}
2828
]

‎.claude-plugin/plugin.json‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "codegraph",
3+
"version": "0.2.0",
4+
"description": "Inject the official CodeGraph prompt at session start (only when a `.codegraph/` directory exists) and expose 21 of codegraph's 23 CLI commands as slash commands for Codex/ZCode/Kimi/Claude Code. Pure Python stdlib.",
5+
"author": {
6+
"name": "Full Stack Plugins",
7+
"url": "https://github.com/full-stack-plugins"
8+
},
9+
"homepage": "https://github.com/full-stack-plugins/codegraph-plugin",
10+
"repository": "https://github.com/full-stack-plugins/codegraph-plugin",
11+
"license": "Apache-2.0"
12+
}

‎.codex-plugin/plugin.json‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "codegraph",
3-
"version": "0.1.6+codex.20261003",
4-
"description": "Inject the official CodeGraph prompt at session start (only when a `.codegraph/` directory exists) and expose all 20 codegraph CLI commands as slash commands for Codex/ZCode/Kimi/Claude Code. Pure Python stdlib.",
3+
"version": "0.2.0+codex.20261009",
4+
"description": "Inject the official CodeGraph prompt at session start (only when a `.codegraph/` directory exists) and expose 21 of codegraph's 23 CLI commands as slash commands for Codex/ZCode/Kimi/Claude Code. Pure Python stdlib.",
55
"author": {
66
"name": "Full Stack Plugins",
77
"url": "https://github.com/full-stack-plugins"
@@ -19,8 +19,8 @@
1919
"skills": "./skills/",
2020
"interface": {
2121
"displayName": "CodeGraph",
22-
"shortDescription": "Discoverable codegraph — official prompt + all CLI commands",
23-
"longDescription": "Injects the official CodeGraph prompt at SessionStart (only when `.codegraph/` exists). Exposes all 20 codegraph CLI commands as slash commands. Pure Python stdlib.",
22+
"shortDescription": "Discoverable codegraph — official prompt + 21 CLI commands",
23+
"longDescription": "Injects the official CodeGraph prompt at SessionStart (only when `.codegraph/` exists). Exposes 21 of codegraph's 23 CLI commands as slash commands. Pure Python stdlib.",
2424
"developerName": "Full Stack Plugins",
2525
"category": "Developer Tools",
2626
"capabilities": [

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Thumbs.db
1919
*~
2020

2121
# Plugin runtime artifacts (mirror codeguard convention)
22+
.codegraph/
2223
.code-review-graph/
2324
.worktrees/
2425
.artifacts/

‎.zcode-plugin/plugin.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"en": "CodeGraph",
66
"zh-CN": "CodeGraph 代码智能"
77
},
8-
"version": "0.1.6",
9-
"description": "Inject the official CodeGraph prompt at session start (only when a `.codegraph/` directory exists) and expose all 20 codegraph CLI commands as slash commands for Codex/ZCode/Kimi/Claude Code. Pure Python stdlib.",
8+
"version": "0.2.0",
9+
"description": "Inject the official CodeGraph prompt at session start (only when a `.codegraph/` directory exists) and expose 21 of codegraph's 23 CLI commands as slash commands for Codex/ZCode/Kimi/Claude Code. Pure Python stdlib.",
1010
"description_i18n": {
11-
"en": "At SessionStart, when a `.codegraph/` directory exists, this plugin writes the official CodeGraph prompt block to `<cwd>/.claude/CLAUDE.md` or `<cwd>/AGENTS.md`, and injects the same block as SessionStart additionalContext. Exposes all 20 codegraph CLI commands as slash commands.",
11+
"en": "At SessionStart, when a `.codegraph/` directory exists, this plugin writes the official CodeGraph prompt block to `<cwd>/.claude/CLAUDE.md` or `<cwd>/AGENTS.md`, and injects the same block as SessionStart additionalContext. Exposes 21 of codegraph's 23 CLI commands as slash commands.",
1212
"zh-CN": "在 SessionStart 时,当 `.codegraph/` 目录存在,本插件把官方 CodeGraph 提示词块写入 `<cwd>/.claude/CLAUDE.md`(不存在则 `<cwd>/AGENTS.md`),并通过 additionalContext 注入当前会话。同时把 codegraph 全量 20 个 CLI 命令暴露为 slash 命令。"
1313
},
1414
"author": {

‎AGENTS.md‎

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,24 @@
44
- 提示词文本必须 verbatim 同步自 `codegraph/src/installer/instructions-template.ts` 的 `CODEGRAPH_INSTRUCTIONS_BLOCK`(`scripts/codegraph_lib/prompt.py`)。每次 codegraph 升级(CHANGELOG 涉及 `instructions-template.ts`)需要手动重新同步,并在 `references/instructions-block.md` 中核对。
55
- SessionStart 钩子必须 fail-open,任何异常不阻断宿主启动。
66
- Hook 输出 `additionalContext` 内容来自 `prompt.CODEGRAPH_INSTRUCTIONS_BLOCK`,不擅自裁剪或附加额外段落。
7-
- 写 `<cwd>/.claude/CLAUDE.md`(不存在)或 `<cwd>/AGENTS.md`(CLAUDE.md 不存在时)时,使用标记区间替换,原子写、幂等。
7+
- 写宿主 instructions 文件时——`<cwd>/.claude/CLAUDE.md` 存在则用它,否则用 `<cwd>/AGENTS.md`——使用标记区间替换,原子写、幂等。
88
- 不自动创建 `<cwd>/.claude/` 目录——避免插件越权定义用户的 `.claude/` 布局。
99
- 不修改 `codegraph` CLI 自身;本插件只调度 `codegraph` 现有命令。
10-
- Marketplace `description` / `shortDescription` 在三个文件(catalog.json、marketplace.json、kimi-marketplace.json)保持一致;`bump-plugin.mjs --write` 后必须人工复查。
10+
- **不得把上游默认不对 agent 列出的 MCP 工具写成可用的「替代工具」**。上游 `DEFAULT_MCP_TOOLS = ['explore']`,其余 7 个(callers/callees/impact/node/search/files/status)调用会返回 `Tool ... is disabled via CODEGRAPH_MCP_TOOLS` 的 isError;上游 `server-instructions.ts` 亦明文要求「don't name them」。命令与技能文案一律引导走同名 CLI 子命令。由 `tests/test_commands.py::TestMcpToolClaimsMatchUpstream` 守卫。
11+
- Marketplace `description` 在 `catalog.json` 与 `marketplace.json` 两文件保持一致;`shortDescription` 仅 `catalog.json` 有,`kimi-marketplace.json` 的 schema 只有 `id`/`displayName`/`icon`/`source`,不含描述字段。`bump-plugin.mjs --write` 后必须人工复查。
1112

1213
## 版本
1314

14-
- 当前: v0.1.6
15-
- 同步自 codegraph v1.5.0 的 `instructions-template.ts`
15+
- 当前: v0.2.0
16+
- 同步自 codegraph v1.6.0 的 `instructions-template.ts`(0.1.7 重新核对:与上游逐字节一致,805 bytes,无文本漂移)
1617
- Codex 后缀: `<version>+codex.YYYYMMDD`
1718

1819
## 同步自上游
1920

2021
- 升级 codegraph 后:
2122
1. `diff` 比对 `codegraph/src/installer/instructions-template.ts` 与 `scripts/codegraph_lib/prompt.py`
2223
2. 若文本漂移,更新 `prompt.py` 并 bump patch 版本
23-
3. CHANGELOG 记录「prompt 文本与 codegraph vX.Y.Z 同步」
24+
3. 在 `RELEASE-NOTES.md` 与 `RELEASE-NOTES.zh-CN.md` 的 Release history 表记录「prompt 文本与 codegraph vX.Y.Z 同步」——本仓无 `CHANGELOG.md`,发布说明即变更记录
2425
- 不要把上游 `codegraph` 代码 vendor 进本插件;本插件只调度其 CLI。
2526

2627
## 命令目录归属(2026-09-23 生态对照结论)
@@ -29,11 +30,42 @@
2930
- `kimi-commands/*.md`:Markdown 格式命令。**目录名不改**——`kimi-commands/` 是生态约定名(flowguard-plugin 的 `kimi.plugin.json` 即指向 `./kimi-commands/`)。
3031
- **不要**在文档中断言「`.json` 归 Kimi、`.md` 归 Codex」——实测生态内 .md 归属自相矛盾(flowguard 的 .md 用 `KIMI_PLUGIN_ROOT` 归 Kimi;bt/processon 的 `commands/*.md` 带 `argument-hint`/`skills:` frontmatter)。归属待实机验证,文档一律用中性表述「JSON 格式 / Markdown 格式」。
3132

33+
## 命令覆盖(2026-10-09 复核)
34+
35+
codegraph v1.6.0 共 23 个子命令,本插件以 21 个 slash 命令覆盖,除以下 4 个外全覆盖:
36+
37+
| 不暴露 | 原因 |
38+
|---|---|
39+
| `prompt-hook` / `serve --mcp` | codegraph 自家隐藏内部命令 |
40+
| `help` | 宿主自带帮助 |
41+
| `ui` / `web` | 打开浏览器图谱查看器,面向人而非 agent |
42+
43+
`codegraph context`(v1.6.0 新增)在 0.1.7 补齐——v0.1.0 时期的「覆盖全部可见命令」表述在 v1.5.0 时成立,v1.6.0 加入 `context` 后即失效。
44+
45+
## 发现性是本插件的目的(0.2.0 起)
46+
47+
本插件存在的意义是**让智能体自己发现 CodeGraph 并主动引导用户建立索引**,不是只在已索引仓库里被动待命。因此:
48+
49+
- `codegraph-helper` 的 frontmatter `description` **不得**以「仓库根有 `.codegraph/` 目录时使用」作为激活门槛。若这样写,未索引仓库里技能根本不触发,其「未索引则提示用户」分支永远执行不到——这是 v0.1.x 的一个真实缺陷,0.2.0 已解除。
50+
- 技能的行为契约:**先检查 → 已索引就用 CodeGraph 回答 / 未索引就主动提示并征得同意 → 同意后跑 `codegraph init`**。不得因为「索引是用户决策」就当没看见。
51+
- **SessionStart 钩子保持静默**:上游注入块原文写着 "If there is no `.codegraph/` directory, skip CodeGraph entirely — indexing is the user's decision."(见 `prompt.CODEGRAPH_INSTRUCTIONS_BLOCK`)。钩子若在未索引时发「你该去索引」的提示,等于自我否定刚 verbatim 注入的块,违反上方 L6。未索引场景由技能的「检查 + 提示」通路兜底。
52+
53+
## `init` 与 `install` 的边界
54+
55+
两者都是用户的决策,但性质不同,不可混为一谈:
56+
57+
| 命令 | 副作用 | 插件立场 |
58+
|---|---|---|
59+
| `codegraph init` | 在仓库根写 `.codegraph/`,项目内、可重建 | **主动检查 + 主动提示**;征得同意后可代跑 |
60+
| `codegraph install` | 改用户全局 MCP 配置,跨项目、影响宿主 | **不代劳**,仅通过 `/codegraph-install` 引导 |
61+
62+
判断标准是副作用的作用域与可逆性,不是「谁做决定」。
63+
3264
## 不做的事
3365

34-
- 不暴露 `codegraph prompt-hook` / `codegraph serve --mcp`(codegraph 自家隐藏命令)
66+
- 不暴露 `codegraph prompt-hook` / `codegraph serve --mcp`(codegraph 自家隐藏命令),也不暴露 `help` / `ui` / `web`
3567
- 不挂 PreToolUse/PostToolUse/UserPromptSubmit/Stop 钩子(避免与 codeguard-plugin 抢触发器)
36-
- 不自动跑 `codegraph install`(那是用户的一次性 wiring 决策,插件不能越权)
68+
- 不自动跑 `codegraph install`(MCP wiring 改的是用户全局配置,作用域跨项目,插件不能越权——与 `init` 的处理见上节)
3769
- 不读取或上传任何源代码到外部
3870

3971
<!-- partme-agent-plugin-policy:v1 -->

‎README.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This plugin belongs to **Full-stack development**.
99
| Full-stack development | [Full Stack Plugins](https://github.com/partme-ai/full-stack-plugins) | Architecture and UI design, code understanding, quality checks, code review, workflow governance, and server operations |
1010
| AIGC content creation | [Full AIGC Plugins](https://github.com/partme-ai/full-aigc-plugins) | Image, video, audio, music, 3D, and multimodal content creation |
1111

12-
> Discoverable CodeGraph — official prompt injection + all 20 CLI commands as slash commands, for Codex / ZCode / Kimi / Claude Code.
12+
> Discoverable CodeGraph — official prompt injection + 21 of the 23 CLI commands as slash commands, for Codex / ZCode / Kimi / Claude Code.
1313
1414
![CodeGraph Plugin](assets/banner.svg)
1515

@@ -20,14 +20,14 @@ Three things, and **only** these three:
2020
1. **At session start**, when `<cwd>/.codegraph/` exists, this plugin injects the official CodeGraph prompt block (verbatim from upstream `codegraph/src/installer/instructions-template.ts`) into:
2121
- The current session, via `SessionStart.additionalContext` JSON output.
2222
- `<cwd>/.claude/CLAUDE.md` if it exists; else `<cwd>/AGENTS.md`. Uses atomic, marker-fenced section replacement — byte-equal content is a no-op, so this is safe to run alongside `codegraph install`.
23-
2. **Exposes all 20 codegraph CLI commands** as slash commands in two formats: JSON (`commands/*.json`, declared in `kimi.plugin.json`) and Markdown (`kimi-commands/*.md`), including the four hidden-but-useful maintenance commands (`daemon`, `unlock`, `version`, `telemetry`).
24-
3. **Registers a discovery skill** (`codegraph-helper`) that conditions the agent to use the right CodeGraph MCP tool for the task at hand.
23+
2. **Exposes 21 of codegraph's 23 CLI commands** as slash commands in two formats: JSON (`commands/*.json`, declared in `kimi.plugin.json`) and Markdown (`kimi-commands/*.md`), including the four hidden-but-useful maintenance commands (`daemon`, `unlock`, `version`, `telemetry`).
24+
3. **Registers a discovery skill** (`codegraph-helper`) that makes the agent **check whether the repo is indexed and, if not, proactively offer to index it**. The skill activates on code-structure questions *whether or not* `.codegraph/` exists: it checks first, then either answers via CodeGraph or tells the user 「this repo isn't indexed yet — want me to index it?」 and runs `codegraph init` once the user agrees.
2525

2626
## What this plugin does **not** do
2727

2828
- It does **not** modify or replace the `codegraph` CLI. The upstream `colbymchenry/codegraph` (MIT) is the source of truth.
2929
- It does **not** install the `codegraph` CLI. Users run `npm i -g @colbymchenry/codegraph` (or the install script) themselves; the plugin just exposes `/codegraph-install` as a guided wrapper around `codegraph install` for MCP wiring.
30-
- It does **not** auto-run `codegraph init`. Indexing is the user's decision. The plugin only activates when `.codegraph/` already exists.
30+
- It does **not** run `codegraph init` **without asking**. Indexing writes a `.codegraph/` directory, so the agent must get consent first — but it *does* detect the missing index and prompt for it automatically, because that discovery is the whole point of this plugin. (The SessionStart hook itself stays silent in un-indexed repos, matching the upstream prompt's own "skip CodeGraph entirely" wording.)
3131
- It does **not** hook `PreToolUse`, `PostToolUse`, `UserPromptSubmit`, or `Stop` — only `SessionStart`. This avoids collisions with codeguard-plugin and other plugins that own those events.
3232

3333
## Requirements
@@ -43,7 +43,7 @@ Three things, and **only** these three:
4343

4444
## Slash commands
4545

46-
20 commands, one per one. Format mirrors codegraph's CLI surface.
46+
21 commands. Format mirrors codegraph's CLI surface. `help` and `ui`/`web` are intentionally not exposed: `help` is covered by the host, and `ui`/`web` opens a browser viewer meant for humans, not agents.
4747

4848
| Command | Equivalent CLI | What it does |
4949
|---|---|---|
@@ -109,7 +109,7 @@ The plugin's contribution over `codegraph install` alone:
109109

110110
- **Two audiences covered**: codegraph's installer only writes files (reaches Task-tool subagents via the project instructions file); the plugin also emits `additionalContext` for the main agent at runtime.
111111
- **AGENTS.md fallback**: if a project doesn't use `.claude/CLAUDE.md`, the plugin writes to `AGENTS.md` (the OpenSpec / multi-agent convention).
112-
- **Slash commands**: codegraph install doesn't expose any; this plugin covers all 20.
112+
- **Slash commands**: codegraph install doesn't expose any; this plugin covers 21 of 23 (everything except `help`, `ui`/`web`, and the two hidden `prompt-hook` / `serve --mcp`).
113113

114114
## Maintenance
115115

0 commit comments

Comments
 (0)