This commit is contained in:
SuperComboGamer
2025-12-10 23:14:23 -05:00
parent f96fa6561e
commit e553b39454
4 changed files with 21 additions and 54 deletions

View File

@@ -168,17 +168,6 @@ class CodexCliDetector {
}; };
} }
// If auth file exists, assume authenticated
if (fs.existsSync(authPath)) {
return {
authenticated: true,
method: 'auth_file',
hasAuthFile: true,
hasEnvKey: !!envApiKey,
authPath
};
}
return { return {
authenticated: false, authenticated: false,
method: 'none', method: 'none',

View File

@@ -69,17 +69,15 @@ export function useCliStatus() {
const result = await api.setup.getClaudeStatus(); const result = await api.setup.getClaudeStatus();
if (result.success && result.auth) { if (result.success && result.auth) {
const auth = result.auth; const auth = result.auth;
// Map the method directly from detector // Validate method is one of the expected values, default to "none"
const methodMap: Record<string, "oauth_token_env" | "oauth_token" | "api_key" | "api_key_env" | "none"> = { const validMethods = ["oauth_token_env", "oauth_token", "api_key", "api_key_env", "none"] as const;
oauth_token_env: "oauth_token_env", type AuthMethod = typeof validMethods[number];
oauth_token: "oauth_token", const method: AuthMethod = validMethods.includes(auth.method as AuthMethod)
api_key: "api_key", ? (auth.method as AuthMethod)
api_key_env: "api_key_env", : "none";
none: "none",
};
const authStatus = { const authStatus = {
authenticated: auth.authenticated, authenticated: auth.authenticated,
method: methodMap[auth.method] || "none", method,
hasCredentialsFile: auth.hasCredentialsFile ?? false, hasCredentialsFile: auth.hasCredentialsFile ?? false,
oauthTokenValid: auth.hasStoredOAuthToken || auth.hasEnvOAuthToken, oauthTokenValid: auth.hasStoredOAuthToken || auth.hasEnvOAuthToken,
apiKeyValid: auth.hasStoredApiKey || auth.hasEnvApiKey, apiKeyValid: auth.hasStoredApiKey || auth.hasEnvApiKey,

View File

@@ -233,16 +233,15 @@ function ClaudeSetupStep({
setClaudeCliStatus(cliStatus); setClaudeCliStatus(cliStatus);
if (result.auth) { if (result.auth) {
const methodMap: Record<string, "oauth_token_env" | "oauth_token" | "api_key" | "api_key_env" | "none"> = { // Validate method is one of the expected values, default to "none"
oauth_token_env: "oauth_token_env", const validMethods = ["oauth_token_env", "oauth_token", "api_key", "api_key_env", "none"] as const;
oauth_token: "oauth_token", type AuthMethod = typeof validMethods[number];
api_key: "api_key", const method: AuthMethod = validMethods.includes(result.auth.method as AuthMethod)
api_key_env: "api_key_env", ? (result.auth.method as AuthMethod)
none: "none", : "none";
};
const authStatus = { const authStatus = {
authenticated: result.auth.authenticated, authenticated: result.auth.authenticated,
method: methodMap[result.auth.method] || "none", method,
hasCredentialsFile: false, hasCredentialsFile: false,
oauthTokenValid: result.auth.hasStoredOAuthToken || result.auth.hasEnvOAuthToken, oauthTokenValid: result.auth.hasStoredOAuthToken || result.auth.hasEnvOAuthToken,
apiKeyValid: result.auth.hasStoredApiKey || result.auth.hasEnvApiKey, apiKeyValid: result.auth.hasStoredApiKey || result.auth.hasEnvApiKey,

View File

@@ -41,21 +41,7 @@ export interface StatResult {
error?: string; error?: string;
} }
// Auto Mode types - Import from electron.d.ts for internal use // Re-export types from electron.d.ts for external use
import type {
AutoModeEvent as AutoModeEventType,
ModelDefinition as ModelDefinitionType,
ProviderStatus as ProviderStatusType,
WorktreeAPI as WorktreeAPIType,
GitAPI as GitAPIType,
WorktreeInfo as WorktreeInfoType,
WorktreeStatus as WorktreeStatusType,
FileDiffsResult as FileDiffsResultType,
FileDiffResult as FileDiffResultType,
FileStatus as FileStatusType,
} from "@/types/electron";
// Re-export types for external use
export type { export type {
AutoModeEvent, AutoModeEvent,
ModelDefinition, ModelDefinition,
@@ -69,17 +55,12 @@ export type {
FileStatus, FileStatus,
} from "@/types/electron"; } from "@/types/electron";
// Type aliases for internal use // Import types for internal use in this file
type AutoModeEvent = AutoModeEventType; import type {
type ModelDefinition = ModelDefinitionType; AutoModeEvent,
type ProviderStatus = ProviderStatusType; WorktreeAPI,
type WorktreeAPI = WorktreeAPIType; GitAPI,
type GitAPI = GitAPIType; } from "@/types/electron";
type WorktreeInfo = WorktreeInfoType;
type WorktreeStatus = WorktreeStatusType;
type FileDiffsResult = FileDiffsResultType;
type FileDiffResult = FileDiffResultType;
type FileStatus = FileStatusType;
// Feature type - Import from app-store // Feature type - Import from app-store
import type { Feature } from "@/store/app-store"; import type { Feature } from "@/store/app-store";