-
Notifications
You must be signed in to change notification settings - Fork 32
Add fuzzy matching suggestions for workflow name resolution #5710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pkg/cli/commands.go
Outdated
| } | ||
|
|
||
| // Add fuzzy match suggestions | ||
| workflowName := strings.TrimSuffix(fileOrWorkflowName, ".md") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot suggestWorkflowNames should handle trimming the .md extension
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 32649ca. The suggestWorkflowNames helper now normalizes the target by stripping .md extension and extracting basename, so callers no longer need to do this themselves.
|
|
||
| // suggestWorkflowNames returns up to 3 similar workflow names using fuzzy matching | ||
| func suggestWorkflowNames(target string) []string { | ||
| availableNames := getAvailableWorkflowNames() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot always normalize target to name, from potentially a filename
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 32649ca. The function now uses filepath.Base() to extract the name from paths and strings.TrimSuffix() to remove .md extension, handling both filenames and paths correctly.
The helper now handles stripping .md extension and extracting basename, so callers don't need to normalize the input themselves. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Document three user-facing features from December 6-7: 1. gh aw init now creates .github/aw/logs/.gitignore (#5712) - Prevents workflow logs from being committed 2. Fuzzy workflow name matching (#5710) - Added Smart Features section with examples - Documents typo suggestions across all commands - Explains Levenshtein distance matching algorithm 3. Auto-detection of safe-inputs in mcp inspect (#5709) - Clarified that safe-inputs are automatically detected - Removed reference to deprecated --safe-inputs flag - Documents imported safe-inputs support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Summary
This PR adds fuzzy matching suggestions for workflow names across all commands that take workflow names as input. When a workflow is not found, the CLI now suggests up to 3 similar workflow names using Levenshtein distance (max distance of 3).
Commands updated:
gh aw compile <workflow>gh aw mcp list <workflow>gh aw mcp add <workflow> <server>gh aw mcp list-tools <server> <workflow>gh aw mcp inspect <workflow>gh aw enable <workflow>gh aw disable <workflow>gh aw logs <workflow>Example output:
Implementation:
suggestWorkflowNames()helper inpkg/cli/workflows.gothat normalizes inputgetAvailableWorkflowNames()helper inpkg/cli/workflows.go.mdextension and extracting basename from pathsparser.FindClosestMatches()function for fuzzy matchingResolveWorkflowPath,resolveWorkflowFile,EnableWorkflowsByNames, and logs commandTest coverage:
suggestWorkflowNames()with various typos and edge casesgetAvailableWorkflowNames()Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.