Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/chat-cli/src/cli/agent/root_command_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl AgentArgs {
Some(AgentSubcommands::Edit { name }) => {
let _agents = Agents::load(os, None, true, &mut stderr, mcp_enabled).await.0;
let (_agent, path_with_file_name) = Agent::get_agent_by_name(os, &name).await?;

let editor_cmd = std::env::var("EDITOR").unwrap_or_else(|_| "vi".to_string());
let mut cmd = std::process::Command::new(editor_cmd);

Expand Down
2 changes: 1 addition & 1 deletion crates/chat-cli/src/cli/chat/cli/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ impl AgentSubcommand {
let (_agent, path_with_file_name) = Agent::get_agent_by_name(os, &name)
.await
.map_err(|e| ChatError::Custom(Cow::Owned(e.to_string())))?;

let editor_cmd = std::env::var("EDITOR").unwrap_or_else(|_| "vi".to_string());
let mut cmd = std::process::Command::new(editor_cmd);

Expand Down
16 changes: 10 additions & 6 deletions crates/chat-cli/src/cli/chat/tools/execute/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ mod tests {
use crate::cli::agent::Agent;

let os = Os::new().await.unwrap();

// Test read-only command with default settings (allow_read_only = false)
let readonly_cmd = serde_json::from_value::<ExecuteCommand>(serde_json::json!({
"command": "ls -la",
Expand All @@ -519,15 +519,16 @@ mod tests {

#[tokio::test]
async fn test_eval_perm_allow_read_only_enabled() {
use std::collections::HashMap;

use crate::cli::agent::{
Agent,
ToolSettingTarget,
};
use std::collections::HashMap;

let os = Os::new().await.unwrap();
let tool_name = if cfg!(windows) { "execute_cmd" } else { "execute_bash" };

let agent = Agent {
name: "test_agent".to_string(),
tools_settings: {
Expand Down Expand Up @@ -566,15 +567,16 @@ mod tests {

#[tokio::test]
async fn test_eval_perm_allow_read_only_with_denied_commands() {
use std::collections::HashMap;

use crate::cli::agent::{
Agent,
ToolSettingTarget,
};
use std::collections::HashMap;

let os = Os::new().await.unwrap();
let tool_name = if cfg!(windows) { "execute_cmd" } else { "execute_bash" };

let agent = Agent {
name: "test_agent".to_string(),
tools_settings: {
Expand All @@ -599,7 +601,9 @@ mod tests {

let res = denied_readonly_cmd.eval_perm(&os, &agent);
// Should deny even read-only commands if they're in denied list
assert!(matches!(res, PermissionEvalResult::Deny(ref commands) if commands.contains(&"\\Als .*\\z".to_string())));
assert!(
matches!(res, PermissionEvalResult::Deny(ref commands) if commands.contains(&"\\Als .*\\z".to_string()))
);

// Test different read-only command not in denied list
let allowed_readonly_cmd = serde_json::from_value::<ExecuteCommand>(serde_json::json!({
Expand Down
2 changes: 1 addition & 1 deletion crates/chat-cli/src/mcp_client/oauth_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ async fn get_auth_manager(
};
let reg_as_str = serde_json::to_string_pretty(&reg)?;
let reg_parent_path = reg_full_path.parent().ok_or(OauthUtilError::MalformDirectory)?;
tokio::fs::create_dir(reg_parent_path).await?;
tokio::fs::create_dir_all(reg_parent_path).await?;
tokio::fs::write(reg_full_path, &reg_as_str).await?;

Ok(am)
Expand Down
Loading