feat(setup): wire daemon autostart on boot/login per platform#187
Merged
Conversation
Linux: ~/.config/systemd/user/agentage.service + loginctl enable-linger → starts at boot, no sudo, restart-on-failure. macOS: ~/Library/LaunchAgents/io.agentage.daemon.plist + launchctl bootstrap → starts at user login (LaunchDaemon would need root and break ~/.agentage paths). Windows: schtasks /Create /SC ONLOGON /TN AgentageDaemon → starts at user logon, no admin (a Windows Service would need admin and run as LocalSystem). Default-on during fresh setup; --no-autostart opts out. setup --disconnect is symmetric: removes the unit/plist/task unless --no-autostart is also passed. Each platform module is dependency-injected (homeDir, nodeBin, entryPath, exec) so unit tests cover rendering + exec wiring on every platform without spawning real systemctl/launchctl/schtasks.
Contributor
|
🎉 PR Validation ✅ PASSED Commit: Checks:
Ready to merge! ✨ 🔗 View workflow run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
agentage setupnow wires the daemon to start automatically on machine restart. One platform module each, dependency-injected so they unit-test cleanly without spawning real systemctl/launchctl/schtasks.~/.config/systemd/user/agentage.service+loginctl enable-linger~/Library/LaunchAgents/io.agentage.daemon.plist+launchctl bootstrapschtasks /Create /SC ONLOGON /TN AgentageDaemonDaemon stores state in
~/.agentage/, so it must run as the user. That rules outLaunchDaemon(root) and Windows Services (LocalSystem) — only Linux + linger gives true pre-login boot without privilege escalation.Behavior
--no-autostartopts out.--disconnect: removes the unit/plist/task.--no-autostartkeeps it.--reauth/--no-login: leaves existing wiring alone.Autostart: systemd-user (starts at boot)/(starts at login).autostart: { mechanism, unitPath, startsAtBoot }field.Test plan
--no-autostart, standalone skip, disconnect cleanup) — 7 new testsnpm run verify— 738 tests pass, build greeninstallAutostart()deploys the unit,systemctl --user is-enabled agentage.servicereturnsenabled,loginctl show-user vreshch -p Lingerisyes→ daemon will start at boot.uninstallAutostart()removes the unit + disables cleanly.Notes
auto-launchnpm package — last release 3y ago, doesn't do systemd-linger (only~/.config/autostart/.desktop= login-time on Linux).deps.exec(...)wrapper, so cross-platform tests run on any host.