|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +This is a vfox plugin for managing multiple Elixir versions across Windows, Linux, and macOS platforms. The plugin integrates with vfox (version-fox), a universal SDK version management tool. |
| 8 | + |
| 9 | +## Code Architecture and Structure |
| 10 | + |
| 11 | +- **Plugin Entry Point**: `metadata.lua` - Contains plugin metadata like name, version, and compatibility requirements |
| 12 | +- **Core Logic**: `lib/elixir_utils.lua` - Utility functions for version management, HTTP requests, and platform-specific operations |
| 13 | +- **Hook System**: The `hooks/` directory contains Lua files that implement the vfox plugin interface: |
| 14 | + - `available.lua` - Lists available Elixir versions |
| 15 | + - `pre_install.lua` - Handles version validation and download URL generation |
| 16 | + - `post_install.lua` - Performs post-installation tasks like compilation |
| 17 | + - `pre_use.lua` - Validates version before activation |
| 18 | + - `env_keys.lua` - Configures environment variables for installed versions |
| 19 | + |
| 20 | +## Common Development Commands |
| 21 | + |
| 22 | +### Testing |
| 23 | + |
| 24 | +```bash |
| 25 | +# The project uses GitHub Actions for E2E testing across platforms |
| 26 | +# Tests are defined in .github/workflows/e2e_test.yaml |
| 27 | + |
| 28 | +# Mise E2E tests are defined in .github/workflows/mise_e2e_test.yaml |
| 29 | + |
| 30 | +# To run tests locally, you would need to: |
| 31 | +# 1. Install vfox or mise |
| 32 | +# 2. Add the plugin |
| 33 | +# 3. Install and test Elixir versions |
| 34 | +``` |
| 35 | + |
| 36 | +### Version Management |
| 37 | + |
| 38 | +```bash |
| 39 | +# Update Elixir versions list |
| 40 | +# Done via GitHub Actions workflow in .github/workflows/update_elixir_versions.yaml |
| 41 | + |
| 42 | +# The versions are stored in assets/versions.txt (Unix) and assets/versions_win.txt (Windows) |
| 43 | +``` |
| 44 | + |
| 45 | +## Key Implementation Details |
| 46 | + |
| 47 | +1. **Multi-platform Support**: The plugin handles different installation methods for Windows (pre-built installers) and Unix-like systems (source compilation) |
| 48 | + |
| 49 | +2. **Mirror Support**: Can install from official Elixir releases or pre-built versions from hex.pm (controlled by VFOX_ELIXIR_MIRROR environment variable) |
| 50 | + |
| 51 | +3. **Dependency Management**: Requires Erlang/OTP to be installed before Elixir installation |
| 52 | + |
| 53 | +4. **Installation Process**: |
| 54 | + - Unix/Linux: Downloads source code and compiles with `make` |
| 55 | + - Windows: Downloads and executes official installer |
| 56 | + - Hex mirror: Downloads pre-built binaries |
| 57 | + |
| 58 | +## Plugin Interface |
| 59 | + |
| 60 | +The plugin implements the standard vfox plugin interface through the hook files: |
| 61 | + |
| 62 | +- `PLUGIN:Available()` - Returns list of available versions |
| 63 | +- `PLUGIN:PreInstall()` - Prepares for installation |
| 64 | +- `PLUGIN:PostInstall()` - Performs post-installation tasks |
| 65 | +- `PLUGIN:PreUse()` - Validates before version activation |
| 66 | +- `PLUGIN:EnvKeys()` - Sets up environment variables |
| 67 | + |
| 68 | +This architecture allows the plugin to integrate seamlessly with vfox's version management system while handling the specific requirements of Elixir installation across different platforms. |
0 commit comments