diff_check
ModuleAsking an agent about the difference between two versions of a repository.
Contents
use utopia_agents::DiffCheck;pub struct DiffCheckCompares two versions of a repository with git diff and asks an agent
about the difference.
Both sides are copied (or cloned) to temporary directories, the
excluded paths are removed, and git diff --no-index compares them. When
they differ, the diff (truncated to the most lines the options allow) is
put in the prompt ({{diff}}, {{base}}, {{target}}, {{diff_stats}}
placeholders; appended when the prompt has no {{diff}}), and the
answer comes back.
use utopia_agents::{DiffCheck, OpenAi};
use utopia_agents::diff_check::{Options, Runner};
let mut adapter = OpenAi::new("sk-...");
let mut options = Options::default();
options.set_exclude_paths(&[".github"]);
let outcome = DiffCheck::new()
.run(Runner::Adapter(&mut adapter), "/srv/sdk-old", "/srv/sdk-new", "Summarize:\n{{diff}}", &options)
.await?;
if outcome.has_changes {
println!("{}", String::from_utf8_lossy(&outcome.response));
}Default.use utopia_agents::diff_check::Options;pub struct OptionsHow a diff check runs.
Default.use utopia_agents::diff_check::Outcome;pub struct OutcomeThe result of a diff check.
use utopia_agents::diff_check::Repository;pub struct RepositoryA repository to compare: a local directory, or a remote Git URL to clone, at an optional ref.
use utopia_agents::diff_check::Runner;pub enum Runner<'a, A>Who answers: an agent (configured further by the options) or an adapter (wrapped in a new agent).
use utopia_agents::diff_check::Source;pub enum SourceWhat to compare: a path or URL, or a Repository.
From.