Rust SDK¶
Use the same engine directly from Rust. It needs Git and the configured agent
and project tools, but no separately installed repo-maintainer executable.
[dependencies]
repo-maintainer = { git = "https://github.com/djsydney04/repo_maintainer" }
anyhow = "1"
Pin a reviewed rev for reproducible builds.
use repo_maintainer::Maintainer;
fn main() -> anyhow::Result<()> {
let maintainer = Maintainer::new("/path/to/repository");
maintainer.check()?;
let result = maintainer.run("Fix the empty search state and add a regression test.")?;
println!("{}: {}", result.status, result.summary);
println!("Patch: {}", result.artifacts.patch.display());
Ok(())
}
run(task) accepts task text, not a filename. Use run_configured() to run the
configured instructions without an additional task. Both are synchronous and
return RunResult; blocked work is a result, while configuration and operational
failures return Err. Credentials come from the worker's environment/login.
Optional builders select configuration and an empty output directory:
let maintainer = repo_maintainer::Maintainer::new("/repos/app")
.config(".maintainer/work.yml")
.output("/jobs/run-42");
The SDK validates changed patches independently and leaves your working tree untouched. It never schedules work or opens a PR. See the shared result contract and CLI stages for publication orchestration.
Configure entirely in Rust¶
Use configuration with a JSON value. It is checked by the same engine schema:
let client = repo_maintainer::Maintainer::new("/repos/app")
.configuration(serde_json::json!({
"version": 2,
"agent": {"allow_paid": true},
"validation": {"checks": [
{"name": "tests", "command": ["cargo", "test"]}
]}
}));
client.check()?;
let result = client.run("Repair one reproducible bug with a regression test.")?;
Add serde_json to your dependencies for this example. A configuration builder replaces a previously selected config file, and config(path) replaces a previously supplied object; the most recent choice is used.