feat: official auto-start service support#422
Merged
SuperCoolPencil merged 19 commits intomainfrom Apr 30, 2026
Merged
Conversation
Binary Size Analysis
|
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.
This PR adds a built-in
servicecommand to manage Surge as a system service (daemon) using thekardianos/servicelibrary.Key Changes:
surge servicecommand withinstall,uninstall,start,stop, andstatussubcommands.root.gowith minimal changes to existing logic.kardianos/service.Why this matters:
Note on minimal changes:
The implementation wraps the existing
rootCmd.Execute()logic, ensuring that when run as a service, Surge behaves exactly likesurge server startbut integrates correctly with the OS service manager (especially important for Windows SCM).Greptile Summary
This PR adds a built-in
surge servicecommand backed bykardianos/servicefor cross-platform daemon management, and wires anauto_starttoggle into the TUI settings so users can install/uninstall the OS service without leaving the app. The implementation addresses all the lifecycle, shutdown, and state-consistency concerns from earlier review rounds.Confidence Score: 5/5
Safe to merge; only P2 findings remain — a misleading test and a minor explicit-value bypass in the settings path.
All previously flagged P0/P1 issues (deadlock, os.Exit lifecycle bypass, silent status error, ToggleServiceFunc nil no-op, unconditional uninstall on reset) have been addressed. The two remaining findings are P2: a test that doesn't actually exercise the context-cancellation path, and an edge-case gap in the explicit-value bool-setting branch. Neither affects production behaviour in the current codebase.
cmd/service_test.go — TestProgramContextCancellation doesn't exercise the cancellation path it claims to test.
Important Files Changed
Prompt To Fix All With AI
Reviews (9): Last reviewed commit: "test: mock command arguments in service ..." | Re-trigger Greptile