Clide is being rebuilt as a Flutter desktop app. The Python Textual implementation moves wholesale into legacy/ rather than being deleted: its pane model, panel set, git skills, and panel communication design are real thought that should remain readable next to the new code while the rebuild finds its shape. Git's rename tracking preserves history, so `git log -- legacy/` still works. The Flutter rebuild lives at the repo root alongside a Go sidecar (the architecture claudian was heading toward, which folds into clide as a core component rather than a separate plugin project). Bootstrap of the new shape lands in subsequent commits. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
67 lines
1.4 KiB
Python
67 lines
1.4 KiB
Python
"""Diff-related Pydantic models."""
|
|
|
|
from enum import Enum
|
|
|
|
from pydantic import BaseModel, ConfigDict
|
|
|
|
|
|
class ChangeType(str, Enum):
|
|
"""Type of change in a diff line."""
|
|
|
|
ADDED = "added"
|
|
REMOVED = "removed"
|
|
CONTEXT = "context"
|
|
HEADER = "header"
|
|
|
|
|
|
class DiffLine(BaseModel):
|
|
"""A single line in a diff."""
|
|
|
|
model_config = ConfigDict(strict=True, frozen=True)
|
|
|
|
change_type: ChangeType
|
|
content: str
|
|
old_line_num: int | None = None
|
|
new_line_num: int | None = None
|
|
|
|
|
|
class DiffHunk(BaseModel):
|
|
"""A hunk (section) of a diff."""
|
|
|
|
model_config = ConfigDict(strict=True, frozen=True)
|
|
|
|
header: str
|
|
old_start: int
|
|
old_count: int
|
|
new_start: int
|
|
new_count: int
|
|
lines: tuple[DiffLine, ...]
|
|
|
|
|
|
class DiffContent(BaseModel):
|
|
"""Complete diff for a file."""
|
|
|
|
model_config = ConfigDict(strict=True, frozen=True)
|
|
|
|
file_path: str
|
|
old_path: str | None = None # For renames
|
|
hunks: tuple[DiffHunk, ...]
|
|
is_binary: bool = False
|
|
is_new_file: bool = False
|
|
is_deleted: bool = False
|
|
|
|
|
|
class DiffViewState(BaseModel):
|
|
"""State of the diff viewer."""
|
|
|
|
model_config = ConfigDict(strict=True)
|
|
|
|
diff: DiffContent | None = None
|
|
scroll_offset: int = 0
|
|
selected_hunk_index: int | None = None
|
|
side_by_side: bool = True
|
|
# For Claude-proposed changes
|
|
is_proposal: bool = False
|
|
accepted_hunks: set[int] = set()
|
|
rejected_hunks: set[int] = set()
|