//! Thin facade over [`tail_fin_cli_core`]: all the generic CLI helpers
//! (`Ctx`, `browser_session`, cookie path resolution, JSON printing) live
//! there so the daemon can share them. Only site-specific glue — currently
//! the Twitter HTTP client constructor — still lives in this crate.

pub use tail_fin_cli_core::{
    auto_launch_stealth, browser_session, default_cookies_path, launch_browser,
    launch_stealth_session, no_mode_error, print_json, print_list, require_browser,
    require_browser_session, resolve_cookies_path, Ctx,
};

/// Helper: get TwitterHttpClient from cookies flag.
#[cfg(feature = "twitter")]
pub fn twitter_http_client(
    cookies_flag: &str,
) -> Result<tail_fin_twitter::TwitterHttpClient, tail_fin_common::TailFinError> {
    use tail_fin_common::TailFinError;

    let path = resolve_cookies_path(cookies_flag, "twitter");
    if !path.exists() {
        return Err(TailFinError::Api(format!(
            "Cookie file not found: {}\n\
             \x20 Run `tail-fin --connect twitter export-cookies` to export cookies from Chrome.",
            path.display()
        )));
    }
    tail_fin_twitter::TwitterHttpClient::from_cookie_file(&path)
}
