Skip to content

Commit ab259b1

Browse files
committed
fix: resolve CodexLens installation failure with NPM global install
- Implement two-pass search strategy for codex-lens path detection - First pass: prefer non-node_modules paths (development environment) - Second pass: allow node_modules paths (NPM global install) - Fixes CodexLens installation for all NPM global install users - No breaking changes, maintains backward compatibility Resolves issue where NPM global install users could not install CodexLens because the code rejected paths containing /node_modules/, which is the only valid location for codex-lens in NPM installations. Tested on macOS with Node.js v22.18.0 via NPM global install.
1 parent 24a28f2 commit ab259b1

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)