The default wecker.py shell command was duplicated across set_alarm()
and start_ringing(). Extracted a shared _default_command() helper so
both callers use the same definition.
- Add startWecker mutation: starts wecker.py via subprocess if not already ringing
- Add stopWecker mutation: kills the running wecker process via SIGTERM if ringing
- Both mutations handle the 'already ringing' / 'not ringing' edge cases gracefully
- Update README with API documentation for the new mutations
- Add comprehensive tests (unit + GraphQL endpoint)
Features:
- New GraphQL query 'isRinging' returns true/false if wecker is active
- Checks the wecker process via PID file (PID_FILE in common.py)
DRY refactoring:
- Extract PID_FILE into shared common.py module
- Both wecker.py and api/schema.py import from common
- DRY enforcement tests verify identity (is) not just equality
Tests:
- test_is_ringing_returns_false_when_not_running
- test_is_ringing_returns_true_when_running
- test_pid_file_defined_once_across_modules (DRY enforcement)
- test_pid_file_same_shared_constant_in_api (DRY enforcement)
- Cleaned up unused imports in test_single_instance.py
Docs:
- Updated README.md with isRinging query documentation
- Fixed api/schema.py to generate cron jobs using '>> wecker.log' so logs aren't truncated.
- Added test_bugfix_default_command_uses_append_for_logs in tests/test_api.py to prevent regression.
- Added RPi.GPIO and pygame to pyproject.toml via 'uv add' to fix ModuleNotFoundError in cron jobs.
- Updated README.md to reflect that system python packages are no longer needed.