MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / normalizeCandidate

Function normalizeCandidate

cli/src/utils/detect-shell.ts:88–116  ·  view source on GitHub ↗
(value?: string | null)

Source from the content-addressed store, hash-verified

86}
87
88function normalizeCandidate(value?: string | null): ShellName | null {
89 if (!value) {
90 return null
91 }
92
93 const trimmed = value.trim()
94 if (!trimmed) {
95 return null
96 }
97
98 const lower = trimmed.toLowerCase()
99 const parts = lower.split(/[/\\]/)
100 const last = parts.pop() ?? lower
101 const base = last.endsWith('.exe') ? last.slice(0, -4) : last
102
103 if (SHELL_ALIASES[base]) {
104 return SHELL_ALIASES[base]
105 }
106
107 if (SHELL_ALIASES[last]) {
108 return SHELL_ALIASES[last]
109 }
110
111 if (base.endsWith('sh')) {
112 return base
113 }
114
115 return null
116}

Callers 2

detectFromEnvironmentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected