Uh oh!
There was an error while loading. Please reload this page.
Read, clone, update, and delete email templates from the CLI - #19
Merged
jbedient-kizen merged 1 commit intoSep 1, 2026
Merged
Conversation
`kizen messages templates` could only list templates before this; now `get`, `clone`, `update`, and `delete` round out the surface. The thing to know: a template stores the editable `craft_json` tree and the compiled `content` HTML that actually gets sent as two independent fields, and the server compiles neither from the other (confirmed live by PATCHing a modified `craft_json` alone and reading `content` back byte-identical). Writing one without the other leaves the builder showing one email while recipients silently receive another. - `get` shows a template's body, plus two drift checks: `structure coupled` (every Section/Row node has its matching `section-<nodeId>` class in the compiled HTML) and `text in sync` (every Text node's copy actually appears there). `--raw` dumps the full payload. - `clone` always copies both content fields together, making it the safe way to branch a design built in the builder UI. - `update` and `delete` PATCH/DELETE a template directly. Generating a new template from a spec file is still not wired; the node shapes and compile findings needed for that are written up in `kizen docs show email-templates`.
annaliu-kizen
approved these changes
Sep 1, 2026
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
Adds
get,clone,update, anddeletetokizen messages templates, whichcould only
listbefore this.The thing to know before reviewing
An email template stores two independent fields:
craft_json— the editable node tree the builder UI renderscontent— the compiled, Outlook-safe HTML that is actually sentThe server compiles neither from the other, on
POSTor onPATCH.Confirmed live by PATCHing a modified
craft_jsonalone and readingcontentback byte-identical. So writing one without the other leaves the builder showing
one email while recipients receive a different one, with nothing anywhere
reporting a problem.
Every design decision in this PR and the ones stacked on it follows from that.
What's here
getprints the template body plus two drift checks:structure coupled— everySection/Rownode has its matchingsection-<nodeId>class in the compiled HTMLtext in sync— everyTextnode's copy actually appears there--rawdumps the full payload.clonealways copies both content fields together, making it the safe wayto branch a design built in the builder UI.
update/deletePATCH and DELETE directly.Generating a template from a spec file is deliberately not wired here — that's
the next PR in the stack. The node shapes and compile findings it needs are
written up in
kizen docs show email-templates.Reviewing
9 files, +775/-26. Self-contained: nothing else in the stack is required for
this to be correct on its own.
The drift checks are worth the closest look. They are necessary but not
sufficient — they compare node ids and text, so they cannot see a divergence
where both still match and only styling or width differs. A later PR in the
stack fixes several defects of exactly that shape, all of which these checks
report as green. If you can think of a cheap check that would have caught those,
it's worth adding.