Conversation
Add `shelltime daemon status` command that displays: - Socket file existence and connectivity - Service manager status (launchctl on macOS) - Configuration info (socket path, CCOtel, code tracking) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary of ChangesHello @AnnatarHe, 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 introduces 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
|
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 2 files with indirect coverage changes 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request introduces a daemon status command, which is a valuable addition for monitoring the daemon's health. The implementation is well-structured, checking for socket existence, connectivity, and displaying configuration details. I've noted a few areas for improvement to enhance correctness and readability. Specifically, there's a potential issue with how the service manager status is checked, an opportunity to simplify some verbose conditional logic, and a minor output formatting inconsistency. My detailed feedback is in the comments below. Overall, this is a solid and useful feature.
| installer, installerErr := model.NewDaemonInstaller("", "") | ||
| if installerErr == nil { | ||
| if err := installer.Check(); err == nil { | ||
| printSuccess("Service is registered and running") | ||
| } else { | ||
| printWarning("Service is not running via system service manager") | ||
| } | ||
| } |
There was a problem hiding this comment.
Calling model.NewDaemonInstaller with empty strings for baseFolder and username will likely cause the service status check to fail, as the installer needs this information to locate service definition files. You should fetch the current user's details to construct the correct paths, similar to how it's handled in the install and uninstall commands. Note that this change requires importing the os/user and path/filepath packages.
| installer, installerErr := model.NewDaemonInstaller("", "") | |
| if installerErr == nil { | |
| if err := installer.Check(); err == nil { | |
| printSuccess("Service is registered and running") | |
| } else { | |
| printWarning("Service is not running via system service manager") | |
| } | |
| } | |
| // Check 3: Service manager status | |
| if currentUser, err := user.Current(); err == nil { | |
| baseFolder := filepath.Join(currentUser.HomeDir, ".shelltime") | |
| if installer, err := model.NewDaemonInstaller(baseFolder, currentUser.Username); err == nil { | |
| if err := installer.Check(); err == nil { | |
| printSuccess("Service is registered and running") | |
| } else { | |
| printWarning("Service is not running via system service manager") | |
| } | |
| } | |
| } |
| if cfg.CCOtel != nil && cfg.CCOtel.Enabled != nil && *cfg.CCOtel.Enabled { | ||
| fmt.Printf(" CCOtel: enabled (port %d)\n", cfg.CCOtel.GRPCPort) | ||
| } else { | ||
| fmt.Println(" CCOtel: disabled") | ||
| } | ||
|
|
||
| if cfg.CodeTracking != nil && cfg.CodeTracking.Enabled != nil && *cfg.CodeTracking.Enabled { | ||
| fmt.Println(" Code Tracking: enabled") | ||
| } else { | ||
| fmt.Println(" Code Tracking: disabled") | ||
| } |
There was a problem hiding this comment.
The nested nil checks for cfg.CCOtel.Enabled and cfg.CodeTracking.Enabled are verbose and repetitive. You can improve readability by extracting the boolean conditions into variables.
| if cfg.CCOtel != nil && cfg.CCOtel.Enabled != nil && *cfg.CCOtel.Enabled { | |
| fmt.Printf(" CCOtel: enabled (port %d)\n", cfg.CCOtel.GRPCPort) | |
| } else { | |
| fmt.Println(" CCOtel: disabled") | |
| } | |
| if cfg.CodeTracking != nil && cfg.CodeTracking.Enabled != nil && *cfg.CodeTracking.Enabled { | |
| fmt.Println(" Code Tracking: enabled") | |
| } else { | |
| fmt.Println(" Code Tracking: disabled") | |
| } | |
| ccOtelEnabled := cfg.CCOtel != nil && cfg.CCOtel.Enabled != nil && *cfg.CCOtel.Enabled | |
| if ccOtelEnabled { | |
| fmt.Printf(" CCOtel: enabled (port %d)\n", cfg.CCOtel.GRPCPort) | |
| } else { | |
| fmt.Println(" CCOtel: disabled") | |
| } | |
| codeTrackingEnabled := cfg.CodeTracking != nil && cfg.CodeTracking.Enabled != nil && *cfg.CodeTracking.Enabled | |
| if codeTrackingEnabled { | |
| fmt.Println(" Code Tracking: enabled") | |
| } else { | |
| fmt.Println(" Code Tracking: disabled") | |
| } |
| color.Green.Println("Status: Running") | ||
| } else { | ||
| color.Red.Println("Status: Stopped") | ||
| fmt.Println() |
There was a problem hiding this comment.
Summary
shelltime daemon statuscommand to check daemon healthTest plan
shelltime daemon statuswhen daemon is runningshelltime daemon statuswhen daemon is stoppeddoctorcommand🤖 Generated with Claude Code