Skip to content

Add non-empty validation to workflow intent field#21556

Closed
Copilot wants to merge 1 commit intomainfrom
copilot/add-non-empty-validation-workflow-intent
Closed

Add non-empty validation to workflow intent field#21556
Copilot wants to merge 1 commit intomainfrom
copilot/add-non-empty-validation-workflow-intent

Conversation

Copy link
Contributor

Copilot AI commented Mar 18, 2026

The huh.NewText() intent field in interactive.go accepted empty strings while the workflow name field already enforced non-empty input — an inconsistency flagged in the Terminal Stylist audit.

Changes

  • pkg/cli/validators.go — Added ValidateWorkflowIntent function that rejects empty/whitespace-only input and enforces a 20-character minimum for meaningful instructions
  • pkg/cli/interactive.go — Wired .Validate(ValidateWorkflowIntent) onto the intent huh.NewText() field
  • pkg/cli/validators_test.go — Added TestValidateWorkflowIntent and TestValidateWorkflowIntent_EdgeCases covering empty, whitespace-only, too-short, and valid inputs
huh.NewText().
    Title("Describe what this workflow should do:").
    Value(&b.Intent).
    Validate(ValidateWorkflowIntent),  // rejects empty + < 20 chars
func ValidateWorkflowIntent(s string) error {
    trimmed := strings.TrimSpace(s)
    if len(trimmed) == 0 {
        return errors.New("workflow instructions cannot be empty")
    }
    if len(trimmed) < 20 {
        return errors.New("please provide at least 20 characters of instructions")
    }
    return nil
}

📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Copilot AI linked an issue Mar 18, 2026 that may be closed by this pull request
5 tasks
Copilot AI changed the title [WIP] [plan] Add non-empty validation to workflow intent field Add non-empty validation to workflow intent field Mar 18, 2026
Copilot AI requested a review from pelikhan March 18, 2026 10:54
@pelikhan pelikhan closed this Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[plan] Add non-empty validation to workflow intent field in interactive.go

2 participants