feat(hashline-edit): add autocorrect, BOM/CRLF normalization, and file creation support

Implements key features from oh-my-pi to improve agent editing success rates:

- Autocorrect v1: single-line merge expansion, wrapped line restoration,
  paired indent restoration (autocorrect-replacement-lines.ts)
- BOM/CRLF normalization: canonicalize on read, restore on write
  (file-text-canonicalization.ts)
- Pre-validate all hashes before mutation (edit-ordering.ts)
- File creation via append/prepend operations (new types + executor logic)
- Modular refactoring: split edit-operations.ts into focused modules
  (primitives, ordering, deduplication, diff, executor)
- Enhanced tool description with operation choice guide and recovery hints

All 50 tests pass. TypeScript clean. Build successful.
This commit is contained in:
YeonGyu-Kim
2026-02-22 14:13:59 +09:00
parent e84fce3121
commit 5d1d87cc10
14 changed files with 774 additions and 341 deletions
+11 -1
View File
@@ -7,7 +7,17 @@ export {
} from "./hash-computation"
export { parseLineRef, validateLineRef } from "./validation"
export type { LineRef } from "./validation"
export type { SetLine, ReplaceLines, InsertAfter, InsertBefore, InsertBetween, Replace, HashlineEdit } from "./types"
export type {
SetLine,
ReplaceLines,
InsertAfter,
InsertBefore,
InsertBetween,
Replace,
Append,
Prepend,
HashlineEdit,
} from "./types"
export { NIBBLE_STR, HASHLINE_DICT, HASHLINE_REF_PATTERN, HASHLINE_OUTPUT_PATTERN } from "./constants"
export {
applyHashlineEdits,