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,11 +1,21 @@
|
||||
//! Update the shared directory cache by resolving each path against
|
||||
//! workspaces and storing the resolved paths in `ctx.dir_cache`.
|
||||
//!
|
||||
//! The cache is an `Arc<RwLock<DirCache>>` shared with the TUI and
|
||||
//! other components so they can read the cached listing without
|
||||
//! re-scanning the filesystem.
|
||||
|
||||
use crate::tools::{resolve_path, ToolCtx};
|
||||
use anyhow::Result;
|
||||
use serde_json::{json, Value};
|
||||
use std::path::PathBuf;
|
||||
use tracing::{info, instrument};
|
||||
|
||||
/// Tool that updates the cached directory listing.
|
||||
///
|
||||
/// Flow: parse `paths` array → resolve each against workspaces →
|
||||
/// persist resolved paths into the shared `DirCache` via an
|
||||
/// async write → confirm with the entry count.
|
||||
pub struct DirCacheUpdate;
|
||||
|
||||
impl crate::tools::Tool for DirCacheUpdate {
|
||||
@@ -30,6 +40,7 @@ impl crate::tools::Tool for DirCacheUpdate {
|
||||
})
|
||||
}
|
||||
|
||||
#[instrument(skip(self, ctx, args))]
|
||||
fn run(&self, ctx: &ToolCtx, args: &Value) -> Result<String> {
|
||||
let paths: Vec<String> = args
|
||||
.get("paths")
|
||||
@@ -47,6 +58,7 @@ impl crate::tools::Tool for DirCacheUpdate {
|
||||
.collect::<Result<Vec<_>>>()?;
|
||||
|
||||
let count = resolved.len();
|
||||
info!(count, "directory cache update requested");
|
||||
|
||||
// Persist the resolved paths into the shared DirCache so the TUI
|
||||
// and other tools can read the cached listing without re-scanning.
|
||||
@@ -54,6 +66,7 @@ impl crate::tools::Tool for DirCacheUpdate {
|
||||
let rt = tokio::runtime::Runtime::new()?;
|
||||
rt.block_on(async { dc.write().await.set(resolved).await });
|
||||
|
||||
info!(count, "directory cache updated");
|
||||
Ok(format!("Directory cache updated with {} entries", count))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user