Skip to content

Conversation

@rinatkhaziev
Copy link
Contributor

@rinatkhaziev rinatkhaziev commented Jan 20, 2026

Description

This PR improves logging integration with Lando, now each dev-env command run generates a single log file that combines run results both from Lando and VIP-CLI/Dev Env. At the end of command run we now show where this file is:

=== VIP Dev Env Log ===
COMMAND            /Users/rinat/.nvm/versions/node/v20.19.4/bin/vip-dev-env-info -s what-mu
OS                 darwin 25.2.0 arm64
NODE               v20.19.4
VIP-CLI            3.23.3-dev.0
DOCKER ENGINE      29.1.3
DOCKER COMPOSE     5.0.0-desktop.1
COMPOSE PLUGIN     v5.0.0-desktop.1
DOCKER BIN         /Applications/Docker.app/Contents/Resources/bin/docker
COMPOSE BIN        /usr/local/bin/docker-compose
RAM                48.0 GB
CPU                16
===

2026-01-20T20:55:09.963Z [vip-dev-env] DEBUG: Trying to retrieve from file cache with key id
2026-01-20T20:55:09.964Z [vip-dev-env] DEBUG: Trying to retrieve from file cache with key id
... omitted
vip dev-env info -s my-env
 SLUG               my-env                                                                                          
 LOCATION           /Users/rinat/.local/share/vip/dev-environment/my-env                                            
 SERVICES           nginx, php, database, memcached, phpmyadmin, elasticsearch, wordpress, mailpit                   
 NGINX URLS         http://my-env.vipdev.lndo.site/                                                                 
                    https://my-env.vipdev.lndo.site/                                                                
 PHPMYADMIN URLS    http://localhost:55724                                                                           
                    http://my-env-pma.vipdev.lndo.site/                                                             
                    https://my-env-pma.vipdev.lndo.site/                                                            
 MAILPIT URLS       http://my-env-mailpit.vipdev.lndo.site/                                                         
                    https://my-env-mailpit.vipdev.lndo.site/                                                        
 ENTERPRISE SEARCH  http://127.0.0.1:55723                                                                           
 DATABASE           127.0.0.1:55722                                                                                  
 STATUS             UP                                                                                               
 LOGIN URL          http://my-env.vipdev.lndo.site/wp-admin/?vip-dev-autologin=sdadsadas-73b3-4212-9c14-1e2b86877fdc 
 DEFAULT USERNAME   vipgo                                                                                            
 DEFAULT PASSWORD   XXXXXX-6SyQV                                                                                     
 DOCUMENTATION      https://docs.wpvip.com/vip-local-development-environment/                                        
 TITLE              VIP Dev                                                                                          
 MULTISITE          false                                                                                            
 PHP                8.4                                                                                              
 XDEBUG             enabled                                                                                          
 CRON               enabled                                                                                          
 WORDPRESS          trunk                                                                                            
 MU PLUGINS         /Users/user/mu-plugins                                           
 APP CODE           /Users/user/app-code                                    

 COMMAND LOG FILE   /Users/user/.local/share/vip/lando/logs/vip-dev-env-my-env-20260120-211348.log

Needs Automattic/lando-cli#170

============

This pull request updates the npm-shrinkwrap.json file with several dependency and metadata adjustments. The most notable changes include updating the version of the lando dependency, adding new modules, and correcting or adding peer and dev flags for various dependencies to improve package resolution and compatibility

Dependency updates and additions:

  • Updated the lando dependency to a new commit hash for github:automattic/lando-cli, ensuring the project uses the latest version from the repository.
  • Added new modules: @isaacs/balanced-match and @isaacs/brace-expansion, including their versioning, integrity, and engine requirements.

Peer and dev flag corrections:

  • Added or corrected the "peer": true flag for multiple dependencies, such as @babel/core, acorn, deep-is, eslint, ajv, and others, to accurately represent peer dependency relationships and prevent npm/yarn warnings. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25]
  • Added "dev": true to several dependencies to clarify their development-only status, such as @isaacs/cliui, ansi-regex, ansi-styles, string-width, strip-ansi, wrap-ansi, @pkgjs/parseargs, eastasianwidth, and emoji-regex. [1] [2] [3] [4] [5] [6] [7] [8]

These changes help ensure that the dependency tree is accurate, up-to-date, and that package managers handle peer and dev dependencies correctly, reducing potential install-time issues and improving maintainability.

Changelog Description

Added

  • Dev Env command execution runs are now being logged in $HOME/.local/share/vip/lando/logs/

Pull request checklist

New release checklist

Steps to Test

Outline the steps to test and verify the PR here.

Example:

  1. Check out PR.
  2. Run npm run build
  3. Run ./dist/bin/vip-cookies.js nom
  4. Verify cookies are delicious.

…and in one file with consistent formatting.

  - Add dynamic dev‑env log filenames (slug + timestamp) and wire bootstrapLando({ logFile }) across all dev‑env commands.
  - Update lando dependency in vip‑cli to new fork commit.
@github-actions
Copy link
Contributor

github-actions bot commented Jan 20, 2026

Dependency Review

The following issues were found:
  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 1 package(s) with unknown licenses.
See the Details below.

License Issues

package.json

PackageVersionLicenseIssue Type
landogithub:automattic/lando-cli#8f198e0f17dec1144efa216bec5a227dfc851900NullUnknown License

OpenSSF Scorecard

PackageVersionScoreDetails
npm/lando github:automattic/lando-cli#8f198e0f17dec1144efa216bec5a227dfc851900 UnknownUnknown

