From a2c1b9b47c85e06648e4a46acc2ed34ddbec23b9 Mon Sep 17 00:00:00 2001 From: catlog22 Date: Sat, 24 Jan 2026 11:08:02 +0800 Subject: [PATCH] fix: replace hardcoded Windows paths with dynamic cross-platform paths in CodexLens error messages - Remove hardcoded Windows paths (D:\Claude_dms3\codex-lens) that were displayed to macOS/Linux users - Generate dynamic possible paths list based on runtime environment - Support multiple installation locations (cwd, project root, home directory) - Improve error messages with platform-appropriate paths - Maintain consistency across both bootstrapWithUv() and installSemanticWithUv() functions Fixes remaining issue from #104 regarding cross-platform error message compatibility --- ccw/src/tools/codex-lens.ts | 41 +++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/ccw/src/tools/codex-lens.ts b/ccw/src/tools/codex-lens.ts index 71d0fb60..099b1d41 100644 --- a/ccw/src/tools/codex-lens.ts +++ b/ccw/src/tools/codex-lens.ts @@ -670,14 +670,26 @@ async function bootstrapWithUv(gpuMode: GpuMode = 'cpu'): Promise ` - ${p}`).join('\n'); + const errorMsg = `Cannot find codex-lens directory for local installation.\n\n` + `codex-lens is a local development package (not published to PyPI) and must be installed from local files.\n\n` + `To fix this:\n` + - `1. Ensure the 'codex-lens' directory exists in your project root\n` + - ` Expected location: D:\\Claude_dms3\\codex-lens\n` + - `2. Verify pyproject.toml exists: D:\\Claude_dms3\\codex-lens\\pyproject.toml\n` + - `3. Run ccw from the correct working directory (e.g., D:\\Claude_dms3)\n` + - `4. Or manually install: cd D:\\Claude_dms3\\codex-lens && pip install -e .[${extras.join(',')}]`; + `1. Ensure 'codex-lens' directory exists at one of these locations:\n${pathsList}\n` + + `2. Verify pyproject.toml exists in the codex-lens directory\n` + + `3. Run ccw from the correct working directory\n` + + `4. Or manually install: cd /path/to/codex-lens && pip install -e .[${extras.join(',')}]`; return { success: false, error: errorMsg }; } @@ -744,13 +756,26 @@ async function installSemanticWithUv(gpuMode: GpuMode = 'cpu'): Promise ` - ${p}`).join('\n'); + const errorMsg = `Cannot find codex-lens directory for local installation.\n\n` + `codex-lens is a local development package (not published to PyPI) and must be installed from local files.\n\n` + `To fix this:\n` + - `1. Ensure the 'codex-lens' directory exists in your project root\n` + - `2. Verify pyproject.toml exists in codex-lens directory\n` + + `1. Ensure 'codex-lens' directory exists at one of these locations:\n${pathsList}\n` + + `2. Verify pyproject.toml exists in the codex-lens directory\n` + `3. Run ccw from the correct working directory\n` + - `4. Or manually install: cd codex-lens && pip install -e .[${extras.join(',')}]`; + `4. Or manually install: cd /path/to/codex-lens && pip install -e .[${extras.join(',')}]`; return { success: false, error: errorMsg }; }