kloudlite / kl

Kloudlite CLI Client
GNU Affero General Public License v3.0
5 stars 1 forks source link

workspace wireguard status #165

Closed nxtcoder36 closed 2 weeks ago

nxtcoder36 commented 2 weeks ago

Summary by Sourcery

Enhance the Zsh configuration to dynamically update the right prompt based on online status and modify the start script to include a new online check script.

Enhancements:

sourcery-ai[bot] commented 2 weeks ago

Reviewer's Guide by Sourcery

This pull request implements a Wireguard status indicator in the workspace environment. It modifies the .zshrc file to display an "offline" status in the right prompt when the Wireguard connection is not active, and updates the start.sh script to initialize and run a background process for checking the online status.

Sequence diagram for Wireguard status check initialization

sequenceDiagram
    participant StartScript as start.sh
    participant CheckOnline as .check-online
    participant BackgroundProcess as Background Process

    StartScript->>CheckOnline: Copy .check-online to home directory
    StartScript->>BackgroundProcess: Run .check-online in background
    BackgroundProcess-->>StartScript: Check online status
    Note right of BackgroundProcess: Updates /tmp/kl/online.status

Class diagram for .zshrc modifications

classDiagram
    class Zshrc {
        +update_rprompt()
        +TRAPALRM()
        +precmd()
        +add-zsh-hook precmd update_rprompt
        +TMOUT = 1
    }
    Zshrc : update_rprompt() -- updates the right prompt based on online status
    Zshrc : TRAPALRM() -- triggers update_rprompt
    Zshrc : precmd() -- checks hash and updates prompt symbol
    Zshrc : TMOUT -- sets timeout for prompt update

File-Level Changes

Change Details Files
Implement Wireguard status indicator in zsh prompt
  • Add function to update right prompt (RPROMPT) based on online status
  • Set up zsh hook to call update function before each command
  • Implement TRAPALRM function to update status periodically
  • Modify precmd function to include status update
  • Set TMOUT variable for periodic updates
klbox-docker/.zshrc
Initialize and run online status check in workspace startup
  • Copy .check-online file to user's home directory during initialization
  • Add command to run .check-online script in background at startup
klbox-docker/start.sh
Remove unnecessary shebang and empty line from .zshrc
  • Delete '#!/bin/zsh' line
  • Remove an empty line at the beginning of the file
klbox-docker/.zshrc

Tips and commands #### Interacting with Sourcery - **Trigger a new review:** Comment `@sourcery-ai review` on the pull request. - **Continue discussions:** Reply directly to Sourcery's review comments. - **Generate a GitHub issue from a review comment:** Ask Sourcery to create an issue from a review comment by replying to it. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) to: - Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others. - Change the review language. - Add, remove or edit custom review instructions. - Adjust other review settings. #### Getting Help - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).