Skip to content

Commit a2c8217

Browse files
committed
Ensures login and connect deeplinks pass auth to CLI when GL is already logged in
1 parent f60c47e commit a2c8217

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

src/constants.commands.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ type InternalGlCommands =
127127
| 'gitlens.ai.explainWip:editor'
128128
| 'gitlens.ai.feedback.helpful'
129129
| 'gitlens.ai.feedback.unhelpful'
130+
| 'gitlens.ai.mcp.authCLI'
130131
| 'gitlens.changeBranchMergeTarget'
131132
| 'gitlens.diffWith'
132133
| 'gitlens.diffWithPrevious:codelens'

src/env/node/gk/cli/integration.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,7 @@ export class GkCliIntegrationProvider implements Disposable {
760760
return [
761761
registerCommand('gitlens.ai.mcp.install', (src?: Source) => this.setupMCP(src?.source)),
762762
registerCommand('gitlens.ai.mcp.reinstall', (src?: Source) => this.setupMCP(src?.source, true)),
763+
registerCommand('gitlens.ai.mcp.authCLI', () => this.authCLI()),
763764
];
764765
}
765766
}

src/plus/gk/subscriptionService.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,7 @@ export class SubscriptionService implements Disposable {
587587
});
588588
const loggedIn = Boolean(session);
589589
if (loggedIn) {
590+
void executeCommand('gitlens.ai.mcp.authCLI');
590591
void this.showPlanMessage(options?.source);
591592
}
592593
return loggedIn;

src/plus/integrations/integrationService.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import type { PullRequest } from '../../git/models/pullRequest';
2020
import type { GitRemote } from '../../git/models/remote';
2121
import type { ResourceDescriptor } from '../../git/models/resourceDescriptor';
2222
import type { RemoteProviderId } from '../../git/remotes/remoteProvider';
23+
import { executeCommand } from '../../system/-webview/command';
2324
import { configuration } from '../../system/-webview/configuration';
2425
import { openUrl } from '../../system/-webview/vscode/uris';
2526
import { gate } from '../../system/decorators/gate';
@@ -124,6 +125,10 @@ export class IntegrationService implements Disposable {
124125
}
125126

126127
let account = (await this.container.subscription.getSubscription()).account;
128+
if (account != null) {
129+
void executeCommand('gitlens.ai.mcp.authCLI');
130+
}
131+
127132
const connectedIntegrations = new Set<string>();
128133
if (integrationIds?.length) {
129134
if (connect?.skipIfConnected && !connect?.skipPreSync) {

0 commit comments

Comments
 (0)