Skip to content

[ide-mode] Create an IDE manager class to handle connecting to and exposing methods from the IDE server#4797

Merged
chrstnb merged 13 commits intomainfrom
cb/idemanager
Jul 25, 2025
Merged

[ide-mode] Create an IDE manager class to handle connecting to and exposing methods from the IDE server#4797
chrstnb merged 13 commits intomainfrom
cb/idemanager

Conversation

@chrstnb
Copy link
Copy Markdown
Contributor

@chrstnb chrstnb commented Jul 24, 2025

TLDR

This is an incremental change towards an extensible implementation.

  • Abstracts the underlying implementation of the IDE server, allowing us to support integrations outside of MCP servers
  • Centralizes logic surrounding IDE mode so we can do more/custom handling as things progress

This uses its own mcp client to connect to the IDE server to decouple this from the user-installed MCP implementation-- we may want to expose this MCP server as part of the other MCP servers to the model in the future, but an alternative implementation is to define a tool the model can use.

In follow-ups:

  • Add support for server re-tries and potentially reading the port from a file-- this will allow us to dynamically load the MCP server even if the terminal was created prior to the IDE writing to the port (this happens often in VSCode).
  • Expose functions like openFileDiff, likely in a tool
  • Add a transport/protocol for MCP servers that are compatible with this implementation

Reviewer Test Plan

Test out the current IDE mode and ensure everything still works.

Testing Matrix

🍏 🪟 🐧
npm run
npx
Docker
Podman - -
Seatbelt - -

Linked issues / bugs

#4800

@chrstnb chrstnb requested a review from a team as a code owner July 24, 2025 17:37
@chrstnb chrstnb requested a review from skeshive July 24, 2025 17:37
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.

Summary of Changes

Hello @chrstnb, 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 dedicated IdeModeManager class to centralize and abstract the logic for connecting to and managing the IDE server. This significant refactoring decouples the IDE integration from the general MCP server configuration and client handling, leading to a more extensible, maintainable, and robust IDE mode implementation. It also streamlines how the CLI reports the IDE connection status.

Highlights

  • Centralized IDE Mode Management: A new IdeModeManager class has been introduced in packages/core/src/ide/ide-mode-manager.ts. This class encapsulates all logic related to connecting to the IDE server, managing its connection status, and handling IDE-specific notifications (like OpenFilesNotificationSchema). It uses its own MCP client to connect to the IDE server, decoupling this integration from the general MCP server configuration.
  • Decoupled IDE Server Configuration: The manual configuration of the IDE server connection, previously handled within packages/cli/src/config/config.ts based on ideMode and environment variables, has been removed. This logic is now managed entirely by the new IdeModeManager, simplifying the main configuration flow.
  • Simplified IDE Status Reporting: The ide status command in the CLI (packages/cli/src/ui/commands/ideCommand.ts and its tests) has been refactored to use the IdeModeManager's getConnectionStatus() method and the new IDEConnectionStatus enum. This streamlines the status reporting logic and provides clearer connection states (Connected, Disconnected, Connecting).
  • Refactored MCP Client for IDE: The general mcp-client.ts in packages/core/src/tools/ no longer contains IDE-specific connection and notification handling. This responsibility has been fully transferred to the IdeModeManager, ensuring a cleaner separation of concerns.
  • IDE Tool Renaming: The VS Code IDE companion server (packages/vscode-ide-companion/src/ide-server.ts) has updated the name of one of its exposed tools from getOpenFiles to getActiveFile, indicating a more precise capability for retrieving the currently active file.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 or fill out our survey to provide feedback.

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 introduces a new IdeModeManager class to abstract and centralize the logic for connecting to the IDE server. This is a great architectural improvement that decouples the IDE-specific logic from the generic MCP client implementation. The refactoring across the codebase to use this new manager is clean and well-executed.

My review focuses on enhancing the robustness of the new IdeModeManager. I've identified a couple of areas where error handling can be improved to prevent silent failures, which are critical for maintainability and debugging.

Comment thread packages/core/src/ide/ide-mode-manager.ts
Comment thread packages/core/src/ide/ide-mode-manager.ts
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jul 24, 2025

Code Coverage Summary

