fix: clarify declarations and redundant comparisons (#2441)

This commit is contained in:
JATMN
2026-10-27 06:51:49 -07:00
committed by GitHub
parent a883d57f82
commit 51f50e99b0
9 changed files with 7 additions and 16 deletions
+1 -1
View File
@@ -5385,7 +5385,7 @@ async function loadInitialMessages(
return { messages: [] }
}
result.messages = index >= 0 ? result.messages.slice(0, index + 1) : []
result.messages = result.messages.slice(0, index + 1)
}
// Match coordinator mode to the resumed session's mode
-3
View File
@@ -111,9 +111,6 @@ export function useTerminalNotification(): TerminalNotification {
),
)
break
case null:
// Handled by the if guard above
break
}
},
[writeRaw],
+1 -1
View File
@@ -1,3 +1,4 @@
import { feature } from 'bun:bundle'
// biome-ignore-all assist/source/organizeImports: internal-only import markers must not be reordered
import type {
ToolResultBlockParam,
@@ -144,7 +145,6 @@ import {
} from './utils/config.js'
import { productionDeps, type QueryDeps } from './query/deps.js'
import type { Terminal, Continue } from './query/transitions.js'
import { feature } from 'bun:bundle'
import {
getCurrentTurnTokenBudget,
getTurnOutputTokens,
+1 -1
View File
@@ -1,3 +1,4 @@
import { feature } from 'bun:bundle'
import type {
BetaContentBlock,
BetaContentBlockParam,
@@ -120,7 +121,6 @@ const autoModeStateModule = feature('TRANSCRIPT_CLASSIFIER')
? (require('../../utils/permissions/autoModeState.js') as typeof import('../../utils/permissions/autoModeState.js'))
: null
import { feature } from 'bun:bundle'
import type { ClientOptions } from '@anthropic-ai/sdk'
import {
APIError,
+1 -1
View File
@@ -1,3 +1,4 @@
import { feature } from 'bun:bundle'
// biome-ignore-all assist/source/organizeImports: internal-only import markers must not be reordered
import { toolMatchesName, type Tool, type Tools } from './Tool.js'
import { AgentTool } from './tools/AgentTool/AgentTool.js'
@@ -91,7 +92,6 @@ export {
ASYNC_AGENT_ALLOWED_TOOLS,
COORDINATOR_MODE_ALLOWED_TOOLS,
} from './constants/tools.js'
import { feature } from 'bun:bundle'
// Dead code elimination: conditional import for OVERFLOW_TEST_TOOL
/* eslint-disable custom-rules/no-process-env-top-level, @typescript-eslint/no-require-imports */
const OverflowTestTool = feature('OVERFLOW_TEST_TOOL')
+1 -1
View File
@@ -1,3 +1,4 @@
import { feature } from 'bun:bundle'
// biome-ignore-all assist/source/organizeImports: internal-only import markers must not be reordered
import {
logEvent,
@@ -209,7 +210,6 @@ import {
} from './messages.js'
import { isHumanTurn } from './messagePredicates.js'
import { isEnvTruthy, getClaudeConfigHomeDir } from './envUtils.js'
import { feature } from 'bun:bundle'
/* eslint-disable @typescript-eslint/no-require-imports */
const BRIEF_TOOL_NAME: string | null =
feature('KAIROS') || feature('KAIROS_BRIEF')
+2 -2
View File
@@ -65,7 +65,7 @@ export async function parseCommand(
if (feature('TREE_SITTER_BASH')) {
await ensureParserInitialized()
const mod = getParserModule()
logLoadOnce(mod !== null)
logLoadOnce(Boolean(mod))
if (!mod) return null
try {
@@ -108,7 +108,7 @@ export async function parseCommandRaw(
if (feature('TREE_SITTER_BASH') || feature('TREE_SITTER_BASH_SHADOW')) {
await ensureParserInitialized()
const mod = getParserModule()
logLoadOnce(mod !== null)
logLoadOnce(Boolean(mod))
if (!mod) return null
try {
const result = mod.parse(command)
-1
View File
@@ -513,7 +513,6 @@ function safeJsonValue(value: unknown, seen = new WeakSet<object>()): unknown {
if (typeof value === 'bigint') return `${value}n`
if (typeof value === 'symbol') return value.toString()
if (typeof value === 'function') return '[Function]'
if (typeof value === 'undefined') return null
if (value instanceof Date) {
return Number.isNaN(value.getTime()) ? null : value.toISOString()
-5
View File
@@ -46,11 +46,6 @@ export function truncatePathMiddle(path: string | undefined, maxLength: number):
// Result format: directory + "…" + filename
const availableForDir = maxLength - 1 - filenameWidth // -1 for ellipsis
if (availableForDir <= 0) {
// No room for directory, just show filename (truncated if needed)
return truncateStartToWidth(filename, maxLength)
}
// Truncate directory and combine
const truncatedDir = truncateToWidthNoEllipsis(directory, availableForDir)
return truncatedDir + '…' + filename