feat(scripts): Draft blog graphic artboards with Gemini - #1267
Open
jeromehardaway wants to merge 1 commit into
Open
feat(scripts): Draft blog graphic artboards with Gemini#1267jeromehardaway wants to merge 1 commit into
jeromehardaway wants to merge 1 commit into
Conversation
Rendering blog graphics from HTML made copy edits deterministic, but the first artboard of a set still had to be written by hand. --draft <name> <brief> hands Gemini the brand tokens and one existing artboard from the same folder, then writes the HTML it returns. The render path is untouched: review the file, --dry it, then upload. What the model produces is a text file that stays editable, which is the whole reason these graphics stopped being generated images. Redrafting over an existing artboard is refused so hand edits survive.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Summary
Blog graphics are HTML artboards rendered headless by
generate:blog-graphic, which made copy edits deterministic — but the first artboard of a set still had to be written by hand. This adds a--draftflag that has Gemini write that first file.The point is that the model's output is a text file, not an image. It stays editable, diffable, and re-renderable, which is the reason these graphics moved off image generation in the first place.
What changed
scripts/generate-blog-graphic.ts—--draft <name> "<brief>"sends Gemini the_brand.csstokens plus one existing artboard from the same folder as a house-style sample, and writes the returned HTML to<slug>/<name>.html. It stops there; the render and upload path is untouched.main()is now behindrequire.main === module, matchinggenerate-blog-image.ts, so the module can be imported by a test.__tests__/scripts/generate-blog-graphic.test.ts— coversstripFences, since the model routinely wraps its output in markdown fences and a fenced code sample inside the markup must survive.Usage:
Test plan
npm run typechecknpm run lint(22 pre-existing errors on master, none in the touched files)npm test— 472 passed, including 4 new10-day-sprint, rendered with--dry: output used onlyvar(--*)tokens with no raw hex, GothamPro headings, Gilroy body, correct.artboardroot, and legible type throughout. Smoke-test artboard deleted afterward.Migration / config notes
Uses
GEMINI_API_KEY, already required bygenerate:blog-imageand already documented in.env.example. No new environment variables.Follow-up
No retry-on-bad-output and no automated validation of the drafted HTML — the
--dryrender is the review step. Worth adding only if drafting ever becomes unattended.