Package Lines Statements Functions Branches
CLI 71.21% 71.21% 79.17% 80.97%
Core 71.08% 71.08% 73.45% 80.44%
CLI Package - Full Text Report
-------------------|---------|----------|---------|---------|-------------------
File               | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
-------------------|---------|----------|---------|---------|-------------------
All files          |   71.21 |    80.97 |   79.17 |   71.21 |                   
 src               |   48.81 |    65.21 |      50 |   48.81 |                   
  gemini.tsx       |   19.68 |     12.5 |      20 |   19.68 | ...56-273,278-327 
  ...ractiveCli.ts |   91.36 |    67.85 |     100 |   91.36 | ...43,146,169-170 
  ...ActiveAuth.ts |     100 |      100 |     100 |     100 |                   
 src/acp           |    1.73 |        0 |       0 |    1.73 |                   
  acp.ts           |    2.79 |        0 |       0 |    2.79 | ...98-225,228-271 
  acpPeer.ts       |     1.4 |        0 |       0 |     1.4 | 33-48,51-674      
 src/config        |   88.47 |    81.59 |   83.87 |   88.47 |                   
  auth.ts          |     100 |      100 |     100 |     100 |                   
  config.ts        |   97.34 |    87.09 |    62.5 |   97.34 | ...35,285,436-440 
  extension.ts     |   81.96 |    84.37 |     100 |   81.96 | ...97-101,110-111 
  sandboxConfig.ts |   54.05 |       50 |   66.66 |   54.05 | ...43,53-69,74-91 
  settings.ts      |   87.22 |    79.72 |   92.85 |   87.22 | ...61-362,402-403 
 src/generated     |     100 |      100 |     100 |     100 |                   
  git-commit.ts    |     100 |      100 |     100 |     100 |                   
 src/patches       |       0 |        0 |       0 |       0 |                   
  is-in-ci.ts      |       0 |        0 |       0 |       0 | 1-17              
 src/services      |   93.27 |    89.47 |    90.9 |   93.27 |                   
  ...mandLoader.ts |     100 |      100 |     100 |     100 |                   
  ...andService.ts |     100 |      100 |     100 |     100 |                   
  ...mandLoader.ts |   90.14 |    88.46 |     100 |   90.14 | 129-134,192-199   
  types.ts         |       0 |        0 |       0 |       0 | 1                 
 ...mpt-processors |     100 |      100 |     100 |     100 |                   
  ...tProcessor.ts |     100 |      100 |     100 |     100 |                   
  types.ts         |     100 |      100 |     100 |     100 |                   
 src/test-utils    |     100 |      100 |     100 |     100 |                   
  ...andContext.ts |     100 |      100 |     100 |     100 |                   
 src/ui            |   59.65 |    67.05 |   73.91 |   59.65 |                   
  App.tsx          |   56.21 |    59.42 |    62.5 |   56.21 | ...13-924,947-976 
  colors.ts        |   87.75 |      100 |      80 |   87.75 | 12-13,18-19,48-49 
  constants.ts     |     100 |      100 |     100 |     100 |                   
  types.ts         |     100 |      100 |     100 |     100 |                   
 src/ui/commands   |   93.88 |    87.25 |   97.43 |   93.88 |                   
  aboutCommand.ts  |     100 |    55.55 |     100 |     100 | 23-30             
  authCommand.ts   |     100 |      100 |     100 |     100 |                   
  bugCommand.ts    |   78.46 |    42.85 |     100 |   78.46 | 32-35,72-81       
  chatCommand.ts   |    92.3 |    81.57 |     100 |    92.3 | ...83-184,186-187 
  clearCommand.ts  |     100 |      100 |     100 |     100 |                   
  ...essCommand.ts |     100 |    88.88 |     100 |     100 | 69                
  copyCommand.ts   |     100 |      100 |     100 |     100 |                   
  corgiCommand.ts  |     100 |      100 |     100 |     100 |                   
  docsCommand.ts   |     100 |      100 |     100 |     100 |                   
  editorCommand.ts |     100 |      100 |     100 |     100 |                   
  ...onsCommand.ts |     100 |      100 |     100 |     100 |                   
  helpCommand.ts   |     100 |      100 |     100 |     100 |                   
  ideCommand.ts    |   99.27 |       90 |     100 |   99.27 | 27                
  mcpCommand.ts    |   88.67 |    85.52 |   83.33 |   88.67 | ...33-335,385-392 
  memoryCommand.ts |     100 |      100 |     100 |     100 |                   
  ...acyCommand.ts |     100 |      100 |     100 |     100 |                   
  quitCommand.ts   |     100 |      100 |     100 |     100 |                   
  ...oreCommand.ts |   93.79 |    91.42 |     100 |   93.79 | 54-55,84-89       
  statsCommand.ts  |   84.48 |       75 |     100 |   84.48 | 24-32             
  themeCommand.ts  |     100 |      100 |     100 |     100 |                   
  toolsCommand.ts  |     100 |      100 |     100 |     100 |                   
  types.ts         |     100 |      100 |     100 |     100 |                   
 src/ui/components |   61.79 |    80.13 |   63.15 |   61.79 |                   
  AboutBox.tsx     |     100 |       50 |     100 |     100 | 102               
  AsciiArt.ts      |     100 |      100 |     100 |     100 |                   
  AuthDialog.tsx   |   89.78 |    96.42 |   66.66 |   89.78 | 68-73,102-109     
  ...nProgress.tsx |   15.78 |      100 |       0 |   15.78 | 17-57             
  ...Indicator.tsx |   15.15 |      100 |       0 |   15.15 | 17-47             
  ...ryDisplay.tsx |   21.05 |      100 |       0 |   21.05 | 17-35             
  ...ryDisplay.tsx |   91.02 |    92.85 |     100 |   91.02 | 73-78,98          
  ...esDisplay.tsx |   10.52 |      100 |       0 |   10.52 | 24-82             
  ...ngsDialog.tsx |    6.76 |      100 |       0 |    6.76 | 26-168            
  Footer.tsx       |   67.44 |       10 |     100 |   67.44 | ...02-109,112-115 
  ...ngSpinner.tsx |      80 |    33.33 |     100 |      80 | 29,31-32          
  Header.tsx       |   17.07 |      100 |       0 |   17.07 | 22-63             
  Help.tsx         |    3.73 |      100 |       0 |    3.73 | 17-154            
  ...emDisplay.tsx |   68.65 |       50 |     100 |   68.65 | ...55-60,79-86,89 
  ...ilDisplay.tsx |   13.88 |      100 |       0 |   13.88 | 17-52             
  InputPrompt.tsx  |   83.33 |    77.06 |     100 |   83.33 | ...35,379,407-411 
  ...Indicator.tsx |     100 |      100 |     100 |     100 |                   
  ...geDisplay.tsx |   25.92 |      100 |       0 |   25.92 | 14-36             
  ...tsDisplay.tsx |     100 |      100 |     100 |     100 |                   
  ...ryDisplay.tsx |     100 |      100 |     100 |     100 |                   
  ...Indicator.tsx |   44.44 |      100 |       0 |   44.44 | 12-17             
  ...MoreLines.tsx |      60 |       25 |     100 |      60 | 24-27,33-40       
  StatsDisplay.tsx |   98.39 |    86.66 |     100 |   98.39 | 173-175           
  ...nsDisplay.tsx |   83.05 |    61.53 |     100 |   83.05 | 34-39,42-43,87-89 
  ThemeDialog.tsx  |    4.29 |      100 |       0 |    4.29 | 29-316            
  Tips.tsx         |      16 |      100 |       0 |      16 | 17-45             
  ...tsDisplay.tsx |     100 |     87.5 |     100 |     100 | 30-31             
  ...ification.tsx |   36.36 |      100 |       0 |   36.36 | 15-22             
 ...nents/messages |   61.55 |    80.34 |   52.63 |   61.55 |                   
  ...onMessage.tsx |   18.51 |      100 |       0 |   18.51 | 22-49             
  DiffRenderer.tsx |   96.18 |    81.92 |     100 |   96.18 | ...16-217,221,283 
  ErrorMessage.tsx |   22.22 |      100 |       0 |   22.22 | 16-31             
  ...niMessage.tsx |   18.51 |      100 |       0 |   18.51 | 20-43             
  ...geContent.tsx |   19.04 |      100 |       0 |   19.04 | 25-43             
  InfoMessage.tsx  |   22.22 |      100 |       0 |   22.22 | 16-31             
  ...onMessage.tsx |   38.91 |     62.5 |   33.33 |   38.91 | ...32-164,200-225 
  ...upMessage.tsx |   10.11 |      100 |       0 |   10.11 | 27-126            
  ToolMessage.tsx  |   87.76 |       80 |     100 |   87.76 | ...,91-95,169-171 
  UserMessage.tsx  |     100 |      100 |     100 |     100 |                   
  ...llMessage.tsx |   36.36 |      100 |       0 |   36.36 | 17-25             
 ...ponents/shared |    74.2 |    71.69 |   91.66 |    74.2 |                   
  MaxSizedBox.tsx  |   80.66 |    81.19 |   88.88 |   80.66 | ...08-509,614-615 
  ...tonSelect.tsx |   66.66 |    65.51 |     100 |   66.66 | ...15,119-155,224 
  text-buffer.ts   |   72.64 |    67.67 |    92.3 |   72.64 | ...1235-1238,1243 
 src/ui/contexts   |   90.57 |    86.36 |     100 |   90.57 |                   
  ...owContext.tsx |   91.07 |    81.81 |     100 |   91.07 | 46-47,59-61       
  ...onContext.tsx |   94.11 |      100 |     100 |   94.11 | 101-104           
  ...ngContext.tsx |   71.42 |       50 |     100 |   71.42 | 17-20             
 src/ui/editors    |   93.87 |    85.71 |   66.66 |   93.87 |                   
  ...ngsManager.ts |   93.87 |    85.71 |   66.66 |   93.87 | 53,67-68          
 src/ui/hooks      |   75.79 |    82.41 |   77.58 |   75.79 |                   
  ...dProcessor.ts |   79.38 |    80.85 |     100 |   79.38 | ...39-442,453-469 
  ...dProcessor.ts |    84.3 |     72.5 |      80 |    84.3 | ...64-373,377-378 
  ...dProcessor.ts |   78.79 |    63.63 |     100 |   78.79 | ...92-296,321-323 
  ...uthCommand.ts |    7.46 |      100 |       0 |    7.46 | 18-92             
  ...tIndicator.ts |     100 |      100 |     100 |     100 |                   
  ...ketedPaste.ts |     100 |      100 |     100 |     100 |                   
  useCompletion.ts |   80.38 |    88.27 |      80 |   80.38 | ...95-596,621-622 
  ...leMessages.ts |   96.96 |    88.88 |     100 |   96.96 | 25-26             
  ...orSettings.ts |     100 |      100 |     100 |     100 |                   
  useFocus.ts      |     100 |      100 |     100 |     100 |                   
  ...miniStream.ts |   69.48 |    71.01 |     100 |   69.48 | ...21-822,852-942 
  ...BranchName.ts |   91.66 |    84.61 |     100 |   91.66 | 57-63             
  ...oryManager.ts |   98.41 |    93.33 |     100 |   98.41 | 43                
  ...putHistory.ts |    92.5 |    85.71 |     100 |    92.5 | 62-63,71,93-95    
  useKeypress.ts   |     100 |      100 |     100 |     100 |                   
  ...gIndicator.ts |     100 |      100 |     100 |     100 |                   
  useLogger.ts     |      25 |      100 |       0 |      25 | 14-32             
  ...raseCycler.ts |    95.5 |       75 |     100 |    95.5 | ...66-167,185-187 
  ...cySettings.ts |     3.6 |      100 |       0 |     3.6 | 18-139            
  ...lScheduler.ts |   79.01 |    94.87 |     100 |   79.01 | ...00-203,293-303 
  ...oryCommand.ts |       0 |        0 |       0 |       0 | 1-7               
  ...ellHistory.ts |   91.95 |    79.16 |   83.33 |   91.95 | 35-37,48-49,94-95 
  ...oryCommand.ts |       0 |        0 |       0 |       0 | 1-75              
  ...tateAndRef.ts |   59.09 |      100 |     100 |   59.09 | 23-31             
  ...rminalSize.ts |   77.27 |      100 |      50 |   77.27 | 19-23             
  ...emeCommand.ts |   46.98 |       75 |     100 |   46.98 | ...4,70-71,77-100 
  useTimer.ts      |   88.09 |    85.71 |     100 |   88.09 | 44-45,51-53       
 src/ui/privacy    |   13.77 |      100 |       0 |   13.77 |                   
  ...acyNotice.tsx |    9.58 |      100 |       0 |    9.58 | 20-113            
  ...acyNotice.tsx |    12.9 |      100 |       0 |    12.9 | 15-55             
  ...acyNotice.tsx |   10.81 |      100 |       0 |   10.81 | 15-58             
  ...acyNotice.tsx |   30.76 |      100 |       0 |   30.76 | 19-36,39-41       
 src/ui/themes     |   99.21 |    89.87 |     100 |   99.21 |                   
  ansi-light.ts    |     100 |      100 |     100 |     100 |                   
  ansi.ts          |     100 |      100 |     100 |     100 |                   
  atom-one-dark.ts |     100 |      100 |     100 |     100 |                   
  ayu-light.ts     |     100 |      100 |     100 |     100 |                   
  ayu.ts           |     100 |      100 |     100 |     100 |                   
  color-utils.ts   |     100 |      100 |     100 |     100 |                   
  default-light.ts |     100 |      100 |     100 |     100 |                   
  default.ts       |     100 |      100 |     100 |     100 |                   
  dracula.ts       |     100 |      100 |     100 |     100 |                   
  github-dark.ts   |     100 |      100 |     100 |     100 |                   
  github-light.ts  |     100 |      100 |     100 |     100 |                   
  googlecode.ts    |     100 |      100 |     100 |     100 |                   
  no-color.ts      |     100 |      100 |     100 |     100 |                   
  ...-of-purple.ts |     100 |      100 |     100 |     100 |                   
  theme-manager.ts |    93.1 |    84.61 |     100 |    93.1 | ...72,176,201-202 
  theme.ts         |   96.57 |     91.3 |     100 |   96.57 | 347-351,383-387   
  xcode.ts         |     100 |      100 |     100 |     100 |                   
 src/ui/utils      |   76.64 |    87.76 |   96.29 |   76.64 |                   
  ...Colorizer.tsx |    77.3 |    77.77 |     100 |    77.3 | ...48-151,185-209 
  ...olePatcher.ts |   82.92 |       75 |   83.33 |   82.92 | 35-39,50-51       
  ...nRenderer.tsx |   26.51 |       75 |     100 |   26.51 | 32-137            
  ...wnDisplay.tsx |   86.19 |    87.69 |     100 |   86.19 | ...71-279,311-332 
  ...eRenderer.tsx |   78.09 |    76.19 |     100 |   78.09 | 55-83             
  ...boardUtils.ts |   32.25 |     37.5 |     100 |   32.25 | ...55-114,129-145 
  commandUtils.ts  |   96.36 |    90.47 |     100 |   96.36 | 68,72             
  computeStats.ts  |     100 |      100 |     100 |     100 |                   
  displayUtils.ts  |     100 |      100 |     100 |     100 |                   
  errorParsing.ts  |     100 |     92.5 |     100 |     100 | 74,78,84          
  formatters.ts    |   90.47 |    95.83 |     100 |   90.47 | 57-60             
  ...nUtilities.ts |   69.84 |    85.71 |     100 |   69.84 | 75-91,100-101     
  textUtils.ts     |   81.81 |      100 |      80 |   81.81 | 13-18             
  updateCheck.ts   |     100 |      100 |     100 |     100 |                   
 src/utils         |   11.24 |       80 |   63.63 |   11.24 |                   
  cleanup.ts       |      64 |    66.66 |   66.66 |      64 | 18-26,35          
  package.ts       |   88.88 |    85.71 |     100 |   88.88 | 33-34             
  readStdin.ts     |    3.44 |      100 |       0 |    3.44 | 7-39              
  sandbox.ts       |       0 |        0 |       0 |       0 | 1-871             
  ...upWarnings.ts |   23.07 |      100 |       0 |   23.07 | 14-40             
  ...upWarnings.ts |   95.91 |    91.66 |     100 |   95.91 | 51-52             
  version.ts       |     100 |       50 |     100 |     100 | 11                
