MCPcopy Create free account
hub / github.com/github/gh-aw / ValidateWorkflowIntent

Function ValidateWorkflowIntent

pkg/cli/validators.go:35–48  ·  view source on GitHub ↗

ValidateWorkflowIntent checks if the provided workflow intent is valid. It ensures the intent has meaningful content with at least 20 characters and is not just whitespace.

(s string)

Source from the content-addressed store, hash-verified

33// It ensures the intent has meaningful content with at least 20 characters
34// and is not just whitespace.
35func ValidateWorkflowIntent(s string) error {
36 validatorsLog.Printf("Validating workflow intent: length=%d", len(s))
37 trimmed := strings.TrimSpace(s)
38 if trimmed == "" {
39 validatorsLog.Print("Workflow intent validation failed: empty content")
40 return errors.New("workflow instructions cannot be empty")
41 }
42 if len(trimmed) < 20 {
43 validatorsLog.Printf("Workflow intent validation failed: too short (%d chars)", len(trimmed))
44 return errors.New("please provide at least 20 characters of instructions")
45 }
46 validatorsLog.Printf("Workflow intent validated successfully: %d chars", len(trimmed))
47 return nil
48}

Calls 2

PrintMethod · 0.80
PrintfMethod · 0.45