# Electron Shell

Electron main-process package for MetoYou / Toju. This directory owns desktop bootstrap, the preload bridge, IPC handlers, desktop persistence glue, updater integration, and window-level behavior.

## Commands

- `npm run build:electron` builds the Electron TypeScript output to `dist/electron`.
- `npm run electron` builds the product client and Electron, then launches the desktop app.
- `npm run electron:dev` starts the Angular client and Electron together.
- `npm run dev` starts the full desktop stack: server, Angular client, and Electron.
- `npm run electron:build`, `npm run electron:build:win`, `npm run electron:build:mac`, and `npm run electron:build:linux` create packaged desktop builds.

## Structure

| Path | Description |
| --- | --- |
| `main.ts` | Electron app bootstrap and process entry point |
| `preload.ts` | Typed renderer-facing preload bridge |
| `app/` | App lifecycle and startup composition |
| `ipc/` | Renderer-invoked IPC handlers |
| `cqrs/` | Local database command/query handlers and mappings |
| `db/`, `entities/`, `migrations/` | Desktop persistence and schema evolution |
| `audio/` | Desktop audio integrations |
| `update/` | Desktop updater flow |
| `window/` | Window creation and window-level behavior |

## Notes

- When adding a renderer-facing capability, update the Electron implementation, `preload.ts`, and the renderer bridge in `toju-app/` together.
- Treat `dist/electron/` and `dist-electron/` as generated output.
- See [AGENTS.md](AGENTS.md) for package-level editing rules.