GitHub - asdf-vm/asdf: Extendable version manager with support for Ruby, Node.js, Elixir, Erlang & more
Key Points
- 1asdf is a single command-line interface tool designed to manage multiple language runtime versions, acting as a unified solution similar to `gvm`, `nvm`, `rbenv`, and `pyenv`.
- 2It addresses the need for multiple version managers by providing an extendable plugin system, allowing users to support various languages with consistent commands and a single global configuration.
- 3This tool simplifies development by enabling per-project version management through a `.tool-versions` file, automatically switching runtimes as directories are traversed.
The asdf-vm/asdf project presents asdf, an extendable command-line interface (CLI) tool engineered to manage multiple language runtime versions across projects. Positioned as a unified alternative to disparate language-specific version managers such as gvm, nvm, rbenv, and pyenv, asdf aims to consolidate runtime version management under a single, consistent interface.
The core methodology of asdf is predicated on a flexible plugin system. asdf itself provides the foundational CLI and framework, while support for specific programming languages, build tools, or runtime environments (e.g., Ruby, Node.js, Elixir, Erlang) is dynamically added via community- or user-contributed plugins. This architecture allows users to install only the necessary plugins for the languages they utilize, preventing the accumulation of redundant version managers.
Technically, asdf achieves its version management through several mechanisms:
- Centralized Configuration: It maintains a single global configuration for default runtime versions.
- Project-Specific Versioning: For project-level specificity,
asdfrelies on a.tool-versionsfile, which specifies the required versions of various runtimes for a given project directory. This file enables consistent development environments across teams. - Legacy Configuration Support: To facilitate seamless migration,
asdfcan interpret existing language-specific version configuration files, such as.node-version,.nvmrc, and.ruby-version, automatically adjusting to established project settings. - Dynamic Shell Integration:
asdfintegrates with common shells (Bash, Zsh, Fish, Elvish). Upon traversing directories,asdfdynamically modifies the shell'sPATHenvironment variable. This ensures that the correct, project-specified runtime version is automatically activated and prioritized, eliminating the need for manual version switching. - Consistent Command Set: Users interact with all managed runtimes using a uniform set of
asdfcommands (e.g., , , ), significantly reducing the learning curve associated with managing multiple language ecosystems.
The project highlights its benefits as providing a single CLI for diverse languages, offering consistent commands, centralizing configuration, supporting automatic version switching based on directory context, and providing a simple plugin system for extensibility. It also provides shell completion and a template for creating new plugins. The overarching motivation behind asdf is to simplify the developer experience by abstracting away the complexity of managing numerous language-specific version managers and their unique command sets into one cohesive, extendable system.