Skip to content

Commit 099f41c

Browse files
committed
port execute_bash summary from main
1 parent 202b5b7 commit 099f41c

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

crates/chat-cli/src/cli/chat/tools/execute_bash.rs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const READONLY_COMMANDS: &[&str] = &["ls", "cat", "echo", "pwd", "which", "head"
3333
#[derive(Debug, Clone, Deserialize)]
3434
pub struct ExecuteBash {
3535
pub command: String,
36+
pub summary: Option<String>,
3637
}
3738

3839
impl ExecuteBash {
@@ -114,13 +115,29 @@ impl ExecuteBash {
114115
queue!(updates, style::Print("\n"),)?;
115116
}
116117

117-
Ok(queue!(
118+
queue!(
118119
updates,
119120
style::SetForegroundColor(Color::Green),
120121
style::Print(&self.command),
121-
style::Print("\n\n"),
122+
style::Print("\n"),
122123
style::ResetColor
123-
)?)
124+
)?;
125+
126+
// Add the summary if available
127+
if let Some(summary) = &self.summary {
128+
queue!(
129+
updates,
130+
style::SetForegroundColor(Color::Blue),
131+
style::Print("\nPurpose: "),
132+
style::ResetColor,
133+
style::Print(summary),
134+
style::Print("\n"),
135+
)?;
136+
}
137+
138+
queue!(updates, style::Print("\n"))?;
139+
140+
Ok(())
124141
}
125142

126143
pub async fn validate(&mut self, _ctx: &Context) -> Result<()> {

crates/chat-cli/src/cli/chat/tools/tool_index.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
"command": {
99
"type": "string",
1010
"description": "Bash command to execute"
11+
},
12+
"summary": {
13+
"type": "string",
14+
"description": "A brief explanation of what the command does"
1115
}
1216
},
1317
"required": ["command"]

0 commit comments

Comments
 (0)