Refactor prompt interactions in NodeHost #679
Merged
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.
This pull request refactors the prompt interactions in the NodeHost class by consolidating the input, select, and confirm functions. This improves code organization and readability.
Refactor confirm method usage in commit and push sequence
🚀 New interactive shell features added to runtime hosts! Now users can:
select(message: string, options: string[]): Promise<string>
input(message: string): Promise<string>
confirm(message: string): Promise<boolean>
🎛️ These interactive commands are now available on the
NodeHost
runtime inpackages/cli/src/nodehost.ts
, with implementation leveraging external package@inquirer/prompts
.🚧 However, these methods are not yet implemented in the
TestHost
runtime inpackages/core/src/testhost.ts
, throwing "Method not implemented" errors.📚 Interfaces for
ShellSelectOptions
,ShellSelectChoice
,ShellInputOptions
, andShellConfirmOptions
have been added topackages/core/src/types/prompt_template.d.ts
, which defines the public API.🎬 Not only runtime hosts, these interactive features are expected in the
PromptContext
as well inpackages/core/src/promptcontext.ts
.💼 Three new utility functions in
packages/cli/src/input.ts
have been added to handle these interactive operations. Features are:Overall, these changes enhance interactivity and provide a more interactive CLI experience for users! 🎉👏