Skip to content

feat: add ListTemplates and GenerateFile RPCs (template-connectors v2, PR 2)#9326

Draft
royendo wants to merge 1 commit into
royendo/template-connectors-v2from
royendo/template-connectors-v2-rpc
Draft

feat: add ListTemplates and GenerateFile RPCs (template-connectors v2, PR 2)#9326
royendo wants to merge 1 commit into
royendo/template-connectors-v2from
royendo/template-connectors-v2-rpc

Conversation

@royendo
Copy link
Copy Markdown
Contributor

@royendo royendo commented Apr 28, 2026

PR 2 of 4 from PRD-template-connectors-v2.md. Wires the runtime/templates package (PR 1, #9325) up to the runtime API. Stacked on top of #9325 — review after that lands. The frontend rewire (PR 3) consumes these RPCs.

  • New RPCs ListTemplates and GenerateFile on RuntimeService. The legacy GenerateTemplate RPC from the original PR feat: template connectors #8981 is dropped per the PRD's open-decisions recommendation: the frontend goes through GenerateFile exclusively, and a search of the codebase showed no CLI/SDK consumer of the older shape.
  • writeRenderedFiles writes .env before the rendered YAML so that secret references ({{ .env.VAR }}) resolve on the first reconcile cycle.
  • appendEnvVar strips newlines and quotes values containing whitespace or shell-special characters (carried over from the v1 review hardening list).
  • proto.generate regenerates Go bindings, the gateway, validate, swagger, and the Orval client. The large diff in api.pb.go is mostly index renumbering caused by adding seven new messages — actual content additions are scoped to the new types.

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

Developed in collaboration with Claude Code

Wires the `runtime/templates` package up to the runtime API surface.
The frontend (PR 3) will fetch form schemas via `ListTemplates` and
render YAML previews / write files via `GenerateFile`.

- proto/rill/runtime/v1/api.proto: adds `ListTemplates` and
  `GenerateFile` RPCs and the `Template`, `TemplateFile`, and
  `GeneratedFile` messages. Per the v2 PRD's open-decisions section,
  the legacy `GenerateTemplate` RPC from the original PR is dropped —
  the frontend goes through `GenerateFile` exclusively.
- runtime/server/server.go: loads the template registry once at
  startup and stores it on `Server`.
- runtime/server/templates.go: handlers for both RPCs plus
  `writeRenderedFiles` (writes `.env` first so YAML referencing
  `{{ .env.VAR }}` resolves on first reconcile) and `appendEnvVar`
  with the v1 review hardening (newline strip + quoting of values
  with whitespace / shell-special characters).
- Regenerated proto bindings, gateway, validate, swagger, and the
  Orval frontend client via `make proto.generate`.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.

1 participant