Skip to content

feat(service): add OS-native background scheduler#3

Merged
jung-thomas merged 11 commits intomainfrom
feature/os-scheduler
Apr 20, 2026
Merged

feat(service): add OS-native background scheduler#3
jung-thomas merged 11 commits intomainfrom
feature/os-scheduler

Conversation

@jung-thomas
Copy link
Copy Markdown
Contributor

Summary

  • Adds sap-devs service install/uninstall/status commands that register an OS-native scheduled task to run sap-devs sync && sap-devs inject --no-sync on a configurable interval (default 6h)
  • Three platform implementations behind build tags: Windows Task Scheduler (schtasks), macOS launchd (plist), Linux systemd user timer — all via os/exec, no CGO
  • New ServiceConfig with nested service.interval config key matching existing sub-config patterns

Architecture

New internal/service/ package with a Scheduler interface and platform implementations:

Platform Mechanism Entry
Windows Task Scheduler sap-devs-sync task via schtasks
macOS launchd ~/Library/LaunchAgents/com.sap-devs.sync.plist
Linux systemd user timer ~/.config/systemd/user/sap-devs-sync.{service,timer}

Part 1 of the system tray design spec. Independent of the tray binary — works standalone.

Test plan

  • go build ./... and go vet ./... pass (verified locally on Windows)
  • CI tests pass on ubuntu-latest (authoritative test runner)
  • sap-devs service status prints "Scheduler: not installed"
  • sap-devs service install registers the OS scheduler entry
  • sap-devs service uninstall removes it
  • darwin/linux files compile under respective build tags (CI matrix)

Specifies architecture for optional Wails v3 tray binary with Fiori-themed
webview dashboard, OS-native scheduler, and download-on-demand distribution.
Plan 1: OS-native scheduler (systemd/launchd/Task Scheduler)
Plan 2: Tray lifecycle & CLI commands (download, autostart, update)
Plan 3: Wails v3 tray binary (tray icon, webview panel, CI workflow)
Adds ServiceConfig struct with Interval field (default 6h) nested under
the service key in config.yaml, following the existing sub-config pattern.
- Quote binary paths in Windows schtasks script (spaces in paths)
- Quote binary paths in Linux systemd ExecStart
- Unload existing agent before re-loading on macOS (re-install fix)
- Resolve symlinks via filepath.EvalSymlinks for stable binary path
- Remove unused ErrNotInstalled sentinel and Status.Interval field
@jung-thomas jung-thomas merged commit 05f1c99 into main Apr 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant