Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(@clack/prompts): add prompt workflow #139

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

orochaa
Copy link
Contributor

@orochaa orochaa commented Aug 11, 2023

Since Typescript has shown a limitation on infer group results, discussed in @chrissantamaria's comment on PR#102, and Issue #131. This functionality presents an alternative for users who favor the builder pattern when dealing with multiple prompts in sequence, serving as either a workaround or an additional choice, while avoid a breaking change.

This PR includes:

  • Code
  • Docs
  • Changeset
  • Example

I am open to discussions on comment's section!

Closes #131
Closes #109

@changeset-bot
Copy link

changeset-bot bot commented Aug 11, 2023

🦋 Changeset detected

Latest commit: 4365f19

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clack/prompts Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

.changeset/config.json Outdated Show resolved Hide resolved
@cpreston321
Copy link
Collaborator

Initial thoughts:

@Mist3rBru Great Work 🙏🏼 ,

I actually kinda of like this.. This could be a great addition. I'm just not for sure on the namespace builder. It almost sounds to me like a workflow. What are your thoughts?

Additional thoughts

I also think, within the next couple of releases -- I want to focus on knocking out a few bugs reported, then exposing each individual core prompt interface types to make it agnostic vs duplicating types that are already exist in core. This way someone can easily build on top of core as an agnostic layer like what we do for @clack/prompts. Then we can add another layer for themes etc.

Thanks,
CP 🚀

@orochaa
Copy link
Contributor Author

orochaa commented Aug 11, 2023

I agree, sounds more like an workflow, it could also change the add method to step.
Example:

await p.workflow()
  .step('name', () => p.text())
  .run()

@cpreston321
Copy link
Collaborator

cpreston321 commented Aug 11, 2023

@Mist3rBru I like that.

My only questions here

  1. Should we deprecate groups in favor on this ?
  2. Since this is the same functionality as group a end user might ask Which one do I use ?

@orochaa
Copy link
Contributor Author

orochaa commented Aug 11, 2023

We can release it, and open a pinned issue like v1.0.0 Roadmap, so people can give their thoughts, and we decide based on it.

@orochaa
Copy link
Contributor Author

orochaa commented Aug 11, 2023

I think it is a better API, since it does not deal with inference errors, and is more extensible.

@cpreston321 cpreston321 changed the title feat(@clack/prompts): add prompt builder feat(@clack/prompts): add prompt workflow Aug 11, 2023
@cpreston321 cpreston321 requested a review from natemoo-re August 11, 2023 16:50
@cpreston321
Copy link
Collaborator

@Mist3rBru I made some improvements to examples please check this out: de9f5b6

@orochaa
Copy link
Contributor Author

orochaa commented Aug 25, 2023

@cpreston321 commit included.

This helps a lot to run the examples!

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.

[Bug] can't infer the input type when using results in p.group [Request] logic diagram
2 participants