Compute a unified diff between old and new content and return it as
a plain-text string (no ANSI codes). Returns an empty string if the
contents are identical.
Show a unified-diff-style view of an edit operation.
Reads the file, locates old_str, and prints context lines
with the removed text in red and the replacement in green.
Show a unified-diff-style view of a write operation (full file).
If the file already exists, reads it and shows a line-by-line diff
with removed lines in red and added lines in green.
If the file is new, shows a preview of the content that will be written.