Skip to content

Commit 780e118

Browse files
authored
fix: resolve CodexLens installation failure with NPM global install
Implements two-pass search strategy to support CodexLens in NPM global installations. Fixes issue #104.
2 parents 159dfd1 + ab259b1 commit 780e118

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

ccw/src/tools/codex-lens.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ function findLocalPackagePath(packageName: string): string | null {
8383
possiblePaths.push(join(cwdParent, packageName));
8484
}
8585

86+
// First pass: prefer non-node_modules paths (development environment)
8687
for (const localPath of possiblePaths) {
87-
// Skip paths inside node_modules
8888
if (isInsideNodeModules(localPath)) {
8989
continue;
9090
}
@@ -94,8 +94,12 @@ function findLocalPackagePath(packageName: string): string | null {
9494
}
9595
}
9696

97-
if (!isDevEnvironment()) {
98-
console.log(`[CodexLens] Running from node_modules - will try PyPI for ${packageName}`);
97+
// Second pass: allow node_modules paths (NPM global install)
98+
for (const localPath of possiblePaths) {
99+
if (existsSync(join(localPath, 'pyproject.toml'))) {
100+
console.log(`[CodexLens] Found ${packageName} in node_modules at: ${localPath}`);
101+
return localPath;
102+
}
99103
}
100104

101105
return null;

0 commit comments

Comments
 (0)