Skip to content

Added Claude-powered image alt text generation#29317

Draft
vitrixbot wants to merge 12 commits into
TryGhost:mainfrom
vitrixbot:codex/claude-alt-text
Draft

Added Claude-powered image alt text generation#29317
vitrixbot wants to merge 12 commits into
TryGhost:mainfrom
vitrixbot:codex/claude-alt-text

Conversation

@vitrixbot

Copy link
Copy Markdown
Contributor

What changed

  • added a settings-backed Claude integration with a masked API-key configuration flow
  • added an authenticated Admin API endpoint that downloads Ghost/CDN images server-side and requests accessibility-focused alt text from Claude
  • added Generate controls for feature images and inline Koenig image cards
  • aligned feature-image alt-text validation with the existing 2,000-character storage limit
  • protected the Claude API key from imports and exports
  • added migration, API, service, settings, Ember editor, and Koenig coverage

Why

Writing useful alt text is easy to miss during publishing. This adds an optional editor workflow that generates a concise description while keeping the provider credential server-side. Existing alt text is only replaced after a successful response and is preserved when generation fails.

Koenig now lives in this monorepo, so the inline-image callback and UI are implemented directly in koenig/koenig-lexical without an external package release or dependency version bump.

Validation

  • 285 focused automated tests passed across Ghost Core, Ghost Admin, Admin X settings, and Koenig
  • Koenig image-card acceptance suite: 38 passed, 2 existing skips
  • verified the Claude key save, masked, active, clear, and inactive states in Ghost Admin
  • verified feature-image and inline-image Generate controls in the live editor
  • verified existing alt text is preserved and inline errors are surfaced when generation is rejected
  • verified the temporary API key and browser-test draft were removed after testing

vitrixbot added 10 commits July 14, 2026 16:41
no ref

- keeps Claude credentials server-side while making the setting available to both Admin clients
- aligns feature image alt text validation with the existing 2000-character storage limit
no ref

- keeps image fetching and Claude credentials on the server behind an authenticated editor endpoint
- validates Ghost image URLs and image data before sending a bounded request to Claude
no ref

- gives administrators a built-in integration card for configuring server-side alt text generation
- masks saved credentials and provides an explicit clear action so enablement follows key presence
no ref

- lets configured editors replace feature image alt text without exposing the Claude key
- blocks duplicate requests and preserves existing descriptions when generation fails
Expose the shared image alt text service to Koenig only when Claude is configured so inline cards can use the same protected backend flow as feature images.
no ref

Fresh test databases need to reflect migrated installs, and API cleanup keeps the shared settings cache isolated for the rest of the suite.
no ref

The upgrade path needs a direct assertion that the versioned migration inserts the nullable setting with the expected type and group.
no ref

Koenig now lives in the monorepo, so the feature branch needs the current workspace layout before integrating editor source changes.

# Conflicts:
#	ghost/admin/app/styles/layouts/editor.css
no ref

- exposes an optional card callback without coupling the editor package to a provider
- replaces image alt text on success while preserving it and showing feedback on failure
no ref

Keep the legacy alt toggle structure unless generated alt text controls are visible, avoiding markup regressions for existing image card states.
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 937345d9-5c35-494d-a98a-fc7da0e3e7ce

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the migration [pull request] Includes migration for review label Jul 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

It looks like this PR contains a migration 👀
Here's the checklist for reviewing migrations:

General requirements

  • ⚠️ Tested performance on staging database servers, as performance on local machines is not comparable to a production environment
  • Satisfies idempotency requirement (both up() and down())
  • Does not reference models
  • Filename is in the correct format (and correctly ordered)
  • Targets the next minor version
  • All code paths have appropriate log messages
  • Uses the correct utils
  • Contains a minimal changeset
  • Does not mix DDL/DML operations
  • Tested in MySQL and SQLite

Schema changes

  • Both schema change and related migration have been implemented
  • For index changes: has been performance tested for large tables
  • For new tables/columns: fields use the appropriate predefined field lengths
  • For new tables/columns: field names follow the appropriate conventions
  • Does not drop a non-alpha table outside of a major version

Data changes

  • Mass updates/inserts are batched appropriately
  • Does not loop over large tables/datasets
  • Defends against missing or invalid data
  • For settings updates: follows the appropriate guidelines

@nx-cloud

nx-cloud Bot commented Jul 14, 2026

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit f374753

Command Status Duration Result
nx run @tryghost/admin-x-settings:test:acceptance ✅ Succeeded 9m 58s View ↗
nx run-many --target=build --projects=tag:publi... ✅ Succeeded <1s View ↗
nx run ghost:test:ci:integration ✅ Succeeded 2m 9s View ↗
nx run-many -t test:unit -p @tryghost/admin-x-f... ✅ Succeeded 6m 19s View ↗
nx run ghost:test:integration ✅ Succeeded 2m 48s View ↗
nx run ghost:test:legacy ✅ Succeeded 2m 59s View ↗
nx run ghost-admin:test ✅ Succeeded 2m 57s View ↗
nx run @tryghost/koenig-lexical:test:acceptance ✅ Succeeded 2m 23s View ↗
Additional runs (8) ✅ Succeeded ... View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-07-14 20:17:55 UTC

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 51.02041% with 120 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.00%. Comparing base (0fa9d88) to head (f374753).
⚠️ Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
.../services/image-alt-text/image-alt-text-service.js 27.56% 113 Missing ⚠️
.../core/core/server/services/image-alt-text/index.js 66.66% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #29317      +/-   ##
==========================================
+ Coverage   73.99%   74.00%   +0.01%     
==========================================
  Files        1572     1580       +8     
  Lines      136697   137062     +365     
  Branches    16520    16585      +65     
==========================================
+ Hits       101143   101438     +295     
- Misses      34560    34615      +55     
- Partials      994     1009      +15     
Flag Coverage Δ
admin-tests 55.43% <100.00%> (+0.53%) ⬆️
e2e-tests 76.09% <46.18%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

migration [pull request] Includes migration for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant