Skip to content

Commit 3cae6cb

Browse files
committed
chore: add CodeRabbit configuration for automated PR reviews
Configure assertive review profile with per-package path instructions, auto-labeling by package, and security-focused rules for crypto code.
1 parent 4f27155 commit 3cae6cb

File tree

1 file changed

+202
-0
lines changed

1 file changed

+202
-0
lines changed

.coderabbit.yaml

Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
language: en-US
2+
tone_instructions: >
3+
Be direct and concise. Focus on actionable feedback.
4+
Skip compliments and filler — just point out issues and suggest fixes.
5+
early_access: false
6+
enable_free_tier: true
7+
8+
reviews:
9+
profile: assertive
10+
request_changes_workflow: true
11+
high_level_summary: true
12+
high_level_summary_placeholder: '@coderabbitai summary'
13+
poem: false
14+
collapse_walkthrough: true
15+
sequence_diagrams: false
16+
changed_files_summary: true
17+
review_status: true
18+
abort_on_close: true
19+
suggested_labels: true
20+
auto_apply_labels: true
21+
labeling_instructions:
22+
- label: 'core'
23+
instructions: 'Apply when changes touch packages/connect-core/'
24+
- label: 'crypto'
25+
instructions: 'Apply when changes touch packages/connect-crypto/'
26+
- label: 'encoding'
27+
instructions: 'Apply when changes touch packages/connect-encoding/'
28+
- label: 'provider'
29+
instructions: 'Apply when changes touch packages/connect-provider/'
30+
- label: 'transactions'
31+
instructions: 'Apply when changes touch packages/connect-transactions/'
32+
- label: 'contracts'
33+
instructions: 'Apply when changes touch packages/connect-contracts/'
34+
- label: 'wallet'
35+
instructions: 'Apply when changes touch packages/connect-wallet/'
36+
- label: 'react'
37+
instructions: 'Apply when changes touch packages/connect-react/'
38+
- label: 'ci'
39+
instructions: 'Apply when changes touch .github/workflows/ or CI configuration files'
40+
- label: 'docs'
41+
instructions: 'Apply when changes are documentation-only (README, CLAUDE.md, examples, JSDoc)'
42+
- label: 'security'
43+
instructions: 'Apply when changes involve cryptographic operations, key management, or signing'
44+
- label: 'breaking-change'
45+
instructions: 'Apply when changes modify public API signatures, remove exports, or change type definitions'
46+
47+
path_filters:
48+
- '!dist/**'
49+
- '!node_modules/**'
50+
- '!**/dist/**'
51+
- '!**/node_modules/**'
52+
- '!**/*.lock'
53+
- '!pnpm-lock.yaml'
54+
- '!coverage/**'
55+
- '!**/coverage/**'
56+
- '!**/generated/**'
57+
58+
path_instructions:
59+
- path: 'packages/connect-core/src/**/*.ts'
60+
instructions: >
61+
Core types, constants, and error definitions for the SDK.
62+
Uses branded types (Address, KLV, TxHash) for type safety — ensure
63+
branded type usage is consistent and not bypassed with casts.
64+
Error classes must extend KleverError with unique error codes.
65+
This package has zero runtime dependencies — flag any new imports
66+
from other @klever packages or heavy external dependencies.
67+
68+
- path: 'packages/connect-encoding/src/**/*.ts'
69+
instructions: >
70+
Protocol Buffer encoding/decoding layer. Handles serialization
71+
of transactions to/from binary format. Must support both Node.js
72+
Buffer and browser Uint8Array (web-compatible). Flag any use of
73+
Node.js-only APIs without proper polyfills or environment checks.
74+
75+
- path: 'packages/connect-crypto/src/**/*.ts'
76+
instructions: >
77+
Cryptographic operations: key generation, signing, HD wallets,
78+
keystores. Security-critical code — flag any use of Math.random(),
79+
non-constant-time comparisons on secrets, or private key exposure
80+
in logs/errors. All crypto operations must use secure random
81+
(crypto.getRandomValues or equivalent). Key material must be
82+
zeroed after use where possible.
83+
84+
- path: 'packages/connect-provider/src/**/*.ts'
85+
instructions: >
86+
Network communication layer with Klever blockchain nodes.
87+
HTTP client with caching, retry logic, and multi-network support
88+
(mainnet, testnet, devnet). Ensure proper error handling for
89+
network failures, timeouts, and rate limiting. API response
90+
types must match the actual Klever node API format.
91+
92+
- path: 'packages/connect-transactions/src/**/*.ts'
93+
instructions: >
94+
Offline transaction building. Transactions must be constructable
95+
without network access. Supports all Klever transaction types
96+
(Transfer, Freeze, Unfreeze, Delegate, etc.). Proto encoding
97+
is used for serialization. Ensure nonce and chain ID are properly
98+
handled. Flag any implicit network calls in builder methods.
99+
100+
- path: 'packages/connect-contracts/src/**/*.ts'
101+
instructions: >
102+
Smart contract interaction layer with ABI parsing, parameter
103+
encoding/decoding, event parsing, and contract factory.
104+
ABI types must be validated before encoding. Parameter encoding
105+
must handle all KleverVM types correctly. Flag any missing type
106+
coverage or incorrect byte encoding.
107+
108+
- path: 'packages/connect-wallet/src/**/*.ts'
109+
instructions: >
110+
Wallet implementations (browser extension, base signer).
111+
Must follow the AbstractSigner interface pattern. Browser wallet
112+
integration should handle extension not installed, user rejection,
113+
and account switching. Never store private keys in localStorage
114+
or sessionStorage.
115+
116+
- path: 'packages/connect-react/src/**/*.{ts,tsx}'
117+
instructions: >
118+
React hooks and context for dApp development. Hooks must follow
119+
React rules (no conditional hooks, proper dependency arrays).
120+
Context provider must handle wallet connection lifecycle.
121+
Components should be tree-shakeable. Flag any direct DOM
122+
manipulation or non-React patterns.
123+
124+
- path: 'packages/connect/src/**/*.ts'
125+
instructions: >
126+
Main entry point that re-exports from all packages. Keep the
127+
public API surface minimal and well-documented. Ensure all
128+
re-exports are properly typed. This package should not contain
129+
business logic — only re-exports and convenience wrappers.
130+
131+
- path: 'packages/**/src/__tests__/**/*.ts'
132+
instructions: >
133+
Vitest test files. Tests should use proper mocking with vi.mock()
134+
and vi.fn(). Do not flag test-only patterns like type assertions
135+
or mock casts. Integration tests (*.testnet.ts) may make real
136+
network calls — these are excluded from CI. Ensure unit tests
137+
do not make actual network requests.
138+
139+
- path: '.github/workflows/**/*.yml'
140+
instructions: >
141+
GitHub Actions CI/CD workflows. The CI pipeline runs format,
142+
typecheck, lint, build, and test in order. Build must complete
143+
before test due to package dependencies. Ensure proper caching
144+
of pnpm store and Turbo cache. Security workflows should not
145+
expose secrets in logs.
146+
147+
auto_review:
148+
enabled: true
149+
auto_incremental_review: true
150+
drafts: false
151+
base_branches:
152+
- develop
153+
- master
154+
155+
finishing_touches:
156+
docstrings:
157+
enabled: false
158+
unit_tests:
159+
enabled: true
160+
161+
tools:
162+
eslint:
163+
enabled: true
164+
biome:
165+
enabled: false
166+
shellcheck:
167+
enabled: true
168+
gitleaks:
169+
enabled: true
170+
actionlint:
171+
enabled: true
172+
yamllint:
173+
enabled: true
174+
175+
chat:
176+
auto_reply: true
177+
178+
knowledge_base:
179+
opt_out: false
180+
learnings:
181+
scope: auto
182+
issues:
183+
scope: auto
184+
pull_requests:
185+
scope: auto
186+
web_search:
187+
enabled: true
188+
code_guidelines:
189+
enabled: true
190+
191+
code_generation:
192+
unit_tests:
193+
path_instructions:
194+
- path: 'packages/**/src/**/*.ts'
195+
instructions: >
196+
Use Vitest with TypeScript. Mock external dependencies with vi.mock().
197+
Use vi.fn() for function mocks. Test files go in src/__tests__/
198+
within each package. Use describe/it blocks with clear test names.
199+
For crypto tests, use known test vectors. For provider tests, mock
200+
HTTP responses. For encoding tests, verify round-trip consistency
201+
(encode then decode should return original). For contract tests,
202+
include ABI fixtures inline or import from test helpers.

0 commit comments

Comments
 (0)