Switched installer to upstream 'laravel/prompts' with fork-parity patch.#2497
Switched installer to upstream 'laravel/prompts' with fork-parity patch.#2497AlexSkrypnyk wants to merge 2 commits into
Conversation
WalkthroughThis PR integrates a patch to ChangesLaravel Prompts Fork-Parity Patch
🎯 3 (Moderate) | ⏱️ ~25 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.vortex/installer/CLAUDE.md:
- Line 237: The current cleanup step that contains the command 'rm -f
~/Library/Caches/composer/patches/*.patch' only targets macOS; update that line
to be cross-platform by also removing patches from the Linux Composer cache
(e.g., ~/.cache/composer/patches) or, better, use a portable fallback that
expands XDG_CACHE_HOME (e.g., remove from
${XDG_CACHE_HOME:-$HOME/.cache}/composer/patches in addition to the macOS
cache), so the step deletes stale patch files on both macOS and Linux.
In @.vortex/installer/patches/laravel-prompts-fork-parity.patch:
- Around line 334-336: Clamp the computed wrap width before calling mbWordwrap:
after computing $targetWidth (from $calculateContentWidth() or
$this->calculateDescriptionWidth($prompt, $maxWidth)) ensure you limit it to the
terminal max by setting it to the minimum of the computed value and $maxWidth
(and optionally floor to at least 1) so that the call to
$this->mbWordwrap($prompt->description, $targetWidth, PHP_EOL) cannot exceed the
box width; update the block that computes $targetWidth and then calls mbWordwrap
accordingly, referencing calculateDescriptionWidth, $calculateContentWidth,
$maxWidth, $targetWidth and mbWordwrap.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 2bf313b8-a199-49b2-9b3a-6b456e355193
⛔ Files ignored due to path filters (1)
.vortex/installer/composer.lockis excluded by!**/*.lock
📒 Files selected for processing (5)
.vortex/installer/CLAUDE.md.vortex/installer/composer.json.vortex/installer/patches.lock.json.vortex/installer/patches/laravel-prompts-fork-parity.patch.vortex/installer/patches/reroot-patch.php
| /tmp/prompts-fork/ | ||
|
|
||
| # 5. Refresh the lockfile and re-apply. | ||
| rm -f ~/Library/Caches/composer/patches/*.patch # macOS cache path |
There was a problem hiding this comment.
Make cache cleanup step cross-platform.
Line 237 hardcodes the macOS Composer cache path, so Linux contributors may skip stale patch cleanup unintentionally. Add Linux path (or a portable alternative) in the same step.
Suggested doc tweak
- rm -f ~/Library/Caches/composer/patches/*.patch # macOS cache path
+ rm -f ~/Library/Caches/composer/patches/*.patch # macOS cache path
+ rm -f ~/.cache/composer/patches/*.patch # Linux cache path📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| rm -f ~/Library/Caches/composer/patches/*.patch # macOS cache path | |
| rm -f ~/Library/Caches/composer/patches/*.patch # macOS cache path | |
| rm -f ~/.cache/composer/patches/*.patch # Linux cache path |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.vortex/installer/CLAUDE.md at line 237, The current cleanup step that
contains the command 'rm -f ~/Library/Caches/composer/patches/*.patch' only
targets macOS; update that line to be cross-platform by also removing patches
from the Linux Composer cache (e.g., ~/.cache/composer/patches) or, better, use
a portable fallback that expands XDG_CACHE_HOME (e.g., remove from
${XDG_CACHE_HOME:-$HOME/.cache}/composer/patches in addition to the macOS
cache), so the step deletes stale patch files on both macOS and Linux.
| + $targetWidth = $calculateContentWidth ? $calculateContentWidth() : $this->calculateDescriptionWidth($prompt, $maxWidth); | ||
| + | ||
| + return $this->mbWordwrap($prompt->description, $targetWidth, PHP_EOL); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Inspect description-width computations that may exceed max width.
rg -n -C2 'calculateDescriptionWidth|return max\(\$this->minWidth|mbWordwrap\(\$prompt->description' .vortex/installer/patches/laravel-prompts-fork-parity.patchRepository: drevops/vortex
Length of output: 29257
Clamp description wrap width to prevent layout overflow.
Several calculateDescriptionWidth() implementations return values without clamping to $maxWidth (e.g., MultiSearchPrompt, MultiSelectPrompt, SearchPrompt, SelectPrompt). When these widths are passed directly to mbWordwrap() on line 336, they can exceed the terminal box width. Add clamping on line 334:
$targetWidth = $calculateContentWidth ? $calculateContentWidth() : $this->calculateDescriptionWidth($prompt, $maxWidth);
+$targetWidth = max(1, min($targetWidth, $maxWidth));📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| + $targetWidth = $calculateContentWidth ? $calculateContentWidth() : $this->calculateDescriptionWidth($prompt, $maxWidth); | |
| + | |
| + return $this->mbWordwrap($prompt->description, $targetWidth, PHP_EOL); | |
| $targetWidth = $calculateContentWidth ? $calculateContentWidth() : $this->calculateDescriptionWidth($prompt, $maxWidth); | |
| $targetWidth = max(1, min($targetWidth, $maxWidth)); | |
| return $this->mbWordwrap($prompt->description, $targetWidth, PHP_EOL); |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.vortex/installer/patches/laravel-prompts-fork-parity.patch around lines 334
- 336, Clamp the computed wrap width before calling mbWordwrap: after computing
$targetWidth (from $calculateContentWidth() or
$this->calculateDescriptionWidth($prompt, $maxWidth)) ensure you limit it to the
terminal max by setting it to the minimum of the computed value and $maxWidth
(and optionally floor to at least 1) so that the call to
$this->mbWordwrap($prompt->description, $targetWidth, PHP_EOL) cannot exceed the
box width; update the block that computes $targetWidth and then calls mbWordwrap
accordingly, referencing calculateDescriptionWidth, $calculateContentWidth,
$maxWidth, $targetWidth and mbWordwrap.
|
Code coverage (threshold: 90%) Per-class coverage |
This comment has been minimized.
This comment has been minimized.
2 similar comments
This comment has been minimized.
This comment has been minimized.
|
Code coverage (threshold: 90%) Per-class coverage |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2497 +/- ##
==========================================
- Coverage 79.97% 79.51% -0.46%
==========================================
Files 129 122 -7
Lines 6895 6736 -159
Branches 47 3 -44
==========================================
- Hits 5514 5356 -158
+ Misses 1381 1380 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
Switches the installer's
laravel/promptsdependency from theAlexSkrypnyk/promptsfork (resolved via a customrepositoriesVCS block) to the canonical package on Packagist, with the fork's three load-bearing customizations re-applied via a singlecweagans/composer-patchesv2 patch. The fork was a maintenance burden - every upstream version bump required waiting for the fork's release schedule before the installer could move to the new tag.Changes
composer.jsonrepositoriesVCS block that overrodelaravel/promptsresolution togithub.com/AlexSkrypnyk/prompts.git.^0.3.14to^0.3.18(current upstream).extra.patchesblock registeringpatches/laravel-prompts-fork-parity.patchforlaravel/prompts.composer.locklaravel/promptsnow resolves fromgithub.com/laravel/prompts.gitat v0.3.18 (canonical Packagist).github.com/AlexSkrypnyk/prompts.gitat v0.3.14.patches/laravel-prompts-fork-parity.patch(new, 1317 lines)Restores three behaviors that the installer depends on:
descriptionfield on every Prompt class and renderer - added via a newRendersDescriptiontrait.PromptManager::runPrompts()threads$handler->description($responses)into$args['description']for every handler that returns a non-null description.Prompt::validateUsing(?Closure $callback)acceptsnull- allowsTuiTrait::tuiTeardown()to clear the static validator between tests.validateUsingcallback runs before the instancevalidateclosure and receives$value-TuiTrait::tuiSetUp()uses this to intercept every prompt's validation and throwRuntimeExceptionon failure, so non-interactive tests fail fast instead of hanging.Also carries a minor
Concerns/TypedValue.phptruthy-check tweak (strlen($default) > 0to!empty($default)) from the fork'smainfor byte-for-byte parity.Two of the three behaviors have open upstream PRs: laravel/prompts#200 (description support) and laravel/prompts#186 (static validator precedence). If either lands upstream, the corresponding hunk can be dropped from the patch on the next bump.
patches/reroot-patch.php(new)Helper script that converts
diff -ruNabsolute paths (e.g./tmp/prompts-upstream/src/Foo.php) intoa/src/Foo.php/b/src/Foo.phpform suitable forcomposer-patches, and strips timestamps. Used on every re-roll.patches.lock.jsonRegenerated by
composer-patchesto include the new patch entry with its SHA-256 checksum..vortex/installer/CLAUDE.mdAdded a
## Patchessection documenting:laravel/promptsbump, since the description trait touches renderers that change frequently).Before / After
Summary by CodeRabbit
New Features
Enhancements
Chores