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

AI template prompt is repeated on Windows #14973

Closed
AaronFriel opened this issue Dec 20, 2023 · 1 comment · Fixed by #15010
Closed

AI template prompt is repeated on Windows #14973

AaronFriel opened this issue Dec 20, 2023 · 1 comment · Fixed by #15010
Assignees
Labels
area/cli UX of using the CLI (args, output, logs) kind/bug Some behavior is incorrect or out of spec p1 A bug severe enough to be the next item assigned to an engineer resolution/fixed This issue was fixed

Comments

@AaronFriel
Copy link
Member

AaronFriel commented Dec 20, 2023

When using pulumi new with AI generated templates, the question and response for the prompt is repeated back to the user on Windows:

> pulumi.exe new
Would you like to create a project from a template or using a Pulumi AI prompt? ai
Please select a language for your project: JavaScript
? Please input your prompt here ("a static website on AWS behind a CDN"):
  an s3 bucket
? Please input your prompt here ("a static website on AWS behind a CDN"):
  an s3 bucket

The user is only asked the one time, the repetition appears to be a bug in Survey. Shortly after pressing enter the AI generated template is rendered to the user, with no impact on the functionality of the command.

@AaronFriel AaronFriel added kind/bug Some behavior is incorrect or out of spec area/cli UX of using the CLI (args, output, logs) p1 A bug severe enough to be the next item assigned to an engineer needs-triage Needs attention from the triage team labels Dec 20, 2023
@AaronFriel
Copy link
Member Author

@justinvp this looks like a known issue with Survey, I wouldn't be surprised if we've run into it ourselves. The fix will definitely be to replace survey in this instance. We discussed changing the prompt function, adding an option to go to put the user's response on a new line.

See:

@AaronFriel AaronFriel self-assigned this Dec 21, 2023
@justinvp justinvp removed the needs-triage Needs attention from the triage team label Dec 23, 2023
AaronFriel added a commit that referenced this issue Dec 27, 2023
Switches the prompt to use the `promptForValue` function, which now accepts an
empty type descriptor. This renders to the user as:

```console
$ pulumi new
 Would you like to create a project from a template or using a Pulumi AI prompt? ai
 Please select a language for your project: TypeScript
What cloud infrastructure would you like to build?
(try something like \"a static website on AWS behind a CDN\")
> an eks cluster
Sending prompt to Pulumi AI...
Pulumi AI response:
\`\`\`typescript
...
\`\`\`
View this conversation at:  https://www.pulumi.com/ai/conversations/13a802da-50b6-46e8-bc82-fd2f7ac6e364
 Use this program as a template? refine
Tell Pulumi AI how to refine the previous program:
> add an awsx vpc
...
```

We're still a little inconsistent between the survey asked questions and those
using `promptForValue`. An overhaul here would be a much larger change that's
currently out of scope.

Removes a test that only tested the mocks, was not working on Windows due to
OS-specific behavior in Survey.

Fixes #14973
AaronFriel added a commit that referenced this issue Dec 27, 2023
Switches the prompt to use the `promptForValue` function, which now accepts an
empty type descriptor. This renders to the user as:

```console
$ pulumi new
 Would you like to create a project from a template or using a Pulumi AI prompt? ai
 Please select a language for your project: TypeScript
What cloud infrastructure would you like to build?
(try something like \"a static website on AWS behind a CDN\")
> an eks cluster
Sending prompt to Pulumi AI...
Pulumi AI response:
\`\`\`typescript
...
\`\`\`
View this conversation at:  https://www.pulumi.com/ai/conversations/13a802da-50b6-46e8-bc82-fd2f7ac6e364
 Use this program as a template? refine
Tell Pulumi AI how to refine the previous program:
> add an awsx vpc
...
```

We're still a little inconsistent between the survey asked questions and those
using `promptForValue`. An overhaul here would be a much larger change that's
currently out of scope.

Removes a test that only tested the mocks, was not working on Windows due to
OS-specific behavior in Survey.

Fixes #14973
github-merge-queue bot pushed a commit that referenced this issue Jan 4, 2024
# Description

Switches the prompt to use the `promptForValue` function, which now
accepts an empty type descriptor. This renders to the user as:

```console
$ pulumi new
 Would you like to create a project from a template or using a Pulumi AI prompt? ai
 Please select a language for your project: TypeScript
What cloud infrastructure would you like to build?
(try something like "a static website on AWS behind a CDN")
> an eks cluster
Sending prompt to Pulumi AI...
Pulumi AI response:
\`\`\`typescript
...
\`\`\`
View this conversation at:  https://www.pulumi.com/ai/conversations/13a802da-50b6-46e8-bc82-fd2f7ac6e364
 Use this program as a template? refine
Tell Pulumi AI how to refine the previous program:
> add an awsx vpc
...
```

We're still a little inconsistent between the survey asked questions and
those using `promptForValue`. An overhaul here would be a much larger
change that's currently out of scope.

Removes a test that only tested the mocks, was not working on Windows
due to OS-specific behavior in Survey.

Fixes #14973

## Checklist

- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
  - [x] I have formatted my code using `gofumpt`
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli UX of using the CLI (args, output, logs) kind/bug Some behavior is incorrect or out of spec p1 A bug severe enough to be the next item assigned to an engineer resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants