chore: add tasks-docker first in starter templates list#20169
Conversation
| const sortVisibleTemplates = (templates: TemplateExample[]) => { | ||
| // The docker template should be the first template in the list, | ||
| // as it's the easiest way to get started with Coder. | ||
| const dockerTemplateId = "docker"; |
There was a problem hiding this comment.
Previously, the docker template was being moved to the front of the list in the frontend. We simply swapped that for the tasks-docker template.
There was a problem hiding this comment.
Just to make sure I'm understanding the product goal: are we okay with dropping the old Docker template entirely, or would we still want it to be second in the list? We still have the Docker template as the second one for the empty templates component
There was a problem hiding this comment.
The docker template is just no longer the very first template displayed. It's still in the list we're sorting it's just ordered based on its name rather than being manually pulled to the front.
There was a problem hiding this comment.
Product wise I think these are meant to be different lists. The EmptyTemplates component is only ever seen when your deployment has no templates pushed, whereas the starter-templates page is more likely to be encountered by a typical developer looking to make a quick template.
But also I'm okay with simply making the docker template second here too.
| //go:embed templates/kubernetes-devcontainer | ||
| //go:embed templates/nomad-docker | ||
| //go:embed templates/scratch | ||
| //go:embed templates/tasks-docker |
There was a problem hiding this comment.
We currently embed the starter template in the binary. This is where we add the tasks-docker template to the list (the examples/templates/tasks-docker directory contains its contents copied from https://github.com/coder/registry/tree/main/registry/coder-labs/templates/tasks-docker).
6974c83 to
b865e8a
Compare
USAGE:
coder templates init [flags] [directory]
Get started with a templated template.
OPTIONS:
--id aws-devcontainer|aws-linux|aws-windows|azure-linux|digitalocean-linux|docker|docker-devcontainer|docker-envbuilder|gcp-devcontainer|gcp-linux|gcp-vm-container|gcp-windows|kubernetes|kubernetes-devcontainer|nomad-docker|scratch
Specify a given example template by ID.
———
Run `coder --help` for a list of global options.
buenos-nachos
left a comment
There was a problem hiding this comment.
Looks good to me overall. The StarterTemplate page has some Emotion styling still, but I have a PR that removes that, so it's not a big deal to take care of that here
|
|
||
|  | ||
|
|
||
| This is a fantastic starting point for working with AI agents with Coder Tasks. Try prompts such as: |
There was a problem hiding this comment.
Nit: I feel like "fantastic" feels too qualitative and feels kinda like AI output
There was a problem hiding this comment.
Haha I copied this source directly from the existing template in the registry, It should probably stay the same until we integrate registry into the core product, but I agree it feels like an AI wrote this.
| const sortVisibleTemplates = (templates: TemplateExample[]) => { | ||
| // The docker template should be the first template in the list, | ||
| // as it's the easiest way to get started with Coder. | ||
| const dockerTemplateId = "docker"; |
There was a problem hiding this comment.
Just to make sure I'm understanding the product goal: are we okay with dropping the old Docker template entirely, or would we still want it to be second in the list? We still have the Docker template as the second one for the empty templates component
| @@ -12,6 +12,7 @@ import { docs } from "utils/docs"; | |||
|
|
|||
| // Those are from https://github.com/coder/coder/tree/main/examples/templates | |||
| const featuredExampleIds = [ | |||
There was a problem hiding this comment.
Nothing wrong with this file, but it looks like it'd be pretty easy to swap in Tailwind here.
If we get rid of the styles object, we should be able to add className="max-w-[50%] h-80 overflow-hidden opacity-85 [&_img]:max-w-full" to the div, and that should be equivalent
There was a problem hiding this comment.
I'm down to look at doing this together 😎
There was a problem hiding this comment.
Sorry, forgot to respond to this. Let me know if you still want to pair on this, and I can do it as soon as I get back from my dentist appointment tomorrow
|
why are we unpinning the regular |
The ticket ask was to pin the Tasks on Docker Template first. I can update the PR to keep the Docker template pinned in the second slot. From the code I sort of thought the idea was to have one pinned template at a time and the rest organized by name. I think maybe the better solution though is to have the set of "featured templates" apply to the starter-templates page as well as the EmptyTemplates component. |
|
agreed. having a simple template front and center that doesn't require spending a bunch of cloud provider money is a great way to ease into the product. |
|
@bcpeinhardt Agree with your approach and thoughts here. Having the Tasks On Docker first makes for a super easy entry point to Tasks, but it wasn't the intention to have the Docker template fall to the wayside. Having it be the 2nd in the list is what I was hoping for! I like the idea of a "featured templates" section! |
Addresses review feedback to keep the regular 'docker' template as the second featured template after 'tasks-docker'. Sorting order is now: 1. tasks-docker (easiest entry point) 2. docker (keeps original docker template featured) 3. All others sorted alphabetically 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…-starter-templates
aslilac
left a comment
There was a problem hiding this comment.
this sort algorithm feels like too much now imo. I really liked your idea of just breaking things up into a "featured" section and everything else.
even if we don't do that yet, in utils/starterTemplates.ts there's a function that this templates value we end up with is coming from, and that does some processing already. I think we could update that function to pull this logic out of React and consolidate things.
| if (a.id === tasksDockerTemplateId) { | ||
| return -1; | ||
| } | ||
| if (b.id === tasksDockerTemplateId) { | ||
| return 1; | ||
| } |
There was a problem hiding this comment.
this is technically an unstable sort because you're not handling a.id === b.id. there shouldn't ever be duplicates, but it's worth thinking about the ramifications.
| if (a.id === dockerTemplateId) { | ||
| return -1; | ||
| } |
There was a problem hiding this comment.
I also worry that it's super unclear why this sort works the way it does. I kinda wish templates just didn't include the docker or tasks-docker templates at all so that it could have a normal sort, and that things sorted "manually" were just in an obvious order, rather than having a complicated looking algorithm that takes up more lines of code than hardcoding the order would.
this pattern was already too clever for it's own good, but with this additional case now it's even more so.
Dismissing because it looks like the PR has changed a good bit since the initial approval. Will re-review soon
buenos-nachos
left a comment
There was a problem hiding this comment.
Okay, so less changed than I thought, but it sounds like we're not fully happy with one of the current implementations
| @@ -12,6 +12,7 @@ import { docs } from "utils/docs"; | |||
|
|
|||
| // Those are from https://github.com/coder/coder/tree/main/examples/templates | |||
| const featuredExampleIds = [ | |||
There was a problem hiding this comment.
Sorry, forgot to respond to this. Let me know if you still want to pair on this, and I can do it as soon as I get back from my dentist appointment tomorrow
…-starter-templates
This PR:
EmptyTemplates)closes #19718
Screen.Recording.2025-10-03.at.4.24.43.PM.mov