Add Windows Task Scheduler runner for weekly check-ins

scripts/run-weekly-checkins.ps1: pure-Windows equivalent of the cron script —
reads the admin API key from .env and POSTs /discovery/coaching/run via
Invoke-RestMethod, logging to data/coaching-cron.log. README documents the
Register-ScheduledTask command (weekly, StartWhenAvailable + WakeToRun) for a
more robust schedule than WSL cron.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Joel Salmon
2026-06-16 21:57:09 -05:00
parent 2f962be0cf
commit 66176cbafb
2 changed files with 42 additions and 0 deletions
+18
View File
@@ -886,6 +886,24 @@ Running weekly services all cadences — the endpoint skips users who are not ye
due (biweekly/monthly), so a weekly tick is the finest needed. Output is
appended to `data/coaching-cron.log`. (On WSL, cron only runs while WSL is up.)
**More robust: Windows Task Scheduler.** `scripts/run-weekly-checkins.ps1` does
the same POST from Windows (reading the key from `.env`, hitting
`localhost:8011`). Register it to run weekly — and to catch up if the machine
was asleep — from PowerShell:
```powershell
$action = New-ScheduledTaskAction -Execute 'powershell.exe' `
-Argument '-NoProfile -ExecutionPolicy Bypass -File "C:\syncdata\impactflow-discovery\scripts\run-weekly-checkins.ps1"'
$trigger = New-ScheduledTaskTrigger -Weekly -DaysOfWeek Monday -At 8am
$settings = New-ScheduledTaskSettingsSet -StartWhenAvailable -WakeToRun
Register-ScheduledTask -TaskName 'ImpactFlow Weekly Check-ins' `
-Action $action -Trigger $trigger -Settings $settings `
-Description 'Phase 3 weekly coaching check-in batch'
```
Use either the WSL cron or the Task Scheduler job — not both is fine, but
running both is harmless since the endpoint dedupes by due-ness.
## Quick Start With Docker
This path requires Docker Desktop or another Docker Engine installation with