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
c9f153a464
feat(hashline-edit): add anchor insert modes and strict insert validation
2026-02-22 03:38:04 +09:00
YeonGyu-Kim
bce12d2fdc
Merge pull request #1953 from maximharizanov/fix/copilot-initiator-attribution
...
fix(copilot): mark internal hook injections as agent-initiated
2026-02-20 11:54:01 +09:00
YeonGyu-Kim
3ab2eec117
fix(hashline): add autocorrect, batch mismatch reporting, and write anchors
2026-02-20 11:02:07 +09:00
Maxim Harizanov
2e5fd99918
fix(types): restore CI compatibility for plugin hooks and tool context
2026-02-19 13:40:38 +02: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
6869a2c0b5
fix(hashline-edit): stabilize TUI diff metadata and output flow
...
Align edit/write hashline handling with TUI expectations by preserving metadata through tool execution, keeping unified diff raw to avoid duplicated line numbers, and tightening read/write/edit outputs plus tests for reliable agent operation.
2026-02-19 18:40:42 +09:00
YeonGyu-Kim
eb6be8ac7b
fix(hashline): address Cubic review comments
...
- P2: Change replace edit sorting from POSITIVE_INFINITY to NEGATIVE_INFINITY
so replace edits run LAST after line-based edits, preventing line number
shifts that would invalidate subsequent anchors
- P3: Update tool description from SHA-256 to xxHash32 to match actual
implementation in hash-computation.ts
2026-02-17 00:03:10 +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