mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-11 02:33:51 +08:00
feat: update CodexLens route to spawn watcher using Python and add getVenvPythonPath export
This commit is contained in:
@@ -20,7 +20,8 @@ import {
|
|||||||
detectGpuSupport,
|
detectGpuSupport,
|
||||||
uninstallCodexLens,
|
uninstallCodexLens,
|
||||||
cancelIndexing,
|
cancelIndexing,
|
||||||
isIndexingInProgress
|
isIndexingInProgress,
|
||||||
|
getVenvPythonPath
|
||||||
} from '../../tools/codex-lens.js';
|
} from '../../tools/codex-lens.js';
|
||||||
import type { ProgressInfo, GpuMode } from '../../tools/codex-lens.js';
|
import type { ProgressInfo, GpuMode } from '../../tools/codex-lens.js';
|
||||||
import { loadLiteLLMApiConfig } from '../../config/litellm-api-config-manager.js';
|
import { loadLiteLLMApiConfig } from '../../config/litellm-api-config-manager.js';
|
||||||
@@ -1356,12 +1357,11 @@ export async function handleCodexLensRoutes(ctx: RouteContext): Promise<boolean>
|
|||||||
return { success: false, error: 'CodexLens not installed', status: 400 };
|
return { success: false, error: 'CodexLens not installed', status: 400 };
|
||||||
}
|
}
|
||||||
|
|
||||||
// Spawn watch process (no shell: true for security)
|
// Spawn watch process using Python (no shell: true for security)
|
||||||
// Use process.platform to determine if we need .cmd extension on Windows
|
// CodexLens is a Python package, must run via python -m codexlens
|
||||||
const isWindows = process.platform === 'win32';
|
const pythonPath = getVenvPythonPath();
|
||||||
const codexlensCmd = isWindows ? 'codexlens.exe' : 'codexlens';
|
const args = ['-m', 'codexlens', 'watch', targetPath, '--debounce', String(debounce_ms)];
|
||||||
const args = ['watch', targetPath, '--debounce', String(debounce_ms)];
|
watcherProcess = spawn(pythonPath, args, {
|
||||||
watcherProcess = spawn(codexlensCmd, args, {
|
|
||||||
cwd: targetPath,
|
cwd: targetPath,
|
||||||
stdio: ['ignore', 'pipe', 'pipe'],
|
stdio: ['ignore', 'pipe', 'pipe'],
|
||||||
env: { ...process.env }
|
env: { ...process.env }
|
||||||
|
|||||||
@@ -1446,6 +1446,12 @@ export {
|
|||||||
cancelIndexing,
|
cancelIndexing,
|
||||||
isIndexingInProgress,
|
isIndexingInProgress,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Export Python path for direct spawn usage (e.g., watcher)
|
||||||
|
export function getVenvPythonPath(): string {
|
||||||
|
return VENV_PYTHON;
|
||||||
|
}
|
||||||
|
|
||||||
export type { GpuMode, PythonEnvInfo };
|
export type { GpuMode, PythonEnvInfo };
|
||||||
|
|
||||||
// Backward-compatible export for tests
|
// Backward-compatible export for tests
|
||||||
|
|||||||
Reference in New Issue
Block a user