Skip to content

feat: detect_changes — git diff → affected AST nodes → blast radius #74

@jamestexas

Description

@jamestexas

Problem

When reviewing a PR or debugging a regression, the key question is: "what changed and what does it affect?" Mache already has the AST graph and callers/callees virtual dirs, but there's no way to go from a git diff to the set of affected graph nodes and their transitive dependents.

Proposed solution

A detect_changes capability that:

  1. Takes a git diff (or two refs) as input
  2. Maps changed byte ranges to affected AST nodes in the projected graph
  3. Traces the blast radius via callers/callees to show transitive impact
  4. Outputs affected node paths (readable via the mounted filesystem)

Possible interface

A virtual directory like _changes/ at the root that reflects the current git diff HEAD:

_changes/
  modified/           # nodes whose source changed
    pkg/functions/Validate/source
  affected/           # transitive callers/callees of modified nodes
    pkg/functions/HandleRequest/source
    cmd/functions/main/source

Or a .query/-style interface: cat .query/changes?ref=HEAD~3

Prior art

codebase-memory-mcp implements detect_changes as an MCP tool that maps git diffs to graph nodes and traces blast radius. Mache's filesystem interface would make this more powerful — agents could ls and grep the affected set directly.

Context

The graph infrastructure (callers/, callees/, SourceOrigin byte ranges) is already in place. The main new work is git diff parsing → byte range mapping → transitive BFS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions