hermes-agent/apps/desktop/electron/vscode-theme-ipc.cjs
Brooklyn Nicholson 8a48d54193 refactor(desktop): extract VS Code Marketplace theme IPC from main.cjs into vscode-theme-ipc.cjs
Seventh main.cjs cluster peel. The two hermes:vscode-theme:* handlers (fetch,
search) move verbatim into electron/vscode-theme-ipc.cjs behind a
registerVscodeThemeIpc({ ipcMain }) registrar. Both delegate to the
vscode-marketplace sibling module, which the new module requires directly — so
the now-dead require in main.cjs is removed.

Channel names unchanged → preload + renderer untouched. Adds
electron/vscode-theme-ipc.test.cjs (surface invariant).
2026-06-30 13:34:12 -05:00

19 lines
922 B
JavaScript

'use strict'
const { fetchMarketplaceThemes, searchMarketplaceThemes } = require('./vscode-marketplace.cjs')
// VS Code Marketplace color-theme IPC: fetch a theme by extension id + search the
// marketplace. Both delegate to the vscode-marketplace sibling module; no theme
// code is ever executed (only JSON is read from the .vsix).
function registerVscodeThemeIpc({ ipcMain }) {
// Download a VS Code Marketplace extension and return the raw color-theme JSON
// it contributes. No theme code is executed — we only read JSON from the .vsix.
ipcMain.handle('hermes:vscode-theme:fetch', async (_event, id) => fetchMarketplaceThemes(String(id || '')))
// Search the Marketplace for color-theme extensions (empty query = top installs).
ipcMain.handle('hermes:vscode-theme:search', async (_event, query) =>
searchMarketplaceThemes(String(query || ''), 20)
)
}
module.exports = { registerVscodeThemeIpc }