feat(permissions): add auto permission mode to session pickers - #87
feat(permissions): add auto permission mode to session pickers#87JeanBaptisteRenard wants to merge 1 commit into
Conversation
Claude Code recognizes `auto` as a --permission-mode value (Claude checks each tool call for risk, auto-approves the low-risk ones, blocks the rest) and treats it as its own default mode, but Switchboard's three permission pickers never listed it. - Add `auto` to the New/Resume Session dialogs and the Settings panel <select>, sourced from one shared PERMISSION_MODES list in utils.js instead of the two byte-identical arrays previously duplicated across dialogs.js (exactly how auto got missed after one copy was updated). - Make 'auto' the effective default for genuinely unconfigured installs (SETTING_DEFAULTS.permissionMode in main.js) without overloading the existing null sentinel: get-effective-settings now only falls through to SETTING_DEFAULTS on `undefined` (key never saved), so a user who explicitly saved "Default" (an intentional `null`, meaning prompt for every action) keeps that behavior instead of being silently upgraded to auto. - Add DOM + static regression coverage: auto is offered and pre-selected in both dialogs, survives the round-trip into the launched session's options (which main.js turns into --permission-mode "auto"), the two dialogs.js copies stay deduplicated, and the null/undefined distinction in get-effective-settings can't regress silently.
|
Superseded. Closing in favour of #89. The What remains genuinely ours is the
That is now #89, rebuilt on top of the synced tree, with the regression test kept (it also covers upstream's The |
Summary
autoas a--permission-modevalue (verified live:claude -p ... --permission-mode autoexits 0) and treats it as its own default permission mode, but Switchboard's three permission pickers (New Session dialog, Resume Session dialog, Settings panel) never listed it.autoto all three, sourced from one sharedPERMISSION_MODESlist inpublic/utils.jsinstead of the two byte-identical arrays previously duplicated inpublic/dialogs.js(exactly howautogot missed after one copy was updated but not the other).autothe effective default for genuinely unconfigured installs (SETTING_DEFAULTS.permissionModeinmain.js) without overloading the existingnullsentinel:get-effective-settingsnow only falls through toSETTING_DEFAULTSonundefined(key never saved at that scope), so a user who explicitly saved "Default" (an intentionalnull, meaning prompt for every action,--permission-modeomitted) keeps that behavior instead of being silently upgraded toauto.dontAskwas left untouched — it's a legitimate CLI mode, not the defect here.Test plan
task test— full suite green (362/362), including new coverage intest/dom-permission-mode-picker.test.js:autois offered (and pre-selected when effective) in both New and Resume Session dialogsautosurvives the round-trip into the launched session's options, whichmain.jsturns into--permission-mode "auto"dialogs.jscopies stay deduplicated behindPERMISSION_MODES(regression guard)<select>offersautoand is built from the same shared listmain.js:SETTING_DEFAULTS.permissionMode === 'auto', and theget-effective-settingsmerge never reintroduces the!== nullconflation that would silently rewrite an explicit "Default" intoautotask lint— 0 errors (pre-existing warning-only baseline, unaffected)claude -p "reply with the single word OK" --permission-mode auto→OK, exit 0Note
Switchboard is normally run as a built AppImage — this code change won't be visible until the app is rebuilt (
task build/npm run build:linux).