Skip to content

Conversation

@haslinghuis
Copy link
Member

@haslinghuis haslinghuis commented Aug 13, 2025

Summary by CodeRabbit

  • New Features

    • CLI now shows a context-aware startup message distinguishing developer vs. regular CLI-only mode.
  • Chores

    • Added an English translation string for the developer-mode CLI message.
    • Expanded localization catalog with a new key to support the developer-mode message and future translations.

@haslinghuis haslinghuis added this to the 11.0 milestone Aug 13, 2025
@haslinghuis haslinghuis self-assigned this Aug 13, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 13, 2025

Walkthrough

Adds i18n key cliDevEnter in locales/en/messages.json and updates src/js/tabs/cli.js to choose between cliDevEnter and cliEnter at CLI startup based on getConfig("cliOnlyMode")?.cliOnlyMode (uses optional chaining).

Changes

Cohort / File(s) Summary
Localization
locales/en/messages.json
Added key cliDevEnter with message "CLI only developer mode detected".
CLI startup messaging
src/js/tabs/cli.js
Updated startup log to use getConfig("cliOnlyMode")?.cliOnlyMode ? "cliDevEnter" : "cliEnter" (optional chaining used). No other initialization logic changed.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant CLI
  participant Config
  participant i18n

  User->>CLI: Open CLI tab
  CLI->>Config: getConfig("cliOnlyMode")
  Config-->>CLI: { cliOnlyMode?: boolean }
  CLI->>i18n: key = cliOnlyMode ? "cliDevEnter" : "cliEnter"
  i18n-->>CLI: Localized message
  CLI-->>User: Display startup message
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Possibly related PRs

Suggested reviewers

  • nerdCopter
  • SupaflyFPV
  • KarateBrot

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5d81715 and af6b5cb.

📒 Files selected for processing (2)
  • locales/en/messages.json (1 hunks)
  • src/js/tabs/cli.js (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • locales/en/messages.json
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/js/tabs/cli.js (3)
src/js/gui_log.js (1)
  • gui_log (7-21)
src/js/localization.js (1)
  • i18n (7-7)
src/js/model.js (1)
  • getConfig (228-228)
🔇 Additional comments (1)
src/js/tabs/cli.js (1)

15-15: LGTM: import alias for getConfig

Importing get as getConfig from ConfigStorage is appropriate and keeps call sites readable.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@haslinghuis haslinghuis moved this to App in 2025.12.0 Aug 13, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
locales/en/messages.json (1)

3394-3396: New i18n key added; consider clearer phrasing

Key addition looks fine. Minor wording nit: “Developer CLI-only mode detected” reads a bit clearer and matches the hyphenation style of “CLI-only”.

Apply this optional diff to tweak the message:

-    "cliDevEnter": {
-        "message": "CLI only developer mode detected"
-    },
+    "cliDevEnter": {
+        "message": "Developer CLI-only mode detected"
+    },
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a80b170 and 5d81715.

📒 Files selected for processing (2)
  • locales/en/messages.json (1 hunks)
  • src/js/tabs/cli.js (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/js/tabs/cli.js (3)
src/js/gui_log.js (1)
  • gui_log (7-21)
src/js/localization.js (1)
  • i18n (7-7)
src/js/model.js (1)
  • getConfig (228-228)
🔇 Additional comments (1)
src/js/tabs/cli.js (1)

479-481: Verify getConfig(“cliOnlyMode”) Shape and Defaults

We’ve searched the codebase for usages of cliOnlyMode and getConfig, but didn’t find a source-level definition of getConfig. Here’s what we observed:

• In src/js/serial_backend.js:
js function isCliOnlyMode() { return getConfig("cliOnlyMode")?.cliOnlyMode === true; }
• In src/js/tabs/cli.js:
js gui_log( i18n.getMessage( getConfig("cliOnlyMode")?.cliOnlyMode ? "cliEnter" : "cliDevEnter" ) );
• In src/js/tabs/options.js:
js const result = getConfig("cliOnlyMode", false); cliOnlyModeElement.prop("checked", !!result.cliOnlyMode);
• No definition of getConfig(...) was found by ripgrep—getConfig must be defined elsewhere (e.g. in model.js or a shared util).

Please manually verify:

  • That getConfig takes a key and optional default value and always returns an object of the form { cliOnlyMode: boolean }.
  • That when no stored setting exists, getConfig("cliOnlyMode") yields { cliOnlyMode: false } (non‐dev behavior).
  • That the second-parameter default (false) is being passed correctly into the underlying getConfig implementation.

Once you’ve located and confirmed the implementation semantics and defaults, update or document getConfig accordingly.

@sonarqubecloud
Copy link

@github-actions
Copy link
Contributor

Preview URL: https://af6b5cb7.betaflight-configurator.pages.dev

@Pancronos
Copy link

image Tested fine. Thanks, with this it will be easier to understand that a developer setting is enabled in options.

@Pancronos
Copy link

Not sure is influent, so just as advice, with virtual connection enabled and dev>cli mode only enabled, goes in cli but there is no message at all in log.

"message": "CLI mode detected"
},
"cliDevEnter": {
"message": "CLI only developer mode detected"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

detected or enabled ?

@haslinghuis haslinghuis merged commit 70bac5c into betaflight:master Aug 14, 2025
8 checks passed
@github-project-automation github-project-automation bot moved this from App to Done in 2025.12.0 Aug 14, 2025
@haslinghuis haslinghuis deleted the clarify-cli-mode branch August 14, 2025 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants