feat(rtk): add JS-native git-log filter (#2423)

Compress git log output via dedicated RTK filter: keep commit headers,
Author/Date, subject; drop body padding, decoration, embedded diff lines.
Wire into autodetect (git-log prioritized before git-diff) and registry.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
KunN-21
2026-07-07 12:02:56 +07:00
committed by decolua
co-authored by Cursor
parent bbae990b92
commit 19281b5524
6 changed files with 329 additions and 21 deletions
@@ -4,6 +4,7 @@ import { describe, it, expect } from "vitest";
import { autoDetectFilter } from "../../open-sse/rtk/autodetect.js";
import { buildOutput } from "../../open-sse/rtk/filters/buildOutput.js";
import { gitDiff } from "../../open-sse/rtk/filters/gitDiff.js";
import { gitLog } from "../../open-sse/rtk/filters/gitLog.js";
import { gitStatus } from "../../open-sse/rtk/filters/gitStatus.js";
import { safeApply } from "../../open-sse/rtk/applyFilter.js";
import { compressMessages } from "../../open-sse/rtk/index.js";
@@ -279,6 +280,41 @@ describe("PR #1175 - integration with compressMessages", () => {
});
});
// ============================================================
// 6.5. GIT-LOG PRIORITY
// ============================================================
describe("git-log priority", () => {
it("git-log chosen over build-output when commit header present in first window", () => {
const input = [
"commit abc1234def5678abc1234def5678abc1234def5",
"Author: Dev One <dev1@example.com>",
"Date: Sun Jul 6 10:00:00 2026 +0700",
"",
" Add auth middleware",
"",
"diff --git a/src/auth.js b/src/auth.js",
"index abc..def 100644",
"--- a/src/auth.js",
"+++ b/src/auth.js",
"@@ -1 +1 @@",
"+new line"
].join("\n");
expect(autoDetectFilter(input)).toBe(gitLog);
});
it("pure git diff still stays git-diff", () => {
const input = [
"diff --git a/src/auth.js b/src/auth.js",
"index abc..def 100644",
"--- a/src/auth.js",
"+++ b/src/auth.js",
"@@ -1 +1 @@",
"+new line"
].join("\n");
expect(autoDetectFilter(input)).toBe(gitDiff);
});
});
// ============================================================
// 7. PORCELAIN REGRESSION DEEPER TESTS
// ============================================================