Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "osvm"
version = "0.8.1"
version = "0.8.2"
edition = "2021"
license = "MIT"
description = "OpenSVM CLI tool for managing SVM nodes and deployments"
Expand Down Expand Up @@ -46,6 +46,7 @@ regex = "1.11.2"
reqwest = { version = "0.12.23", features = ["json"] }
base64 = "0.22.1"
bs58 = "0.5.1"
uuid = { version = "1.0", features = ["v4"] }
# Enhanced audit dependencies
syn = { version = "2.0", features = ["full", "visit"] }
quote = "1.0"
Expand Down
14 changes: 5 additions & 9 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@
use {
crate::config::Config,
crate::utils::diagnostics::DiagnosticCoordinator,
crate::utils::{dashboard, ebpf_deploy, examples, nodes, ssh_deploy, svm_info},
crate::utils::markdown_renderer::MarkdownRenderer,
crate::utils::{dashboard, ebpf_deploy, examples, nodes, ssh_deploy, svm_info},
clparse::parse_command_line,
solana_client::rpc_client::RpcClient,
solana_sdk::{
native_token::Sol,
pubkey::Pubkey,
signature::Signer
},
solana_sdk::{native_token::Sol, pubkey::Pubkey, signature::Signer},
std::{process::exit, str::FromStr},
};

Expand Down Expand Up @@ -64,18 +60,18 @@ async fn handle_ai_query(
// For external subcommands, clap collects additional arguments in subcommand_value
// This is the proper way to handle external subcommands with clap
let mut query_parts = vec![sub_command.to_string()];

// Get additional arguments from clap's external subcommand handling
// External subcommands store arguments as OsString, not String
if let Some(external_args) = sub_matches.get_many::<std::ffi::OsString>("") {
query_parts.extend(external_args.map(|os_str| os_str.to_string_lossy().to_string()));
}

// If clap doesn't provide args (fallback), parse from environment
// This maintains compatibility while documenting the limitation
if query_parts.len() == 1 {
let args: Vec<String> = std::env::args().collect();

// Collect non-flag arguments starting from the subcommand
let mut found_subcommand = false;
for arg in args.iter().skip(1) {
Expand Down
21 changes: 19 additions & 2 deletions src/services/ai_service.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use crate::utils::circuit_breaker::{
AnalysisVector as CircuitAnalysisVector, EndpointId, GranularCircuitBreaker,
};
use crate::utils::debug_logger::VerbosityLevel;
use crate::utils::prompt_templates::{
AnalysisVector as TemplateAnalysisVector, PromptTemplateManager, TemplateCategory,
};
use crate::{debug_error, debug_print, debug_success, debug_warn};
use anyhow::{Context, Result};
use reqwest;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -70,6 +72,19 @@ impl AiService {
}

pub fn with_api_url_and_debug(custom_api_url: Option<String>, debug_mode: bool) -> Self {
// Set debug verbosity based on debug mode
if debug_mode {
crate::utils::debug_logger::set_verbosity(VerbosityLevel::Detailed);
} else {
crate::utils::debug_logger::set_verbosity(VerbosityLevel::Silent);
}

debug_print!(
VerbosityLevel::Basic,
"Initializing AI service with debug mode: {}",
debug_mode
);

let (api_url, use_openai) = match custom_api_url {
Some(url) => {
// Check if it's an OpenAI URL and we have an API key
Expand Down Expand Up @@ -108,9 +123,11 @@ impl AiService {
let mut template_manager = PromptTemplateManager::new();

// Initialize template manager
if let Err(e) = template_manager.load_from_directory_with_debug("./templates/ai_prompts", debug_mode) {
if let Err(e) =
template_manager.load_from_directory_with_debug("./templates/ai_prompts", debug_mode)
{
if debug_mode {
println!("⚠️ Failed to load AI prompt templates: {}", e);
debug_warn!("Failed to load AI prompt templates: {}", e);
}
}

Expand Down
Loading