Skip to content

[plan] Add completion descriptions for workflow names using CompletionWithDesc #8553

Description

@github-actions

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

  1. Locate completion function in pkg/cli/completions.go:

    • Find CompleteWorkflowNames() function
  2. Create description extractor:

    func getWorkflowDescription(filepath string) string {
        // Read markdown file
        // Parse frontmatter
        // Extract 'description' or 'name' field
        // Return truncated string (max 60 chars)
    }
  3. 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))
    }
  4. Test in multiple shells:

    • Bash: gh aw run (TAB)
    • Zsh: gh aw compile (TAB)
    • Fish: gh aw enable (TAB)

Files to Modify

  • Update: pkg/cli/completions.go

    • Modify CompleteWorkflowNames() to include descriptions
    • Add getWorkflowDescription() helper function
  • 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

AI generated by Plan Command for discussion #8545

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions