Skip to content

Interop with cargo-impact: --files-from stdin and --impact-scope #5

@asmuelle

Description

@asmuelle

Context

cargo-impact v0.3.0-alpha.1 ships a --context flag that emits a newline-delimited list of files touched by the blast radius of a code change:

$ cargo impact --context
src/engine.rs
src/ffi.rs
tests/integration.rs
docs/architecture.md

The intended bidirectional workflow (documented in cargo-impact's README §7):

# Forward: generate a context pack scoped to only impact-affected files
cargo impact --context | cargo context --files-from -

# Reverse: consume a full cargo-impact JSON report and produce a
# context pack for the low-confidence findings so the AI can re-verify
cargo impact --format=json > .impact.json
cargo context --impact-scope=.impact.json --budget=8000

Neither of the two cargo-context flags this needs (--files-from and --impact-scope) exists today.

Ask

1. --files-from <PATH|-> (smaller, high-leverage)

Add a flag that reads a newline-delimited list of file paths (from a file, or - for stdin) and builds the context pack using exactly those files instead of (or in addition to) the git-diff-derived set. Paths are repo-relative.

This makes cargo impact --context | cargo context --files-from - work immediately — users get a context pack scoped to the blast radius of their change, not a whole-repo dump.

2. --impact-scope <PATH> (larger, richer)

Consume a cargo-impact --format=json envelope. The JSON shape is documented in cargo-impact README §8. Useful fields:

  • findings[].kind — which analyzer produced the finding
  • findings[].confidence and findings[].tier — let cargo-context prioritize or filter
  • findings[].primary_path (via impact_surface / the kind payload)

With this, cargo context could emit targeted packs per finding or per severity tier, keeping the pack small while maintaining coverage.

Suggested order

--files-from first — it's small, composable, and useful on its own. --impact-scope is a v0.4+ item since it needs schema tracking.

Reference

Happy to draft a PR for --files-from against this repo if it looks shaped how you'd want it.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions