GitRoot

craft your forge, build your project, grow your community freely
 1// SPDX-FileCopyrightText: 2025 Romain Maneschi <romain@gitroot.dev>
 2//
 3// SPDX-License-Identifier: MIT
 4
 5use crate::{Commit, Report};
 6
 7pub trait Plugin: Send + 'static {
 8    fn init(
 9        &self,
10        repo_name: String,
11        conf_has_changed: bool,
12        serialized_conf: String,
13    ) -> Result<(), String>;
14    fn start_commit(&self, commit: Commit) -> Result<(), String>;
15    fn add_file(&self, path: String) -> Result<(), String>;
16    fn mod_file(&self, from_path: String, to_path: String) -> Result<(), String>;
17    fn del_file(&self, path: String) -> Result<(), String>;
18    fn end_commit(&self, commit: Commit) -> Result<(), String>;
19    fn finish(&self) -> Result<(), String>;
20}
21
22pub trait PluginReporter: Plugin + Send + 'static {
23    fn report(&self, report: Report) -> Result<(), String>;
24}