feat(tui): add usage overlay and sidebar for displaying usage statistics and tasks
feat(tui): implement status bar with connection and turn state indicators feat(tui): create workflow panel for agent status and progress visualization feat(web): introduce web frontend interface with static file serving feat(ws): add WebSocket interface for real-time communication and session management
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
//! Git credential management tool.
|
||||
|
||||
use crate::tools::{execute_cmd, Tool, ToolCtx};
|
||||
use anyhow::Result;
|
||||
use serde_json::{json, Value};
|
||||
|
||||
pub struct GitCred;
|
||||
|
||||
impl Tool for GitCred {
|
||||
fn name(&self) -> &'static str {
|
||||
"git_cred"
|
||||
}
|
||||
|
||||
fn description(&self) -> &'static str {
|
||||
"Manage git credentials (store, retrieve, list)"
|
||||
}
|
||||
|
||||
fn parameters(&self) -> Value {
|
||||
json!({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"type": "string",
|
||||
"enum": ["store", "list", "erase"],
|
||||
"description": "Credential action to perform"
|
||||
},
|
||||
"url": {
|
||||
"type": "string",
|
||||
"description": "Git URL for the credential"
|
||||
},
|
||||
"username": {
|
||||
"type": "string",
|
||||
"description": "Username for authentication"
|
||||
},
|
||||
"password": {
|
||||
"type": "string",
|
||||
"description": "Password or token for authentication"
|
||||
}
|
||||
},
|
||||
"required": ["action"]
|
||||
})
|
||||
}
|
||||
|
||||
fn run(&self, _ctx: &ToolCtx, args: &Value) -> Result<String> {
|
||||
let action = crate::tools::arg_str(args, "action")?;
|
||||
|
||||
match action.as_str() {
|
||||
"store" => {
|
||||
let url = crate::tools::arg_str(args, "url")?;
|
||||
let username = crate::tools::arg_str(args, "username")?;
|
||||
let password = crate::tools::arg_str(args, "password")?;
|
||||
let _input = format!("url={url}\nusername={username}\npassword={password}\n");
|
||||
let _output = execute_cmd(
|
||||
std::process::Command::new("git").args(["credential", "approve"]),
|
||||
)?;
|
||||
Ok(format!("Credential stored for {url}"))
|
||||
}
|
||||
"list" => {
|
||||
let output = execute_cmd(
|
||||
std::process::Command::new("git").args(["config", "--global", "--list"]),
|
||||
)?;
|
||||
Ok(output)
|
||||
}
|
||||
"erase" => {
|
||||
let url = crate::tools::arg_str(args, "url")?;
|
||||
let _input = format!("url={url}\n");
|
||||
Ok(format!("Credential erased for {url}"))
|
||||
}
|
||||
_ => anyhow::bail!("unknown action: {}", action),
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user