Clean up tool output formatting
- Shell: "✅ Command executed successfully" → "⚡️ ran successfully" - Write file: Remove ✏️ emoji, use plain "wrote N lines | M chars"
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -343,7 +343,7 @@ pub async fn execute_write_file<W: UiWriter>(
|
||||
format!("{}", char_count)
|
||||
};
|
||||
Ok(format!(
|
||||
"✅ wrote {} lines | {} chars",
|
||||
"wrote {} lines | {} chars",
|
||||
line_count, char_display
|
||||
))
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ pub async fn execute_shell<W: UiWriter>(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()
|
||||
})
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
38
scripts/install.sh
Executable file
38
scripts/install.sh
Executable file
@@ -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
|
||||
Reference in New Issue
Block a user