feat(cli): add gateway restart command#108
Conversation
|
Warning Review limit reached
Next review available in: 51 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. 📝 WalkthroughWalkthroughAdds a cross-platform ChangesGateway restart command
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant PushCLI
participant restart_gateway
participant ServiceManager
PushCLI->>restart_gateway: Parse and dispatch "restart"
restart_gateway->>ServiceManager: Restart launchd or systemd gateway
ServiceManager-->>restart_gateway: Return exit status
restart_gateway-->>PushCLI: Print success or return error
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Greptile SummaryThis PR adds a
Confidence Score: 5/5Safe to merge — the new restart command is well-scoped, correctly constructs the platform-specific service manager invocation, and is covered by both unit and integration tests. The implementation is straightforward: hardcoded service names, digit-only UID validation before embedding in a launchctl path, and a runner-injection pattern that keeps execution and construction testable independently. No config is read or written by this command, so the risk surface is narrow. Documentation changes are accurate and consistent with the code. No files require special attention. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant User
participant push CLI
participant effective_user_id
participant id_cmd as id (macOS only)
participant svc_mgr as launchctl / systemctl
User->>push CLI: push restart
push CLI->>effective_user_id: get UID (macOS only)
effective_user_id->>id_cmd: id -u
id_cmd-->>effective_user_id: "501"
effective_user_id-->>push CLI: Some("501")
push CLI->>push CLI: build PlatformCommand
Note over push CLI: macOS: launchctl kickstart -k gui/501/com.owainlewis.push<br/>Linux: systemctl --user restart push.service
push CLI->>svc_mgr: spawn process
svc_mgr-->>push CLI: exit status
alt success
push CLI-->>User: Restarted the Push gateway.
else failure
push CLI-->>User: error with command + exit status
end
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant User
participant push CLI
participant effective_user_id
participant id_cmd as id (macOS only)
participant svc_mgr as launchctl / systemctl
User->>push CLI: push restart
push CLI->>effective_user_id: get UID (macOS only)
effective_user_id->>id_cmd: id -u
id_cmd-->>effective_user_id: "501"
effective_user_id-->>push CLI: Some("501")
push CLI->>push CLI: build PlatformCommand
Note over push CLI: macOS: launchctl kickstart -k gui/501/com.owainlewis.push<br/>Linux: systemctl --user restart push.service
push CLI->>svc_mgr: spawn process
svc_mgr-->>push CLI: exit status
alt success
push CLI-->>User: Restarted the Push gateway.
else failure
push CLI-->>User: error with command + exit status
end
Reviews (2): Last reviewed commit: "fix(test): avoid shell path interpolatio..." | Re-trigger Greptile |
Summary
push restartfor managed gateway servicescom.owainlewis.pushwith launchd on macOS andpush.servicewith user systemd on LinuxWhy
Config changes currently require users to remember the platform-specific service-manager command. This adds one Push command that restarts the documented managed gateway.
Test plan
cargo fmt --checkcargo clippy --all-targets --all-features -- -D warningscargo test(264 tests passed)uv run --with-requirements requirements-docs.txt mkdocs build --strictgit diff --checkRisks
The command targets the documented fixed launchd label and systemd user unit. Custom service names are not selected by
--config.Related issue
None.
Summary by CodeRabbit
New Features
push restartcommand to restart the managed Push gateway on macOS and Linux.Documentation