Split single-container Coder template into per-env templates
The old root main.tf tried to switch dev profiles inside one shared container via a coder_parameter dropdown; the settings-application path looked for a *.json cache file that never existed (the cache was written as *.code-profile), so profile settings never actually applied, and VS Code extensions were copied from extensions/ (which turns out to be Claude Code plugin bundles, not real VS Code extension packages). Replace it with one independent Coder template per environment (templates/default, 3d-printing, cobol, python, ttrpg, web). Each reads its matching profile-templates/*.code-profile file at template-push time via file()/jsondecode(), feeds the extension ID list straight into the code-server module's `extensions` input, and writes the raw settings.json text via a coder_script - no runtime Gitea zip download needed anymore. Also add scripts/cli-setup-wizard.sh, hooked into every new interactive shell until completed, offering to install/log into GitHub Copilot CLI, Google Antigravity CLI, and Claude Code CLI. VS Code extensions are deliberately not asked about there since Terraform already handles them. All six templates verified with `terraform init`/`validate` against the real coder-server container on octo-winsrv. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,2 +1,86 @@
|
||||
# Profiles-for-Coder
|
||||
|
||||
Coder templates for per-discipline dev environments (Default, 3D Printing,
|
||||
COBOL, Python, TTRPG, Web). Each environment is its own Coder **template** -
|
||||
not a dropdown inside one shared container, which is what this repo used to
|
||||
do and which didn't actually work.
|
||||
|
||||
## Layout
|
||||
|
||||
```
|
||||
templates/
|
||||
default/main.tf # Standard Default Dev
|
||||
3d-printing/main.tf # 3D Printing & Engineering
|
||||
cobol/main.tf # COBOL Modern Mainframe
|
||||
python/main.tf # Python Engineering
|
||||
ttrpg/main.tf # TTRPG & Lore Building
|
||||
web/main.tf # Web Applications
|
||||
scripts/
|
||||
cli-setup-wizard.sh # shared first-run wizard, see below
|
||||
profile-templates/ # VS Code .code-profile exports, one per env
|
||||
extensions/ # Claude Code plugin/skill bundles (see note below)
|
||||
```
|
||||
|
||||
Each `templates/<env>/main.tf` is a complete, independent Coder template
|
||||
(agent, docker container, code-server, JetBrains). They're deliberately not
|
||||
built from a shared Terraform module - only their `locals` block differs
|
||||
(which profile file to read). Push them individually:
|
||||
|
||||
```sh
|
||||
coder templates push profiles-default -d templates/default
|
||||
coder templates push profiles-3d -d templates/3d-printing
|
||||
coder templates push profiles-cobol -d templates/cobol
|
||||
coder templates push profiles-python -d templates/python
|
||||
coder templates push profiles-ttrpg -d templates/ttrpg
|
||||
coder templates push profiles-web -d templates/web
|
||||
```
|
||||
|
||||
### How the VS Code profile gets applied
|
||||
|
||||
`profile-templates/*.code-profile` is a real VS Code Profile export: a JSON
|
||||
file whose `settings` and `extensions` fields are themselves JSON-encoded
|
||||
strings (double/triple-nested). Each template's `main.tf` reads and decodes
|
||||
its matching file **at `terraform apply`/push time** (via `file()` +
|
||||
`jsondecode()`), then:
|
||||
|
||||
- passes the extension ID list straight into the `code-server` module's
|
||||
`extensions` input, so code-server installs them on first boot - no
|
||||
interactive prompt needed, Terraform handles it declaratively;
|
||||
- writes the raw `settings.json` text (comments and all - VS Code tolerates
|
||||
JSONC) to `~/.local/share/code-server/User/settings.json` via a
|
||||
`coder_script`.
|
||||
|
||||
This replaces the old approach, which downloaded a zip of this repo from
|
||||
Gitea *inside* the running container and tried to apply settings from
|
||||
`~/.local/share/profiles-cache/<profile>.json` - a path that never matched
|
||||
the actual `.code-profile` file extension, so settings never applied. That
|
||||
bug (plus the single shared container) is why "one container, many envs"
|
||||
never really worked.
|
||||
|
||||
### CLI setup wizard
|
||||
|
||||
`scripts/cli-setup-wizard.sh` is dropped onto every workspace and hooked
|
||||
into `~/.bashrc`. It runs in every new interactive terminal - until the user
|
||||
finishes it - and offers to install + log into:
|
||||
|
||||
- **GitHub Copilot CLI** (`npm install -g @github/copilot`, then `copilot login`)
|
||||
- **Google Antigravity CLI** (`curl -fsSL https://antigravity.google/cli/install.sh | bash`, binary `agy`)
|
||||
- **Claude Code CLI** (`npm install -g @anthropic-ai/claude-code`, then `claude`)
|
||||
|
||||
It does **not** ask about VS Code extensions, since those are handled by
|
||||
Terraform (see above). Once the user confirms completion it writes a
|
||||
sentinel file (`~/.cache/coder-cli-wizard/done`) and stops prompting. It can
|
||||
always be re-run manually: `bash /opt/coder/cli-setup-wizard.sh --force`.
|
||||
|
||||
### `extensions/` directory
|
||||
|
||||
Heads up: `extensions/awesome-skills-plugin` and `extensions/custom-specialty-plugin`
|
||||
are **Claude Code plugin/skill bundles** (`plugin.json` + `SKILL.md` files),
|
||||
not actual VS Code extension packages. The old root `main.tf` copied this
|
||||
folder straight into code-server's extensions directory, which would never
|
||||
have worked as VS Code extensions regardless of the container bug above.
|
||||
This rewrite doesn't wire `extensions/` into anything - it's left as-is
|
||||
pending a decision on whether/how to install these as Claude Code plugins
|
||||
inside each workspace (e.g. `custom-specialty-plugin/skills/cobol-teacher`
|
||||
for the COBOL env, `openscad-parametric` for 3D, `ttrpg-lore-weaver` /
|
||||
`foundryvtt-modding` for TTRPG).
|
||||
|
||||
Reference in New Issue
Block a user