Skip to content

Commit e980501

Browse files
committed
Support null as value in autoApprove
1 parent 85a3729 commit e980501

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

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

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,27 @@ export const terminalChatAgentToolsConfiguration: IStringDictionary<IConfigurati
2727
default: true,
2828
},
2929
[TerminalChatAgentToolsSettingId.AutoApprove]: {
30-
markdownDescription: localize('autoApprove', "A list of commands or regular expressions that control whether the run in terminal tool commands require explicit approval. These will be matched against the start of a command. A regular expression can be provided by wrapping the string in `/` characters.\n\nSet to `true` to automatically approve commands, or `false` to require explicit approval.\n\nExamples:\n- `\"mkdir\": true` Will allow all command lines starting with `mkdir`\n- `\"npm run build\": true` Will allow all command lines starting with `npm run build`\n- `\"rm\": false` Will require explicit approval for all command lines starting with `rm`\n- `\"/^git (status|show\\b.*)$/\": true` will allow `git status` and all command lines starting with `git show`\n- `\"/.*/\": true` will allow all command lines\n\nCommands set to `false` will override those set to `true`."),
30+
markdownDescription: localize('autoApprove', "A list of commands or regular expressions that control whether the run in terminal tool commands require explicit approval. These will be matched against the start of a command. A regular expression can be provided by wrapping the string in `/` characters.\n\nSet to `true` to automatically approve commands, or `false` to always require explicit approval.\n\nExamples:\n- `\"mkdir\": true` Will allow all command lines starting with `mkdir`\n- `\"npm run build\": true` Will allow all command lines starting with `npm run build`\n- `\"rm\": false` Will require explicit approval for all command lines starting with `rm`\n- `\"/^git (status|show\\b.*)$/\": true` will allow `git status` and all command lines starting with `git show`\n- `\"/.*/\": true` will allow all command lines\n\nNote that these commands and regular expressions are evaluated for every sub-command within a single command line, so `foo && bar` for example will need both `foo` and `bar` to match a `true` entry and must not match a `false` entry."),
3131
type: 'object',
3232
additionalProperties: {
33-
type: 'boolean',
34-
enum: [
35-
true,
36-
false,
37-
null,
38-
],
39-
enumDescriptions: [
40-
localize('autoApprove.true', "Automatically approve the pattern."),
41-
localize('autoApprove.false', "Require explicit approval for the pattern."),
42-
],
43-
description: localize('autoApprove.key', "The start of a command to match against. A regular expression can be provided by wrapping the string in `/` characters."),
33+
anyOf: [
34+
{
35+
type: 'boolean',
36+
enum: [
37+
true,
38+
false,
39+
],
40+
enumDescriptions: [
41+
localize('autoApprove.true', "Automatically approve the pattern."),
42+
localize('autoApprove.false', "Require explicit approval for the pattern."),
43+
],
44+
description: localize('autoApprove.key', "The start of a command to match against. A regular expression can be provided by wrapping the string in `/` characters."),
45+
},
46+
{
47+
type: 'null',
48+
description: localize('autoApprove.null', "Ignore the pattern, this is useful for unsetting the same pattern set at a higher scope."),
49+
},
50+
]
4451
},
4552
tags: [
4653
'experimental'
@@ -57,9 +64,5 @@ export const terminalChatAgentToolsConfiguration: IStringDictionary<IConfigurati
5764
chown: false,
5865
'Remove-Item': false,
5966
},
60-
policy: {
61-
name: 'TerminalChatAgentToolsAutoApprove',
62-
minimumVersion: '1.103',
63-
}
6467
}
6568
};

0 commit comments

Comments
 (0)