feat: configurable hint in policyParams for deny/instruct messages#90
feat: configurable hint in policyParams for deny/instruct messages#90NiveditJain wants to merge 1 commit into
Conversation
Allow users to append custom guidance to deny and instruct messages by adding a `hint` string to any policy's policyParams config. The hint is appended to the reason before it's sent back to Claude, giving actionable next steps without modifying the policy itself. Works with built-in, custom, and convention policies. Non-string and empty values are silently ignored for backward compatibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 46 minutes and 51 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
…olicyParams (#91) * feat: convention-based policy auto-discovery from .failproofai/policies/ Add git-hooks-like auto-discovery: drop *policies.{js,mjs,ts} files into .failproofai/policies/ at project or user level and they're loaded automatically — no --custom flag or config changes needed. - Add discoverPolicyFiles() and loadAllCustomHooks() to custom-hooks-loader - Convention hooks registered with "convention/" prefix for telemetry - PostHog telemetry: convention_policies_loaded event, is_convention_policy flag on hook_policy_triggered - listHooks() shows discovered convention policies - CLI help updated with CONVENTION POLICIES section - 6 new unit tests, 16 new e2e tests covering discovery, union loading, fail-open, file filtering, coexistence with --custom - Example files in examples/convention-policies/ - Mintlify docs and README updated Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: address CodeRabbit review feedback - Fix PR number reference in CHANGELOG (#88 → #89) - Add `text` language identifier to fenced code block in README - Track convention hooks by object reference instead of name to prevent mis-tagging explicit hooks that share a convention hook name - Use `basename()` instead of `file.split("/")` for cross-platform paths Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: configurable `hint` in policyParams for deny/instruct messages Allow users to append custom guidance to deny and instruct messages by adding a `hint` string to any policy's policyParams config. The hint is appended to the reason before it's sent back to Claude, giving actionable next steps without modifying the policy itself. Works with built-in, custom, and convention policies. Non-string and empty values are silently ignored for backward compatibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: add missing vitest expect import in policy-params e2e test Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: address CodeRabbit review feedback (round 2) - Remove duplicate policyParams hint test suite, merge unique sanitize-jwt test - Fix CHANGELOG PR references from #89/#90 to #91 - Extract appendHint() helper to trim/normalize hint concatenation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Summary
hintfield topolicyParamsthat appends custom guidance to deny and instruct messages sent back to Claudecustom/), and convention (convention/)Example config:
{ "policyParams": { "block-force-push": { "hint": "Try creating a fresh branch instead." } } }Claude sees: "Force-pushing is blocked. Try creating a fresh branch instead."
Changes
src/hooks/policy-evaluator.tshintto reason for deny/instruct decisions__tests__/hooks/policy-evaluator.test.ts__tests__/e2e/hooks/policy-params.e2e.test.tsdocs/configuration.mdxhintfield under Field Referencedocs/custom-policies.mdxREADME.mdCHANGELOG.mdTest plan
bun run test:run)bun run test:e2e)🤖 Generated with Claude Code