Skip to content

Commit ec4438f

Browse files
feat: add custom npm global prefix detection for auggie path
1 parent 4ebc0c0 commit ec4438f

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

src/config.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,33 @@ impl Config {
327327
}
328328
}
329329

330+
// Custom npm global prefix (npm config get prefix)
331+
// This handles cases where user configured custom global directory
332+
if let Ok(output) = std::process::Command::new("npm").args(["config", "get", "prefix"]).output() {
333+
if output.status.success() {
334+
if let Ok(prefix) = String::from_utf8(output.stdout) {
335+
let prefix = prefix.trim();
336+
// npm on Windows uses prefix\node_modules for global packages
337+
candidates.push(format!(r"{}\node_modules\@augmentcode\auggie\augment.mjs", prefix));
338+
candidates.push(format!(r"{}\node_modules\@augmentcode\auggie\dist\cli.js", prefix));
339+
// Some setups use prefix\node_global\node_modules
340+
candidates.push(format!(r"{}\node_global\node_modules\@augmentcode\auggie\augment.mjs", prefix));
341+
}
342+
}
343+
}
344+
345+
// Fallback: scan common custom global locations on other drives
346+
for drive in ['C', 'D', 'E', 'F'] {
347+
let custom_paths = [
348+
format!(r"{}:\nodejs\node_global\node_modules\@augmentcode\auggie\augment.mjs", drive),
349+
format!(r"{}:\nodejs\node_modules\@augmentcode\auggie\augment.mjs", drive),
350+
format!(r"{}:\Program Files\nodejs\node_global\node_modules\@augmentcode\auggie\augment.mjs", drive),
351+
];
352+
for path in custom_paths {
353+
candidates.push(path);
354+
}
355+
}
356+
330357
for path in candidates {
331358
let p = PathBuf::from(&path);
332359
if p.exists() {

0 commit comments

Comments
 (0)