MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / findClaudeAlias

Function findClaudeAlias

source code/utils/shellConfig.ts:116–137  ·  view source on GitHub ↗
(
  options?: ShellConfigOptions,
)

Source from the content-addressed store, hash-verified

114 * @param options Optional overrides for testing (env, homedir)
115 */
116export async function findClaudeAlias(
117 options?: ShellConfigOptions,
118): Promise<string | null> {
119 const configs = getShellConfigPaths(options)
120
121 for (const configPath of Object.values(configs)) {
122 const lines = await readFileLines(configPath)
123 if (!lines) continue
124
125 for (const line of lines) {
126 if (CLAUDE_ALIAS_REGEX.test(line)) {
127 // Extract the alias target
128 const match = line.match(/alias\s+claude=["']?([^"'\s]+)/)
129 if (match && match[1]) {
130 return match[1]
131 }
132 }
133 }
134 }
135
136 return null
137}
138
139/**
140 * Check if a claude alias exists and points to a valid executable

Callers 2

findValidClaudeAliasFunction · 0.85

Calls 2

getShellConfigPathsFunction · 0.85
readFileLinesFunction · 0.85

Tested by

no test coverage detected