Craft Anything: understand how any software works, and craft your own.
Rust
Find Hermes Agent's native Windows install when the app's PATH is older than it (#585)
Fábio Soaresb9c4c53099fe
diff --git a/crates/platform/src/which.rs b/crates/platform/src/which.rsindex 77e03c10..9897b2e5 100644--- a/crates/platform/src/which.rs+++ b/crates/platform/src/which.rs@@ -21,10 +21,11 @@ const USUAL_HOME_DIRS: &[&str] = &[".local/bin", ".claude/local", ".npm-global/b#[cfg(unix)]const USUAL_DIRS: &[&str] = &["/opt/homebrew/bin", "/usr/local/bin"];// Claude Code's installer, npm (without a custom prefix), WinGet's portable packages (Claude-// Code's WinGet install), bun and cargo; PATH may not have them yet in an app started before-// the install.+// Code's WinGet install), bun, cargo and Hermes Agent's installer (`%LOCALAPPDATA%\hermes\bin`, #116);+// PATH may not have them yet in an app started before the install.#[cfg(windows)]-const USUAL_HOME_DIRS: &[&str] = &[r".local\bin", r"AppData\Roaming\npm", r"AppData\Local\Microsoft\WinGet\Links", r".bun\bin", r".cargo\bin"];+const USUAL_HOME_DIRS: &[&str] =+ &[r".local\bin", r"AppData\Roaming\npm", r"AppData\Local\Microsoft\WinGet\Links", r".bun\bin", r".cargo\bin", r"AppData\Local\hermes\bin"];#[cfg(not(any(unix, windows)))]const USUAL_HOME_DIRS: &[&str] = &[];// WinGet's portable packages installed for every user (`--scope machine`).@@ -297,6 +298,20 @@ mod tests {assert!(nvm_bins(Path::new("/nowhere")).is_empty());}+ /// #116: Hermes Agent's Windows installer puts `hermes.exe` in `%LOCALAPPDATA%\hermes\bin` and+ /// adds that to the user's PATH, which an app started before the install (or by a launcher)+ /// doesn't have, so Settings found no Hermes.+ #[cfg(windows)]+ #[test]+ fn hermes_agents_windows_folder_is_searched() {+ let home = tempfile::tempdir().unwrap();+ let bin = home.path().join(r"AppData\Local\hermes\bin");+ std::fs::create_dir_all(&bin).unwrap();+ std::fs::write(bin.join("hermes.exe"), "").unwrap();+ let path = with_usual_dirs(None, Some(home.path().to_path_buf()));+ assert_eq!(which_in("hermes", path), [bin.join("hermes.exe")]);+ }+/// #132: npm's own prefix setting says where it put the agents it installed.#[test]fn npms_prefix_setting_is_searched() {diff --git a/docs/ROADMAP.md b/docs/ROADMAP.mdindex a27d72c8..8c32632d 100644--- a/docs/ROADMAP.md+++ b/docs/ROADMAP.md@@ -360,6 +360,10 @@ Owner: open · Status: in progress- [ ] A note sent during a build reaches the builder at its next step on other coding agents withtool hooks, and on the API-backend loop between tool calls (Claude Code only today)- [ ] Session copies for other agents that keep sessions (ACP agents' `session/load`) (#451)+- [x] Hermes Agent's native Windows install (`%LOCALAPPDATA%\hermes\bin`) is searched, so an app+ started before the install, or by a launcher, finds it (#116)+- [ ] Live-check #116 on Windows: install Hermes natively, start the app from a launcher, and see+ Settings → AI offer it; #116's "error after every message" has no text yet (asked)- [ ] See whether Hermes still fails on 0.3.0 (#460: the fix its `fixed` label names was already in0.3.0 when it was filed, and it gives no version)