# AGENTS Escrcpy is a pnpm + Turborepo monorepo for an Electron GUI around Android mirroring/control with scrcpy. Keep this file focused on agent-critical facts; link existing docs instead of copying them. For the broader overview, start with [develop.md](../develop.md). ## Architecture - [desktop/](../desktop/) is the Electron app. The main process is plugin-based via `@escrcpy/electron-setup`; the entry point is [desktop/electron/main.js](../desktop/electron/main.js). - Renderer windows are separate Vite entries in [desktop/vite.config.js](../desktop/vite.config.js): `main`, `control`, `explorer`, `copilot`, `terminal`, `automation`, and `mirror`. - Window modules live under [desktop/electron/modules/](../desktop/electron/modules/). Register main-process features as modules/services instead of adding logic to the preload script. - [packages/electron-setup/](../packages/electron-setup/) provides app/plugin/window management primitives. [packages/electron-ipcx/README.md](../packages/electron-ipcx/README.md) documents IPC with renderer callbacks. - [packages/wscrcpy/](../packages/wscrcpy/) is a self-contained Vue + TS module built from `src/` (tsdown + unplugin-vue, declarations via vue-tsc). Two process-scoped entries: the package root exports the renderer-facing API (`Wscrcpy` component, composables, core helpers/types), and `@escrcpy/wscrcpy/main` exports the main-process ByteBridge factory — never import the root from main or `./main` from a renderer. `service/bridge/` is a thin main-process TCP ⇄ MessagePort pump; `src/stack/` owns the full protocol stack inside each window; `src/core/runtime.ts` routes every wscrcpy channel to the local stack. Preserve the public signatures and the `DeviceTarget = 'all' | 'primary' | string | string[]` contract; business code stays untouched across internal changes. - [packages/madb/](../packages/madb/) is an MCP server for AI agent Android device control via ADB and yadb (32 tools). See its [AGENTS.md](../packages/madb/AGENTS.md). - [packages/adbx/](../packages/adbx/) is an injected adbkit capability layer; it prefers yadb when available and falls back to standard ADB. - [packages/shared/](../packages/shared/) contains platform-neutral utilities shared across workspace packages. - [packages/unocss-preset-shades/](../packages/unocss-preset-shades/) is an UnoCSS preset that generates color shades from a base color. ## Commands - Install: `corepack enable pnpm && pnpm install`. - Dev: `pnpm dev` starts Turbo-managed app development; the desktop Vite server uses port `1535`. - Lint: `pnpm lint` or `pnpm lint:fix`. - Build: `pnpm build`; platform variants are `pnpm build:win`, `pnpm build:mac`, and `pnpm build:linux`. - Docs: `pnpm docs:dev`, `pnpm docs:build`, `pnpm docs:preview`. - i18n sync: `pnpm lang-sync` after editing locale keys in `desktop/electron/resources/extra/common/locales/*.json`. - Electron install repair: `pnpm electron-fix` when Electron reports an incomplete install. - wscrcpy type check: `pnpm --filter @escrcpy/wscrcpy typecheck` (vue-tsc; plain tsc cannot resolve `.vue` imports). There is no repo-wide test script today. For changes, run the smallest meaningful verification first, then `pnpm lint`; use `pnpm build` for packaging, Electron main-process, Vite config, dependency, or release-sensitive changes. ## Frontend Patterns - Vue code uses Vue 3 Composition API with `