Scanned Files

  • package.json

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarQube Cloud

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements unified logging for VIP Dev Env commands by integrating command execution logs with Lando. Each dev-env command now generates a timestamped log file that combines output from both Lando and VIP-CLI, stored in $HOME/.local/share/vip/lando/logs/. The log path is displayed at the end of each command execution.

Changes:

  • Added TypeScript type definitions for Lando logger enhancements including logFile, logName, and child() method
  • Implemented log file path generation with timestamp and slug formatting in dev-environment-cli.ts
  • Enhanced Lando bootstrap process with log banner generation, Docker version detection, and system information logging
  • Updated all 13 dev-env command files to pass log file configuration to bootstrapLando()
  • Updated lando dependency to commit 8f198e0f17dec1144efa216bec5a227dfc851900
  • Updated npm-shrinkwrap.json with new dependencies (@isaacs/balanced-match, @isaacs/brace-expansion) and corrected peer/dev flags

Reviewed changes

Copilot reviewed 4 out of 18 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
types/lando/lib/logger.d.ts Added type definitions for new logger options (logFile, logName, logger) and child() method
src/lib/dev-environment/dev-environment-lando.ts Implemented log file path handling, banner generation with system info, Docker version detection, and debug log redirection
src/lib/dev-environment/dev-environment-cli.ts Added utility functions for log file naming: formatDevEnvLogTimestamp, formatDevEnvLogSlug, and getDevEnvLogFile
src/commands/dev-env-import-sql.ts Updated to pass slug-specific log file to bootstrapLando
src/bin/vip-dev-env-*.js (13 files) Updated all dev-env commands to call bootstrapLando with getDevEnvLogFile for consistent logging
package.json Updated lando dependency to new commit hash
npm-shrinkwrap.json Updated dependency tree with new modules, corrected peer/dev flags, removed figlet/through/valid-url dependencies
Files not reviewed (1)
  • npm-shrinkwrap.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +957 to +968
export function formatDevEnvLogTimestamp( date: Date ): string {
return date.toISOString().replace( /\..*$/, '' ).replace( /[-:]/g, '' ).replace( 'T', '-' );
}

export function formatDevEnvLogSlug( slug: string ): string {
return slug.replace( /[^a-z0-9_-]+/gi, '-' ).toLowerCase();
}

export function getDevEnvLogFile( slug?: string ): string {
const slugPart = slug ? formatDevEnvLogSlug( slug ) : 'all';
return `vip-dev-env-${ slugPart }-${ formatDevEnvLogTimestamp( new Date() ) }.log`;
}
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The three new exported functions formatDevEnvLogTimestamp, formatDevEnvLogSlug, and getDevEnvLogFile lack test coverage. These functions handle string formatting and timestamp generation, which are important for log file naming. Consider adding unit tests to verify the expected output format, especially for formatDevEnvLogTimestamp which manipulates dates, and formatDevEnvLogSlug which sanitizes slug strings.

Copilot uses AI. Check for mistakes.
Comment on lines +179 to +183
try {
const existing = await stat( logFilePath );
if ( existing.size > 0 ) {
return;
}
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The writeLogBanner function writes to the log file only if it doesn't exist or has size 0. However, if the file exists and is empty due to a previous failed write, this check will still skip writing the banner. Consider also checking for file age or using a more robust mechanism to determine if the banner should be written, such as checking if the banner is already present in the file.

Copilot uses AI. Check for mistakes.
await mkdir( path.dirname( logFilePath ), { recursive: true } );

const dockerVersions = await getDockerVersions( config );
const command = process.argv.slice( 1 ).join( ' ' );
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function uses process.argv.slice(1).join(' ') to construct the command line, which may not properly represent arguments that contain spaces or special characters. Consider using proper shell escaping or quoting for arguments that contain spaces to ensure the logged command accurately reflects what was executed.

Suggested change
const command = process.argv.slice( 1 ).join( ' ' );
const command = process.argv.slice( 1 ).map( ( arg ) => JSON.stringify( arg ) ).join( ' ' );

Copilot uses AI. Check for mistakes.
Comment on lines +369 to +370
if ( process.env.DEBUG && ! process.env.DEBUG.includes( '-winston:*' ) ) {
process.env.DEBUG = `${ process.env.DEBUG },-winston:*`;
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DEBUG environment variable modification could interfere with user's existing debug settings. Adding -winston:* to an existing DEBUG value without checking if it's already present could result in duplicate filters. Consider checking if the filter is already present before appending it, or use a more robust approach to exclude winston logs.

Suggested change
if ( process.env.DEBUG && ! process.env.DEBUG.includes( '-winston:*' ) ) {
process.env.DEBUG = `${ process.env.DEBUG },-winston:*`;
if ( process.env.DEBUG !== undefined ) {
const debugEnv = process.env.DEBUG;
const patterns = debugEnv
.split( ',' )
.map( ( pattern ) => pattern.trim() )
.filter( ( pattern ) => pattern.length > 0 );
if ( ! patterns.includes( '-winston:*' ) ) {
patterns.push( '-winston:*' );
process.env.DEBUG = patterns.join( ',' );
}

Copilot uses AI. Check for mistakes.
Comment on lines +387 to +388
debugLib.log = ( message: string, ...args: unknown[] ) => {
lando.log.debug( message, ...args );
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overriding the global debugLib.log function affects all debug instances in the entire application, not just those related to this module. This side effect could interfere with debugging in other parts of the codebase. Consider using a more targeted approach, such as creating a child logger or wrapping the debug instance locally.

Suggested change
debugLib.log = ( message: string, ...args: unknown[] ) => {
lando.log.debug( message, ...args );
( debug as debugLib.Debugger ).log = ( ...args: unknown[] ) => {
lando.log.debug( ...args );

Copilot uses AI. Check for mistakes.
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.

3 participants