Skip to content

Add a TUI when invoked without arguments - #18

Open
colinstark wants to merge 32 commits into
mainfrom
colinstark/tui-pr
Open

colinstark wants to merge 32 commits into
mainfrom
colinstark/tui-pr

Conversation

@colinstark

@colinstark colinstark commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR adds a full-screen terminal UI for Enterprise Live Migrations. Running gh elm with no arguments in an interactive terminal now opens a guided interface for configuring endpoints, creating and operating migrations, inspecting destination-side state, managing reports and resources, and reclaiming mannequins.

The existing command-line commands and machine-readable output remain available for automation. When input or output is not an interactive terminal, bare gh elm continues to show command help.

What’s included

Guided configuration

  • View the effective source and target configuration with credentials redacted.
  • Configure source and target URLs and tokens directly in the TUI.
  • Normalize supported target hostnames to their API endpoints.
  • Validate source and target authentication before enabling migration actions.
  • Reset stored configuration and credentials with confirmation.
  • Surface configuration and authentication errors without leaving the interface.

Migration discovery and creation

  • Browse and search source repositories available through the configured GHES appliance.
  • Display repository metadata to help identify the correct source repository.
  • Browse and search available destination organizations.
  • Default the destination repository name from the selected source while keeping it editable.
  • Select internal or private destination visibility.
  • Optionally start a migration immediately after creation.
  • Fall back to manual org/repo entry when API discovery is unavailable or undesirable.
  • Prevent duplicate source migration creation and use the API-required system PAT reference.

Source migration management

  • List and search source migrations, including created and active migrations.
  • Toggle between compact and detailed migration-list views.
  • Open a migration directly by UUID.
  • Display migration state, phase progress, repository metadata, timestamps, messages, and cutover readiness.
  • Refresh migration details without replacing the current page with a loading screen.
  • Start, pause, resume, or cancel migrations according to their current state.
  • Initiate cutover when ready or explicitly force cutover when readiness checks have not passed.
  • Revert a completed cutover.
  • Require confirmation for destructive or irreversible actions.

Destination migration management

  • Follow the target migration ID directly from a source migration without copying IDs between commands.
  • Open a destination migration directly by numeric ID.
  • Display destination status, repository progress, attribution, timestamps, and related migration details.
  • Create a target-side migration for advanced and diagnostic workflows.
  • Pause, resume, or abort destination migrations when supported by their current state.

Resources and reports

  • List repository resources associated with a destination migration.
  • Filter resources by repository, migration origin, and processing state.
  • Control the maximum number of returned resources or request the complete result set.
  • Request backfill or live-update node reports.
  • Check report generation status.
  • Retrieve signed report download URLs.

Mannequin management

  • List mannequins for a target organization.
  • Include or exclude already reclaimed mannequins.
  • Export mannequin records to CSV.
  • Reclaim an individual mannequin.
  • Reclaim mannequins in bulk from an edited CSV.
  • Support invitation-based reclaim, EMU immediate reattribution, and customer-owned GitHub App or bot accounts.
  • Warn about potentially incorrect bot mappings and require explicit confirmation for irreversible bot reclaims.

Terminal experience

  • Launch automatically only when both input and output are interactive terminals.
  • Use a full-screen alternate-buffer interface while preserving the existing non-interactive CLI behavior.
  • Support arrow keys and j/k navigation, Enter to select, Escape to go back, / to search, Ctrl+V to change list density, Page Up/Page Down for long views, ? for contextual help, and q to quit.
  • Provide focused action buttons with keyboard shortcuts across forms and detail screens.
  • Add native terminal cursor handling for clearer text-field editing.
  • Support text insertion, deletion, word deletion, selectable values, toggles, and editable form fields.
  • Keep navigation and action availability synchronized with configuration and migration state.
  • Present loading, empty, success, warning, confirmation, and error states consistently.

Shared workflow layer

  • Add a command-neutral workflow service used by the TUI for configuration, migration lifecycle operations, target resources and reports, and mannequin management.
  • Centralize validation, endpoint resolution, credential loading, pagination, status handling, and human-readable errors.
  • Expand source and target API clients to expose repository catalogs, organizations, destination migrations, progress, reports, and related metadata required by the interactive workflows.

