| 1 | package evidence |
| 2 | |
| 3 | import ( |
| 4 | "path/filepath" |
| 5 | "strings" |
| 6 | ) |
| 7 | |
| 8 | // ReceiptShowsWholeGitDiff reports whether a successful shell receipt exposed |
| 9 | // the current repository diff content. Status summaries and diff --check do |
| 10 | // not count as content review. |
| 11 | func ReceiptShowsWholeGitDiff(rec Receipt) bool { |
| 12 | return receiptCommandSucceeded(rec) && isShellToolName(rec.ToolName) && rec.OutputBytes > 0 && commandShowsWholeGitDiff(rec.Command) |
| 13 | } |
| 14 | |
| 15 | // ReceiptShowsContentForPath reports whether a successful shell receipt |
| 16 | // exposed the named file's content rather than merely mentioning the path. |
| 17 | func ReceiptShowsContentForPath(rec Receipt, path string) bool { |
| 18 | path = strings.ToLower(filepath.ToSlash(normalizePath(path))) |
| 19 | return path != "" && receiptCommandSucceeded(rec) && |
| 20 | isShellToolName(rec.ToolName) && rec.OutputBytes > 0 && |
| 21 | commandShowsContentForPath(rec.Command, path) |
| 22 | } |
| 23 | |
| 24 | func receiptCommandSucceeded(rec Receipt) bool { |
| 25 | return rec.Success && (rec.ExitCode == nil || *rec.ExitCode == 0) && rec.Verification != VerificationFailed |
| 26 | } |
| 27 |