Skip to content

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

Closed
orochaa wants to merge 1 commit into
bombshell-dev:mainfrom
orochaa:builder
Closed

feat(@clack/prompts): add prompt workflow#139
orochaa wants to merge 1 commit into
bombshell-dev:mainfrom
orochaa:builder

Conversation

@orochaa

@orochaa orochaa commented Aug 11, 2023

Copy link
Copy Markdown
Contributor

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

changeset-bot Bot commented Aug 11, 2023

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: bc6fd8c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Comment thread .changeset/config.json
@cpreston321

Copy link
Copy Markdown
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

orochaa commented Aug 11, 2023

Copy link
Copy Markdown
Contributor Author

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

cpreston321 commented Aug 11, 2023

Copy link
Copy Markdown
Collaborator

@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

orochaa commented Aug 11, 2023

Copy link
Copy Markdown
Contributor Author

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

orochaa commented Aug 11, 2023

Copy link
Copy Markdown
Contributor Author

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
Comment thread packages/prompts/README.md Outdated
Comment thread packages/prompts/README.md
Comment thread packages/prompts/README.md
@cpreston321

Copy link
Copy Markdown
Collaborator

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

@orochaa

orochaa commented Aug 25, 2023

Copy link
Copy Markdown
Contributor Author

@cpreston321 commit included.

This helps a lot to run the examples!

@pkg-pr-new

pkg-pr-new Bot commented Jan 11, 2025

Copy link
Copy Markdown

Open in Stackblitz@example/basic@example/changesets

npm i https://pkg.pr.new/bombshell-dev/clack/@clack/core@139
npm i https://pkg.pr.new/bombshell-dev/clack/@clack/prompts@139

commit: bc6fd8c

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