Tools
Command Line
trunk tools <command> | Description |
---|---|
| list all available tools in the repository and whether they are enabled or not |
| install your enabled tools into |
| enable the provided tool, optionally at a specified version |
| disable the provided tool |
Discovering Tools
The Trunk plugins repo ships with a collection of tools that can help supercharge your repository and provide examples for how to write your own. To see a list of tools that you can enable in your own repo run:
Running Tools
Trunk installs your enabled tools into the .trunk/tools
directory. Each tool exposes a list of shims (these may or may not be identically named to the tool - most typically a tool has one shim matching the name of the tool). Each shim is installed into the .trunk/tools
directory.
You can run your tools by referring to the path <path-to-workspace>/.trunk/tools/<shim-name>
but this is unwieldy. We highly recommend using our shell hooks to manage your PATH.
Starting with CLI version 1.18.0
, you can do so by running trunk shellhooks install
, which will install the Trunk hooks to the config file of your $SHELL. You can also run trunk shellhooks install <shell_name>
to install a specific shell hook.
Supported shells:
bash
zsh
tcsh
fish
elvish
For organization that want to require the use of the hooks, they can add to the config file:
On the next Trunk command (like check or fmt), it will update your shell RC file to load our hooks.
After reloading your shell, whenever you're inside your repo at the command line, you can just run shims installed by trunk tools
directly by name.
N.B. There is a known incompatibility with direnv when using PATH_ADD. To use our hooks, remove PATH_ADD from your .envrc and add them to your Trunk config as such:
Paths can either be absolute, or relative to the workspace using the special ${workspace}
variable
Troubleshooting Linters
Tools enable you to run your linter binaries on the command line independent of trunk check
and test and troubleshoot your integrations more easily.
Tools are configured in the tools
section of trunk.yaml
. As with other settings, you can override these values in your User YAML.
Like with actions and linters, we have a (versioned) enabled
section and a disabled
section, which can be manipulated using trunk tools enable/disable
. There is also a list of definitions
, which are merged across your trunk.yaml
, user.yaml
, as well as any plugins that you use.
auto_sync
controls whether or not Trunk automatically installs your tools for you when your config changes. This defaults to true
. Note that the daemon must be running with the monitor in order for this to function properly.
Last updated