@@ -302,6 +302,11 @@ export const RunCommand = cmd({
302302 describe : "show thinking blocks" ,
303303 default : false ,
304304 } )
305+ . option ( "dangerously-skip-permissions" , {
306+ type : "boolean" ,
307+ describe : "auto-approve permissions that are not explicitly denied (dangerous!)" ,
308+ default : false ,
309+ } )
305310 } ,
306311 handler : async ( args ) => {
307312 let message = [ ...args . message , ...( args [ "--" ] || [ ] ) ]
@@ -544,15 +549,23 @@ export const RunCommand = cmd({
544549 if ( event . type === "permission.asked" ) {
545550 const permission = event . properties
546551 if ( permission . sessionID !== sessionID ) continue
547- UI . println (
548- UI . Style . TEXT_WARNING_BOLD + "!" ,
549- UI . Style . TEXT_NORMAL +
550- `permission requested: ${ permission . permission } (${ permission . patterns . join ( ", " ) } ); auto-rejecting` ,
551- )
552- await sdk . permission . reply ( {
553- requestID : permission . id ,
554- reply : "reject" ,
555- } )
552+
553+ if ( args [ "dangerously-skip-permissions" ] ) {
554+ await sdk . permission . reply ( {
555+ requestID : permission . id ,
556+ reply : "once" ,
557+ } )
558+ } else {
559+ UI . println (
560+ UI . Style . TEXT_WARNING_BOLD + "!" ,
561+ UI . Style . TEXT_NORMAL +
562+ `permission requested: ${ permission . permission } (${ permission . patterns . join ( ", " ) } ); auto-rejecting` ,
563+ )
564+ await sdk . permission . reply ( {
565+ requestID : permission . id ,
566+ reply : "reject" ,
567+ } )
568+ }
556569 }
557570 }
558571 }
0 commit comments