ycoder.sh manages Coder workspace templates. It keeps
every template equal to one source: vibestack/. The tool copies the files —
it does not make symbolic links, because Coder removes a symbolic link to a
.tf file from an upload.
- A Coder server. Make a session token at
<coder-url>/cli-auth. - The
coderCLI andterraform. - The GitHub CLI (
gh) — only for thedownloadcommand.
# Set CODER_URL and CODER_SESSION_TOKEN
cp .env.example .env && $EDITOR .env
# Set the secret values of the template
cp vibestack/.env.example vibestack/.env && $EDITOR vibestack/.env
./ycoder.sh validate vibestack
./ycoder.sh push vibestackTo make your own template, run ./ycoder.sh create myapp. Put your changes in
myapp/custom.tf and myapp/startup.custom.sh. Then validate and push.
| Command | Arguments | Description |
|---|---|---|
sync |
[template...] |
Copy the vibestack/ files into the templates |
create |
<template> |
Make a new template folder; stops if the folder exists |
validate |
[template...] |
Run terraform validate in a temporary folder |
push |
<template> [args] |
Sync the template, then push it to Coder |
download |
— | Get the newest ycoder.sh and vibestack/ from GitHub |
agent |
— | Show the file map and the rules for AI agents |
help, version |
— | Show the usage / the version of the script |
- Do not change a generated file (
main.tf,startup.sh,Makefile,.env.example,README.md) — each has a banner, and the nextsyncremoves your change. Your files arecustom.tf,startup.custom.shandCUSTOM.md;syncdoes not change them. - With no name,
syncandvalidateact on every managed folder (a managed folder has the banner in itsmain.tf). Give the name of the template. - Caution:
downloadreplacesycoder.shand all ofvibestack/; it keeps onlyvibestack/.env.YCODER_REPO(defaultynfra/ycoder) andYCODER_REF(defaultmaster) select the source; the files land next to the script. - Do not run
terraformyourself —validateworks in a temporary folder against the currentvibestack/files (plugins cache in$TF_PLUGIN_CACHE_DIR, default~/.terraform.d/plugin-cache), and the Coder server applies the plan. pushrunsmake -C <template> pushwhen the templateMakefilehas apushtarget (it reads.envand sends each secret as a--variableflag); if not, it runscoder templates push <template> -d <template>.startup.custom.shruns afterstartup.shand can use thelog,ok,link_shared,summary_linesandsummaryhelpers; incustom.tf, useorder = 3or a higher value for your apps.- Put a secret value in the template's
.env(git ignores it), never in a.tffile. direnv reads the root.envthrough.envrc, so thecoderCLI needs no other configuration. - The script first moves to its own folder, so you can run it from any folder.
docker/,mux/andohmyfelix/are standalone templates with a hand-writtenmain.tf— the tool skips them.- vibestack/README.md describes the workspace: the apps, the variables and the image version.
See AGENTS.md for the conventions and the writing rules.