Copy this, then paste it as the first message in a new Codex session.
Prompt
Copy
# Handoff: Adobe production automation toolkit This is the first message of a fresh Codex session. It is written to be read by an agent, not a person. The designer who pasted it is at the keyboard — ask her directly when you need a decision. **Start here.** Work in a new empty folder on her machine — `~/adobe-ops` is fine, `git init` it. Nothing from any other project is needed. Read this whole message before writing anything. --- ## Context Building a production automation toolkit for a working graphic designer. She runs Adobe CC (Lightroom Classic, Photoshop, Illustrator, InDesign, Acrobat) and delivers assets for **web, social, and print**. Clients hand her requirements in prose; she hand-exports every deliverable, then re-exports the whole matrix on each revision round. **She is a designer, not a developer.** Every tool must be runnable by someone who does not live in a terminal. Assume zero tolerance for a broken environment. Secondary goal: the same toolkit becomes the foundation for the **website builds** she currently hands to a developer. ### Non-goals - No design decisions. The agent executes after approval; it never chooses layout, type, or colour. - No Adobe enterprise APIs. The Photoshop/Firefly REST API requires an enterprise contract — out of scope. Everything goes through local scripting on her existing CC licence. - No headless operation. The apps must be running. Do not architect for CI. --- ## The loop she actually runs This is the shape of a working day. Everything below exists to serve it — if a phase does not make one of these three steps shorter, it is the wrong phase. 1. **"Here's the job."** She pastes the client's brief — the email, the call notes, the spec sheet with the sizes buried in a paragraph — and gets back a checkable list of every file the job requires. Thirty seconds of her correcting it. That list is the quote and the export instructions at the same time; that dual use is the point. 2. **She designs.** Nothing automated touches this step, ever. The automation starts the moment a design is approved and stops the moment it is delivered. 3. **"Package it."** One word, with the approved master open. Every size, every format, every colourway, named correctly, in a folder tree, with a contact-sheet proof PDF at the end. Revision round two re-runs the whole thing in seconds. Three verbs, and she should be able to say them in plain English rather than remember flags: ```bash adobe-ops brief <file> # step 1 — brief in, deliverables list out adobe-ops package # step 3 — run the matrix against the approved master adobe-ops deliver # folder tree + proof sheet + zip ``` Accept the spoken forms too — "here's the job", "package it", "send it" — and when something fails, say what she should fix in her words. A stack trace is a support call. --- ## Environment — establish this first Before writing anything, determine and record in `ENVIRONMENT.md`: 1. **OS.** macOS and Windows take completely different invocation paths. You are running on her machine — detect it, do not guess. 2. **Adobe app versions.** The application name string is version-specific on macOS (`Adobe Photoshop 2026`) and matters for COM ProgIDs on Windows. Read them off what is actually installed. 3. **UXP vs ExtendScript per app** — this is the critical constraint and the most common source of wasted work: | App | Public automation surface | Use | |---|---|---| | Photoshop | UXP (public) + ExtendScript + `batchPlay` | ExtendScript for scripts; UXP only if a panel is needed | | Illustrator | **ExtendScript only** | UXP is internal to Adobe, no public API or docs — do not attempt it | | InDesign | UXP (public) + ExtendScript | ExtendScript; data merge is native | | Lightroom Classic | Lua SDK (separate, awkward) | Prefer presets + watched-folder export over SDK work | | Acrobat | JavaScript for Acrobat + Action Wizard | Preflight and PDF/X presets | 4. **Automation permissions.** The first run has to talk macOS into letting one app drive another — a permission dialog, once, and it is the fiddliest fifteen minutes of the whole setup. Walk her through it, and record what was granted in `ENVIRONMENT.md` so the next failure is diagnosable. 5. **Codex sandboxes shell commands by default.** Driving one application from another through `osascript` is exactly the kind of thing a default sandbox stops. Settle the approval mode on the first run, on a throwaway file, rather than halfway through a client job. 6. **Version names break annually.** Scripts address Adobe apps by exact version name, so a CC upgrade can stop everything working. Keep that string in one place, and make the CLI say *"I can't find Adobe Photoshop 2026 — has it been upgraded?"* rather than failing obscurely. She has been told this will happen; make sure she can tell when it has. If you find yourself writing `require('illustrator')` in a UXP context, stop — that API is not public. ### Invocation ```bash # macOS — run a .jsx in a named app osascript -e 'tell application "Adobe Photoshop 2026" to do javascript file "/abs/path/script.jsx"' ``` ```powershell # Windows — COM $ps = New-Object -ComObject Photoshop.Application $ps.DoJavaScriptFile("C:\abs\path\script.jsx") ``` Wrap both behind a single cross-platform Node CLI so she never types either one. --- ## Architecture ``` brief (prose) ──► spec.json ──► runners ──► /out tree ──► proof PDF ▲ human review ``` `spec.json` is the single source of truth. It is generated from the client brief, corrected by her, then drives every export. It doubles as the scope document for quoting — that dual use is the point, don't design it away. ### Repo layout ``` adobe-ops/ bin/adobe-ops # Node CLI, the only thing she runs spec/schema.json # JSON Schema for spec.json spec/templates/ # identity.json, campaign.json, print.json scripts/photoshop/*.jsx scripts/illustrator/*.jsx scripts/indesign/*.jsx lib/invoke.js # OS detection + app dispatch lib/naming.js # her naming convention, single implementation out/ # generated, gitignored ENVIRONMENT.md RUNBOOK.md # written for her, plain language, screenshots ``` ### `spec.json` shape Design the schema around these fields. Validate with AJV and fail loudly with human-readable errors. ```jsonc { "client": "Acme", "project": "spring-campaign", "namingPattern": "{client}_{project}_{deliverable}_{variant}_{w}x{h}{density}.{ext}", "deliverables": [ { "id": "ig-feed", "source": "masters/hero.psd", "app": "photoshop", "exports": [ { "w": 1080, "h": 1080, "format": "jpg", "quality": 85, "colorSpace": "sRGB", "density": ["1x","2x"] } ] }, { "id": "logo-kit", "source": "masters/logo.ai", "app": "illustrator", "lockups": ["primary","stacked","mark"], "colorways": ["full","mono-black","reverse-white"], "formats": ["svg","eps","pdf","png"] }, { "id": "rack-card", "source": "masters/rack.indd", "app": "indesign", "preset": "PDF/X-4", "bleedMm": 3, "marks": true } ] } ``` --- ## Build order Ship each phase working before starting the next. She should have something useful after phase 1. Pace it the way she was pitched it: one finished thing per week, and nothing goes near a live client job until it has run clean on a finished old one. Week one, a single export she does constantly. Week two, the brief generator. Week three, the logo kit. Week four, her own website. Time her doing week one's export by hand first — the before-and-after number is worth having. ### Phase 1 — Photoshop export matrix The highest-value piece. Build first. - `scripts/photoshop/export-matrix.jsx` reads a JSON payload, walks `deliverables[].exports`, writes files to `out/`. - Handle: crop/fit strategies (contain vs cover vs smart-object swap), density multipliers, sRGB conversion, JPEG quality, PNG-24 with alpha, WebP if the version supports it. - **Preserve the master.** Duplicate the document, operate on the duplicate, close without saving. A script that dirties her PSD is a script she will never run again. - Wrap the whole run in a single history state where possible. - Return structured JSON on stdout: `{ ok, written: [...], skipped: [...], errors: [...] }`. The CLI prints a human summary. **Acceptance:** given a real PSD and a spec with 40+ exports, produces every file, correctly named, with the master unmodified, and reports a per-file result. ### Phase 2 — brief → spec.json - `adobe-ops brief` takes pasted prose (file or stdin) and emits a draft `spec.json`. The command is named for what she is doing, not for what it writes. - Ship 3 templates so common jobs start 90% complete. - Must open the draft for her review before anything runs. Never auto-execute a generated spec. - Diff view when regenerating over an existing spec. ### Phase 3 — Illustrator logo kit - `scripts/illustrator/logo-kit.jsx` — the classic identity handoff: every lockup × every colourway × every format. - Artboard-per-lockup convention in the source `.ai`; document it in RUNBOOK. - SVG export needs post-processing — run SVGO, strip Illustrator metadata, set `viewBox`. - EPS and PDF for print; PNG at 3 sizes for web. - ExtendScript is ES3-flavoured: no `let`, no arrow functions, no `JSON` object. Vendor a JSON polyfill in `lib/` and include it in every `.jsx`. Expect this to bite. ### Phase 4 — InDesign variants + print PDFs - Data merge from CSV for SKU/language variants. - PDF/X-4 export with bleed and marks via named presets. - Verify the preset exists before invoking; error clearly if not. ### Phase 5 — delivery This is `adobe-ops deliver`, the third verb. - Folder tree from `namingPattern`. - Contact-sheet proof PDF of everything generated — one artifact the client reviews. - Zip + manifest. --- ## Website build track Separate concern, same toolkit. The pitch she agreed to puts this in week four, on her own site — the pilot with no client risk. It does not depend on any of the phases above, so start it whenever she wants it rather than making her wait for phase 4. **Stack — pick boring, she has to maintain it:** - Astro, static output, Tailwind - Cloudflare Pages or Netlify — either one, free tier, no server to run - Forms: Netlify Forms or Formspree — no backend - CMS only if the client will actually edit: Decap or TinaCMS - No database, no auth, no server runtime **Deliver a starter template**, not a from-scratch build each time: her type scale, spacing, and component patterns pre-loaded so each new site starts from her design system rather than Tailwind defaults. **Scope guardrails** to encode in the template README: marketing sites, landing pages, portfolios, 1–15 pages, forms, blog. Refuse: auth, payments she'd build herself, databases, dashboards, regulated data. --- ## Rules for this session - **Read before writing.** Check the actual DOM for the app version installed; the Illustrator and Photoshop scripting DOMs differ in ways that are not guessable. - **Test each `.jsx` on a throwaway file first.** Never a client master. - **No silent failures.** Every script returns structured JSON; the CLI surfaces every error with the file that caused it. - **RUNBOOK.md is a deliverable, not documentation.** Written for a non-technical reader: what to click, what good output looks like, what to do when it doesn't. - Commit per phase with a working state. ## Open questions to resolve with Adam before phase 1 Do not start phase 1 until these are answered. Most of them she can answer on the spot — ask her. Whatever she can't, she takes to Adam. 1. macOS or Windows? Which CC versions? 2. Her exact naming convention and folder structure — get real examples from three past projects. 3. Which single export is most repeated? That's the phase 1 target. 4. Does she have a Creative Cloud plan that includes all five apps, or single-app licences? 5. Preferred storage for client delivery — Dropbox, WeTransfer, Drive? Affects phase 5. --- ## Reference - Illustrator scripting: `File > Scripts`, samples in `Adobe Illustrator <ver>/Scripting/Sample Scripts` - Photoshop MCP alternative if scripting proves too brittle: `@alisaitteke/photoshop-mcp` (npx, ~100 tools, has state/preview tools for self-correction) or `mikechambers/adb-mcp` (UXP plugin + Node proxy). Evaluate only if phase 1 stalls — direct scripting is simpler and has fewer moving parts. - Adobe's official remote MCP (`adobe-creativity.adobe.io/mcp`) operates at Express/Firefly tier, not full Photoshop/Illustrator. Not sufficient for this work.