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:
asepharyana
2026-07-20 15:53:43 +07:00
parent f84dfb8476
commit 16494d4b1e
69 changed files with 637 additions and 30 deletions
+8
View File
@@ -4,7 +4,11 @@ use crate::tools::{resolve_path, Tool, ToolCtx};
use anyhow::Result;
use serde_json::{json, Value};
use std::fs;
use tracing::{info, instrument, warn};
/// Read the contents of a file.
///
/// Flow: resolve path → check existence and type → read file content → return.
pub struct Read;
impl Tool for Read {
@@ -29,16 +33,20 @@ impl Tool for Read {
})
}
#[instrument(skip(self, ctx, args))]
fn run(&self, ctx: &ToolCtx, args: &Value) -> Result<String> {
let rel = crate::tools::arg_str(args, "path")?;
let path = resolve_path(&ctx.workspaces, &rel)?;
if !path.exists() {
warn!(rel = %rel, "read target does not exist");
anyhow::bail!("file '{rel}' does not exist");
}
if !path.is_file() {
warn!(rel = %rel, "read target is not a file");
anyhow::bail!("'{rel}' is not a file");
}
let content = fs::read_to_string(&path)?;
info!(rel = %rel, bytes = content.len(), "file read");
Ok(content)
}
}