saya-cli 0.3.1

Database-aware AI agent for the terminal: full-screen TUI, schema discovery, and bounded read-only SQL over PostgreSQL, MySQL, SQLite, DuckDB, and Snowflake.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use super::runtime::AgentRuntimeError;
use crate::config::runtime::RuntimeConfig;

pub(crate) fn selected(
    runtime: &RuntimeConfig,
    override_name: Option<&String>,
) -> Result<(Option<String>, Option<saya_types::DatabaseProfile>), AgentRuntimeError> {
    match override_name {
        Some(name) => runtime
            .named_profile(name)
            .map(|profile| (Some(name.clone()), Some(profile.clone())))
            .map_err(|error| AgentRuntimeError::Configuration(error.to_string())),
        None => Ok((
            runtime.resolved.profile_name.clone(),
            runtime.resolved.profile.clone(),
        )),
    }
}