Lift rule defaults to data/rule-defaults.json + build-time override flag#61
Merged
Conversation
…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]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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]>
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
defaultEnabledout of the 21 rule modules into a single committedextension/data/rule-defaults.json. Codegen validates completeness against the live rule registry and emitsrule-defaults.generated.ts; adding a rule without picking a default is now a build error.bun run build --defaults <path>(andEXTENSION_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.chrome.storage— existing user toggles persist (currentnormalize()semantics).Test plan
cd extension && bun run preflight— biome + eslint + tsc + knip + jest (all 30 suites / 495 tests pass)bun run buildproduces a bundle withraw = "{}"forEXTENSION_DEFAULT_OVERRIDESbun run build --defaults /tmp/abs.json(partial JSON) bakes the listed overrides into the bundle and logs the override countEXTENSION_DEFAULTS_FILE=/tmp/abs.json bun run buildhas the same effectbun run build --defaults /tmp/bad.json(with{"bogus-rule":true}) fails the build withunknown rule ids: bogus-ruleextension/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 rebuildrule-defaults.generated.ts🤖 Generated with Claude Code