Skip to main content

Config

Struct Config 

Source
pub struct Config {
Show 49 fields pub port: u16, pub worker_token: String, pub github_webhook_secret: String, pub bitbucket_webhook_secret: String, pub gitlab_webhook_secret: String, pub openrouter_api_key: String, pub openrouter_model: String, pub openrouter_model_explore: String, pub openrouter_base_url: String, pub openrouter_max_tokens: u32, pub openrouter_temperature: f32, pub openrouter_timeout_secs: u64, pub openrouter_max_retries: u32, pub max_diff_chars: usize, pub include_globs: Vec<String>, pub exclude_globs: Vec<String>, pub vendored_globs: Vec<String>, pub file_bundling: bool, pub self_critique: bool, pub min_confidence: u8, pub max_findings: usize, pub reanchor_findings: bool, pub agentic: bool, pub max_turns: usize, pub max_history_chars: usize, pub review_on_update: bool, pub github_token: String, pub github_api_base: String, pub bitbucket_email: String, pub bitbucket_token: String, pub bitbucket_api_base: String, pub gitlab_token: String, pub gitlab_api_base: String, pub comment_marker: String, pub user_agent: String, pub http_referer: String, pub x_title: String, pub extra_system_prompt: String, pub structural_context: bool, pub structural_max_files: usize, pub complexity_metrics: bool, pub complexity_min_cyclomatic: u32, pub blast_radius: bool, pub blast_max_symbols: usize, pub blast_max_refs: usize, pub ci_status: bool, pub cve_scan: bool, pub cve_max_packages: usize, pub osv_api_base: String,
}
Expand description

Resolved runtime configuration.

Fields§

§port: u16§worker_token: String§github_webhook_secret: String

Shared secret GitHub signs webhook deliveries with (X-Hub-Signature-256).

§bitbucket_webhook_secret: String

Shared secret Bitbucket signs webhook deliveries with (X-Hub-Signature).

§gitlab_webhook_secret: String

Shared token GitLab sends webhook deliveries with (X-Gitlab-Token). Unlike GitHub/Bitbucket this is a plain token compared verbatim, not an HMAC.

§openrouter_api_key: String

OpenRouter (or any OpenAI-compatible) API key. Resolved from OPENROUTER_API_KEY, falling back to LLM_API_KEY — the alias lets Ollama/vLLM/local OpenAI-compatible servers reuse a generic var name.

§openrouter_model: String

Synthesis model: writes the final review findings (quality matters here).

§openrouter_model_explore: String

Exploration model: drives the agentic tool loop (grep/read_file/list_dir) to gather context. Cheaper — it navigates files, it doesn’t judge.

§openrouter_base_url: String

Base URL of the OpenAI-compatible chat-completions API. Resolved from LLM_BASE_URL, then OPENROUTER_BASE_URL, defaulting to OpenRouter — the LLM_BASE_URL alias lets Ollama/vLLM/local OpenAI-compatible servers work.

§openrouter_max_tokens: u32§openrouter_temperature: f32§openrouter_timeout_secs: u64

Whole-request timeout for a single model call. The hand-rolled loop had none, so a stalled provider hung the entire review.

§openrouter_max_retries: u32

Retries for a transient failure (429 / 5xx) on one call. The hand-rolled loop had none, so a single 429 discarded the whole review.

§max_diff_chars: usize§include_globs: Vec<String>

Glob patterns of files to INCLUDE in the diff before it’s sent to the LLM. Empty means include everything (subject to exclude_globs).

§exclude_globs: Vec<String>

Glob patterns of files to EXCLUDE from the diff (lockfiles, generated, vendored, minified) — drops noise and saves tokens before the LLM call.

§vendored_globs: Vec<String>

Glob patterns marking vendored third-party source. Diff-hygiene (class D) findings are suppressed inside these paths — bulk-committing upstream code is the intent of a vendoring PR, not a defect. Empty means the conventional defaults (crate::diff::DEFAULT_VENDORED_DIRS).

§file_bundling: bool

When packing a large diff to the size budget, group related changed files (a source + its test, i18n siblings) into one unit so they stay adjacent and pack together instead of being scattered by priority. Fail-open.

§self_critique: bool

Run a second, skeptical “self-critique” pass that removes false positives and out-of-scope nits from the findings before posting.

