diff --git a/.DS_Store b/.DS_Store index d66d8d339..606a28c2c 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/apps/cli/biome.json b/apps/cli/biome.json index 0fae93d4d..d0e15f5d1 100644 --- a/apps/cli/biome.json +++ b/apps/cli/biome.json @@ -3,5 +3,12 @@ "extends": ["../../biome2.json"], "files": { "includes": ["src/**/*", "scripts/**/*"] + }, + "linter": { + "rules": { + "suspicious": { + "noConsole": "off" + } + } } } diff --git a/apps/cli/src/commands/deploy/schemas.ts b/apps/cli/src/commands/deploy/schemas.ts index 5f629f697..fa2349831 100644 --- a/apps/cli/src/commands/deploy/schemas.ts +++ b/apps/cli/src/commands/deploy/schemas.ts @@ -35,7 +35,6 @@ import { z } from 'zod'; // Get DocDeployResultSchema from deploy namespace const DocDeployResultSchema = deploy.DocDeployResultSchema; -type DocDeployResult = deploy.DocDeployResult; // Re-export all the shared schemas from server-shared export { diff --git a/apps/cli/src/commands/main/main.test.tsx b/apps/cli/src/commands/main/main.test.tsx index 520c900f8..c5c266b0f 100644 --- a/apps/cli/src/commands/main/main.test.tsx +++ b/apps/cli/src/commands/main/main.test.tsx @@ -8,7 +8,7 @@ vi.mock('bun', () => ({ public pattern: string, public options: any ) {} - async *scan() { + async scan() { // Return empty for tests return []; } diff --git a/apps/cli/src/commands/main/main.tsx b/apps/cli/src/commands/main/main.tsx index bbe4a6915..bdb9dd7a9 100644 --- a/apps/cli/src/commands/main/main.tsx +++ b/apps/cli/src/commands/main/main.tsx @@ -28,7 +28,7 @@ type AppMode = 'Planning' | 'Auto-accept' | 'None'; export function Main() { const { exit } = useApp(); const [input, setInput] = useState(''); - const [history, setHistory] = useState([]); + const [_history, setHistory] = useState([]); const [messages, setMessages] = useState([]); const historyCounter = useRef(0); const messageCounter = useRef(0); @@ -45,6 +45,7 @@ export function Main() { const abortControllerRef = useRef(null); // Callback to update messages from agent stream + // biome-ignore lint/suspicious/noExplicitAny: We need to fix this to actually make it typesafe const handleMessageUpdate = useCallback((modelMessages: any[]) => { const transformedMessages = transformModelMessagesToUI(modelMessages); @@ -125,6 +126,7 @@ export function Main() { role: 'user', content: trimmed, }; + // biome-ignore lint/suspicious/noExplicitAny: We need to fix this to actually make it typesafe const updatedModelMessages = [...existingModelMessages, userMessage] as any; // Update UI state immediately diff --git a/apps/cli/src/components/chat-layout.tsx b/apps/cli/src/components/chat-layout.tsx index 386c96fea..764850d07 100644 --- a/apps/cli/src/components/chat-layout.tsx +++ b/apps/cli/src/components/chat-layout.tsx @@ -127,7 +127,7 @@ export function ChatInput({ // Slash command state const [slashQuery, setSlashQuery] = useState(null); - const [slashStart, setSlashStart] = useState(-1); + const [_slashStart, setSlashStart] = useState(-1); const [commandResults, setCommandResults] = useState([]); const [showCommandAutocomplete, setShowCommandAutocomplete] = useState(false); const [selectedCommandIndex, setSelectedCommandIndex] = useState(0); diff --git a/apps/cli/src/components/edit-message.tsx b/apps/cli/src/components/edit-message.tsx index 7d5143345..029541184 100644 --- a/apps/cli/src/components/edit-message.tsx +++ b/apps/cli/src/components/edit-message.tsx @@ -65,7 +65,7 @@ function parseDiff(diff: string): { lines: ParsedDiffLine[]; additions: number; */ export function EditMessage({ message }: EditMessageProps) { const isExpanded = useExpansion(); - const { args, result } = message; + const { result } = message; if (!result) { return null; @@ -128,6 +128,7 @@ export function EditMessage({ message }: EditMessageProps) { return ( `${m.path}:${m.lineNum}: ${m.lineText}`).join('\n'); + output = result.matches.map((m) => `${m.path}:${m.lineNum}: ${m.lineText}`).join('\n'); success = result.totalMatches > 0; } } else if (message.kind === 'ls') { diff --git a/apps/cli/src/components/history-browser.tsx b/apps/cli/src/components/history-browser.tsx index b4cf9035f..3eb6fc210 100644 --- a/apps/cli/src/components/history-browser.tsx +++ b/apps/cli/src/components/history-browser.tsx @@ -40,7 +40,6 @@ function getRelativeTime(dateString: string): string { } export function HistoryBrowser({ workingDirectory, onSelect, onCancel }: HistoryBrowserProps) { - const { exit } = useApp(); const [conversations, setConversations] = useState([]); const [selectedIndex, setSelectedIndex] = useState(0); const [loading, setLoading] = useState(true); @@ -59,7 +58,7 @@ export function HistoryBrowser({ workingDirectory, onSelect, onCancel }: History let title = 'Untitled conversation'; if (fullConvo?.modelMessages) { const firstUserMsg = fullConvo.modelMessages.find( - (msg: any) => msg.message.kind === 'user' + (msg) => msg.message.kind === 'user' ); if (firstUserMsg && firstUserMsg.message.kind === 'user') { // Truncate to first line and max 60 chars diff --git a/apps/cli/src/components/multi-line-text-input.tsx b/apps/cli/src/components/multi-line-text-input.tsx index 47f4e79a9..312c8754c 100644 --- a/apps/cli/src/components/multi-line-text-input.tsx +++ b/apps/cli/src/components/multi-line-text-input.tsx @@ -168,6 +168,7 @@ export function MultiLineTextInput({ if (action.preventDefault) { // Apply the action if (action.type === 'mode-change' && action.mode) { + // biome-ignore lint/style/noNonNullAssertion: Dallin can confirm if this is safe setVimState((prev) => ({ ...prev, mode: action.mode! })); if (action.mode === 'visual') { setVimState((prev) => ({ ...prev, visualStart: cursorPosition })); @@ -180,9 +181,11 @@ export function MultiLineTextInput({ onChange(action.text); } if (action.yankedText !== undefined) { + // biome-ignore lint/style/noNonNullAssertion: Dallin can confirm if this is safe setVimState((prev) => ({ ...prev, yankedText: action.yankedText! })); } if (action.mode !== undefined) { + // biome-ignore lint/style/noNonNullAssertion: Dallin can confirm if this is safe setVimState((prev) => ({ ...prev, mode: action.mode! })); } return; @@ -324,7 +327,9 @@ export function MultiLineTextInput({ let positionInLine = cursorPosition; for (let i = 0; i < lines.length; i++) { + // biome-ignore lint/style/noNonNullAssertion: Dallin can confirm if this is safe const lineLength = lines[i]!.length + (i < lines.length - 1 ? 1 : 0); // +1 for newline except last line + // biome-ignore lint/style/noNonNullAssertion: Dallin can confirm if this is safe if (cursorPosition <= currentLineStart + lines[i]!.length) { currentLineIndex = i; positionInLine = cursorPosition - currentLineStart; @@ -337,6 +342,7 @@ export function MultiLineTextInput({ const previousLineStart = lines .slice(0, currentLineIndex - 1) .reduce((acc, line) => acc + line.length + 1, 0); + // biome-ignore lint/style/noNonNullAssertion: Dallin can confirm if this is safe const previousLineLength = lines[currentLineIndex - 1]!.length; const newPosition = previousLineStart + Math.min(positionInLine, previousLineLength); setCursorPosition(newPosition); @@ -352,7 +358,9 @@ export function MultiLineTextInput({ let positionInLine = cursorPosition; for (let i = 0; i < lines.length; i++) { + // biome-ignore lint/style/noNonNullAssertion: Dallin can confirm if this is safe const lineLength = lines[i]!.length + (i < lines.length - 1 ? 1 : 0); // +1 for newline except last line + // biome-ignore lint/style/noNonNullAssertion: Dallin can confirm if this is safe if (cursorPosition <= currentLineStart + lines[i]!.length) { currentLineIndex = i; positionInLine = cursorPosition - currentLineStart; @@ -365,7 +373,7 @@ export function MultiLineTextInput({ const nextLineStart = lines .slice(0, currentLineIndex + 1) .reduce((acc, line) => acc + line.length + 1, 0); - const nextLineLength = lines[currentLineIndex + 1]!.length; + const nextLineLength = lines[currentLineIndex + 1]?.length ?? 0; const newPosition = nextLineStart + Math.min(positionInLine, nextLineLength); setCursorPosition(newPosition); } diff --git a/apps/cli/src/components/read-message.tsx b/apps/cli/src/components/read-message.tsx index 867bcbcf3..09c3e99c9 100644 --- a/apps/cli/src/components/read-message.tsx +++ b/apps/cli/src/components/read-message.tsx @@ -20,7 +20,7 @@ interface ReadMessageProps { */ export function ReadMessage({ message }: ReadMessageProps) { const isExpanded = useExpansion(); - const { args, result } = message; + const { result } = message; if (!result) { return null; diff --git a/apps/cli/src/components/shared/content-lines.tsx b/apps/cli/src/components/shared/content-lines.tsx index d2893d958..79abaf871 100644 --- a/apps/cli/src/components/shared/content-lines.tsx +++ b/apps/cli/src/components/shared/content-lines.tsx @@ -17,6 +17,7 @@ export function ContentLines({ return ( <> {lines.map((line, idx) => ( + // biome-ignore lint/suspicious/noArrayIndexKey: Lines position stable during rendering? Dallin can confirm? {line} diff --git a/apps/cli/src/components/write-message.tsx b/apps/cli/src/components/write-message.tsx index 4ecdd3b5d..5ab156ec6 100644 --- a/apps/cli/src/components/write-message.tsx +++ b/apps/cli/src/components/write-message.tsx @@ -42,6 +42,7 @@ export function WriteMessage({ message }: WriteMessageProps) { return ( ); onMessageUpdate?.(accumulatorState.messages); } diff --git a/apps/cli/src/services/message-accumulator.ts b/apps/cli/src/services/message-accumulator.ts index e162f2aa3..14acfdaf6 100644 --- a/apps/cli/src/services/message-accumulator.ts +++ b/apps/cli/src/services/message-accumulator.ts @@ -68,7 +68,7 @@ export function addReasoningContent( state.currentStepAssistantMessage && Array.isArray(state.currentStepAssistantMessage.content) ) { - (state.currentStepAssistantMessage.content as Array).push( + (state.currentStepAssistantMessage.content as (typeof reasoningContent)[]).push( reasoningContent ); } @@ -108,7 +108,7 @@ export function addTextContent( state.currentStepAssistantMessage && Array.isArray(state.currentStepAssistantMessage.content) ) { - (state.currentStepAssistantMessage.content as Array).push(textContent); + (state.currentStepAssistantMessage.content as (typeof textContent)[]).push(textContent); } return state; @@ -121,7 +121,7 @@ export function addToolCall( state: MessageAccumulatorState, toolCallId: string, toolName: string, - input: any + input: unknown ): MessageAccumulatorState { const toolCallContent = { type: 'tool-call' as const, @@ -150,9 +150,7 @@ export function addToolCall( state.currentStepAssistantMessage && Array.isArray(state.currentStepAssistantMessage.content) ) { - (state.currentStepAssistantMessage.content as Array).push( - toolCallContent - ); + (state.currentStepAssistantMessage.content as (typeof toolCallContent)[]).push(toolCallContent); } return state; @@ -166,7 +164,7 @@ export function addToolResult( state: MessageAccumulatorState, toolCallId: string, toolName: string, - output: any + output: string | Record ): MessageAccumulatorState { const toolResultContent = { type: 'tool-result' as const, @@ -194,7 +192,7 @@ export function addToolResult( // Append to existing tool message if (Array.isArray(state.currentToolMessage.content)) { - (state.currentToolMessage.content as Array).push(toolResultContent); + (state.currentToolMessage.content as (typeof toolResultContent)[]).push(toolResultContent); } return state; diff --git a/apps/cli/src/utils/conversation-history.ts b/apps/cli/src/utils/conversation-history.ts index b5ced7bb5..ac8b35300 100644 --- a/apps/cli/src/utils/conversation-history.ts +++ b/apps/cli/src/utils/conversation-history.ts @@ -46,13 +46,6 @@ function encodePathForDirectory(path: string): string { return Buffer.from(path).toString('base64url'); } -/** - * Decodes a directory name back to the original path - */ -function decodePathFromDirectory(encoded: string): string { - return Buffer.from(encoded, 'base64url').toString('utf-8'); -} - /** * Gets the history directory for a specific working directory */ @@ -112,7 +105,7 @@ export async function loadConversation( const data = await readFile(filePath, 'utf-8'); const parsed = JSON.parse(data); return ConversationSchema.parse(parsed); - } catch (error) { + } catch (_error) { // File doesn't exist or is invalid return null; } @@ -124,6 +117,7 @@ export async function loadConversation( export async function saveModelMessages( chatId: string, workingDirectory: string, + // biome-ignore lint/suspicious/noExplicitAny: We need to fix this to actually make it typesafe modelMessages: any[] ): Promise { let conversation = await loadConversation(chatId, workingDirectory); @@ -134,6 +128,7 @@ export async function saveModelMessages( } // Replace the model messages with the new array + // biome-ignore lint/suspicious/noExplicitAny: We need to fix this to actually make it typesafe conversation.modelMessages = modelMessages as any[]; conversation.updatedAt = new Date().toISOString(); @@ -174,7 +169,7 @@ export async function listConversations( return conversations .filter((c): c is NonNullable => c !== null) .sort((a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime()); - } catch (error) { + } catch (_error) { // Directory doesn't exist or can't be read return []; } @@ -228,7 +223,7 @@ export async function loadTodos( const data = await readFile(filePath, 'utf-8'); const parsed = JSON.parse(data); return TodoListSchema.parse(parsed); - } catch (error) { + } catch (_error) { // File doesn't exist or is invalid return null; } diff --git a/apps/cli/src/utils/file-search.ts b/apps/cli/src/utils/file-search.ts index 095dcd563..eaddf2167 100644 --- a/apps/cli/src/utils/file-search.ts +++ b/apps/cli/src/utils/file-search.ts @@ -93,7 +93,7 @@ class FileSearcher { return `**/${pattern}`; }); patterns.push(...adjustedPatterns); - } catch (error) { + } catch (_error) { // Silently ignore } } diff --git a/apps/cli/src/utils/transform-messages.ts b/apps/cli/src/utils/transform-messages.ts index 0583a571a..3909b0677 100644 --- a/apps/cli/src/utils/transform-messages.ts +++ b/apps/cli/src/utils/transform-messages.ts @@ -17,8 +17,6 @@ const TOOL_NAMES = { IDLE: 'idleTool', } as const; -type ToolName = (typeof TOOL_NAMES)[keyof typeof TOOL_NAMES]; - /** * Type guards for tool arguments and results */