Objective
Implement "Did you mean?" fuzzy matching for engine names, MCP server names, and event types to help users quickly fix typos and misspellings.
Context
From discussion #33307: Users currently see unhelpful errors like "invalid engine: copiliot" when they make typos. The codebase already has excellent fuzzy matching in pkg/cli/run_workflow_validation.go that can be reused for other common error scenarios.
Approach
- Extract the fuzzy matching logic from
pkg/cli/run_workflow_validation.go into a reusable utility function in pkg/stringutil/
- Apply fuzzy matching to these high-impact error scenarios:
- Engine names (
copilot, claude, codex, custom)
- MCP server names (from registry or user-configured)
- GitHub event types (
push, pull_request, issues, etc.)
- Permission scopes (
contents, issues, pull_requests, etc.)
Files to Modify
- Create:
pkg/stringutil/fuzzy_match.go (extract from run_workflow_validation.go)
- Create:
pkg/stringutil/fuzzy_match_test.go (test coverage)
- Update:
pkg/workflow/engine_validation.go (add fuzzy matching for engine names)
- Update:
pkg/workflow/mcp_property_validation.go (add fuzzy matching for MCP servers)
- Update:
pkg/workflow/event_validation.go (add fuzzy matching for event types)
- Update:
pkg/workflow/permissions_validation.go (add fuzzy matching for permission scopes)
Example Implementation
Extracted utility function:
// pkg/stringutil/fuzzy_match.go
package stringutil
// FindClosestMatches returns suggestions for misspelled input
func FindClosestMatches(input string, validOptions []string, maxDistance int) []string {
// Use Levenshtein distance or similar algorithm
// Return top 3 closest matches if distance <= maxDistance
}
Usage in validation:
// Before
return fmt.Errorf("invalid engine: %s", engineName)
// After
validEngines := []string{"copilot", "claude", "codex", "custom"}
matches := stringutil.FindClosestMatches(engineName, validEngines, 2)
if len(matches) > 0 {
return NewValidationError(
"engine",
engineName,
fmt.Sprintf("engine '%s' is not valid", engineName),
fmt.Sprintf("Did you mean '%s'?\n\nValid engines: %s",
strings.Join(matches, "', '"),
strings.Join(validEngines, ", "))
)
}
Acceptance Criteria
Testing Strategy
- Test common typos: "copiliot" → suggests "copilot"
- Test case sensitivity: "Copilot" → suggests "copilot"
- Test partial matches: "cop" → suggests "copilot"
- Test distance threshold: "xyz" → no suggestions (too different)
- Verify existing tests still pass
Reference
Generated by 📋 Plan Command · ● 12.7M · ◷
Objective
Implement "Did you mean?" fuzzy matching for engine names, MCP server names, and event types to help users quickly fix typos and misspellings.
Context
From discussion #33307: Users currently see unhelpful errors like "invalid engine: copiliot" when they make typos. The codebase already has excellent fuzzy matching in
pkg/cli/run_workflow_validation.gothat can be reused for other common error scenarios.Approach
pkg/cli/run_workflow_validation.gointo a reusable utility function inpkg/stringutil/copilot,claude,codex,custom)push,pull_request,issues, etc.)contents,issues,pull_requests, etc.)Files to Modify
pkg/stringutil/fuzzy_match.go(extract from run_workflow_validation.go)pkg/stringutil/fuzzy_match_test.go(test coverage)pkg/workflow/engine_validation.go(add fuzzy matching for engine names)pkg/workflow/mcp_property_validation.go(add fuzzy matching for MCP servers)pkg/workflow/event_validation.go(add fuzzy matching for event types)pkg/workflow/permissions_validation.go(add fuzzy matching for permission scopes)Example Implementation
Extracted utility function:
Usage in validation:
Acceptance Criteria
pkg/stringutil/fuzzy_match.gomake agent-finishsuccessfully before committingTesting Strategy
Reference
pkg/cli/run_workflow_validation.go(existing fuzzy matching implementation)gitthat suggest "Did you mean 'commit'?"