Documentation Index
Fetch the complete documentation index at: https://trunk-4cab4936-sam-gutentag-flaky-tests-new-monitors.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Plugin config merging
Trunk uses a plugin system where a root configuration is defined in the trunk-io/plugin repository. You can import many plugin config sources, and fields defined at each level override the level above.When plugin configs are merged, only fields defined in a config file are merged into the level above. You can define just the fields you wish to override in
.trunk/trunk.yaml and .trunk/user.yaml.trunk.yaml schema. Config merging proceeds as follows:
- Remote plugins sourced in
.trunk/trunk.yaml(and.trunk/user.yaml). Plugins are sourced in the order they’re defined, with later plugins overriding those defined before it. Thetrunkplugin is implicitly sourced first. - Your repo level
.trunk/trunk.yamlfile, complete with a CLI version and any definitions or enables. Configurations defined here override what’s defined in the remote plugins. - Optionally,
.trunk/user.yaml, a local git-ignored file where users can provide their own overrides.
exported_configs section are symlinked from their relevant plugin into the root of the workspace when an applicable linter is run with trunk check.
Importing a plugin repository
By default, trunk imports the trunk-io/plugins repository. To import a repo add it to theplugins.sources list. Each repo requires a URI and ref.
| Field | Description |
|---|---|
id | unique identifier for this repository |
uri | address used to clone the target repository |
ref | commit id or tag to checkout. Do not use branch names, as these can be unstable |
local | path to local (on-disk) repository. Takes precedence over uri/ref if defined |
import_to_global (default: true) | import content into the global namespace. If set to false actions and linters defined in the plugin must be referenced by <plugin_id>.<name> |
Plugin capabilities
Any configuration used intrunk.yaml can also be used in a plugin repository, with some exceptions. A plugin repository must have one root level plugin.yaml and can have any number of other plugin.yaml files in other subdirectories. These configuration files are then merged into one composite plugin configuration.
The most common use for a plugin repository is to define custom linters, actions, or tools. But they can also be used to define a common set of shared tools across an organization. For more info, see organization configs.
The root plugin.yaml file may also have a required_trunk_version field which governs compatibility when upgrading between CLI versions.
Add a plugin to your trunk.yaml file
To add a plugin from GitHub:
ref field must be a tag or SHA.
Plugins scope
Plugins are merged serially, in the order that they are sourced, and can override almost any Trunkconfiguration. This allows organizations to provide a set of overrides and definitions in one
central place. For instance, you can create your own
my-plugins repository with plugin.yaml:
.trunk/trunk.yaml file from another repository as follows:
trunk in the sourcing repository, they will already have ruff enabled, along with the trufflehog override from the my-plugins repository.
Note that private GitHub plugin repositories are not currently supported.
Excluded fields
Pluginsources, as well as the cli version, are not merged from plugin repositories to ensurethat config merging occurs in a predictable, stable fashion.