Skip to content

Auto-install missing PHP version during pv link#38

Merged
munezaclovis merged 3 commits intomainfrom
feature/auto-install-php-version
Mar 10, 2026
Merged

Auto-install missing PHP version during pv link#38
munezaclovis merged 3 commits intomainfrom
feature/auto-install-php-version

Conversation

@munezaclovis
Copy link
Copy Markdown
Contributor

Summary

  • Adds install_php_version automation setting (default: true) to control whether pv link auto-installs a missing PHP version
  • When pv link resolves a PHP version (from pv.yml or composer.json) that isn't installed, it now installs it automatically, prompts, or warns based on the setting
  • Adds the setting to the setup wizard as "Auto install missing PHP version" and to the automation gate system

How it works

After version resolution in pv link, if the resolved PHP version differs from the global default and isn't installed:

Setting Behavior
true (default) Auto-installs via php:install
ask Prompts with huh confirm (skips in non-interactive mode)
false Warns and continues linking

If installation fails, linking is aborted. If the user declines or the setting is off, linking continues with a warning.

Motivation

Previously, linking a project with an uninstalled PHP version succeeded silently, and the failure only surfaced as a 502 Bad Gateway when visiting the site. This change catches it at link time — the natural moment to bootstrap project dependencies. This also lays the groundwork for a richer pv link / pv init that fully bootstraps from pv.yml.

Test plan

  • go vet ./... passes clean
  • gofmt -l . reports no issues
  • Full test suite passes (go test ./...)
  • New tests: TestDefaultSettings_HasInstallPHPVersion, TestLookupGate_InstallPHPVersion, TestLink_SkipsInstallWhenVersionIsGlobal
  • Manual: pv link on a project with pv.yml specifying an uninstalled version triggers install
  • Manual: Set install_php_version: ask in ~/.pv/pv.yml, verify prompt appears
  • Manual: Set install_php_version: "false", verify warning is shown but link succeeds

- Switch from default to explicit config.AutoOn case for safety
- Add TestLink_AutoOffWarnsButLinksWithMissingVersion
- Add TestLink_SkipsInstallWhenNonGlobalVersionIsInstalled
@munezaclovis munezaclovis merged commit 8fa2aec into main Mar 10, 2026
1 check passed
@munezaclovis munezaclovis deleted the feature/auto-install-php-version branch March 10, 2026 14:43
munezaclovis added a commit that referenced this pull request Mar 25, 2026
- #16 (setup TUI off-by-one): cursor bound is correct, max = len+1
- #19 (StartBackgroundUpdater): IS called from server.Start()
- #38 (updateSymlinks divergence): SetGlobal saves before calling,
  paths always agree
- #39 (frankenphp logFile leak): struct only built after Start()
  succeeds, Process is always non-nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant