pub mod file;
pub mod system;
pub mod web;
pub mod search;
pub mod math;
pub mod media;
pub mod basic;
pub mod memory;
#[deprecated(since = "0.2.0", note = "请使用 `system::git` 模块代替")]
pub mod git {
pub use crate::system::git::*;
}
#[deprecated(since = "0.2.0", note = "请使用 `basic::echo` 模块代替")]
pub mod echo {
pub use crate::basic::echo::*;
}
#[deprecated(since = "0.2.0", note = "请使用 `file` 模块代替")]
pub use file as file_legacy;
#[deprecated(since = "0.2.0", note = "请使用 `system` 模块代替")]
pub use system as system_legacy;
#[deprecated(since = "0.2.0", note = "请使用 `web` 模块代替")]
pub use web as web_legacy;
pub use file::{FileEditTool, FileReadTool, FileToolConfig, FileWriteTool};
pub use system::{CmdExecTool, DatetimeTool, GitTool, ShellTool};
pub use web::{
BrowseTool, BrowserOpenTool, GithubTrendingTool, HttpRequestTool, SerpapiTool, TavilyTool,
WebFetchTool,
};
pub use search::{ContentSearchTool, GlobSearchTool};
pub use math::CalculatorTool;
pub use media::ImageInfoTool;
pub use basic::EchoTool;
pub use memory::{MemoryRecallTool, MemoryStoreTool};
pub use rucora_core::tool::ToolRegistry;
#[cfg(test)]
mod tests {
use std::path::Path;
#[test]
fn src_root_contains_only_declared_entry_files() {
let src_dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("src");
let allowed_root_files = ["lib.rs"];
let unexpected_files = std::fs::read_dir(&src_dir)
.expect("应能读取 rucora-tools/src 目录")
.flatten()
.map(|entry| entry.path())
.filter(|path| path.is_file())
.filter(|path| path.extension().and_then(|ext| ext.to_str()) == Some("rs"))
.filter_map(|path| {
let file_name = path.file_name()?.to_str()?;
(!allowed_root_files.contains(&file_name)).then(|| file_name.to_string())
})
.collect::<Vec<_>>();
assert!(
unexpected_files.is_empty(),
"发现未归类或未挂载的根目录工具文件:{unexpected_files:?}"
);
}
}