refactor(hashline-edit): redesign hashline format with CID-based hashing
Breaking Changes: - Change hashline format from 'lineNum:hex|content' to 'lineNum#CID:content' - Replace hex-based hashing (00-ff) with CID-based hashing (ZPMQVRWSNKTXJBYH nibbles) - Simplify constants: HASH_DICT → NIBBLE_STR + HASHLINE_DICT - Update patterns: HASHLINE_PATTERN → HASHLINE_REF_PATTERN + HASHLINE_OUTPUT_PATTERN Benefits: - More compact and memorable CID identifiers - Better alignment with LSP line reference format (lineNum#ID) - Improved error messages and diff metadata clarity - Remove unused toHashlineContent from diff-enhancer hook Updates: - Refactor hash-computation for CID generation - Update all diff-utils to use new format - Update hook to use raw content instead of hashline format - Update tests to match new expectations 🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { log } from "../../shared"
|
||||
import { toHashlineContent, generateUnifiedDiff, countLineDiffs } from "../../tools/hashline-edit/diff-utils"
|
||||
import { generateUnifiedDiff, countLineDiffs } from "../../tools/hashline-edit/diff-utils"
|
||||
|
||||
interface HashlineEditDiffEnhancerConfig {
|
||||
hashline_edit?: { enabled: boolean }
|
||||
@@ -86,16 +86,13 @@ export function createHashlineEditDiffEnhancerHook(config: HashlineEditDiffEnhan
|
||||
}
|
||||
|
||||
const { additions, deletions } = countLineDiffs(oldContent, newContent)
|
||||
const oldHashlined = toHashlineContent(oldContent)
|
||||
const newHashlined = toHashlineContent(newContent)
|
||||
|
||||
const unifiedDiff = generateUnifiedDiff(oldContent, newContent, filePath)
|
||||
|
||||
output.metadata.filediff = {
|
||||
file: filePath,
|
||||
path: filePath,
|
||||
before: oldHashlined,
|
||||
after: newHashlined,
|
||||
before: oldContent,
|
||||
after: newContent,
|
||||
additions,
|
||||
deletions,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user