From b780b5ff2c634162e9df781bba4386df112e18d9 Mon Sep 17 00:00:00 2001 From: Rebecca Hum Date: Tue, 19 May 2026 14:54:06 -0600 Subject: [PATCH 1/7] dev-env create: Update PHP 8.3 as the recommended --- src/lib/constants/dev-environment.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/constants/dev-environment.ts b/src/lib/constants/dev-environment.ts index f99c18b0c..eeaff7a2d 100644 --- a/src/lib/constants/dev-environment.ts +++ b/src/lib/constants/dev-environment.ts @@ -28,13 +28,13 @@ interface PhpImage { } export const DEV_ENVIRONMENT_PHP_VERSIONS: Record< string, PhpImage > = { - 8.2: { - image: 'ghcr.io/automattic/vip-container-images/php-fpm:8.2', - label: '8.2 (recommended)', - }, 8.3: { image: 'ghcr.io/automattic/vip-container-images/php-fpm:8.3', - label: '8.3', + label: '8.3 (recommended)', + }, + 8.2: { + image: 'ghcr.io/automattic/vip-container-images/php-fpm:8.2', + label: '8.2', }, 8.4: { image: 'ghcr.io/automattic/vip-container-images/php-fpm:8.4', From acb729de7a6c25ec0d4e1d2a1bf109e5883bae6f Mon Sep 17 00:00:00 2001 From: Rebecca Hum Date: Tue, 19 May 2026 15:00:50 -0600 Subject: [PATCH 2/7] address feedback --- src/bin/vip-dev-env-update.js | 3 ++- src/lib/constants/dev-environment.ts | 12 +++++++----- src/lib/dev-environment/dev-environment-cli.ts | 7 ++++++- src/lib/dev-environment/dev-environment-core.ts | 3 ++- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/bin/vip-dev-env-update.js b/src/bin/vip-dev-env-update.js index 2c6085f83..9080cb134 100755 --- a/src/bin/vip-dev-env-update.js +++ b/src/bin/vip-dev-env-update.js @@ -6,6 +6,7 @@ import debugLib from 'debug'; import command from '../lib/cli/command'; import { DEV_ENVIRONMENT_NOT_FOUND, + DEV_ENVIRONMENT_DEFAULT_PHP_VERSION, DEV_ENVIRONMENT_PHP_VERSIONS, } from '../lib/constants/dev-environment'; import { @@ -109,7 +110,7 @@ cmd.argv( process.argv, async ( arg, opt ) => { elasticsearch: currentInstanceData.elasticsearch, php: currentInstanceData.php || - DEV_ENVIRONMENT_PHP_VERSIONS[ Object.keys( DEV_ENVIRONMENT_PHP_VERSIONS )[ 0 ] ].image, + DEV_ENVIRONMENT_PHP_VERSIONS[ DEV_ENVIRONMENT_DEFAULT_PHP_VERSION ].image, mariadb: currentInstanceData.mariadb, phpmyadmin: currentInstanceData.phpmyadmin, xdebug: currentInstanceData.xdebug, diff --git a/src/lib/constants/dev-environment.ts b/src/lib/constants/dev-environment.ts index eeaff7a2d..6b4a44a60 100644 --- a/src/lib/constants/dev-environment.ts +++ b/src/lib/constants/dev-environment.ts @@ -27,15 +27,17 @@ interface PhpImage { label: string; } +export const DEV_ENVIRONMENT_DEFAULT_PHP_VERSION = '8.3' as const; + export const DEV_ENVIRONMENT_PHP_VERSIONS: Record< string, PhpImage > = { - 8.3: { - image: 'ghcr.io/automattic/vip-container-images/php-fpm:8.3', - label: '8.3 (recommended)', - }, 8.2: { image: 'ghcr.io/automattic/vip-container-images/php-fpm:8.2', label: '8.2', }, + 8.3: { + image: 'ghcr.io/automattic/vip-container-images/php-fpm:8.3', + label: '8.3', + }, 8.4: { image: 'ghcr.io/automattic/vip-container-images/php-fpm:8.4', label: '8.4', @@ -49,7 +51,7 @@ export const DEV_ENVIRONMENT_PHP_VERSIONS: Record< string, PhpImage > = { export const DEV_ENVIRONMENT_DEFAULTS = { title: 'VIP Dev', multisite: false, - phpVersion: Object.keys( DEV_ENVIRONMENT_PHP_VERSIONS )[ 0 ], + phpVersion: DEV_ENVIRONMENT_DEFAULT_PHP_VERSION, } as const; export const DEV_ENVIRONMENT_VERSION = '2.3.3'; diff --git a/src/lib/dev-environment/dev-environment-cli.ts b/src/lib/dev-environment/dev-environment-cli.ts index af46f1287..b766c1eae 100644 --- a/src/lib/dev-environment/dev-environment-cli.ts +++ b/src/lib/dev-environment/dev-environment-cli.ts @@ -23,6 +23,7 @@ import { Args } from '../cli/command'; import { DEV_ENVIRONMENT_FULL_COMMAND, DEV_ENVIRONMENT_DEFAULTS, + DEV_ENVIRONMENT_DEFAULT_PHP_VERSION, DEV_ENVIRONMENT_PROMPT_INTRO, DEV_ENVIRONMENT_COMPONENTS, DEV_ENVIRONMENT_NOT_FOUND, @@ -799,7 +800,11 @@ export async function promptForPhpVersion( initialValue: string ): Promise< stri const choices = []; Object.keys( DEV_ENVIRONMENT_PHP_VERSIONS ).forEach( version => { const phpImage = DEV_ENVIRONMENT_PHP_VERSIONS[ version ]; - choices.push( { message: phpImage.label, value: version } ); + const label = + version === DEV_ENVIRONMENT_DEFAULT_PHP_VERSION + ? `${ phpImage.label } (recommended)` + : phpImage.label; + choices.push( { message: label, value: version } ); } ); const images = Object.values( DEV_ENVIRONMENT_PHP_VERSIONS ); let initial = images.findIndex( version => version.image === initialValue ); diff --git a/src/lib/dev-environment/dev-environment-core.ts b/src/lib/dev-environment/dev-environment-core.ts index 25d46564e..26a6e113a 100644 --- a/src/lib/dev-environment/dev-environment-core.ts +++ b/src/lib/dev-environment/dev-environment-core.ts @@ -42,6 +42,7 @@ import { DEV_ENVIRONMENT_WORDPRESS_CACHE_KEY, DEV_ENVIRONMENT_WORDPRESS_VERSION_TTL, DEV_ENVIRONMENT_PHP_VERSIONS, + DEV_ENVIRONMENT_DEFAULT_PHP_VERSION, DEV_ENVIRONMENT_VERSION, } from '../constants/dev-environment'; import { createProxyAgent } from '../http/proxy-agent'; @@ -322,7 +323,7 @@ function preProcessInstanceData( instanceData: InstanceData ): Required< Instanc elasticsearch: instanceData.elasticsearch || false, // NOSONAR php: instanceData.php ?? - DEV_ENVIRONMENT_PHP_VERSIONS[ Object.keys( DEV_ENVIRONMENT_PHP_VERSIONS )[ 0 ] ].image, + DEV_ENVIRONMENT_PHP_VERSIONS[ DEV_ENVIRONMENT_DEFAULT_PHP_VERSION ].image, xdebug: Boolean( instanceData.xdebug ), phpmyadmin: Boolean( instanceData.phpmyadmin ), photon: Boolean( instanceData.photon ), From c382fe13f98aff0fef7228fd118475bd4e1d05fb Mon Sep 17 00:00:00 2001 From: Rebecca Hum Date: Tue, 19 May 2026 15:08:26 -0600 Subject: [PATCH 3/7] fix tests --- __tests__/devenv-e2e/001-create.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tests__/devenv-e2e/001-create.spec.js b/__tests__/devenv-e2e/001-create.spec.js index 90f4ba2c9..a9f0a3aac 100644 --- a/__tests__/devenv-e2e/001-create.spec.js +++ b/__tests__/devenv-e2e/001-create.spec.js @@ -68,7 +68,7 @@ describe( 'vip dev-env create', () => { it( 'should use sane defaults', async () => { const slug = getProjectSlug(); const expectedMultisite = false; - const expectedPhpVersion = '8.2'; + const expectedPhpVersion = '8.3'; const expectedElasticsearch = false; const expectedPhpMyAdmin = false; const expectedXDebug = false; From d13ce08ea83d3b23ddbedf74ed798cda24060540 Mon Sep 17 00:00:00 2001 From: Rebecca Hum Date: Tue, 19 May 2026 15:13:44 -0600 Subject: [PATCH 4/7] feedback --- src/lib/constants/dev-environment.ts | 16 ++++++++-------- src/lib/dev-environment/dev-environment-cli.ts | 7 +++++-- src/lib/dev-environment/dev-environment-core.ts | 3 +-- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/lib/constants/dev-environment.ts b/src/lib/constants/dev-environment.ts index 6b4a44a60..8c25c56cf 100644 --- a/src/lib/constants/dev-environment.ts +++ b/src/lib/constants/dev-environment.ts @@ -27,26 +27,26 @@ interface PhpImage { label: string; } -export const DEV_ENVIRONMENT_DEFAULT_PHP_VERSION = '8.3' as const; - -export const DEV_ENVIRONMENT_PHP_VERSIONS: Record< string, PhpImage > = { - 8.2: { +export const DEV_ENVIRONMENT_PHP_VERSIONS = { + '8.2': { image: 'ghcr.io/automattic/vip-container-images/php-fpm:8.2', label: '8.2', }, - 8.3: { + '8.3': { image: 'ghcr.io/automattic/vip-container-images/php-fpm:8.3', label: '8.3', }, - 8.4: { + '8.4': { image: 'ghcr.io/automattic/vip-container-images/php-fpm:8.4', label: '8.4', }, - 8.5: { + '8.5': { image: 'ghcr.io/automattic/vip-container-images/php-fpm:8.5', label: '8.5 (experimental)', }, -} as const; +} as const satisfies Record< string, PhpImage >; + +export const DEV_ENVIRONMENT_DEFAULT_PHP_VERSION: keyof typeof DEV_ENVIRONMENT_PHP_VERSIONS = '8.3'; export const DEV_ENVIRONMENT_DEFAULTS = { title: 'VIP Dev', diff --git a/src/lib/dev-environment/dev-environment-cli.ts b/src/lib/dev-environment/dev-environment-cli.ts index b766c1eae..05eb8bd05 100644 --- a/src/lib/dev-environment/dev-environment-cli.ts +++ b/src/lib/dev-environment/dev-environment-cli.ts @@ -785,7 +785,8 @@ export function resolvePhpVersion( version: string ): string { throw new UserError( `Unknown or unsupported PHP version: ${ version }.` ); } } else { - result = DEV_ENVIRONMENT_PHP_VERSIONS[ version ].image; + result = + DEV_ENVIRONMENT_PHP_VERSIONS[ version as keyof typeof DEV_ENVIRONMENT_PHP_VERSIONS ].image; } debug( 'Resolved PHP image: %j', result ); @@ -798,7 +799,9 @@ export async function promptForPhpVersion( initialValue: string ): Promise< stri let answer = initialValue; if ( isStdinTTY ) { const choices = []; - Object.keys( DEV_ENVIRONMENT_PHP_VERSIONS ).forEach( version => { + ( + Object.keys( DEV_ENVIRONMENT_PHP_VERSIONS ) as ( keyof typeof DEV_ENVIRONMENT_PHP_VERSIONS )[] + ).forEach( version => { const phpImage = DEV_ENVIRONMENT_PHP_VERSIONS[ version ]; const label = version === DEV_ENVIRONMENT_DEFAULT_PHP_VERSION diff --git a/src/lib/dev-environment/dev-environment-core.ts b/src/lib/dev-environment/dev-environment-core.ts index 26a6e113a..8982265a7 100644 --- a/src/lib/dev-environment/dev-environment-core.ts +++ b/src/lib/dev-environment/dev-environment-core.ts @@ -322,8 +322,7 @@ function preProcessInstanceData( instanceData: InstanceData ): Required< Instanc mariadb: instanceData.mariadb ?? '', elasticsearch: instanceData.elasticsearch || false, // NOSONAR php: - instanceData.php ?? - DEV_ENVIRONMENT_PHP_VERSIONS[ DEV_ENVIRONMENT_DEFAULT_PHP_VERSION ].image, + instanceData.php ?? DEV_ENVIRONMENT_PHP_VERSIONS[ DEV_ENVIRONMENT_DEFAULT_PHP_VERSION ].image, xdebug: Boolean( instanceData.xdebug ), phpmyadmin: Boolean( instanceData.phpmyadmin ), photon: Boolean( instanceData.photon ), From 933ee03608b0b0010737dafe9c1c70cedaedb842 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 19 May 2026 21:35:54 +0000 Subject: [PATCH 5/7] fix dev-env PHP version guard Agent-Logs-Url: https://github.com/Automattic/vip-cli/sessions/747814a4-7b7c-47c4-a84c-5abd7d4a0c1b Co-authored-by: rebeccahum <16962021+rebeccahum@users.noreply.github.com> --- .../lib/dev-environment/dev-environment-cli.js | 17 +++++++++-------- src/lib/dev-environment/dev-environment-cli.ts | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/__tests__/lib/dev-environment/dev-environment-cli.js b/__tests__/lib/dev-environment/dev-environment-cli.js index 0e28e12af..d91867225 100644 --- a/__tests__/lib/dev-environment/dev-environment-cli.js +++ b/__tests__/lib/dev-environment/dev-environment-cli.js @@ -594,13 +594,14 @@ describe( 'lib/dev-environment/dev-environment-cli', () => { expect( actual ).toStrictEqual( expected ); } ); - it.each( [ [ '7.4' ], [ 'ghcr.io/automattic/vip-container-images/php-fpm-ubuntu:7.3' ] ] )( - 'should throw an error for invalid version', - async version => { - expect( () => resolvePhpVersion( version ) ).toThrow( - `Unknown or unsupported PHP version: ${ version }` - ); - } - ); + it.each( [ + [ '7.4' ], + [ 'ghcr.io/automattic/vip-container-images/php-fpm-ubuntu:7.3' ], + [ 'toString' ], + ] )( 'should throw an error for invalid version', async version => { + expect( () => resolvePhpVersion( version ) ).toThrow( + `Unknown or unsupported PHP version: ${ version }` + ); + } ); } ); } ); diff --git a/src/lib/dev-environment/dev-environment-cli.ts b/src/lib/dev-environment/dev-environment-cli.ts index 05eb8bd05..2b57edcf7 100644 --- a/src/lib/dev-environment/dev-environment-cli.ts +++ b/src/lib/dev-environment/dev-environment-cli.ts @@ -776,7 +776,7 @@ export function resolvePhpVersion( version: string ): string { debug( `Resolving PHP version %j`, version ); let result: string; - if ( ! ( version in DEV_ENVIRONMENT_PHP_VERSIONS ) ) { + if ( ! Object.prototype.hasOwnProperty.call( DEV_ENVIRONMENT_PHP_VERSIONS, version ) ) { const images = Object.values( DEV_ENVIRONMENT_PHP_VERSIONS ); const image = images.find( value => value.image === version ); if ( image ) { From d52adc4860aca9c56162bffba35a115685c9c7d7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 19 May 2026 21:37:16 +0000 Subject: [PATCH 6/7] refine PHP version own check Agent-Logs-Url: https://github.com/Automattic/vip-cli/sessions/747814a4-7b7c-47c4-a84c-5abd7d4a0c1b Co-authored-by: rebeccahum <16962021+rebeccahum@users.noreply.github.com> --- src/lib/dev-environment/dev-environment-cli.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/dev-environment/dev-environment-cli.ts b/src/lib/dev-environment/dev-environment-cli.ts index 2b57edcf7..bfe136b6e 100644 --- a/src/lib/dev-environment/dev-environment-cli.ts +++ b/src/lib/dev-environment/dev-environment-cli.ts @@ -776,7 +776,7 @@ export function resolvePhpVersion( version: string ): string { debug( `Resolving PHP version %j`, version ); let result: string; - if ( ! Object.prototype.hasOwnProperty.call( DEV_ENVIRONMENT_PHP_VERSIONS, version ) ) { + if ( ! Object.hasOwn( DEV_ENVIRONMENT_PHP_VERSIONS, version ) ) { const images = Object.values( DEV_ENVIRONMENT_PHP_VERSIONS ); const image = images.find( value => value.image === version ); if ( image ) { From 2618c77cc5fa7ca71b2319f7dfe4bccca29bb398 Mon Sep 17 00:00:00 2001 From: Rebecca Hum Date: Tue, 19 May 2026 15:47:40 -0600 Subject: [PATCH 7/7] 8.4 NOW --- __tests__/devenv-e2e/001-create.spec.js | 2 +- src/lib/constants/dev-environment.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/__tests__/devenv-e2e/001-create.spec.js b/__tests__/devenv-e2e/001-create.spec.js index a9f0a3aac..6530ccafb 100644 --- a/__tests__/devenv-e2e/001-create.spec.js +++ b/__tests__/devenv-e2e/001-create.spec.js @@ -68,7 +68,7 @@ describe( 'vip dev-env create', () => { it( 'should use sane defaults', async () => { const slug = getProjectSlug(); const expectedMultisite = false; - const expectedPhpVersion = '8.3'; + const expectedPhpVersion = '8.4'; const expectedElasticsearch = false; const expectedPhpMyAdmin = false; const expectedXDebug = false; diff --git a/src/lib/constants/dev-environment.ts b/src/lib/constants/dev-environment.ts index 8c25c56cf..ce9721dea 100644 --- a/src/lib/constants/dev-environment.ts +++ b/src/lib/constants/dev-environment.ts @@ -46,7 +46,7 @@ export const DEV_ENVIRONMENT_PHP_VERSIONS = { }, } as const satisfies Record< string, PhpImage >; -export const DEV_ENVIRONMENT_DEFAULT_PHP_VERSION: keyof typeof DEV_ENVIRONMENT_PHP_VERSIONS = '8.3'; +export const DEV_ENVIRONMENT_DEFAULT_PHP_VERSION: keyof typeof DEV_ENVIRONMENT_PHP_VERSIONS = '8.4'; export const DEV_ENVIRONMENT_DEFAULTS = { title: 'VIP Dev',