diff --git a/src/renderer/lib/ipc.ts b/src/renderer/lib/ipc.ts index e45a707..5eb9350 100644 --- a/src/renderer/lib/ipc.ts +++ b/src/renderer/lib/ipc.ts @@ -62,10 +62,28 @@ export const ipc = { // Callers needing a file picker should use ipc.file.pickFile() directly. read: (path: string): Promise> => safeCall('file', 'read', path), - write: (path: string, content: string): Promise> => + write: (path: string, content: string): Promise> => safeCall('file', 'write', path, content), list: (dir: string): Promise> => safeCall('file', 'list', dir), + delete: (path: string): Promise> => + safeCall('file', 'delete', path), + ensureDir: (path: string): Promise> => + safeCall('file', 'ensureDir', path), + exists: (path: string): Promise> => + safeCall('file', 'exists', path), + isDirectory: (path: string): Promise> => + safeCall('file', 'isDirectory', path), + copy: ( + source: string, + destination: string + ): Promise> => + safeCall('file', 'copy', source, destination), + move: ( + source: string, + destination: string + ): Promise> => + safeCall('file', 'move', source, destination), pickFolder: (): Promise> => safeCall('file', 'pickFolder'), pickFile: (): Promise> => @@ -103,11 +121,13 @@ export const ipc = { gitStage: (args: { rootPath: string; files: string[]; - }): Promise> => safeCall('git', 'stage', args), + }): Promise> => + safeCall('git', 'stage', args), gitCommit: (args: { rootPath: string; message: string; - }): Promise> => safeCall('git', 'commit', args), + }): Promise> => + safeCall('git', 'commit', args), setCurrent: (path: string | null): void => { if (typeof window !== 'undefined' && window.electronAPI?.file?.setCurrent) { window.electronAPI.file.setCurrent(path); @@ -161,9 +181,11 @@ export const ipc = { }, }, updater: { - check: (): Promise> => safeCall('updater', 'check'), + check: (): Promise> => + safeCall('updater', 'check'), install: (): Promise> => safeCall('updater', 'install'), - getState: (): Promise> => safeCall('updater', 'getState'), + getState: (): Promise> => + safeCall('updater', 'getState'), onStatus: (cb: (payload: unknown) => void): (() => void) => { if (typeof window === 'undefined' || !window.electronAPI?.updater?.onStatus) { return () => {}; @@ -172,9 +194,20 @@ export const ipc = { }, }, crash: { - read: (): Promise> => safeCall('crash', 'read'), + read: (): Promise< + IpcResult< + | Array<{ + filename: string; + kind: string; + message?: string; + stack?: string; + timestamp: string; + }> + | ChannelMissing + > + > => safeCall('crash', 'read'), openDir: (): Promise> => safeCall('crash', 'openDir'), - delete: (filename: string): Promise> => + delete: (filename: string): Promise> => safeCall('crash', 'delete', filename), }, };