Implement chat and markdown views, enhance status bar, and add workflow panel
- Added `chat.rs` for rendering chat messages with timestamps and roles. - Introduced `markdown.rs` for rendering markdown content with styling. - Created `status.rs` to display the application status bar with session and message counts. - Developed `workflow.rs` to show the current workflow status, including tool calls and active jobs. - Established a `theme.rs` for centralized color management across the UI. - Updated `mod.rs` to include new modules and manage rendering logic.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
use serde_json::{json, Value};
|
||||
use anyhow::{Result, anyhow};
|
||||
use std::process::Command;
|
||||
use super::Tool;
|
||||
use super::ToolCtx;
|
||||
|
||||
pub struct GitCred;
|
||||
|
||||
impl Tool for GitCred {
|
||||
fn name(&self) -> &'static str {
|
||||
"git_cred"
|
||||
}
|
||||
|
||||
fn description(&self) -> &'static str {
|
||||
"Interact with git credential helper (store, get, erase credentials)"
|
||||
}
|
||||
|
||||
fn parameters(&self) -> Value {
|
||||
json!({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"operation": {
|
||||
"type": "string",
|
||||
"enum": ["store", "get", "erase"],
|
||||
"description": "Git credential operation"
|
||||
}
|
||||
},
|
||||
"required": ["operation"]
|
||||
})
|
||||
}
|
||||
|
||||
fn run(&self, _ctx: &ToolCtx, args: &Value) -> Result<String> {
|
||||
let operation = args.get("operation")
|
||||
.and_then(|v| v.as_str())
|
||||
.ok_or_else(|| anyhow!("missing required argument: operation"))?;
|
||||
let output = Command::new("git")
|
||||
.arg("credential")
|
||||
.arg(operation)
|
||||
.output()
|
||||
.map_err(|e| anyhow!("git credential failed: {}", e))?;
|
||||
if output.status.success() {
|
||||
let stdout = String::from_utf8_lossy(&output.stdout).to_string();
|
||||
let stderr = String::from_utf8_lossy(&output.stderr).to_string();
|
||||
Ok(format!("{}{}", stdout, stderr))
|
||||
} else {
|
||||
let stderr = String::from_utf8_lossy(&output.stderr).to_string();
|
||||
anyhow::bail!("git credential '{}' failed: {}", operation, stderr.trim())
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user