Run one OpenCode agent hook dispatch the way the atomic-opencode plugin does: JSON on stdin, foreground, from the repository root.
(&self, verb: &str, session_id: &str)
| 121 | /// Run one OpenCode agent hook dispatch the way the atomic-opencode |
| 122 | /// plugin does: JSON on stdin, foreground, from the repository root. |
| 123 | fn agent_hook(&self, verb: &str, session_id: &str) -> Output { |
| 124 | use std::io::Write; |
| 125 | let payload = format!( |
| 126 | "{{\"session_id\":\"{session_id}\",\"cwd\":\"{}\",\"timestamp\":\"2026-10-14T10:30:00Z\"}}", |
| 127 | self.root().display() |
| 128 | ); |
| 129 | let mut child = Command::new(ATOMIC_BIN) |
| 130 | .args(["agent", "hooks", "opencode", verb, "--foreground"]) |
| 131 | .current_dir(self.root()) |
| 132 | .env("HOME", self.home.path()) |
| 133 | .env("ATOMIC_HOME", self.home.path().join(".atomic")) |
| 134 | .env("ATOMIC_NONINTERACTIVE", "1") |
| 135 | .env("NO_COLOR", "1") |
| 136 | .env("CLICOLOR", "0") |
| 137 | .env("TERM", "dumb") |
| 138 | .stdout(Stdio::piped()) |
| 139 | .stderr(Stdio::piped()) |
| 140 | .stdin(Stdio::piped()) |
| 141 | .spawn() |
| 142 | .expect("spawn atomic agent hooks"); |
| 143 | child |
| 144 | .stdin |
| 145 | .as_mut() |
| 146 | .expect("hook stdin") |
| 147 | .write_all(payload.as_bytes()) |
| 148 | .expect("write hook stdin"); |
| 149 | child.wait_with_output().expect("wait for agent hook") |
| 150 | } |
| 151 | |
| 152 | /// A retained shadow exclude marker without shim enrollment: written by |
| 153 | /// import/push, kept on disk by `git shim disable`, and never removed by |
no test coverage detected