Remove ANSI formatting codes from g3-core

Move terminal formatting responsibility to g3-cli layer:

- format_str_replace_summary(): Remove ANSI codes, add colorize_str_replace_summary()
  helper in CLI to apply green/red colors for insertions/deletions
- format_timing_footer(): Remove dimming ANSI codes (now plain text)
- str_replace tool result: Remove ANSI codes from success message

Remaining acceptable ANSI usage in g3-core:
- iTerm2 inline image protocol (terminal-specific escape sequence)
- Image metadata dimming (direct print, would need larger refactor)
- Terminal beep for stale TODO warning (audio, not visual)
- ANSI stripping utility in research.rs (not output)

This continues the separation of concerns: g3-core handles logic,
g3-cli handles all terminal formatting.
This commit is contained in:
Dhanji R. Prasanna
2026-01-20 10:00:37 +05:30
parent 182f5f98fe
commit 10bce7f66f
3 changed files with 32 additions and 9 deletions

View File

@@ -582,7 +582,7 @@ pub async fn execute_str_replace<W: UiWriter>(
// Write the result back to the file
match std::fs::write(&file_path, &result) {
Ok(()) => Ok(format!("\x1b[32m+{} insertions\x1b[0m | \x1b[31m-{} deletions\x1b[0m", insertions, deletions)),
Ok(()) => Ok(format!("✅ +{} insertions | -{} deletions", insertions, deletions)),
Err(e) => Ok(format!("❌ Failed to write to file '{}': {}", file_path, e)),
}
}