fix(cli): handle Enter in watch TUI#171
Draft
aparajon wants to merge 1 commit into
Draft
Conversation
There was a problem hiding this comment.
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 --watchand 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Some terminals surface Return as
ctrl+jin 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
enterandctrl+jthrough a shared watch TUI handlerRisk 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