Generated: 2026-01-18 Project: vfox (Version Fox) - Cross-platform SDK version manager
vfox is a cross-platform SDK version manager (similar to nvm, fvm, sdkman, asdf-vm) that uses Lua-based plugins to manage runtime versions across Global, Project, and Session scopes. Built with Go 1.24.0.
# Build
go build .
# Test (all)
go test ./...
# Test (single package)
go test ./internal/sdk -v
# Test with coverage
go test ./... -coverprofile=coverage.out -covermode=atomic
# E2E tests
./scripts/e2e-test.sh # Unix
pwsh ./scripts/e2e-test.ps1 # Windows
# Dependencies
go mod tidy
go get .
# Version bump
./scripts/bump.sh <version>
# Release (via goreleaser)
goreleaser release- License headers: All Go files start with Apache 2.0 copyright block (17 lines)
- Formatting: Standard
gofmt- usego fmt ./before committing - No linter config: No golangci-lint, go vet, or golint configuration found
- Import grouping: Third-party packages grouped, internal packages last
- Error wrapping: Use
fmt.Errorf("context: %w", err)for error chains
manager (orchestration)
↓
sdk (SDK abstraction)
↓
plugin (Lua plugin system)
↓
env (environment variables & shell integration)
↓
pathmeta, config (metadata & configuration)
↓
shared/* (utilities: logger, util, cache, shim)
- ✅ Downward dependencies only
- ❌ No upward dependencies
- ❌ No peer dependencies
- ✅
shared/*can import nothing frominternal/
FORBIDDEN: Manager layer directly handling SDK operations
// WRONG - Manager handling SDK ops directly
manager.Install(sdk, version)
manager.CreateSymlinks(...)
// CORRECT - Delegate to SDK layer
sdk, err := manager.LookupSdk("nodejs")
sdk.Install(version)
sdk.CreateSymlinksForScope(version, env.Project)
sdk.EnvKeysForScope(version, env.Project)- Paths: Appended in order (first = HIGHEST priority): Project → Session → Global
- Vars: Overwritten (last = HIGHEST priority): Global → Session → Project
Simple: [tools] nodejs = "21.5.1"
Complex: [tools] java = { version = "21", vendor = "openjdk" }
Priority: .vfox.toml > vfox.toml > .tool-versions > .nvmrc > .node-version > .sdkmanrc
- UserPaths (
~/.vfoxor~/.version-fox): tmp/, config.yaml, sdks/ (symlinks) - SharedPaths (
VFOX_HOMEor UserPaths): cache/ (installs), plugins/, config.yaml - Environment variable:
VFOX_HOMEsets shared root (default: same as UserPaths) - Internal vars:
__VFOX_SHELL,__VFOX_PID,__VFOX_CURTMPPATH(for shell hooks)
Required hooks: Available(), PreInstall(version), EnvKeys(version)
Optional hooks: PostInstall(version), PreUse(version), ParseLegacyFile(), PreUninstall(version)
Formats: Single file (main.lua) or multi-file (metadata.lua + hooks/*.lua)
- Upward dependencies: Lower layers importing higher layers
- Peer dependencies: Same-level packages importing each other
- Manager SDK operations: Direct SDK handling in manager (must delegate to SDK layer)
- Shared packages with business logic:
internal/shared/*should only contain utilities
- No log.Fatal: Use proper error handling
- Minimize unsafe: Only for Windows-specific UAC elevation
- No circular imports: Enforce strict layered hierarchy
- No empty catch blocks: Handle errors properly
- Write tests first: TDD approach
- No deleting failing tests: Fix code, not tests
- 33 test files cover: concurrent SDK lookup, paths, config, shells, plugins, cross-platform
| Task | Location |
|---|---|
| CLI commands | cmd/commands/ (22 commands) |
| SDK operations | internal/sdk/sdk.go |
| Plugin system | internal/plugin/ |
| Manager | internal/manager.go (lookup, plugin registry only) |
| Paths | internal/pathmeta/path_meta.go |
| Environment | internal/env/env.go (scope-aware merging) |
| Config | internal/config/config.go |
github.com/urfave/cli/v3- CLI frameworkgithub.com/yuin/gopher-lua- Lua VMgithub.com/BurntSushi/toml- TOML parsinggopkg.in/yaml.v3- YAML parsinggithub.com/pterm/pterm- Terminal UIgithub.com/shirou/gopsutil/v4- Process/system utilities
- Targets: linux, darwin, windows on 386, amd64, arm, arm64, loong64
- Shells: Bash, Zsh, Fish, PowerShell, Clink, Nushell
- Symlinks: Unix (symbolic links), Windows (shim executables)