mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 22:21:22 -07:00
fix(ide): Update IDE extension to write auth token in env var (#14999)
This commit is contained in:
@@ -108,7 +108,7 @@ describe('IDEServer', () => {
|
||||
await ideServer.start(mockContext);
|
||||
|
||||
const replaceMock = mockContext.environmentVariableCollection.replace;
|
||||
expect(replaceMock).toHaveBeenCalledTimes(2);
|
||||
expect(replaceMock).toHaveBeenCalledTimes(3);
|
||||
|
||||
expect(replaceMock).toHaveBeenNthCalledWith(
|
||||
1,
|
||||
@@ -127,6 +127,12 @@ describe('IDEServer', () => {
|
||||
expectedWorkspacePaths,
|
||||
);
|
||||
|
||||
expect(replaceMock).toHaveBeenNthCalledWith(
|
||||
3,
|
||||
'GEMINI_CLI_IDE_AUTH_TOKEN',
|
||||
'test-auth-token',
|
||||
);
|
||||
|
||||
const port = getPortFromMock(replaceMock);
|
||||
const expectedPortFile = path.join(
|
||||
'/tmp',
|
||||
@@ -254,6 +260,10 @@ describe('IDEServer', () => {
|
||||
'GEMINI_CLI_IDE_WORKSPACE_PATH',
|
||||
expectedWorkspacePaths,
|
||||
);
|
||||
expect(replaceMock).toHaveBeenCalledWith(
|
||||
'GEMINI_CLI_IDE_AUTH_TOKEN',
|
||||
'test-auth-token',
|
||||
);
|
||||
|
||||
const port = getPortFromMock(replaceMock);
|
||||
const expectedPortFile = path.join(
|
||||
|
||||
@@ -38,6 +38,7 @@ class CORSError extends Error {
|
||||
const MCP_SESSION_ID_HEADER = 'mcp-session-id';
|
||||
const IDE_SERVER_PORT_ENV_VAR = 'GEMINI_CLI_IDE_SERVER_PORT';
|
||||
const IDE_WORKSPACE_PATH_ENV_VAR = 'GEMINI_CLI_IDE_WORKSPACE_PATH';
|
||||
const IDE_AUTH_TOKEN_ENV_VAR = 'GEMINI_CLI_IDE_AUTH_TOKEN';
|
||||
|
||||
interface WritePortAndWorkspaceArgs {
|
||||
context: vscode.ExtensionContext;
|
||||
@@ -70,6 +71,10 @@ async function writePortAndWorkspace({
|
||||
IDE_WORKSPACE_PATH_ENV_VAR,
|
||||
workspacePath,
|
||||
);
|
||||
context.environmentVariableCollection.replace(
|
||||
IDE_AUTH_TOKEN_ENV_VAR,
|
||||
authToken,
|
||||
);
|
||||
|
||||
const content = JSON.stringify({
|
||||
port,
|
||||
|
||||
Reference in New Issue
Block a user