Skip to main content

Crate vbash

Crate vbash 

Source
Expand description

A virtual bash environment for AI agents.

Runs bash scripts in-process with a virtual filesystem. Includes sed, awk, jq, and most common Unix commands.

use vbash::Shell;

let mut shell = Shell::builder()
    .file("/data/names.txt", "alice\nbob\ncharlie")
    .build();

let result = shell.exec("cat /data/names.txt | sort | head -n 2").unwrap();
assert_eq!(result.stdout, "alice\nbob\n");
assert_eq!(result.exit_code, 0);

Re-exports§

pub use error::Error;
pub use commands::CommandFn;
pub use commands::CommandContext;
pub use fs::VirtualFs;
pub use fs::memory::InMemoryFs;
pub use fs::mountable::MountableFs;
pub use fs::overlay::OverlayFs;
pub use fs::readwrite::ReadWriteFs;

Modules§

ast
AST types for parsed bash scripts.
commands
Command registry and dispatch.
error
Error types for parsing, execution, and filesystem operations.
fs
Virtual filesystem trait and implementations.
interpreter
Executes parsed AST nodes against a virtual shell environment.
lexer
Tokenizes bash script strings into a token stream.
parser
Parses a token stream into an AST.

Structs§

Builder
Builder for configuring an Shell instance.
ExecOptions
Options for a single exec call.
ExecResult
Result of executing a bash command string.
ExecutionLimits
Configurable execution limits to prevent runaway scripts.
Shell
A virtual Bash environment.