Skip to content

feat(pm): utoo ping#2599

Open
elrrrrrrr wants to merge 4 commits intonextfrom
fix/pm-run-ping
Open

feat(pm): utoo ping#2599
elrrrrrrr wants to merge 4 commits intonextfrom
fix/pm-run-ping

Conversation

@elrrrrrrr
Copy link
Contributor

@elrrrrrrr elrrrrrrr commented Feb 12, 2026

  • 🧶 Add new utoo ping command - similar to npm ping, it displays registry latency and returns whether semver is supported.
  • ♻️ Refactor existing config.rs module
    1. Configuration read/write operations through config_file.rs
    2. Runtime configuration exposed through user_config.rs
  • 🤖 Auto-detect registry semver support - No longer hardcoded, persistent results stored in config.toml
image

@elrrrrrrr elrrrrrrr added the A-Pkg Manager Area: Package Manager label Feb 12, 2026
- Fix run_script to accept cwd parameter instead of using std::env::current_dir()
- Add ping command to check npm registry connectivity

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @elrrrrrrr, 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 significantly enhances the utoo package manager by introducing a new ping command for network diagnostics and improving configuration management. The configuration system has been refactored to separate file-based operations from runtime access, leading to a cleaner and more maintainable codebase. A key improvement is the automatic detection and caching of registry semver support, which streamlines package resolution by adapting to different registry capabilities without manual configuration.

Highlights

  • New utoo ping command: Introduced a command similar to npm ping to measure registry latency and display semver support.
  • Configuration Module Refactor: The config.rs module was split into config_file.rs for file operations and user_config.rs for runtime configuration and getters.
  • Auto-detect Registry Semver Support: The system now automatically detects and caches whether a registry supports semver queries, storing results in config.toml.
Changelog
  • crates/pm/src/cmd/config.rs
    • Updated the Config import to config_file.
    • Added functionality to list array configurations.
  • crates/pm/src/cmd/mod.rs
    • Added the new ping module to the command list.
  • crates/pm/src/cmd/ping.rs
    • Implemented the ping command, which measures registry latency and detects semver support.
  • crates/pm/src/cmd/run.rs
    • Refactored run_script to accept the current working directory (cwd) as an argument, reducing reliance on std::env::current_dir().
    • Updated test calls to pass cwd explicitly.
  • crates/pm/src/cmd/view.rs
    • Updated the get_registry import to use the new user_config module.
  • crates/pm/src/constants.rs
    • Added constants for the new ping command, including its name, alias, and description.
  • crates/pm/src/helper/auto_update.rs
    • Updated the get_registry import to use the new user_config module.
  • crates/pm/src/helper/fs.rs
    • Updated configuration imports to use user_config.
    • Added supports_semver to BuildDepsOptions context.
    • Modified the registry() builder to conditionally apply semver support.
  • crates/pm/src/helper/lock.rs
    • Updated the get_legacy_peer_deps import to use the new user_config module.
  • crates/pm/src/helper/tree_builder.rs
    • Updated the get_legacy_peer_deps import to use the new user_config module.
  • crates/pm/src/main.rs
    • Updated configuration imports to use user_config and config_file.
    • Integrated the new ping command into the CLI.
    • Adjusted config loading to use config_file.
  • crates/pm/src/service/binary.rs
    • Updated the get_registry import to use the new user_config module.
  • crates/pm/src/service/config.rs
    • Updated the Config import to use config_file.
  • crates/pm/src/service/install.rs
    • Updated the get_omit import to use the new user_config module.
  • crates/pm/src/util/cache.rs
    • Updated the get_cache_dir import to use the new user_config module.
  • crates/pm/src/util/config_file.rs
    • Added a new module containing the Config struct for handling file-based configuration (loading, saving, setting, getting values and arrays).
  • crates/pm/src/util/mod.rs
    • Updated module declarations to reflect the config_file and user_config split.
  • crates/pm/src/util/registry.rs
    • Modified PingResult and ping_registry to be public, allowing their use by other modules.
  • crates/pm/src/util/user_config.rs
    • Renamed from config.rs.
    • Refactored to manage runtime configuration values.
    • Introduced SUPPORTS_SEMVER for caching semver support.
    • Added detect_supports_semver function for probing registry semver capabilities.
    • Updated set_registry to trigger semver detection upon registry change.
  • crates/ruborist/src/service/api.rs
    • Added a supports_semver field to BuildDepsOptions to allow explicit control over semver resolution behavior.
  • crates/ruborist/src/service/registry.rs
    • Added a supports_semver field to UnifiedRegistryBuilder to configure semver support for the registry client.
    • Modified build method to use the explicit supports_semver value or default based on is_npm_registry.
  • crates/utoo-wasm/src/deps.rs
    • Added supports_semver to the BuildDepsOptions when building dependencies.
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request yet.
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
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 introduces a new ping command, which is a great addition for diagnosing registry issues. The refactoring of the configuration logic into config_file.rs and user_config.rs is a significant improvement for code clarity and maintainability. I also appreciate the automatic detection of registry semver support, which enhances the tool's intelligence. The changes are well-implemented, and I have only a couple of minor suggestions for improvement.

.cloned()
.unwrap_or_default();
entries.push(new_entry);
let _ = config.set_array("supports-semver", entries, true);
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The Result from config.set_array is being ignored. If saving the configuration fails (e.g., due to file permissions), the error will be silently swallowed. This would cause the application to re-run the network probe on every execution, which is inefficient. It's better to handle this Result, at least by logging a warning if it fails.

Suggested change
let _ = config.set_array("supports-semver", entries, true);
if let Err(e) = config.set_array("supports-semver", entries, true) {
tracing::warn!("Failed to save semver support to config: {}", e);
}

@elrrrrrrr elrrrrrrr force-pushed the fix/pm-run-ping branch 4 times, most recently from 014304d to 746e7c9 Compare February 12, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Pkg Manager Area: Package Manager

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant