Repository navigation
Prompt through laranail/console, not laravel/prompts - #27
Merged
Merged
Conversation
The editor imported select(), text(), confirm() and SelectPrompt from laravel/prompts without declaring the package; it arrived only because laranail/console requires it. Prompts now go through console's Prompter, and the can-prompt check is console's Prompter::canPrompt(), which carries the same rule the editor had inline. The prompts, their answers and the exit 2 without a terminal are unchanged. The production editor test enables the prompt fallback through console's InteractsWithConsole::withPromptFallback() instead of Prompt directly. PromptsBoundaryTest fails if src/ uses Laravel\Prompts again: a Pest arch rule, and beside it a raw substring scan over every file under src/ that asserts how many files it read. Requires laranail/console ^0.1.7, the first release with canPrompt().
There was a problem hiding this comment.
🟢 Approval recommended
The migration preserves behavior and the only identified issue is minor comment grammar.
1 open finding
What changed in this PR
Routes editor prompts through laranail/console, removing direct reliance on laravel/prompts.
Changes:
- Migrates editor prompts and terminal checks to
Prompter. - Adds a source-boundary architecture test.
- Requires
laranail/console ^0.1.7and updates documentation.
| File | Description |
|---|---|
src/Console/EditCommand.php |
Uses the shared prompt wrapper. |
tests/Feature/TuiTest.php |
Adopts console prompt testing helpers. |
tests/Unit/PromptsBoundaryTest.php |
Guards the dependency boundary. |
docs/tools/tui.md |
Documents prompt routing. |
composer.json |
Raises the console dependency floor. |
CHANGELOG.md |
Records the migration and requirement. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What
laranail::env-kit.editprompted throughlaravel/promptsdirectly (select(),text(),confirm(), andSelectPrompt::shouldFallback()for the can-prompt check from #26) without declaring the package. It now goes through laranail/console, which wraps laravel/prompts:Laravel\Prompts)select($label, $options)Prompter::create()->select($label, $options)->getResult()text($label, required:, default:)Prompter::create()->text($label, default:, required:)->getResult()confirm($label, default: false)Prompter::create()->confirm($label, default: false)->getResult()SelectPrompt::shouldFallback()+stream_isatty(STDIN)+isInteractive()(privatecanPrompt())Prompter::canPrompt($this->input)(new in console, laranail/console#83)Prompt::fallbackWhen(true)InteractsWithConsole::withPromptFallback()(new in console, laranail/console#83)Behaviour is unchanged: the same prompts and answers, and still exit
2with the #26 message under--no-interactionor with no TTY.Guard
tests/Unit/PromptsBoundaryTest.php: a Pest arch rule (expect('Simtabi\Laranail\EnvKit\Headless')->not->toUse('Laravel\Prompts')), plus a raw substring scan over every PHP file undersrc/that asserts it read more than 100 files. Both go red when ause function Laravel\Prompts\select;import or a fully-qualified\Laravel\Prompts\info()call is added back.Release dependency: draft until console is released
This needs
Prompter::canPrompt()andwithPromptFallback(), which are only in laranail/console#83, socomposer.jsonraises the floor tolaranail/console ^0.1.7. CI on this PR is red until laranail/console#83 is on console'smain: PHPStan reportsCall to an undefined static method Prompter::canPrompt(). CI installs fine, because withminimum-stability: devconsole'sdev-main(aliased0.1.x-dev) satisfies^0.1.7, and that resolves today'smain, which does not have #83 yet. So merging #83 turns this green even before a tag. A consumer withminimum-stability: stablestill needs the tagged release, so the PR stays a draft until console cuts it. If the release gets another number, the constraint and CHANGELOG line change with it.Verified locally against the console branch through a path repository in a
$TMPDIRcopy (not committed): pest 543 passed (541 onmain, plus the 2 new tests), phpstan clean, pint (package-tools config) passed. The repo has norector.php, so rector was not run.