MCPcopy Create free account
hub / github.com/SethGammon/Citadel / resolveGhPath

Function resolveGhPath

core/utils/path-helpers.js:61–78  ·  view source on GitHub ↗

* Resolve the GitHub CLI executable path. * Checks native Windows install locations first, then falls back to PATH lookup. * Works correctly in Git Bash, native Windows, WSL, and Unix. * * @returns {string} Absolute path or 'gh' (relies on PATH)

()

Source from the content-addressed store, hash-verified

59 * @returns {string} Absolute path or 'gh' (relies on PATH)
60 */
61function resolveGhPath() {
62 if (process.platform === 'win32') {
63 const fs = require('fs');
64 const candidates = [
65 'C:\\Program Files\\GitHub CLI\\gh.exe',
66 'C:\\Program Files (x86)\\GitHub CLI\\gh.exe',
67 ];
68 for (const candidate of candidates) {
69 try {
70 if (fs.existsSync(candidate)) return candidate;
71 } catch {
72 // Non-critical — fall through to PATH
73 }
74 }
75 }
76 // Unix, WSL, Git Bash, or gh not in standard locations — rely on PATH
77 return 'gh';
78}
79
80module.exports = {
81 toUniversal,

Callers 1

getGhPathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected