Repository navigation
OMNIS-34: Add the plan preview and apply handoff to the TUI - #42
Merged
Merged
Conversation
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.
YouTrack: https://youtrack.xn--wrm-hoa.li/issue/OMNIS-34 (sub-task of OMNIS-14)
In
omnishell tui, the keyashows the plan thatomnishell applywould execute, in a scrollable screen. Confirming it closes the UI and runs the realomnishell apply; apply's ownProceed?prompt stays the gate, so the preview is not a confirmation. No new dependencies.Changes
engine: newEngine.Preview(cfg, lockPath)returns the rendered plan (plus a warning per unknown module) andNeedsApply.NeedsApplyuses apply's own rule,plan.HasChanges || initOrRCDrift, so the preview never promises a change that apply would not make (a merely deleted init file is deliberately not drift to a plain apply). It is read-only.tui:BackendgainsPlan(). The model opens a waiting screen at once and computes the plan in atea.Cmd(Updatestill does no I/O). Esc cancels; an answer for a request the user already left, or for an older request, is dropped.ais ignored while a toggle is being written. The plan screen scrolls (arrows,j/k, page up/down, home/end,g/G), and shows only "back" for a failed plan or a plan with nothing to apply. Plan text and errors go throughsanitize.tui:Runreturns aResult;y/Enter on a shown plan setsResult.ApplyRequestedand quits.cli: after the UI has closed and the terminal is back to normal,omnishell tuiruns the apply command with every flag at its default (no--yes) and returns its error, so prompts, sudo, hooks and exit codes are apply's own. A failing UI never leads to an apply.CLAUDE.mddescribe the behaviour; the implementation plan is underdocs/superpowers.go.modandgo.sumare unchanged.Commits
Test plan
make vetandmake test(race detector) pass locally.golangci-lintv2.13.2 (the CI version, viago run) reports 0 issues.CGO_ENABLED=0 go build ./cmd/omnishellsucceeds for linux/amd64, linux/arm64, linux/armv6, linux/armv7, darwin/amd64 and darwin/arm64.TestPreviewNeedsApplyAgreesWithApplycompares the preview with a realApplyfor a fresh config, a converged one, a deleted init file and a newly enabled module.HOME): plan,y, thennatProceed?exits 1 with "aborted" and writes nothing; plan, Esc,qexits 0; plan,y, thenyruns apply and writesinit.zsh. An independent review ran it as well.golangci-lint,govulncheckand the build matrix pass.HOME(never a real config), runomnishell init,omnishell enable completion, thenomnishell tui. Pressaand check that the plan appears and scrolls, Esc returns to the same selection, andyfollowed bynat the prompt changes nothing. Then again withyat the prompt.Known gaps (not in this PR)
yanswers apply'sProceed? [y/N]with No (safe, but it looks like a failure);y/Enter also hand over when the terminal is currently too small to show the plan; ana, Esc,a, Esc burst leaves read-only package-manager probes running; very long plan lines and errors are cut without an indication.main: apply echoes the package manager'sbrew infooutput to the terminal while it computes its plan. OMNIS-35 only quieted the read-only commands.