|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +Cross-platform Electron desktop app for managing periodic breaks. Runs as system tray application with notifications and fullscreen overlays. |
| 8 | + |
| 9 | +## Architecture |
| 10 | + |
| 11 | +### Main Process (`app/main/`) |
| 12 | + |
| 13 | +- **Entry Point**: `index.ts` |
| 14 | +- **Core Logic**: `lib/` directory: |
| 15 | + - `breaks.ts` - Break scheduling and management |
| 16 | + - `ipc.ts` - Inter-process communication handlers |
| 17 | + - `store.ts` - Settings persistence |
| 18 | + - `tray.ts` - System tray integration |
| 19 | + - `windows.ts` - Window management |
| 20 | + - `notifications.ts` - Native notifications |
| 21 | + - `auto-launch.ts` - Auto-startup |
| 22 | + |
| 23 | +### Renderer Process (`app/renderer/`) |
| 24 | + |
| 25 | +- **Entry Point**: `index.tsx` |
| 26 | +- **Components**: React components (Break, Settings, etc.) |
| 27 | +- **Styling**: CSS with Tailwind CSS |
| 28 | +- **Sounds**: Audio files for notifications |
| 29 | +- **Preload**: `preload.js` - Secure IPC bridge |
| 30 | +- **Fonts**: Inter font bundled in `public/fonts/` |
| 31 | + |
| 32 | +### Types (`app/types/`) |
| 33 | + |
| 34 | +- Shared TypeScript definitions for IPC, settings, breaks |
| 35 | + |
| 36 | +## Common Development Commands |
| 37 | + |
| 38 | +### Development |
| 39 | + |
| 40 | +```bash |
| 41 | +npm run dev # Start development server with hot reload |
| 42 | +START_MINIMIZED=true npm run dev # Start development without auto-focus |
| 43 | +``` |
| 44 | + |
| 45 | +### Building |
| 46 | + |
| 47 | +```bash |
| 48 | +npm run build # Build both main and renderer processes |
| 49 | +npm run build-main # Build main process only |
| 50 | +npm run build-renderer # Build renderer process only |
| 51 | +``` |
| 52 | + |
| 53 | +### Production |
| 54 | + |
| 55 | +```bash |
| 56 | +npm run start # Start production build |
| 57 | +DEBUG_PROD=true npm run start # Start production with debugging |
| 58 | +``` |
| 59 | + |
| 60 | +### Code Quality |
| 61 | + |
| 62 | +```bash |
| 63 | +npm run lint # Run ESLint |
| 64 | +npm run typecheck # Run TypeScript compiler check |
| 65 | +npm run format-check # Check code formatting |
| 66 | +npm run format # Fix code formatting |
| 67 | +``` |
| 68 | + |
| 69 | +### Testing |
| 70 | + |
| 71 | +```bash |
| 72 | +npm test # Run tests |
| 73 | +``` |
| 74 | + |
| 75 | +### Packaging |
| 76 | + |
| 77 | +```bash |
| 78 | +npm run package # Package for current platform |
| 79 | +npm run package-all # Package for all platforms |
| 80 | +npm run package-mac # Package for macOS |
| 81 | +npm run package-win # Package for Windows |
| 82 | +npm run package-linux # Package for Linux |
| 83 | +``` |
| 84 | + |
| 85 | +## Key Technologies |
| 86 | + |
| 87 | +- **Electron** - Desktop application framework |
| 88 | +- **React 19** - UI framework for renderer process with new JSX transform |
| 89 | +- **TypeScript 5.8** - Primary language |
| 90 | +- **shadcn/ui** - Modern UI component library with Radix UI primitives |
| 91 | +- **Tailwind CSS** - Utility-first CSS framework for styling |
| 92 | +- **Inter Font** - Typography font bundled locally (WOFF2 format) |
| 93 | +- **Framer Motion** - Animation library for smooth transitions |
| 94 | +- **Vite** - Frontend build tool and dev server for renderer process |
| 95 | +- **Webpack 5** - Module bundler for main process |
| 96 | +- **electron-store** - Settings persistence |
| 97 | +- **Howler.js** - Audio playback |
| 98 | +- **moment.js** - Date/time handling |
| 99 | + |
| 100 | +## IPC Communication |
| 101 | + |
| 102 | +Typed IPC system in `app/types/ipc.ts` with handlers in `app/main/lib/ipc.ts`: |
| 103 | + |
| 104 | +- Settings management |
| 105 | +- Break control |
| 106 | +- Sound playback |
| 107 | +- Window management |
| 108 | + |
| 109 | +## Settings Architecture |
| 110 | + |
| 111 | +electron-store with TypeScript interfaces in `app/types/settings.ts`: |
| 112 | + |
| 113 | +- Break intervals and duration |
| 114 | +- Working hours |
| 115 | +- Sound preferences |
| 116 | +- Notification settings |
| 117 | + |
| 118 | +## Build System |
| 119 | + |
| 120 | +- **Main Process**: Webpack 5 |
| 121 | +- **Renderer Process**: Vite |
| 122 | +- Babel + TypeScript |
| 123 | +- React Fast Refresh |
| 124 | +- TypeScript `skipLibCheck: true` |
| 125 | + |
| 126 | +## Recent Updates |
| 127 | + |
| 128 | +### UI and Styling |
| 129 | + |
| 130 | +- **shadcn/ui** - Modern component library with Radix UI primitives |
| 131 | +- **Tailwind CSS** - Utility-first CSS framework |
| 132 | +- **Inter font** - Bundled locally (WOFF2) |
| 133 | +- **Enhanced button interactions** - Improved hover/active states |
| 134 | + |
| 135 | +### Animation System |
| 136 | + |
| 137 | +- **framer-motion** - Replaced react-spring |
| 138 | +- `motion.div` components for break windows |
| 139 | +- **Smooth progress** - 50ms notification, 100ms break window updates |
| 140 | +- Fixed infinite loops with functional state updates |
| 141 | + |
| 142 | +### Window Management |
| 143 | + |
| 144 | +- **Dynamic notification sizing** - 450px-550px based on enabled buttons |
| 145 | +- **Circular progress border** - Around Start button |
| 146 | +- **Multi-screen sync** - Break starts synchronized across displays |
| 147 | +- Timer cleanup prevents hot reload flickering |
| 148 | + |
| 149 | +### Dependencies |
| 150 | + |
| 151 | +- **React 19** - New JSX transform |
| 152 | +- **TypeScript 5.8** |
| 153 | +- **Framer Motion** |
| 154 | +- **Vite** |
| 155 | + |
| 156 | +### Development Experience |
| 157 | + |
| 158 | +- tsconfig.json excludes node_modules |
| 159 | +- Improved hot reloading |
| 160 | + |
| 161 | +## Development Workflow |
| 162 | + |
| 163 | +**IMPORTANT**: Always run after non-trivial changes: |
| 164 | + |
| 165 | +```bash |
| 166 | +npm run format && npm run lint && npm run typecheck |
| 167 | +``` |
0 commit comments