Skip to content
Merged
Prev Previous commit
update skill to say to edit the preview stub
  • Loading branch information
sawka committed Mar 7, 2026
commit 897660a57d6ce4707b5d1dc4ee6cde8cc867a875
14 changes: 12 additions & 2 deletions .kilocode/skills/electron-api/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ description: Guide for adding new Electron APIs to Wave Terminal. Use when imple

Electron APIs allow the frontend to call Electron main process functionality directly via IPC.

## Three Files to Edit
## Four Files to Edit

1. [`frontend/types/custom.d.ts`](frontend/types/custom.d.ts) - TypeScript [`ElectronApi`](frontend/types/custom.d.ts:82) type
2. [`emain/preload.ts`](emain/preload.ts) - Expose method via `contextBridge`
3. [`emain/emain-ipc.ts`](emain/emain-ipc.ts) - Implement IPC handler
4. [`frontend/preview/preview-electron-api.ts`](frontend/preview/preview-electron-api.ts) - Add a no-op stub to keep the `previewElectronApi` object in sync with the `ElectronApi` type

## Three Communication Patterns

Expand Down Expand Up @@ -54,7 +55,15 @@ electron.ipcMain.handle("capture-screenshot", async (event, rect) => {
});
```

### 4. Call from Frontend
### 4. Add Preview Stub

In [`frontend/preview/preview-electron-api.ts`](frontend/preview/preview-electron-api.ts):

```typescript
captureScreenshot: (_rect: Electron.Rectangle) => Promise.resolve(""),
```

### 5. Call from Frontend

```typescript
import { getApi } from "@/store/global";
Expand Down Expand Up @@ -167,6 +176,7 @@ webContents.send("zoom-factor-change", newZoomFactor);
- [ ] Include IPC channel name in comment
- [ ] Expose in [`preload.ts`](emain/preload.ts)
- [ ] Implement in [`emain-ipc.ts`](emain/emain-ipc.ts)
- [ ] Add no-op stub to [`preview-electron-api.ts`](frontend/preview/preview-electron-api.ts)
- [ ] IPC channel names match exactly
- [ ] **For sync**: Set `event.returnValue` (or browser hangs!)
- [ ] Test end-to-end
Loading