Repository navigation
feat(cli): add exp task create command - #19492
Conversation
3220cc1 to
9196c38
Compare
9196c38 to
14ee5c9
Compare
| templateVersionPresetID = uuid.New() | ||
| ) | ||
|
|
||
| templateAndVersionFoundHandler := func(t *testing.T, ctx context.Context, templateName, templateVersionName, presetName, prompt string) http.HandlerFunc { |
There was a problem hiding this comment.
Decided to create a small helper here instead of writing the same handler over-and-over again. This is following in the footsteps of #19533 by using a http handler to mock coderd behavior instead of using coderdtest.
There was a problem hiding this comment.
We might want to add a single "integration"-style test at the end in a separate PR so we know we've all our bases covered.
There was a problem hiding this comment.
Sounds good to me
mafredri
left a comment
There was a problem hiding this comment.
Some suggestions/nits inline, but approach seems fine. We may want to consider moving some of the logic to the API endpoint if we want to make API usage more convenient, but this works for now.
| workspace, err := expClient.CreateTask(ctx, codersdk.Me, codersdk.CreateTaskRequest{ | ||
| TemplateVersionID: templateVersionID, | ||
| TemplateVersionPresetID: templateVersionPresetID, | ||
| Prompt: taskInput, |
There was a problem hiding this comment.
Suggestion: Not sure if we're too far gone to do this, but potential for rename: Prompt -> Input depending on how we want to standardize this.
There was a problem hiding this comment.
As it is all experimental we technically still have time
mafredri
left a comment
There was a problem hiding this comment.
Post-merge approve and one more suggestion.
| inv.Stdout, | ||
| "The task %s has been created at %s!\n", | ||
| cliui.Keyword(workspace.Name), | ||
| cliui.Timestamp(time.Now()), |
There was a problem hiding this comment.
The way I've implemented it is how we currently do it for workspace creation but I'm happy to create a quick follow up PR to address this?
There was a problem hiding this comment.
Up to you tbh, I'm good with either just thought it made sense so threw it out there. 👍🏻
Partially implements coder/internal#893
This isn't the full implementation of
coder exp tasks createas defined in the issue, but it is the minimum required to create a task.