Repository navigation
feat: move the CLI prompts into a Prompt class - #10655
Open
paulbalandan wants to merge 1 commit into
Open
paulbalandan wants to merge 1 commit into
paulbalandan wants to merge 1 commit into
Conversation
Member
|
@paulbalandan, feel free to ping me if you have anything you would like me to review with Copilot. |
Member
Author
I'm not sure what happened, but I still have some AI credits left 😅 |
paulbalandan
force-pushed
the
cli-prompt
branch
from
October 23, 2026 10:52
30c4a77 to
45a7282
Compare
This branch has not been deployed
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.

Description
Follow-up to #10628 and #10643. The output already lives in instance classes, and this moves the prompts there too.
CodeIgniter\CLI\Promptis built on anOutput, and reads and writes only through it. It hasask(),askByKey()andaskByMultipleKeys(), which hold the old logic and are fully typed.single_service('validation'), created only when a prompt has rules.CLI::prompt(),promptByKey()andpromptByMultipleKeys()delegate to it, and their signatures are unchanged.CLI::getPrompt()andAbstractCommand::getPrompt()return aPrompton the shared output and on the run's output.AbstractCommand::getPrompt()is overridable. The prompts for missing arguments and the generators' confirmation go through it, so aPromptsubclass answers those too.askByMultipleKeys()has the missing-key fix from fix: reject missing keys inCLI::promptByMultipleKeys()#10654. An answer must name existing keys, not merely keys no larger than the last one.Behaviour changes, listed in the changelog and the upgrade guide:
CLIsubclass overridingvalidate()no longer affects the prompts. ExtendPromptand override itsvalidate()instead.CLI::prompt()no longer affectspromptByKey()orpromptByMultipleKeys().$options, or apromptByKey()text of the wrong type now throw aTypeError.CLI::validate()is deprecated and triggers a deprecation notice.Checklist: