Initial open source GitHub PR review bot

This commit is contained in:
lezi-fun committed 2026-05-12 21:23:43 +08:00
commit c6bf0346b4
23 files changed
+4577

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
import type { PullRequestFile } from "../types.js";
export function compactFilesForReview(files: PullRequestFile[], maxPatchChars: number): PullRequestFile[] {
let remaining = maxPatchChars;
return files.map((file) => {
if (!file.patch || remaining <= 0) {
return { ...file, patch: undefined };
}
const patch = file.patch.slice(0, remaining);
remaining -= patch.length;
return {
...file,
patch: patch.length < file.patch.length ? `${patch}\n[patch truncated]` : patch
};
});
}