@@ -78,14 +78,14 @@ function withProvided(dir: string) {
7878
7979test ( "fromConfig - string value becomes wildcard rule" , ( ) => {
8080 const result = Permission . fromConfig ( { bash : "allow" } )
81- expect ( result ) . toEqual ( [ { permission : "shell " , pattern : "*" , action : "allow" } ] )
81+ expect ( result ) . toEqual ( [ { permission : "bash " , pattern : "*" , action : "allow" } ] )
8282} )
8383
8484test ( "fromConfig - object value converts to rules array" , ( ) => {
8585 const result = Permission . fromConfig ( { bash : { "*" : "allow" , rm : "deny" } } )
8686 expect ( result ) . toEqual ( [
87- { permission : "shell " , pattern : "*" , action : "allow" } ,
88- { permission : "shell " , pattern : "rm" , action : "deny" } ,
87+ { permission : "bash " , pattern : "*" , action : "allow" } ,
88+ { permission : "bash " , pattern : "rm" , action : "deny" } ,
8989 ] )
9090} )
9191
@@ -96,32 +96,32 @@ test("fromConfig - mixed string and object values", () => {
9696 webfetch : "ask" ,
9797 } )
9898 expect ( result ) . toEqual ( [
99- { permission : "shell " , pattern : "*" , action : "allow" } ,
100- { permission : "shell " , pattern : "rm" , action : "deny" } ,
99+ { permission : "bash " , pattern : "*" , action : "allow" } ,
100+ { permission : "bash " , pattern : "rm" , action : "deny" } ,
101101 { permission : "edit" , pattern : "*" , action : "allow" } ,
102102 { permission : "webfetch" , pattern : "*" , action : "ask" } ,
103103 ] )
104104} )
105105
106- test ( "fromConfig - shell and legacy bash normalize to shell in key order " , ( ) => {
106+ test ( "fromConfig - custom key remains separate from bash " , ( ) => {
107107 const result = Permission . fromConfig ( {
108- shell : "deny" ,
108+ custom : "deny" ,
109109 bash : "allow" ,
110110 } )
111111 expect ( result ) . toEqual ( [
112- { permission : "shell " , pattern : "*" , action : "deny" } ,
113- { permission : "shell " , pattern : "*" , action : "allow" } ,
112+ { permission : "custom " , pattern : "*" , action : "deny" } ,
113+ { permission : "bash " , pattern : "*" , action : "allow" } ,
114114 ] )
115115 expect ( Permission . evaluate ( "bash" , "ls" , result ) . action ) . toBe ( "allow" )
116- expect ( Permission . evaluate ( "shell " , "ls" , result ) . action ) . toBe ( "allow " )
116+ expect ( Permission . evaluate ( "custom " , "ls" , result ) . action ) . toBe ( "deny " )
117117} )
118118
119- test ( "fromConfig - legacy bash rules coexist with canonical shell rules" , ( ) => {
119+ test ( "fromConfig - custom rules do not affect bash rules" , ( ) => {
120120 const result = Permission . fromConfig ( {
121- shell : { "rm *" : "deny" } ,
121+ custom : { "rm *" : "deny" } ,
122122 bash : { "*" : "allow" , "rm *" : "ask" } ,
123123 } )
124- expect ( Permission . evaluate ( "shell " , "rm foo" , result ) . action ) . toBe ( "ask " )
124+ expect ( Permission . evaluate ( "custom " , "rm foo" , result ) . action ) . toBe ( "deny " )
125125 expect ( Permission . evaluate ( "bash" , "rm foo" , result ) . action ) . toBe ( "ask" )
126126} )
127127
@@ -158,8 +158,8 @@ test("fromConfig - preserves top-level config key order", () => {
158158 const wildcardFirst = Permission . fromConfig ( { "*" : "deny" , bash : "allow" } )
159159 const specificFirst = Permission . fromConfig ( { bash : "allow" , "*" : "deny" } )
160160
161- expect ( wildcardFirst . map ( ( r ) => r . permission ) ) . toEqual ( [ "*" , "shell " ] )
162- expect ( specificFirst . map ( ( r ) => r . permission ) ) . toEqual ( [ "shell " , "*" ] )
161+ expect ( wildcardFirst . map ( ( r ) => r . permission ) ) . toEqual ( [ "*" , "bash " ] )
162+ expect ( specificFirst . map ( ( r ) => r . permission ) ) . toEqual ( [ "bash " , "*" ] )
163163
164164 expect ( Permission . evaluate ( "bash" , "ls" , wildcardFirst ) . action ) . toBe ( "allow" )
165165 expect ( Permission . evaluate ( "bash" , "ls" , specificFirst ) . action ) . toBe ( "deny" )
@@ -178,7 +178,7 @@ test("fromConfig - top-level ordering is not sorted by wildcard specificity", ()
178178 edit : "deny" ,
179179 "mcp_*" : "allow" ,
180180 } )
181- expect ( ruleset . map ( ( r ) => r . permission ) ) . toEqual ( [ "shell " , "*" , "edit" , "mcp_*" ] )
181+ expect ( ruleset . map ( ( r ) => r . permission ) ) . toEqual ( [ "bash " , "*" , "edit" , "mcp_*" ] )
182182} )
183183
184184test ( "fromConfig - sub-pattern insertion order inside a tool key is preserved" , ( ) => {
@@ -304,9 +304,9 @@ test("evaluate - exact pattern match", () => {
304304 expect ( result . action ) . toBe ( "deny" )
305305} )
306306
307- test ( "evaluate - shell matches legacy bash rules" , ( ) => {
308- const result = Permission . evaluate ( "shell " , "rm" , [ { permission : "bash" , pattern : "rm" , action : "deny" } ] )
309- expect ( result . action ) . toBe ( "deny " )
307+ test ( "evaluate - custom tool does not match bash rules" , ( ) => {
308+ const result = Permission . evaluate ( "custom " , "rm" , [ { permission : "bash" , pattern : "rm" , action : "deny" } ] )
309+ expect ( result . action ) . toBe ( "ask " )
310310} )
311311
312312test ( "evaluate - wildcard pattern match" , ( ) => {
0 commit comments