2d2d31adfa
* Cleanup * fix: populate deny array before assigning to config, add CursorCliConfig type * Fix deny array ordering and add CursorCliConfig type Move deny array population before config declaration to avoid relying on reference semantics. Add proper type interface for the CLI config object. --------- Co-authored-by: pullfrog[bot] <226033991+pullfrog[bot]@users.noreply.github.com>
26 lines
759 B
TypeScript
26 lines
759 B
TypeScript
/**
|
|
* CLI utilities
|
|
*/
|
|
|
|
import { spawnSync } from "node:child_process";
|
|
import { existsSync } from "node:fs";
|
|
|
|
// re-export logging utilities for backward compatibility
|
|
export { formatIndentedField, formatJsonValue, log, writeSummary } from "./log.ts";
|
|
|
|
/**
|
|
* Finds a CLI executable path by checking if it's installed globally
|
|
* @param name The name of the CLI executable to find
|
|
* @returns The path to the CLI executable, or null if not found
|
|
*/
|
|
export function findCliPath(name: string): string | null {
|
|
const result = spawnSync("which", [name], { encoding: "utf-8" });
|
|
if (result.status === 0 && result.stdout) {
|
|
const cliPath = result.stdout.trim();
|
|
if (cliPath && existsSync(cliPath)) {
|
|
return cliPath;
|
|
}
|
|
}
|
|
return null;
|
|
}
|