@@ -15,14 +15,13 @@ describe("Destructive Command Guard auto-approval precedence", () => {
1515 alwaysAllowFollowupQuestions : false ,
1616 allowedCommands : [ "echo" ] ,
1717 deniedCommands : [ "rm" ] ,
18- alwaysAllowCommandsExceptDenied : false ,
1918 destructiveCommandGuardEnabled : true ,
2019 mcpServers : [ ] ,
2120 }
2221
23- it ( "ignores Zoo's deny list while DCG is enabled " , async ( ) => {
22+ it ( "auto-approves commands allowed by DCG without consulting Zoo's deny list" , async ( ) => {
2423 expect ( await checkAutoApproval ( { state : baseState , ask : "command" , text : "rm file" } ) ) . toEqual ( {
25- decision : "ask " ,
24+ decision : "approve " ,
2625 } )
2726 } )
2827
@@ -32,9 +31,33 @@ describe("Destructive Command Guard auto-approval precedence", () => {
3231 ) . toEqual ( { decision : "ask" } )
3332 } )
3433
35- it ( "retains ordinary allowlist auto-approval for DCG-allowed commands" , async ( ) => {
36- expect ( await checkAutoApproval ( { state : baseState , ask : "command" , text : "echo safe" } ) ) . toEqual ( {
34+ it ( "auto-approves DCG-allowed commands without consulting Zoo's allowlist" , async ( ) => {
35+ expect ( await checkAutoApproval ( { state : baseState , ask : "command" , text : "unlisted-command" } ) ) . toEqual ( {
36+ decision : "approve" ,
37+ } )
38+ } )
39+
40+ it ( "keeps ordinary allowlist auto-approval when DCG is disabled" , async ( ) => {
41+ const state = { ...baseState , destructiveCommandGuardEnabled : false }
42+
43+ expect ( await checkAutoApproval ( { state, ask : "command" , text : "echo safe" } ) ) . toEqual ( {
3744 decision : "approve" ,
3845 } )
3946 } )
47+
48+ it ( "keeps ordinary denylist behavior when DCG is disabled" , async ( ) => {
49+ const state = { ...baseState , destructiveCommandGuardEnabled : false }
50+
51+ expect ( await checkAutoApproval ( { state, ask : "command" , text : "rm file" } ) ) . toEqual ( {
52+ decision : "deny" ,
53+ } )
54+ } )
55+
56+ it ( "keeps ordinary prompts for unlisted commands when DCG is disabled" , async ( ) => {
57+ const state = { ...baseState , destructiveCommandGuardEnabled : false }
58+
59+ expect ( await checkAutoApproval ( { state, ask : "command" , text : "unlisted-command" } ) ) . toEqual ( {
60+ decision : "ask" ,
61+ } )
62+ } )
4063} )
0 commit comments