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](../../plugins/name/ladybug.md) as an example:
1415```yml
16- url: https://gitroot.dev/releases/0.3.0/ladybug-0.0.3.wasm
17checksum: sha256:adfaf88dc15ca5d53019ff194a32abec9c914c6cdf676ef4de589c1a4cfd12d4
18name: ladybug
19active: true20run:
21 - path: issues/**/*.md
22branch:
23 - "*"24when:
25 - add
26 - mod
27write:
28git:
29 - path: issues/**/*.md
30can:
31 - mod
32web: []
33configuration: ...
34```3536You 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."
3738But it can't create a file in git or write in web.
3940Be carrefull, the plugin will be called for modification of `issues/1.md`, but it can modify `issues/2.md` if it need to do.
4142_Configuration has been omitted because it depend on each plugin._4344## More complexe example
4546If you look at the [plugins.yml](../../.gitroot/plugins.yml) of GitRoot itself you will see that [apex plugin](../../plugins/name/apex.md) have a more complexe configuration:
4748```yml
49- url: https://gitroot.dev/releases/0.3.0/apex-0.0.3.wasm
50checksum: sha256:3f7e22f834ce7e16231f6fa08495517c1ec021cb801b9b2885345a8deb16ebf0
51name: apex
52active: true53run:
54 - path: "**/*"55branch:
56 - main
57when:
58 - add
59 - mod
60 - del
61write:
62git:
63 - path: index.md
64can:
65 - add
66web:
67 - path: "**/*"68can:
69 - add
70 - mod
71 - del
72 - append
73configuration: &apexConf74header: ...
75 - path: "**/*"76branch:
77 - "*"78 - "!main"79when:
80 - add
81 - mod
82 - del
83write:
84git: []
85web:
86 - path: branches/**/*
87can:
88 - add
89 - mod
90 - del
91 - append
92configuration:
93<<: *apexConf94generateGitWorktree: false95```9697You 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, apex plugin can only write in the `branches` directory".
9899Why? 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 modif in an other url (e.g. http://myTld.com/myRepo/branches/brach-test/myFile) and when the change are commited to the default branche render in final destination (e.g. http://myTld.com/myRepo/myFile).