1import { defineConfig, type CodeRabbitContext } from "@coderabbitai/config";
2
3// Org members and collaborators can approve their own pull requests.
4const UNGATED_AUTHORS = new Set(["OWNER", "MEMBER", "COLLABORATOR"]);
5const isGated = ({ pr }: CodeRabbitContext) => !UNGATED_AUTHORS.has(pr?.authorAssociation ?? "");
6
7export default defineConfig((ctx) => ({
8 reviews: {
9 high_level_summary: false,
10 review_status: false,
11 request_changes_workflow: false,
12 allow_author_approval: !isGated(ctx),
13 auto_review: {
14 enabled: true,
15 },
16 pre_merge_checks: {
17 docstrings: { mode: "off" },
18 override_requested_reviewers_only: isGated(ctx),
19 },
20 path_filters: [
21 // Vendored read-only reference checkouts of upstream Effect and Alchemy
22 // (see scripts/lib/reference-repos.ts). Nothing imports from them.
23 "!.repos/**",
24 ],
25 path_instructions: [
26 {
27 path: "{apps,packages,infra}/**/*.ts",
28 instructions: "Hold changed code to the rules in docs/internals/effect-services.md.",
29 },
30 {
31 path: "apps/web/src/**/*.{tsx,css}",
32 instructions: "Hold changed code to the rules in docs/internals/web-ui.md.",
33 },
34 ],
35 },
36 knowledge_base: {
37 code_guidelines: {
38 filePatterns: [
39 { files: "docs/internals/effect-services.md", applyTo: "{apps,packages,infra}/**/*.ts" },
40 { files: "docs/internals/web-ui.md", applyTo: "apps/web/src/**/*.{tsx,css}" },
41 ],
42 },
43 },
44}));