Enhance bash tool security and improve permission dialog UI

- Expand safe command list with common dev tools (git, go, node, python, etc.)
- Improve multi-word command detection for better security checks
- Add scrollable viewport to permission dialog for better diff viewing
- Fix command batching in TUI update to properly handle multiple commands

🤖 Generated with termai
Co-Authored-By: termai <noreply@termai.io>
This commit is contained in:
Kujtim Hoxha
2025-04-04 15:41:25 +02:00
parent 8f8b403bbc
commit 6419973667
4 changed files with 149 additions and 37 deletions

View File

@@ -123,8 +123,6 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
a.status, _ = a.status.Update(msg)
case util.ErrorMsg:
a.status, _ = a.status.Update(msg)
case util.ClearStatusMsg:
a.status, _ = a.status.Update(msg)
case tea.KeyMsg:
if a.editorMode == vimtea.ModeNormal {
switch {
@@ -163,16 +161,21 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
}
}
var cmds []tea.Cmd
s, cmd := a.status.Update(msg)
a.status = s
cmds = append(cmds, cmd)
if a.dialogVisible {
d, cmd := a.dialog.Update(msg)
a.dialog = d.(core.DialogCmp)
return a, cmd
cmds = append(cmds, cmd)
return a, tea.Batch(cmds...)
}
s, _ := a.status.Update(msg)
a.status = s
p, cmd := a.pages[a.currentPage].Update(msg)
a.pages[a.currentPage] = p
return a, cmd
cmds = append(cmds, cmd)
return a, tea.Batch(cmds...)
}
func (a *appModel) ToggleHelp() {