Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 49 additions & 24 deletions contributions.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,19 @@
]
}
},
"gitlens.ai.explainWip": {
"label": "Explain Working Changes (Preview)...",
"commandPalette": "gitlens:enabled && !gitlens:readonly && !gitlens:untrusted && gitlens:gk:organization:ai:enabled",
"menus": {
"view/item/context": [
{
"when": "viewItem =~ /gitlens:worktree\\b/ && !listMultiSelection && !gitlens:readonly && !gitlens:untrusted && gitlens:gk:organization:ai:enabled",
"group": "3_gitlens_ai",
"order": 1
}
]
}
},
"gitlens.ai.generateChangelog": {
"label": "Generate Changelog (Preview)...",
"commandPalette": "gitlens:enabled && !gitlens:untrusted && gitlens:gk:organization:ai:enabled && config.gitlens.ai.enabled"
Expand Down Expand Up @@ -1361,6 +1374,42 @@
]
}
},
"gitlens.graph.ai.explainCommit": {
"label": "Explain Commit",
"menus": {
"webview/context": [
{
"when": "webviewItem =~ /gitlens:commit\\b/ && !listMultiSelection && !gitlens:readonly && !gitlens:untrusted && gitlens:gk:organization:ai:enabled && config.gitlens.ai.enabled",
"group": "1_gitlens_actions_3",
"order": 1
}
]
}
},
"gitlens.graph.ai.explainStash": {
"label": "Explain Stash (Preview)",
"menus": {
"webview/context": [
{
"when": "webviewItem =~ /gitlens:stash\\b/ && !listMultiSelection && !gitlens:readonly && !gitlens:untrusted && gitlens:gk:organization:ai:enabled && config.gitlens.ai.enabled",
"group": "1_gitlens_actions_3",
"order": 1
}
]
}
},
"gitlens.graph.ai.explainWip": {
"label": "Explain Working Changes (Preview)",
"menus": {
"webview/context": [
{
"when": "webviewItem =~ /gitlens:wip\\b/ && !listMultiSelection && !gitlens:readonly && !gitlens:untrusted && gitlens:gk:organization:ai:enabled && config.gitlens.ai.enabled",
"group": "1_gitlens_actions_3",
"order": 1
}
]
}
},
"gitlens.graph.ai.generateChangelogFrom": {
"label": "Generate Changelog (Preview)...",
"icon": "$(sparkle)",
Expand Down Expand Up @@ -1988,30 +2037,6 @@
]
}
},
"gitlens.graph.explainCommit": {
"label": "Explain Commit",
"menus": {
"webview/context": [
{
"when": "webviewItem =~ /gitlens:commit\\b/ && !listMultiSelection && !gitlens:readonly && !gitlens:untrusted && gitlens:gk:organization:ai:enabled && config.gitlens.ai.enabled",
"group": "1_gitlens_actions_3",
"order": 1
}
]
}
},
"gitlens.graph.explainStash": {
"label": "Explain Stash (Preview)",
"menus": {
"webview/context": [
{
"when": "webviewItem =~ /gitlens:stash\\b/ && !listMultiSelection && !gitlens:readonly && !gitlens:untrusted && gitlens:gk:organization:ai:enabled && config.gitlens.ai.enabled",
"group": "1_gitlens_actions_3",
"order": 1
}
]
}
},
"gitlens.graph.fetch": {
"label": "Fetch",
"icon": "$(repo-fetch)",
Expand Down
63 changes: 45 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6084,6 +6084,11 @@
"title": "Explain Stash (Preview)...",
"category": "GitLens"
},
{
"command": "gitlens.ai.explainWip",
"title": "Explain Working Changes (Preview)...",
"category": "GitLens"
},
{
"command": "gitlens.ai.generateChangelog",
"title": "Generate Changelog (Preview)...",
Expand Down Expand Up @@ -6619,6 +6624,18 @@
"title": "Add as Co-author",
"icon": "$(person-add)"
},
{
"command": "gitlens.graph.ai.explainCommit",
"title": "Explain Commit"
},
{
"command": "gitlens.graph.ai.explainStash",
"title": "Explain Stash (Preview)"
},
{
"command": "gitlens.graph.ai.explainWip",
"title": "Explain Working Changes (Preview)"
},
{
"command": "gitlens.graph.ai.generateChangelogFrom",
"title": "Generate Changelog (Preview)...",
Expand Down Expand Up @@ -6847,14 +6864,6 @@
"icon": "$(trash)",
"enablement": "!operationInProgress"
},
{
"command": "gitlens.graph.explainCommit",
"title": "Explain Commit"
},
{
"command": "gitlens.graph.explainStash",
"title": "Explain Stash (Preview)"
},
{
"command": "gitlens.graph.fetch",
"title": "Fetch",
Expand Down Expand Up @@ -10408,6 +10417,10 @@
"command": "gitlens.ai.explainStash",
"when": "gitlens:enabled && !gitlens:readonly && !gitlens:untrusted && gitlens:gk:organization:ai:enabled && config.gitlens.ai.enabled"
},
{
"command": "gitlens.ai.explainWip",
"when": "gitlens:enabled && !gitlens:readonly && !gitlens:untrusted && gitlens:gk:organization:ai:enabled"
},
{
"command": "gitlens.ai.generateChangelog",
"when": "gitlens:enabled && !gitlens:untrusted && gitlens:gk:organization:ai:enabled && config.gitlens.ai.enabled"
Expand Down Expand Up @@ -10808,6 +10821,18 @@
"command": "gitlens.graph.addAuthor",
"when": "false"
},
{
"command": "gitlens.graph.ai.explainCommit",
"when": "false"
},
{
"command": "gitlens.graph.ai.explainStash",
"when": "false"
},
{
"command": "gitlens.graph.ai.explainWip",
"when": "false"
},
{
"command": "gitlens.graph.ai.generateChangelogFrom",
"when": "false"
Expand Down Expand Up @@ -11000,14 +11025,6 @@
"command": "gitlens.graph.deleteTag",
"when": "false"
},
{
"command": "gitlens.graph.explainCommit",
"when": "false"
},
{
"command": "gitlens.graph.explainStash",
"when": "false"
},
{
"command": "gitlens.graph.fetch",
"when": "false"
Expand Down Expand Up @@ -17958,6 +17975,11 @@
"when": "viewItem =~ /gitlens:worktree\\b/ && !listMultiSelection",
"group": "3_gitlens@1"
},
{
"command": "gitlens.ai.explainWip",
"when": "viewItem =~ /gitlens:worktree\\b/ && !listMultiSelection && !gitlens:readonly && !gitlens:untrusted && gitlens:gk:organization:ai:enabled",
"group": "3_gitlens_ai@1"
},
{
"command": "gitlens.views.deleteWorktree",
"when": "viewItem =~ /gitlens:worktree\\b(?!.*?\\b\\+(active|default)\\b)/ && !listMultiSelection && !gitlens:readonly",
Expand Down Expand Up @@ -20164,7 +20186,7 @@
"group": "1_gitlens_actions_1@4"
},
{
"command": "gitlens.graph.explainCommit",
"command": "gitlens.graph.ai.explainCommit",
"when": "webviewItem =~ /gitlens:commit\\b/ && !listMultiSelection && !gitlens:readonly && !gitlens:untrusted && gitlens:gk:organization:ai:enabled && config.gitlens.ai.enabled",
"group": "1_gitlens_actions_3@1"
},
Expand Down Expand Up @@ -20329,7 +20351,7 @@
"group": "1_gitlens_actions@3"
},
{
"command": "gitlens.graph.explainStash",
"command": "gitlens.graph.ai.explainStash",
"when": "webviewItem =~ /gitlens:stash\\b/ && !listMultiSelection && !gitlens:readonly && !gitlens:untrusted && gitlens:gk:organization:ai:enabled && config.gitlens.ai.enabled",
"group": "1_gitlens_actions_3@1"
},
Expand Down Expand Up @@ -20393,6 +20415,11 @@
"when": "webviewItem == gitlens:wip && !listMultiSelection && !gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders",
"group": "1_gitlens_actions@4"
},
{
"command": "gitlens.graph.ai.explainWip",
"when": "webviewItem =~ /gitlens:wip\\b/ && !listMultiSelection && !gitlens:readonly && !gitlens:untrusted && gitlens:gk:organization:ai:enabled && config.gitlens.ai.enabled",
"group": "1_gitlens_actions_3@1"
},
{
"command": "gitlens.graph.hideRefGroup",
"when": "webviewItemGroup =~ /gitlens:refGroup\\b(?!.*?\\b\\+current\\b)/",
Expand Down
1 change: 1 addition & 0 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import './commands/diffWithWorking';
import './commands/externalDiff';
import './commands/explainCommit';
import './commands/explainStash';
import './commands/explainWip';
import './commands/generateChangelog';
import './commands/generateCommitMessage';
import './commands/ghpr/openOrCreateWorktree';
Expand Down
9 changes: 9 additions & 0 deletions src/commands/commandContext.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { isRemote } from '../git/models/remote';
import { Repository } from '../git/models/repository';
import type { GitTag } from '../git/models/tag';
import { isTag } from '../git/models/tag';
import { GitWorktree } from '../git/models/worktree';
import { CloudWorkspace } from '../plus/workspaces/models/cloudWorkspace';
import { LocalWorkspace } from '../plus/workspaces/models/localWorkspace';
import { isScm, isScmResourceGroup, isScmResourceState } from '../system/-webview/scm';
Expand Down Expand Up @@ -121,6 +122,14 @@ export function isCommandContextViewNodeHasRemote(
return isRemote((context.node as ViewNode & { remote: GitRemote }).remote);
}

export function isCommandContextViewNodeHasWorktree(
context: CommandContext,
): context is CommandViewNodeContext & { node: ViewNode & { worktree: GitWorktree } } {
if (context.type !== 'viewItem') return false;

return (context.node as ViewNode & { worktree?: GitWorktree }).worktree instanceof GitWorktree;
}

export function isCommandContextViewNodeHasRepository(
context: CommandContext,
): context is CommandViewNodeContext & { node: ViewNode & { repo: Repository } } {
Expand Down
Loading