Skip to content
This repository was archived by the owner on Jul 11, 2026. It is now read-only.
This repository was archived by the owner on Jul 11, 2026. It is now read-only.

[Analysis Layer] Change Impact Analysis - Dependency Graph Awareness #6

Closed

Description

@gloomcheng

Problem Statement

When AI modifies a function/file, it doesn't know:

  • What other files import it
  • Will changes break downstream code
  • Which tests need updating

This leads to incomplete refactors and hidden breakages.

Proposed Solution

Impact Analysis System

  1. Dependency Graph

    • Build import/export graph of codebase
    • Track function/class references
  2. Pre-change Analysis

    • Before modifying, show: "This affects 5 files"
    • List specific dependents
  3. Change Validation

    • After change, verify dependents still work
    • Suggest necessary updates

Technical Approach

  • Use TypeScript compiler API / tree-sitter for parsing
  • Cache dependency graph, update incrementally
  • Integrate with implement phase

Success Criteria

  • AI sees impact before making changes
  • Reduced broken imports after refactoring
  • Automated suggestions for affected files

🤖 Generated with Claude Code

Activity

  1. gloomcheng commented on Dec 25, 2025

    @gloomcheng
    ContributorAuthor

    ✅ Issue #6 Completed: Change Impact Analysis - Dependency Graph Awareness

    Successfully implemented dependency graph and change impact analysis system.

    What was implemented:

    1. ImpactAnalyzer Service - Core dependency graph engine

      • Parses TypeScript/JavaScript imports and exports
      • Builds bidirectional dependency graph (who imports what, who depends on this)
      • Recursive traversal to find all affected files
      • Breaking change detection (removed/renamed/signature-changed exports)
      • Smart caching (5-minute TTL) for performance
      • Supports configurable depth and exclude patterns
    2. ImpactAnalysisHandler - MCP tool handler

      • 5 new MCP tools: impact-build-graph, impact-analyze, impact-preview, impact-validate, impact-stats
      • Rich impact reporting with levels (low → medium → high → critical)
      • Groups affected files by directory for clarity
      • Separates production code from test files
      • Generates actionable suggestions
    3. Impact Analysis Features

      • Pre-change preview: See what will be affected before coding
      • Full analysis: Detailed breakdown of all dependents and usage
      • Post-change validation: Verify changes didn't break imports
      • Graph statistics: Understand codebase structure

    Key Capabilities:

    • Import/export dependency tracking
    • Affected files detection with depth control
    • Impact level calculation (based on affected file count)
    • Breaking change identification
    • Test vs production file separation
    • Backward compatibility suggestions

    Example Workflow:

    1. impact-preview files=["src/utils/format.ts"] - Check before modifying
    2. Make changes to the file
    3. impact-validate files=["src/utils/format.ts"] - Verify nothing broke
    4. Review affected files and update as needed

    Impact Levels:

    • Low (0-3 files): Safe to proceed
    • Medium (4-10 files): Review affected files
    • High (11-25 files): Consider backward compatibility
    • Critical (26+ files): Major refactoring, deprecation recommended

    This completes the first Analysis Layer feature, giving AI awareness of:

    • Code dependencies and import relationships ✅
    • Ripple effects of changes before/after modifications ✅
    • Breaking changes and affected code paths ✅

    Committed in: 046e7e4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestlayer:analysisAnalysis Layer - static analysis & impactpriority:mediumMedium priority item

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions