|
| 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 | +WP Debug is an Electron-based desktop application for monitoring WordPress debug logs in real-time. The app provides a React frontend with real-time file monitoring capabilities, system tray integration, and automatic WordPress configuration management. |
| 8 | + |
| 9 | +## Architecture |
| 10 | + |
| 11 | +**Main Process** (`main/index.js`): |
| 12 | +- Electron main process handling file system operations, tray management, and WordPress configuration |
| 13 | +- Manages chokidar file watcher for real-time log monitoring |
| 14 | +- Handles IPC communication with renderer process |
| 15 | +- Manages WordPress wp-config.php modifications and mu-plugin installation/cleanup |
| 16 | + |
| 17 | +**Renderer Process** (`renderer/`): |
| 18 | +- React frontend built with Tailwind CSS |
| 19 | +- Entry point: `renderer/src/index.js` → `renderer/src/App.js` |
| 20 | +- Components in `renderer/src/components/` |
| 21 | +- Webpack builds to `renderer/index.js` |
| 22 | + |
| 23 | +**Build System**: |
| 24 | +- Webpack for renderer process bundling with Babel for React/ES6 |
| 25 | +- Electron Forge for packaging and distribution |
| 26 | +- PostCSS with Tailwind CSS for styling |
| 27 | +- Icon generation scripts in `scripts/` |
| 28 | + |
| 29 | +## Development Commands |
| 30 | + |
| 31 | +```bash |
| 32 | +# Start development with hot reload |
| 33 | +npm run dev |
| 34 | + |
| 35 | +# Build renderer for production |
| 36 | +npm run build |
| 37 | + |
| 38 | +# Start application directly |
| 39 | +npm start |
| 40 | + |
| 41 | +# Package application without installers |
| 42 | +npm run package |
| 43 | + |
| 44 | +# Create platform-specific distributables |
| 45 | +npm run make |
| 46 | + |
| 47 | +# Platform-specific builds |
| 48 | +npm run make -- --platform=darwin # macOS |
| 49 | +npm run make -- --platform=win32 # Windows |
| 50 | +npm run make -- --platform=linux # Linux |
| 51 | + |
| 52 | +# Icon generation |
| 53 | +npm run generate-icons # App icons |
| 54 | +npm run generate-tray # Tray icons |
| 55 | +npm run generate-all # Both |
| 56 | +``` |
| 57 | + |
| 58 | +## Key Components |
| 59 | + |
| 60 | +**Main Process (`main/index.js`)**: |
| 61 | +- `isWordPressDirectory()` - Validates WordPress installations |
| 62 | +- `enableWPDebug()` / `cleanupWPDebug()` - Manages wp-config.php modifications |
| 63 | +- `createMuPlugin()` / `removeMuPlugin()` - Handles wp_debug() helper function |
| 64 | +- Chokidar watcher for real-time log monitoring |
| 65 | +- System tray with notifications |
| 66 | + |
| 67 | +**React App (`renderer/src/App.js`)**: |
| 68 | +- Directory selection and validation |
| 69 | +- Real-time log display with expand/collapse |
| 70 | +- Recent directories management via electron-store |
| 71 | +- IPC communication with main process |
| 72 | + |
| 73 | +## WordPress Integration |
| 74 | + |
| 75 | +The app automatically: |
| 76 | +1. Validates WordPress installations by checking for wp-config.php |
| 77 | +2. Backs up and modifies wp-config.php to enable debug logging |
| 78 | +3. Installs a mu-plugin with `wp_debug()` helper function |
| 79 | +4. Monitors wp-content/debug.log for changes |
| 80 | +5. Restores original configuration on exit |
| 81 | + |
| 82 | +## File Structure |
| 83 | + |
| 84 | +- `main/` - Electron main process |
| 85 | +- `renderer/` - React frontend (built by webpack) |
| 86 | +- `assets/` - Icons and images |
| 87 | +- `scripts/` - Build utilities for icon generation |
| 88 | +- `out/` - Built executables and packages |
| 89 | + |
| 90 | +## Dependencies |
| 91 | + |
| 92 | +**Runtime**: electron, react, react-dom, chokidar, electron-store, tailwindcss |
| 93 | +**Build**: webpack, babel, electron-forge, sharp (for icons), postcss |
| 94 | + |
| 95 | +## Notes |
| 96 | + |
| 97 | +- No test framework is configured |
| 98 | +- Uses GPL-2.0-or-later license |
| 99 | +- Cross-platform support (macOS, Windows, Linux) |
| 100 | +- System tray integration with notifications |
| 101 | +- File watching requires local WordPress installations (no Docker support) |
0 commit comments