chore: migrate multi-option select prompts to huh

Description

  • chore: migrate multi-option select prompts to huh

Resolves #8033 (closed)

How has this been tested?

Manual Testing Commands

1. CI Job Selection (Interactive Prompts)

These commands test the huhtest migration for interactive job selection:

  # Test interactive job selection for trace
  glab ci trace

  # Test interactive job selection for retry
  glab ci retry

  # Test interactive job selection for trigger (manual jobs only)
  glab ci trigger

  # Test with specific pipeline ID
  glab ci trace --pipeline-id <pipeline-id>
  glab ci retry --pipeline-id <pipeline-id>
  glab ci trigger --pipeline-id <pipeline-id>

  # Test with branch flag
  glab ci trace --branch main
  glab ci retry --branch develop

2. CI Status Command

Tests the interactive menu after pipeline completes:

  # View pipeline status
  glab ci status

  # Live mode (shows interactive menu when pipeline completes)
  glab ci status --live

  # Compact view
  glab ci status --compact

  # Specific branch
  glab ci status --branch main

Expected behavior: When pipeline completes in live mode, you should see a menu with options: "View logs", "Retry", "Exit"

3. Issue Board View

Tests board selection prompt:

  # Interactive board selection
  glab issue board view

  # With filters
  glab issue board view --assignee username
  glab issue board view --labels bug,feature
  glab issue board view --milestone v1.0

Expected behavior: Should prompt you to select from available project and group issue boards

4. SSH Key Commands

Tests interactive SSH key selection:

  # Interactive key selection for get
  glab ssh-key get

  # Interactive key selection for delete
  glab ssh-key delete

  # With pagination
  glab ssh-key get --per-page 50 --page 2
  glab ssh-key delete --per-page 30 --page 1

  # Direct ID (non-interactive)
  glab ssh-key get <key-id>
  glab ssh-key delete <key-id>

Expected behavior: Should show a select menu with your SSH keys and pagination info

5. Stack Navigation

Tests stack navigation commands:

  # First, create a stack
  glab stack create
  glab stack save -m "First change"
  glab stack save -m "Second change"

  # Navigate through stack
  glab stack first
  glab stack next
  glab stack prev
  glab stack last

  # Interactive move (tests huh prompt)
  glab stack move

Expected behavior: glab stack move should show an interactive menu to select which diff to check out

6. Error Handling Test

Test the bug fix for external jobs error handling:

  # In a project with external CI jobs (e.g., GitHub Actions)
  # Run trace without specifying a job when pipeline has no GitLab jobs
  glab ci trace --pipeline-id <pipeline-with-only-external-jobs>

Expected behavior: Should now properly show API errors instead of silently failing when fetching commit statuses fails

Key Test Scenarios

Interactive Prompts (huhtest migration):

  * All prompts should display correctly with proper formatting
  * Arrow keys should navigate options
  * Enter should select
  * Escape/Ctrl+C should cancel gracefully
  * Pagination info should display correctly

Error Cases:

  * Test with invalid pipeline IDs
  * Test with branches that don't exist
  * Test when no jobs are available
  * Test API failures (should show proper error messages now)

Edge Cases:

  * Empty stacks
  * Single-item selections
  * Projects without issue boards
  * No SSH keys configured

Screenshots (if appropriate):

Edited by Kai Armstrong

Merge request reports

Loading