Problem
/warden config opens a panel that flattens the config into editable rows (flattenConfig in src/panel.ts, around line 178). Booleans toggle in place. Every other type opens a free-text box. That is fine for numbers and paths, but several keys take one of a fixed set of values, and typing them is error-prone:
| Key |
Values |
mode |
the configured modes (see docs/configuration.md) |
typesafeBackend |
the backends pi-typesafe knows (DECISIONS_BACKENDS) |
widget.placement |
WidgetPlacement in src/widget.ts |
widget.barMode |
WidgetBarMode in src/widget.ts |
skills.mode |
see docs/configuration.md |
context.recallTool |
RecallTool in src/recall.ts (auto plus the search tools) |
A typo saves an invalid value, which the config loader then silently replaces with the default at next load. The user sees their edit vanish with no message.
Proposal
- Give
ConfigEntry an optional options: readonly string[]. The panel populates it for the keys above from the same type definitions the loader uses, so the two cannot drift.
- Render an entry with
options as a selector: left and right arrow keys cycle through the values, Enter confirms, Esc cancels. Show the current value with a marker like ◂ openrouter ▸.
- Keep the free-text box for strings without
options and for numbers. Booleans keep toggling.
- When a key's value on disk is not in its option list (an old config, a hand edit), the selector shows it as the current value with a note, and cycling replaces it. Do not silently reset.
Where
src/panel.ts: ConfigEntry, flattenConfig, the edit handler.
- The option lists should come from one place. If the types are string unions with no runtime array, add exported
const arrays next to each type and derive the union from them (typeof X[number]), so the loader's validation and the panel read the same array.
docs/configuration.md: one sentence in the /warden config description.
Acceptance
- Each key above shows a selector, never a text box.
- Arrow keys cycle, Enter saves the chosen value to the same file the text box saves to, Esc leaves the value unchanged.
- A value not in the list is displayed, not replaced, until the user cycles.
- Unit tests for the option derivation (each enum key has a non-empty list that matches the loader's accepted values) and for the cycle logic (wraps at both ends).
npm run check passes. CHANGELOG entry under Unreleased / Added.
Non-goals
- Redesigning the panel layout.
- Validation of free-text keys beyond what the loader does today.
Problem
/warden configopens a panel that flattens the config into editable rows (flattenConfiginsrc/panel.ts, around line 178). Booleans toggle in place. Every other type opens a free-text box. That is fine for numbers and paths, but several keys take one of a fixed set of values, and typing them is error-prone:modedocs/configuration.md)typesafeBackendDECISIONS_BACKENDS)widget.placementWidgetPlacementinsrc/widget.tswidget.barModeWidgetBarModeinsrc/widget.tsskills.modedocs/configuration.mdcontext.recallToolRecallToolinsrc/recall.ts(autoplus the search tools)A typo saves an invalid value, which the config loader then silently replaces with the default at next load. The user sees their edit vanish with no message.
Proposal
ConfigEntryan optionaloptions: readonly string[]. The panel populates it for the keys above from the same type definitions the loader uses, so the two cannot drift.optionsas a selector: left and right arrow keys cycle through the values, Enter confirms, Esc cancels. Show the current value with a marker like◂ openrouter ▸.optionsand for numbers. Booleans keep toggling.Where
src/panel.ts:ConfigEntry,flattenConfig, the edit handler.constarrays next to each type and derive the union from them (typeof X[number]), so the loader's validation and the panel read the same array.docs/configuration.md: one sentence in the/warden configdescription.Acceptance
npm run checkpasses. CHANGELOG entry underUnreleased/Added.Non-goals