mirror of
https://github.com/RightNow-AI/openfang.git
synced 2026-07-30 23:05:08 +00:00
Open-source Agent OS built in Rust. - 14 crates, 1,767+ tests, zero clippy warnings - 7 autonomous Hands (Clip, Lead, Collector, Predictor, Researcher, Twitter, Browser) - 16 security systems (WASM sandbox, Merkle audit trail, taint tracking, Ed25519 signing, SSRF protection, secret zeroization, HMAC-SHA256 mutual auth, and more) - 30 pre-built agents across 4 performance tiers - 40 channel adapters (Telegram, Discord, Slack, WhatsApp, Teams, and 35 more) - 38 built-in tools + MCP client/server + A2A protocol - 26 LLM providers with intelligent routing and cost tracking - 60+ bundled skills with FangHub marketplace - Tauri 2.0 native desktop app - 140+ REST/WS/SSE API endpoints with Alpine.js dashboard - OpenAI-compatible /v1/chat/completions endpoint - One-command install, production-ready
123 lines
3.5 KiB
Rust
123 lines
3.5 KiB
Rust
//! Shared UI primitives for non-TUI subcommands (doctor, status, etc.).
|
|
//!
|
|
//! Uses `colored` for terminal output. The interactive TUI uses ratatui instead.
|
|
|
|
use colored::Colorize;
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Existing helpers
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/// Doctor-style check: passed (green checkmark).
|
|
pub fn check_ok(msg: &str) {
|
|
println!(" {} {}", "\u{2714}".bright_green(), msg);
|
|
}
|
|
|
|
/// Doctor-style check: warning (yellow dash).
|
|
pub fn check_warn(msg: &str) {
|
|
println!(" {} {}", "-".bright_yellow(), msg.yellow());
|
|
}
|
|
|
|
/// Doctor-style check: failed (red cross).
|
|
pub fn check_fail(msg: &str) {
|
|
println!(" {} {}", "\u{2718}".bright_red(), msg.bright_red());
|
|
}
|
|
|
|
/// Print a step/section header.
|
|
pub fn step(msg: &str) {
|
|
println!(" {} {}", "\u{25cf}".bright_red(), msg.bold());
|
|
}
|
|
|
|
/// Print a success message.
|
|
pub fn success(msg: &str) {
|
|
println!(" {} {}", "\u{2714}".bright_green(), msg);
|
|
}
|
|
|
|
/// Print an error message.
|
|
pub fn error(msg: &str) {
|
|
println!(" {} {}", "\u{2718}".bright_red(), msg.bright_red());
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// New themed output helpers
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/// Brand banner: ">> OpenFang Agent OS"
|
|
pub fn banner() {
|
|
println!(
|
|
" {} {}",
|
|
">>".bright_cyan().bold(),
|
|
"OpenFang Agent OS".bold()
|
|
);
|
|
println!(" {}", "The open-source agent operating system".dimmed());
|
|
}
|
|
|
|
/// Section header: ">> Title" in cyan.
|
|
pub fn section(title: &str) {
|
|
println!(" {} {}", ">>".bright_cyan().bold(), title.bold());
|
|
}
|
|
|
|
/// Key-value display: " Label: value".
|
|
pub fn kv(label: &str, value: &str) {
|
|
println!(" {:<13}{}", format!("{label}:"), value);
|
|
}
|
|
|
|
/// Key-value with green value.
|
|
pub fn kv_ok(label: &str, value: &str) {
|
|
println!(" {:<13}{}", format!("{label}:"), value.bright_green());
|
|
}
|
|
|
|
/// Key-value with yellow value.
|
|
pub fn kv_warn(label: &str, value: &str) {
|
|
println!(" {:<13}{}", format!("{label}:"), value.bright_yellow());
|
|
}
|
|
|
|
/// Hint line: " hint: message" in dimmed text.
|
|
pub fn hint(msg: &str) {
|
|
println!(" {} {}", "hint:".dimmed(), msg.dimmed());
|
|
}
|
|
|
|
/// Numbered "Next steps:" list.
|
|
pub fn next_steps(steps: &[&str]) {
|
|
println!(" {}:", "Next steps".bold());
|
|
for (i, step) in steps.iter().enumerate() {
|
|
println!(" {}. {step}", i + 1);
|
|
}
|
|
}
|
|
|
|
/// Suggest a command: " label command" with command highlighted.
|
|
pub fn suggest_cmd(label: &str, cmd: &str) {
|
|
println!(" {:<22}{}", label, cmd.bright_cyan());
|
|
}
|
|
|
|
/// Red error + yellow "fix:" suggestion.
|
|
pub fn error_with_fix(msg: &str, fix: &str) {
|
|
println!(" {} {}", "\u{2718}".bright_red(), msg.bright_red());
|
|
println!(" {} {}", "fix:".bright_yellow(), fix);
|
|
}
|
|
|
|
/// Yellow warning + "try:" suggestion.
|
|
pub fn warn_with_fix(msg: &str, fix: &str) {
|
|
println!(" {} {}", "-".bright_yellow(), msg.yellow());
|
|
println!(" {} {}", "try:".bright_yellow(), fix);
|
|
}
|
|
|
|
/// Provider status line: checkmark/circle + name + env var.
|
|
pub fn provider_status(name: &str, env_var: &str, configured: bool) {
|
|
if configured {
|
|
println!(" {} {:<14} ({})", "\u{2714}".bright_green(), name, env_var);
|
|
} else {
|
|
println!(
|
|
" {} {:<14} ({} not set)",
|
|
"\u{25cb}".dimmed(),
|
|
name.dimmed(),
|
|
env_var.dimmed()
|
|
);
|
|
}
|
|
}
|
|
|
|
/// Empty line.
|
|
pub fn blank() {
|
|
println!();
|
|
}
|