kodegen_bash_shell

Crates.iokodegen_bash_shell
lib.rskodegen_bash_shell
version0.10.10
created_at2025-12-02 06:23:18.795294+00
updated_at2026-01-02 14:59:01.370648+00
descriptionEmbeddable POSIX/bash shell with cancellation support. Fork of brush-shell.
homepagehttps://kodegen.ai
repositoryhttps://github.com/cyrup-ai/kodegen-bash-shell
max_upload_size
id1961189
size1,474,541
David Maple (kloudsamurai)

documentation

README

kodegen-bash-shell

A permanent fork of brush-shell with programmatic command cancellation support.

Overview

kodegen-bash-shell provides an embeddable POSIX/bash-compatible shell interpreter for Rust applications, with the critical addition of cancellation token support for interrupting running commands programmatically.

This fork exists because the upstream brush-shell, while excellent, does not provide a mechanism to cancel run_string() execution from an embedding context. For AI code generation agents that need to interrupt long-running commands, this capability is essential.

Fork Status

This is a permanent fork, not a temporary divergence. We do not expect these changes to be upstreamed, as they represent a fundamental architectural addition that may not align with the upstream project's goals.

Component Upstream Version Fork Package
brush-core 0.4.0 kodegen-bash-shell
brush-parser 0.3.0 kodegen-bash-parser
brush-builtins 0.1.0 kodegen-bash-builtins

Key Addition: CancellationToken

use kodegen_bash_shell::{Shell, ExecutionParameters, CancellationToken};

// Create a cancellation token
let token = CancellationToken::new();
let token_clone = token.clone();

// Pass token to execution parameters
let mut params = shell.default_exec_params();
params.set_cancellation_token(token_clone);

// Run command (can be cancelled)
let handle = tokio::spawn(async move {
    shell.run_string("sleep 60", &params).await
});

// Cancel from another task
token.cancel();

// Command returns with Interrupted result
let result = handle.await?;
assert!(result.is_interrupted());

Credits

This project is built on the excellent work of Reuben Olinsky (@reubeno) and the brush-shell project.

See ACKNOWLEDGEMENTS.md for full attribution.

License

Licensed under either of:

at your option.

The original brush-shell code by Reuben Olinsky is licensed under MIT. Fork modifications by KODEGEN.AI are dual-licensed under Apache-2.0 OR MIT.

See LICENSE for full details.

Commit count: 0

cargo fmt