MCPcopy Create free account
hub / github.com/ByteYellow/AgentProvenance / PrintDiffFile

Function PrintDiffFile

internal/provenance/diff.go:168–184  ·  view source on GitHub ↗
(out io.Writer, manifest FileDiffManifest)

Source from the content-addressed store, hash-verified

166}
167
168func PrintDiffFile(out io.Writer, manifest FileDiffManifest) {
169 fmt.Fprintf(out, "run=%s file=%s base_snapshot=%s\n", manifest.RunID, manifest.File, manifest.BaseSnapshotID)
170 fmt.Fprintf(out, "base_sha256=%s base_path=%s\n", manifest.BaseSHA256, manifest.BasePath)
171 fmt.Fprintln(out, "diffs:")
172 for _, attempt := range manifest.Attempts {
173 fmt.Fprintf(out, " attempt=%s rollout=%s tool_call=%s winner=%t status=%s strategy=%s changed=%t base_sha256=%s attempt_sha256=%s workspace=%s\n",
174 attempt.AttemptID, attempt.RolloutID, attempt.ToolCallID, attempt.IsWinner, attempt.Status, attempt.Strategy, attempt.Changed, manifest.BaseSHA256, attempt.FileSHA256, attempt.WorkspacePath)
175 if !attempt.Changed {
176 continue
177 }
178 fmt.Fprintf(out, " --- base/%s\n", manifest.File)
179 fmt.Fprintf(out, " +++ attempt/%s/%s\n", attempt.AttemptID, manifest.File)
180 for _, line := range attempt.UnifiedDiff {
181 fmt.Fprintf(out, " %s\n", line)
182 }
183 }
184}
185
186func BlameFileJSON(db *sql.DB, runID, filePath string, out io.Writer) error {
187 manifest, err := BuildBlameFile(db, runID, filePath)

Callers 1

DiffFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected