fix: resolve ~45 more unused-variable alerts across 35+ files

- @ant packages: computer-use-input, computer-use-mcp, computer-use-swift, ink, model-provider
- builtin-tools: AgentTool, BashTool, ExecuteTool, MonitorTool, PowerShellTool, SearchExtraToolsTool, WebSearchTool, bingAdapter, ScheduleCronTool
- Others: acp-link, image-processor-napi, sessionMemory, acp/agent
- UI: PromptInput, Notifications, SearchExtraToolsHint, Spinner, App

Fix ConsoleOAuthFlow.tsx regression from previous batch (doSave was accidentally removed)
This commit is contained in:
James Feng 2026-06-08 17:30:56 +08:00
parent d20b58fc05
commit 9870abbd83
44 changed files with 14 additions and 132 deletions

View File

@ -6,7 +6,7 @@
*/
import { $ } from 'bun'
import type { FrontmostAppInfo, InputBackend } from '../types.js'
import type { InputBackend } from '../types.js'
const KEY_MAP: Record<string, number> = {
return: 36, enter: 36, tab: 48, space: 49, delete: 51, backspace: 51,

View File

@ -5,7 +5,7 @@
* Requires: xdotool (apt install xdotool)
*/
import type { FrontmostAppInfo, InputBackend } from '../types.js'
import type { InputBackend } from '../types.js'
// ---------------------------------------------------------------------------
// Shell helper — run a command and return trimmed stdout
@ -20,13 +20,6 @@ function run(cmd: string[]): string {
return new TextDecoder().decode(result.stdout).trim()
}
async function runAsync(cmd: string[]): Promise<string> {
const proc = Bun.spawn(cmd, { stdout: 'pipe', stderr: 'pipe' })
const out = await new Response(proc.stdout).text()
await proc.exited
return out.trim()
}
// ---------------------------------------------------------------------------
// xdotool key name mapping
// ---------------------------------------------------------------------------

View File

@ -7,7 +7,7 @@
* All P/Invoke types are compiled once at module load and reused across calls.
*/
import type { FrontmostAppInfo, InputBackend } from '../types.js'
import type { InputBackend } from '../types.js'
// ---------------------------------------------------------------------------
// PowerShell helper — run a script and return trimmed stdout
@ -22,15 +22,7 @@ function ps(script: string): string {
return new TextDecoder().decode(result.stdout).trim()
}
async function psAsync(script: string): Promise<string> {
const proc = Bun.spawn(
['powershell', '-NoProfile', '-NonInteractive', '-Command', script],
{ stdout: 'pipe', stderr: 'pipe' },
)
const out = await new Response(proc.stdout).text()
await proc.exited
return out.trim()
}
// ---------------------------------------------------------------------------
// P/Invoke type definitions (compiled once, cached by PowerShell session)

View File

@ -188,17 +188,6 @@ function asRecord(args: unknown): Record<string, unknown> {
return {}
}
function requireNumber(
args: Record<string, unknown>,
key: string,
): number | Error {
const v = args[key]
if (typeof v !== 'number' || !Number.isFinite(v)) {
return new Error(`"${key}" must be a finite number.`)
}
return v
}
function requireString(
args: Record<string, unknown>,
key: string,
@ -1004,7 +993,6 @@ async function handleRequestAccess(
bundleId: string
reason: 'user_denied' | 'not_installed'
}> = []
let dialogFlags: CuGrantFlags = overrides.grantFlags
if (needDialog.length > 0 || Object.keys(requestedFlags).length > 0) {
const req: CuPermissionRequest = {
@ -1022,7 +1010,6 @@ async function handleRequestAccess(
const response = await overrides.onPermissionRequest(req)
dialogGranted = response.granted
dialogDenied = response.denied
dialogFlags = response.flags
}
// Do NOT return display geometry or coordinateMode. See COORDINATES.md

View File

@ -9,9 +9,8 @@ import { readFileSync, unlinkSync } from 'fs'
import { tmpdir } from 'os'
import { join } from 'path'
import type {
AppInfo, AppsAPI, DisplayAPI, DisplayGeometry, InstalledApp,
PrepareDisplayResult, RunningApp, ScreenshotAPI, ScreenshotResult,
SwiftBackend, WindowDisplayInfo,
AppsAPI, DisplayAPI, DisplayGeometry, InstalledApp,
ScreenshotAPI,
} from '../types.js'
export type {
@ -37,14 +36,6 @@ function jxaSync(script: string): string {
return new TextDecoder().decode(result.stdout).trim()
}
function osascriptSync(script: string): string {
const result = Bun.spawnSync({
cmd: ['osascript', '-e', script],
stdout: 'pipe', stderr: 'pipe',
})
return new TextDecoder().decode(result.stdout).trim()
}
async function osascript(script: string): Promise<string> {
const proc = Bun.spawn(['osascript', '-e', script], {
stdout: 'pipe', stderr: 'pipe',

View File

@ -10,7 +10,7 @@
import type {
AppInfo, AppsAPI, DisplayAPI, DisplayGeometry, InstalledApp,
PrepareDisplayResult, RunningApp, ScreenshotAPI, ScreenshotResult,
SwiftBackend, WindowDisplayInfo,
WindowDisplayInfo,
} from '../types.js'
// ---------------------------------------------------------------------------

View File

@ -6,9 +6,8 @@
*/
import type {
AppInfo, AppsAPI, DisplayAPI, DisplayGeometry, InstalledApp,
PrepareDisplayResult, RunningApp, ScreenshotAPI, ScreenshotResult,
SwiftBackend, WindowDisplayInfo,
AppsAPI, DisplayAPI, DisplayGeometry,
ScreenshotAPI, ScreenshotResult,
} from '../types.js'
// CC_Pure: Linux-native build — Win32 imports stubbed (cross-package resolution unavailable)
@ -68,7 +67,7 @@ foreach ($s in [System.Windows.Forms.Screen]::AllScreens) {
$result -join "|"
`)
return raw.split('|').filter(Boolean).map(entry => {
const [w, h, id, primary] = entry.split(',')
const [w, h, id] = entry.split(',')
return {
width: Number(w),
height: Number(h),

View File

@ -1,4 +1,4 @@
import React, { PureComponent, type ReactNode } from 'react'
import { PureComponent, type ReactNode } from 'react'
// Business-layer callbacks — replaced with inline defaults so this package
// has zero dependencies on business code. The business layer can inject
// implementations via AppCallbacks when needed.

View File

@ -1,6 +1,5 @@
import codeExcerpt, { type CodeExcerpt } from 'code-excerpt'
import { readFileSync } from 'fs'
import React from 'react'
import StackUtils from 'stack-utils'
import Box from './Box.js'
import Text from './Text.js'

View File

@ -1,12 +1,10 @@
import React from 'react'
export type Props = {
/**
* Number of newlines to insert.
*
* @default 1
*/
readonly count?: number
count?: number
}
/**

View File

@ -1,4 +1,3 @@
import React from 'react'
import Box from './Box.js'
/**

View File

@ -8,7 +8,7 @@ import {
} from 'fs'
import noop from 'lodash-es/noop.js'
import throttle from 'lodash-es/throttle.js'
import React, { type ReactNode } from 'react'
import { ReactNode } from 'react'
import type { FiberRoot } from 'react-reconciler'
import { ConcurrentRoot } from 'react-reconciler/constants.js'
import { onExit } from 'signal-exit'

View File

@ -11,7 +11,6 @@ import { KeyboardEvent } from '../core/events/keyboard-event.js'
import type { Key, InputEvent } from '../core/events/input-event.js'
import type { ParsedKey } from '../core/parse-keypress.js'
import useInput from './use-input.js'
import { useTerminalSize } from '../hooks/useTerminalSize.js'
type UseSearchInputOptions = {
isActive: boolean
@ -57,12 +56,9 @@ export function useSearchInput({
onExit,
onCancel,
onExitUp,
columns,
initialQuery = '',
backspaceExitsOnEmpty = true,
}: UseSearchInputOptions): UseSearchInputReturn {
const { columns: terminalColumns } = useTerminalSize()
const _effectiveColumns = columns ?? terminalColumns
const [query, setQueryState] = useState(initialQuery)
const [cursorOffset, setCursorOffset] = useState(initialQuery.length)

View File

@ -1,5 +1,4 @@
import type {
BetaContentBlockParam,
BetaToolResultBlockParam,
BetaToolUseBlock,
} from '@anthropic-ai/sdk/resources/beta/messages/messages.mjs'

View File

@ -1,4 +1,3 @@
import { Hono } from "hono";
import { serve } from "@hono/node-server";
import { ProcessManager } from "./manager.js";
import { createApp } from "./routes.js";

View File

@ -588,11 +588,6 @@ interface ContentBlock {
name?: string;
}
interface ProxyMessage {
type: "connect" | "disconnect" | "new_session" | "prompt" | "cancel" | "set_session_model";
payload?: { cwd?: string } | { content: ContentBlock[] } | { modelId: string };
}
export async function startServer(config: ServerConfig): Promise<void> {
const { port, host, command, args, cwd, token, https } = config;

View File

@ -1,5 +1,4 @@
import { feature } from 'bun:bundle'
import * as React from 'react'
import { buildTool, type ToolDef, toolMatchesName } from 'src/Tool.js'
import type {
AssistantMessage,

View File

@ -6,7 +6,6 @@ import {
truncate as fsTruncate,
link,
} from 'fs/promises'
import * as React from 'react'
import type { CanUseToolFn } from 'src/hooks/useCanUseTool.js'
import type { AppState } from 'src/state/AppState.js'
import { z } from 'zod/v4'

View File

@ -2,9 +2,7 @@ import { z } from 'zod/v4'
import {
buildTool,
findToolByName,
type Tool,
type ToolDef,
type ToolUseContext,
type ToolResult,
type Tools,
type ValidationResult,

View File

@ -1,5 +1,3 @@
import { EXECUTE_TOOL_NAME } from './constants.js'
export const DESCRIPTION =
'ExecuteExtraTool — a first-class core tool that is always loaded and available. Execute any deferred tool by name with parameters. Use it after discovering a tool via SearchExtraTools. This is NOT a remote or external tool — it runs locally with full permissions.'

View File

@ -1,4 +1,3 @@
import React from 'react';
import { Text } from '@anthropic/ink';
import { z } from 'zod/v4';
import { TOOL_SUMMARY_MAX_LENGTH } from 'src/constants/toolLimits.js';

View File

@ -1,7 +1,6 @@
import { feature } from 'bun:bundle';
import type { ToolResultBlockParam } from '@anthropic-ai/sdk/resources/index.mjs';
import { copyFile, stat as fsStat, truncate as fsTruncate, link } from 'fs/promises';
import * as React from 'react';
import type { CanUseToolFn } from 'src/hooks/useCanUseTool.js';
import type { AppState } from 'src/state/AppState.js';
import { z } from 'zod/v4';

View File

@ -1,4 +1,3 @@
import { feature } from 'bun:bundle'
import { getFeatureValue_CACHED_WITH_REFRESH } from 'src/services/analytics/growthbook.js'
import { DEFAULT_CRON_JITTER_CONFIG } from 'src/utils/cronTasks.js'
import { isEnvTruthy } from 'src/utils/envUtils.js'

View File

@ -25,7 +25,6 @@ import {
getToolIndex,
searchTools,
} from 'src/services/searchExtraTools/toolIndex.js'
import type { SearchExtraToolsResult } from 'src/services/searchExtraTools/toolIndex.js'
const KEYWORD_WEIGHT = Number(
process.env.SEARCH_EXTRA_TOOLS_WEIGHT_KEYWORD ?? '0.4',
@ -446,17 +445,6 @@ export const SearchExtraToolsTool = buildTool({
const discoverQuery = discoverMatch[1]!.trim()
const index = await getToolIndex(deferredTools)
const tfIdfResults = searchTools(discoverQuery, index, max_results)
const textResults = tfIdfResults.map(r => {
let line = `**${r.name}** (score: ${r.score.toFixed(2)})\n${r.description}`
if (r.inputSchema) {
line += `\nSchema: ${JSON.stringify(r.inputSchema)}`
}
return line
})
const text =
textResults.length > 0
? `Found ${textResults.length} tools:\n${textResults.join('\n\n')}`
: 'No matching deferred tools found'
logSearchOutcome(
tfIdfResults.map(r => r.name),
'keyword',

View File

@ -4,8 +4,6 @@ import { CORE_TOOLS } from 'src/constants/tools.js'
export { SEARCH_EXTRA_TOOLS_TOOL_NAME } from './constants.js'
import { SEARCH_EXTRA_TOOLS_TOOL_NAME } from './constants.js'
const PROMPT_HEAD = `Search for deferred tools by name or keyword. LOW PRIORITY — only use this tool when no core tool can accomplish the task. Core tools (Read, Edit, Write, Bash, Glob, Grep, Agent, WebFetch, WebSearch, Skill) are always available and should be used directly. This tool is for discovering additional capabilities like MCP tools, cron scheduling, worktree management, agent teams (TeamCreate, TeamDelete, SendMessage), etc.
`

View File

@ -2,7 +2,6 @@ import type { PermissionResult } from 'src/utils/permissions/PermissionResult.js
import { z } from 'zod/v4'
import { buildTool, type ToolDef } from 'src/Tool.js'
import { lazySchema } from 'src/utils/lazySchema.js'
import { jsonStringify } from 'src/utils/slowOperations.js'
import { createAdapter } from './adapters/index.js'
import { getWebSearchPrompt, WEB_SEARCH_TOOL_NAME } from './prompt.js'
import {

View File

@ -194,7 +194,6 @@ export function resolveBingUrl(rawUrl: string): string | undefined {
if (uMatch) {
const encoded = uMatch[1]
if (encoded.length >= 3) {
const prefix = encoded.slice(0, 2)
const b64 = encoded.slice(2)
try {
// Base64url decode (pad as needed)

View File

@ -61,7 +61,6 @@ return "${tmpPath}"
return null
}
const file = Bun.file(tmpPath)
// Use synchronous read via Node compat
const fs = require('fs')
const buffer: Buffer = fs.readFileSync(tmpPath)

View File

@ -21,12 +21,6 @@ const USAGE =
type LocalMemoryViewProps = React.ComponentProps<typeof LocalMemoryView>;
type LocalMemoryAction = {
label: string;
description: string;
run: () => void;
};
const ACTION_LABEL_COLUMN_WIDTH = 26;
function formatStoreList(stores: string[]): string {

View File

@ -13,12 +13,6 @@ const USAGE = 'Usage: /local-vault list | set KEY VALUE | get KEY [--reveal] | d
type LocalVaultViewProps = React.ComponentProps<typeof LocalVaultView>;
type LocalVaultAction = {
label: string;
description: string;
run: () => void;
};
const ACTION_LABEL_COLUMN_WIDTH = 26;
function formatKeyList(keys: string[]): string {

View File

@ -134,6 +134,5 @@ export function getErrorGuidance(error: PluginError): string | null {
case 'generic-error':
return null;
}
const _exhaustive: never = error;
return null;
}

View File

@ -1,10 +1,8 @@
import React from 'react';
import { FpsMetricsProvider } from '../context/fpsMetrics.js';
import { StatsProvider, type StatsStore } from '../context/stats.js';
import { type AppState, AppStateProvider } from '../state/AppState.js';
import { onChangeAppState } from '../state/onChangeAppState.js';
import type { FpsMetrics } from '../utils/fpsTracker.js';
import { ThemeProvider } from '@anthropic/ink';
type Props = {
getFpsMetrics: () => FpsMetrics | undefined;

View File

@ -595,15 +595,6 @@ function OAuthStatusMessage({
[activeField, baseUrl, apiKey, haikuModel, sonnetModel, opusModel],
);
const _switchTo = useCallback(
(target: Field) => {
setOAuthStatus(buildState(activeField, inputValue, target));
setInputValue(displayValues[target] ?? '');
setInputCursorOffset((displayValues[target] ?? '').length);
},
[activeField, inputValue, displayValues, buildState, setOAuthStatus],
);
const doSave = useCallback(() => {
const finalVals = { ...displayValues, [activeField]: inputValue };
const env: Record<string, string> = {};

View File

@ -24,7 +24,6 @@ import { setEnvHookNotifier } from '../../utils/hooks/fileChangedWatcher.js';
import { toIDEDisplayName } from '../../utils/ide.js';
import { getMessagesAfterCompactBoundary } from '../../utils/messages.js';
import { tokenCountFromLastAPIResponse } from '../../utils/tokens.js';
import { AutoUpdaterWrapper } from '../AutoUpdaterWrapper.js';
import { ConfigurableShortcutHint } from '../ConfigurableShortcutHint.js';
import { IdeStatusIndicator } from '../IdeStatusIndicator.js';
import { MemoryUsageIndicator } from '../MemoryUsageIndicator.js';

View File

@ -546,7 +546,6 @@ function PromptInput({
const tasksSelected = footerItemSelected === 'tasks';
const tmuxSelected = footerItemSelected === 'tmux';
const _bagelSelected = footerItemSelected === 'bagel';
const teamsSelected = footerItemSelected === 'teams';
const bridgeSelected = footerItemSelected === 'bridge';

View File

@ -1,5 +1,4 @@
import * as React from 'react';
import { Box, Text } from '@anthropic/ink';
import { Select } from './CustomSelect/select.js';
import { PermissionDialog } from './permissions/PermissionDialog.js';

View File

@ -252,8 +252,6 @@ function SpinnerWithVerbInner({
const shimmerColor = overrideShimmerColor ?? defaultShimmerColor;
// TTFT display is gated to internal builds — apiMetricsRef was removed from
// props during a refactor, so skip this until it's re-threaded.
const _ttftText: string | null = null;
// When leader is idle but teammates are running (and we're viewing the leader),
// show a static dim idle display instead of the animated spinner — otherwise

View File

@ -12,7 +12,6 @@ import {
VERIFICATION_AGENT_TYPE,
} from '@claude-code-best/builtin-tools/tools/AgentTool/constants.js'
import { FILE_WRITE_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/FileWriteTool/prompt.js'
import { FILE_READ_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/FileReadTool/prompt.js'
import { FILE_EDIT_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/FileEditTool/constants.js'
import { TODO_WRITE_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/TodoWriteTool/constants.js'
import { TASK_CREATE_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/TaskCreateTool/constants.js'

View File

@ -70,9 +70,6 @@ const skillPrefetch = feature('EXPERIMENTAL_SKILL_SEARCH')
const searchExtraToolsPrefetch = feature('EXPERIMENTAL_SEARCH_EXTRA_TOOLS')
? (require('./services/searchExtraTools/prefetch.js') as typeof import('./services/searchExtraTools/prefetch.js'))
: null
const _jobClassifier = feature('TEMPLATES')
? (require('./jobs/classifier.js') as typeof import('./jobs/classifier.js'))
: null
/* eslint-enable @typescript-eslint/no-require-imports */
import {
enqueue,

View File

@ -20,7 +20,7 @@ import {
closeSync,
writeFileSync,
} from 'node:fs'
import { homedir, tmpdir } from 'node:os'
import { homedir } from 'node:os'
import { basename, join } from 'node:path'
import { randomBytes } from 'node:crypto'
import { validateKey } from '../../utils/localValidate.js'

View File

@ -6,7 +6,6 @@
import { writeFile } from 'fs/promises'
import memoize from 'lodash-es/memoize.js'
import { feature } from 'bun:bundle'
import { getIsRemoteMode } from '../../bootstrap/state.js'
import { getSystemPrompt } from '../../constants/prompts.js'
import { getSystemContext, getUserContext } from '../../context.js'

View File

@ -44,7 +44,6 @@ import type { Message } from '../../types/message.js'
import { deserializeMessages } from '../../utils/conversationRecovery.js'
import {
getLastSessionLog,
sessionIdExists,
} from '../../utils/sessionStorage.js'
import { QueryEngine } from '../../QueryEngine.js'
import type { QueryEngineConfig } from '../../QueryEngine.js'

View File

@ -154,7 +154,6 @@ import {
import { getAgentContext } from 'src/utils/agentContext.js'
import { isClaudeAISubscriber } from 'src/utils/auth.js'
import {
getToolSearchBetaHeader,
modelSupportsStructuredOutputs,
shouldIncludeFirstPartyOnlyBetas,
shouldUseGlobalCacheScope,
@ -192,7 +191,6 @@ import {
isDeferredTool,
SEARCH_EXTRA_TOOLS_TOOL_NAME,
} from '@claude-code-best/builtin-tools/tools/SearchExtraToolsTool/prompt.js'
import { count } from '../../utils/array.js'
import { insertBlockAfterToolResults } from '../../utils/contentArray.js'
import { validateBoundedIntEnvVar } from '../../utils/envValidation.js'
import { safeParseJSON } from '../../utils/json.js'

View File

@ -79,8 +79,6 @@ import { getProjectRoot } from '../bootstrap/state.js'
import { formatCommandsWithinBudget } from '@claude-code-best/builtin-tools/tools/SkillTool/prompt.js'
import { getContextWindowForModel } from './context.js'
import type { DiscoverySignal } from '../services/skillSearch/signals.js'
import * as skillSearchFeatureCheck from '../services/skillSearch/featureCheck.js'
import * as skillSearchPrefetch from '../services/skillSearch/prefetch.js'
import { BRIEF_TOOL_NAME as BRIEF_TOOL_NAME_VALUE } from '@claude-code-best/builtin-tools/tools/BriefTool/prompt.js'
import * as autoModeStateModuleValue from './permissions/autoModeState.js'
import { feature } from 'bun:bundle'