Documentation and tests

  • Document how the TUI launches, its navigation model, creation workflow, repository discovery, and manual-entry fallback.
  • Add comprehensive unit coverage for TUI state transitions, navigation, forms, actions, confirmations, rendering, cursor behavior, API operations, and workflow orchestration.
  • Extend command, rendering, endpoint, and API regression coverage for the behavior used by the TUI.

Testing

  • go test ./...

colinstark and others added 28 commits September 18, 2026 16:37
Use the API-required system-pat reference for source-driven migration creation in both CLI and TUI workflows, with request-level regression coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Repository records now retain API metadata through the workflow catalog for TUI use.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Improve responsive repository details, richer card and button decoration, functional shortcuts, and independent always-valid action focus.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep existing migration details visible until refreshed values arrive, and preserve them when a refresh fails.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Hide refresh and messages until source migrations start, and support terminal-style Alt+Delete word removal in editable form fields.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep migration details and lists current without loading flashes, improve migration headers and creation results, and refine cancellation labels and list overflow layout.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Hide migration-only progress states from cutover output while retaining readiness, blockers, repository details, and cutover lifecycle statuses.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Give every form a contextual primary button and a Cancel button, matching the configuration form interaction pattern.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep destination operations accessible through source migration details and remove redundant advanced navigation and branding from the TUI.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 18, 2026 14:38
@colinstark
colinstark requested a review from a team as a code owner September 18, 2026 14:38
@colinstark colinstark changed the title Polish interactive terminal migration workflows Add a TUI when invoked without arguments Sep 18, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Target progress grouping mishandles prefixed protobuf resource types, causing incorrect labels and totals.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Polishes interactive migration workflows and enriches migration metadata and progress rendering.

Changes:

  • Refines TUI navigation, forms, overlays, actions, and native cursor handling.
  • Adds repository metadata and destination progress summaries.
  • Normalizes configuration/API behavior and expands regression coverage.
File Description
README.md Updates TUI usage guidance.
internal/​workflow/​service.go Refines configuration, repositories, and PAT handling.
internal/​workflow/​service_test.go Tests workflow service changes.
internal/​tui/​view.go Overhauls TUI rendering and progress views.
internal/​tui/​model.go Refactors navigation, forms, actions, and state.
internal/​tui/​model_test.go Expands TUI workflow coverage.
internal/​tui/​keys.go Updates search-key help.
internal/​tui/​cursor.go Adds native terminal cursor support.
internal/​tui/​cursor_test.go Tests cursor adaptation.
internal/​tui/​components.go Adds badges and improved buttons.
internal/​theme/​theme.go Extends semantic styling.
internal/​theme/​theme_test.go Tests theme additions.
internal/​render/​migration.go Refines status and progress rendering.
internal/​render/​migration_test.go Tests migration presentation.
internal/​endpoints/​endpoints.go Normalizes bare target hostnames.
internal/​endpoints/​endpoints_test.go Tests hostname normalization.
internal/​elmapi/​target_migrations.go Models target summaries and encoded counts.
internal/​elmapi/​target_migrations_test.go Tests target response decoding.
internal/​elmapi/​migrations.go Defines the system PAT reference.
internal/​elmapi/​catalog.go Preserves repository metadata.
internal/​elmapi/​catalog_test.go Tests repository metadata decoding.
internal/​cmd/​tui.go Installs native cursor output.
internal/​cmd/​migration/​watch/​watch_test.go Tests cancelled terminology.
internal/​cmd/​migration/​watch/​view.go Displays terminated migrations as cancelled.
internal/​cmd/​migration/​watch/​phases.go Updates termination labels.
internal/​cmd/​migration/​migration.go Uses the system PAT reference.
internal/​cmd/​migration/​migration_test.go Updates command behavior assertions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/tui/view.go
Comment thread internal/tui/model_test.go Outdated
colinstark and others added 4 commits September 18, 2026 17:06
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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