suggestWorkflowNames returns up to 3 similar workflow names using fuzzy matching The target can be a workflow name or filename (with or without .md extension)
(target string)
| 249 | // suggestWorkflowNames returns up to 3 similar workflow names using fuzzy matching |
| 250 | // The target can be a workflow name or filename (with or without .md extension) |
| 251 | func suggestWorkflowNames(target string) []string { |
| 252 | availableNames := getAvailableWorkflowNames() |
| 253 | if len(availableNames) == 0 { |
| 254 | return nil |
| 255 | } |
| 256 | |
| 257 | // Normalize target: strip .md extension and get basename if it's a path |
| 258 | normalizedTarget := strings.TrimSuffix(filepath.Base(target), ".md") |
| 259 | |
| 260 | workflowsLog.Printf("Suggesting workflow names for %q (available: %d)", normalizedTarget, len(availableNames)) |
| 261 | // Use the existing FindClosestMatches function from parser package |
| 262 | suggestions := parser.FindClosestMatches(normalizedTarget, availableNames, 3) |
| 263 | workflowsLog.Printf("Found %d suggestion(s) for %q: %v", len(suggestions), normalizedTarget, suggestions) |
| 264 | return suggestions |
| 265 | } |
| 266 | |
| 267 | // isWorkflowFile returns true if the file should be treated as a workflow file. |
| 268 | // README.md files are excluded as they are documentation, not workflows. |