Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Feature Request - Codemaps] Deduplicate Structural Graph Edges and Augment with Metadata (Call Sites)

未关闭
#141 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@satvikkk 已经在做这个了。

开始于 2026年2月16日。

评估

这个 Issue 还没有评估数据。

描述

enhancement

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:

  1. Token Bloat: Sending 50 identical A -> B edges wastes LLM context window limits.
  2. 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 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

gemini-cli-extensions/security 的其他 Issue

查看 gemini-cli-extensions/security 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。