feat: add compact UI output for Plan Mode tools
Plan tools (plan_read, plan_write) now display with elegant tree-style formatting similar to the old todo_write UI: - State indicators: □ (todo), ◐ (doing), ■ (done), ⊘ (blocked) - Tree prefixes (├/└) for items with child details - Strikethrough for completed items - Shows touches and all three checks (happy/negative/boundary) - Displays plan file path link at the end plan_approve uses compact single-line format like read_file: - Shows approval status and revision number - Handles already-approved and error cases Changes: - Add print_plan_compact() to UiWriter trait with default impl - Implement print_plan_compact() in ConsoleUiWriter - Call print_plan_compact() from execute_plan_read/write - Add plan_read/plan_write to is_self_handled_tool() - Add plan_approve to is_compact_tool() with format_plan_approve_summary() - Add serde_yaml dependency to g3-cli
This commit is contained in:
@@ -101,11 +101,15 @@ pub fn is_compact_tool(tool_name: &str) -> bool {
|
||||
| "coverage"
|
||||
| "rehydrate"
|
||||
| "code_search"
|
||||
| "plan_approve"
|
||||
)
|
||||
}
|
||||
|
||||
pub fn is_self_handled_tool(tool_name: &str) -> bool {
|
||||
tool_name == "todo_read" || tool_name == "todo_write"
|
||||
matches!(tool_name,
|
||||
"todo_read" | "todo_write" |
|
||||
"plan_read" | "plan_write"
|
||||
)
|
||||
}
|
||||
|
||||
/// Format a compact summary for a successful compact tool
|
||||
@@ -125,6 +129,7 @@ fn format_compact_tool_summary(tool_name: &str, tool_result: &str) -> String {
|
||||
"coverage" => format_coverage_summary(tool_result),
|
||||
"rehydrate" => format_rehydrate_summary(tool_result),
|
||||
"code_search" => format_code_search_summary(tool_result),
|
||||
"plan_approve" => format_plan_approve_summary(tool_result),
|
||||
_ => "✅ completed".to_string(),
|
||||
}
|
||||
}
|
||||
@@ -512,6 +517,25 @@ pub fn format_code_search_summary(result: &str) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
/// Format a plan_approve result summary.
|
||||
pub fn format_plan_approve_summary(result: &str) -> String {
|
||||
// Result formats:
|
||||
// "✅ Plan approved at revision N. You may now begin implementation."
|
||||
// "ℹ️ Plan already approved at revision N. Current revision: M"
|
||||
// "❌ No plan exists to approve..."
|
||||
if result.contains("❌") {
|
||||
"❌ failed".to_string()
|
||||
} else if result.contains("already approved") {
|
||||
"ℹ️ already approved".to_string()
|
||||
} else if let Some(pos) = result.find("revision ") {
|
||||
let after = &result[pos + 9..];
|
||||
let rev: String = after.chars().take_while(|c| c.is_ascii_digit()).collect();
|
||||
format!("✅ approved rev {}", rev)
|
||||
} else {
|
||||
"✅ approved".to_string()
|
||||
}
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// Tool Call Deduplication
|
||||
// =============================================================================
|
||||
|
||||
Reference in New Issue
Block a user