volition_core/tools/mod.rs
1// volition-agent-core/src/tools/mod.rs
2
3//! Contains implementations for standard, non-interactive tools.
4//!
5//! These functions provide the core logic for interacting with external commands
6//! (shell, git, cargo), the filesystem, and performing searches.
7//! They are designed as reusable building blocks for `ToolProvider` implementations.
8//!
9//! **Important:** These functions generally do *not* include safety checks
10//! (like command argument validation, file path sandboxing) or user interaction
11//! (like confirmation prompts). Callers, typically `ToolProvider` implementations,
12//! are responsible for adding necessary safety layers before invoking these core functions.
13
14pub mod cargo;
15pub mod fs;
16pub mod git;
17pub mod search;
18pub mod shell;
19
20/// Represents the structured output of an executed external command.
21#[derive(Debug, Clone, PartialEq)]
22pub struct CommandOutput {
23 /// The exit status code of the command (e.g., 0 for success).
24 pub status: i32,
25 /// The captured standard output as a string.
26 pub stdout: String,
27 /// The captured standard error as a string.
28 pub stderr: String,
29}
30
31impl CommandOutput {
32 /// Checks if the command executed successfully (status code 0).
33 pub fn success(&self) -> bool {
34 self.status == 0
35 }
36}