Skip to content

feat: add TemplateBuilderCompose SDK types and client method#26350

Merged
jeremyruppel merged 7 commits into
mainfrom
jeremy/devex-277-phase3-sdk
Jun 15, 2026
Merged

feat: add TemplateBuilderCompose SDK types and client method#26350
jeremyruppel merged 7 commits into
mainfrom
jeremy/devex-277-phase3-sdk

Conversation

@jeremyruppel

Copy link
Copy Markdown
Contributor

Note

This PR was authored by Coder Agents on behalf of @jeremyruppel.

Part 3 of DEVEX-277 (POST /api/v2/templatebuilder/compose).

Adds SDK types and client method for the compose endpoint:

  • TemplateBuilderComposeRequest with BaseTemplateID and Modules (list of {ID, Variables}). Registry URL is omitted from the request; it comes from server-side deployment config.
  • TemplateBuilderCompose(ctx, req) client method that POSTs the request and returns raw application/x-tar bytes (matching the Download pattern in codersdk/files.go).
  • Generated TypeScript types updated.

@linear-code

linear-code Bot commented Jun 12, 2026

Copy link
Copy Markdown

DEVEX-277

Implement the bases listing endpoint for the template builder. Returns
base templates from the bundled catalog with OS metadata resolved from
the exampleID->OS map. The endpoint is gated behind the template builder
feature flag and returns 404 when disabled.
…talog

Reusable Go script that reads the Coder registry repo and generates
module.json and .tf.tmpl files for the template builder catalog. Parses
variable declarations from main.tf, frontmatter from README.md, and
pinned versions from git tags.

Usage:
  go run ./scripts/modulegen/ -registry /path/to/registry -output coderd/templatebuilder/modules

Handles escaped quotes and heredoc descriptions, skips variables with
heredoc defaults (cannot be represented in the builder UI), uses numeric
semver sorting for version tags, and exits non-zero on failures.
…raction

Add ModuleRenderContext and RenderModuleTemplate for rendering module
.tf.tmpl files with registry URL, pinned version, agent resource name,
and variable values. Nil-guards the Variables map to prevent panics.

Extract shared renderTemplate with missingkey=error so missing variable
keys fail loudly instead of producing "<no value>" in rendered HCL.

Add ExtractAgentResourceName which uses a regex to find the coder_agent
resource name from rendered base HCL. Strips comment lines (# and //)
before matching to avoid false positives. Errors if zero or more than
one agent is found.

Add ModuleTemplateFS to expose module template files from the embedded
catalog, with validation that the expected .tf.tmpl file exists.
Compose renders a base template and selected modules into Terraform
source files. It validates modules before rendering: rejects duplicates,
ConflictsWith violations, unknown IDs, and OS incompatibility. For each
module, mergeModuleVariables fills in manifest defaults for non-computed,
non-sensitive variables (with basic JSON type validation), then overlays
caller-supplied values. Required variables without defaults are left
absent so missingkey=error catches the omission at render time.

BundleTar packages the result into a tar archive with reproducible
timestamps (time.Unix(0,0)). Writes main.tf always, modules.tf only
when modules are present.
Add TemplateBuilderComposeRequest and TemplateBuilderComposeModule
request types for the compose endpoint. The response is raw
application/x-tar bytes, so TemplateBuilderCompose returns []byte
directly (matching the Download pattern in codersdk/files.go).

Generated TypeScript types updated.
@jeremyruppel jeremyruppel force-pushed the jeremy/devex-277-phase3-sdk branch from 79ca213 to 1e7157e Compare June 12, 2026 22:00

jeremyruppel commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

Merge activity

@jeremyruppel jeremyruppel changed the base branch from jeremy/devex-277-phase2-compose to graphite-base/26350 June 15, 2026 13:28
@jeremyruppel jeremyruppel changed the base branch from graphite-base/26350 to main June 15, 2026 13:28
@jeremyruppel jeremyruppel merged commit ce21a56 into main Jun 15, 2026
37 of 58 checks passed
@jeremyruppel jeremyruppel deleted the jeremy/devex-277-phase3-sdk branch June 15, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants