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:
@@ -1,3 +1,5 @@
|
||||
//! Tool: `delete` — remove a file or empty directory relative to a workspace root.
|
||||
|
||||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
use serde_json::{json, Value};
|
||||
@@ -7,6 +9,7 @@ use super::super::ToolCtx;
|
||||
use super::super::resolve_path;
|
||||
use super::helpers::arg_str;
|
||||
|
||||
/// Tool: delete a file or empty directory. Refuses non-empty directories.
|
||||
pub struct Delete;
|
||||
|
||||
impl Tool for Delete {
|
||||
@@ -31,6 +34,10 @@ impl Tool for Delete {
|
||||
})
|
||||
}
|
||||
|
||||
/// Delete a file or empty directory. Returns success message or errors on failure.
|
||||
///
|
||||
/// Flow: resolve path → check existence → check dir/file → remove.
|
||||
/// Only empty directories are deletable (non-empty returns an error).
|
||||
fn run(&self, ctx: &ToolCtx, args: &Value) -> Result<String> {
|
||||
let rel = arg_str(args, "path")?;
|
||||
let path: PathBuf = resolve_path(&ctx.workspaces, &rel)?;
|
||||
|
||||
Reference in New Issue
Block a user