style: 完成所有文件的lint

This commit is contained in:
claude-code-best
2026-05-01 21:39:30 +08:00
parent d136872cc9
commit 6182015005
1333 changed files with 68255 additions and 77882 deletions

View File

@@ -1,81 +1,71 @@
import { feature } from 'bun:bundle'
import * as React from 'react'
import { resetCostState } from '../../bootstrap/state.js'
import {
clearTrustedDeviceToken,
enrollTrustedDevice,
} from '../../bridge/trustedDevice.js'
import type { LocalJSXCommandContext } from '../../commands.js'
import { ConfigurableShortcutHint } from '../../components/ConfigurableShortcutHint.js'
import { ConsoleOAuthFlow } from '../../components/ConsoleOAuthFlow.js'
import { Dialog } from '@anthropic/ink'
import { useMainLoopModel } from '../../hooks/useMainLoopModel.js'
import { Text } from '@anthropic/ink'
import { refreshGrowthBookAfterAuthChange } from '../../services/analytics/growthbook.js'
import { refreshPolicyLimits } from '../../services/policyLimits/index.js'
import { refreshRemoteManagedSettings } from '../../services/remoteManagedSettings/index.js'
import type { LocalJSXCommandOnDone } from '../../types/command.js'
import { stripSignatureBlocks } from '../../utils/messages.js'
import { feature } from 'bun:bundle';
import * as React from 'react';
import { resetCostState } from '../../bootstrap/state.js';
import { clearTrustedDeviceToken, enrollTrustedDevice } from '../../bridge/trustedDevice.js';
import type { LocalJSXCommandContext } from '../../commands.js';
import { ConfigurableShortcutHint } from '../../components/ConfigurableShortcutHint.js';
import { ConsoleOAuthFlow } from '../../components/ConsoleOAuthFlow.js';
import { Dialog } from '@anthropic/ink';
import { useMainLoopModel } from '../../hooks/useMainLoopModel.js';
import { Text } from '@anthropic/ink';
import { refreshGrowthBookAfterAuthChange } from '../../services/analytics/growthbook.js';
import { refreshPolicyLimits } from '../../services/policyLimits/index.js';
import { refreshRemoteManagedSettings } from '../../services/remoteManagedSettings/index.js';
import type { LocalJSXCommandOnDone } from '../../types/command.js';
import { stripSignatureBlocks } from '../../utils/messages.js';
import {
checkAndDisableAutoModeIfNeeded,
resetAutoModeGateCheck,
} from '../../utils/permissions/bypassPermissionsKillswitch.js'
import { resetUserCache } from '../../utils/user.js'
} from '../../utils/permissions/bypassPermissionsKillswitch.js';
import { resetUserCache } from '../../utils/user.js';
export async function call(
onDone: LocalJSXCommandOnDone,
context: LocalJSXCommandContext,
): Promise<React.ReactNode> {
export async function call(onDone: LocalJSXCommandOnDone, context: LocalJSXCommandContext): Promise<React.ReactNode> {
return (
<Login
onDone={async success => {
context.onChangeAPIKey()
context.onChangeAPIKey();
// Signature-bearing blocks (thinking, connector_text) are bound to the API key —
// strip them so the new key doesn't reject stale signatures.
context.setMessages(stripSignatureBlocks)
context.setMessages(stripSignatureBlocks);
if (success) {
// Post-login refresh logic. Keep in sync with onboarding in src/interactiveHelpers.tsx
// Reset cost state when switching accounts
resetCostState()
resetCostState();
// Refresh remotely managed settings after login (non-blocking)
void refreshRemoteManagedSettings()
void refreshRemoteManagedSettings();
// Refresh policy limits after login (non-blocking)
void refreshPolicyLimits()
void refreshPolicyLimits();
// Clear user data cache BEFORE GrowthBook refresh so it picks up fresh credentials
resetUserCache()
resetUserCache();
// Refresh GrowthBook after login to get updated feature flags (e.g., for claude.ai MCPs)
refreshGrowthBookAfterAuthChange()
refreshGrowthBookAfterAuthChange();
// Clear any stale trusted device token from a previous account before
// re-enrolling — prevents sending the old token on bridge calls while
// the async enrollTrustedDevice() is in-flight.
clearTrustedDeviceToken()
clearTrustedDeviceToken();
// Enroll as a trusted device for Remote Control (10-min fresh-session window)
void enrollTrustedDevice()
void enrollTrustedDevice();
// Reset killswitch gate checks and re-run with new org
resetAutoModeGateCheck()
const appState = context.getAppState()
void checkAndDisableAutoModeIfNeeded(
appState.toolPermissionContext,
context.setAppState,
appState.fastMode,
)
resetAutoModeGateCheck();
const appState = context.getAppState();
void checkAndDisableAutoModeIfNeeded(appState.toolPermissionContext, context.setAppState, appState.fastMode);
// Increment authVersion to trigger re-fetching of auth-dependent data in hooks (e.g., MCP servers)
context.setAppState(prev => ({
...prev,
authVersion: prev.authVersion + 1,
}))
}));
}
onDone(success ? 'Login successful' : 'Login interrupted')
onDone(success ? 'Login successful' : 'Login interrupted');
}}
/>
)
);
}
export function Login(props: {
onDone: (success: boolean, mainLoopModel: string) => void
startingMessage?: string
onDone: (success: boolean, mainLoopModel: string) => void;
startingMessage?: string;
}): React.ReactNode {
const mainLoopModel = useMainLoopModel()
const mainLoopModel = useMainLoopModel();
return (
<Dialog
@@ -86,19 +76,11 @@ export function Login(props: {
exitState.pending ? (
<Text>Press {exitState.keyName} again to exit</Text>
) : (
<ConfigurableShortcutHint
action="confirm:no"
context="Confirmation"
fallback="Esc"
description="cancel"
/>
<ConfigurableShortcutHint action="confirm:no" context="Confirmation" fallback="Esc" description="cancel" />
)
}
>
<ConsoleOAuthFlow
onDone={() => props.onDone(true, mainLoopModel)}
startingMessage={props.startingMessage}
/>
<ConsoleOAuthFlow onDone={() => props.onDone(true, mainLoopModel)} startingMessage={props.startingMessage} />
</Dialog>
)
);
}