Skip to content

refactor(gcli): clean up and overhaul most parts of gcli#5057

Merged
liferooter merged 38 commits intomasterfrom
gs/gcli/overhaul-except-wallet
Jan 29, 2026
Merged

refactor(gcli): clean up and overhaul most parts of gcli#5057
liferooter merged 38 commits intomasterfrom
gs/gcli/overhaul-except-wallet

Conversation

@liferooter
Copy link
Copy Markdown
Contributor

@liferooter liferooter commented Jan 6, 2026

  • Refactor and clean up parts of gcli except the one connected with gring
  • Use FromStr/Display implementations for hex-like types instead of manual usage of hex
  • Clean up gcli CLI
  • Mostly unify gcli output
  • Fix the last parts of misadaptation to recent gsdk changes in gcli
  • Restructure gcli crate from lib + named binary to lib + binary
  • Make gcli tests more straightforward, remove advanced wrapper around gcli from them
  • Remove gcli tests as redundant. gcli is a CLI wrapper around gsdk, no need to test gsdk again

@liferooter liferooter requested a review from ark0f January 6, 2026 10:18
@liferooter liferooter added A0-pleasereview PR is ready to be reviewed by the team D5-tooling Helper tools and utilities labels Jan 6, 2026
@semanticdiff-com
Copy link
Copy Markdown

semanticdiff-com Bot commented Jan 6, 2026

Review changes with  SemanticDiff

Changed Files
File Status
  gcli/src/cmd/wallet.rs  64% smaller
  gcli/src/cmd/claim.rs  48% smaller
  gcli/src/cmd/new.rs  46% smaller
  gcli/src/main.rs  44% smaller
  gcli/src/template.rs  43% smaller
  gcli/src/cmd/reply.rs  35% smaller
  gcli/src/cmd/send.rs  35% smaller
  gcli/src/cmd/transfer.rs  34% smaller
  gcli/src/cmd/mod.rs  27% smaller
  gcli/src/cmd/config.rs  18% smaller
  gcli/src/cmd/info.rs  17% smaller
  utils/gring/src/keyring.rs  15% smaller
  gcli/src/cmd/update.rs  15% smaller
  gcli/src/app.rs  7% smaller
  gcli/src/utils.rs  6% smaller
  gcli/src/cmd/read_state.rs  6% smaller
  gcli/tests/smoke.rs  2% smaller
  gcli/src/cli.rs  2% smaller
  Cargo.lock Unsupported file format
  Cargo.toml Unsupported file format
  gcli/Cargo.toml Unsupported file format
  gcli/src/cmd/create.rs  0% smaller
  gcli/src/cmd/create_program.rs  0% smaller
  gcli/src/cmd/program.rs  0% smaller
  gcli/src/cmd/upload.rs  0% smaller
  gcli/src/cmd/upload_code.rs  0% smaller
  gcli/src/embed.rs  0% smaller
  gcli/src/lib.rs Unsupported file format
  gcli/tests/cmd/claim.rs  0% smaller
  gcli/tests/cmd/info.rs  0% smaller
  gcli/tests/cmd/mod.rs  0% smaller
  gcli/tests/cmd/reply.rs  0% smaller
  gcli/tests/cmd/send.rs  0% smaller
  gcli/tests/cmd/transfer.rs  0% smaller
  gcli/tests/cmd/upload.rs  0% smaller
  gcli/tests/common/args.rs  0% smaller
  gcli/tests/common/mod.rs  0% smaller
  gcli/tests/gear.rs  0% smaller
  gcli/tests/util.rs  0% smaller
  node/cli/src/cli.rs  0% smaller
  node/cli/src/command.rs  0% smaller

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @liferooter, 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 undertakes a comprehensive refactor of the gcli command-line interface, focusing on improving its internal architecture and external usability. The changes aim to make the tool more intuitive for users, easier to maintain for developers, and more consistent in its operations and output. Key areas of improvement include a streamlined application core, a more logical command structure, and enhanced handling of data types, alongside a general cleanup of the codebase and testing infrastructure.

Highlights

  • Refactored Application Structure: The core gcli application logic has been significantly refactored, replacing the App trait with dedicated Opts and App structs. This change streamlines how CLI options are handled and centralizes application state management, leading to a more modular and maintainable codebase.
  • Overhauled CLI Commands and Output: Many gcli commands have been renamed, restructured, or replaced to improve clarity and consistency. For instance, program is now ask-state, create and upload are replaced by deploy and upload-code. Output messages across various commands have been standardized and enhanced with colorization for better user experience.
  • Improved Hex-like Type Handling: A new HexBytes struct has been introduced, leveraging derive_more to provide robust and convenient handling of hex-encoded byte arrays. This replaces manual hex::decode and to_hash calls, simplifying code and reducing potential errors when working with cryptographic IDs and payloads.
  • Restructured gcli Crate: The gcli crate has been restructured from a lib + named binary to a standalone binary. This simplifies the project's build process and clarifies its role as a command-line tool rather than a reusable library.
  • Simplified Testing Framework: The internal testing utilities have been simplified, removing helper structs like Args and consolidating NodeExec functionality. Tests now directly interact with the gcli binary using tokio::process::Command, making them more straightforward and robust.
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.

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

  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.

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 is a significant and well-executed refactoring of the gcli crate. The changes greatly improve the codebase by restructuring it from a library to a binary, cleaning up the CLI, unifying output, and improving type safety with FromStr/Display implementations for hex-like types. The test suite has also been modernized, which is a welcome improvement.

My review has identified a few points for further improvement. I've found a critical portability issue in the update command that would prevent it from compiling on non-Unix platforms. Additionally, there are a few opportunities to enhance code clarity and maintainability, a minor performance improvement by removing a redundant clone, and some inconsistencies in output logging. I've also flagged a test that appears to be outdated and will likely fail.

Overall, this is a high-quality contribution that moves gcli in a very positive direction. Addressing the points in my review will help ensure the tool is robust, portable, and even more maintainable.

Comment thread gcli/src/cmd/update.rs Outdated
Comment thread gcli/src/app.rs Outdated
Comment thread gcli/src/app.rs Outdated
Comment thread gcli/src/cmd/info.rs Outdated
Comment thread gcli/src/cmd/upload_code.rs Outdated
Comment thread gcli/tests/cmd/upload_code.rs Outdated
Comment thread gcli/src/cmd/config.rs
Copy link
Copy Markdown
Member

@ark0f ark0f left a comment

Choose a reason for hiding this comment

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

Consider to use trycmd crate for CLI testing. Some commands have quite complex logic

Comment thread gcli/examples/mycli.rs
Comment thread gcli/tests/cmd/info.rs Outdated
Comment thread gcli/src/cmd/ask_state.rs Outdated
Comment thread gcli/src/app.rs
Comment thread gcli/src/cmd/transfer.rs
Comment thread gcli/src/cmd/deploy.rs Outdated
Comment thread gcli/src/cmd/config.rs Outdated
Comment thread gcli/Cargo.toml
@liferooter liferooter merged commit f4865b5 into master Jan 29, 2026
32 checks passed
@liferooter liferooter deleted the gs/gcli/overhaul-except-wallet branch January 29, 2026 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A0-pleasereview PR is ready to be reviewed by the team D5-tooling Helper tools and utilities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants