Skip to content

Commit 8a58383

Browse files
committed
refactor: route fix through command module
1 parent c591f1e commit 8a58383

1 file changed

Lines changed: 64 additions & 37 deletions

File tree

lib/codex-manager.ts

Lines changed: 64 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2667,41 +2667,6 @@ function upsertRecoveredFlaggedAccount(
26672667
};
26682668
}
26692669

2670-
async function runFix(args: string[]): Promise<number> {
2671-
return runFixCommand(args, {
2672-
setStoragePath,
2673-
loadAccounts,
2674-
parseFixArgs,
2675-
printFixUsage,
2676-
loadQuotaCache,
2677-
saveQuotaCache,
2678-
cloneQuotaCacheData,
2679-
buildQuotaEmailFallbackState,
2680-
updateQuotaCacheForAccount,
2681-
pruneUnsafeQuotaEmailCacheEntry,
2682-
resolveActiveIndex,
2683-
hasUsableAccessToken,
2684-
fetchCodexQuotaSnapshot,
2685-
formatCompactQuotaSnapshot,
2686-
normalizeFailureDetail,
2687-
hasLikelyInvalidRefreshToken,
2688-
queuedRefresh,
2689-
sanitizeEmail,
2690-
extractAccountEmail,
2691-
extractAccountId,
2692-
applyTokenAccountIdentity,
2693-
isHardRefreshFailure,
2694-
evaluateForecastAccounts,
2695-
recommendForecastAccount,
2696-
saveAccounts,
2697-
formatAccountLabel,
2698-
stylePromptText,
2699-
formatResultSummary,
2700-
styleAccountDetailText,
2701-
defaultDisplay: DEFAULT_DASHBOARD_DISPLAY_SETTINGS,
2702-
});
2703-
}
2704-
27052670
interface DoctorFixAction {
27062671
key: string;
27072672
message: string;
@@ -3022,7 +2987,38 @@ async function runAuthLogin(args: string[]): Promise<number> {
30222987
"Auto-Fix",
30232988
"Checking and fixing common issues",
30242989
async () => {
3025-
await runFix(["--live"]);
2990+
await runFixCommand(["--live"], {
2991+
setStoragePath,
2992+
loadAccounts,
2993+
parseFixArgs,
2994+
printFixUsage,
2995+
loadQuotaCache,
2996+
saveQuotaCache,
2997+
cloneQuotaCacheData,
2998+
buildQuotaEmailFallbackState,
2999+
updateQuotaCacheForAccount,
3000+
pruneUnsafeQuotaEmailCacheEntry,
3001+
resolveActiveIndex,
3002+
hasUsableAccessToken,
3003+
fetchCodexQuotaSnapshot,
3004+
formatCompactQuotaSnapshot,
3005+
normalizeFailureDetail,
3006+
hasLikelyInvalidRefreshToken,
3007+
queuedRefresh,
3008+
sanitizeEmail,
3009+
extractAccountEmail,
3010+
extractAccountId,
3011+
applyTokenAccountIdentity,
3012+
isHardRefreshFailure,
3013+
evaluateForecastAccounts,
3014+
recommendForecastAccount,
3015+
saveAccounts,
3016+
formatAccountLabel,
3017+
stylePromptText,
3018+
formatResultSummary,
3019+
styleAccountDetailText,
3020+
defaultDisplay: DEFAULT_DASHBOARD_DISPLAY_SETTINGS,
3021+
});
30263022
},
30273023
displaySettings,
30283024
);
@@ -3568,7 +3564,38 @@ export async function runCodexMultiAuthCli(rawArgs: string[]): Promise<number> {
35683564
});
35693565
}
35703566
if (command === "fix") {
3571-
return runFix(rest);
3567+
return runFixCommand(rest, {
3568+
setStoragePath,
3569+
loadAccounts,
3570+
parseFixArgs,
3571+
printFixUsage,
3572+
loadQuotaCache,
3573+
saveQuotaCache,
3574+
cloneQuotaCacheData,
3575+
buildQuotaEmailFallbackState,
3576+
updateQuotaCacheForAccount,
3577+
pruneUnsafeQuotaEmailCacheEntry,
3578+
resolveActiveIndex,
3579+
hasUsableAccessToken,
3580+
fetchCodexQuotaSnapshot,
3581+
formatCompactQuotaSnapshot,
3582+
normalizeFailureDetail,
3583+
hasLikelyInvalidRefreshToken,
3584+
queuedRefresh,
3585+
sanitizeEmail,
3586+
extractAccountEmail,
3587+
extractAccountId,
3588+
applyTokenAccountIdentity,
3589+
isHardRefreshFailure,
3590+
evaluateForecastAccounts,
3591+
recommendForecastAccount,
3592+
saveAccounts,
3593+
formatAccountLabel,
3594+
stylePromptText,
3595+
formatResultSummary,
3596+
styleAccountDetailText,
3597+
defaultDisplay: DEFAULT_DASHBOARD_DISPLAY_SETTINGS,
3598+
});
35723599
}
35733600
if (command === "doctor") {
35743601
return runDoctorCommand(rest, {

0 commit comments

Comments
 (0)