chore: 清理 18 处未使用导入、变量和函数

移除未使用的导入(getSubscriptionType、isEnvDefinedFalsy、
getClaudeConfigHomeDir 等)、未使用的常量(ACCENT_COLOR、
NAME_MATCH_BONUS、CLIPBOARD_THRESHOLD)和死函数
(getOpus41Option、pasteViaClipboard),
为未使用参数添加 _ 前缀。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
claude-code-best
2026-05-05 20:15:51 +08:00
parent 1ac18aec0d
commit 0ad6349434
18 changed files with 12 additions and 95 deletions

View File

@@ -1,7 +1,6 @@
import type { CoordinateMode, CuSubGates } from '@ant/computer-use-mcp/types'
import { getDynamicConfig_CACHED_MAY_BE_STALE } from '../../services/analytics/growthbook.js'
import { getSubscriptionType } from '../auth.js'
import { isEnvTruthy } from '../envUtils.js'
type ChicagoConfig = CuSubGates & {

View File

@@ -22,7 +22,6 @@ const INDICATOR_HEIGHT = 28
const FADE_AFTER_MS = 2000
const BG_COLOR = '30, 30, 30' // dark background
const TEXT_COLOR = '220, 220, 220' // light text
const ACCENT_COLOR = '80, 200, 80' // green accent for active
let indicatorProc: ReturnType<typeof Bun.spawn> | null = null
let stopFile: string | null = null

View File

@@ -12,9 +12,6 @@
import { validateHwnd, runPs, VK_MAP, MODIFIER_KEYS } from './shared.js'
/** Character count above which we switch to clipboard paste */
const CLIPBOARD_THRESHOLD = 32
/** Cache findEditChild results — window structure doesn't change while bound */
const editChildCache = new Map<string, string | null>()
@@ -275,46 +272,6 @@ function buildWmCharLines(hwnd: string, text: string): string[] {
return lines
}
/**
* Paste text via clipboard into the target window.
* Uses Clipboard.SetText() + SendMessageW(Ctrl+V).
* NO global APIs (SendInput/keybd_event/SendKeys) — only window-targeted messages.
*/
function pasteViaClipboard(hwnd: string, text: string): boolean {
// Escape single quotes for PowerShell string literal
const escaped = text.replace(/'/g, "''")
const hwndExpr = `[IntPtr]::new([long]${hwnd})`
const script = `${WINMSG_TYPE}
Add-Type -AssemblyName System.Windows.Forms
# Save current clipboard
$saved = $null
try { $saved = [System.Windows.Forms.Clipboard]::GetText() } catch {}
# Set our text
[System.Windows.Forms.Clipboard]::SetText('${escaped}')
# Ctrl+V via PostMessage to the target window (NOT global keybd_event)
# Must use PostMessage + correct lParam (scan code) for Windows Terminal / ConPTY
[WinMsg]::PostMessage(${hwndExpr}, [WinMsg]::WM_KEYDOWN, [IntPtr]0x11, [WinMsg]::KeyDownLParam(0x11)) # Ctrl down
[WinMsg]::PostMessage(${hwndExpr}, [WinMsg]::WM_KEYDOWN, [IntPtr]0x56, [WinMsg]::KeyDownLParam(0x56)) # V down
[WinMsg]::PostMessage(${hwndExpr}, [WinMsg]::WM_KEYUP, [IntPtr]0x56, [WinMsg]::KeyUpLParam(0x56)) # V up
[WinMsg]::PostMessage(${hwndExpr}, [WinMsg]::WM_KEYUP, [IntPtr]0x11, [WinMsg]::KeyUpLParam(0x11)) # Ctrl up
# Brief wait for paste to complete
Start-Sleep -Milliseconds 50
# Restore clipboard
if ($saved -ne $null -and $saved -ne '') {
try { [System.Windows.Forms.Clipboard]::SetText($saved) } catch {}
} else {
try { [System.Windows.Forms.Clipboard]::Clear() } catch {}
}
Write-Output 'OK'
`
return runPs(script) === 'OK'
}
/**
* Send text to a window via WM_CHAR per Unicode codepoint.
* Always uses the WM_CHAR path — reliable across all window types including