# Tool Versions<no value>
// <!-- Required for asciidoctor -->
:toc:
// Set toclevels to be at least your hugo [markup.tableOfContents.endLevel] config key
:toclevels: 4

[cols="1^,1^,1^",options=header]
|===
| source | condition | target
| &#10004; | &#10004; | &#10004;
|===

== Description

The `toolversions` resource reads and writes one entry in a `.tool-versions` file, the version manifest used by link:https://asdf-vm.com/[asdf] and link:https://mise.jdx.dev/[mise], where each line pairs a tool name with one or more versions:

[source,text]
----
nodejs 20.11.0
golang 1.22.0
terraform 1.7.4
----

**source**::
Returns the version recorded for `key`.

**condition**::
Checks that the entry holds `value`, or the source output when `value` is unset.

**target**::
Updates that entry. Files already holding the value are reported as up to date and left untouched.

== Parameters

{{< resourceparameters "sources" "toolversions" >}}

`file` or `files` is mandatory, as is `key`; missing either aborts the run with `wrong spec content`, preceded by `.tool-versions file undefined` or `tool-versions key undefined`. `file` and `files` are mutually exclusive.

`key`:: The tool name as it appears at the start of the line (`golang`, not a path expression).
`value`:: Defaults to the source output.
`createmissingkey`:: Target only. Appends the tool when the file does not mention it yet, instead of failing. Unlike the link:/docs/plugins/resource/toml/["TOML" resource], there is no engine restriction on it.

== Remote files

For a source and a condition, `file` accepts `https://`, `http://` and `file://`. A target must write locally and refuses a URL.

== Example

[source,yaml]
----
# updatecli.yaml
{{<include "assets/code_example/docs/plugins/resources/toolversions/updatecli.d/default.yaml">}}
----

== Links

* link:https://asdf-vm.com/manage/configuration.html#tool-versions[The `.tool-versions` file format]
