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

Function suggestWorkflowNames

pkg/cli/workflows.go:251–265  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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)
251func 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.

Callers 6

NewLogsCommandFunction · 0.85
TestSuggestWorkflowNamesFunction · 0.85
toggleWorkflowsByNamesFunction · 0.85
ResolveWorkflowPathFunction · 0.85
resolveWorkflowFileInDirFunction · 0.85
validateMCPWorkflowNameFunction · 0.85

Calls 3

FindClosestMatchesFunction · 0.92
PrintfMethod · 0.45

Tested by 1

TestSuggestWorkflowNamesFunction · 0.68