chore: add .failproofai config directory#94
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (11)
📝 WalkthroughWalkthroughAdds FailproofAI policy/config files and workflow convention policies that intercept PreToolUse Bash invocations (git commit/push) to prompt for changelog/docs/PR description updates; introduces scoped convention tagging, accumulates multiple instruct messages, expands policy hinting via policyParams, and updates related tests, docs, and hooks configuration. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant FailproofAI
participant Bash
participant Git
User->>FailproofAI: Invoke tool (PreToolUse event)
FailproofAI->>FailproofAI: Determine tool type
alt tool === "Bash"
FailproofAI->>FailproofAI: Read ctx.toolInput?.command
alt command matches git commit
FailproofAI->>User: instruct("Please update CHANGELOG.md / docs...") (may accumulate multiple instructs)
else command matches git push
FailproofAI->>User: instruct("Remember to update PR description")
else
FailproofAI->>Bash: allow execution
Bash->>Git: run command
end
else
FailproofAI->>Bash: allow execution
Bash->>Git: run command
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
…k-force-push hint Add cross-cutting hint tip to built-in-policies.mdx so users discover the feature from the policy reference page. Add a block-force-push hint example inline and configure the project config with a hint suggesting a fresh branch as an alternative to force-pushing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds a convention-based instruct policy at .failproofai/policies/ that reminds the coding agent to check and update CHANGELOG.md before committing. Auto-discovered by failproofai — no config changes needed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ack .claude/settings.json Add convention policies to remind the agent to update documentation (docs/*.mdx, README.md, examples/) and PR descriptions when relevant. Un-gitignore .claude/settings.json so hook configuration is shared with the team. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.failproofai/policies/workflow-policies.mjs:
- Line 16: Replace the narrow regex /git\s+commit/ with a broader pattern that
allows intervening git options (e.g., -c key=value or other flags) between "git"
and "commit"; in other words, change the condition that currently tests
/git\s+commit/ so it matches "git" followed by zero or more space‑separated
tokens (including tokens starting with '-') and then "commit", and ensure you
use a word boundary so only actual commit commands match.
In `@CHANGELOG.md`:
- Around line 6-10: Update the bullets under the "## Unreleased" section (e.g.,
the lines mentioning "Add `changelog-check` convention policy" and the "Docs"
bullets about `hint` and `block-force-push`) to append the PR reference suffix
for each entry (format: " (`#123`)") so every Unreleased bullet includes its PR
number; ensure the PR id is accurate for each item and preserve existing wording
and markdown structure.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6348d479-5f06-48b7-b87a-a83730710543
📒 Files selected for processing (4)
.failproofai/policies-config.json.failproofai/policies/workflow-policies.mjsCHANGELOG.mddocs/built-in-policies.mdx
| fn: async (ctx) => { | ||
| if (ctx.toolName !== "Bash") return allow(); | ||
| const cmd = String(ctx.toolInput?.command ?? ""); | ||
| if (/git\s+commit/.test(cmd)) { |
There was a problem hiding this comment.
Broaden commit detection to avoid missing valid git commit forms.
Current regex can miss commands like git -c key=value commit -m ..., so reminders won’t trigger consistently.
🔧 Proposed fix
- if (/git\s+commit/.test(cmd)) {
+ const isGitCommit =
+ /^\s*(?:[A-Za-z_][A-Za-z0-9_]*=\S+\s+)*git(?:\s+-\S+)*\s+commit\b/.test(cmd);
+ if (isGitCommit) {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (/git\s+commit/.test(cmd)) { | |
| const isGitCommit = | |
| /^\s*(?:[A-Za-z_][A-Za-z0-9_]*=\S+\s+)*git(?:\s+-\S+)*\s+commit\b/.test(cmd); | |
| if (isGitCommit) { |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.failproofai/policies/workflow-policies.mjs at line 16, Replace the narrow
regex /git\s+commit/ with a broader pattern that allows intervening git options
(e.g., -c key=value or other flags) between "git" and "commit"; in other words,
change the condition that currently tests /git\s+commit/ so it matches "git"
followed by zero or more space‑separated tokens (including tokens starting with
'-') and then "commit", and ensure you use a word boundary so only actual commit
commands match.
| - Add `changelog-check` convention policy to remind agent to update CHANGELOG before committing | ||
|
|
||
| ### Docs | ||
| - Document cross-cutting `hint` param in built-in policies reference and add `block-force-push` hint example | ||
| - Add `block-force-push` hint to project config suggesting fresh branch as alternative |
There was a problem hiding this comment.
Add PR numbers to the new Unreleased bullets.
These entries should include the PR reference suffix to match the repo changelog convention.
✏️ Proposed fix
### Features
-- Add `changelog-check` convention policy to remind agent to update CHANGELOG before committing
+- Add `changelog-check` convention policy to remind agent to update CHANGELOG before committing (`#94`)
### Docs
-- Document cross-cutting `hint` param in built-in policies reference and add `block-force-push` hint example
-- Add `block-force-push` hint to project config suggesting fresh branch as alternative
+- Document cross-cutting `hint` param in built-in policies reference and add `block-force-push` hint example (`#94`)
+- Add `block-force-push` hint to project config suggesting fresh branch as alternative (`#94`)Based on learnings: Update CHANGELOG.md in every PR under ## Unreleased, and include PR numbers per entry (e.g., (#123)).
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - Add `changelog-check` convention policy to remind agent to update CHANGELOG before committing | |
| ### Docs | |
| - Document cross-cutting `hint` param in built-in policies reference and add `block-force-push` hint example | |
| - Add `block-force-push` hint to project config suggesting fresh branch as alternative | |
| - Add `changelog-check` convention policy to remind agent to update CHANGELOG before committing (`#94`) | |
| ### Docs | |
| - Document cross-cutting `hint` param in built-in policies reference and add `block-force-push` hint example (`#94`) | |
| - Add `block-force-push` hint to project config suggesting fresh branch as alternative (`#94`) |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@CHANGELOG.md` around lines 6 - 10, Update the bullets under the "##
Unreleased" section (e.g., the lines mentioning "Add `changelog-check`
convention policy" and the "Docs" bullets about `hint` and `block-force-push`)
to append the PR reference suffix for each entry (format: " (`#123`)") so every
Unreleased bullet includes its PR number; ensure the PR id is accurate for each
item and preserve existing wording and markdown structure.
… .failproofai-{scope}
- Accumulate all instruct messages instead of first-wins, matching the
existing allow accumulation pattern.
- Rename convention policy prefix from convention/ to
.failproofai-project/ or .failproofai-user/ based on discovery scope.
- Add convention_scope field to telemetry for both policy_triggered and
custom_hook_error events.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
.failproofai/config directory with all 30 built-in policies enabledblock-force-pushhint suggesting fresh branch as alternative.failproofai/policies/workflow-policies.mjs):changelog-check— reminds agent to update CHANGELOG before committingdocs-check— reminds agent to update docs, README, and examples if relevantpr-description-check— reminds agent to update PR description after pushing.claude/settings.jsonin git (un-gitignored)hintparam in built-in policies referenceinstructmessages instead of only delivering the first oneconvention/to.failproofai-{scope}/(.failproofai-project/,.failproofai-user/) withconvention_scopein telemetryTest plan
bun run test:run— 872 tests passbun run test:e2e— 204 e2e tests passfailproofai p— all 3 convention policies discovered and loadedgit commitandgit pushconvention/references in source code🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Behavior Changes
Documentation