craft your forge, build your project, grow your community freely
1<!--
2SPDX-FileCopyrightText: 2025 Romain Maneschi <romain@gitroot.dev>
3 4SPDX-License-Identifier: CC-BY-SA-4.0
5--> 6 7# Plugin rights
8 9Plugins are the true power of GitRoot. But, as you know, with power comes responsability. To be sure to understand what a plugin can and can't, GitRoot expose all details in `.gitroot/plugins.yml`.
1011## First example
1213Taking ladybug as an example:
1415```yml
16- url: plugins/ladybug/ladybug-0.0.1.wasm
17name: ladybug
18active: true19run:
20 - path: issues/**/*.md
21branch:
22 - "*"23when:
24 - add
25 - mod
26write:
27git:
28 - path: issues/**/*.md
29can:
30 - mod
31web: []
32configuration: ...
33```3435You can read: "for all branches in your repository, when you modify or create any markdown file in the directory or a sud-directory of issues execute the plugin. During execution it can write in any markdown file in the directory or a sud-directory of issues in modification."
3637But it can't create a file in git or write in web.
3839Be carrefull, the plugin will be called for modification of `issues/1.md`, but it can modify `issues/2.md` if it need to do.
4041_Configuration has been omitted because it depend on each plugin._4243## More complexe example
4445If you look at the plugins.yml of GitRoot itself you will see that apex plugin have a more complexe configuration:
4647```yml
48- url: plugins/apex/apex-0.0.1.wasm
49name: apex
50active: true51run:
52 - path: "**/*"53branch:
54 - main
55when:
56 - add
57 - mod
58 - del
59write:
60git:
61 - path: index.md
62can:
63 - add
64web:
65 - path: "**/*"66can:
67 - add
68 - mod
69 - del
70 - append
71configuration: &apexConf72header: ...
73 - path: "grafts/*"74branch:
75 - "*"76 - "!main"77when:
78 - add
79 - mod
80 - del
81write:
82git: []
83web:
84 - path: "grafts/*"85can:
86 - add
87 - append
88configuration:
89<<: *apexConf90generateGitWorktree: false91```9293You can read it as: "On the main branch, every file can be rendered in the web. An index.md can be created in the git worktree. But for all other branches, only files in the graft directory can be rendered in the web and only to create or append modifications."
9495Why? Because in GitRoot everybody can create a branch. Imagine if a bad person come, create a branch and delete all the content of the repository. Then push it, if apex render that in the web, your repository website will be empty... What we want is: render it when the change are commited to the default branche.
9697But we also want to see all other grafts. So we tell to the plugin system to only accept new graft. If user make a bad thing nothing will it the web content.