Add fancy ASCII art header for agent mode
The agent mode header now shows: - Agent name in uppercase with box art - Working directory (truncated if too long) - Status indicators for README, AGENTS.md, and Memory loading - Task preview if provided Also exports truncate_for_display and adds truncate_path_for_display helper functions in project_files module.
This commit is contained in:
@@ -140,7 +140,8 @@ fn find_fallback_title(content: &str) -> Option<String> {
|
||||
}
|
||||
|
||||
/// Truncate a string for display, adding ellipsis if needed.
|
||||
fn truncate_for_display(s: &str, max_len: usize) -> String {
|
||||
/// Used for displaying long strings in fixed-width UI elements.
|
||||
pub fn truncate_for_display(s: &str, max_len: usize) -> String {
|
||||
if s.len() > max_len {
|
||||
format!("{}...", &s[..max_len - 3])
|
||||
} else {
|
||||
@@ -148,6 +149,20 @@ fn truncate_for_display(s: &str, max_len: usize) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
/// Truncate a path for display, showing the end portion if too long.
|
||||
/// For paths, we want to show the most relevant part (the end).
|
||||
pub fn truncate_path_for_display(path: &std::path::Path, max_len: usize) -> String {
|
||||
let path_str = path.display().to_string();
|
||||
if path_str.len() > max_len {
|
||||
// Show the end of the path with ... prefix
|
||||
let start = path_str.len() - (max_len - 3);
|
||||
// Find a path separator to break at cleanly if possible
|
||||
format!("...{}", &path_str[start..])
|
||||
} else {
|
||||
path_str
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user