asdf-vm / asdf-vm/asdf

Install option which causes failure if .tool-versions lists unknown plugin

Open
#968 4 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
25.6k
Forks
941
Avg merge
9h 24m
Merged PRs (30d)
3

Description

**Is your feature request related to a problem? Please describe.**

I had an issue where my app wouldn't build correctly in CI because a plugin that was listed in `.tool-versions` hadn't been previously installed as a plugin. In this case it was pretty clear what the issue was because I got a `No such file or directory` error for the command (though the *reason* wasn't super clear, since it was part of migrating to GitHub actions and I thought that while I had installed it one step, maybe the state didn't carry over to the next step or something; took me a while to realize that `asdf` silently ignores unknown plug-ins). However, I can imagine a *much* more insidious version of this problem where, say `python 3.7` is ignored and it falls back to system python or something like that.

**Describe the solution you'd like**

I would like a flag to `asdf install`, perhaps `--expect-plugins`, that would cause the command to exit with a failure status code if it detects a plugin in `.tool-versions` (I think, *any* `.tool-versions` in the ancestor chain, but maybe just the current directory?) that hasn't previously been added. That would have made my CI issue immediately apparent.

At work, we've standardized across teams on `asdf` among our dozens of apps, and it's second nature to do `asdf install` when working on a new project. So I'd probably use this flag by default all the time, just so I know right away if some team's project introduces a new plugin.

**Describe similar asdf features and why they are not sufficient**

I've found a number of issues related to unknown plugins in `.tool-versions`. Most propose some version of automatically installing those plugins. While I personally would prefer that solution, I know that it's been rejected. However, I haven't found my specific proposal here in any other issues, and I think it might be acceptable where the others weren't.

**Describe workarounds you've considered**

I suppose a shell script that I can alias `asdf install` to.

**Additional context**

If this solution is acceptable, I'd be happy to work on a PR for it.

Contributor guide

Open the contributing guide

Research direction

Start at the asdf install command entry point and inspect how .tool-versions files and unknown plugins are handled. Resolve whether ancestor directories are included, then verify that the proposed opt-in flag exits unsuccessfully when a listed plugin has not been added while preserving current behavior without the flag.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.