Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Lift rule defaults to data/rule-defaults.json + build-time override flag#61

Merged
twschiller merged 2 commits into
mainfrom
worktree-floofy-gathering-wombat
Jun 1, 2026
Merged

Lift rule defaults to data/rule-defaults.json + build-time override flag#61
twschiller merged 2 commits into
mainfrom
worktree-floofy-gathering-wombat

Conversation

@twschiller

Copy link
Copy Markdown
Contributor

Summary

  • Move per-rule defaultEnabled out of the 21 rule modules into a single committed extension/data/rule-defaults.json. Codegen validates completeness against the live rule registry and emits rule-defaults.generated.ts; adding a rule without picking a default is now a build error.
  • Add bun run build --defaults <path> (and EXTENSION_DEFAULTS_FILE=<path>) so infra deployments can ship a build with a custom default set without their agent flipping toggles via the Options UI each session. The override file shape matches the Options-page export, so the same JSON works in both places. Unknown rule ids fail the build.
  • Build-time overrides apply only to fresh chrome.storage — existing user toggles persist (current normalize() semantics).

Test plan

  • cd extension && bun run preflight — biome + eslint + tsc + knip + jest (all 30 suites / 495 tests pass)
  • bun run build produces a bundle with raw = "{}" for EXTENSION_DEFAULT_OVERRIDES
  • bun run build --defaults /tmp/abs.json (partial JSON) bakes the listed overrides into the bundle and logs the override count
  • EXTENSION_DEFAULTS_FILE=/tmp/abs.json bun run build has the same effect
  • bun run build --defaults /tmp/bad.json (with {"bogus-rule":true}) fails the build with unknown rule ids: bogus-rule
  • Load extension/dist/ into a fresh Chrome profile after a build-with-override and confirm Options page shows the expected initial toggle states; previously-toggled storage is unaffected on rebuild
  • CI codegen-freshness step covers the new rule-defaults.generated.ts

🤖 Generated with Claude Code

…de flag

Defaults previously lived as `defaultEnabled: boolean` scattered across 21
rule modules — hard to audit in one glance, and impossible to customize
without forking. Two changes here:

- Move the per-rule defaults into a single committed file
  `extension/data/rule-defaults.json`, validated by codegen against the live
  rule registry and emitted into `rule-defaults.generated.ts`. Adding a rule
  without picking a default is now a build error.
- Accept `bun run build --defaults <path>` and `EXTENSION_DEFAULTS_FILE` so
  infra deployments can ship a build with a custom default set without
  flipping toggles via the Options UI on every fresh session. The override
  file shape matches the Options-page export, so the same JSON works in both
  places. Validation is strict — unknown rule ids fail the build.

Build-time overrides apply only to fresh `chrome.storage`; existing user
toggles persist (matches the current `normalize()` semantics).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@vercel

vercel Bot commented Jun 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agent-browser-shield-demo-site Ready Ready Preview, Comment Jun 1, 2026 12:48pm

Request Review

The previous commit's markdown wasn't reflowed to mdformat's column width,
which the pre-commit hook in CI rejects.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@twschiller twschiller merged commit be4d60f into main Jun 1, 2026
7 checks passed
@twschiller twschiller deleted the worktree-floofy-gathering-wombat branch June 1, 2026 12:49
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