YeonGyu-Kim
6ab3dc35b0
fix(hashline-edit): align autocorrect, BOM/CRLF, and tool description with oh-my-pi
...
- Rewrite restoreOldWrappedLines to use oh-my-pi's span-scanning algorithm
- Add stripTrailingContinuationTokens and stripMergeOperatorChars helpers
- Fix detectLineEnding to use first-occurrence logic instead of any-match
- Fix applyAppend/applyPrepend to replace empty-line placeholder in empty files
- Enhance tool description with 7 critical rules, tag guidance, and anti-patterns
2026-02-22 14:40:18 +09:00
YeonGyu-Kim
3ba84d2107
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.
2026-02-22 14:13:59 +09:00
YeonGyu-Kim
2615fd0d73
fix(hashline-edit): address Cubic review issues - boundary echo, chunking dedup, empty stream alignment
...
- Fix single-line anchor-echo stripping to trigger empty-insert validation
- Fix trailing boundary-echo stripping for boundary-only payloads
- Extract shared chunking logic to hashline-chunk-formatter
- Align empty stream/iterable handling with formatHashLines
- Add regression tests for all fixes
2026-02-22 03:54:31 +09:00
YeonGyu-Kim
8f424de41b
feat(hashline-edit): add anchor insert modes and strict insert validation
2026-02-22 03:38:47 +09:00
YeonGyu-Kim
e549d24f6f
fix(hashline-edit): restore leading indentation for first line in replace_lines
...
- BUG-21: Apply restoreLeadingIndent to first entry of replace_lines, matching set_line behavior
- Update test to verify indentation preservation
2026-02-21 02:41:21 +09:00
YeonGyu-Kim
258e9d473c
fix(hashline-edit): do not restore indentation for replace_lines
...
- applyReplaceLines: use stripped array directly instead of restoreLeadingIndent
- applySetLine: keep restoreLeadingIndent (1:1 replacement needs indent preservation)
- Added test case for replace_lines preserving new line indentation
- All 3025 tests pass
🤖 Generated with OhMyOpenCode assistance
2026-02-20 17:47:37 +09:00
YeonGyu-Kim
3ab2eec117
fix(hashline): add autocorrect, batch mismatch reporting, and write anchors
2026-02-20 11:02:07 +09:00
YeonGyu-Kim
9402905738
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
2026-02-19 18:40:42 +09:00
YeonGyu-Kim
9bd21c8a67
feat(hashline): port hashline edit tool from oh-my-pi
...
This PR ports the hashline edit tool from oh-my-pi to oh-my-opencode as an experimental feature.
## Features
- New experimental.hashline_edit config flag
- hashline_edit tool with 4 operations: set_line, replace_lines, insert_after, replace
- Hash-based line anchors for safe concurrent editing
- Edit tool disabler for non-OpenAI providers
- Read output enhancer with LINE:HASH prefixes
- Provider state tracking module
## Technical Details
- xxHash32-based 2-char hex hashes
- Bottom-up edit application to prevent index shifting
- OpenAI provider exemption (uses native apply_patch)
- 90 tests covering all operations and edge cases
- All files under 200 LOC limit
## Files Added/Modified
- src/tools/hashline-edit/ (7 files, ~400 LOC)
- src/hooks/hashline-edit-disabler/ (4 files, ~200 LOC)
- src/hooks/hashline-read-enhancer/ (3 files, ~400 LOC)
- src/features/hashline-provider-state.ts (13 LOC)
- src/config/schema/experimental.ts (hashline_edit flag)
- src/config/schema/hooks.ts (2 new hook names)
- src/plugin/tool-registry.ts (conditional registration)
- src/plugin/chat-params.ts (provider state tracking)
- src/tools/index.ts (export)
- src/hooks/index.ts (exports)
2026-02-17 00:03:10 +09:00