Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
67 lines
2.1 KiB
Rust
67 lines
2.1 KiB
Rust
use crate::common::status::{generate_status_info, StatusInfo};
|
|
use crate::config::Settings;
|
|
use crate::meta_plugin::MetaPluginType;
|
|
use crate::compression_engine::CompressionType;
|
|
use crate::services::filter_service::get_available_filter_plugins;
|
|
use clap::Command;
|
|
use std::path::PathBuf;
|
|
use std::str::FromStr;
|
|
|
|
pub struct StatusService;
|
|
|
|
impl StatusService {
|
|
pub fn new() -> Self {
|
|
Self
|
|
}
|
|
|
|
pub fn generate_status(
|
|
&self,
|
|
cmd: &mut Command,
|
|
settings: &Settings,
|
|
data_path: PathBuf,
|
|
db_path: PathBuf,
|
|
) -> StatusInfo {
|
|
// Get meta plugins directly from config
|
|
let meta_plugin_types: Vec<MetaPluginType> = crate::modes::common::settings_meta_plugin_types(cmd, settings);
|
|
|
|
// Determine which compression type would be enabled for a save operation
|
|
let enabled_compression_type = if let Some(compression_name) = &settings.compression() {
|
|
CompressionType::from_str(compression_name).ok()
|
|
} else {
|
|
Some(crate::compression_engine::default_compression_type())
|
|
};
|
|
|
|
let mut status_info = generate_status_info(data_path, db_path, &meta_plugin_types, enabled_compression_type);
|
|
|
|
// Add detailed filter plugins information
|
|
let filter_plugins_map = get_available_filter_plugins();
|
|
let mut filter_plugins_info = Vec::new();
|
|
|
|
for (name, creator) in filter_plugins_map {
|
|
let plugin = creator();
|
|
let options = plugin.options();
|
|
// For now, use a default description
|
|
let description = "Filter plugin".to_string();
|
|
|
|
filter_plugins_info.push(crate::common::status::FilterPluginInfo {
|
|
name,
|
|
options,
|
|
description,
|
|
});
|
|
}
|
|
status_info.filter_plugins = filter_plugins_info;
|
|
|
|
// Add configured meta plugins information
|
|
status_info.configured_meta_plugins = settings.meta_plugins.clone();
|
|
|
|
status_info
|
|
}
|
|
|
|
}
|
|
|
|
impl Default for StatusService {
|
|
fn default() -> Self {
|
|
Self::new()
|
|
}
|
|
}
|