Skip to content

OMNIS-34: Add the plan preview and apply handoff to the TUI - #42

Merged
JtheGunner merged 7 commits into
mainfrom
feat/OMNIS-34-plan-preview-and-apply-handoff
Oct 7, 2026
Merged

JtheGunner merged 7 commits into
mainfrom
feat/OMNIS-34-plan-preview-and-apply-handoff

Conversation

@JtheGunner

Copy link
Copy Markdown
Owner

YouTrack: https://youtrack.xn--wrm-hoa.li/issue/OMNIS-34 (sub-task of OMNIS-14)

In omnishell tui, the key a shows the plan that omnishell apply would execute, in a scrollable screen. Confirming it closes the UI and runs the real omnishell apply; apply's own Proceed? prompt stays the gate, so the preview is not a confirmation. No new dependencies.

Changes

  • engine: new Engine.Preview(cfg, lockPath) returns the rendered plan (plus a warning per unknown module) and NeedsApply. NeedsApply uses 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: Backend gains Plan(). The model opens a waiting screen at once and computes the plan in a tea.Cmd (Update still does no I/O). Esc cancels; an answer for a request the user already left, or for an older request, is dropped. a is 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 through sanitize.
  • tui: Run returns a Result; y/Enter on a shown plan sets Result.ApplyRequested and quits.
  • cli: after the UI has closed and the terminal is back to normal, omnishell tui runs 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.
  • README, CHANGELOG and CLAUDE.md describe the behaviour; the implementation plan is under docs/superpowers. go.mod and go.sum are unchanged.

Commits

  • docs: add implementation plan for the plan preview in the TUI (OMNIS-34)
  • feat: add Engine.Preview to show what apply would do
  • feat: let the tui backend compute the plan
  • feat: add the plan screen to the tui model
  • feat: draw the plan screen in the tui
  • feat: hand over to apply when the plan is confirmed in the tui
  • docs: describe the plan preview in the omnishell tui

Test plan

  • make vet and make test (race detector) pass locally.
  • golangci-lint v2.13.2 (the CI version, via go run) reports 0 issues.
  • CGO_ENABLED=0 go build ./cmd/omnishell succeeds for linux/amd64, linux/arm64, linux/armv6, linux/armv7, darwin/amd64 and darwin/arm64.
  • TestPreviewNeedsApplyAgreesWithApply compares the preview with a real Apply for a fresh config, a converged one, a deleted init file and a newly enabled module.
  • The handoff was run with the real binary in a pseudo-terminal (throwaway HOME): plan, y, then n at Proceed? exits 1 with "aborted" and writes nothing; plan, Esc, q exits 0; plan, y, then y runs apply and writes init.zsh. An independent review ran it as well.
  • CI: vet, race tests, golangci-lint, govulncheck and the build matrix pass.
  • Reviewer: with a scratch HOME (never a real config), run omnishell init, omnishell enable completion, then omnishell tui. Press a and check that the plan appears and scrolls, Esc returns to the same selection, and y followed by n at the prompt changes nothing. Then again with y at the prompt.

Known gaps (not in this PR)

  • Pressing Enter after y answers apply's Proceed? [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; an a, Esc, a, Esc burst leaves read-only package-manager probes running; very long plan lines and errors are cut without an indication.
  • If apply finds nothing to do after the handoff (the config changed since the preview), the UI closes without any output.
  • Existing behaviour on main: apply echoes the package manager's brew info output to the terminal while it computes its plan. OMNIS-35 only quieted the read-only commands.
  • The options editor is the next sub-task (OMNIS-33).

@JtheGunner
JtheGunner merged commit f6e3bfe into main Oct 7, 2026
4 checks passed
@JtheGunner
JtheGunner deleted the feat/OMNIS-34-plan-preview-and-apply-handoff branch October 7, 2026 09:52
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.

1 participant