A tiny friend in your Mac's notch and on your iPhone that keeps an eye on your AI coding agents: Claude Code, Codex, Cursor, Gemini CLI, Antigravity and more. Approve from the notch or your Lock Screen.
Swift ai-agentsanthropicantigravityclaudeclaude-codecodexcursordynamic-islandgemini-cliiosiphonlinuxmacosmacos-appmenubar-appnotchopen-sourceswiftswiftuiwindows
fix(windows): protect statusline backup outside bin from uninstaller (#855)
Ohualtex9ae452fabfd1
diff --git a/windows/README.md b/windows/README.mdindex a3f80fad..02429a96 100644--- a/windows/README.md+++ b/windows/README.md@@ -191,7 +191,7 @@ reset times. Both are off by default; turn them on in **Settings… → Plan usa`%USERPROFILE%\.claude\settings.json`, takes a dated backup and writes onlyafter your click, with the same writer as the hooks: the status line becomes `coucou-hook --statusline`, whichpasses only the limits on (300 ms at most) and runs the status line you had- before — kept in `statusline-previous.json` next to the relay — with the same+ before — kept in `statusline-previous.json` outside `bin` in Coucou's data folder — with the sameinput, printing what it prints. On Windows that one runs through Git Bash, asClaude Code runs it (`CLAUDE_CODE_GIT_BASH_PATH`, then the Git for Windows that`git.exe` on `PATH` belongs to, then the usual install folders); it gets 10 sdiff --git a/windows/hook/src/statusline.rs b/windows/hook/src/statusline.rsindex 2d135eb6..a0803c47 100644--- a/windows/hook/src/statusline.rs+++ b/windows/hook/src/statusline.rs@@ -87,7 +87,13 @@ pub fn payload(map: &serde_json::Map<String, serde_json::Value>) -> Option<Strin/// The command of the status line the user had before the relay took its place.fn previous_command() -> Option<String> {- let path = std::env::current_exe().ok()?.with_file_name(PREVIOUS_FILE);+ let exe = std::env::current_exe().ok()?;+ let path = exe+ .parent()+ .and_then(|p| p.parent())+ .map(|p| p.join(PREVIOUS_FILE))+ .filter(|p| p.is_file())+ .unwrap_or_else(|| exe.with_file_name(PREVIOUS_FILE));let saved: serde_json::Value = serde_json::from_slice(&std::fs::read(path).ok()?).ok()?;saved.get("command")?.as_str().filter(|c| !c.trim().is_empty()).map(str::to_string)}diff --git a/windows/src-tauri/src/hooks.rs b/windows/src-tauri/src/hooks.rsindex 582016d4..daa5ee66 100644--- a/windows/src-tauri/src/hooks.rs+++ b/windows/src-tauri/src/hooks.rs@@ -242,18 +242,20 @@ pub fn write(install: bool, fingerprint: &str) -> Result<String, String> {//// Claude Code runs one `statusLine` command and hands it the plan limits. Coucou// puts its relay there; a status line the user already had is kept in-// statusline-previous.json beside the relay, and the relay still runs it, so it-// keeps working. Installing and removing it is separate from the hooks, and-// goes through the same hardened writer (config_file.rs): strict read, diff,-// fingerprint, dated backup, then the write.+// statusline-previous.json in local_dir() (outside bin/, surviving uninstaller),+// and the relay still runs it, so it keeps working. Installing and removing it+// is separate from the hooks, and goes through the same hardened writer+// (config_file.rs): strict read, diff, fingerprint, dated backup, then the write./// Where the user's own status line waits while the relay stands in for it.pub fn status_line_previous_path() -> PathBuf {- settings::hook_exe_path().with_file_name("statusline-previous.json")+ settings::local_dir().join("statusline-previous.json")}fn read_status_line_previous() -> Option<Value> {- let bytes = std::fs::read(status_line_previous_path()).ok()?;+ let bytes = std::fs::read(status_line_previous_path())+ .or_else(|_| std::fs::read(settings::hook_exe_path().with_file_name("statusline-previous.json")))+ .ok()?;serde_json::from_slice::<Value>(&bytes).ok().filter(Value::is_object)}@@ -329,10 +331,12 @@ pub fn status_line_write(install: bool, fingerprint: &str) -> Result<String, Str// Back in settings.json: the saved copy has done its job.Ok(_) if !install => {let _ = std::fs::remove_file(status_line_previous_path());+ let _ = std::fs::remove_file(settings::hook_exe_path().with_file_name("statusline-previous.json"));}// Nothing was written: do not leave a stale copy behind.Err(_) if saved => {let _ = std::fs::remove_file(status_line_previous_path());+ let _ = std::fs::remove_file(settings::hook_exe_path().with_file_name("statusline-previous.json"));}_ => {}}