Skip to main content

BashShape

Struct BashShape 

Source
pub struct BashShape {
    pub primary_program: Option<String>,
    pub all_programs: Vec<String>,
    pub list_ops: Vec<String>,
    pub pipeline_stages: usize,
    pub redirects: Vec<String>,
    pub has_heredoc: bool,
    pub cwd_hint: Option<String>,
    pub side_effect: Option<SideEffect>,
    pub kind: Option<ProgramKind>,
    pub top_level_statements: Vec<StatementSlice>,
}
Expand description

Compact summary of a bash command string, attached to args._shape on each normalised Bash tool-call frame. All fields are optional/additive: readers must ignore unknown keys, and missing keys mean “not computed” (older sessions, parse failure).

Fields§

§primary_program: Option<String>

First command’s program name after stripping a leading cd X && prefix and any leading var=val assignments — what the operator was actually trying to run.

§all_programs: Vec<String>

All program names found in the script, in invocation order, deduped.

§list_ops: Vec<String>

Top-level list operators present ("&&", "||"), deduped.

§pipeline_stages: usize

Maximum pipeline stage count seen (1 = no pipe, >1 = piped).

§redirects: Vec<String>

File-redirect operators (>, >>, &>, …) used anywhere in the script.

§has_heredoc: bool

true when a <<EOF heredoc opens — UI can collapse the body.

§cwd_hint: Option<String>

Working-directory hint: argument of a leading cd that was stripped when determining primary_program. Rendered as “(in foo/bar)”.

§side_effect: Option<SideEffect>

Side-effect classification derived from primary_program + first argument. None = read-only or unknown.

§kind: Option<ProgramKind>

Coarse program category derived from primary_program alone. Lets the UI pick an icon / activity bucket without re-mapping a hardcoded program list in TS. Orthogonal to side_effectkind is what the program is, side_effect is what this invocation does.

§top_level_statements: Vec<StatementSlice>

Source byte ranges of each top-level statement in program.statements, in order. Use this — never raw.split('\n') — when a consumer needs to segment a multi-statement bash string back into its individual commands (e.g. the conveyor modal’s batch-approve UI). \<LF> line-continuations are collapsed at the lexer level by tree-sitter, so a backslash-continued multi-flag invocation yields ONE slice, not one per \<LF>.

Trait Implementations§

Source§

impl Clone for BashShape

Source§

fn clone(&self) -> BashShape

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BashShape

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for BashShape

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for BashShape

Source§

fn eq(&self, other: &BashShape) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for BashShape

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for BashShape

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.