mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-05 01:50:27 +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,
|
||||
uninstallCodexLens,
|
||||
cancelIndexing,
|
||||
isIndexingInProgress
|
||||
isIndexingInProgress,
|
||||
getVenvPythonPath
|
||||
} from '../../tools/codex-lens.js';
|
||||
import type { ProgressInfo, GpuMode } from '../../tools/codex-lens.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 };
|
||||
}
|
||||
|
||||
// Spawn watch process (no shell: true for security)
|
||||
// Use process.platform to determine if we need .cmd extension on Windows
|
||||
const isWindows = process.platform === 'win32';
|
||||
const codexlensCmd = isWindows ? 'codexlens.exe' : 'codexlens';
|
||||
const args = ['watch', targetPath, '--debounce', String(debounce_ms)];
|
||||
watcherProcess = spawn(codexlensCmd, args, {
|
||||
// Spawn watch process using Python (no shell: true for security)
|
||||
// CodexLens is a Python package, must run via python -m codexlens
|
||||
const pythonPath = getVenvPythonPath();
|
||||
const args = ['-m', 'codexlens', 'watch', targetPath, '--debounce', String(debounce_ms)];
|
||||
watcherProcess = spawn(pythonPath, args, {
|
||||
cwd: targetPath,
|
||||
stdio: ['ignore', 'pipe', 'pipe'],
|
||||
env: { ...process.env }
|
||||
|
||||
@@ -1446,6 +1446,12 @@ export {
|
||||
cancelIndexing,
|
||||
isIndexingInProgress,
|
||||
};
|
||||
|
||||
// Export Python path for direct spawn usage (e.g., watcher)
|
||||
export function getVenvPythonPath(): string {
|
||||
return VENV_PYTHON;
|
||||
}
|
||||
|
||||
export type { GpuMode, PythonEnvInfo };
|
||||
|
||||
// Backward-compatible export for tests
|
||||
|
||||
Reference in New Issue
Block a user