fix(tsc): Phase 2 — eliminate all Cannot find name errors (204→175)

- Fix 19 Cannot find name + 1 no exported member
- Variable name typos: filePath→_filePath, PermissionMode→PermissionName, etc.
- Missing imports: feature, readFileSync, ALL_MODEL_CONFIGS, etc.
- Stub definitions: suppressNextDiscovery, WORKFLOW_TOOL_NAME_VALUE
- 0 remaining Cannot find module/name/export errors
This commit is contained in:
James Feng 2026-06-07 10:49:56 +08:00
parent 315b0bd80e
commit a648196c3c
17 changed files with 25 additions and 12 deletions

View File

@ -11,6 +11,7 @@ import {
logEvent,
logEventAsync,
} from '../services/analytics/index.js'
import { isInBundledMode } from '../utils/bundledMode.js'
import { logForDebugging } from '../utils/debug.js'
import { rcLog } from './rcDebugLog.js'
import { logForDiagnosticsNoPII } from '../utils/diagLogs.js'

View File

@ -747,7 +747,7 @@ export async function runHeadless(
const result = await handleRewindFiles(
options.rewindFiles as UUID,
currentAppState,
_setAppState,
setAppState,
false,
)
if (!result.canRewind) {

View File

@ -1,3 +1,4 @@
import { feature } from 'bun:bundle'
import * as React from 'react'
import { resetCostState } from '../../bootstrap/state.js'
import {

View File

@ -1,3 +1,4 @@
import { readFileSync } from 'fs';
import { REMOTE_CONTROL_DISCONNECTED_MSG } from '../bridge/types.js';
import type { Command } from '../commands.js';
import { DIAMOND_OPEN } from '../constants/figures.js';
@ -20,6 +21,7 @@ import { logForDebugging } from '../utils/debug.js';
import { errorMessage } from '../utils/errors.js';
import { logError } from '../utils/log.js';
import { enqueuePendingNotification } from '../utils/messageQueueManager.js';
import { ALL_MODEL_CONFIGS } from '../utils/model/configs.js';
import { updateTaskState } from '../utils/task/framework.js';
import { archiveRemoteSession, teleportToRemote } from '../utils/teleport.js';
import { pollForApprovedExitPlanMode, UltraplanPollError } from '../utils/ultraplan/ccrSession.js';

View File

@ -76,7 +76,7 @@ export function FileEditToolUpdatedMessage({
hunks={structuredPatch}
dim={false}
width={columns - 12}
filePath={filePath}
filePath={_filePath}
firstLine={firstLine}
fileContent={fileContent}
/>

View File

@ -123,7 +123,7 @@ export function Onboarding({ onDone }: Props): React.ReactNode {
</Box>
)
const _preflightStep = <PreflightStep onSuccess={goToNextStep} /> // Create the steps array - determine which steps to include based on reAuth and oauthEnabled
const preflightStep = <PreflightStep onSuccess={goToNextStep} /> // Create the steps array - determine which steps to include based on reAuth and oauthEnabled
const apiKeyNeedingApproval = useMemo(() => {
// Add API key step if needed
// On homespace, ANTHROPIC_API_KEY is preserved in process.env for child

View File

@ -457,7 +457,7 @@ function PromptInput({
const [showFastModePicker, setShowFastModePicker] = useState(false);
const [showThinkingToggle, setShowThinkingToggle] = useState(false);
const [showAutoModeOptIn, setShowAutoModeOptIn] = useState(false);
const [previousModeBeforeAuto, setPreviousModeBeforeAuto] = useState<PermissionMode | null>(null);
const [previousModeBeforeAuto, setPreviousModeBeforeAuto] = useState<PermissionName | null>(null);
const autoModeOptInTimeoutRef = useRef<NodeJS.Timeout | null>(null);
// Check if cursor is on the first line of input

View File

@ -323,7 +323,7 @@ export function useReplBridge(
};
});
// Notify model about newly available bridge-dependent tools
if (!wasSessionActive) {
if (!replBridgeSessionActive) {
setMessages(prev => [
...prev,
createSystemMessage(

View File

@ -19,7 +19,7 @@ import { isSynchronizedOutputSupported } from '@anthropic/ink';
import type { RenderOptions, Root, TextProps } from '@anthropic/ink';
import { KeybindingSetup } from './keybindings/KeybindingProviderSetup.js';
import { startDeferredPrefetches } from './main.js';
import { initializeGrowthBook, resetGrowthBook } from './services/analytics/growthbook.js';
import { initializeGrowthBook, resetGrowthBook, checkGate_CACHED_OR_BLOCKING } from './services/analytics/growthbook.js';
import { isQualifiedForGrove } from './services/api/grove.js';
import { handleMcpjsonServerApprovals } from './services/mcpServerApproval.js';
import { AppStateProvider } from './state/AppState.js';

View File

@ -3192,7 +3192,7 @@ export function REPL({
// processTextPrompt) — both pushed length past 1 on turn one, so the
// title silently fell through to the "Claude Code" default.
if (!titleDisabled && !sessionTitle && !agentTitle && !haikuTitleAttemptedRef.current) {
const firstUserMessage = newMessages.find(m => m.type === 'user' && !m.isMeta);
const firstUserMessage = _newMessages.find(m => m.type === 'user' && !m.isMeta);
const text =
firstUserMessage?.type === 'user'
? getContentText(firstUserMessage.message!.content as string | ContentBlockParam[])
@ -3257,7 +3257,7 @@ export function REPL({
// Manual /compact sets messages directly (shouldQuery=false) bypassing
// handleMessageFromStream. Clear context-blocked if a compact boundary
// is present so proactive ticks resume after compaction.
if (newMessages.some(isCompactBoundaryMessage)) {
if (_newMessages.some(isCompactBoundaryMessage)) {
// Bump conversationId so Messages.tsx row keys change and
// stale memoized rows remount with post-compact content.
setConversationId(randomUUID());
@ -3272,7 +3272,7 @@ export function REPL({
const toolUseContext = getToolUseContext(
messagesIncludingNewMessages,
newMessages,
_newMessages,
abortController,
mainLoopModelParam,
);

View File

@ -1240,7 +1240,7 @@ async function* queryModel(
const useGlobalCacheFeature = shouldUseGlobalCacheScope()
const willDefer = (t: Tool) =>
useToolSearch && (deferredToolNames.has(t.name) || shouldDeferLspTool(t))
useSearchExtraTools && (deferredToolNames.has(t.name) || shouldDeferLspTool(t))
// MCP tools are per-user → dynamic tool section → can't globally cache.
// Only gate when an MCP tool will actually render (not defer_loading).
const needsToolBasedCacheMarker =
@ -1646,7 +1646,6 @@ async function* queryModel(
getAPIProvider() === 'bedrock'
? [
...getBedrockExtraBodyParamsBetas(retryContext.model),
...(toolSearchHeader ? [toolSearchHeader] : []),
]
: []
const extraBodyParams = getExtraBodyParams(bedrockBetas)

View File

@ -75,7 +75,7 @@ export function registerToolMessage(
groupIds: string[],
): void {
for (const id of groupIds) {
registerToolResult(state, id)
registerToolResult(_state, id)
}
}

View File

@ -12,6 +12,10 @@ export function getStats(): CollapseStats {
}
}
export function isContextCollapseEnabled(): boolean {
return false
}
export function subscribe(callback: () => void): () => void {
return () => {}
}

View File

@ -27,9 +27,11 @@ import {
import { lazySchema } from '../../utils/lazySchema.js'
import { parsePluginIdentifier } from '../../utils/plugins/pluginIdentifier.js'
import { escapeXmlAttr } from '../../utils/xml.js'
import { getSettingsForSource } from '../../utils/settings/settings.js'
import {
type ChannelAllowlistEntry,
getChannelAllowlist,
isChannelsEnabled,
} from './channelAllowlist.js'
export const ChannelMessageNotificationSchema = lazySchema(() =>

View File

@ -6,6 +6,7 @@
* to avoid circular dependencies.
*/
import { feature } from 'bun:bundle'
import type { ContentBlockParam } from '@anthropic-ai/sdk/resources/messages.mjs'
// ============================================================================

View File

@ -37,6 +37,7 @@ import {
} from './tasks.js'
import { getPlanFilePath, getPlan } from './plans.js'
import { getConnectedIdeName } from './ide.js'
import { getSettings_DEPRECATED } from './settings/settings.js'
import {
getManagedAndUserConditionalRules,
getMemoryFilesForNestedDirectory,
@ -771,6 +772,7 @@ export async function getAttachments(
const context = { ...toolUseContext, abortController }
const isMainThread = !toolUseContext.agentId
let suppressNextDiscovery = false
// Attachments which are added in response to on user input
const userInputAttachments = input

View File

@ -19,6 +19,7 @@ import { TEAM_CREATE_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/Tea
import { TEAM_DELETE_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/TeamDeleteTool/constants.js'
import { TODO_WRITE_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/TodoWriteTool/constants.js'
import { SEARCH_EXTRA_TOOLS_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/SearchExtraToolsTool/prompt.js'
import { WORKFLOW_TOOL_NAME as WORKFLOW_TOOL_NAME_VALUE } from '@claude-code-best/builtin-tools/tools/WorkflowTool/constants.js'
import { YOLO_CLASSIFIER_TOOL_NAME } from './yoloClassifier.js'
// Ant-only tool names: conditional require so Bun can DCE these in external builds.