-------------------|---------|----------|---------|---------|-------------------
Core Package - Full Text Report
-------------------|---------|----------|---------|---------|-------------------
File               | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
-------------------|---------|----------|---------|---------|-------------------
All files          |   71.08 |    80.44 |   73.45 |   71.08 |                   
 src               |     100 |      100 |     100 |     100 |                   
  index.ts         |     100 |      100 |     100 |     100 |                   
 src/__mocks__/fs  |     100 |      100 |     100 |     100 |                   
  promises.ts      |     100 |      100 |     100 |     100 |                   
 src/code_assist   |   69.74 |       74 |   71.05 |   69.74 |                   
  codeAssist.ts    |   18.51 |      100 |       0 |   18.51 | 13-35             
  converter.ts     |   89.06 |    96.15 |   81.81 |   89.06 | 176-180,199-209   
  oauth2.ts        |   75.08 |    62.22 |      80 |   75.08 | ...79-380,392-398 
  server.ts        |   46.75 |       80 |   53.84 |   46.75 | ...61-202,205-207 
  setup.ts         |   73.77 |     62.5 |     100 |   73.77 | 57-58,69-71,83-93 
  types.ts         |     100 |      100 |     100 |     100 |                   
 src/config        |   76.38 |    83.78 |      50 |   76.38 |                   
  config.ts        |   76.16 |    83.78 |      50 |   76.16 | ...08-615,621-622 
  models.ts        |     100 |      100 |     100 |     100 |                   
 src/core          |   74.33 |    76.51 |   77.08 |   74.33 |                   
  client.ts        |   74.83 |    75.78 |   76.92 |   74.83 | ...17,719-720,723 
  ...tGenerator.ts |   91.95 |    78.26 |     100 |   91.95 | 79-80,132,143-146 
  ...lScheduler.ts |   72.77 |    70.51 |   81.25 |   72.77 | ...68-674,691-700 
  geminiChat.ts    |   62.39 |       72 |   62.06 |   62.39 | ...13,628,632-640 
  geminiRequest.ts |     100 |      100 |     100 |     100 |                   
  logger.ts        |   81.85 |    77.14 |     100 |   81.85 | ...78-282,291-292 
  modelCheck.ts    |   23.52 |       50 |     100 |   23.52 | 31-75             
  ...olExecutor.ts |     100 |    66.66 |     100 |     100 | 64,99             
  prompts.ts       |   95.76 |    96.96 |      50 |   95.76 | 37-38,304-361     
  tokenLimits.ts   |      15 |      100 |       0 |      15 | 15-31             
  turn.ts          |   83.08 |    83.33 |     100 |   83.08 | ...50-253,266-267 
 src/ide           |    51.9 |       90 |      75 |    51.9 |                   
  ide-client.ts    |      16 |       50 |       0 |      16 | 14,32-100         
  ideContext.ts    |     100 |      100 |     100 |     100 |                   
 src/mcp           |   73.98 |    80.55 |   76.31 |   73.98 |                   
  ...h-provider.ts |   83.01 |      100 |   33.33 |   83.01 | ...69,73,77,81-82 
  ...h-provider.ts |   77.75 |    67.24 |      90 |   77.75 | ...14-616,621-623 
  ...en-storage.ts |     100 |      100 |     100 |     100 |                   
  oauth-utils.ts   |   42.85 |     87.5 |      80 |   42.85 | ...32-192,216-252 
 src/services      |    91.8 |    91.25 |   82.75 |    91.8 |                   
  ...eryService.ts |   93.33 |    88.46 |   85.71 |   93.33 | 31,39,84,109-110  
  gitService.ts    |   77.52 |      100 |      60 |   77.52 | ...08-112,115-119 
  ...ionService.ts |   97.89 |       90 |     100 |   97.89 | 153-154,164-165   
 src/telemetry     |   67.71 |    84.09 |    75.4 |   67.71 |                   
  constants.ts     |     100 |      100 |     100 |     100 |                   
  ...-exporters.ts |   26.47 |        0 |       0 |   26.47 | ...80,83-84,87-88 
  index.ts         |     100 |      100 |     100 |     100 |                   
  ...t.circular.ts |       0 |        0 |       0 |       0 | 1-62              
  ...t.circular.ts |       0 |        0 |       0 |       0 | 1-119             
  loggers.ts       |    76.1 |    79.16 |   81.81 |    76.1 | ...96-313,322-334 
  metrics.ts       |   60.36 |    95.65 |    62.5 |   60.36 | ...36-158,161-184 
  sdk.ts           |   76.72 |    28.57 |     100 |   76.72 | ...33,141-142,148 
  types.ts         |   84.42 |    97.87 |   89.47 |   84.42 | 83-92,162-191     
  uiTelemetry.ts   |   99.23 |       95 |     100 |   99.23 | 119               
 ...learcut-logger |   82.67 |    74.41 |   76.19 |   82.67 |                   
  ...cut-logger.ts |   82.45 |     73.8 |      80 |   82.45 | ...38-539,543-545 
  ...tadata-key.ts |   84.61 |      100 |       0 |   84.61 | 169-179           
 src/tools         |   59.01 |    77.64 |   67.34 |   59.01 |                   
  diffOptions.ts   |     100 |      100 |     100 |     100 |                   
  edit.ts          |   77.87 |    83.33 |      75 |   77.87 | ...54-455,459-494 
  glob.ts          |   85.29 |    80.95 |   83.33 |   85.29 | ...68-269,277-284 
  grep.ts          |   57.35 |     75.8 |   72.72 |   57.35 | ...32-537,542-546 
  ls.ts            |    8.61 |      100 |   14.28 |    8.61 | ...74-179,187-326 
  mcp-client.ts    |   23.36 |    65.21 |   23.52 |   23.36 | ...55-959,963-966 
  mcp-tool.ts      |   84.92 |    88.46 |      90 |   84.92 | ...69,175,180-181 
  memoryTool.ts    |   97.46 |    84.84 |     100 |   97.46 | 94,96,98-99       
  ...iable-tool.ts |     100 |    84.61 |     100 |     100 | 90,97             
  read-file.ts     |   96.69 |    96.15 |   83.33 |   96.69 | 113-114,123-124   
  ...many-files.ts |   82.17 |    69.81 |      80 |   82.17 | ...90-491,498-499 
  shell.ts         |   65.49 |    66.12 |   78.57 |   65.49 | ...64,481,487-499 
  tool-registry.ts |   54.38 |    75.86 |      75 |   54.38 | ...52-357,441-442 
  tools.ts         |   75.47 |      100 |   33.33 |   75.47 | ...67-172,181-184 
  web-fetch.ts     |   31.06 |    68.42 |   66.66 |   31.06 | ...92-193,221-359 
  web-search.ts    |   26.72 |      100 |      40 |   26.72 | ...04-105,108-197 
  write-file.ts    |   81.45 |    83.67 |   77.77 |   81.45 | ...09-314,376-406 
 src/utils         |   81.53 |    83.71 |   86.61 |   81.53 |                   
  LruCache.ts      |   70.96 |     62.5 |     100 |   70.96 | 20-22,28,30-34    
  bfsFileSearch.ts |   93.22 |    88.23 |     100 |   93.22 | 54-55,68-69       
  browser.ts       |    8.69 |      100 |       0 |    8.69 | 17-53             
  editCorrector.ts |   77.35 |    61.11 |   91.66 |   77.35 | ...70-682,716,730 
  editor.ts        |    97.4 |    94.11 |     100 |    97.4 | 145,207,210-211   
  ...rReporting.ts |   83.52 |    84.61 |     100 |   83.52 | 81-85,106-114     
  errors.ts        |   39.02 |       60 |      75 |   39.02 | 21-25,41-57,61-67 
  fetch.ts         |   34.04 |      100 |       0 |   34.04 | 22-27,31-57       
  fileUtils.ts     |    93.1 |    88.31 |     100 |    93.1 | ...66-270,339-345 
  ...eUtilities.ts |   96.03 |    95.83 |     100 |   96.03 | 28-29,57-58       
  ...rStructure.ts |   95.96 |    94.93 |     100 |   95.96 | ...14-117,345-347 
  ...noreParser.ts |     100 |    88.88 |     100 |     100 | 27,47             
  gitUtils.ts      |   51.21 |     90.9 |      50 |   51.21 | 40-41,50-73       
  ...yDiscovery.ts |   81.88 |    75.86 |      75 |   81.88 | ...28-329,332-333 
  ...tProcessor.ts |   86.86 |    88.46 |     100 |   86.86 | 115-124,131-140   
  ...Inspectors.ts |     100 |      100 |     100 |     100 |                   
  ...kerChecker.ts |   83.51 |    83.33 |     100 |   83.51 | ...95-100,108-114 
  partUtils.ts     |     100 |      100 |     100 |     100 |                   
  paths.ts         |    61.7 |    73.33 |   44.44 |    61.7 | ...68-169,177-178 
  ...rDetection.ts |   37.28 |    36.36 |      80 |   37.28 | ...7,91-92,98-103 
  retry.ts         |   62.55 |    73.21 |     100 |   62.55 | ...54-274,319-334 
  ...nStringify.ts |     100 |      100 |     100 |     100 |                   
  ...aValidator.ts |   86.95 |    68.75 |     100 |   86.95 | 24-25,27-28,45-46 
  session.ts       |     100 |      100 |     100 |     100 |                   
  summarizer.ts    |     100 |    88.88 |     100 |     100 | 91                
  ...emEncoding.ts |      98 |    93.75 |     100 |      98 | 106-107           
  testUtils.ts     |   84.44 |    72.72 |   83.33 |   84.44 | 27-28,34-35,70-72 
  user_account.ts  |   97.72 |    97.05 |     100 |   97.72 | 102-103           
  user_id.ts       |   60.97 |    44.44 |      75 |   60.97 | ...33,46-48,52-57 
