Skip to main content

soul_coder/
lib.rs

1//! # soul-coder
2//!
3//! Coding-specific tools for [soul-core](https://crates.io/crates/soul-core) —
4//! read, write, edit, bash, grep, find, ls.
5//!
6//! WASM-first, cross-platform. All tools use `soul_core::vfs::VirtualFs` and
7//! `soul_core::vexec::VirtualExecutor` for platform abstraction, enabling
8//! full operation in both native and WebAssembly environments.
9//!
10//! ## Quick Start
11//!
12//! ```rust
13//! use std::sync::Arc;
14//! use soul_core::vfs::MemoryFs;
15//! use soul_core::vexec::NoopExecutor;
16//! use soul_coder::presets;
17//!
18//! // Create all 7 coding tools with in-memory VFS (WASM-ready)
19//! let fs = Arc::new(MemoryFs::new());
20//! let exec = Arc::new(NoopExecutor);
21//! let registry = presets::all_tools(fs, exec, "/workspace");
22//!
23//! assert_eq!(registry.len(), 7);
24//! ```
25//!
26//! ## Tool Presets
27//!
28//! | Preset | Tools | Use Case |
29//! |--------|-------|----------|
30//! | `coding_tools` | read, write, edit, bash | Interactive coding sessions |
31//! | `read_only_tools` | read, grep, find, ls | Codebase exploration |
32//! | `all_tools` | all 7 tools | Full agent capabilities |
33//!
34//! ## ExecutorRegistry Integration
35//!
36//! For integration with soul-core's config-driven executor system:
37//!
38//! ```rust
39//! use std::sync::Arc;
40//! use soul_core::vfs::MemoryFs;
41//! use soul_core::vexec::NoopExecutor;
42//!
43//! let fs = Arc::new(MemoryFs::new());
44//! let exec = Arc::new(NoopExecutor);
45//! let registry = soul_coder::presets::all_executor(fs, exec, "/workspace");
46//!
47//! assert!(registry.has_tool("read"));
48//! ```
49//!
50//! ## Individual Tools
51//!
52//! Each tool can be instantiated independently:
53//!
54//! ```rust
55//! use std::sync::Arc;
56//! use soul_core::vfs::MemoryFs;
57//! use soul_coder::tools::read::ReadTool;
58//!
59//! let fs = Arc::new(MemoryFs::new());
60//! let tool = ReadTool::new(fs, "/workspace");
61//! ```
62
63pub mod presets;
64pub mod tools;
65pub mod truncate;
66
67// Re-export key types for convenience
68pub use presets::{
69    all_executor, all_tools, coding_executor, coding_tools, read_only_tools, wrap_as_executor,
70};
71pub use tools::{
72    bash::BashTool,
73    edit::EditTool,
74    find::FindTool,
75    grep::GrepTool,
76    ls::LsTool,
77    read::ReadTool,
78    write::WriteTool,
79};