feat(makefile): add platform-specific service restart commands - #418
Conversation
- Add new `services` target that detects OS and calls appropriate service manager - launchctl targets now only run on macOS - Add systemctl targets for Linux (code-syncer, dotfiles-updater, ollama) - Update `switch` target to use platform-aware `services` target 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
📝 WalkthroughSummary by CodeRabbitRelease Notes
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughThe Makefile has been refactored to introduce a platform-agnostic service management abstraction. The Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (4)📓 Common learnings📚 Learning: 2025-11-25T09:35:01.066ZApplied to files:
📚 Learning: 2025-11-25T09:34:40.062ZApplied to files:
📚 Learning: 2025-11-25T09:34:40.062ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
🔇 Additional comments (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @shunkakinoki, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the Makefile's cross-platform compatibility by introducing a new Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
You do not have enough credits to review this pull request. Please purchase more credits to continue. |
Mesa DescriptionTL;DRAdded a new What changed?
Description generated by Mesa. Update settings |
There was a problem hiding this comment.
Code Review
This pull request is a great step towards unifying the service management across different operating systems by introducing a platform-aware services target. The implementation is mostly correct, but I've found a critical issue where a macOS-only service is targeted on Linux, which would cause failures. I've also suggested adding a few missing Linux services for consistency with the macOS implementation and improving the handling of unsupported operating systems. With these corrections, the changes will be robust and work as intended.
| systemctl: systemctl-code-syncer systemctl-dotfiles-updater systemctl-ollama ## Restart all systemd user services. | ||
|
|
||
| .PHONY: systemctl-code-syncer | ||
| systemctl-code-syncer: ## Restart code-syncer systemd user service. | ||
| @echo "🔄 Restarting code-syncer..." | ||
| @systemctl --user restart code-syncer.service || true | ||
| @echo "✅ code-syncer restarted" | ||
|
|
||
| .PHONY: systemctl-dotfiles-updater | ||
| systemctl-dotfiles-updater: ## Restart dotfiles-updater systemd user service. | ||
| @echo "🔄 Restarting dotfiles-updater..." | ||
| @systemctl --user restart dotfiles-updater.service || true | ||
| @echo "✅ dotfiles-updater restarted" | ||
|
|
||
| .PHONY: systemctl-ollama | ||
| systemctl-ollama: ## Restart ollama systemd user service. | ||
| @echo "🔄 Restarting ollama..." | ||
| @systemctl --user restart ollama.service || true | ||
| @echo "✅ ollama restarted" |
There was a problem hiding this comment.
The new systemctl targets have some inconsistencies with the available services defined in the Nix configurations.
- Incorrect Service: The
code-syncerservice is macOS-only, so thesystemctl-code-syncertarget will fail on Linux and should be removed. - Missing Services: The
cliproxyapiandneverssl-keepaliveservices have Linux implementations but are missing correspondingsystemctl-*targets and are not included in the mainsystemctlaggregate target.
To fix this and align with the launchctl targets, the systemctl targets should be updated. I've also sorted them alphabetically for better readability.
systemctl: systemctl-cliproxyapi systemctl-dotfiles-updater systemctl-neverssl-keepalive systemctl-ollama ## Restart all systemd user services.
.PHONY: systemctl-cliproxyapi
systemctl-cliproxyapi: ## Restart cliproxyapi systemd user service.
@echo "🔄 Restarting cliproxyapi..."
@systemctl --user restart cliproxyapi.service || true
@echo "✅ cliproxyapi restarted"
.PHONY: systemctl-dotfiles-updater
systemctl-dotfiles-updater: ## Restart dotfiles-updater systemd user service.
@echo "🔄 Restarting dotfiles-updater..."
@systemctl --user restart dotfiles-updater.service || true
@echo "✅ dotfiles-updater restarted"
.PHONY: systemctl-neverssl-keepalive
systemctl-neverssl-keepalive: ## Restart neverssl-keepalive systemd user service.
@echo "🔄 Restarting neverssl-keepalive..."
@systemctl --user restart neverssl-keepalive.service || true
@echo "✅ neverssl-keepalive restarted"
.PHONY: systemctl-ollama
systemctl-ollama: ## Restart ollama systemd user service.
@echo "🔄 Restarting ollama..."
@systemctl --user restart ollama.service || true
@echo "✅ ollama restarted"
| @if [ "$(OS)" = "Darwin" ]; then \ | ||
| $(MAKE) launchctl; \ | ||
| elif [ "$(OS)" = "Linux" ]; then \ | ||
| $(MAKE) systemctl; \ | ||
| fi |
There was a problem hiding this comment.
It's good practice to handle the case where $(OS) is neither "Darwin" nor "Linux". Adding an else clause to the conditional would provide clearer feedback to users on unsupported operating systems, preventing silent failures or confusion.
@if [ "$(OS)" = "Darwin" ]; then \
$(MAKE) launchctl; \
elif [ "$(OS)" = "Linux" ]; then \
$(MAKE) systemctl; \
else \
echo "No platform-specific services to restart for OS $(OS)"; \
fi
There was a problem hiding this comment.
Pull request overview
This PR adds platform-specific service restart commands to the Makefile, enabling cross-platform support for managing system services. The switch target now automatically detects the operating system (macOS or Linux) and calls the appropriate service manager (launchctl or systemd).
Key Changes
- Introduced a new
servicestarget that performs OS detection and delegates to platform-specific targets - Added systemctl targets for Linux to restart user services (code-syncer, dotfiles-updater, ollama)
- Updated the
switchtarget to use the platform-awareservicestarget instead of directly callinglaunchctl
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ##@ Systemd Services (Linux) | ||
|
|
||
| .PHONY: systemctl | ||
| systemctl: systemctl-code-syncer systemctl-dotfiles-updater systemctl-ollama ## Restart all systemd user services. |
There was a problem hiding this comment.
The systemctl target only restarts 3 services (code-syncer, dotfiles-updater, ollama) while the launchctl target restarts 6 services (brew-upgrader, cliproxyapi, code-syncer, dotfiles-updater, neverssl-keepalive, ollama). This creates platform inconsistency where macOS users get more services restarted than Linux users when running 'make switch'. Either add the missing systemctl targets for brew-upgrader, cliproxyapi, and neverssl-keepalive, or document why these services are macOS-only.
Summary
servicestarget that detects OS and calls appropriate service managerswitchtarget to use platform-awareservicestargetTest plan
make switchworks correctly on macOS (calls launchctl targets)make switchworks correctly on Linux (calls systemctl targets)make systemctl-*targets work on Linux🤖 Generated with Claude Code
Summary by cubic
Adds a platform-aware services target so make switch restarts the right user services on each OS. On macOS it uses launchctl; on Linux it uses systemd user units.
Written for commit ef6fa03. Summary will update automatically on new commits.