Files
auto-git/gemini.md

62 lines
2.6 KiB
Markdown

# Project Status: Completed
The application is fully implemented and tested for Windows 11 background operation.
---
# Current Architecture (Finalized)
The project is structured as a proper Python package to ensure compatibility with PyInstaller and robust path handling.
```
auto-git/
├── run.py # Main entry point for Python/PyInstaller
├── git_monitor/ # Main package
│ ├── __init__.py # Package marker
│ ├── main.py # Application lifecycle
│ ├── tray_app.py # System tray (pystray) + UI (tkinter)
│ ├── git_manager.py # Git operations (GitPython)
│ ├── file_watcher.py # Filesystem monitoring (watchdog)
│ ├── notifier.py # Windows notifications (plyer + win10toast fallback)
│ ├── config.py # Persistent configuration (config.json)
│ ├── logger.py # Application logging (git_monitor.log)
│ └── requirements.txt # Dependency list
└── .gitignore # Project ignore rules
```
---
# Implemented Solutions & Fixes
### 1. UI Responsive Fix (Windows 11)
To prevent the application from freezing during folder selection:
* **Threading**: `pystray` runs in a separate background thread.
* **Main Loop**: `tkinter.mainloop()` runs in the main thread to handle system dialogs properly.
* **Non-blocking Dialogs**: Folder selection is scheduled via `root.after(0, ...)` to ensure it doesn't block the tray icon.
### 2. PyInstaller Compatibility
* **Package Imports**: All internal imports use absolute paths (e.g., `from git_monitor.logger import ...`).
* **Path Management**: `logger.py` and `config.py` use `sys.frozen` detection to ensure data files are always located relative to the `.exe` file, not temporary directories.
* **Notification Robustness**: Added a fallback mechanism in `notifier.py`. If `plyer` fails to find a platform implementation (common in isolated environments), it automatically switches to `win10toast`.
---
# Build Instructions
To generate the standalone executable, use the following command from the project root:
```powershell
pyinstaller.exe --onefile --noconsole --name git-monitor --hidden-import="plyer.platforms.win.notification" run.py
```
### Build Parameters:
* `--onefile`: Packages everything into a single `.exe`.
* `--noconsole`: Hides the command prompt window during execution.
* `--hidden-import`: Manually includes the dynamic notification module for Windows.
---
# Runtime Files
* **Log File**: `git_monitor.log` (created in the same folder as the `.exe`).
* **Config File**: `config.json` (created in the same folder as the `.exe`).