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

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

View File

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

View File

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