From 57b7bcb0de30b868fa5acbe84bfa81a1b3b2eeef Mon Sep 17 00:00:00 2001 From: Dhanji Prasanna Date: Fri, 10 Oct 2025 14:18:35 +1100 Subject: [PATCH] cosmetic tool call stuff --- crates/g3-cli/src/lib.rs | 59 +++++++++++++++-------------- crates/g3-cli/src/ui_writer_impl.rs | 4 +- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/crates/g3-cli/src/lib.rs b/crates/g3-cli/src/lib.rs index b5b843b..43c9c50 100644 --- a/crates/g3-cli/src/lib.rs +++ b/crates/g3-cli/src/lib.rs @@ -249,7 +249,7 @@ fn extract_readme_heading(readme_content: &str) -> Option { // Process the content line by line, skipping the prefix line if present let lines_iter = readme_content.lines(); let mut content_lines = Vec::new(); - + for line in lines_iter { // Skip the "📚 Project README (from ...):" line if line.starts_with("📚 Project README") { @@ -258,11 +258,11 @@ fn extract_readme_heading(readme_content: &str) -> Option { content_lines.push(line); } let content = content_lines.join("\n"); - + // Look for the first markdown heading for line in content.lines() { let trimmed = line.trim(); - + // Check for H1 heading (# Title) if trimmed.starts_with("# ") { let title = trimmed[2..].trim(); @@ -271,17 +271,21 @@ fn extract_readme_heading(readme_content: &str) -> Option { return Some(title.to_string()); } } - + // Skip other markdown headings for now (##, ###, etc.) // We're only looking for the main H1 heading } - + // If no H1 heading found, look for the first non-empty, non-metadata line as a fallback for line in content.lines().take(5) { let trimmed = line.trim(); // Skip empty lines, other heading markers, and metadata - if !trimmed.is_empty() && !trimmed.starts_with("📚") && !trimmed.starts_with('#') - && !trimmed.starts_with("==") && !trimmed.starts_with("--") { + if !trimmed.is_empty() + && !trimmed.starts_with("📚") + && !trimmed.starts_with('#') + && !trimmed.starts_with("==") + && !trimmed.starts_with("--") + { // Limit length for display return Some(if trimmed.len() > 100 { format!("{}...", &trimmed[..97]) @@ -334,7 +338,10 @@ async fn run_interactive_retro( } else { "PROJECT DOCUMENTATION LOADED".to_string() }; - tui.output(&format!("SYSTEM: PROJECT README LOADED - {}\n\n", readme_snippet)); + tui.output(&format!( + "SYSTEM: PROJECT README LOADED - {}\n\n", + readme_snippet + )); } tui.output("SYSTEM: READY FOR INPUT\n\n"); tui.output("\n\n"); @@ -561,27 +568,10 @@ async fn run_interactive( let output = SimpleOutput::new(); output.print(""); - output.print("🪿 G3 AI Coding Agent - Interactive Mode"); - output.print("I solve problems by writing and executing code. what shall we build today?"); + output.print("🪿 G3 AI Coding Agent"); + output.print(" >> what shall we build today?"); output.print(""); - // Display message if README was loaded - if readme_content.is_some() { - // Extract the first heading or title from the README - let readme_snippet = if let Some(ref content) = readme_content { - extract_readme_heading(content) - .unwrap_or_else(|| "Project documentation loaded".to_string()) - } else { - "Project documentation loaded".to_string() - }; - - output.print(&format!("📚 Project README loaded: {}", readme_snippet)); - if readme_snippet.len() > 80 { - output.print(" (Full README available in context)"); - } - output.print(""); - } - // Display provider and model information match agent.get_provider_info() { Ok((provider, model)) => { @@ -592,8 +582,19 @@ async fn run_interactive( } } - output.print(""); - output.print("CTRL-D to quit; ↑/↓ for history"); + // Display message if README was loaded + if readme_content.is_some() { + // Extract the first heading or title from the README + let readme_snippet = if let Some(ref content) = readme_content { + extract_readme_heading(content) + .unwrap_or_else(|| "Project documentation loaded".to_string()) + } else { + "Project documentation loaded".to_string() + }; + + output.print(&format!("📚 detected: {}", readme_snippet)); + } + output.print(""); // Initialize rustyline editor with history diff --git a/crates/g3-cli/src/ui_writer_impl.rs b/crates/g3-cli/src/ui_writer_impl.rs index 78aca49..70a9e01 100644 --- a/crates/g3-cli/src/ui_writer_impl.rs +++ b/crates/g3-cli/src/ui_writer_impl.rs @@ -98,12 +98,12 @@ impl UiWriter for ConsoleUiWriter { } fn print_tool_output_line(&self, line: &str) { - println!("│ {}", line); + println!("│ \x1b[2m{}\x1b[0m", line); } fn print_tool_output_summary(&self, hidden_count: usize) { println!( - "│ ... ({} more line{})", + "│ \x1b[2m... ({} more line{})\x1b[0m", hidden_count, if hidden_count == 1 { "" } else { "s" } );