mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-21 07:45:52 +00:00
chore: 移除 binaryCheck/claudeAiLimits/codeIndexing 中未引用的导出
- binaryCheck.ts: 删除 clearBinaryCache(零调用,binaryCache 仍由 isBinaryInstalled 使用) - claudeAiLimits.ts: 删除 RATE_LIMIT_DISPLAY_NAMES 常量 + getRateLimitDisplayName(互为唯一消费者) - codeIndexing.ts: 删除 detectCodeIndexingFromMcpTool(同胞 detectCodeIndexingFromCommand/McpServerName 仍活跃) Co-Authored-By: glm-5.2 <zai-org@claude-code-best.win>
This commit is contained in:
@@ -78,18 +78,6 @@ const EARLY_WARNING_CLAIM_MAP: Record<string, RateLimitType> = {
|
||||
overage: 'overage',
|
||||
}
|
||||
|
||||
const RATE_LIMIT_DISPLAY_NAMES: Record<RateLimitType, string> = {
|
||||
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.
|
||||
|
||||
@@ -44,10 +44,3 @@ export async function isBinaryInstalled(command: string): Promise<boolean> {
|
||||
|
||||
return exists
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the binary check cache (useful for testing)
|
||||
*/
|
||||
export function clearBinaryCache(): void {
|
||||
binaryCache.clear()
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user