Skip to content

feat: add Settings tab to rules-picker UI - #61

Merged
fahadsiddiqui merged 2 commits into
mainfrom
add-settings-panel-to-rules-ui
Jul 23, 2026
Merged

feat: add Settings tab to rules-picker UI#61
fahadsiddiqui merged 2 commits into
mainfrom
add-settings-panel-to-rules-ui

Conversation

@fahadsiddiqui

Copy link
Copy Markdown
Member

Summary

  • The rules-picker UI (rules-editor / startRulesServer) only let you edit disabledRules and the three allowlists; enabled, mode, externalRulesMode, and externalRulesJsonPath were config-file-only.
  • Adds a Settings tab (shown first) with: an enabled toggle, a Block/Redact/Warn mode selector (with inline descriptions of each), an external rule set selector (coding-only vs all), and an external rules JSON path field.
  • New /save-settings endpoint, validated via parseSettings (same allowed values as ConfigLoader) and persisted via writeSettings, following the same merge/debounced-autosave pattern as the existing rules/allowlist saves.

Test plan

  • npm run build
  • npx jest (377/377 passing)
  • Manual round-trip test of parseSettings/writeSettings/ConfigLoader
  • Live server smoke test via Chrome: loaded the Settings tab, flipped mode to Redact and enabled off, confirmed "Saved settings." status and verified the written .privacy-guard.json matched

The rules-picker UI only exposed disabledRules and the three allowlists,
leaving enabled, mode, externalRulesMode, and externalRulesJsonPath
editable only by hand-editing .privacy-guard.json. Add a Settings tab
(shown first) that surfaces all of them:

- Privacy Guard enabled on/off toggle
- Mode radio group (block / redact / warn) with a short description of
  what each does
- External rule set selector (coding-only vs all)
- External rules JSON path text field, with a note that it only takes
  effect on the next rules-editor run

Backend: parseSettings (validate.ts) validates the payload against the
same PromptGuardMode/external-rules-mode values the config loader
accepts; writeSettings (config-writer.ts) merges them into the config
file the same way writeDisabledRules/writeAllowlists do, omitting
externalRulesJsonPath entirely when blank so it falls back to the
bundled default. server.ts wires these into a new /save-settings route
alongside the existing /save and /save-allowlists routes.

Rebuilt dist/ since it's committed for the Claude Code plugin build.
The Settings tab described "redact" as letting the prompt through
automatically, which is wrong: the UserPromptSubmit hook API has no way
to rewrite/resubmit a prompt, so redact mode still blocks (decision:
'block') just like block mode - it only adds a cleaned, copy-pasteable
version of the prompt to the block reason. See src/hook/response.ts and
the existing README "Block, Redact, or Warn?" section, which already
described this correctly.
@fahadsiddiqui
fahadsiddiqui merged commit 83e2a90 into main Jul 23, 2026
5 checks passed
@fahadsiddiqui
fahadsiddiqui deleted the add-settings-panel-to-rules-ui branch July 23, 2026 19:46
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