refactor(#1450): lift shared harness-path resolution into hive-sh4re

This commit is contained in:
damocles 2026-06-14 21:21:07 +02:00 committed by mara
commit 41c4682f7a
7 changed files with 48 additions and 46 deletions

View file

@ -10,20 +10,10 @@
use std::path::PathBuf;
/// NOTE: the base-dir resolution logic here is intentionally mirrored in
/// `hive-bash-mcp/src/paths.rs::mcp_loose_ends_dir()`. They can't share
/// code across crates — keep them in sync if the fallback logic changes.
/// Resolution lives in `hive_sh4re::paths` so the harness + every MCP
/// daemon agree on where loose-end summary files are written.
fn loose_ends_dir() -> PathBuf {
let base = if let Some(p) = std::env::var_os("HYPERHIVE_HARNESS_DIR") {
PathBuf::from(p)
} else {
let state = std::env::var("HYPERHIVE_STATE_DIR").unwrap_or_default();
let state_path = PathBuf::from(&state);
state_path
.parent()
.map_or_else(|| PathBuf::from(state), |p| p.join("harness"))
};
base.join("mcp-loose-ends")
hive_sh4re::paths::mcp_loose_ends_dir()
}
/// Collect all loose-end summary strings published by external MCP daemons.