Expand description
Diff-line marker conventions shared between the edit_file tool (which generates diff output) and the chat renderer (which colors added/removed lines red/green).
Kept in the render layer rather than in the tool impl because
every consumer is the renderer. The producer today is
generate_diff — inside the edit tool’s helper code — and uses
the same constants to format its lines.
Enums§
- Diff
Line Kind - Classification of a diff line. The chat renderer matches on this to choose a background color.
Constants§
- DIFF_
ADDED_ MARKER - Marker for an ADDED line.
- DIFF_
REMOVED_ MARKER - Marker for a REMOVED line. Formatted as
{num:>4}{marker}{content}so the three-byte width stays aligned across line numbers up to 9,999. Lines without a matching prefix fall through toContext.
Functions§
- parse_
diff_ line - Parse one line of diff output. Lines that don’t follow the
{number}{marker}{content}shape — including malformed or truncated input — fall through toContextso the renderer’s match stays exhaustive without panicking.