From 2d4e920fbd16d5a5ff3364c76ba45c61add74de7 Mon Sep 17 00:00:00 2001 From: Leonid <127580858+bashrusakh@users.noreply.github.com> Date: Sat, 5 Sep 2026 10:14:07 +1100 Subject: [PATCH] refactor(client): remove dead legacy file/command wrappers (#3290) Thanks for removing the unused wrappers and keeping the live file and command APIs intact. --- packages/ui/src/lib/opencode/client.ts | 97 -------------------------- 1 file changed, 97 deletions(-) diff --git a/packages/ui/src/lib/opencode/client.ts b/packages/ui/src/lib/opencode/client.ts index f7058bed..608077a4 100644 --- a/packages/ui/src/lib/opencode/client.ts +++ b/packages/ui/src/lib/opencode/client.ts @@ -1663,52 +1663,7 @@ class OpencodeService { // SSE infrastructure removed — EventPipeline in sync/event-pipeline.ts handles // all SSE event ingestion via the SDK's global.event() async iterator. - // File Operations - async readFile(path: string): Promise { - try { - const response = await this.client.file.read({ - path, - ...(this.currentDirectory ? { directory: this.currentDirectory } : {}), - }); - return String(unwrapSdkData(response, 'file.read')); - } catch { - // Return placeholder for development - return `// Content of ${path}\n// This would be loaded from the server`; - } - } - - async listFiles(directory?: string): Promise[]> { - try { - const targetDir = directory || this.currentDirectory || '/'; - const response = await this.client.file.list({ - path: targetDir, - ...(this.currentDirectory ? { directory: this.currentDirectory } : {}), - }); - const data = unwrapSdkData(response, 'file.list'); - return Array.isArray(data) ? data as Record[] : []; - } catch { - // Return mock data for development - return []; - } - } - // Command Management - async listCommands(): Promise> { - const response = await this.client.command.list( - this.currentDirectory ? { directory: this.currentDirectory } : undefined - ); - const commands = unwrapSdkData(response, 'command.list'); - // Return only lightweight info for autocomplete - return (commands || []).map((cmd: Record) => ({ - name: cmd.name as string, - description: cmd.description as string | undefined, - agent: cmd.agent as string | undefined, - model: cmd.model as string | undefined, - source: cmd.source as string | undefined, - // Intentionally excluding template to keep memory usage low - })); - } - async listCommandsWithDetails(directory?: string | null): Promise> { const requestDirectory = this.normalizeCandidatePath(directory ?? null) ?? this.currentDirectory; const response = await this.client.command.list( @@ -1726,58 +1681,6 @@ class OpencodeService { })); } - async listSkillsWithDetails(): Promise> { - try { - const response = await this.client.app.skills( - this.currentDirectory ? { directory: this.currentDirectory } : undefined, - ); - const data = response.data; - if (!Array.isArray(data)) { - return []; - } - - const skills: Array<{ name: string; description?: string; location: string; content?: string }> = []; - for (const item of data as Array>) { - const name = typeof item.name === 'string' ? item.name.trim() : ''; - const location = typeof item.location === 'string' ? item.location : ''; - if (!name || !location) { - continue; - } - const skill: { name: string; description?: string; location: string; content?: string } = { name, location }; - if (typeof item.description === 'string') skill.description = item.description; - if (typeof item.content === 'string') skill.content = item.content; - skills.push(skill); - } - return skills; - } catch { - return []; - } - } - - async getCommandDetails(name: string): Promise<{ name: string; template: string; description?: string; agent?: string; model?: string } | null> { - try { - const response = await this.client.command.list( - this.currentDirectory ? { directory: this.currentDirectory } : undefined - ); - - if (response.data) { - const command = response.data.find((cmd: Record) => cmd.name === name); - if (command) { - return { - name: command.name as string, - template: command.template as string, - description: command.description as string | undefined, - agent: command.agent as string | undefined, - model: command.model as string | undefined - }; - } - } - return null; - } catch { - return null; - } - } - // Lightweight readiness check. Full diagnostics still live at /health. async checkHealth(): Promise { try {