fix(hashline-edit): improve hash computation and tool description clarity
- Include line number in hash computation to ensure uniqueness - Add explicit examples of WRONG vs CORRECT LINE:HASH format - Clarify that hash must be hex characters (0-9, a-f only) - Update tests to use dynamic hash computation
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import { HASH_DICT } from "./constants"
|
||||
|
||||
export function computeLineHash(_lineNumber: number, content: string): string {
|
||||
export function computeLineHash(lineNumber: number, content: string): string {
|
||||
const stripped = content.replace(/\s+/g, "")
|
||||
const hash = Bun.hash.xxHash32(stripped)
|
||||
const hashInput = `${lineNumber}:${stripped}`
|
||||
const hash = Bun.hash.xxHash32(hashInput)
|
||||
const index = hash % 256
|
||||
return HASH_DICT[index]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user