[Feature Request - Codemaps] Deduplicate Structural Graph Edges and Augment with Metadata (Call Sites)
@satvikkk 已经在做这个了。
开始于 2026年2月16日。
评估
这个 Issue 还没有评估数据。
描述
In the codemaps GraphService unconditionally adds an edge each time a parser detects a relationship (e.g., calls, imports). If a function calls the fs module 10 times, the parser emits 10 identical structural edges into the JSON payload. While this captures raw control flow, it significantly inflates the token size of the graph output for LLM agents and creates redundant noise during traversal.
Problem Statement: When an MCP agent queries the AST graph to understand the architecture or look for security boundaries, the identical duplicate edges are inefficient:
- Token Bloat: Sending 50 identical
A -> Bedges wastes LLM context window limits. - Analysis Complexity: Graph algorithms run slower and need manual filtering if traversing a multigraph.
**Proposed Solution:**The backend GraphService should natively de-duplicate edges between the same conceptual source and target nodes, but preserve the frequency and location metadata. Instead of an array of redundant edges, the graph JSON for an edge would look like this:
{ "source": "src/index.ts:scan_dir",
"target": "module:fs",
"type": "calls",
"weight": 3,
"locations": [
{"line": 28, "snippet": "await fs.readdir"},
{"line": 34, "snippet": "await fs.stat"},
{"line": 45, "snippet": "await fs.realpath"}
]
}
**Why this matters for Agents:**By collapsing edges but enriching them with target telemetry (like code snippets and varying lines), the structural architecture answers "Who interacts with whom?" exactly once. If a security agent spots a dangerous data cross (e.g. untrusted input -> exec), it can immediately inspect the locations array attached to that single edge to launch a direct pinpoint audit without re-parsing the entire codebase.
Implementation Details:- Update add_edge() in GraphService to check if a {source, target} pair already exists.- If it does, push the new line references into the locations array and bump the weight.
Note: This is dependent on the CodeMaps tool.
- 主要语言
- TypeScript
- 星标
- 794
- 派生
- 58
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
gemini-cli-extensions/security 的其他 Issue
-
Help未关闭
难度 1/5 1 小时以内 新手友好度 10/100
-
难度 3/5 1-2 天 新手友好度 45/100
gemini-cli-extensions/security#133 · 3 条评论 ·
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 5/5 一周以上 新手友好度 20/100
-
难度 5/5 一周以上 新手友好度 20/100
gemini-cli-extensions/security#102 · 5 条评论 ·
查看 gemini-cli-extensions/security 的全部 Issue
相似的 Issue
-
area/frontend good first issue kind/cooldown
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 85/100
voidzero-dev/oxc-angular-compiler#511 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
langchain-ai/deepagentsjs#898 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 92/100
anomalyco/models.dev#8509 · 2 条评论 ·
维护者通常 1 天内回复
-
bug documentation P2 UI/UX
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复