GitRoot
Craft your forge, Build your project, Grow your community freely
1// SPDX-FileCopyrightText: 2026 Romain Maneschi <romain@gitroot.dev>
2//
3// SPDX-License-Identifier: MIT
4
5use serde::{Deserialize, Serialize};
6use serde_json::Value;
7
8#[derive(Debug, Deserialize, Serialize, Clone)]
9#[serde(rename_all = "camelCase")]
10pub struct PluginRun {
11 pub path: String,
12 pub branch: Vec<String>,
13 pub when: Vec<PluginRunWhen>,
14 pub func: Vec<PluginFunc>,
15 pub write: PluginWrite,
16 pub configuration: Value,
17}
18
19#[derive(Debug, Deserialize, Serialize, Clone)]
20#[serde(rename_all = "camelCase")]
21pub struct PluginFunc {
22 pub func_name: String,
23 pub args: Vec<String>,
24 pub res: Vec<String>,
25}
26
27#[derive(Debug, Deserialize, Serialize, Clone)]
28#[serde(rename_all = "camelCase")]
29pub struct PluginWrite {
30 pub git: Vec<PluginWriteRight>,
31 pub web: Vec<PluginWriteRight>,
32 pub exec: Vec<PluginExecRight>,
33 pub call_func: Vec<PluginCallFuncRight>,
34}
35
36#[derive(Debug, Deserialize, Serialize, Clone)]
37#[serde(rename_all = "camelCase")]
38pub struct PluginWriteRight {
39 pub path: String,
40 pub can: Vec<PluginWriteRightCan>,
41}
42
43#[derive(Debug, Deserialize, Serialize, Clone)]
44#[serde(rename_all = "camelCase")]
45pub struct PluginExecRight {
46 pub command: String,
47}
48
49#[derive(Debug, Deserialize, Serialize, Clone)]
50#[serde(rename_all = "camelCase")]
51pub struct PluginCallFuncRight {
52 pub plugin_purl: String,
53 pub func_name: String,
54}
55
56#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)]
57#[serde(rename_all = "lowercase")]
58pub enum PluginRunWhen {
59 Add,
60 Mod,
61 Del,
62}
63
64#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)]
65#[serde(rename_all = "lowercase")]
66pub enum PluginWriteRightCan {
67 Add,
68 Mod,
69 Del,
70 Append,
71}
72