feat(vcs): setting to hide the Generate Commit Message with Agent button (#4701)

Version Control > Commit > Commit Message Generation gets "Show the Generate Commit Message with Agent button" (on by default). Off hides the button above the commit message in the Commit tool window and dialog; the action stays available from Find Action and its shortcut.
This commit is contained in:
l0ng-ai
2026-11-20 13:29:32 +08:00
committed by GitHub
parent adf17d030e
commit 96f3818bf2
8 changed files with 34 additions and 2 deletions
+3
View File
@@ -176,6 +176,8 @@ pub struct CommitSettings {
pub agent_model: String,
/// That model's thinking level for commit messages; empty keeps the agent's.
pub agent_effort: String,
/// Show the Generate Commit Message with Agent button above the commit message.
pub agent_button: bool,
}
impl Default for CommitSettings {
@@ -201,6 +203,7 @@ impl Default for CommitSettings {
agent: String::new(),
agent_model: String::new(),
agent_effort: String::new(),
agent_button: true,
}
}
}
+1
View File
@@ -850,6 +850,7 @@ mod tests {
"agent": "",
"agentModel": "",
"agentEffort": "",
"agentButton": true,
})
);
}
+2
View File
@@ -3770,6 +3770,8 @@ export type CommitSettings = {
agentModel?: string,
/** That model's thinking level for commit messages; empty keeps the agent's. */
agentEffort?: string,
/** Show the Generate Commit Message with Agent button above the commit message. */
agentButton?: boolean,
};
export type Commit_Deserialize = {
+17 -2
View File
@@ -6,6 +6,8 @@
import { createElement } from "react";
import { registerActions } from "@/platform/actions";
import { useProject } from "@/platform/project";
import { clearContext, setContext } from "@/platform/context";
import { onWorkflowSettingsChange, workflowSettings } from "@/platform/workflowSettings";
import { executeAction } from "@/platform/actions";
import { lazyComponent, lazyWhen } from "@/ui";
import { isVirtualUri } from "@/platform/virtualDocs";
@@ -47,6 +49,18 @@ import { replyActions } from "./replyActions";
export { activateSettingsPages } from "./settingsPages";
function trackAgentButtonSetting(): () => void {
setContext("commitAgentButton", workflowSettings().vcs.commit.agentButton);
const stop = onWorkflowSettingsChange(
(s) => s.vcs.commit.agentButton,
(on) => setContext("commitAgentButton", on),
);
return () => {
stop();
clearContext("commitAgentButton");
};
}
export function activate(): () => void {
const sync = (root: string | null | undefined) => {
disconnect();
@@ -153,12 +167,13 @@ export function activate(): () => void {
accepts: (type) => type === TASK_DRAG,
drop: ({ payload }) => void executeAction("agents.openTaskInEditor", payload),
}),
// The button above the commit message (the Commit tool window and dialog).
// The button above the commit message (the Commit tool window and dialog), unless turned off.
trackAgentButtonSetting(),
registerMenuSlotItem("commitMessage", {
action: "agents.generateCommitMessage",
label: "Generate Commit Message with Agent",
icon: "toolwindow-agents",
when: "projectOpen && vcsAvailable",
when: "projectOpen && vcsAvailable && commitAgentButton",
}),
registerStatusItem({ id: "agents.status", align: "right", priority: 3, title: "Agents", component: AgentsStatus }),
registerMenuGroup({
+5
View File
@@ -643,6 +643,11 @@ export const VCS_PAGES: PageSpec[] = [
{
title: "Commit Message Generation",
options: [
{
kind: "toggle",
key: "vcs.commit.agentButton",
label: "Show the Generate Commit Message with Agent button",
},
{
kind: "custom",
label: "Agent",
+1
View File
@@ -2265,6 +2265,7 @@
"Finished": "Finished",
"Only while the tab cannot be seen. A command stopped with Ctrl-C, shell startup and short commands stay quiet; a non-zero exit always reports its code.": "Only while the tab cannot be seen. A command stopped with Ctrl-C, shell startup and short commands stay quiet; a non-zero exit always reports its code.",
"Generate Commit Message with Agent": "Generate Commit Message with Agent",
"Show the Generate Commit Message with Agent button": "Show the Generate Commit Message with Agent button",
"Has the coding agent you work with review the changes about to be committed and write the commit message.": "Has the coding agent you work with review the changes about to be committed and write the commit message.",
"No changes to describe": "No changes to describe",
"Include changes in the commit first.": "Include changes in the commit first.",
+1
View File
@@ -8667,6 +8667,7 @@
"Exited with code {code}": "退出代码 {code}",
"Only while the tab cannot be seen. A command stopped with Ctrl-C, shell startup and short commands stay quiet; a non-zero exit always reports its code.": "仅当标签页不可见时通知。用 Ctrl-C 停止的命令、shell 启动和短命令保持安静;非零退出始终报告退出代码。",
"Generate Commit Message with Agent": "使用智能体生成提交消息",
"Show the Generate Commit Message with Agent button": "显示“使用智能体生成提交消息”按钮",
"Has the coding agent you work with review the changes about to be committed and write the commit message.": "让您正在使用的编程智能体审查即将提交的更改并撰写提交消息。",
"No changes to describe": "没有可描述的更改",
"Include changes in the commit first.": "请先在提交中包含更改。",
+4
View File
@@ -69,6 +69,8 @@ export interface CommitSettingsValid {
agentModel: string;
/** That model's thinking level for commit messages; empty keeps the agent's. */
agentEffort: string;
/** Show the Generate Commit Message with Agent button above the commit message. */
agentButton: boolean;
}
export interface VcsSettingsValid {
@@ -316,6 +318,7 @@ export const DEFAULT_WORKFLOW: WorkflowSettings = {
agent: "",
agentModel: "",
agentEffort: "",
agentButton: true,
},
confirmation: {
onCreate: "ask",
@@ -488,6 +491,7 @@ export function validateVcs(raw: unknown): VcsSettingsValid {
agent: text(c.agent, d.commit.agent),
agentModel: text(c.agentModel, d.commit.agentModel),
agentEffort: text(c.agentEffort, d.commit.agentEffort),
agentButton: bool(c.agentButton, d.commit.agentButton),
},
confirmation: {
onCreate: oneOf(conf.onCreate, confirm, d.confirmation.onCreate),