For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: Enable Windows close-to-tray for every installation once, then preserve the user's subsequent on/off choice across future launches and upgrades.
Architecture: The shared app-settings schema owns a one-time migration keyed by closeToTrayOnWindowsMigrationInitialized. The setting service detects legacy raw files and persists the migrated value through its serialized write queue; UI and Electron bootstrap fallbacks match the canonical true default.
Tech Stack: TypeScript, Zod, React, Electron, Vitest, pnpm.
true/false values to true exactly once.false must remain false.pnpm typecheck and pnpm lint before completion.Files:
packages/shared/test/validation.test.tspackages/shared/src/validationAppSettings.tspackages/shared/src/protocol.tsInterfaces:
AppSettings.closeToTrayOnWindowsMigrationInitialized?: booleanProduces: parsed defaults { closeToTrayOnWindows: true, closeToTrayOnWindowsMigrationInitialized: true }
[ ] Step 1: Write the failing schema test
Add assertions that {}, legacy { closeToTrayOnWindows: false }, migrated false, and migrated true resolve respectively to true, true, false, and true.
Run: pnpm vitest run packages/shared/test/validation.test.ts
Expected: FAIL because the current default and legacy false both resolve to false.
Add a preprocess migration that returns this shape when the marker is absent:
{
...raw,
closeToTrayOnWindows: true,
closeToTrayOnWindowsMigrationInitialized: true,
}
Define both schema fields and document the marker in AppSettings.
Run: pnpm vitest run packages/shared/test/validation.test.ts
Expected: PASS.
Files:
packages/services/test/settingService.test.tspackages/services/src/setting/settingService.tsInterfaces:
Produces: first get() of a legacy file atomically persists closeToTrayOnWindows: true and closeToTrayOnWindowsMigrationInitialized: true.
[ ] Step 1: Write the failing persistence test
Create a legacy settings file containing closeToTrayOnWindows: false, call get(), assert the returned and on-disk values are migrated, call update({ closeToTrayOnWindows: false }), and assert a fresh service preserves the migrated false.
Run: pnpm vitest run packages/services/test/settingService.test.ts
Expected: FAIL because the existing persistence detector only recognizes the optimize-agent migration.
Detect both one-time migrations from the raw settings value, persist schema output when either is pending, and keep the queued re-read before writing so concurrent patches are preserved.
Run: pnpm vitest run packages/services/test/settingService.test.ts
Expected: PASS.
Files:
packages/ui/src/SettingsPage.tsxpackages/desktop/src/main/index.tsdocs/windows-tray.mdInterfaces:
AppSettings.closeToTrayOnWindows from the setting service.Produces: UI toggle and main close handler both fall back to enabled if settings cannot provide a value.
[ ] Step 1: Change UI and main-process fallbacks to true
Set the React state initializer, loaded-setting fallback, main module default, and bootstrap fallback to true.
Run: pnpm vitest run packages/shared/test/validation.test.ts packages/services/test/settingService.test.ts packages/desktop/test/desktopWindowLifecycle.test.ts
Expected: PASS.
Run: pnpm typecheck
Run: pnpm lint
Expected: both exit 0.
Stage the implementation, tests, spec, and plan, then amend with:
git commit --amend -m "feat(desktop): enable Windows close to tray by default"