- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 126
chore(cli): add notifications #1682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| WalkthroughWalkthroughThe changes introduce enhancements to the CLI tool, including a new optional  Changes
 Sequence Diagram(s)sequenceDiagram
    participant User
    participant CLI
    participant ConfigService
    User->>CLI: Run command with options
    CLI->>CLI: Check options
    alt Offline mode
        CLI->>CLI: Skip version check and notifications
    else Online mode
        CLI->>CLI: Check version
        CLI->>ConfigService: Fetch notifications
        ConfigService-->>CLI: Return notifications
        CLI->>CLI: Display notification
    end
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit: 
 
 Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
 Other keywords and placeholders
 CodeRabbit Configuration File ( | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (2)
- packages/schema/package.jsonis excluded by- !**/*.json
- pnpm-lock.yamlis excluded by- !**/pnpm-lock.yaml,- !**/*.yaml
Files selected for processing (3)
- packages/schema/src/cli/actions/generate.ts (3 hunks)
- packages/schema/src/cli/cli-util.ts (3 hunks)
- packages/schema/src/cli/index.ts (2 hunks)
Additional comments not posted (9)
packages/schema/src/cli/actions/generate.ts (3)
13-13: LGTM!The code changes are approved.
26-26: LGTM!The code changes are approved.
53-65: LGTM!The code changes are approved for the following reasons:
- The new
offlineoption is correctly handled to prevent the version check and notification from running in offline mode.- The efficiency is improved by executing the promises concurrently using
Promise.all.packages/schema/src/cli/index.ts (2)
100-100: LGTM!The renaming of
noDependencyChecktonoDependencyCheckOptionimproves code clarity.
101-101: LGTM!The addition of the
offlineOptionenhances the usability of the command-line interface by allowing users to run the program in offline mode.packages/schema/src/cli/cli-util.ts (4)
9-9: LGTM!The code changes are approved.
12-12: LGTM!The code changes are approved.
25-26: LGTM!The code changes are approved.
372-400: LGTM!The
showNotificationfunction is a well-implemented addition that enhances the user experience by providing dynamic notifications based on external configuration. The function:
- Uses the Fetch API to retrieve JSON data, applying a timeout mechanism to prevent prolonged waiting.
- Validates the structure of the data using the
zodlibrary, ensuring that the notifications conform to the expected schema.- Filters for active notifications and randomly selects one to display as a terminal link using the
terminal-linkpackage.- Handles errors gracefully by catching exceptions and returning early.
The code changes are approved.
No description provided.