feat: AI-generated release illustrations (PR 3/3)#56
Conversation
Closes out the three-part image pipeline. PR 1 added pluggable storage, PR 2 added per-feature illustrations; this PR adds release-edition illustrations using the same provider abstraction and the same gating. CLI: - cli/src/image/release-prompt.ts — port the editorial "Special Edition" prompt from gitsky. Generic template only; Flux variant skipped to match PR 2's scope. Theme color passed in as hex (no name lookup). - cli/src/image/generate-release-image.ts — orchestrator. Hydrates top story details from the matched draft so the prompt gets full story+technicalDescription, not just the denormalized headline. - cli/src/image/mime.ts — extracted extension lookup so feature and release orchestrators share one normalizer. - cli/src/index.ts → processOneRelease — generate after assembleRelease, preserve the existing imageUrl when inputsHash is unchanged, backfill when missing, regenerate when the edition changed. Same non-blocking contract as feature images: failures log `image:failed(...)` and the release JSON still writes. - types/schema: add `imageUrl?: string` to Release. Site: - SpecialEditionCard renders the illustration between the hero text and the stats strip, with the gitsky vignette + gold-accent treatment. - ReleaseEditionHero un-defers the hero illustration block on the release detail page. - site Release type mirrors the optional imageUrl field. Tests: - 6 unit tests for the release prompt builder (substitution, top-stories rendering, releaseNotes truncation, null fallbacks). 85/85 pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdds AI-generated "Special Edition" release illustrations: prompt construction and tests, image generation/upload with MIME→extension utility, CLI integration to conditionally generate and preserve images, type/schema updates, and frontend components that render illustrations when ChangesRelease Image Generation Feature
Sequence DiagramsequenceDiagram
participant CLI as Release Pipeline
participant Prompt as Prompt Builder
participant ImageGen as Image Generator
participant Storage as Storage
participant Frontend as Frontend Renderer
CLI->>Prompt: pass release metadata (quip, story, notes, topStories, themeColor)
Prompt->>Prompt: format top stories, truncate notes, apply theme color
Prompt-->>ImageGen: full prompt text
ImageGen->>ImageGen: generate image buffer (returns mimeType + buffer)
ImageGen->>Storage: upload buffer with key `releases/{encodedTag}.{ext}`
Storage-->>ImageGen: storage URL
ImageGen-->>CLI: imageUrl
CLI->>CLI: write Release including imageUrl
Frontend->>Storage: request imageUrl
Storage-->>Frontend: image bytes
Frontend->>Frontend: render `EditionIllustration` / `HeroIllustration`
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Vercel preview — built from |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@site/src/components/ReleaseEditionHero.tsx`:
- Around line 35-56: HeroIllustration’s Image has no load-failure handling; add
an onError handler on the Image in the HeroIllustration component (and
optionally render a fallback element) so broken URLs don’t leave a broken image:
locate function HeroIllustration and the Image props and add an onError callback
that hides or replaces the failed image (e.g., set display none or swap to a
local fallback src or show a visually appropriate placeholder element) and
ensure the alt remains meaningful for accessibility.
In `@site/src/components/SpecialEditionCard.tsx`:
- Around line 37-57: EditionIllustration currently uses Next.js Image with
unoptimized and no error handling; verify whether the image host is included in
next/image remotePatterns or remove unoptimized to allow Next to optimize (check
Image usage in EditionIllustration and remotePatterns config referenced in
ReleaseEditionHero), and add a lightweight onError handler on the Image (e.g.,
in EditionIllustration using the url/tag props) to swap to a fallback image or
set a local error state to render an alternative UI so failed loads don't break
the card.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 4c647e59-3a52-40ef-83b5-38b5d76e0925
📒 Files selected for processing (11)
cli/src/image/generate-feature-image.tscli/src/image/generate-release-image.tscli/src/image/mime.tscli/src/image/release-prompt.test.tscli/src/image/release-prompt.tscli/src/index.tscli/src/schemas.tscli/src/types.tssite/src/components/ReleaseEditionHero.tsxsite/src/components/SpecialEditionCard.tsxsite/src/lib/releases.ts
Extract the EditionIllustration and HeroIllustration helpers from SpecialEditionCard / ReleaseEditionHero into a single client component file. Each tracks a 'failed' state and unmounts the whole vignette+ gold-accent container on the Image's onError — without the wrapper, a broken URL would leave a framed broken-image icon. Keeping the parent card and hero as server components avoids hydrating presentational markup that doesn't need it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
Summary
Closes the three-part image pipeline. PR 1 added the storage abstraction, PR 2 added per-feature illustrations, this PR adds release-edition illustrations using the same provider abstraction and the same opt-in gating.
assembleRelease. Preserve the existingimageUrlwhen the release'sinputsHashis unchanged. Backfill when an existing release has no image. Regenerate when the edition's content changed. Same non-blocking contract as feature images — failures logimage:failed(...)and the release JSON still writes.releases/<encodeFilename(tag)>.<ext>(mirrors the on-disk JSON filename).SpecialEditionCardrenders the illustration between the hero text and the stats strip;ReleaseEditionHeroun-defers the hero illustration block on the detail page. Both use the gitsky vignette + gold-accent treatment.extensionFromMimeTypetocli/src/image/mime.tsso feature and release orchestrators share one normalizer (the per-PR-comment fix from PR feat: AI-generated images for features (PR 2/3) #54 lived only ingenerate-feature-image.ts).Test plan
cd cli && yarn typecheck && yarn test— 85/85 (was 79, +6 release prompt tests).cd site && yarn typecheck && yarn test— green.cd cli && GITHUB_TOKEN=… GITPULSE_RELEASES_CAP=3 yarn analyze— observe[ … | image:stored]per release; verify uploadedreleases/<tag>.{png,jpg}URLs and that each release JSON gained animageUrl.skipped, images preserved (no extra Gemini calls).imageUrlfrom a single release JSON, re-run analyze — observe backfill (one new image, others unchanged).cd site && yarn devand visit/—SpecialEditionCardshows the illustration between the quip block and stats;/releases/<tag>shows the hero illustration above the release story.Out of scope
gitpulse image <release-URL>subcommand — feature stories have it (PR 2), releases don't yet. Easy follow-up if useful.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Tests