Enhance tool documentation and add new features

- Added module-level documentation for memory tools (`remember`, `recall`, `forget`) to clarify their purpose.
- Improved documentation in `recall.rs` and `remember.rs` to describe the functionality and flow of memory entry operations.
- Updated `mod.rs` to include descriptions for the tool trait and execution context.
- Enhanced `plan.rs` with detailed comments on plan-mode signaling tools.
- Documented text search tools in `search.rs` to explain their functionality.
- Improved sequential-thinking tool documentation in `seqthink.rs`.
- Added safety filter documentation in `shell_filter` for credential and git operations.
- Enhanced utility tools documentation, including `cd`, `dir_cache_update`, and `todowrite`.
- Improved rendering documentation in view modules (`chat`, `markdown`, `status`, `workflow`) to clarify rendering flows and purposes.
This commit is contained in:
asepharyana
2026-07-12 11:28:39 +07:00
parent 7158d362fd
commit 2efd40ca88
124 changed files with 2379 additions and 19 deletions
+13
View File
@@ -1,8 +1,11 @@
//! `cd` tool: verify and resolve a workspace-relative directory path.
use serde_json::{json, Value};
use anyhow::{Result, anyhow};
use super::super::Tool;
use super::super::ToolCtx;
/// Tool that resolves a workspace-relative path and reports whether it exists and is a dir.
pub struct Cd;
impl Tool for Cd {
@@ -27,6 +30,16 @@ impl Tool for Cd {
})
}
/// Resolve `path` against the workspace roots and report its status.
///
/// Flow: extract `path` → `resolve_path` (sandboxed to `ctx.workspaces`) →
/// check `exists()` and `is_dir()` → canonicalize → return canonical path.
///
/// Why: the agent has no persistent cwd between tool calls; "cd" here is purely a
/// verification + canonicalization helper rather than a state change.
///
/// Return: canonical path on success; explicit "does not exist" / "not a directory"
/// message (still `Ok`) so the model can react without treating it as an error.
fn run(&self, ctx: &ToolCtx, args: &Value) -> Result<String> {
let rel = args.get("path")
.and_then(|v| v.as_str())