From 5929308f532289a056cb0ba633c4cd6b27364496 Mon Sep 17 00:00:00 2001 From: claude-code-best Date: Sat, 20 Jun 2026 10:22:01 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E7=A7=BB=E9=99=A4=20binaryCheck/claud?= =?UTF-8?q?eAiLimits/codeIndexing=20=E4=B8=AD=E6=9C=AA=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - binaryCheck.ts: 删除 clearBinaryCache(零调用,binaryCache 仍由 isBinaryInstalled 使用) - claudeAiLimits.ts: 删除 RATE_LIMIT_DISPLAY_NAMES 常量 + getRateLimitDisplayName(互为唯一消费者) - codeIndexing.ts: 删除 detectCodeIndexingFromMcpTool(同胞 detectCodeIndexingFromCommand/McpServerName 仍活跃) Co-Authored-By: glm-5.2 --- src/services/claudeAiLimits.ts | 12 ----------- src/utils/binaryCheck.ts | 7 ------- src/utils/codeIndexing.ts | 38 ---------------------------------- 3 files changed, 57 deletions(-) diff --git a/src/services/claudeAiLimits.ts b/src/services/claudeAiLimits.ts index 318002ce7..82a5fe79f 100644 --- a/src/services/claudeAiLimits.ts +++ b/src/services/claudeAiLimits.ts @@ -78,18 +78,6 @@ const EARLY_WARNING_CLAIM_MAP: Record = { overage: 'overage', } -const RATE_LIMIT_DISPLAY_NAMES: Record = { - five_hour: 'session limit', - seven_day: 'weekly limit', - seven_day_opus: 'Opus limit', - seven_day_sonnet: 'Sonnet limit', - overage: 'extra usage limit', -} - -export function getRateLimitDisplayName(type: RateLimitType): string { - return RATE_LIMIT_DISPLAY_NAMES[type] || type -} - /** * Calculate what fraction of a time window has elapsed. * Used for time-relative early warning fallback. diff --git a/src/utils/binaryCheck.ts b/src/utils/binaryCheck.ts index 8471753ae..e18e83da6 100644 --- a/src/utils/binaryCheck.ts +++ b/src/utils/binaryCheck.ts @@ -44,10 +44,3 @@ export async function isBinaryInstalled(command: string): Promise { return exists } - -/** - * Clear the binary check cache (useful for testing) - */ -export function clearBinaryCache(): void { - binaryCache.clear() -} diff --git a/src/utils/codeIndexing.ts b/src/utils/codeIndexing.ts index 8bf076d51..975d041cd 100644 --- a/src/utils/codeIndexing.ts +++ b/src/utils/codeIndexing.ts @@ -145,44 +145,6 @@ export function detectCodeIndexingFromCommand( return CLI_COMMAND_MAPPING[firstWord] } -/** - * Detects if an MCP tool is from a code indexing server. - * - * @param toolName - The MCP tool name (format: mcp__serverName__toolName) - * @returns The code indexing tool identifier, or undefined if not a code indexing tool - * - * @example - * detectCodeIndexingFromMcpTool('mcp__sourcegraph__search') // returns 'sourcegraph' - * detectCodeIndexingFromMcpTool('mcp__cody__chat') // returns 'cody' - * detectCodeIndexingFromMcpTool('mcp__filesystem__read') // returns undefined - */ -export function detectCodeIndexingFromMcpTool( - toolName: string, -): CodeIndexingTool | undefined { - // MCP tool names follow the format: mcp__serverName__toolName - if (!toolName.startsWith('mcp__')) { - return undefined - } - - const parts = toolName.split('__') - if (parts.length < 3) { - return undefined - } - - const serverName = parts[1] - if (!serverName) { - return undefined - } - - for (const { pattern, tool } of MCP_SERVER_PATTERNS) { - if (pattern.test(serverName)) { - return tool - } - } - - return undefined -} - /** * Detects if an MCP server name corresponds to a code indexing tool. *