§min_confidence: u8

Drop findings whose model-reported confidence is below this threshold.

§max_findings: usize

Hard cap on the number of findings posted (after sorting by severity).

§reanchor_findings: bool

Re-anchor a finding whose line just missed a real diff line: snap it to the nearest diff line within a small window when that line’s code matches what the finding references, so a small drift posts inline instead of folding into the summary. Conservative + fail-open.

§agentic: bool

Use the agentic reviewer: clone the repo and let the model investigate cross-file context with tools, instead of a single diff-only call.

§max_turns: usize

Max tool-loop turns for the agentic reviewer (cost guard).

§max_history_chars: usize

Char budget for accumulated tool results in the agent conversation; older results are elided once newer ones fill it (bounds per-turn tokens).

§review_on_update: bool

Re-review when new commits are pushed to an open PR (GitHub synchronize / Bitbucket pullrequest:updated). Off by default so iterating on a PR doesn’t trigger a fresh (expensive) review per push — opened/reopened/ ready_for_review always review; use the manual POST /review endpoint to re-review on demand.

§github_token: String§github_api_base: String§bitbucket_email: String§bitbucket_token: String§bitbucket_api_base: String§gitlab_token: String§gitlab_api_base: String§comment_marker: String

Signature appended to every comment the bot posts and used as the dedupe key to find/update its own comments. Injected so the library carries no hardcoded bot identity.

§user_agent: String

User-Agent header sent on provider (GitHub) API requests.

§http_referer: String

HTTP-Referer header sent to OpenRouter (attribution).

§x_title: String

X-Title header sent to OpenRouter (attribution).

§extra_system_prompt: String

Extra system-prompt text appended to the built-in prompts. Lets a consumer inject a large conventions block (e.g. via a file baked into its image) without changing the library.

§structural_context: bool

Compute “structural context” (the enclosing function/symbol of each changed line) and inject it into the review prompt so the model knows each change’s scope. Fully fail-open — never blocks a review.

§structural_max_files: usize

Max number of files to fetch + parse for structural context (cost guard).

§complexity_metrics: bool

Surface deterministic complexity metrics (cyclomatic + cognitive, A–F grade) for the functions a change touches, computed with tree-sitter alongside the structural context. A cheap, LLM-free risk signal. Fully fail-open.

§complexity_min_cyclomatic: u32

Only report a changed function when its cyclomatic complexity is at least this — keeps the block a high-signal risk flag, not noise for trivial code.

§blast_radius: bool

Compute a “blast radius” for the agentic reviewer: from the clone, find the callers and tests of each changed symbol and seed the prompt with them (also exposes a references tool). Agentic path only — needs the clone. Fail-open.

§blast_max_symbols: usize

Max number of changed symbols to expand into a blast radius (cost guard).

§blast_max_refs: usize

Max call sites listed per symbol per bucket (callers / tests) (cost guard).

§ci_status: bool

Fetch the head commit’s CI results (GitHub check runs / Bitbucket build statuses) with the PR metadata and surface them in the prompt, so the reviewer can’t assert a broken build that CI already decided.

One extra API call per review. Off is for tokens near their rate limit; with it off the reviewer simply sees no CI block. Fully fail-open either way.

§cve_scan: bool

Scan changed lockfiles for known-vulnerable dependencies via OSV.dev and append advisories to the review summary. Fully fail-open — never blocks a review.

§cve_max_packages: usize

Max distinct packages queried against OSV per review (cost/fan-out guard).

§osv_api_base: String

Base URL of the OSV.dev API (override for a mirror or a test double).

Implementations§

Source§

impl Config

Source

pub fn from_env() -> Self

Build the config from environment variables, applying defaults.

Source

pub fn with_repo_overrides(&self, rc: &RepoConfig) -> Config

Return a clone of this config with any fields set in rc overridden.

Only Some(..) fields of the per-repo [RepoConfig] take effect; the rest keep the env-derived value. rc.instructions is appended to Config::extra_system_prompt (newline-separated) rather than replacing it, so a consumer’s baked-in conventions block and the repo’s own instructions both reach the model.

§Examples
let base = Config::from_env();
let rc = RepoConfig { min_confidence: Some(80), ..Default::default() };
let effective = base.with_repo_overrides(&rc);
assert_eq!(effective.min_confidence, 80);

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more