@@ -31,6 +31,9 @@ func CodexSearchDirs(home string) []string {
3131 }
3232 addWindowsCodexSearchDirs (add )
3333 addDarwinCodexSearchDirs (add , home )
34+ if prefix , ok := npmGlobalPrefix (); ok {
35+ add (prefix )
36+ }
3437 return dirs
3538}
3639
@@ -54,31 +57,24 @@ func codexExecutableFile(path string) bool {
5457
5558// ResolveCodexExecutable finds the Codex CLI binary from PATH or common install roots.
5659func ResolveCodexExecutable () (string , bool ) {
57- if p , err := exec .LookPath ("codex" ); err == nil && strings .TrimSpace (p ) != "" {
60+ if p , err := exec .LookPath ("codex" ); err == nil && strings .TrimSpace (p ) != "" && ! codexClientExecutablePath ( p ) {
5861 return p , true
5962 }
6063 home , _ := os .UserHomeDir ()
6164 for _ , dir := range CodexSearchDirs (home ) {
6265 for _ , name := range codexCommandNames () {
6366 candidate := filepath .Join (dir , name )
64- if codexExecutableFile (candidate ) {
67+ if codexExecutableFile (candidate ) && ! codexClientExecutablePath ( candidate ) {
6568 return candidate , true
6669 }
6770 }
6871 }
69- for _ , candidate := range codexExtraExecutableCandidates () {
70- if codexExecutableFile (candidate ) {
71- return candidate , true
72- }
73- }
7472 return "" , false
7573}
7674
77- // CodexInstalled reports whether Codex is usable ( CLI on disk or Codex app install layout) .
78- // CLI and desktop app share CODEX_HOME; they are not distinguished here.
75+ // CodexInstalled reports whether the Codex CLI is available .
76+ // Desktop/Store app installs are intentionally ignored here.
7977func CodexInstalled () bool {
80- if _ , ok := ResolveCodexExecutable (); ok {
81- return true
82- }
83- return codexRuntimePresent ()
78+ _ , ok := ResolveCodexExecutable ()
79+ return ok
8480}
0 commit comments