Skip to content

Conversation

@dermatz
Copy link
Collaborator

@dermatz dermatz commented Sep 16, 2025

This pull request introduces enhanced and secure handling of environment variables, especially for interactive theme selection in the BuildCommand. It adds robust checks for interactive terminal support, safely manages environment variables without direct superglobal access, and improves compatibility with CI and containerized environments.

Environment variable and terminal handling improvements:

  • Added secure methods for getting, setting, and sanitizing environment variables, avoiding direct use of PHP superglobals and deprecated functions. This includes methods like getEnvVar, setEnvVar, and sanitizeEnvironmentValue, as well as a secure in-memory cache (secureEnvStorage).
  • Implemented detection of interactive terminal environments with isInteractiveTerminal, checking for CI variables and TTY support to determine if prompts should be shown.
  • Added logic to set and reset terminal environment variables (COLUMNS, LINES, TERM) before and after running interactive prompts, ensuring compatibility with Docker/DDEV and Laravel Prompts.
  • Provided fallback and error handling for non-interactive or failed prompt scenarios, displaying available themes instead of prompting.

Class structure updates:

  • Introduced new class properties (originalEnv, secureEnvStorage) to manage environment state securely during command execution.
image

Copilot AI review requested due to automatic review settings September 16, 2025 12:55
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 enhances the theme selection process in the BuildCommand by improving terminal compatibility and error handling for interactive prompts. The changes focus on making the command more robust in various terminal environments and providing better fallback mechanisms.

Key changes:

  • Added TTY detection to gracefully handle non-interactive environments
  • Enhanced terminal compatibility with environment variable settings and output buffer management
  • Improved error handling with try-catch blocks around interactive prompts

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@dermatz dermatz enabled auto-merge (squash) September 16, 2025 12:57
@dermatz dermatz requested a review from Morgy93 September 16, 2025 13:25
@dermatz dermatz merged commit 326a6dd into main Sep 16, 2025
9 checks passed
@dermatz dermatz deleted the fix/MultiSelectPrompt branch September 16, 2025 14:32
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