Skip to content

feat: add artist-release-editorial content template#408

Merged
sweetmantech merged 7 commits intotestfrom
feat/artist-release-editorial-template
Apr 8, 2026
Merged

feat: add artist-release-editorial content template#408
sweetmantech merged 7 commits intotestfrom
feat/artist-release-editorial-template

Conversation

@recoup-coding-agent
Copy link
Copy Markdown
Collaborator

@recoup-coding-agent recoup-coding-agent commented Apr 7, 2026

Summary

  • Adds artist-release-editorial to the CONTENT_TEMPLATES registry — editorial-style release promos featuring artist press photos, playlist covers, and DSP branding
  • New template test verifying registration and validation

Test plan

  • Unit test: contentTemplates.test.ts — verifies template exists in registry and isSupportedContentTemplate returns true
  • GET /api/content/templates returns the new template in the list
  • Content creation with template: "artist-release-editorial" passes validation

🤖 Generated with Claude Code


Summary by cubic

Adds the artist-release-editorial content template and registers it in CONTENT_TEMPLATES with defaultLipsync: false, and extracts isSupportedContentTemplate into its own module. Enables multi-image attachments by returning imageUrls: string[] from extractMessageAttachments, forwarding all images in registerOnNewMention, 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

    • Added an "artist-release-editorial" content template for editorial-style promo layouts.
    • Multi-image attachment support: users can attach multiple images; content creation will include all images and acknowledgements now show the image count.
  • Documentation

    • Improved documentation for content template utilities.

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>
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
recoup-api Ready Ready Preview Apr 8, 2026 4:13pm

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 7, 2026

Warning

Rate limit exceeded

@sweetmantech has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 22 minutes and 18 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0846a0ba-3879-4ebe-8c76-0fc34f1262e2

📥 Commits

Reviewing files that changed from the base of the PR and between 4b2e488 and c2f38a2.

⛔ Files ignored due to path filters (2)
  • lib/agents/content/__tests__/extractMessageAttachments.test.ts is excluded by !**/*.test.*, !**/__tests__/** and included by lib/**
  • lib/content/__tests__/contentTemplates.test.ts is excluded by !**/*.test.*, !**/__tests__/** and included by lib/**
📒 Files selected for processing (3)
  • lib/content/contentTemplates.ts
  • lib/content/isSupportedContentTemplate.ts
  • lib/content/validateCreateContentBody.ts
📝 Walkthrough

Walkthrough

Added a new content template entry artist-release-editorial and expanded image attachment handling from a single imageUrl to multiple imageUrls, with the mention-handling flow updated to acknowledge and forward multiple images.

Changes

Cohort / File(s) Summary
Content Template Configuration
lib/content/contentTemplates.ts
Added a new CONTENT_TEMPLATES entry artist-release-editorial (description + defaultLipsync: false) and added JSDoc for isSupportedContentTemplate.
Attachment Extraction
lib/agents/content/extractMessageAttachments.ts
Changed ExtractedAttachments shape from `imageUrl: string
Mention Handler / Content Creation
lib/agents/content/handlers/registerOnNewMention.ts
Updated handler to consume imageUrls array, adjust acknowledgment message to report image count, and pass images: imageUrls in content creation payload when present.

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)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🎨 New templates and many images align,
From single URL to an array divine,
Mentions now count every visual cue,
Payloads carry multiple frames through,
Small edits, cleaner flow — the pipeline shines.

🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Solid & Clean Code ✅ Passed Code changes maintain SOLID principles: Single Responsibility (focused modules), Open/Closed (extensible design with imageUrl→imageUrls), and proper interface contracts. Implementation is clean, consistent with existing patterns, and avoids duplication.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/artist-release-editorial-template

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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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

📥 Commits

Reviewing files that changed from the base of the PR and between 85fa5b8 and 3d7ce43.

⛔ Files ignored due to path filters (1)
  • lib/content/__tests__/contentTemplates.test.ts is excluded by !**/*.test.*, !**/__tests__/** and included by lib/**
📒 Files selected for processing (1)
  • lib/content/contentTemplates.ts

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Loading

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>
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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 onNewMention callback 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

📥 Commits

Reviewing files that changed from the base of the PR and between 3d7ce43 and 4b2e488.

⛔ Files ignored due to path filters (2)
  • lib/agents/content/__tests__/extractMessageAttachments.test.ts is excluded by !**/*.test.*, !**/__tests__/** and included by lib/**
  • lib/agents/content/__tests__/registerOnNewMention.test.ts is excluded by !**/*.test.*, !**/__tests__/** and included by lib/**
📒 Files selected for processing (2)
  • lib/agents/content/extractMessageAttachments.ts
  • lib/agents/content/handlers/registerOnNewMention.ts

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 4 files (changes from recent commits).

Requires human review: Refactors attachment processing logic to support multiple images and changes internal data structures in a core agent handler, which warrants human verification.

sweetmantech and others added 4 commits April 8, 2026 11:03
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
*
* @param template
*/
export function isSupportedContentTemplate(template: string): boolean {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SRP - new lib file for the isSupportedContentTemplate function.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 1 file (changes from recent commits).

Requires human review: Adds a new content template and modifies core logic to support multiple image attachments, which changes the payload structure for the content generation pipeline.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 4 files (changes from recent commits).

Auto-approved: Adds 'artist-release-editorial' template and enables multi-image support. Low risk as the downstream API already expected an array of images. Includes thorough test coverage.

@sweetmantech sweetmantech merged commit fe1e264 into test Apr 8, 2026
5 of 6 checks passed
@sweetmantech sweetmantech deleted the feat/artist-release-editorial-template branch April 8, 2026 18:41
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.

2 participants