From 38828c77571515cee33871a7618772490b54972f Mon Sep 17 00:00:00 2001 From: "Dhanji R. Prasanna" Date: Wed, 14 Jan 2026 19:42:54 +0530 Subject: [PATCH] Clean up tool output formatting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Shell: "✅ Command executed successfully" → "⚡️ ran successfully" - Write file: Remove ✏️ emoji, use plain "wrote N lines | M chars" --- crates/g3-core/src/streaming.rs | 12 +++--- crates/g3-core/src/tools/file_ops.rs | 2 +- crates/g3-core/src/tools/shell.rs | 2 +- .../tests/end_of_turn_behavior_test.rs | 4 +- scripts/install.sh | 38 +++++++++++++++++++ 5 files changed, 48 insertions(+), 10 deletions(-) create mode 100755 scripts/install.sh diff --git a/crates/g3-core/src/streaming.rs b/crates/g3-core/src/streaming.rs index fd6946e..9eac742 100644 --- a/crates/g3-core/src/streaming.rs +++ b/crates/g3-core/src/streaming.rs @@ -303,20 +303,20 @@ pub fn format_write_file_summary(line_count: usize, char_count: usize) -> String } else { format!("{}", char_count) }; - format!("✏️ {} lines ({} chars)", line_count, char_display) + format!("wrote {} lines | {} chars", line_count, char_display) } /// Format a write_file result for compact display. -/// Parses the tool result which is in format: "✅ wrote N lines | M chars" -/// Returns a compact summary like "✏️ N lines (M chars)" +/// Parses the tool result which is in format: "wrote N lines | M chars" +/// Returns a compact summary like "wrote N lines | M chars" pub fn format_write_file_result(tool_result: &str) -> String { - // Parse "✅ wrote N lines | M chars" or "✅ wrote N lines | M.Mk chars" - if let Some(rest) = tool_result.strip_prefix("✅ wrote ") { + // Parse "wrote N lines | M chars" or "wrote N lines | M.Mk chars" + if let Some(rest) = tool_result.strip_prefix("wrote ") { // rest is "N lines | M chars" or "N lines | M.Mk chars" if let Some((lines_part, chars_part)) = rest.split_once(" | ") { let lines = lines_part.trim_end_matches(" lines"); let chars = chars_part.trim_end_matches(" chars"); - return format!("✏️ {} lines ({} chars)", lines, chars); + return format!("wrote {} lines | {} chars", lines, chars); } } // Fallback: return the original result if parsing fails diff --git a/crates/g3-core/src/tools/file_ops.rs b/crates/g3-core/src/tools/file_ops.rs index f21ba22..26539d0 100644 --- a/crates/g3-core/src/tools/file_ops.rs +++ b/crates/g3-core/src/tools/file_ops.rs @@ -343,7 +343,7 @@ pub async fn execute_write_file( format!("{}", char_count) }; Ok(format!( - "✅ wrote {} lines | {} chars", + "wrote {} lines | {} chars", line_count, char_display )) } diff --git a/crates/g3-core/src/tools/shell.rs b/crates/g3-core/src/tools/shell.rs index e3ff32c..4fa665c 100644 --- a/crates/g3-core/src/tools/shell.rs +++ b/crates/g3-core/src/tools/shell.rs @@ -56,7 +56,7 @@ pub async fn execute_shell(tool_call: &ToolCall, ctx: &ToolContext< Ok(result) => { if result.success { Ok(if result.stdout.is_empty() { - "✅ Command executed successfully".to_string() + "⚡️ ran successfully".to_string() } else { result.stdout.trim().to_string() }) diff --git a/crates/g3-core/tests/end_of_turn_behavior_test.rs b/crates/g3-core/tests/end_of_turn_behavior_test.rs index 61a3d14..938aa90 100644 --- a/crates/g3-core/tests/end_of_turn_behavior_test.rs +++ b/crates/g3-core/tests/end_of_turn_behavior_test.rs @@ -337,7 +337,7 @@ mod tool_output_formatting { /// Test write_file result parsing #[test] fn test_write_file_result() { - let result = format_write_file_result("✅ wrote 42 lines | 1500 chars"); + let result = format_write_file_result("wrote 42 lines | 1500 chars"); assert!(result.contains("42"), "Should contain line count: {}", result); assert!(result.contains("1500"), "Should contain char count: {}", result); } @@ -345,7 +345,7 @@ mod tool_output_formatting { /// Test write_file result with k notation #[test] fn test_write_file_result_k_notation() { - let result = format_write_file_result("✅ wrote 100 lines | 2.5k chars"); + let result = format_write_file_result("wrote 100 lines | 2.5k chars"); assert!(result.contains("100")); assert!(result.contains("2.5k")); } diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100755 index 0000000..c69fd11 --- /dev/null +++ b/scripts/install.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Build and install g3 and studio to ~/.local/bin + +set -e + +cd "$(dirname "$0")/.." + +INSTALL_DIR="$HOME/.local/bin" +mkdir -p "$INSTALL_DIR" + +echo "Building g3 and studio (release)..." +cargo build --release + +echo "Installing to $INSTALL_DIR..." +cp target/release/g3 "$INSTALL_DIR/" +cp target/release/studio "$INSTALL_DIR/g3-studio" +cp target/release/libVisionBridge.dylib "$INSTALL_DIR/" + +# Create symlink to override Android Studio's 'studio' command +# Remove existing symlink if present, but don't remove if it's a different file +if [ -L "$INSTALL_DIR/studio" ]; then + rm "$INSTALL_DIR/studio" +fi +ln -s "$INSTALL_DIR/g3-studio" "$INSTALL_DIR/studio" + +echo "Done! Installed:" +echo " $INSTALL_DIR/g3" +echo " $INSTALL_DIR/g3-studio" +echo " $INSTALL_DIR/studio -> g3-studio" +echo " $INSTALL_DIR/libVisionBridge.dylib" + +# Check if ~/.local/bin is in PATH +if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then + echo "" + echo "⚠️ $INSTALL_DIR is not in your PATH" + echo " Add this to your shell rc file:" + echo " export PATH=\"\$HOME/.local/bin:\$PATH\"" +fi