Skip to content

Commit b068388

Browse files
feat(vscode): remove generateBranchName command and add branch check … (#4088)
* feat(vscode): remove generateBranchName command and add branch check for commit message generation * refactor(vscode): simplify branch check logic in commit message generation * fix(vscode): update command condition for generateCommitMessage to check chatEnabled * [autofix.ci] apply automated fixes * fix(vscode): disable generateCommitMessage command when chat is enabled --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent d3d077a commit b068388

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

clients/vscode/package.json

-5
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,6 @@
270270
"command": "tabby.chat.generateCommitMessage",
271271
"when": "tabby.chatEnabled",
272272
"group": "navigation@-1"
273-
},
274-
{
275-
"command": "tabby.chat.generateBranchName",
276-
"when": "tabby.chatEnabled",
277-
"group": "navigation@-2"
278273
}
279274
],
280275
"view/title": [

clients/vscode/src/commands/index.ts

+10
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,18 @@ export class Commands {
422422
{ repository: selectedRepo.rootUri.toString() },
423423
token,
424424
);
425+
425426
if (result && selectedRepo.inputBox) {
426427
selectedRepo.inputBox.value = result.commitMessage;
428+
429+
const repo = this.gitProvider.getRepository(selectedRepo.rootUri);
430+
if (repo && repo.state && repo.state.HEAD) {
431+
const currentBranch = repo.state.HEAD.name;
432+
// FIXME(Sma1lboy): let LLM model decide should we create a new branch or not
433+
if (currentBranch === "main" || currentBranch === "master") {
434+
commands.executeCommand("tabby.chat.generateBranchName", selectedRepo);
435+
}
436+
}
427437
}
428438
},
429439
);

0 commit comments

Comments
 (0)