Skip to content

Commit 83d5826

Browse files
authored
Merge pull request microsoft#258221 from microsoft/tyriar/258095
Move terminal auto approve to chat.tools, add deprecation messages
2 parents ec4cf2e + 2a3dea2 commit 83d5826

File tree

2 files changed

+39
-3
lines changed

2 files changed

+39
-3
lines changed

src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandLineAutoApprover.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,31 @@ export class CommandLineAutoApprover extends Disposable {
2828
super();
2929
this.updateConfiguration();
3030
this._register(this._configurationService.onDidChangeConfiguration(e => {
31-
if (e.affectsConfiguration(TerminalChatAgentToolsSettingId.AutoApprove)) {
31+
if (
32+
e.affectsConfiguration(TerminalChatAgentToolsSettingId.AutoApprove) ||
33+
e.affectsConfiguration(TerminalChatAgentToolsSettingId.DeprecatedAutoApproveCompatible)
34+
) {
3235
this.updateConfiguration();
3336
}
3437
}));
3538
}
3639

3740
updateConfiguration() {
38-
const { denyListRules, allowListRules, allowListCommandLineRules, denyListCommandLineRules } = this._mapAutoApproveConfigToRules(this._configurationService.getValue(TerminalChatAgentToolsSettingId.AutoApprove));
41+
let configValue = this._configurationService.getValue(TerminalChatAgentToolsSettingId.AutoApprove);
42+
const deprecatedValue = this._configurationService.getValue(TerminalChatAgentToolsSettingId.DeprecatedAutoApproveCompatible);
43+
if (deprecatedValue && typeof deprecatedValue === 'object' && configValue && typeof configValue === 'object') {
44+
configValue = {
45+
...configValue,
46+
...deprecatedValue
47+
};
48+
}
49+
50+
const {
51+
denyListRules,
52+
allowListRules,
53+
allowListCommandLineRules,
54+
denyListCommandLineRules
55+
} = this._mapAutoApproveConfigToRules(configValue);
3956
this._allowListRules = allowListRules;
4057
this._denyListRules = denyListRules;
4158
this._allowListCommandLineRules = allowListCommandLineRules;

src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ import { localize } from '../../../../../nls.js';
99
import { ConfigurationScope, type IConfigurationPropertySchema } from '../../../../../platform/configuration/common/configurationRegistry.js';
1010

1111
export const enum TerminalChatAgentToolsSettingId {
12-
AutoApprove = 'chat.agent.terminal.autoApprove',
12+
AutoApprove = 'chat.tools.terminal.autoApprove',
13+
14+
DeprecatedAutoApproveCompatible = 'chat.agent.terminal.autoApprove',
15+
DeprecatedAutoApprove1 = 'chat.agent.terminal.allowList',
16+
DeprecatedAutoApprove2 = 'chat.agent.terminal.denyList',
17+
DeprecatedAutoApprove3 = 'github.copilot.chat.agent.terminal.allowList',
18+
DeprecatedAutoApprove4 = 'github.copilot.chat.agent.terminal.denyList',
1319
}
1420

1521
export interface ITerminalChatAgentToolsConfiguration {
@@ -96,3 +102,16 @@ export const terminalChatAgentToolsConfiguration: IStringDictionary<IConfigurati
96102
},
97103
}
98104
};
105+
106+
for (const id of [
107+
TerminalChatAgentToolsSettingId.DeprecatedAutoApprove1,
108+
TerminalChatAgentToolsSettingId.DeprecatedAutoApprove2,
109+
TerminalChatAgentToolsSettingId.DeprecatedAutoApprove3,
110+
TerminalChatAgentToolsSettingId.DeprecatedAutoApprove4,
111+
TerminalChatAgentToolsSettingId.DeprecatedAutoApproveCompatible,
112+
]) {
113+
terminalChatAgentToolsConfiguration[id] = {
114+
deprecated: true,
115+
markdownDeprecationMessage: localize('autoApprove.deprecated', 'Use {0} instead', `\`#${TerminalChatAgentToolsSettingId.AutoApprove}#\``)
116+
};
117+
}

0 commit comments

Comments
 (0)