Private
Public Access
refactor(gui_2,patch_modal): merge diff_viewer ops into gui_2; data classes (DiffHunk/DiffFile) move to patch_modal.py alongside PendingPatch; git rm src/diff_viewer.py
Per spec FR1 + Phase 1.4 + architecture feedback (data != view): - Data classes DiffHunk, DiffFile -> src/patch_modal.py (alongside PendingPatch; all patch-domain data) - Operations parse_diff/parse_hunk_header/get_line_color/apply_patch_to_file (called by gui_2) -> src/gui_2.py - GUI is a pure view; data lives elsewhere; no new files per AGENTS.md Tests: tests/test_diff_viewer.py imports from src.gui_2 (parse_diff/apply_patch_to_file) and src.patch_modal (DiffFile/DiffHunk).
This commit is contained in:
@@ -2,6 +2,21 @@ from dataclasses import dataclass, field
|
||||
from typing import Optional, Callable, List
|
||||
|
||||
|
||||
@dataclass
|
||||
class DiffHunk:
|
||||
header: str
|
||||
lines: List[str]
|
||||
old_start: int
|
||||
old_count: int
|
||||
new_start: int
|
||||
new_count: int
|
||||
|
||||
@dataclass
|
||||
class DiffFile:
|
||||
old_path: str
|
||||
new_path: str
|
||||
hunks: List[DiffHunk] = field(default_factory=list)
|
||||
|
||||
@dataclass
|
||||
class PendingPatch:
|
||||
patch_text: str = ""
|
||||
|
||||
Reference in New Issue
Block a user