approval hints in task view (#6887)
* approval hints in task view * more descriptive
This commit is contained in:
1 parent
f47d07784a
commit
7c51236aef
1 file changed
+18
-3
@@ -6,8 +6,8 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/cline/cli/pkg/cli/clerror"
|
||||
"github.com/cline/cli/pkg/cli/types"
|
||||
"github.com/cline/cli/pkg/cli/output"
|
||||
"github.com/cline/cli/pkg/cli/types"
|
||||
)
|
||||
|
||||
// AskHandler handles ASK type messages
|
||||
@@ -122,6 +122,14 @@ func (h *AskHandler) handlePlanModeRespond(msg *types.ClineMessage, dc *DisplayC
|
||||
return nil
|
||||
}
|
||||
|
||||
// showApprovalHint displays a hint in non-interactive mode about how to approve/deny
|
||||
func (h *AskHandler) showApprovalHint(dc *DisplayContext) {
|
||||
if !dc.IsInteractive {
|
||||
output.Printf("\n\033[90mCline is requesting approval to use this tool\033[0m\n")
|
||||
output.Printf("\033[90mUse \033[0mcline task send --approve\033[90m or \033[0m--deny\033[90m to respond\033[0m\n")
|
||||
}
|
||||
}
|
||||
|
||||
// handleCommand handles command execution requests
|
||||
func (h *AskHandler) handleCommand(msg *types.ClineMessage, dc *DisplayContext) error {
|
||||
if msg.Text == "" {
|
||||
@@ -135,6 +143,7 @@ func (h *AskHandler) handleCommand(msg *types.ClineMessage, dc *DisplayContext)
|
||||
rendered := dc.ToolRenderer.RenderCommandApprovalRequest(msg.Text, autoApprovalConflict)
|
||||
output.Print(rendered)
|
||||
|
||||
h.showApprovalHint(dc)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -172,6 +181,7 @@ func (h *AskHandler) handleTool(msg *types.ClineMessage, dc *DisplayContext) err
|
||||
rendered := dc.ToolRenderer.RenderToolApprovalRequest(&tool)
|
||||
output.Print(rendered)
|
||||
|
||||
h.showApprovalHint(dc)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -254,7 +264,9 @@ func (h *AskHandler) handleAutoApprovalMaxReached(msg *types.ClineMessage, dc *D
|
||||
// handleBrowserActionLaunch handles browser action launch requests
|
||||
func (h *AskHandler) handleBrowserActionLaunch(msg *types.ClineMessage, dc *DisplayContext) error {
|
||||
url := strings.TrimSpace(msg.Text)
|
||||
return dc.Renderer.RenderMessage("BROWSER", fmt.Sprintf("Cline wants to launch browser and navigate to: %s. Approval required.", url), true)
|
||||
err := dc.Renderer.RenderMessage("BROWSER", fmt.Sprintf("Cline wants to launch browser and navigate to: %s. Approval required.", url), true)
|
||||
h.showApprovalHint(dc)
|
||||
return err
|
||||
}
|
||||
|
||||
// handleUseMcpServer handles MCP server usage requests
|
||||
@@ -283,8 +295,11 @@ func (h *AskHandler) handleUseMcpServer(msg *types.ClineMessage, dc *DisplayCont
|
||||
}
|
||||
}
|
||||
|
||||
return dc.Renderer.RenderMessage("MCP",
|
||||
err := dc.Renderer.RenderMessage("MCP",
|
||||
fmt.Sprintf("Cline wants to %s on the %s MCP server", operation, mcpReq.ServerName), true)
|
||||
|
||||
h.showApprovalHint(dc)
|
||||
return err
|
||||
}
|
||||
|
||||
// handleNewTask handles new task creation requests
|
||||
|
||||
Reference in new issue
Block a user