feat: add IRONCLAW_BASE_DIR env var with LazyLock caching (#397)

This commit is contained in:
ibhagwan
2026-02-27 17:43:43 +04:00
committed by GitHub
parent a7c0be7f1b
commit c592a8f2de
26 changed files with 255 additions and 127 deletions
+3 -3
View File
@@ -6,6 +6,8 @@
use std::path::PathBuf;
use crate::bootstrap::ironclaw_base_dir;
/// Run all diagnostic checks and print results.
pub async fn run_doctor_command() -> anyhow::Result<()> {
println!("IronClaw Doctor");
@@ -195,9 +197,7 @@ async fn try_pg_connect() -> Result<(), String> {
}
fn check_workspace_dir() -> CheckResult {
let dir = dirs::home_dir()
.unwrap_or_else(|| PathBuf::from("."))
.join(".ironclaw");
let dir = ironclaw_base_dir();
if dir.exists() {
if dir.is_dir() {
+3 -8
View File
@@ -5,6 +5,7 @@
use std::path::PathBuf;
use crate::bootstrap::ironclaw_base_dir;
use crate::settings::Settings;
/// Run the status command, printing system health info.
@@ -206,15 +207,9 @@ fn count_wasm_files(dir: &std::path::Path) -> usize {
}
fn default_tools_dir() -> PathBuf {
dirs::home_dir()
.unwrap_or_else(|| PathBuf::from("."))
.join(".ironclaw")
.join("tools")
ironclaw_base_dir().join("tools")
}
fn default_channels_dir() -> PathBuf {
dirs::home_dir()
.unwrap_or_else(|| PathBuf::from("."))
.join(".ironclaw")
.join("channels")
ironclaw_base_dir().join("channels")
}
+2 -3
View File
@@ -9,6 +9,7 @@ use std::sync::Arc;
use clap::Subcommand;
use tokio::fs;
use crate::bootstrap::ironclaw_base_dir;
use crate::config::Config;
#[allow(unused_imports)]
use crate::db::Database;
@@ -19,9 +20,7 @@ use crate::tools::wasm::{CapabilitiesFile, compute_binary_hash};
/// Default tools directory.
fn default_tools_dir() -> PathBuf {
dirs::home_dir()
.map(|h| h.join(".ironclaw").join("tools"))
.unwrap_or_else(|| PathBuf::from(".ironclaw/tools"))
ironclaw_base_dir().join("tools")
}
#[derive(Subcommand, Debug, Clone)]