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);

Structs§

Builder
Builder for configuring an Shell instance.
CommandContext
Provides filesystem, environment, and I/O access to commands.
ExecOptions
Options for a single exec call.
ExecResult
Result of executing a bash command string.
ExecutionLimits
Configurable execution limits to prevent runaway scripts.
InMemoryFs
A pure in-memory filesystem. No disk I/O whatsoever.
MountableFs
A filesystem router that composes multiple backends at different mount points.
OverlayFs
Copy-on-write overlay filesystem.
ParseError
A syntax error with source location.
ReadWriteFs
Direct read-write access to a real directory on the host filesystem.
SessionLimits
Shell
A virtual Bash environment.

Enums§

Error
Top-level error type for all vbash operations.
ExecError
Errors that can occur during command execution.
FsError
Filesystem errors modeled after POSIX errno values.
LimitKind
Which resource limit was exceeded.

Traits§

VirtualFs
A virtual filesystem that shell commands operate on.

Type Aliases§

CommandFn
Signature for all command implementations.