MCPcopy Create free account
hub / github.com/diillson/chatcli / GetSuggestedPattern

Function GetSuggestedPattern

cli/coder/policy_manager.go:434–444  ·  view source on GitHub ↗

GetSuggestedPattern returns a suggested policy pattern for the given tool invocation. For exec commands, it returns empty string to prevent "Allow Always" from being offered -- exec should always require per-command approval since any shell command could be destructive.

(toolName, args string)

Source from the content-addressed store, hash-verified

432// "Allow Always" from being offered -- exec should always require per-command
433// approval since any shell command could be destructive.
434func GetSuggestedPattern(toolName, args string) string {
435 sub, _ := NormalizeCoderArgs(args)
436 if sub == "" {
437 return toolName
438 }
439 // exec commands must NEVER get a blanket "Allow Always" pattern
440 if strings.EqualFold(sub, "exec") {
441 return ""
442 }
443 return fmt.Sprintf("%s %s", toolName, sub)
444}
445
446func (pm *PolicyManager) ActivePolicyPath() string {
447 pm.mu.RLock()

Calls 1

NormalizeCoderArgsFunction · 0.85

Tested by 2

TestGetSuggestedPatternFunction · 0.68