Files
OmniRoute/src/mitm/detection/claudeCode.ts
Diego Rodrigues de Sa e Souza d0396c200d Release v3.8.31 (#4377)
Release v3.8.31 — see CHANGELOG.md [3.8.31] for full notes and contributors.

Merged over known non-blocking reds (all correctness gates green): Integration Tests (2/2) is env/flaky (polls a real upstream batch that did not complete in the poll window); SonarQube/SonarCloud is the advisory server-side new-code quality gate. Unit (8 shards), Coverage, Node 22/24/26, Lint, PR Test Policy, Quality Ratchet, Docs-Strict, Quality-Extended and all 4 CodeQL analyses are green.
2026-06-20 14:55:24 -03:00

26 lines
768 B
TypeScript

/**
* Claude Code (Anthropic 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.ts";
const HOME = os.homedir();
const PATHS = [
"/usr/local/bin/claude",
"/usr/bin/claude",
path.join(HOME, ".local", "bin", "claude"),
path.join(HOME, ".npm-global", "bin", "claude"),
path.join(HOME, ".claude"),
path.join(process.env.APPDATA ?? path.join(HOME, "AppData", "Roaming"), "npm", "claude.cmd"),
];
export function detectClaudeCode(): DetectionResult {
for (const p of PATHS) {
if (fs.existsSync(p)) return { installed: true, path: p };
}
return { installed: false };
}