Repository navigation
Generate templates' typed APIs with a shared template generator - #318
Merged
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
widefleet-docs | 6027592 | Nov 23 2026, 10:06 AM |
The Linear template carried its own GraphQL generator. Templates for other providers need the same rules, selection types and approvals, so the generator moves to packages/template-generator and runs from the repository: pnpm --filter @platform/template-generator generate linear. Templates stay standalone copies: the generator writes their generated files and copies the runtime files they share, the selection types and approvals, into each template's src. The Linear template's output is unchanged apart from the header.
The generator also takes an app's directory, so an app copied from a template picks up its provider's API changes without copying files from the repository. template.md describes it.
tnkuehne
force-pushed
the
feat/template-generator
branch
from
November 23, 2026 10:05
a6cf96f to
6027592
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The Linear template has its own generator in
scripts/generate.ts. It turns Linear's GraphQL schema into typed methods, field selections and approvals. Templates for other providers need the same pieces: selection types, change categories, approval questions and the approval level. Copying the generator into every template would mean copying fixes too.What changes
packages/template-generator: the generator moves here and runs from the repository:pnpm --filter @platform/template-generator generate linear.Without a source file, it downloads the provider's current API description. With one, it reads that file instead.
generate /path/to/your/app). It reads that app's rules and rewrites its generated and shared files, so copies can pick up provider changes too.scripts/operations.tsnames the source and the service, and decides how each operation is offered.src/api.tsandsrc/schema.ts. It also copies the shared runtime files (selection.ts,approval.ts) into the template'ssrc, then formats them. A template has no dependency on the package.scripts/generate.ts, itsgeneratescript and thegraphqldev dependency are removed. The generated output only changes in its header, which now names the command.Testing
pnpm check

Confidence Score: 5/5
The PR appears safe to merge; no actionable new issues were found.Summary
Moves Linear's generator into
packages/template-generatorand keeps templates standalone.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR Target["Template name or app directory"] --> Rules["Read scripts/operations.ts"] Rules --> Source["Read saved schema or download it"] Source --> Generate["Generate typed API and schema"] Generate --> Write["Write files into target app"] Runtime["Shared selection.ts and approval.ts"] --> Write Write --> Format["Format generated files"]Reviews (3) · Last reviewed commit: "Regenerate apps copied from a template" · Reviewed by Greptile