feat: pass CHARTMETRIC_REFRESH_TOKEN to sandbox environment#113
feat: pass CHARTMETRIC_REFRESH_TOKEN to sandbox environment#113sidneyswift wants to merge 2 commits intomainfrom
Conversation
Made-with: Cursor
Enables the artist-research and chartmetric skills to access Chartmetric analytics data inside sandboxes. Optional — omitted when the env var is not configured. Made-with: Cursor
📝 WalkthroughWalkthroughAdded customizable template instructions and motion prompts to the template system, introduced a new album-record-store template with comprehensive configuration files, and extended the sandbox environment to include the CHARTMETRIC_REFRESH_TOKEN. The template system now prioritizes custom instructions over generic defaults when available. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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.
Actionable comments posted: 1
🧹 Nitpick comments (2)
src/content/loadTemplate.ts (1)
140-144: Note:replace()only substitutes the first occurrence of each placeholder.If a
customMotionPromptcontains multiple{movement}or{mood}placeholders, only the first of each will be replaced. This is likely fine for current use cases, but worth noting if templates evolve.🔧 Optional: Use replaceAll for multiple placeholders
if (template.customMotionPrompt) { return template.customMotionPrompt - .replace("{movement}", movement) - .replace("{mood}", mood); + .replaceAll("{movement}", movement) + .replaceAll("{mood}", mood); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/content/loadTemplate.ts` around lines 140 - 144, The current custom prompt substitution in loadTemplate.ts uses String.prototype.replace which only replaces the first occurrence of "{movement}" and "{mood}" in template.customMotionPrompt; update the logic in the loadTemplate function where template.customMotionPrompt is handled to replace all occurrences (e.g., use replaceAll("{movement}", movement) and replaceAll("{mood}", mood) or use global regexes like .replace(/\{movement\}/g, movement) and .replace(/\{mood\}/g, mood)) so every placeholder instance in template.customMotionPrompt is substituted.src/content/templates/album-record-store/style-guide.json (1)
1-36: Consider splitting unrelated changes into separate PRs.This PR bundles two unrelated changes:
- Album-record-store template addition (Commit 1, this file)
- CHARTMETRIC_REFRESH_TOKEN sandbox environment variable (Commit 2, main PR objective)
Keeping changes focused in separate PRs improves reviewability, makes git history clearer, and simplifies rollback if needed.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/content/templates/album-record-store/style-guide.json` around lines 1 - 36, This PR mixes two unrelated changes: the new album-record-store template (the JSON with "name": "album-record-store" and its style-guide.json content) and the CHARTMETRIC_REFRESH_TOKEN sandbox env var; split them by removing the album-record-store addition from this branch/PR and creating a separate branch/PR that contains only the new template file (style-guide.json) and its assets, while keeping only the CHARTMETRIC_REFRESH_TOKEN environment variable change in the current PR; ensure the new PR references the template by its "name": "album-record-store" so reviewers can find it, and verify the current PR contains only the env var change for CHARTMETRIC_REFRESH_TOKEN before updating the branch.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/content/templates/album-record-store/style-guide.json`:
- Line 4: The usesFaceGuide flag in the template's style-guide.json is set to
true but the template contains "no person in the shot"; update the usesFaceGuide
property to false so the codepath that fetches face-guide.png (triggered by
usesFaceGuide) is skipped—locate the usesFaceGuide entry in the style-guide.json
and change its value from true to false.
---
Nitpick comments:
In `@src/content/loadTemplate.ts`:
- Around line 140-144: The current custom prompt substitution in loadTemplate.ts
uses String.prototype.replace which only replaces the first occurrence of
"{movement}" and "{mood}" in template.customMotionPrompt; update the logic in
the loadTemplate function where template.customMotionPrompt is handled to
replace all occurrences (e.g., use replaceAll("{movement}", movement) and
replaceAll("{mood}", mood) or use global regexes like .replace(/\{movement\}/g,
movement) and .replace(/\{mood\}/g, mood)) so every placeholder instance in
template.customMotionPrompt is substituted.
In `@src/content/templates/album-record-store/style-guide.json`:
- Around line 1-36: This PR mixes two unrelated changes: the new
album-record-store template (the JSON with "name": "album-record-store" and its
style-guide.json content) and the CHARTMETRIC_REFRESH_TOKEN sandbox env var;
split them by removing the album-record-store addition from this branch/PR and
creating a separate branch/PR that contains only the new template file
(style-guide.json) and its assets, while keeping only the
CHARTMETRIC_REFRESH_TOKEN environment variable change in the current PR; ensure
the new PR references the template by its "name": "album-record-store" so
reviewers can find it, and verify the current PR contains only the env var
change for CHARTMETRIC_REFRESH_TOKEN before updating the branch.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6d5bcbad-97f6-4505-971c-425ac87c8553
📒 Files selected for processing (9)
src/content/loadTemplate.tssrc/content/templates/album-record-store/caption-guide.jsonsrc/content/templates/album-record-store/references/captions/examples.jsonsrc/content/templates/album-record-store/style-guide.jsonsrc/content/templates/album-record-store/video-moods.jsonsrc/content/templates/album-record-store/video-movements.jsonsrc/sandboxes/__tests__/getSandboxEnv.test.tssrc/sandboxes/getSandboxEnv.tssrc/tasks/createContentTask.ts
| { | ||
| "name": "album-record-store", | ||
| "description": "Album cover art displayed in a gritty New York record store — vinyl spinning on a turntable", | ||
| "usesFaceGuide": true, |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Check usage of usesFaceGuide in the codebase to understand if it's referenced when customInstruction is set
# Search for usesFaceGuide references in TypeScript files
rg -n -C5 'usesFaceGuide' --type=ts
# Search for how customInstruction interacts with usesFaceGuide
rg -n -C5 'customInstruction.*usesFaceGuide|usesFaceGuide.*customInstruction' --type=tsRepository: recoupable/tasks
Length of output: 4672
Change usesFaceGuide to false — the template has no person in the shot, so fetching a face-guide image will fail or waste resources.
Line 4 sets usesFaceGuide: true, but the template explicitly states "no person in the shot" (lines 24–26). The usesFaceGuide flag triggers a GitHub fetch for face-guide.png (regardless of customInstruction), which will fail or be unnecessary for a template without people. Set usesFaceGuide: false.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/content/templates/album-record-store/style-guide.json` at line 4, The
usesFaceGuide flag in the template's style-guide.json is set to true but the
template contains "no person in the shot"; update the usesFaceGuide property to
false so the codepath that fetches face-guide.png (triggered by usesFaceGuide)
is skipped—locate the usesFaceGuide entry in the style-guide.json and change its
value from true to false.
Summary
CHARTMETRIC_REFRESH_TOKENtogetSandboxEnv()so the artist-research and chartmetric skills can access Chartmetric analytics data inside sandboxesGITHUB_TOKENTest plan
getSandboxEnvtests passCHARTMETRIC_REFRESH_TOKENto Trigger.dev project env varsMade with Cursor
Summary by CodeRabbit