Skip to content

fix(cli): handle Enter in watch TUI#171

Draft
aparajon wants to merge 1 commit into
mainfrom
armand/fix-enter-deploy-tui
Draft

fix(cli): handle Enter in watch TUI#171
aparajon wants to merge 1 commit into
mainfrom
armand/fix-enter-deploy-tui

Conversation

@aparajon
Copy link
Copy Markdown
Collaborator

Why

Some terminals surface Return as ctrl+j in Bubble Tea, so pressing Enter in the watch TUI could fail to trigger deferred deploy, cutover, or skip-revert. The apply-created watch session also needs known environment scope immediately so control requests are correctly scoped before the first progress payload arrives.

What

  • Normalize enter and ctrl+j through a shared watch TUI handler
  • Seed database/environment into interactive apply/progress watch models
  • Fix the printed progress resume command to use positional apply ID syntax
  • Add regression coverage for deploy, cutover, and skip-revert Enter handling

Risk Assessment

Low. This is limited to CLI watch-mode input handling and resume text; command package tests cover the changed key paths.

References

  • go test ./pkg/cmd/...
  • go build ./...

Generated with Codex

Copilot AI review requested due to automatic review settings May 27, 2026 14:00
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes Bubble Tea watch-mode input handling so Enter reliably triggers deferred deploy/cutover/skip-revert across terminals (including those reporting Enter as ctrl+j), and ensures the watch TUI has database/environment scope available immediately for correctly scoped control requests. It also updates the printed “resume progress” command to use the positional apply ID syntax and adds regression tests for the Enter/ctrl+j behavior.

Changes:

  • Normalize Enter handling (enter + ctrl+j) via a shared key handler and centralize the deploy/cutover/skip-revert trigger logic.
  • Seed database/environment scope into apply-id watch sessions (used by progress --watch and apply watch) before the first progress payload arrives.
  • Update the exit/resume text and tests to use schemabot progress <applyID> positional syntax.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/cmd/commands/watch_tui.go Adds Enter/ctrl+j normalization and factors Enter-trigger behavior into a helper; adds scoped apply-id watch helper; updates resume command format.
pkg/cmd/commands/watch_tui_test.go Adds regression tests ensuring Enter and ctrl+j trigger deploy/cutover/skip-revert; updates resume command assertions.
pkg/cmd/commands/watch_tui_commands.go Introduces an overridable callStartAPI for deploy-trigger testability; routes deploy trigger through it.
pkg/cmd/commands/progress.go Ensures watch-mode progress uses the scoped apply-id watch helper to pre-seed database/environment.
pkg/cmd/commands/common.go Passes database/environment into apply-and-watch to seed interactive watch scope.
pkg/cmd/commands/apply.go Extends WatchApplyProgressWithFormat signature to accept database/environment and passes them into the scoped interactive watch helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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