mirror of
https://github.com/NanmiCoder/claude-code-haha.git
synced 2026-10-10 03:43:11 +08:00
chore: drop 27 imports nothing references in src and adapters
Found by widening scripts/pr/dead-imports.ts past src/server/ws once its lexer stopped desyncing. None of these bindings appear anywhere in their own file; several are the tail of a move that left the import behind, and useMergedTools still lists replBridgeEnabled in a dependency array after the useAppState call that set it was stubbed out. Nine statements lost their last binding. Each target was checked for a top-level side effect first: node:fs, node:fs/promises and bun:bundle have none, ws/events.js is a type-only import that never emits, AppState.tsx, model/model.ts and markdown-style.ts declare only, and utils/config.ts does register a cleanup but is imported by 157 other files in src, so attachments.ts dropping it cannot unregister anything. No behavior change intended and none observed: src is 2995 pass / 37 skip / 30 fail across 273 files before and after, with the 30 failures identical test for test, and adapters is 437 pass / 0 fail both times. The 30 are pre-existing and unrelated.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect, beforeEach } from 'bun:test'
|
||||
import { describe, it, expect } from 'bun:test'
|
||||
import { MessageBuffer } from '../message-buffer.js'
|
||||
|
||||
describe('MessageBuffer', () => {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* - 纯 patch fallback 路径
|
||||
*/
|
||||
|
||||
import { describe, it, expect, beforeEach } from 'bun:test'
|
||||
import { describe, it, expect } from 'bun:test'
|
||||
import {
|
||||
StreamingCard,
|
||||
buildInitialStreamingCard,
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
import * as Lark from '@larksuiteoapi/node-sdk'
|
||||
import * as path from 'node:path'
|
||||
import * as fs from 'node:fs/promises'
|
||||
import { WsBridge, type ServerMessage, type AttachmentRef } from '../common/ws-bridge.js'
|
||||
import { MessageDedup } from '../common/message-dedup.js'
|
||||
import { StreamingCard } from './streaming-card.js'
|
||||
@@ -19,7 +18,6 @@ import {
|
||||
formatImHelp,
|
||||
formatImStatus,
|
||||
formatPermissionRequest,
|
||||
splitMessage,
|
||||
} from '../common/format.js'
|
||||
import {
|
||||
formatPermissionDecisionStatus,
|
||||
@@ -31,7 +29,6 @@ import { SessionStore } from '../common/session-store.js'
|
||||
import { AdapterHttpClient, type RecentProject } from '../common/http-client.js'
|
||||
import { restoreStoredSessionBinding } from '../common/session-recovery.js'
|
||||
import { isAllowedUser, tryPair } from '../common/pairing.js'
|
||||
import { optimizeMarkdownForFeishu } from './markdown-style.js'
|
||||
import { extractInboundPayload } from './extract-payload.js'
|
||||
import { FeishuMediaService } from './media.js'
|
||||
import { AttachmentStore } from '../common/attachment/attachment-store.js'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect } from 'bun:test'
|
||||
import { splitMessage, formatPermissionRequest, truncateInput, escapeMarkdownV2 } from '../../common/format.js'
|
||||
import { splitMessage, formatPermissionRequest, escapeMarkdownV2 } from '../../common/format.js'
|
||||
import { parsePermitCallbackData } from '../../common/permission.js'
|
||||
import {
|
||||
buildTelegramThinkingUpdate,
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
* then run: bun run whatsapp
|
||||
*/
|
||||
|
||||
import * as fs from 'node:fs/promises'
|
||||
import * as path from 'node:path'
|
||||
import {
|
||||
normalizeMessageContent,
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import { useMemo } from 'react'
|
||||
import type { Tools, ToolPermissionContext } from '../Tool.js'
|
||||
import { assembleToolPool } from '../tools.js'
|
||||
import { useAppState } from '../state/AppState.js'
|
||||
import { mergeAndFilterTools } from '../utils/toolPool.js'
|
||||
|
||||
/**
|
||||
|
||||
@@ -107,7 +107,6 @@ import type { Terminal, Continue } from './query/transitions.js'
|
||||
import { feature } from 'bun:bundle'
|
||||
import {
|
||||
getCurrentTurnTokenBudget,
|
||||
getSessionId,
|
||||
getTurnOutputTokens,
|
||||
incrementBudgetContinuationCount,
|
||||
} from './bootstrap/state.js'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Tests for CronScheduler — cron matching, task execution, log storage, and API endpoints
|
||||
*/
|
||||
|
||||
import { describe, it, expect, beforeEach, afterEach, mock, spyOn } from 'bun:test'
|
||||
import { describe, it, expect, beforeEach, afterEach } from 'bun:test'
|
||||
import { Database } from 'bun:sqlite'
|
||||
import * as fs from 'fs/promises'
|
||||
import * as path from 'path'
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
CronScheduler,
|
||||
type TaskRun,
|
||||
} from '../services/cronScheduler.js'
|
||||
import { CronService, type CronTask } from '../services/cronService.js'
|
||||
import { CronService } from '../services/cronService.js'
|
||||
import { resetScheduledRunReadModelForTests } from '../services/localIndex/scheduledRunReadModel.js'
|
||||
|
||||
// ─── Test helpers ───────────────────────────────────────────────────────────
|
||||
|
||||
@@ -4,10 +4,8 @@
|
||||
|
||||
import { describe, it, expect, beforeEach, afterEach, mock } from 'bun:test'
|
||||
import * as fs from 'node:fs/promises'
|
||||
import * as fsSyn from 'node:fs'
|
||||
import * as path from 'node:path'
|
||||
import * as os from 'node:os'
|
||||
import type { TeamMemberStatus } from '../ws/events.js'
|
||||
|
||||
// ============================================================================
|
||||
// Test helpers
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
symlinkSync,
|
||||
writeFileSync,
|
||||
} from 'node:fs'
|
||||
import { tmpdir, homedir } from 'node:os'
|
||||
import { homedir } from 'node:os'
|
||||
import * as path from 'node:path'
|
||||
import { handleLocalFile, reconstructAbsolutePath } from '../localFile'
|
||||
import { isAllowedFilesystemPath } from '../filesystem'
|
||||
|
||||
@@ -12,7 +12,6 @@ import {
|
||||
addMcpConfig,
|
||||
findProjectMcpConfigPath,
|
||||
getAllMcpConfigs,
|
||||
getClaudeCodeMcpConfigs,
|
||||
getMcpConfigByName,
|
||||
isMcpServerDisabled,
|
||||
projectDirDeclaresMcpServers,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { watch, type FSWatcher } from 'node:fs'
|
||||
import { readdir, stat } from 'node:fs/promises'
|
||||
import { basename, dirname, join, relative, resolve, sep } from 'node:path'
|
||||
import { dirname, join, relative, resolve, sep } from 'node:path'
|
||||
|
||||
export type ReconciliationBatch = {
|
||||
paths: string[]
|
||||
|
||||
@@ -24,7 +24,6 @@ import {
|
||||
reduceTranscriptWithLocators,
|
||||
} from './transcriptReducer.js'
|
||||
import type {
|
||||
SessionListSummary,
|
||||
TranscriptChunk,
|
||||
TranscriptEntryLocator,
|
||||
TranscriptProjection,
|
||||
|
||||
@@ -16,7 +16,7 @@ import { anthropicToOpenaiChat } from '../proxy/transform/anthropicToOpenaiChat.
|
||||
import { anthropicToOpenaiResponses } from '../proxy/transform/anthropicToOpenaiResponses.js'
|
||||
import { openaiChatToAnthropic } from '../proxy/transform/openaiChatToAnthropic.js'
|
||||
import { openaiResponsesToAnthropic } from '../proxy/transform/openaiResponsesToAnthropic.js'
|
||||
import type { AnthropicRequest, AnthropicResponse } from '../proxy/transform/types.js'
|
||||
import type { AnthropicRequest } from '../proxy/transform/types.js'
|
||||
import {
|
||||
OPENAI_OFFICIAL_PROVIDER,
|
||||
isOpenAIOfficialProviderId,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { feature } from 'bun:bundle'
|
||||
import { chmod, open, rename, stat, unlink } from 'fs/promises'
|
||||
import mapValues from 'lodash-es/mapValues.js'
|
||||
import memoize from 'lodash-es/memoize.js'
|
||||
|
||||
@@ -37,9 +37,7 @@ import {
|
||||
import { getPlanFilePath, getPlan } from './plans.js'
|
||||
import { getConnectedIdeName } from './ide.js'
|
||||
import {
|
||||
filterInjectedMemoryFiles,
|
||||
getManagedAndUserConditionalRules,
|
||||
getMemoryFiles,
|
||||
getMemoryFilesForNestedDirectory,
|
||||
getConditionalRulesForCwdLevelDirectory,
|
||||
type MemoryFileInfo,
|
||||
@@ -72,12 +70,6 @@ import type {
|
||||
} from '@anthropic-ai/sdk/resources/messages.mjs'
|
||||
import { maybeResizeAndDownsampleImageBlock } from './imageResizer.js'
|
||||
import type { PastedContent } from './config.js'
|
||||
import { getGlobalConfig } from './config.js'
|
||||
import {
|
||||
getDefaultSonnetModel,
|
||||
getDefaultHaikuModel,
|
||||
getDefaultOpusModel,
|
||||
} from './model/model.js'
|
||||
import type { ReadResourceResult } from '@modelcontextprotocol/sdk/types.js'
|
||||
import { getSkillToolCommands, getMcpSkillCommands } from '../commands.js'
|
||||
import type { Command } from '../types/command.js'
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { feature } from 'bun:bundle'
|
||||
import { open } from 'fs/promises'
|
||||
import { basename, dirname, join, sep } from 'path'
|
||||
import { basename, join, sep } from 'path'
|
||||
import type { ModelUsage } from 'src/entrypoints/agentSdkTypes.js'
|
||||
import type { Entry, TranscriptMessage } from '../types/logs.js'
|
||||
import { logForDebugging } from './debug.js'
|
||||
|
||||
Reference in New Issue
Block a user