agent: Use current shell (#28470)
Release Notes: - agent: Replace `bash` tool with `terminal` tool which uses the current shell --------- Co-authored-by: Bennet <bennet@zed.dev> Co-authored-by: Antonio <antonio@zed.dev>
This commit is contained in:
parent
8ac378b86e
commit
90bcde116f
15 changed files with 334 additions and 74 deletions
29
crates/migrator/src/migrations/m_2025_04_15/settings.rs
Normal file
29
crates/migrator/src/migrations/m_2025_04_15/settings.rs
Normal file
|
@ -0,0 +1,29 @@
|
|||
use std::ops::Range;
|
||||
use tree_sitter::{Query, QueryMatch};
|
||||
|
||||
use crate::MigrationPatterns;
|
||||
use crate::patterns::SETTINGS_ASSISTANT_TOOLS_PATTERN;
|
||||
|
||||
pub const SETTINGS_PATTERNS: MigrationPatterns = &[(
|
||||
SETTINGS_ASSISTANT_TOOLS_PATTERN,
|
||||
replace_bash_with_terminal_in_profiles,
|
||||
)];
|
||||
|
||||
fn replace_bash_with_terminal_in_profiles(
|
||||
contents: &str,
|
||||
mat: &QueryMatch,
|
||||
query: &Query,
|
||||
) -> Option<(Range<usize>, String)> {
|
||||
let tool_name_capture_ix = query.capture_index_for_name("tool_name")?;
|
||||
let tool_name_range = mat
|
||||
.nodes_for_capture_index(tool_name_capture_ix)
|
||||
.next()?
|
||||
.byte_range();
|
||||
let tool_name = contents.get(tool_name_range.clone())?;
|
||||
|
||||
if tool_name != "bash" {
|
||||
return None;
|
||||
}
|
||||
|
||||
Some((tool_name_range, "terminal".to_string()))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue