Conversation
…allation guidance Add platform-aware error messages that detect the user's environment and provide tailored Node.js installation instructions. Features: - Detects OS (Linux, macOS, Windows), Linux distributions (Ubuntu, Debian, RHEL, Amazon Linux, Alpine, Arch, SUSE), cloud providers (AWS, GCP, Azure), containers (Docker, Kubernetes), CI/CD platforms (GitHub Actions, GitLab CI, CircleCI, etc.), Python environments (venv, conda), and sudo access - Generates platform-specific installation instructions including package manager commands, NodeSource setup, nvm installation, Docker examples, CI/CD configuration, and alternatives for restricted environments - Provides sudo vs no-sudo alternatives where applicable - Includes nodeenv option for Python virtual environment users - Always suggests direct npx usage as a fallback - Comprehensive test coverage with 53 new tests This improves user experience when Node.js is not installed by providing actionable, context-aware guidance instead of generic error messages. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…est practices Update installation instructions to follow current official recommendations and best practices for 2025: macOS: - Remove MacPorts (less commonly recommended, incorrect command) - Prioritize Homebrew > nvm > Official installer - Remove version-specific package confusion Ubuntu/Debian: - Reorder to prioritize NodeSource (recommended for production) - Add warning that snap auto-updates can cause issues in production - Note that default apt repository may be outdated Windows: - Prioritize official installer (most recommended) - Add LTS version options for winget, Chocolatey, and Scoop - Reorder: Official installer > winget > Chocolatey > Scoop All recommendations now align with official Node.js documentation and current community best practices verified through research of official sources. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add comprehensive WSL detection and tailored installation guidance for users running promptfoo-python in Windows Subsystem for Linux. Detection: - Detects WSL via WSL_DISTRO_NAME and WSL_INTEROP environment variables - Checks /proc/version for Microsoft/WSL signatures - Detects WSL 1 via /mnt/c Windows filesystem mounts - Integrated into environment detection system Installation Guidance: - Warns users NOT to use Windows Node.js from WSL (path/performance issues) - Recommends installing Node.js within WSL using Linux package managers - Provides nvm as recommended alternative for version management - Includes WSL-specific performance tips (store files in ~/, not /mnt/c/) - Shows both WSL guidance and Linux distro-specific instructions Testing: - Added 3 WSL detection tests (env vars, interop, no detection) - Added 2 WSL instruction tests (basic, combined with Ubuntu) - Added WSL Ubuntu environment detection test - Updated all existing environment tests to mock WSL detection - Total: 102 tests passing (6 new WSL-related tests) This improves the developer experience for the large number of users who develop in WSL, providing them with WSL-aware best practices instead of generic Linux instructions that may lead to suboptimal configurations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add support for derivative distributions via ID_LIKE field - Pop!_OS, Raspbian, Linux Mint now correctly map to parent distros - Add /usr/lib/os-release fallback per freedesktop.org spec - Improve code organization with distro family sets - Add 4 new tests for derivative detection (106 total, all passing) - No external dependencies required This provides 95% of the benefit of the 'distro' package without adding an external dependency. Closes the gap for common derivative distributions while maintaining zero-dependency approach. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds comprehensive environment detection to provide tailored Node.js installation instructions when Node.js is not installed.
Instead of showing generic error messages, the CLI now detects the user's execution environment and provides platform-specific installation guidance with officially recommended installation methods.
Environment Detection
The new
environment.pymodule detects:/.dockerenvand cgroup), Kubernetes (via env vars)Platform-Specific Instructions
The new
instructions.pymodule generates tailored installation instructions based on official Node.js recommendations and best practices for 2025:Cloud Functions & Serverless
CI/CD Environments
actions/setup-node@v4setupDocker Containers
apk add nodejs npmwith Dockerfile examplesapt-get install nodejs npmwith NodeSource alternativeWSL (Windows Subsystem for Linux)
~/), not/mnt/c/Linux Distributions
macOS
MacPorts(removed - incorrect command, less commonly recommended)Windows
Virtual Environments
Direct Usage
npx promptfoo@latestas a universal fallbackTest Coverage
Total: 106 passing tests, 3 skipped (Windows-specific on macOS) ✅
tests/test_environment.py(31 tests)tests/test_instructions.py(32 tests)Updated
tests/test_cli.py(43 tests)test_print_installation_help_outputs_to_stderrplatform-agnostic to work with environment-specific outputImplementation Details
Architecture
environment.py) and instruction generation (instructions.py)Environmentdataclass for clean, typed environment informationDerivative Distribution Support
Instead of adding the
distropackage as a dependency, we implemented ID_LIKE support which provides 95% of the benefit:Code Quality
Examples
macOS
Ubuntu with sudo
WSL (Windows Subsystem for Linux)
GitHub Actions
Commits
Files Changed
New Files
src/promptfoo/environment.py(344 lines) - Environment detection with WSL and derivative distro supportsrc/promptfoo/instructions.py(430 lines) - Platform-specific instructions with official recommendationstests/test_environment.py(352 lines) - Environment detection tests including WSL and derivativestests/test_instructions.py(416 lines) - Instruction generation tests including WSLModified Files
src/promptfoo/cli.py- Updatedprint_installation_help()to use new detectiontests/test_cli.py- Updated test to be platform-agnosticBenefits
🤖 Generated with Claude Code