Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
style(host-core): rustfmt the capability-transfer sources
vastsa1ff571dcb761
diff --git a/crates/host-core/src/agent_capabilities.rs b/crates/host-core/src/agent_capabilities.rsindex ace7f505a..bb3fcc5f6 100644--- a/crates/host-core/src/agent_capabilities.rs+++ b/crates/host-core/src/agent_capabilities.rs@@ -446,11 +446,7 @@ pub fn display_name_candidate(name: &str, ordinal: u32, max_chars: usize) -> Str/// The display name a document should carry at a destination that already/// holds `taken` (compared case-insensitively, the way shadowing compares it).-pub fn suffixed_display_name(- preferred: &str,- taken: &HashSet<String>,- max_chars: usize,-) -> String {+pub fn suffixed_display_name(preferred: &str, taken: &HashSet<String>, max_chars: usize) -> String {for ordinal in 1..=MAX_ID_SUFFIX {let candidate = display_name_candidate(preferred, ordinal, max_chars);if !candidate.is_empty() && !taken.contains(&candidate.to_lowercase()) {@@ -504,7 +500,10 @@ pub fn copy_directory_tree(from: &Path, to: &Path, skip_skill_document: bool) ->/// never replaces an existing destination.pub fn move_capability_file(from: &Path, to: &Path) -> Result<()> {if to.exists() {- bail!("CAPABILITY_INVALID: destination already exists: {}", to.display());+ bail!(+ "CAPABILITY_INVALID: destination already exists: {}",+ to.display()+ );}if let Some(parent) = to.parent() {fs::create_dir_all(parent)?;@@ -745,14 +744,15 @@ pub(crate) mod test_support {/// per-module locks would not exclude each other, and two tests would end up/// reading each other's directory.pub fn with_global_agents<T>(dir: &Path, f: impl FnOnce() -> T) -> T {- let _guard = AGENTS_ENV_LOCK.lock().unwrap_or_else(|error| error.into_inner());+ let _guard = AGENTS_ENV_LOCK+ .lock()+ .unwrap_or_else(|error| error.into_inner());// Safety: test-only process env mutation, serialized by the lock above.unsafe { std::env::set_var(super::AGENTS_DIR_ENV, dir) };let outcome = f();unsafe { std::env::remove_var(super::AGENTS_DIR_ENV) };outcome}-}#[cfg(test)]@@ -973,7 +973,13 @@ mod tests {).unwrap();state- .set_enabled("skills", CapabilityLevel::Project, "review", Some("/repo"), false)+ .set_enabled(+ "skills",+ CapabilityLevel::Project,+ "review",+ Some("/repo"),+ false,+ ).unwrap();assert!(!state.enabled("skills", CapabilityLevel::Global, "review", None));diff --git a/crates/host-core/src/mcp_servers.rs b/crates/host-core/src/mcp_servers.rsindex 3840479ca..b2307dada 100644--- a/crates/host-core/src/mcp_servers.rs+++ b/crates/host-core/src/mcp_servers.rs@@ -570,8 +570,7 @@ impl McpServerRegistry {let target_label = suffixed_display_name(&source.label, &taken_labels, MAX_VALUE_BYTES);let mut config: McpConfig = serde_json::from_str(- &fs::read_to_string(&source_path)- .with_context(|| format!("read {source_path}"))?,+ &fs::read_to_string(&source_path).with_context(|| format!("read {source_path}"))?,).with_context(|| format!("parse {source_path}"))?;let rename = config.id != target_id || config.label != target_label;@@ -632,11 +631,7 @@ mod tests {/// A registry plus the two directories a level switch needs.fn scaffolding() -> (tempfile::TempDir, tempfile::TempDir, tempfile::TempDir) {- (- tempdir().unwrap(),- tempdir().unwrap(),- tempdir().unwrap(),- )+ (tempdir().unwrap(), tempdir().unwrap(), tempdir().unwrap())}fn stdio(id: &str) -> McpServerInput {@@ -806,9 +801,12 @@ mod tests {.is_empty());// The global override is gone with the document, not left pointing// at an id the global directory no longer holds.- assert!(registry- .state- .enabled(MCP_KIND, CapabilityLevel::Global, "files", Some(&project_path)));+ assert!(registry.state.enabled(+ MCP_KIND,+ CapabilityLevel::Global,+ "files",+ Some(&project_path)+ ));});}@@ -881,12 +879,18 @@ mod tests {assert!(!project.path().join(".agents/servers/files.json").exists());// The disabled state is now the global default: it follows the// document, and no project-only entry is left behind.- assert!(!registry- .state- .enabled(MCP_KIND, CapabilityLevel::Global, "files", Some("/elsewhere")));- assert!(registry- .state- .enabled(MCP_KIND, CapabilityLevel::Project, "files", Some(&project_path)));+ assert!(!registry.state.enabled(+ MCP_KIND,+ CapabilityLevel::Global,+ "files",+ Some("/elsewhere")+ ));+ assert!(registry.state.enabled(+ MCP_KIND,+ CapabilityLevel::Project,+ "files",+ Some(&project_path)+ ));});}@@ -959,7 +963,10 @@ mod tests {fs::read_to_string(project.path().join(".agents/servers/FILES.json")).unwrap(),existing);- assert!(project.path().join(".agents/servers/files-2.json").is_file());+ assert!(project+ .path()+ .join(".agents/servers/files-2.json")+ .is_file());let listed = registry.list(CapabilityLevel::Project, Some(&project_path)).unwrap();diff --git a/crates/host-core/src/rpc/mod.rs b/crates/host-core/src/rpc/mod.rsindex 56e20fe14..48a3594c1 100644--- a/crates/host-core/src/rpc/mod.rs+++ b/crates/host-core/src/rpc/mod.rs@@ -4510,11 +4510,14 @@ mod tests {.expect_err("the named end of a move is required");assert_eq!(absent.code, 1002);- let project =- parse_capability_target(&json!({ "to": { "level": "project", "projectPath": "/p" } }), "to")- .unwrap();+ let project = parse_capability_target(+ &json!({ "to": { "level": "project", "projectPath": "/p" } }),+ "to",+ )+ .unwrap();assert_eq!(project.level, CapabilityLevel::Project);- let global = parse_capability_target(&json!({ "to": { "level": "global" } }), "to").unwrap();+ let global =+ parse_capability_target(&json!({ "to": { "level": "global" } }), "to").unwrap();assert_eq!(global.level, CapabilityLevel::Global);}diff --git a/crates/host-core/src/user_skills.rs b/crates/host-core/src/user_skills.rsindex 102383a3e..beabc6329 100644--- a/crates/host-core/src/user_skills.rs+++ b/crates/host-core/src/user_skills.rs@@ -410,8 +410,9 @@ impl UserSkillRegistry {fs::remove_dir_all(dir).map_err(|error| anyhow::anyhow!("remove {}: {error}", dir.display()))?;} else {- fs::remove_file(&source_path)- .map_err(|error| anyhow::anyhow!("remove {}: {error}", source_path.display()))?;+ fs::remove_file(&source_path).map_err(|error| {+ anyhow::anyhow!("remove {}: {error}", source_path.display())+ })?;}}@@ -1087,7 +1088,10 @@ mod tests {fs::read_to_string(&target).unwrap(),"---\nname: Review\ndescription: Check code\n---\n\nDo it.\n");- assert!(registry.list(CapabilityLevel::Global, None).unwrap().is_empty());+ assert!(registry+ .list(CapabilityLevel::Global, None)+ .unwrap()+ .is_empty());});}@@ -1241,9 +1245,12 @@ mod tests {assert!(!project.path().join(".agents/skills/review.md").exists());// Off everywhere, because the document is off and its state is now// the global default rather than one project's leftover override.- assert!(!registry- .state- .enabled(SKILL_KIND, CapabilityLevel::Global, "review", Some("/elsewhere")));+ assert!(!registry.state.enabled(+ SKILL_KIND,+ CapabilityLevel::Global,+ "review",+ Some("/elsewhere")+ ));});}@@ -1296,12 +1303,18 @@ mod tests {// that is what both the directory and the next scan will call it.assert_eq!(placement.stem, "2");let document = skill_document_path(directory.path(), &placement.stem, true);- assert_eq!(capability_id(&placement.name, &document, 64), placement.stem);+ assert_eq!(+ capability_id(&placement.name, &document, 64),+ placement.stem+ );// A flat destination derives the same id from the `.md` stem.let placement = plan_skill_placement(&source, directory.path(), false, &existing).unwrap();let document = skill_document_path(directory.path(), &placement.stem, false);- assert_eq!(capability_id(&placement.name, &document, 64), placement.stem);+ assert_eq!(+ capability_id(&placement.name, &document, 64),+ placement.stem+ );}#[test]