···11// Contains functions for health checking various dependencies
2233-use std::{env, process::Command};
33+use std::env;
44+55+use anyhow::Result;
4655-use crate::runtime::mlx::ping;
77+use crate::{
88+ daemon::ping,
99+ utils::installer::{UpdateInfo, get_update_info},
1010+};
61177-pub async fn check_health() {
1212+pub async fn check_health() -> Result<()> {
813 let os = env::consts::OS;
99- println!("Running diagnosis...");
1010- check_python3();
1111- if os == "macos" {
1212- check_server_status().await
1313- }
1414-}
1414+ println!("Running diagnosis...\n");
15151616-fn check_python3() {
1717- let output = Command::new("python3")
1818- .arg("--version")
1919- .output()
2020- .ok()
2121- .map(|o| String::from_utf8_lossy(&o.stdout).trim().to_string());
2222-2323- if let Some(version) = output {
2424- println!("Python3: ✅ {}", version)
1616+ println!("Checking for newer version...\n");
1717+ let update_info: UpdateInfo = get_update_info().await?;
1818+ if update_info.can_update {
1919+ println!("⚠️ Outdated version, try `tiles update`");
2020+ let update_str = format!(
2121+ "\tcurrent version - {}\n\tlatest version - {}",
2222+ update_info.current_version, update_info.latest_version
2323+ );
2424+ println!("{}", update_str);
2525 } else {
2626- println!("Python3: ❌ hint: Install Python3 for your OS")
2626+ println!("✅ Running latest version\n");
2727 }
2828+ if os == "macos" && !cfg!(debug_assertions) {
2929+ check_server_status().await;
3030+ }
3131+ Ok(())
2832}
3333+2934async fn check_server_status() {
3030- if ping().await.is_ok() {
3131- println!("Model server is UP: ✅")
3535+ if ping(None).await.is_ok() {
3636+ println!("✅ Daemon is UP")
3237 } else {
3333- println!("Model server is DOWN: ❌, try `tiles server start`")
3838+ println!("❌ Daemon is DOWN, try `tiles daemon start`")
3439 }
3540}
+18-1
tiles/src/core/storage/db.rs
···33//! Uses sqlite as the underlying database
44//!
5566-use std::path::PathBuf;
66+use std::{env, path::PathBuf};
7788use anyhow::{Result, anyhow};
99use log::info;
···117117118118fn fetch_passkey() -> Result<String> {
119119 let app_name = get_app_name();
120120+ // handling db passwords in dev mode separately
121121+ // This is to suppress keychain popups during development
122122+123123+ if cfg!(debug_assertions) {
124124+ if let Ok(passwd) = env::var("TILES_DEV_DB_PASSWORD") {
125125+ return Ok(passwd);
126126+ } else {
127127+ info!("DB passkey not found in development, creating one..");
128128+ let passwd = create_and_save_passkey(&app_name, "db_passkey")?;
129129+ info!(
130130+ "Save this password {} as an environment variable with name `TILES_DEV_DB_PASSWORD`",
131131+ passwd
132132+ );
133133+ return Ok(passwd);
134134+ }
135135+ }
136136+120137 if let Ok(passkey) = get_passkey(&app_name, "db_passkey") {
121138 Ok(passkey)
122139 } else {
+1-1
tiles/src/main.rs
···233233 .inspect_err(|e| eprintln!("Tiles failed to run due to {:?}", e))?;
234234 }
235235 Some(Commands::Health) => {
236236- commands::check_health().await;
236236+ commands::check_health().await?;
237237 }
238238 Some(Commands::Server(server)) => match server.command {
239239 Some(ServerCommands::Start) => commands::start_server(&runtime).await,