Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions crates/hk-core/src/adapter/dsh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ fn resolve_homes(
) -> (PathBuf, PathBuf) {
(
dsh_home
.filter(|dir| !dir.is_empty())
.map(PathBuf::from)
.unwrap_or_else(|| home.join(".dsh")),
agents_home
.filter(|dir| !dir.is_empty())
.map(PathBuf::from)
.unwrap_or_else(|| home.join(".agents")),
)
Expand Down Expand Up @@ -976,10 +978,12 @@ mod tests {
assert_eq!(dsh, PathBuf::from("/custom/dsh"));
assert_eq!(agents, PathBuf::from("/custom/agents"));

// Both unset → ~/.dsh and ~/.agents fallbacks.
let (dsh, agents) = resolve_homes(None, None, home);
assert_eq!(dsh, home.join(".dsh"));
assert_eq!(agents, home.join(".agents"));
// Unset or empty → ~/.dsh and ~/.agents fallbacks.
for unset in [None, Some("".into())] {
let (dsh, agents) = resolve_homes(unset.clone(), unset, home);
assert_eq!(dsh, home.join(".dsh"));
assert_eq!(agents, home.join(".agents"));
}

// DSH_HOME set, DSH_AGENTS_HOME unset → mixed.
let (dsh, agents) = resolve_homes(Some("/custom/dsh".into()), None, home);
Expand Down
11 changes: 7 additions & 4 deletions crates/hk-core/src/adapter/penguin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ impl Default for PenguinAdapter {
/// can be tested without racing other adapter tests.
fn resolve_home(penguin_home: Option<std::ffi::OsString>, home: &Path) -> PathBuf {
penguin_home
.filter(|dir| !dir.is_empty())
.map(PathBuf::from)
.unwrap_or_else(|| home.join(".penguin").join("data"))
}
Expand Down Expand Up @@ -178,10 +179,12 @@ mod tests {
resolve_home(Some("/custom/penguin".into()), home),
PathBuf::from("/custom/penguin")
);
assert_eq!(
resolve_home(None, home),
PathBuf::from("/home/u/.penguin/data")
);
for unset in [None, Some("".into())] {
assert_eq!(
resolve_home(unset, home),
PathBuf::from("/home/u/.penguin/data")
);
}
}

#[test]
Expand Down
1 change: 1 addition & 0 deletions crates/hk-core/src/adapter/pi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ impl PiAdapter {
pub fn new() -> Self {
let home = crate::home_dir();
let agent_dir = std::env::var_os("PI_CODING_AGENT_DIR")
.filter(|dir| !dir.is_empty())
.map(PathBuf::from)
.unwrap_or_else(|| home.join(".pi").join("agent"));
Self { home, agent_dir }
Expand Down
11 changes: 8 additions & 3 deletions crates/hk-core/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1491,9 +1491,14 @@ pub fn install_to_agent(
let config_path = target_adapter
.mcp_config_path_for(target_scope)
.ok_or_else(|| {
HkError::Validation(format!(
"{target_agent} does not support project-level MCP servers"
))
HkError::Validation(match target_scope {
ConfigScope::Global => {
format!("Installing MCP servers to {target_agent} is not supported")
}
ConfigScope::Project { .. } => {
format!("{target_agent} does not support project-level MCP servers")
}
})
})?;
deployer::deploy_mcp_server(&config_path, &entry, target_adapter.as_ref())?;
Ok(entry.name)
Expand Down
Loading