From 231d9bbd1b06e29998afff2cb324a299b928084a Mon Sep 17 00:00:00 2001 From: ndycode Date: Sat, 21 Mar 2026 10:58:54 +0800 Subject: [PATCH] refactor: extract fix command --- lib/codex-manager.ts | 56 ++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 30 deletions(-) diff --git a/lib/codex-manager.ts b/lib/codex-manager.ts index b1c32ea7..ac2598ff 100644 --- a/lib/codex-manager.ts +++ b/lib/codex-manager.ts @@ -2834,35 +2834,6 @@ function applyDoctorFixes(storage: AccountStorageV3): { return { changed, actions }; } -async function runDoctor(args: string[]): Promise { - return runDoctorCommand(args, { - setStoragePath, - getStoragePath, - getCodexCliAuthPath, - getCodexCliConfigPath, - loadCodexCliState, - parseDoctorArgs, - printDoctorUsage, - loadAccounts, - applyDoctorFixes, - saveAccounts, - resolveActiveIndex, - evaluateForecastAccounts, - recommendForecastAccount, - sanitizeEmail, - extractAccountEmail, - extractAccountId, - hasPlaceholderEmail, - hasLikelyInvalidRefreshToken, - getDoctorRefreshTokenKey, - hasUsableAccessToken, - queuedRefresh, - normalizeFailureDetail, - applyTokenAccountIdentity, - setCodexCliActiveSelection, - }); -} - async function clearAccountsAndReset(): Promise { await clearAccounts(); } @@ -3600,7 +3571,32 @@ export async function runCodexMultiAuthCli(rawArgs: string[]): Promise { return runFix(rest); } if (command === "doctor") { - return runDoctor(rest); + return runDoctorCommand(rest, { + setStoragePath, + getStoragePath, + getCodexCliAuthPath, + getCodexCliConfigPath, + loadCodexCliState, + parseDoctorArgs, + printDoctorUsage, + loadAccounts, + applyDoctorFixes, + saveAccounts, + resolveActiveIndex, + evaluateForecastAccounts, + recommendForecastAccount, + sanitizeEmail, + extractAccountEmail, + extractAccountId, + hasPlaceholderEmail, + hasLikelyInvalidRefreshToken, + getDoctorRefreshTokenKey, + hasUsableAccessToken, + queuedRefresh, + normalizeFailureDetail, + applyTokenAccountIdentity, + setCodexCliActiveSelection, + }); } console.error(`Unknown command: ${command}`);