@@ -80,24 +80,23 @@ function Approvals:is_approved(bufnr, args)
8080 return false
8181 end
8282
83- local tool_cfg = args .tool_name and config .interactions .chat .tools and config .interactions .chat .tools [args .tool_name ]
83+ local tool_cfg = args
84+ and args .tool_name
85+ and config .interactions .chat .tools
86+ and config .interactions .chat .tools [args .tool_name ]
8487
85- if approvals .yolo_mode then
86- if not args or not args .tool_name then
87- return true
88- end
89-
90- if tool_cfg and tool_cfg .opts then
91- -- Allow users to designate certain tools as not allowed in yolo mode
88+ -- Check if tool requires command-level approval first
89+ if tool_cfg and tool_cfg .opts and tool_cfg .opts .require_cmd_approval then
90+ -- Yolo mode overrides cmd approval requirement
91+ if approvals .yolo_mode then
92+ -- But still respect allowed_in_yolo_mode = false
9293 if tool_cfg .opts .allowed_in_yolo_mode == false then
9394 return false
9495 end
96+ return true
9597 end
9698
97- return true
98- end
99-
100- if tool_cfg and tool_cfg .opts and tool_cfg .opts .require_cmd_approval then
99+ -- Not in yolo mode, check if this specific command was approved
101100 if not approvals [args .tool_name ] then
102101 return false
103102 end
@@ -108,6 +107,22 @@ function Approvals:is_approved(bufnr, args)
108107 return false
109108 end
110109
110+ -- Handle yolo mode for regular tools (non-cmd-approval tools)
111+ if approvals .yolo_mode then
112+ if not args or not args .tool_name then
113+ return true
114+ end
115+
116+ if tool_cfg and tool_cfg .opts then
117+ -- Allow users to designate certain tools as not allowed in yolo mode
118+ if tool_cfg .opts .allowed_in_yolo_mode == false then
119+ return false
120+ end
121+ end
122+
123+ return true
124+ end
125+
111126 if args and args .tool_name then
112127 return approvals [args .tool_name ] == true
113128 end
0 commit comments