feat(config): add experimental.hashline_edit flag and provider state module

This commit is contained in:
YeonGyu-Kim
2026-02-16 15:59:12 +09:00
parent fcf26d9898
commit 149de9da66
12 changed files with 531 additions and 0 deletions
@@ -0,0 +1,19 @@
import { HASH_DICT } from "./constants"
export function computeLineHash(lineNumber: number, content: string): string {
const stripped = content.replace(/\s+/g, "")
const hash = Bun.hash.xxHash32(stripped)
const index = hash % 256
return HASH_DICT[index]
}
export function formatHashLine(lineNumber: number, content: string): string {
const hash = computeLineHash(lineNumber, content)
return `${lineNumber}:${hash}|${content}`
}
export function formatHashLines(content: string): string {
if (!content) return ""
const lines = content.split("\n")
return lines.map((line, index) => formatHashLine(index + 1, line)).join("\n")
}