Skip to content

feat: Rule ID visibility, stable IDs, list_rules tool, and rules-picker CLI#36

Merged
fahadsiddiqui merged 1 commit into
mainfrom
feature/rules-toggle-ui
Jul 20, 2026
Merged

feat: Rule ID visibility, stable IDs, list_rules tool, and rules-picker CLI#36
fahadsiddiqui merged 1 commit into
mainfrom
feature/rules-toggle-ui

Conversation

@fahadsiddiqui

Copy link
Copy Markdown
Member

Closes #24.

Summary

  • Block messages now show each finding's rule ID (e.g. OpenAI API Key (openai-api-key): sk-p…3xyz) plus a hint pointing at disabledRules in .privacy-guard.json.
  • External rule IDs (data/regex_list_1.json) are now stable across data-file reordering - collisions are disambiguated with a short hash of the entry's own content instead of a positional counter.
  • New list_rules MCP tool returns id/title/severity/category/source/disabled for every rule, for in-chat use.
  • New companion CLI (bin: claude-code-privacy-guard, run as npx claude-code-privacy-guard rules) starts a loopback-only local web UI listing every rule with checkboxes. Toggling auto-saves (debounced) to disabledRules; the server stays alive across saves and only exits on Ctrl+C or 10 minutes idle. The save endpoint requires a random per-run token as defense in depth.
  • Config resolution prefers an existing project-level .privacy-guard.json, but falls back to a global ~/.privacy-guard.json by default when none exists anywhere in the directory tree - Privacy Guard protects the person, not one repo. Both the console output and the web page label which scope is being edited.
  • README updated with a new "Managing Rules" section.

Test plan

  • npm run build - clean
  • npm test - 159/159 passing
  • eslint src --ext .ts - clean
  • Manual harness runs verifying: list_rules MCP tool over real stdio, CLI save endpoint (bad token → 403/no write, good token → 200/write, preserves other config keys), server survives repeated saves without closing, auto-save on checkbox toggle with debounce/coalescing, config resolution correctly falls back to a fake $HOME when no project config exists and prefers an existing project-level config when one does

Not included

  • Publishing to npm (npm publish) so npx claude-code-privacy-guard rules resolves for real users - this is a separate action I want explicit sign-off on before running, since it's a new public distribution channel.

…picker CLI

Implements the rule-discoverability and toggling work from issue #24.

- Show each finding's rule ID in the hook's block message (e.g.
  "OpenAI API Key (openai-api-key): sk-p…3xyz"), plus a hint line
  pointing at disabledRules in .privacy-guard.json.
- Make external rule IDs (data/regex_list_1.json) stable across
  data-file reordering: collisions are now disambiguated with a short
  hash of the entry's own content instead of a positional counter.
- Add a list_rules MCP tool that returns id, title, severity,
  category, source, and disabled state for every rule, for use from
  inside a Claude Code chat session.
- Add a companion CLI (bin: claude-code-privacy-guard, invoked as
  `npx claude-code-privacy-guard rules`) that starts a loopback-only
  local web UI listing every rule with checkboxes. Toggling a rule
  auto-saves (debounced) straight to disabledRules; the server stays
  alive across saves and only exits on Ctrl+C or 10 minutes of
  inactivity. The save endpoint is protected by a random per-run
  token as defense in depth.
- Config resolution favors an existing project-level
  .privacy-guard.json, but falls back to a global ~/.privacy-guard.json
  by default when none exists anywhere in the directory tree, since
  Privacy Guard is meant to protect the person, not one repo. Both the
  console output and the web page label which scope (global vs.
  project-level override) is being edited.
- Document all of the above in README.md, including the new
  "Managing Rules" section.
@fahadsiddiqui fahadsiddiqui changed the title Rule ID visibility, stable IDs, list_rules tool, and rules-picker CLI feat: Rule ID visibility, stable IDs, list_rules tool, and rules-picker CLI Jul 19, 2026
@fahadsiddiqui
fahadsiddiqui merged commit 7d7f0ac into main Jul 20, 2026
3 checks passed
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.

Rule toggling via disabledRules is undocumented, hard to discover, and has no UI

1 participant