Pull request explained
Add campaign export: channel sizes, fit-to-box text and a campaign sheet
Marketing needs one message in every channel size. This adds nine canvas formats (LinkedIn, Open Graph, headers, an email header at 2×, and four display ads with 150 KB budgets), a data-od-fit attribute that shrinks long translations until they fit, and a campaignSheet export option that shows every shape and every other piece of the campaign on one image.
Before and after
| Before | After | |
|---|---|---|
| Display ads | No ad sizes; hand-typed width/height, no byte budget | preset: "banner-mrec" and three more, each capped at 150 KB |
| German copy | Overflows and is reported as an error | Marked data-od-fit, it shrinks in 5% steps to 70%, and the shrink is reported as a note |
| Reviewing a campaign | One shape sheet per design | campaign-sheet.png: every shape plus the landing page and email |
Risks
- Default shape sheets. Tiny ads would fail on every poster, so headers, banners and ads are left out of a sheet that names no presets (
inDefaultSheet: false). - Fluid text. Fitting writes
calc((authored size) * k), not frozen pixels, so text still reflows across shapes.
How it was tested
campaignKit.test.ts: formats, budgets and the 2× email header; per-row fitting; the campaign sheet with a collection, all in a real browser.- Existing poster and export suites (70 tests) unchanged.
Review tour
| Order | Files | What to look for |
|---|---|---|
| 1 | core/src/poster/formats.ts | The nine formats; scale and inDefaultSheet |
| 2 | core/src/poster/pageScripts.ts | fitBoundText: how fit is judged, and restoring the authored size |
| 3 | core/src/export/exportArtifact.ts | Per-shape scale; the campaign sheet built from the collection |
| 4 | core/src/poster/shapeSheet.ts | Image mime and size caps on tiles |
| 5 | core/src/test/unit/campaignKit.test.ts | Coverage of the above |
| 6 | vscode/package.json, mcp-server/src/*, cli/src/* | Schemas and flags; mechanical |
| 7 | content/**/campaign.md, surfaces.json, generated prompts | The campaign flow text; the rest is generated |
Sources
git show --stat 038ac77git show 038ac77 -- packages/core/srcpackages/core/src/test/unit/campaignKit.test.ts