-------------------|---------|----------|---------|---------|-------------------

For detailed HTML reports, please see the 'coverage-reports-22.x' artifact from the main CI run.

console.debug('[DEBUG] [ImportProcessor]', ...args),
};

export enum IDEConnectionStatus {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Given we're leaning on MCP for this any reason to not re-use our existing status details?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think it's possible we might want to support different protocols so wanted to keep them separate so the fact that it's relying on an MCP server is an implementation detail of the manager (now client). WDYT?

Comment thread packages/core/src/ide/ide-mode-manager.ts
Comment thread packages/core/src/ide/ide-mode-manager.ts
client: Client | undefined = undefined;
connectionStatus: IDEConnectionStatus = IDEConnectionStatus.Disconnected;

constructor() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  1. instead of initializing IDE mode implicitly, can we initialize it when the user invokes the /ide slash command? so the /ide slash command would act as a toggle for enabling / disabling IDE mode
  2. until we're ready to launch, we should still hide /ide behind the --ide-mode flag

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I moved it so it gets kicked off if ide-mode is enabled to match the current behavior, but we have more flexibility if we want to invoke it ad hoc! I think it makes sense in a follow up tho?

Comment thread packages/core/src/ide/ide-mode-manager.ts
Comment thread packages/vscode-ide-companion/src/ide-server.ts Outdated
Comment thread packages/core/src/services/ideContext.ts
const idePort = process.env['GEMINI_CLI_IDE_SERVER_PORT'];
if (!idePort) {
logger.debug(
'Unable to connect to IDE mode MCP server. GEMINI_CLI_IDE_SERVER_PORT environment variable is not set.',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lets surface this error message to the user via /ide and indicate the companion extension must be installed + they must run in the VS Code integrated terminal

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think this is a good idea but out of scope for this PR-- I think we should move all of the install stuff into this package as an 'install registry', allowing us to surface installable options but still allowing other options to connect via the protocol. WDYT?

@chrstnb
Copy link
Copy Markdown
Contributor Author

chrstnb commented Jul 25, 2025

Note: let's add support here for threading through the name of the IDE #4682 (comment)

@chrstnb chrstnb added this pull request to the merge queue Jul 25, 2025
Merged via the queue into main with commit 1b8ba5c Jul 25, 2025
8 checks passed
@chrstnb chrstnb deleted the cb/idemanager branch July 25, 2025 17:50
jkcinouye pushed a commit that referenced this pull request Jul 25, 2025
thacio added a commit to thacio/auditaria that referenced this pull request Jul 25, 2025
JunYang-tes pushed a commit to JunYang-tes/gemini-cli.nvim that referenced this pull request Aug 9, 2025
involvex pushed a commit to involvex/gemini-cli that referenced this pull request Sep 11, 2025
reconsumeralization pushed a commit to reconsumeralization/gemini-cli that referenced this pull request Sep 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants