Skip to content

Commit 8636d22

Browse files
authored
Merge pull request #817 from Deepam02/add-yolo-command
Add /yolo command to toggle tool approval
2 parents 56e8bab + 66fc848 commit 8636d22

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

docs/USAGE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ During CLI sessions, you can use special commands:
115115
| `/reset` | Clear conversation history |
116116
| `/eval` | Save current conversation for evaluation |
117117
| `/compact` | Compact conversation to lower context usage |
118+
| `/yolo` | Toggle automatic approval of tool calls |
118119

119120
## 🔧 Configuration Reference
120121

pkg/tui/commands/commands.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ type (
1616
EvalSessionMsg struct{}
1717
CompactSessionMsg struct{}
1818
CopySessionToClipboardMsg struct{}
19+
ToggleYoloMsg struct{}
1920
)
2021

2122
// Agent commands
@@ -85,6 +86,16 @@ func BuiltInSessionCommands() []Item {
8586
return core.CmdHandler(EvalSessionMsg{})
8687
},
8788
},
89+
{
90+
ID: "session.yolo",
91+
Label: "Yolo",
92+
SlashCommand: "/yolo",
93+
Description: "Toggle automatic approval of tool calls",
94+
Category: "Session",
95+
Execute: func() tea.Cmd {
96+
return core.CmdHandler(ToggleYoloMsg{})
97+
},
98+
},
8899
}
89100
}
90101

pkg/tui/tui.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,17 @@ func (a *appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
193193

194194
return a, core.CmdHandler(notification.ShowMsg{Text: "Conversation copied to clipboard."})
195195

196+
case commands.ToggleYoloMsg:
197+
sess := a.application.Session()
198+
sess.ToolsApproved = !sess.ToolsApproved
199+
var statusText string
200+
if sess.ToolsApproved {
201+
statusText = "Yolo mode enabled: tools will be auto-approved"
202+
} else {
203+
statusText = "Yolo mode disabled: tools will require confirmation"
204+
}
205+
return a, core.CmdHandler(notification.ShowMsg{Text: statusText})
206+
196207
case commands.AgentCommandMsg:
197208
resolvedCommand := a.application.ResolveCommand(context.Background(), msg.Command)
198209
return a, core.CmdHandler(editor.SendMsg{Content: resolvedCommand})

0 commit comments

Comments
 (0)