Skip to main content

pr_review_core/
lib.rs

1//! pr-review-core — reusable engine for an advisory AI PR reviewer.
2//!
3//! Pulls a pull request's diff, reviews it with a Claude model via OpenRouter,
4//! and posts a line-anchored inline review plus an advisory summary comment.
5//! Provider-agnostic across GitHub and Bitbucket. Bot identity and any extra
6//! prompt are injected through [`config::Config`] so consumers (bot binaries)
7//! supply their own branding.
8
9/// This crate's version, for consumers that report which engine they are running.
10///
11/// A bot binary knows its own version but not its engine's, and "is the deployed
12/// image current?" is otherwise answerable only by reading deploy logs — which cost
13/// real time three separate times while shipping 0.11.0.
14pub const VERSION: &str = env!("CARGO_PKG_VERSION");
15
16pub mod agent;
17pub mod backend;
18pub mod blast;
19pub mod command;
20pub mod complexity;
21pub mod config;
22pub mod deps;
23pub mod diff;
24pub mod llm;
25pub mod prompt;
26pub mod providers;
27pub mod repo;
28pub mod repo_config;
29pub mod review;
30pub mod structure;
31pub mod webhook;
32
33/// Clip a string to at most `n` characters (char-safe — never splits a UTF-8
34/// codepoint). Used to keep API error bodies short in messages.
35pub fn clip(s: &str, n: usize) -> String {
36    s.chars().take(n).collect()
37}