Skip to content

Commit 35528a8

Browse files
author
Nivokvo Bounty Hunter
committed
fix(ai): resolve engine aliases in pickAiEngine
pickAiEngine() passed the raw preferred string directly to ENGINES lookup, so aliases like 'cc' for claude or 'openai' for codex were never resolved. Fixed by calling resolveEngine() first, matching all other CLI surfaces.
1 parent dfcb8c1 commit 35528a8

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/engines.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ export function aiExecArgs(engine, prompt) {
155155

156156
/** First installed engine that supports headless ai(), honoring a preference. */
157157
export function pickAiEngine(preferred) {
158-
const order = preferred ? [preferred] : ["claude", "codex", "opencode", "gemini", "aider"];
158+
const resolved = preferred ? resolveEngine(preferred)?.[0] : null;
159+
const order = resolved ? [resolved] : ["claude", "codex", "opencode", "gemini", "aider"];
159160
for (const key of order) {
160161
if (Object.hasOwn(ENGINES, key) && Object.hasOwn(AI_EXEC, key) && isInstalled(ENGINES[key].bin)) return key;
161162
}

0 commit comments

Comments
 (0)