feat: add artist-release-editorial content template#408
Conversation
Register the new artist-release-editorial template for editorial-style release promos featuring artist press photos, playlist covers, and DSP branding. Co-Authored-By: Paperclip <noreply@paperclip.ing>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 22 minutes and 18 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdded a new content template entry Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant MentionHandler
participant AttachmentExtractor
participant ContentService
Note over MentionHandler,AttachmentExtractor: Multi-image support added
User->>MentionHandler: `@mention` with attachments
MentionHandler->>AttachmentExtractor: extractMessageAttachments(message)
AttachmentExtractor-->>MentionHandler: imageUrls[]
MentionHandler->>ContentService: createContent(payload with images: imageUrls)
ContentService-->>MentionHandler: creationResult
MentionHandler-->>User: Ack ("Images: <n> attached" / creation status)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
lib/content/contentTemplates.ts (1)
38-41: Make the JSDoc meaningful or remove it.This block is currently empty and doesn’t add context beyond the function signature. Either add a short behavioral note (e.g., exact matching against
CONTENT_TEMPLATES) or remove it to reduce noise.As per coding guidelines, "Use meaningful comments, not obvious ones".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/content/contentTemplates.ts` around lines 38 - 41, The JSDoc block for the function parameter "template" is empty and should either be removed or replaced with a concise behavioral comment describing what the function does (e.g., that it performs an exact or fuzzy match against CONTENT_TEMPLATES, expected input shape of the template parameter, and the return value/side-effects). Update the JSDoc to mention "template" and reference CONTENT_TEMPLATES and the function behavior (matching strategy and return type), or delete the empty JSDoc entirely to avoid noisy/obvious comments.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@lib/content/contentTemplates.ts`:
- Around line 38-41: The JSDoc block for the function parameter "template" is
empty and should either be removed or replaced with a concise behavioral comment
describing what the function does (e.g., that it performs an exact or fuzzy
match against CONTENT_TEMPLATES, expected input shape of the template parameter,
and the return value/side-effects). Update the JSDoc to mention "template" and
reference CONTENT_TEMPLATES and the function behavior (matching strategy and
return type), or delete the empty JSDoc entirely to avoid noisy/obvious
comments.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 7bf6ec99-440a-4cf5-a4c5-907484072e39
⛔ Files ignored due to path filters (1)
lib/content/__tests__/contentTemplates.test.tsis excluded by!**/*.test.*,!**/__tests__/**and included bylib/**
📒 Files selected for processing (1)
lib/content/contentTemplates.ts
There was a problem hiding this comment.
No issues found across 2 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: This is a low-risk, additive change that registers a new content template name and includes corresponding unit tests.
Architecture diagram
sequenceDiagram
participant UI as Client UI
participant API as Content API (/api/content)
participant Validator as Template Validator
participant Registry as Template Registry
Note over UI,Registry: Template Discovery Flow
UI->>API: GET /templates
API->>Registry: Access CONTENT_TEMPLATES
Note right of Registry: NEW: Includes artist-release-editorial
Registry-->>API: Return list of templates
API-->>UI: 200 OK (JSON array)
Note over UI,Registry: Content Creation Flow
UI->>API: POST /create { template: "artist-release-editorial", ... }
API->>Validator: NEW: isSupportedContentTemplate("artist-release-editorial")
Validator->>Registry: Check template name against CONTENT_TEMPLATES
alt Template Found
Registry-->>Validator: Match found
Validator-->>API: true
API->>API: Proceed with content generation
API-->>UI: 201 Created
else Template Not Found
Registry-->>Validator: No match
Validator-->>API: false
API-->>UI: 400 Bad Request
end
extractMessageAttachments now returns imageUrls (string[]) instead of imageUrl (string | null), collecting all image attachments rather than only the first. registerOnNewMention passes the full array to the content pipeline so multiple playlist covers / logos are forwarded. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
🧹 Nitpick comments (2)
lib/agents/content/handlers/registerOnNewMention.ts (2)
21-22: Consider extracting hardcoded UUIDs to configuration.These hardcoded account IDs reduce flexibility and make testing more difficult. Consider moving them to a configuration object or environment variables, or accepting them as parameters.
- const accountId = "fb678396-a68f-4294-ae50-b8cacf9ce77b"; - const artistAccountId = "1873859c-dd37-4e9a-9bac-80d3558527a9"; + const accountId = config.contentAgent.defaultAccountId; + const artistAccountId = config.contentAgent.defaultArtistAccountId;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/agents/content/handlers/registerOnNewMention.ts` around lines 21 - 22, Replace the hardcoded UUIDs in registerOnNewMention.ts by reading them from configuration or parameters: stop using the inline constants accountId and artistAccountId and instead obtain their values from a config object/environment variables or function arguments (e.g., config.accountId / process.env.ACCOUNT_ID or add parameters to registerOnNewMention). Update any call sites that construct or invoke registerOnNewMention to pass the IDs if you choose parameters, and add sensible defaults/fallbacks and validation for missing/invalid IDs.
19-137: Inner callback exceeds recommended function length.The
onNewMentioncallback spans ~118 lines and handles multiple distinct responsibilities: prompt parsing, attachment extraction, artist resolution, repo lookup, acknowledgment posting, content triggering, and polling setup.Consider extracting cohesive steps into focused helper functions (e.g.,
resolveArtistContext,buildContentPayload,postAcknowledgment) to improve testability and readability. This aligns with the Single Responsibility Principle and the guideline to keep functions under 50 lines.As per coding guidelines: "Flag functions longer than 20 lines" and "Keep functions under 50 lines".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/agents/content/handlers/registerOnNewMention.ts` around lines 19 - 137, The onNewMention callback is too large and handles multiple responsibilities; refactor it by extracting cohesive helper functions: implement resolveArtistContext(accountId, artistAccountId) to encapsulate resolveArtistSlug, getArtistContentReadiness and fallback selectAccountSnapshots logic; implement buildContentPayload({accountId, artistSlug, template, lipsync, captionLength, upscale, githubRepo, songs, imageUrls}) to construct the payload currently assembled inline; and implement postAcknowledgment(thread, {artistSlug, template, batch, lipsync, songs, songUrl, imageUrls}) to handle the details message and initial thread.post. Replace the large inline blocks in onNewMention with calls to these helpers and keep error handling and polling (triggerCreateContent, triggerPollContentRun) in the top-level callback.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@lib/agents/content/handlers/registerOnNewMention.ts`:
- Around line 21-22: Replace the hardcoded UUIDs in registerOnNewMention.ts by
reading them from configuration or parameters: stop using the inline constants
accountId and artistAccountId and instead obtain their values from a config
object/environment variables or function arguments (e.g., config.accountId /
process.env.ACCOUNT_ID or add parameters to registerOnNewMention). Update any
call sites that construct or invoke registerOnNewMention to pass the IDs if you
choose parameters, and add sensible defaults/fallbacks and validation for
missing/invalid IDs.
- Around line 19-137: The onNewMention callback is too large and handles
multiple responsibilities; refactor it by extracting cohesive helper functions:
implement resolveArtistContext(accountId, artistAccountId) to encapsulate
resolveArtistSlug, getArtistContentReadiness and fallback selectAccountSnapshots
logic; implement buildContentPayload({accountId, artistSlug, template, lipsync,
captionLength, upscale, githubRepo, songs, imageUrls}) to construct the payload
currently assembled inline; and implement postAcknowledgment(thread,
{artistSlug, template, batch, lipsync, songs, songUrl, imageUrls}) to handle the
details message and initial thread.post. Replace the large inline blocks in
onNewMention with calls to these helpers and keep error handling and polling
(triggerCreateContent, triggerPollContentRun) in the top-level callback.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 27dd356c-d284-4a26-9f4b-217a5c111013
⛔ Files ignored due to path filters (2)
lib/agents/content/__tests__/extractMessageAttachments.test.tsis excluded by!**/*.test.*,!**/__tests__/**and included bylib/**lib/agents/content/__tests__/registerOnNewMention.test.tsis excluded by!**/*.test.*,!**/__tests__/**and included bylib/**
📒 Files selected for processing (2)
lib/agents/content/extractMessageAttachments.tslib/agents/content/handlers/registerOnNewMention.ts
…ditorial-template
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This reverts commit 023643b.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
lib/content/contentTemplates.ts
Outdated
| * | ||
| * @param template | ||
| */ | ||
| export function isSupportedContentTemplate(template: string): boolean { |
There was a problem hiding this comment.
SRP - new lib file for the isSupportedContentTemplate function.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
artist-release-editorialto theCONTENT_TEMPLATESregistry — editorial-style release promos featuring artist press photos, playlist covers, and DSP brandingTest plan
contentTemplates.test.ts— verifies template exists in registry andisSupportedContentTemplatereturns trueGET /api/content/templatesreturns the new template in the listtemplate: "artist-release-editorial"passes validation🤖 Generated with Claude Code
Summary by cubic
Adds the
artist-release-editorialcontent template and registers it inCONTENT_TEMPLATESwithdefaultLipsync: false, and extractsisSupportedContentTemplateinto its own module. Enables multi-image attachments by returningimageUrls: string[]fromextractMessageAttachments, forwarding all images inregisterOnNewMention, and updating the acknowledgment to show the image count; tests cover template validation and multi-image cases.Written for commit c2f38a2. Summary will update on new commits.
Summary by CodeRabbit
New Features
Documentation