Load project-scoped .claude settings files#4
Conversation
`rules-guard` now reads `<cwd>/.claude/settings.local.json` in addition to the two `~/.claude` files, so machine-local project rules apply. The inline settings-file list becomes a pure, injectable `claudeFiles(home, cwd)` helper, matching `compileGlob`/`globSpecificity`, so resolution is unit-testable. The project-scoped file is an additional policy source, not an order-based override: `buildPolicy` merges every entry and resolves path conflicts by glob specificity (ties deny), so a local rule adds to the policy rather than winning by being local. A missing or unparseable file is skipped, as with the other sources. Glory to the Omnissiah
|
Warning Review limit reached
Next review available in: 53 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
`rules-guard` now reads `<cwd>/.claude/settings.json` in addition to the project-local `settings.local.json`, so team-shared project rules that are committed to source control are enforced too, not only the git-ignored local overrides. Both project files are resolved under `cwd`, matching Claude Code, which looks for project settings in the working directory without traversing parent directories. Order stays policy-irrelevant: `buildPolicy` merges every entry and resolves conflicts by glob specificity (ties deny), so the shared file adds rules rather than winning by position. By the will of the Machine God
Summary
rules-guardnow reads the two project-scoped Claude settings files under the working directory —.claude/settings.json(team-shared, committed) and.claude/settings.local.json(personal, git-ignored) — in addition to the existing~/.claude/settings.jsonand~/.claude/remote-settings.json. Theirpermissions.deny/permissions.allowrules are enforced across all omp tools.Changes
index.ts— Replaced the inlineCLAUDE_FILES.map(...)with a pure, injectableclaudeFiles(home, cwd)helper (mirrors thehomedefault oncompileGlob/globSpecificity). It returns the two~/.claudefiles plus<cwd>/.claude/settings.jsonand<cwd>/.claude/settings.local.json, resolved under the working directory.CLAUDE_FILES = claudeFiles()still feeds the unchangedloadPolicyEntries(), so the new sources merge through the same path. Docblock updated to list all four files.README.md— Added Policy-sources rows for.claude/settings.json(project-shared) and.claude/settings.local.json(project-local), worded as additional project-scoped sources, not order-based overrides.index.test.ts— Added tests: pure path resolution forclaudeFiles(all four locations), and an end-to-end merge that writes real.claude/settings.json+.claude/settings.local.jsonunder a project dir and loads them vialoadPolicyEntries(claudeFiles(home, proj))with distincthome/projdirs so no path collides.Design notes
cwd, not~/.claude. This matches Claude Code, which looks for project settings in the current working directory and does not traverse parent directories (see anthropics/claude-code#12962).buildPolicymerges every entry and resolves path conflicts by glob specificity (ties → deny), so a project rule adds to the policy rather than winning by position.try/catchinloadPolicyEntries— no behavior change when a file is not present.Verification
bun test extensions/rules-guard/index.test.ts→ 60 pass / 0 fail, 100% line + func coverage.bun typecheck→ clean (exit 0).bun check(Biome) → passed (exit 0).