Skip to content

Commit d593fec

Browse files
Fix ESLint import ordering and remove unused code
- Cleaned up CLI imports to match our ESLint ordering and dropped stray unused symbols (cli/src/chat.tsx:1, cli/src/utils/theme- system.ts:1, cli/src/hooks/use-system-theme-detector.ts:1). - Removed unused locals from the chat message renderer and send- message flow so lint no longer complains about dead code (cli/ src/components/message-block.tsx:181, cli/src/hooks/use-send- message.ts:58). - Updated tooling imports at the bottom of chat.tsx so type-only dependencies sit in the dedicated group ESLint expects (cli/ src/chat.tsx:31). 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
1 parent dfbbc84 commit d593fec

File tree

5 files changed

+9
-17
lines changed

5 files changed

+9
-17
lines changed

cli/src/chat.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
33

44
import { MultilineInput } from './components/multiline-input'
55
import { Separator } from './components/separator'
6+
import { StatusIndicator, useHasStatus } from './components/status-indicator'
67
import {
78
SuggestionMenu,
89
type SuggestionItem,
910
} from './components/suggestion-menu'
10-
import { StatusIndicator, useHasStatus } from './components/status-indicator'
11+
import { SLASH_COMMANDS, type SlashCommand } from './data/slash-commands'
1112
import { useClipboard } from './hooks/use-clipboard'
1213
import { useInputHistory } from './hooks/use-input-history'
1314
import { useKeyboardHandlers } from './hooks/use-keyboard-handlers'
@@ -16,18 +17,15 @@ import { useMessageRenderer } from './hooks/use-message-renderer'
1617
import { useChatScrollbox } from './hooks/use-scroll-management'
1718
import { useSendMessage } from './hooks/use-send-message'
1819
import { useSystemThemeDetector } from './hooks/use-system-theme-detector'
20+
import { createChatScrollAcceleration } from './utils/chat-scroll-accel'
1921
import { formatTimestamp, formatQueuedPreview } from './utils/helpers'
20-
import { logger } from './utils/logger'
21-
import { buildMessageTree } from './utils/message-tree-utils'
22-
import { SLASH_COMMANDS, type SlashCommand } from './data/slash-commands'
2322
import {
2423
loadLocalAgents,
2524
type LocalAgentInfo,
2625
} from './utils/local-agent-registry'
27-
26+
import { logger } from './utils/logger'
27+
import { buildMessageTree } from './utils/message-tree-utils'
2828
import { chatThemes, createMarkdownPalette } from './utils/theme-system'
29-
import { createChatScrollAcceleration } from './utils/chat-scroll-accel'
30-
import { TextAttributes } from '@opentui/core'
3129

3230
import type { ToolName } from '@codebuff/sdk'
3331
import type { InputRenderable, ScrollBoxRenderable } from '@opentui/core'

cli/src/components/message-block.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ export const MessageBlock = ({
123123
.split('\n')
124124
.filter((line) => line.trim())
125125
const firstLine = lines[0] || ''
126-
const lastLine = lines[lines.length - 1] || firstLine
127-
128126
const streamingPreview = isStreaming
129127
? firstLine.replace(/[#*_`~\[\]()]/g, '').trim() + '...'
130128
: ''
@@ -197,7 +195,6 @@ export const MessageBlock = ({
197195
.split('\n')
198196
.filter((line) => line.trim())
199197
const firstLine = lines[0] || ''
200-
const lastLine = lines[lines.length - 1] || firstLine
201198

202199
const streamingPreview = isStreaming
203200
? firstLine.replace(/[#*_`~\[\]()]/g, '').trim() + '...'

cli/src/hooks/use-send-message.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,9 @@ export const useSendMessage = ({
5555
const spawnAgentsMapRef = useRef<
5656
Map<string, { index: number; agentType: string }>
5757
>(new Map())
58-
const toolCallToAgentIdsRef = useRef<Map<string, string[]>>(new Map())
5958
const subagentBuffersRef = useRef<
6059
Map<string, { buffer: string; insideToolCall: boolean }>
6160
>(new Map())
62-
const subagentToolCallsRef = useRef<
63-
Map<string, { agentId: string; tempToolCallId: string }>
64-
>(new Map())
6561

6662
const sendMessage = useCallback(
6763
async (content: string) => {
@@ -754,7 +750,7 @@ export const useSendMessage = ({
754750
setMessages((prev) =>
755751
prev.map((msg) => {
756752
if (msg.id === aiMessageId && msg.blocks) {
757-
const blocks = msg.blocks.map((block, blockIndex) => {
753+
const blocks = msg.blocks.map((block) => {
758754
if (
759755
block.type === 'agent' &&
760756
block.agentId.startsWith(toolCallId)

cli/src/hooks/use-system-theme-detector.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { useEffect, useRef, useState } from 'react'
2-
import { type ThemeName, detectSystemTheme } from '../utils/theme-system'
2+
33
import { logger } from '../utils/logger'
44
import {
55
spawnMacOSThemeListener,
66
type ThemeListenerProcess,
77
} from '../utils/theme-listener-macos'
8+
import { type ThemeName, detectSystemTheme } from '../utils/theme-system'
89

910
const DEFAULT_POLL_INTERVAL_MS = 60000 // 60 seconds
1011

cli/src/utils/theme-system.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { existsSync, readFileSync, readdirSync, statSync } from 'fs'
2-
import { join } from 'path'
32
import { homedir } from 'os'
3+
import { join } from 'path'
44

55
import type { MarkdownPalette } from './markdown-renderer'
66

0 commit comments

Comments
 (0)