asdf-vm / asdf

Extendable version manager with support for Ruby, Node.js, Elixir, Erlang & more
https://asdf-vm.com/
MIT License
21.13k stars 763 forks source link

Add the ability to track which versions are in use #1717

Open nicolas-miller-storable opened 5 months ago

nicolas-miller-storable commented 5 months ago

Is your feature request related to a problem? Please describe

I work on a lot of different projects, meaning I have a lot of versions of different tools installed. I currently have 14 versions of Node.js on my device. Unfortunately, I do not have an easy way to determine which of those tools are actually in use. If I want to purge unused tool versions, I have to audit all the .tool-versions files in all my projects manually. I would really love if asdf had a mechanism in place to help me keep track of the different tool versions specified in my various .tool-versions files.

Describe the proposed solution

I would like to see a new core asdf command to tag projects. For the sake of discussion, let's call this command asdf track.

When I run asdf track in a project directory with a .tool-versions file present, it writes that directory to a dot file in my home directory. Again, for the sake of discussion, let's just call this file .tool-version-tracker.

When I want to clean house, I then run asdf track --audit (or something similar). This prompts asdf to read the .tool-version-tracker, follow the various paths, inspect the .tool-versions files, and spit out a distinct list of tools and versions in use across my device. That way, I can easily determine which versions I can purge.

As a bonus, this could spit out the project directories alongside the versions. This would make it easier for me to audit my projects and find out which ones are in desperate need of upgrades.

Describe similar asdf features and why they are not sufficient

asdf list is perfect for seeing which versions of a certain tool I have installed, but there is currently no scripted way for me to see which versions I'm actually using.

Describe other workarounds you've considered

I was going to write a bash script to trawl the directories on my device with .tool-versions files, but I figured I'm not the only developer who would benefit from this feature.

nicolas-miller-storable commented 5 months ago

I did see https://github.com/asdf-vm/asdf/issues/819 and https://github.com/asdf-vm/asdf/issues/830. I'm not concerned with making asdf do the cleanup of old versions. I'm only interested in asdf telling me what tools and versions are found in .tool-versions files across my device. If that's still out of scope for asdf, I understand.