(tool: &str)
| 808 | } |
| 809 | |
| 810 | fn tool_name_to_permission(tool: &str) -> String { |
| 811 | let normalized = tool.trim(); |
| 812 | match normalized.to_ascii_lowercase().as_str() { |
| 813 | "*" => "*".to_string(), |
| 814 | "read" => "read(*)".to_string(), |
| 815 | "write" => "write(*)".to_string(), |
| 816 | "edit" => "edit(*)".to_string(), |
| 817 | "grep" => "grep(*)".to_string(), |
| 818 | "glob" => "glob(*)".to_string(), |
| 819 | "ls" => "ls(*)".to_string(), |
| 820 | "bash" => "bash(*)".to_string(), |
| 821 | "task" => "task(*)".to_string(), |
| 822 | "parallel_task" | "parallel-task" => "parallel_task(*)".to_string(), |
| 823 | _ if normalized.contains('(') => normalized.to_string(), |
| 824 | _ => format!("{normalized}(*)"), |
| 825 | } |
| 826 | } |
| 827 | |
| 828 | fn permission_policy_from_tools(tools: &[String]) -> PermissionPolicy { |
| 829 | tools.iter().fold(PermissionPolicy::new(), |policy, tool| { |
no test coverage detected