Download src/mitm/detection/codex.ts from rais133/omniroute: direct link, hf CLI and curl.
- Browser
- Download file 782 Bytes
-
https://huggingface.co/spaces/rais133/omniroute/resolve/main/src/mitm/detection/codex.ts
- Command line
-
hf download hf://spaces/rais133/omniroute/src/mitm/detection/codex.ts
-
curl -L -o codex.ts https://huggingface.co/spaces/rais133/omniroute/resolve/main/src/mitm/detection/codex.ts
782 Bytes
| /** | |
| * OpenAI Codex CLI installation detection. | |
| * Purely filesystem-based — no shell interpolation (Hard Rule #13). | |
| */ | |
| import fs from "node:fs"; | |
| import os from "node:os"; | |
| import path from "node:path"; | |
| import type { DetectionResult } from "../types"; | |
| const HOME = os.homedir(); | |
| const PATHS = [ | |
| "/usr/local/bin/codex", | |
| "/usr/bin/codex", | |
| path.join(HOME, ".local", "bin", "codex"), | |
| path.join(HOME, ".npm-global", "bin", "codex"), | |
| path.join(HOME, "node_modules", ".bin", "codex"), | |
| path.join( | |
| process.env.APPDATA ?? path.join(HOME, "AppData", "Roaming"), | |
| "npm", | |
| "codex.cmd" | |
| ), | |
| ]; | |
| export function detectCodex(): DetectionResult { | |
| for (const p of PATHS) { | |
| if (fs.existsSync(p)) return { installed: true, path: p }; | |
| } | |
| return { installed: false }; | |
| } | |