chore(clippy): clear warning backlog and harden conversions (#383)
This commit is contained in:
parent
a91516df7a
commit
3234159c6c
9 changed files with 77 additions and 69 deletions
|
|
@ -902,8 +902,8 @@ mod tests {
|
|||
let json_str = r#"{"name": "GMAIL_SEND_EMAIL_WITH_ATTACHMENT", "appName": "gmail", "description": "Send email with attachment & special chars: <>'\"\"", "enabled": true}"#;
|
||||
let action: ComposioAction = serde_json::from_str(json_str).unwrap();
|
||||
assert_eq!(action.name, "GMAIL_SEND_EMAIL_WITH_ATTACHMENT");
|
||||
assert!(action.description.as_ref().unwrap().contains("&"));
|
||||
assert!(action.description.as_ref().unwrap().contains("<"));
|
||||
assert!(action.description.as_ref().unwrap().contains('&'));
|
||||
assert!(action.description.as_ref().unwrap().contains('<'));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ impl GitOperationsTool {
|
|||
|| arg_lower.starts_with("--upload-pack=")
|
||||
|| arg_lower.starts_with("--receive-pack=")
|
||||
|| arg_lower.contains("$(")
|
||||
|| arg_lower.contains("`")
|
||||
|| arg_lower.contains('`')
|
||||
|| arg.contains('|')
|
||||
|| arg.contains(';')
|
||||
{
|
||||
|
|
@ -90,10 +90,8 @@ impl GitOperationsTool {
|
|||
branch = line.trim_start_matches("# branch.head ").to_string();
|
||||
} else if let Some(rest) = line.strip_prefix("1 ") {
|
||||
// Ordinary changed entry
|
||||
let parts: Vec<&str> = rest.split(' ').collect();
|
||||
if parts.len() >= 2 {
|
||||
let path = parts.get(1).unwrap_or(&"");
|
||||
let staging = parts.get(0).unwrap_or(&"");
|
||||
let mut parts = rest.splitn(3, ' ');
|
||||
if let (Some(staging), Some(path)) = (parts.next(), parts.next()) {
|
||||
if !staging.is_empty() {
|
||||
let status_char = staging.chars().next().unwrap_or(' ');
|
||||
if status_char != '.' && status_char != ' ' {
|
||||
|
|
@ -203,7 +201,8 @@ impl GitOperationsTool {
|
|||
}
|
||||
|
||||
async fn git_log(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {
|
||||
let limit = args.get("limit").and_then(|v| v.as_u64()).unwrap_or(10) as usize;
|
||||
let limit_raw = args.get("limit").and_then(|v| v.as_u64()).unwrap_or(10);
|
||||
let limit = usize::try_from(limit_raw).unwrap_or(usize::MAX).min(1000);
|
||||
let limit_str = limit.to_string();
|
||||
|
||||
let output = self
|
||||
|
|
@ -383,7 +382,9 @@ impl GitOperationsTool {
|
|||
"pop" => self.run_git_command(&["stash", "pop"]).await,
|
||||
"list" => self.run_git_command(&["stash", "list"]).await,
|
||||
"drop" => {
|
||||
let index = args.get("index").and_then(|v| v.as_u64()).unwrap_or(0) as i32;
|
||||
let index_raw = args.get("index").and_then(|v| v.as_u64()).unwrap_or(0);
|
||||
let index = i32::try_from(index_raw)
|
||||
.map_err(|_| anyhow::anyhow!("stash index too large: {index_raw}"))?;
|
||||
self.run_git_command(&["stash", "drop", &format!("stash@{{{index}}}")])
|
||||
.await
|
||||
}
|
||||
|
|
@ -516,12 +517,7 @@ impl Tool for GitOperationsTool {
|
|||
error: Some("Action blocked: read-only mode".into()),
|
||||
});
|
||||
}
|
||||
AutonomyLevel::Supervised => {
|
||||
// Allow but require tracking
|
||||
}
|
||||
AutonomyLevel::Full => {
|
||||
// Allow freely
|
||||
}
|
||||
AutonomyLevel::Supervised | AutonomyLevel::Full => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue