Skip to content

feat: category description generation (P0 #3)#6

Merged
roboshyim merged 1 commit into
mainfrom
feat/category-copy
Jul 21, 2026
Merged

feat: category description generation (P0 #3)#6
roboshyim merged 1 commit into
mainfrom
feat/category-copy

Conversation

@roboshyim

Copy link
Copy Markdown
Collaborator

What

Adds AI-generated category descriptions — the category half of P0 roadmap item #3 (category & manufacturer copy). Mirrors the existing product-description feature end-to-end.

Changes

  • CategoryDescriptionGenerator (src/Feature/CategoryDescription/): feature-flag gates (master + per-feature), language resolution via LanguageEntity, shared tone presets (ProductDescriptionToneStore), builds a category-specific system+user prompt (name, parent-category breadcrumb, keywords, meta title/description, existing description), calls AiClient with Capability::TextGeneration, sanitizes HTML. Reuses the shared tone store so category copy follows the same merchant-defined tones.
  • CategoryDescriptionController: POST /api/_action/frosh-ai/category/generate-description + GET /api/_action/frosh-ai/category/description-status.
  • FeatureId::CategoryDescription + featureCategoryDescription config checkbox (en + de-DE).
  • services.xml registrations (generator + public controller).

Tests

CategoryDescriptionGeneratorTest (5 tests): master-disabled / feature-flag-off / missing-name gates, tone+language+HTML sanitization (markdown fences, script tags), locale resolution from languageId. Updated FeatureFlagsTest for the new flag.

101 tests / 396 assertions, green — verified locally and in the frosh-ai-dev container (Shopware 6.7 / PHP 8.3).

Notes

  • Admin UI button (a "generate" action on the category detail page) is a deliberate follow-up — this PR lands the generator + API + flag + tests.
  • Manufacturer copy (the other half of P0 feat: add native Anthropic Claude provider #3) reuses this exact pattern and is next.

- Add FeatureId::CategoryDescription with config key and label
- Add featureCategoryDescription checkbox to config.xml (en + de-DE)
- Create CategoryDescriptionGenerator mirroring ProductDescriptionGenerator
  - Reuses ProductDescriptionToneStore for shared tone presets
  - Accepts category context: name, parentCategories, keywords, metaTitle,
    metaDescription, existingDescription, tone, language, maxWords
- Create CategoryDescriptionController with POST /api/_action/frosh-ai/category/generate-description
  and GET /api/_action/frosh-ai/category/description-status
- Register generator + controller in services.xml
- Add CategoryDescriptionGeneratorTest (5 tests) and update FeatureFlagsTest
  for the new feature flag
@roboshyim
roboshyim merged commit 3d9d95a into main Jul 21, 2026
2 checks passed
roboshyim added a commit that referenced this pull request Jul 21, 2026
)

P0 roadmap item #6 — per-product AI summary of approved customer reviews
(summary/pros/cons/themes/reviewCount/averageRating) via chatStructured.

- ReviewSummaryGenerator: master + feature flag + provider gates, fetches
  up to 50 approved reviews (status=true, createdAt DESC, content capped
  at 500 chars each) from product_review.repository
- POST /api/_action/frosh-ai/product/review-summary {productId}
- GET  /api/_action/frosh-ai/product/review-summary-status
- FeatureId::ReviewSummary + featureReviewSummary config checkbox (en/de)
- Admin UI / storefront output intentionally left for follow-ups
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant