diff --git a/.coderabbit.yaml b/.coderabbit.yaml new file mode 100644 index 00000000..565174d9 --- /dev/null +++ b/.coderabbit.yaml @@ -0,0 +1,39 @@ +# yaml-language-server: $schema=https://storage.googleapis.com/coderabbit_public_assets/schema.v2.json + +reviews: + path_filters: + - "!pnpm-lock.yaml" + path_instructions: + - path: "**/*.ts" + instructions: | + When the same diff also changes a `CLAUDE.md`, an `AGENTS.md` or a + README, check what it now claims against this code. A sentence that + counts call sites, names "the one such site" or describes a signature is + a claim that goes stale silently, and one already had. + + Errors are values here (`unthrown`), not exceptions. Suggestions that + assume otherwise are wrong rather than debatable: + + - No `try`/`catch` around a `Result` pipeline. Every combinator catches + a thrown callback and converts it to a `Defect`; the `defect` arm of + the final `match` is the catch. A `try` in the diff is either a + boundary around a foreign throwing API — legitimate, and they carry a + reason — or a mistake. + - There is no `mapErr`. The error combinators are `mapErrCases`, + `flatMapErrCases`, `recoverErrCases` and `tapErrCases`, and they are + exhaustive by design: `P._` is a lint error outside a helper generic + in `E`. + - Every async surface returns `AsyncResult`, never a bare `Promise` — + the infallible ones included (`AsyncResult`). + - `Ok(v).toAsync()` is `OkAsync(v)`; `Err(e).toAsync()` is + `ErrAsync(e)`. A `flatMap` returning the value it was handed is + `ensure`. A nullable lookup is `fromNullable`, not a ternary. + - `E` is never `unknown`, `any` or `Error`; a `Defect` never appears + in it. + + Comments are sparse by convention: rationale lives in the spec file, + not beside the code. Do not ask for more comments, or for TSDoc on a + private symbol. + + `type` not `interface`, `unknown` not `any`, and every relative import + carries `.js` — `moduleResolution: NodeNext`.