Skip to content

[cli] move public C APIs to dedicated cli_api.cpp#13016

Merged
jwhui merged 1 commit into
openthread:mainfrom
abtink:cli/def-cli-app-src
Apr 30, 2026
Merged

[cli] move public C APIs to dedicated cli_api.cpp#13016
jwhui merged 1 commit into
openthread:mainfrom
abtink:cli/def-cli-app-src

Conversation

@abtink
Copy link
Copy Markdown
Member

@abtink abtink commented Apr 30, 2026

This commit moves the public C APIs for the CLI from cli.cpp to a new dedicated file cli_api.cpp.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 improves the codebase organization by decoupling the public C API definitions from the main CLI implementation file. By moving these functions to a dedicated file, the project achieves better modularity and cleaner separation of concerns within the CLI module.

Highlights

  • Code Refactoring: Moved all public C API implementations from cli.cpp to a new dedicated file named cli_api.cpp.
  • Build System Updates: Updated BUILD.gn, CMakeLists.txt, and radio.cmake to include the new cli_api.cpp file in the build process.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@abtink abtink force-pushed the cli/def-cli-app-src branch from f743532 to 8be43ee Compare April 30, 2026 06:42
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the CLI implementation by moving the public C APIs from cli.cpp into a new dedicated file, cli_api.cpp. Corresponding updates were made to the GN and CMake build files to include the new source file in the build process. I have no feedback to provide.

This commit moves the public C APIs for the CLI from `cli.cpp` to
a new dedicated file `cli_api.cpp`.
@abtink abtink force-pushed the cli/def-cli-app-src branch from 8be43ee to c0f3c79 Compare April 30, 2026 06:58
@github-actions
Copy link
Copy Markdown

Merging #13016 into main

name branch text data bss total
ot-cli-ftd 7319d40 483160 860 66548 550568
89ff964 483160 860 66548 550568
+/- +0 +0 +0 +0
ot-ncp-ftd 7319d40 448836 764 61784 511384
89ff964 448836 764 61784 511384
+/- +0 +0 +0 +0
ot-cli-mtd 7319d40 375216 764 50972 426952
89ff964 375216 764 50972 426952
+/- +0 +0 +0 +0
ot-ncp-mtd 7319d40 356164 764 46240 403168
89ff964 356164 764 46240 403168
+/- +0 +0 +0 +0
ot-cli-ftd-br 7319d40 599984 864 136732 737580
89ff964 600000 864 136732 737596
+/- +16 +0 +0 +16
ot-rcp 7319d40 63344 568 20804 84716
89ff964 63344 568 20804 84716
+/- +0 +0 +0 +0
Library files
name branch text data bss total
libopenthread-ftd.a 7319d40 251143 95 40327 291565
89ff964 251143 95 40327 291565
+/- +0 +0 +0 +0
libopenthread-cli-ftd.a 7319d40 61833 0 8091 69924
89ff964 61833 0 8091 69924
+/- +0 +0 +0 +0
libopenthread-ncp-ftd.a 7319d40 33511 0 5948 39459
89ff964 33511 0 5948 39459
+/- +0 +0 +0 +0
libopenthread-mtd.a 7319d40 169773 0 24783 194556
89ff964 169773 0 24783 194556
+/- +0 +0 +0 +0
libopenthread-cli-mtd.a 7319d40 41569 0 8059 49628
89ff964 41569 0 8059 49628
+/- +0 +0 +0 +0
libopenthread-ncp-mtd.a 7319d40 25807 0 5948 31755
89ff964 25807 0 5948 31755
+/- +0 +0 +0 +0
libopenthread-ftd-br.a 7319d40 369001 99 110471 479571
89ff964 369001 99 110471 479571
+/- +0 +0 +0 +0
libopenthread-cli-ftd-br.a 7319d40 81040 0 8131 89171
89ff964 81040 0 8131 89171
+/- +0 +0 +0 +0
libopenthread-rcp.a 7319d40 9946 0 5060 15006
89ff964 9946 0 5060 15006
+/- +0 +0 +0 +0
libopenthread-radio.a 7319d40 19939 0 238 20177
89ff964 19939 0 238 20177
+/- +0 +0 +0 +0

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

❌ Patch coverage is 25.00000% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.66%. Comparing base (7319d40) to head (c0f3c79).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/cli/cli_api.cpp 25.00% 15 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13016      +/-   ##
==========================================
+ Coverage   69.01%   72.66%   +3.65%     
==========================================
  Files         695      699       +4     
  Lines       98523    94059    -4464     
==========================================
+ Hits        67992    68347     +355     
+ Misses      30531    25712    -4819     
Files with missing lines Coverage Δ
src/cli/cli.cpp 64.14% <ø> (+16.12%) ⬆️
src/cli/cli.hpp 75.00% <ø> (ø)
src/cli/cli_api.cpp 25.00% <25.00%> (ø)

... and 114 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@abtink abtink marked this pull request as ready for review April 30, 2026 16:41
@jwhui jwhui merged commit 54dd6f0 into openthread:main Apr 30, 2026
126 of 127 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants