Skip to content

Conversation

@thelovekesh
Copy link
Collaborator

  • Update http client to use cache round tripper
  • Add content caching for manifests and tarballs
  • Update installer to remove caching layer from it
  • Update registry API client

@thelovekesh thelovekesh added the core changes made in cli core api label Jan 15, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello @thelovekesh, 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 introduces a significant architectural improvement by centralizing content caching within the HTTP client. This change streamlines the package installation process by allowing the installer to rely on a unified and efficient caching layer for registry manifests and tarballs, rather than managing its own. The refactoring enhances performance, reduces redundant network requests, and improves the overall reliability of file operations, especially on platforms like Windows.

Highlights

  • Centralized HTTP Caching: The HTTP client has been refactored to include a new, robust caching mechanism. This new Transport layer handles caching of HTTP GET requests, including metadata, using a file-based system with atomic writes, locking, and versioning. It also incorporates a singleflight pattern to deduplicate concurrent requests for the same resource.
  • Installer Simplification: The package installer's internal caching logic for tarballs has been removed. It now leverages the centralized HTTP client cache, simplifying its implementation and ensuring consistent caching behavior across the application.
  • Registry Client Integration: The registry API client has been updated to utilize the new HTTP caching for fetching package manifests and downloading tarballs. It now explicitly passes caching directives (e.g., X-Save-Cache, X-Cache-Revalidate) to the underlying HTTP client.
  • Improved whoami Command: The whoami command now uses the updated registry client's Whoami method, which benefits from the new HTTP client caching and streamlines token validation.
  • Dependency Updates: The go.mod and go.sum files have been updated to remove github.com/otiai10/copy and github.com/otiai10/mint, as their functionality for directory operations has been replaced by custom, more robust implementations within the installer, including retry logic for Windows compatibility.

🧠 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.

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.

@github-actions
Copy link

📦 wpm cli builds 📦

Copy link

@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 significantly refactors the caching mechanism for API requests, moving from a simple time-to-live file-based cache to a more robust, atomic, and concurrent-safe HTTP cache implemented via a new api.Transport struct. This new cache supports explicit cache control headers like X-Save-Cache and X-Cache-Revalidate, and includes advanced features like single-flight request deduplication, file locking with retries, and atomic file operations with Windows compatibility considerations. Consequently, the cli/command/auth/login.go and cli/command/whoami/whoami.go commands are updated to leverage a centralized wpmCli.RegistryClient() for token validation and API interactions, and now utilize new output.Text for colored CLI messages. The pkg/pm/installer/installer.go is also refactored to remove the otiai10/copy dependency, streamline package installation by directly processing downloaded tarballs into a temporary directory (.tmp) within the content directory, and implement more resilient file operations (rename, remove) with retry logic for Windows. Several WriteString calls across the codebase are updated to explicitly ignore return values, and cache-related configuration fields are consolidated or removed from api.ClientOptions and pkg/config/config.go.


return g.Wait()
err := g.Wait()
os.RemoveAll(i.tmpDir)

Choose a reason for hiding this comment

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

medium

The os.RemoveAll(i.tmpDir) call is made unconditionally after g.Wait(). If g.Wait() returns an error, it might be useful to inspect the contents of i.tmpDir for debugging purposes before it's removed. Consider adding a flag or logging mechanism to preserve tmpDir in case of errors, especially during development or in verbose modes.

@thelovekesh thelovekesh merged commit 43c71b3 into main Jan 15, 2026
15 checks passed
@thelovekesh thelovekesh deleted the improve/network-usage branch January 15, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core changes made in cli core api

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants