Enhance logging and documentation across utility tools and TUI overlays
- Added tracing instrumentation and improved logging messages in the Pong, Todofinish, and Todowrite tools for better debugging and monitoring. - Enhanced documentation comments for clarity on tool functionalities and workflows. - Implemented tracing in WorkflowRun, NoteFinding, ReadFindings, and HiveMind tools to track execution phases and findings. - Updated TUI overlays (e.g., Bash, Clear Confirm, Editor, Effort Level, Help, Key Input, Learning, Loading, MCP, Model Selector, Plan, Quit Confirm, Rewind, Settings, Todo, Usage) with debug logging to capture rendering details. - Improved the status bar and workflow panel rendering with additional debug information. - Added tracing to various utility functions to facilitate better performance monitoring and error tracking.
This commit is contained in:
@@ -1,9 +1,19 @@
|
||||
//! Write a TODO item.
|
||||
//!
|
||||
//! Appends a new unchecked TODO entry to the session's `TODO.md`
|
||||
//! file with an optional priority marker and emits a
|
||||
//! `TurnEvent::TodoUpdate` for the TUI.
|
||||
|
||||
use crate::tools::{Tool, ToolCtx};
|
||||
use anyhow::Result;
|
||||
use serde_json::{json, Value};
|
||||
use tracing::{info, instrument};
|
||||
|
||||
/// Tool that adds an item to the session TODO list.
|
||||
///
|
||||
/// Flow: parse item + optional priority → append `- [priority] item\n`
|
||||
/// to `TODO.md` → write file → push `TurnEvent::TodoUpdate` if events
|
||||
/// channel exists → confirm addition.
|
||||
pub struct Todowrite;
|
||||
|
||||
impl Tool for Todowrite {
|
||||
@@ -33,6 +43,7 @@ impl Tool for Todowrite {
|
||||
})
|
||||
}
|
||||
|
||||
#[instrument(skip(self, ctx, args))]
|
||||
fn run(&self, ctx: &ToolCtx, args: &Value) -> Result<String> {
|
||||
let item = crate::tools::arg_str(args, "item")?;
|
||||
let priority = args
|
||||
@@ -40,6 +51,8 @@ impl Tool for Todowrite {
|
||||
.and_then(|v| v.as_str())
|
||||
.unwrap_or("medium");
|
||||
|
||||
info!(item, priority, "todowrite invoked");
|
||||
|
||||
let todo_line = format!("- [{}] {}\n", priority, item);
|
||||
|
||||
let todo_path = ctx.session_dir.join("TODO.md");
|
||||
@@ -53,6 +66,7 @@ impl Tool for Todowrite {
|
||||
q.push_back(crate::TurnEvent::TodoUpdate(content));
|
||||
}
|
||||
|
||||
info!(item, priority, "TODO item added");
|
||||
Ok(format!("[{}] TODO added: {}", priority, item))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user