Skip to content

OMNIS-32: Toggle modules in the TUI - #40

Merged
JtheGunner merged 8 commits into
mainfrom
feat/OMNIS-32-toggle-modules-in-the-tui
Oct 7, 2026
Merged

JtheGunner merged 8 commits into
mainfrom
feat/OMNIS-32-toggle-modules-in-the-tui

Conversation

@JtheGunner

Copy link
Copy Markdown
Owner

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

In omnishell tui, Space now enables or disables the selected module in config.toml, through modedit.Enable / Disable (the same rules as omnishell enable / disable). Modules that cannot run on this host are dimmed with the reason shown, the header counts the changes since start, and a rejected toggle shows its reason on a status line and leaves the checkbox alone. No new dependencies.

Changes

  • modedit: ModuleView.Unavailable explains why a module cannot run here (unsupported OS, or none of the managed shells can run it). The shell rule is shared with Enable, and a test pins that dimming and Enable never disagree. New Editor.Statuses() reads only config.toml.
  • tui: Backend gains Enable, Disable and Statuses. Update stays free of I/O: Space returns a tea.Cmd that writes and then re-reads the statuses. One write runs at a time (a "saving…" marker shows in the footer), and the cursor stays where the user moved it.
  • tui view: change counter in the header (net difference from the start, so toggling back counts as no change), status line in place of the help text, dimmed rows, a Host: line in the detail pane. Backend text on the status line goes through sanitize.
  • cli: the backend adapter shortens config.Error to its message (the config path would push the reason off a one-line status bar). The tui command builds its engine with io.Discard writers.
  • README, CHANGELOG and CLAUDE.md describe the behaviour; the implementation plan is under docs/superpowers.

Commits

  • docs: add implementation plan for toggling modules in the TUI (OMNIS-32)
  • feat: report why a module cannot run on this host in modedit views
  • feat: let the tui backend enable and disable modules
  • feat: toggle the selected module with space in the tui model
  • feat: show the change counter, status line and dimmed modules in the tui
  • docs: describe toggling in the omnishell tui
  • fix: keep package manager output off the tui screen
  • fix: re-read only module statuses after a toggle and ignore space while saving

Review findings fixed before this PR

  • Package-manager output (brew list --versions, dpkg-query) was copied onto the terminal the UI was drawing on, because the runner writes to the writers it is given. The tui engine now gets io.Discard.
  • Re-reading every module after each write asked the package manager about every package (seconds on hosts with brew), which let a second Space act on a stale status and made the cursor jump back. The refresh now reads statuses only, writes are serialised, and the cursor stays put.

Behaviour to know about

  • Only the managed-shell rule makes enable fail. A module dimmed for its OS can still be enabled (apply skips it), exactly as with omnishell enable; this PR does not change enable.
  • After a toggle only the enabled flags are re-read; package state and host compatibility are as loaded at start.

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.
  • go.mod and go.sum are unchanged.
  • CI: vet, race tests, golangci-lint, govulncheck and the build matrix pass.
  • Reviewer: with a scratch HOME (never a real config), run omnishell init, then omnishell tui. Press Space on a few modules and check that config.toml changes at once and keeps its comments, that the counter and checkboxes follow, that a zsh-only module on a bash-only host is dimmed and shows the rejection, that pressing Space twice quickly does not undo itself, and that no stray text appears on screen.

Known gaps (not in this PR)

  • omnishell list still passes its real stdout to the engine, so package-manager probe output can end up in list and corrupt list --json. It predates this change; the same io.Discard fix applies.
  • Options editor, plan preview and the apply handoff are the next sub-tasks (OMNIS-33, OMNIS-34).

@JtheGunner
JtheGunner merged commit b2a0005 into main Oct 7, 2026
4 checks passed
@JtheGunner
JtheGunner deleted the feat/OMNIS-32-toggle-modules-in-the-tui branch October 7, 2026 08:51
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