feat: add Settings tab to rules-picker UI - #61
Merged
Conversation
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.
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.
Summary
rules-editor/startRulesServer) only let you editdisabledRulesand the three allowlists;enabled,mode,externalRulesMode, andexternalRulesJsonPathwere config-file-only./save-settingsendpoint, validated viaparseSettings(same allowed values asConfigLoader) and persisted viawriteSettings, following the same merge/debounced-autosave pattern as the existing rules/allowlist saves.Test plan
npm run buildnpx jest(377/377 passing)parseSettings/writeSettings/ConfigLoader.privacy-guard.jsonmatched