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

Method ValidateCommand

cli/agent/command_validator.go:195–207  ·  view source on GitHub ↗

ValidateCommand valida um comando antes da execução

(cmd string)

Source from the content-addressed store, hash-verified

193
194// ValidateCommand valida um comando antes da execução
195func (v *CommandValidator) ValidateCommand(cmd string) error {
196 if strings.TrimSpace(cmd) == "" {
197 return errors.New(i18n.T("agent.validator.empty_command"))
198 }
199
200 if v.IsDangerous(cmd) {
201 // CORREÇÃO: Construir a string primeiro e passá-la como argumento para fmt.Errorf
202 errorMsg := i18n.T("agent.validator.dangerous_command", cmd)
203 return fmt.Errorf("%s", errorMsg)
204 }
205
206 return nil
207}
208
209// IsLikelyInteractive verifica se um comando provavelmente é interativo
210func (v *CommandValidator) IsLikelyInteractive(cmd string) bool {

Callers 2

ExecuteMethod · 0.80

Calls 3

IsDangerousMethod · 0.95
TFunction · 0.92
ErrorfMethod · 0.80

Tested by 1