Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#141 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

@satvikkk đang làm issue này rồi.

Từ ngày 16/2/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
794
Fork
58
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của gemini-cli-extensions/security

Tất cả issue của gemini-cli-extensions/security

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.