Improve tool output formatting

1. str_replace: Show insertion/deletion counts with colors
   " +N insertions | -M deletions" (green/red)

2. write_file: Compact format with human-readable sizes
   " wrote N lines | Xk chars"

3. read_file: Cleaner format
   "🔍 N lines read" instead of "📄 File content (N lines)"

4. webdriver_quit: Show correct driver name (safaridriver vs chromedriver)

5. read_file: When start position exceeds file length, read last 100 chars
   with explanation instead of failing

6. shell: Remove redundant "Command failed:" prefix from error messages
This commit is contained in:
Dhanji R. Prasanna
2026-01-11 19:52:00 +05:30
parent 7c960875ef
commit ed1c31dd70
3 changed files with 45 additions and 17 deletions

View File

@@ -599,16 +599,22 @@ pub async fn execute_webdriver_quit<W: UiWriter>(
Ok(_) => {
debug!("WebDriver session closed successfully");
// Kill the safaridriver process
// Kill the driver process
if let Some(mut process) = ctx.webdriver_process.write().await.take() {
if let Err(e) = process.kill().await {
warn!("Failed to kill safaridriver process: {}", e);
warn!("Failed to kill driver process: {}", e);
} else {
debug!("Safaridriver process terminated");
debug!("Driver process terminated");
}
}
Ok("✅ WebDriver session closed and safaridriver stopped".to_string())
// Return appropriate message based on browser type
use g3_config::WebDriverBrowser;
let driver_name = match &ctx.config.webdriver.browser {
WebDriverBrowser::Safari => "safaridriver",
WebDriverBrowser::ChromeHeadless => "chromedriver",
};
Ok(format!("✅ WebDriver session closed and {} stopped", driver_name))
}
Err(e) => Ok(format!("❌ Failed to quit WebDriver: {}", e)),
}