Centralize g3 status message formatting
Extract a new g3_status module in g3-cli that provides consistent formatting for all 'g3:' prefixed system status messages. Key changes: - Add G3Status struct with methods for progress, done, failed, error, etc. - Add Status enum with Done, Failed, Error, Resolved, Insufficient, NoChanges - Add ThinResult struct in g3-core for semantic thinning data - Update UiWriter trait with print_thin_result() method - Refactor context thinning to return ThinResult instead of formatted strings - Update all callers to use the new centralized formatting - Session resume/decline messages now use G3Status - Compaction status messages now use G3Status This maintains clean separation of concerns: g3-core emits semantic data, g3-cli handles all terminal formatting and colors.
This commit is contained in:
@@ -242,8 +242,16 @@ impl g3_core::ui_writer::UiWriter for PlannerUiWriter {
|
||||
println!("g3: {} ... [{}]", message, status);
|
||||
}
|
||||
|
||||
fn print_context_thinning(&self, message: &str) {
|
||||
println!("🗜️ {}", message);
|
||||
fn print_thin_result(&self, result: &g3_core::ThinResult) {
|
||||
// Simple text output for planner
|
||||
if result.had_changes {
|
||||
println!(
|
||||
"🗜️ thinning context ... {}% -> {}% ... [done]",
|
||||
result.before_percentage, result.after_percentage
|
||||
);
|
||||
} else {
|
||||
println!("🗜️ thinning context ... {}% ... [no changes]", result.before_percentage);
|
||||
}
|
||||
}
|
||||
|
||||
fn print_tool_header(&self, tool_name: &str, tool_args: Option<&serde_json::Value>) {
|
||||
|
||||
Reference in New Issue
Block a user