MCPcopy Index your code
hub / github.com/codeaashu/claude-code / findClaudeAlias

Function findClaudeAlias

src/utils/shellConfig.ts:114–135  ·  view source on GitHub ↗
(
  options?: ShellConfigOptions,
)

Source from the content-addressed store, hash-verified

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

Callers 2

findValidClaudeAliasFunction · 0.85

Calls 3

getShellConfigPathsFunction · 0.85
readFileLinesFunction · 0.85
valuesMethod · 0.80

Tested by

no test coverage detected