Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 7, 2025

  • Explore repository structure and identify commands that take workflow names
  • Find existing fuzzy matching implementation (parser.FindClosestMatches)
  • Create a helper function in pkg/cli for workflow name suggestions
  • Update ResolveWorkflowPath in pkg/cli/resolver.go to suggest similar names
  • Update enable.go to suggest similar workflow names when not found
  • Update logs.go to suggest similar workflow names when not found
  • Update commands.go (resolveWorkflowFile) to suggest similar workflow names
  • Add unit tests for fuzzy matching helper functions
  • Add integration tests for all affected commands
  • Run make lint and fix issues
  • Verify all affected commands work correctly
  • Validate all changes (note: pre-existing test failures in pkg/workflow are unrelated)
  • Move normalization logic into suggestWorkflowNames helper

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:

✗ workflow file not found: .github/workflows/audti-workflows.md

Suggestions:
  • Did you mean: audit-workflows?
  • Run 'gh aw status' to see all available workflows
  • Check for typos in the workflow name

Implementation:

  • Added suggestWorkflowNames() helper in pkg/cli/workflows.go that normalizes input
  • Added getAvailableWorkflowNames() helper in pkg/cli/workflows.go
  • The helper handles stripping .md extension and extracting basename from paths
  • Reused existing parser.FindClosestMatches() function for fuzzy matching
  • Updated error messages in ResolveWorkflowPath, resolveWorkflowFile, EnableWorkflowsByNames, and logs command
  • Added comprehensive unit and integration tests (all passing)

Test coverage:

  • Unit tests for suggestWorkflowNames() with various typos and edge cases
  • Unit tests for getAvailableWorkflowNames()
  • Integration tests for all affected commands
  • Tests for exact matches (no suggestions shown)
  • Tests for distant matches (no suggestions when distance > 3)
Original prompt

Review all commands that take a workflow name as an input and make sure that they recommend a few matching names if not found. Use a helper with fuzz search.

  • review each command
  • check not found scenario has useful help with potential name candidates

💡 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.

Copilot AI and others added 5 commits December 7, 2025 03:22
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>
Copilot AI changed the title [WIP] Review commands for workflow name suggestions Add fuzzy matching suggestions for workflow name resolution Dec 7, 2025
Copilot AI requested a review from pelikhan December 7, 2025 03:40
}

// Add fuzzy match suggestions
workflowName := strings.TrimSuffix(fileOrWorkflowName, ".md")
Copy link
Contributor

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

Copy link
Contributor Author

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()
Copy link
Contributor

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

Copy link
Contributor Author

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>
Copilot AI requested a review from pelikhan December 7, 2025 03:49
@pelikhan pelikhan marked this pull request as ready for review December 7, 2025 03:50
@pelikhan pelikhan merged commit fc84c8e into main Dec 7, 2025
5 checks passed
@pelikhan pelikhan deleted the copilot/review-workflow-name-commands branch December 7, 2025 03:50
github-actions bot added a commit that referenced this pull request Dec 7, 2025
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>
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.

2 participants