MCPcopy Create free account
hub / github.com/Gan-Xing/CodexBridge / resolveExplicitCommandPath

Function resolveExplicitCommandPath

src/providers/codex/config.ts:700–725  ·  view source on GitHub ↗
(
  command: string,
  {
    platform,
    env,
    cwd,
  }: {
    platform: NodeJS.Platform;
    env: NodeJS.ProcessEnv;
    cwd: string;
  },
)

Source from the content-addressed store, hash-verified

698}
699
700function resolveExplicitCommandPath(
701 command: string,
702 {
703 platform,
704 env,
705 cwd,
706 }: {
707 platform: NodeJS.Platform;
708 env: NodeJS.ProcessEnv;
709 cwd: string;
710 },
711): string | null {
712 if (!hasPathSeparator(command)) {
713 return null;
714 }
715 const hostCommand = normalizeCommandPathForHost(command, platform);
716 const basePath = path.isAbsolute(hostCommand)
717 ? hostCommand
718 : path.resolve(cwd, hostCommand);
719 for (const candidate of buildExplicitCandidates(basePath, platform, env)) {
720 if (isCommandFile(candidate)) {
721 return candidate;
722 }
723 }
724 return null;
725}
726
727function normalizeCommandPathForHost(command: string, platform: NodeJS.Platform): string {
728 if (platform !== 'win32' || path.sep !== '/') {

Callers 1

resolveCommandFunction · 0.70

Calls 5

buildExplicitCandidatesFunction · 0.85
resolveMethod · 0.80
hasPathSeparatorFunction · 0.70
isCommandFileFunction · 0.70

Tested by

no test coverage detected