Skip to content

Commit 5ac7bb6

Browse files
committed
Adds explain branch to home
1 parent dd3dd56 commit 5ac7bb6

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

src/constants.commands.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ type InternalHomeWebviewCommands =
5555
| 'gitlens.home.continuePausedOperation'
5656
| 'gitlens.home.abortPausedOperation'
5757
| 'gitlens.home.explainWip'
58+
| 'gitlens.home.ai.explainBranch'
5859
| 'gitlens.home.openRebaseEditor';
5960

6061
type InternalHomeWebviewViewCommands =

src/webviews/apps/plus/home/components/branch-card.ts

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,15 +1000,30 @@ export class GlBranchCard extends GlBranchCardBase {
10001000
href=${this.createCommandLink('gitlens.home.openWorktree')}
10011001
></action-item>`,
10021002
);
1003-
// add explain WIP
1004-
if (this.wip?.workingTreeState != null) {
1003+
1004+
const hasWip =
1005+
this.wip?.workingTreeState != null
1006+
? this.wip.workingTreeState.added +
1007+
this.wip.workingTreeState.changed +
1008+
this.wip.workingTreeState.deleted >
1009+
0
1010+
: false;
1011+
if (hasWip) {
10051012
actions.push(
10061013
html`<action-item
1007-
label="Explain Changes"
1014+
label="Explain Working Changes (Preview)"
10081015
icon="sparkle"
10091016
href=${this.createCommandLink('gitlens.home.explainWip')}
10101017
></action-item>`,
10111018
);
1019+
} else {
1020+
actions.push(
1021+
html`<action-item
1022+
label="Explain Branch (Preview)"
1023+
icon="sparkle"
1024+
href=${this.createCommandLink('gitlens.home.ai.explainBranch')}
1025+
></action-item>`,
1026+
);
10121027
}
10131028
} else {
10141029
actions.push(
@@ -1018,6 +1033,13 @@ export class GlBranchCard extends GlBranchCardBase {
10181033
href=${this.createCommandLink('gitlens.home.switchToBranch')}
10191034
></action-item>`,
10201035
);
1036+
actions.push(
1037+
html`<action-item
1038+
label="Explain Branch (Preview)"
1039+
icon="sparkle"
1040+
href=${this.createCommandLink('gitlens.home.ai.explainBranch')}
1041+
></action-item>`,
1042+
);
10211043
}
10221044

10231045
// branch actions

src/webviews/home/homeWebview.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
354354
registerCommand('gitlens.home.abortPausedOperation', this.abortPausedOperation, this),
355355
registerCommand('gitlens.home.openRebaseEditor', this.openRebaseEditor, this),
356356
registerCommand('gitlens.home.explainWip', this.explainWip, this),
357+
registerCommand('gitlens.home.ai.explainBranch', this.explainWip, this),
357358
];
358359
}
359360

0 commit comments

Comments
 (0)