-
Notifications
You must be signed in to change notification settings - Fork 295
Closed
Labels
Description
Objective
Enhance shell completions to show workflow descriptions alongside workflow names when users press TAB, leveraging Cobra v1.9.0+ CompletionWithDesc functionality.
Context
Currently, shell completions only show workflow names. With completion descriptions, users will see:
my-workflow Daily CI workflow for testing
deploy-prod Production deployment workflow
This significantly improves discoverability and reduces need to check workflow files.
Implementation Approach
-
Locate completion function in
pkg/cli/completions.go:- Find
CompleteWorkflowNames()function
- Find
-
Create description extractor:
func getWorkflowDescription(filepath string) string { // Read markdown file // Parse frontmatter // Extract 'description' or 'name' field // Return truncated string (max 60 chars) }
-
Update completion function to use tab-separated format:
for _, file := range mdFiles { name := strings.TrimSuffix(filepath.Base(file), ".md") desc := getWorkflowDescription(file) completions = append(completions, fmt.Sprintf("%s\t%s", name, desc)) }
-
Test in multiple shells:
- Bash:
gh aw run (TAB) - Zsh:
gh aw compile (TAB) - Fish:
gh aw enable (TAB)
- Bash:
Files to Modify
-
Update:
pkg/cli/completions.go- Modify
CompleteWorkflowNames()to include descriptions - Add
getWorkflowDescription()helper function
- Modify
-
Update:
pkg/cli/completions_test.go(if exists, otherwise create)- Add tests for description extraction
- Test truncation behavior
Acceptance Criteria
- Shell completions show workflow descriptions in bash/zsh/fish
- Descriptions are truncated to reasonable length (60 chars)
- Fallback to empty string if description not available
- No performance degradation (descriptions cached if needed)
- Test coverage for new functionality
References
- Cobra v1.9.0
CompletionWithDeschelper - Format:
"completion\tdescription"per shell completion standards
Related to [plan] Enhance Cobra CLI implementation with completion descriptions and context support #8552
AI generated by Plan Command for discussion #8545
Reactions are currently unavailable