Repository navigation
OMNIS-33: Add the options editor to the TUI - #43
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-33 (sub-task of OMNIS-14, the last functional one)
In
omnishell tui, the keyoopens an options screen for the selected module. Bool options switch with Space, enum options cycle with the left and right arrows, and string and int options are typed (pre-filled with the current value) and saved with Enter. Every value goes through the existingmodedit.SetOption, so it is validated against the module's option schema exactly likeomnishell set, and a rejected value is never written. No new dependencies.Changes
modedit: newEditor.Options(id)returns a module's options sorted by key, with type, help, allowed values, pattern, default and current value. It reads onlyconfig.tomland the manifest (a test makes any package-manager call panic), so it is cheap enough to call after every write. A value thatconfig.tomlholds but the schema rejects (a hand edit) is shown as written and flagged(invalid).tui:BackendgainsOptionsandSetOption. The model reads and writes intea.Cmds (Updatestill does no I/O), one write at a time; keys other than Ctrl-C are ignored while a write is pending. A rejected string or int keeps the typed text and shows the reason on the status line, so a typo is corrected instead of retyped. List options are shown, dimmed, and not editable here (the detail points toomnishell set). The header's change count now includes options whose value differs from the first value the screen showed.tuiview: option table with scrolling, a detail pane (help, type, current value, default, allowed values, pattern, a note when the module is not enabled), and a typing cell that scrolls so the end of the input and the cursor stay visible. The browser footer readsesc clearinstead ofesc clear filterto fito optionsinto 80 columns, which changes one line in six existing golden files.sanitize.cli: the backend adapter shortensconfig.Errorto its message. README, CHANGELOG,CLAUDE.mdand thetui --helptext describe the screen; the implementation plan is underdocs/superpowers.Commits
The last commit repairs a test I got wrong in the commit before it (it set the pending flag before leaving the screen, which the screen deliberately ignores); that earlier commit is red on its own, the branch tip is green.
Review findings fixed before this PR
fzf.default_opts) was not shown in full anywhere, and while typing, the input and cursor scrolled out of the column, so it was edited blind. The detail pane now shows the whole value over up to two lines, and the typing cell scrolls on the left (also with wide characters, where cutting in the middle of a character used to leave the cursor one cell too far right)./pressed while the options were loading left the browser in filter-typing mode after Esc, soqwas typed into the filter. Fixed, with a test.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.HOME): switchingtmux.auto_attachwritesauto_attach = false; typing a value the pattern rejects shows the reason and writes nothing; a valid value is saved; extending the longfzf.default_optssaves it andomnishell validateaccepts the file. An independent review ran the same kind of checks and also wrote a range of awkward strings (quotes, backslashes, U+2028, emoji,#,[modules.x]) throughSetOption; every one loads again.golangci-lint,govulncheckand the build matrix pass.HOME(never a real config), runomnishell init, thenomnishell tui. Pressoon a module with options (for examplefzfortmux) and check Space on a bool, the arrows on an enum, and Enter on a string, including a value the pattern rejects (the text must stay for correction) and a long value.Known gaps (not in this PR)
View()tests, not by a real terminal emulator.omnishell tui --helptext has one line longer than 80 columns, and one CHANGELOG line is longer than the file's wrap width.main:omnishell setcan write aconfig.tomlthat no command can load when the value contains BEL (0x07) or VT (0x0b), becauseconfig.tomlLiteralusesstrconv.Quote, which emits\aand\vthat TOML does not have. The TUI is not affected, becausesanitizereplaces control characters before they reachSetOption.