Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/shared/IpcChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ export enum IpcChannel {
Fs_ReadText = 'fs:readText',
File_OpenWithRelativePath = 'file:openWithRelativePath',
File_IsTextFile = 'file:isTextFile',
File_IsDirectory = 'file:isDirectory',
File_ListDirectory = 'file:listDirectory',
File_GetDirectoryStructure = 'file:getDirectoryStructure',
File_CheckFileName = 'file:checkFileName',
Expand Down Expand Up @@ -380,10 +381,13 @@ export enum IpcChannel {
ClaudeCodePlugin_ListAvailable = 'claudeCodePlugin:list-available',
ClaudeCodePlugin_Install = 'claudeCodePlugin:install',
ClaudeCodePlugin_Uninstall = 'claudeCodePlugin:uninstall',
ClaudeCodePlugin_UninstallPackage = 'claudeCodePlugin:uninstall-package',
ClaudeCodePlugin_ListInstalled = 'claudeCodePlugin:list-installed',
ClaudeCodePlugin_InvalidateCache = 'claudeCodePlugin:invalidate-cache',
ClaudeCodePlugin_ReadContent = 'claudeCodePlugin:read-content',
ClaudeCodePlugin_WriteContent = 'claudeCodePlugin:write-content',
ClaudeCodePlugin_InstallFromZip = 'claudeCodePlugin:install-from-zip',
ClaudeCodePlugin_InstallFromDirectory = 'claudeCodePlugin:install-from-directory',

// Local Transfer
LocalTransfer_ListServices = 'local-transfer:list',
Expand Down
31 changes: 31 additions & 0 deletions src/main/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,7 @@ export async function registerIpc(mainWindow: BrowserWindow, app: Electron.App)
ipcMain.handle(IpcChannel.File_BinaryImage, fileManager.binaryImage.bind(fileManager))
ipcMain.handle(IpcChannel.File_OpenWithRelativePath, fileManager.openFileWithRelativePath.bind(fileManager))
ipcMain.handle(IpcChannel.File_IsTextFile, fileManager.isTextFile.bind(fileManager))
ipcMain.handle(IpcChannel.File_IsDirectory, fileManager.isDirectory.bind(fileManager))
ipcMain.handle(IpcChannel.File_ListDirectory, fileManager.listDirectory.bind(fileManager))
ipcMain.handle(IpcChannel.File_GetDirectoryStructure, fileManager.getDirectoryStructure.bind(fileManager))
ipcMain.handle(IpcChannel.File_CheckFileName, fileManager.fileNameGuard.bind(fileManager))
Expand Down Expand Up @@ -1054,6 +1055,16 @@ export async function registerIpc(mainWindow: BrowserWindow, app: Electron.App)
}
})

ipcMain.handle(IpcChannel.ClaudeCodePlugin_UninstallPackage, async (_, options) => {
try {
const data = await pluginService.uninstallPluginPackage(options)
return { success: true, data }
} catch (error) {
logger.error('Failed to uninstall plugin package', { options, error })
return { success: false, error }
}
})

ipcMain.handle(IpcChannel.ClaudeCodePlugin_ListInstalled, async (_, agentId: string) => {
try {
const data = await pluginService.listInstalled(agentId)
Expand Down Expand Up @@ -1128,6 +1139,26 @@ export async function registerIpc(mainWindow: BrowserWindow, app: Electron.App)
}
})

ipcMain.handle(IpcChannel.ClaudeCodePlugin_InstallFromZip, async (_, options) => {
try {
const data = await pluginService.installFromZip(options)
return { success: true, data }
} catch (error) {
logger.error('Failed to install plugin from ZIP', { options, error })
return { success: false, error }
}
})

ipcMain.handle(IpcChannel.ClaudeCodePlugin_InstallFromDirectory, async (_, options) => {
try {
const data = await pluginService.installFromDirectory(options)
return { success: true, data }
} catch (error) {
logger.error('Failed to install plugin from directory', { options, error })
return { success: false, error }
}
})

ipcMain.handle(IpcChannel.LocalTransfer_ListServices, () => localTransferService.getState())
ipcMain.handle(IpcChannel.LocalTransfer_StartScan, () => localTransferService.startDiscovery({ resetList: true }))
ipcMain.handle(IpcChannel.LocalTransfer_StopScan, () => localTransferService.stopDiscovery())
Expand Down
9 changes: 9 additions & 0 deletions src/main/services/FileStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1854,6 +1854,15 @@ class FileStorage {
}
}

public isDirectory = async (_: Electron.IpcMainInvokeEvent, filePath: string): Promise<boolean> => {
try {
const stat = await fs.promises.stat(filePath)
return stat.isDirectory()
} catch {
return false
}
}

public showInFolder = async (_: Electron.IpcMainInvokeEvent, path: string): Promise<void> => {
if (!fs.existsSync(path)) {
const msg = `File or folder does not exist: ${path}`
Expand Down
Loading