Skip to content

feat: wire blast-radius to /v1/analysis/impact endpoint #24

@jonathanpopham

Description

@jonathanpopham

Problem

The blast-radius command currently calls /v1/graphs/supermodel, gets a generic graph, and does naive reverse BFS on import edges in Go. This misses the API's real impact analysis which includes:

  • Call graph + dependency graph reachability (not just imports)
  • Risk scoring (low/medium/high/critical) with risk factors
  • Affected functions with distance and relationship type (direct_caller/transitive_caller)
  • Affected entry points (route handlers, module exports, event handlers)
  • Diff-based analysis (auto-extract targets from git diff)
  • Global coupling map when no targets specified
  • Cross-domain impact detection

The API already exposes all of this at POST /v1/analysis/impact.

Solution

Wire the CLI's blast-radius command to the dedicated endpoint:

  1. Add Impact() method to api.Client that POSTs to /v1/analysis/impact with async polling
  2. Add response types (ImpactResult, BlastRadius, AffectedFunction, AffectedFile, etc.)
  3. Rewrite internal/blastradius/handler.go to call the new endpoint
  4. Support --targets query param and --diff file upload
  5. Surface risk scores, affected functions, and entry points in output

Three modes

  1. supermodel blast-radius <file> — target a specific file (maps to ?targets=<file>)
  2. supermodel blast-radius --diff changes.diff — analyze from a diff
  3. supermodel blast-radius (no args) — global coupling map

References

  • API spec: POST /v1/analysis/impact in openapi.yaml
  • Current CLI handler: internal/blastradius/handler.go (naive import BFS)
  • Pattern: internal/deadcode/handler.go (already wired to dedicated endpoint)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions