1pub mod file;
32
33pub mod system;
37
38pub mod web;
42
43pub mod search;
47
48pub mod math;
52
53pub mod media;
57
58pub mod basic;
62
63pub mod memory;
67
68#[deprecated(since = "0.2.0", note = "请使用 `system::git` 模块代替")]
70pub mod git {
71 pub use crate::system::git::*;
72}
73
74#[deprecated(since = "0.2.0", note = "请使用 `basic::echo` 模块代替")]
76pub mod echo {
77 pub use crate::basic::echo::*;
78}
79
80#[deprecated(since = "0.2.0", note = "请使用 `file` 模块代替")]
84pub use file as file_legacy;
85
86#[deprecated(since = "0.2.0", note = "请使用 `system` 模块代替")]
88pub use system as system_legacy;
89
90#[deprecated(since = "0.2.0", note = "请使用 `web` 模块代替")]
92pub use web as web_legacy;
93
94pub use file::{FileEditTool, FileReadTool, FileToolConfig, FileWriteTool};
98
99pub use system::{CmdExecTool, DatetimeTool, GitTool, ShellTool};
101
102pub use web::{
104 BrowseTool, BrowserOpenTool, GithubTrendingTool, HttpRequestTool, SerpapiTool, TavilyTool,
105 WebFetchTool,
106};
107
108pub use search::{ContentSearchTool, GlobSearchTool};
110
111pub use math::CalculatorTool;
113
114pub use media::ImageInfoTool;
116
117pub use basic::EchoTool;
119
120pub use memory::{MemoryRecallTool, MemoryStoreTool};
122
123pub use rucora_core::tool::ToolRegistry;
125
126#[cfg(test)]
127mod tests {
128 use std::path::Path;
129
130 #[test]
131 fn src_root_contains_only_declared_entry_files() {
132 let src_dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("src");
133 let allowed_root_files = ["lib.rs"];
134
135 let unexpected_files = std::fs::read_dir(&src_dir)
136 .expect("应能读取 rucora-tools/src 目录")
137 .flatten()
138 .map(|entry| entry.path())
139 .filter(|path| path.is_file())
140 .filter(|path| path.extension().and_then(|ext| ext.to_str()) == Some("rs"))
141 .filter_map(|path| {
142 let file_name = path.file_name()?.to_str()?;
143 (!allowed_root_files.contains(&file_name)).then(|| file_name.to_string())
144 })
145 .collect::<Vec<_>>();
146
147 assert!(
148 unexpected_files.is_empty(),
149 "发现未归类或未挂载的根目录工具文件:{unexpected_files:?}"
150 );
151 }
152}