aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJJ Liebig <jonathan.liebig@gmail.com>2026-09-22 22:37:25 +0200
committerGitHub <noreply@github.com>2026-09-22 22:37:25 +0200
commitcd8306d7f35d6329d543944a0257b6bc4b297c8b (patch)
tree31454c3f4a61a6948956599ac9d38958365a7503 /src
parent621e6b73c4fe4c13562c0906699003d0ca59f0f1 (diff)
fix: detect npm-installed omp on windows (#4502)
refs #4313
Diffstat (limited to 'src')
-rw-r--r--src/detect/mod.rs42
1 files changed, 34 insertions, 8 deletions
diff --git a/src/detect/mod.rs b/src/detect/mod.rs
index 7fe15d11..3dae571b 100644
--- a/src/detect/mod.rs
+++ b/src/detect/mod.rs
@@ -650,6 +650,15 @@ fn agent_name_from_known_package_path(path: &str) -> Option<String> {
}
if ends_with(&[
"node_modules",
+ "@oh-my-pi",
+ "pi-coding-agent",
+ "dist",
+ "cli.js",
+ ]) {
+ return Some(agent_label(Agent::Omp).to_string());
+ }
+ if ends_with(&[
+ "node_modules",
"@moonshot-ai",
"kimi-code",
"dist",
@@ -1433,19 +1442,36 @@ mod tests {
#[test]
fn identify_agent_in_job_detects_bun_wrapped_omp() {
- let job = crate::platform::ForegroundJob {
+ for (runtime, script) in [
+ ("bun", "/home/can/.bun/bin/omp"),
+ (
+ "bun.exe",
+ r"C:\Users\herdr\AppData\Roaming\npm\node_modules\@oh-my-pi\pi-coding-agent\dist\cli.js",
+ ),
+ ] {
+ let job = crate::platform::ForegroundJob {
+ process_group_id: 123,
+ processes: vec![foreground_process(123, runtime, &[runtime, script])],
+ };
+ assert_eq!(
+ identify_agent_in_job(&job),
+ Some((Agent::Omp, "omp".to_string())),
+ "script: {script}"
+ );
+ }
+
+ let other_script = crate::platform::ForegroundJob {
process_group_id: 123,
processes: vec![foreground_process(
123,
- "bun",
- &["bun", "/home/can/.bun/bin/omp"],
+ "bun.exe",
+ &[
+ "bun.exe",
+ r"C:\Users\herdr\AppData\Roaming\npm\node_modules\@oh-my-pi\pi-coding-agent\dist\setup.js",
+ ],
)],
};
-
- assert_eq!(
- identify_agent_in_job(&job),
- Some((Agent::Omp, "omp".to_string()))
- );
+ assert_eq!(identify_agent_in_job(&other_script), None);
}
#[test]