Skip to content

agent: @U0AJM7X8FBR Admin - please update the mono/admin repo with a table show#93

Open
recoup-coding-agent wants to merge 1 commit intomainfrom
agent/-u0ajm7x8fbr-admin---please-up-1773608074198
Open

agent: @U0AJM7X8FBR Admin - please update the mono/admin repo with a table show#93
recoup-coding-agent wants to merge 1 commit intomainfrom
agent/-u0ajm7x8fbr-admin---please-up-1773608074198

Conversation

@recoup-coding-agent
Copy link
Copy Markdown
Collaborator

@recoup-coding-agent recoup-coding-agent commented Mar 15, 2026

Automated PR from coding agent.

Summary by CodeRabbit

  • Chores
    • Applied code formatting standardization across the codebase, including consistent parameter formatting and code organization.
    • Enhanced code documentation with additional JSDoc parameter annotations throughout multiple modules.
    • Adjusted task timeout configuration for improved performance.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 15, 2026

📝 Walkthrough

Walkthrough

Large-scale formatting and documentation refactoring affecting 80+ files. Changes include single-lining multi-line function signatures, adding JSDoc parameter annotations, normalizing arrow function syntax, and minor behavioral adjustments in task configuration and sandbox setup logic.

Changes

Cohort / File(s) Summary
Artist utilities
src/artists/getBatchArtistSocials.ts, src/artists/isScrapableSocial.ts
Added JSDoc parameter tags and simplified formatting; no behavioral changes.
Chat and Polling
src/chats/getTaskRoomId.ts, src/polling/pollScraperResults.ts
Reformatted function signatures from multi-line to single-line; added JSDoc tags.
Content Pipeline Config
src/content/defaultPipelineConfig.ts
Reformatted AspectRatio union type from single-line to multi-line block for readability.
Content Context Fetching
src/content/fetchArtistContext.ts, src/content/fetchAudienceContext.ts, src/content/fetchGithubFile.ts
Added comprehensive JSDoc parameter documentation; consolidated function calls to single lines.
Content Generation & Audio
src/content/analyzeClips.ts, src/content/generateAudioVideo.ts, src/content/generateCaption.ts, src/content/generateContentImage.ts, src/content/generateContentVideo.ts, src/content/upscaleImage.ts, src/content/upscaleVideo.ts
Added detailed JSDoc for function parameters; refactored ffmpeg argument arrays; introduced extractFalUrl helper in upscaleVideo; minor inlining of calculations.
Content Processing & Rendering
src/content/listArtistSongs.ts, src/content/loadTemplate.ts, src/content/renderFinalVideo.ts, src/content/selectAudioClip.ts, src/content/testPipeline.ts, src/content/transcribeSong.ts
Enhanced JSDoc documentation; added loadState function to testPipeline; consolidated string expressions; introduced getOrgRepoUrls helper; restructured error handling with explicit exit calls.
Constants & Schemas
src/consts.ts, src/schemas/contentCreationSchema.ts, src/schemas/sandboxSchema.ts
Minor trailing newline/formatting adjustments; no functional changes.
GitHub Repository Management
src/github/createGithubRepo.ts, src/github/createOrgGithubRepo.ts, src/github/getExistingGithubRepo.ts, src/github/__tests__/*
Consolidated fetch call formatting to single lines; added trailing commas to function parameters; collapsed test string literals.
Pulse & Sandbox Execution
src/pulse/executePulseInSandbox.ts, src/pulse/__tests__/*
Added JSDoc parameter documentation; minor test assertion reformatting.
Recoup Account & Chat Services
src/recoup/createAccountSandbox.ts, src/recoup/createChat.ts, src/recoup/fetchActivePulses.ts, src/recoup/fetchTask.ts, src/recoup/generateChat.ts, src/recoup/getAccount.ts, src/recoup/getAccountOrgs.ts, src/recoup/getAccountSandboxes.ts, src/recoup/getArtistSocials.ts, src/recoup/getProArtists.ts, src/recoup/getScraperResults.ts, src/recoup/scrapeSocial.ts, src/recoup/updateAccountSnapshot.ts, src/recoup/__tests__/*
Systematic signature reformatting to single lines; added trailing commas; added JSDoc blocks; normalized arrow function syntax (e.g., (p) => to p =>); minor test assertion consolidation.
Sandbox Core Operations
src/sandboxes/cloneMonorepoViaAgent.ts, src/sandboxes/configureGitAuth.ts, src/sandboxes/ensureGithubRepo.ts, src/sandboxes/ensureOrgRepos.ts, src/sandboxes/ensureSetupSandbox.ts, src/sandboxes/getOrCreateSandbox.ts, src/sandboxes/getSandboxEnv.ts, src/sandboxes/getVercelSandboxCredentials.ts, src/sandboxes/installSkill.ts, src/sandboxes/logStep.ts, src/sandboxes/notifyCodingAgentCallback.ts, src/sandboxes/onboardOpenClaw.ts, src/sandboxes/parsePRUrls.ts, src/sandboxEnv/pushSandboxToGithub.ts, src/sandboxes/setupOpenClaw.ts, src/sandboxes/snapshotAndPersist.ts, src/sandboxes/writeReadme.ts
Refactored signatures to single-line format; added trailing commas; introduced early validation for GITHUB_TOKEN in ensureOrgRepos; added enhanced logging; normalized arrow function syntax.
Sandbox Git Operations
src/sandboxes/git/addOrgSubmodules.ts, src/sandboxes/git/pushOrgRepos.ts, src/sandboxes/runGitCommand.ts
Normalized arrow function callbacks (removing parentheses from single parameters); added JSDoc annotations.
Sandbox Test Utilities
src/sandboxes/__tests__/*
Added JSDoc helper function documentation; consolidated multi-line test assertions to single lines; added trailing commas to arrow function predicates; extended mockDetachedCommand with stderr property.
Socials & Scraping
src/socials/filterScrapableSocials.ts, src/socials/scrapeAndPollSocials.ts
Added JSDoc parameter annotations; refactored Map generic type to single-line; added trailing comma to batchSize parameter.
Task Configuration & Orchestration
src/tasks/codingAgentTask.ts, src/tasks/createContentTask.ts, src/tasks/customerPromptTask.ts, src/tasks/proArtistSocialProfilesScrape.ts, src/tasks/runSandboxCommandTask.ts, src/tasks/sendPulsesTask.ts, src/tasks/setupSandboxTask.ts, src/tasks/updatePRTask.ts
Reduced maxDuration in codingAgentTask from 30 to 15 minutes; normalized arrow function syntax (removing parentheses); consolidated function call arguments; reformatted multi-line expressions to single lines; minor test mock object formatting adjustments.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 Hopping through the code with JSDoc cheer,
Trailing commas placed with utmost care,
Single lines where multilines once were,
Arrow functions trimmed without despair!
Eighty files now tidied, formatted right,
Our refactored burrow shines so bright!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title is vague and incomplete, referencing a specific user ID and an unclear directive about updating a repo with 'a table show' without explaining what changes were made. Revise the title to clearly describe the main changes made in the PR, such as 'Add formatting and documentation improvements across content, sandbox, and task modules' or similar concise summary of the actual modifications.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch agent/-u0ajm7x8fbr-admin---please-up-1773608074198
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Actionable comments posted: 10

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
src/content/listArtistSongs.ts (1)

102-131: 🛠️ Refactor suggestion | 🟠 Major

Extract getOrgRepoUrls to a shared utility module to follow DRY principle.

This function is duplicated in both src/content/listArtistSongs.ts (lines 107–131) and src/content/fetchGithubFile.ts (lines 80–95). Both implement identical parsing logic for .gitmodules files using the same regex pattern, though they use different fetch mechanisms (direct API call vs. the fetchFileFromRepo helper).

Extract the shared parsing logic into a reusable utility that both files can import, or consolidate to use a single fetch approach.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/listArtistSongs.ts` around lines 102 - 131, The getOrgRepoUrls
function is duplicated; extract the parsing logic that reads .gitmodules text
and returns git submodule URLs into a shared utility (e.g., parseGitmodulesText
or extractGitmoduleUrls) and have both getOrgRepoUrls (in listArtistSongs) and
the code in fetchGithubFile call that utility; keep network/fetch differences
(fetchFileFromRepo vs direct fetch) outside the utility so the new helper only
accepts the raw .gitmodules content string and returns string[] using the
existing regex (/url\s*=\s*(https:\/\/github\.com\/[^\s]+)/g), then replace the
duplicated loops with calls to this helper in both getOrgRepoUrls and the other
consumer.
src/socials/scrapeAndPollSocials.ts (1)

16-23: ⚠️ Potential issue | 🔴 Critical

Guard batchSize to prevent non-terminating loops.

At Line 22, a batchSize of 0 (or negative) can break loop progress and hang execution.

Suggested fix
 export async function scrapeAndPollSocials(
   socials: ScrapableSocial[],
   batchSize: number = SCRAPE_BATCH_SIZE,
 ): Promise<PollResult[]> {
+  if (!Number.isInteger(batchSize) || batchSize <= 0) {
+    throw new Error("batchSize must be a positive integer");
+  }
+
   const allResults: PollResult[] = [];
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/socials/scrapeAndPollSocials.ts` around lines 16 - 23, The for-loop in
scrapeAndPollSocials can hang if batchSize is 0 or negative; guard the batchSize
parameter at the top of the scrapeAndPollSocials function (or before the loop)
by validating if batchSize is a positive integer and if not, either set it to
the default SCRAPE_BATCH_SIZE or throw a descriptive error; reference the
batchSize parameter and the for loop that slices socials (socials.slice(i, i +
batchSize)) when making the change.
src/sandboxes/ensureOrgRepos.ts (1)

51-54: ⚠️ Potential issue | 🟠 Major

Use a unique workspace folder name per org.

createOrgGithubRepo() makes the remote repo unique by organizationId, but the local clone name drops that and only keeps the sanitized org name. If two orgs sanitize to the same slug, both prompt entries target the same orgs/{name} path and one repo can overwrite the other. Include the org ID in the local directory name or explicitly reject collisions before building repoList.

Minimal fix example
-      name: sanitizeRepoName(org.organizationName),
+      name: `${sanitizeRepoName(org.organizationName)}-${org.organizationId}`,

Also applies to: 63-63

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/sandboxes/ensureOrgRepos.ts` around lines 51 - 54, The current orgRepos
entry uses sanitizeRepoName(org.organizationName) which can collide for
different orgs; update the logic in ensureOrgRepos.ts (where orgRepos is pushed
and in createOrgGithubRepo()) to include the org's unique identifier (e.g.,
organizationId) in the local folder/slug (for example append or prefix
organizationId to sanitizeRepoName) or validate and throw on name collisions
before building repoList; ensure all places that consume orgRepos (the
createOrgGithubRepo call/site) use the new combined slug so local clone paths
are unique per org.
🧹 Nitpick comments (41)
src/sandboxes/__tests__/stripGitmodulesTokens.test.ts (1)

9-11: Remove or document the empty JSDoc block.

Line 9 introduces an empty comment block with no content. Either remove it or add meaningful helper docs to avoid dead commentary.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/sandboxes/__tests__/stripGitmodulesTokens.test.ts` around lines 9 - 11,
Remove the empty JSDoc block introduced at the top of
src/sandboxes/__tests__/stripGitmodulesTokens.test.ts or replace it with a short
meaningful comment describing the test file's purpose (e.g., what
stripGitmodulesTokens behavior is being validated); ensure there are no other
blank JSDoc blocks left in this test file so the repository contains only useful
documentation.
src/content/upscaleImage.ts (1)

40-43: Incomplete JSDoc and duplicated utility function.

The added JSDoc comment is empty and provides no meaningful documentation. If documenting this function, include a proper description explaining its purpose (e.g., "Extracts the URL from various Fal API response formats").

Additionally, extractFalUrl is duplicated verbatim in upscaleVideo.ts and generateContentVideo.ts. Consider extracting it to a shared utility file.

📝 Suggested JSDoc improvement
 /**
- *
- * `@param` data
+ * Extracts the URL from various Fal API response formats.
+ * Checks image/video objects, then images/videos arrays, then falls back to data.url.
+ * `@param` data - The Fal API response data object
+ * `@returns` The extracted URL, or undefined if not found
  */

As per coding guidelines: "Extract shared logic into reusable utilities to follow DRY (Don't Repeat Yourself)".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/upscaleImage.ts` around lines 40 - 43, Replace the empty JSDoc
above the function with a clear one-line description like "Extracts the Fal API
image/video URL from various response shapes" and document the parameter and
return value; then remove the duplicated extractFalUrl implementation from
upscaleImage.ts (and from upscaleVideo.ts / generateContentVideo.ts) and move it
into a shared utility module (e.g., a new function export in a utils file),
updating callers to import extractFalUrl from that module so the logic is
single-sourced and documented.
src/recoup/getArtistSocials.ts (1)

34-37: Incomplete JSDoc documentation.

The @param tag lacks a description, and @returns is missing. Consider completing the documentation or removing the empty JSDoc stub.

📝 Suggested complete documentation
 /**
- *
- * `@param` artistAccountId
+ * Fetches social profiles for a given artist account.
+ * `@param` artistAccountId - The unique identifier of the artist account
+ * `@returns` Array of social profiles, or undefined if fetch fails
  */
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/recoup/getArtistSocials.ts` around lines 34 - 37, The JSDoc above
getArtistSocials is incomplete: add a clear description for the parameter
artistAccountId and add a `@returns` tag describing what getArtistSocials
resolves/returns (type and purpose), or remove the stub entirely; update the
comment block directly above the getArtistSocials function so it documents the
function behavior, input (artistAccountId: string or appropriate type) and the
return value (e.g., Promise<ArtistSocials> or null) to keep docs accurate.
src/sandboxes/__tests__/configureGitAuth.test.ts (1)

9-11: Remove the empty JSDoc block.

This comment block is empty and doesn’t document anything; removing it will reduce test noise.

✂️ Proposed cleanup
-/**
- *
- */
 function createMockSandbox() {
   const runCommand = vi.fn().mockResolvedValue({ exitCode: 0 });
   return { runCommand } as any;
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/sandboxes/__tests__/configureGitAuth.test.ts` around lines 9 - 11, Remove
the empty JSDoc comment block at the top of the test file (the standalone /** */
block found in configureGitAuth.test.ts) — simply delete that no-content comment
so the test file contains only actual test code and relevant comments.
src/sandboxes/__tests__/syncOrgRepos.test.ts (1)

10-12: Remove the empty docblock.

Line 10 introduces an empty /** ... */ block that doesn’t document anything and adds noise in tests.

Suggested cleanup
-/**
- *
- */
 function createMockSandbox() {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/sandboxes/__tests__/syncOrgRepos.test.ts` around lines 10 - 12, Remove
the empty JSDoc block (the standalone `/** ... */` at the top of the test file)
— it provides no documentation and should be deleted; simply delete that empty
docblock from src/sandboxes/__tests__/syncOrgRepos.test.ts so the file starts
with the test imports or first describe/it block.
src/content/analyzeClips.ts (1)

107-110: Extract duplicated fallback lyric construction into a helper.

The same lyrics.segments.slice(0, 10).map(...).join(" ") logic appears in both fallback branches. Pull it into a local helper for DRY and easier future edits.

Proposed refactor
 export async function analyzeClips(songTitle: string, lyrics: SongLyrics): Promise<SongClip[]> {
+  const buildFallbackLyrics = () =>
+    lyrics.segments.slice(0, 10).map(s => s.text).join(" ");
@@
     return [
       {
         startSeconds: 0,
-        lyrics: lyrics.segments
-          .slice(0, 10)
-          .map(s => s.text)
-          .join(" "),
+        lyrics: buildFallbackLyrics(),
         reason: "fallback — start of song",
         mood: "unknown",
         hasLyrics: true,
@@
     return [
       {
         startSeconds: 0,
-        lyrics: lyrics.segments
-          .slice(0, 10)
-          .map(s => s.text)
-          .join(" "),
+        lyrics: buildFallbackLyrics(),
         reason: "fallback — JSON parse failed",
         mood: "unknown",
         hasLyrics: true,

As per coding guidelines, "Extract shared logic into reusable utilities to follow DRY (Don't Repeat Yourself)".

Also applies to: 126-129

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/analyzeClips.ts` around lines 107 - 110, Extract the repeated
fallback construction lyrics.segments.slice(0, 10).map(s => s.text).join(" ")
into a small local helper (e.g., getFallbackLyrics or buildLyricFallback) that
accepts the lyrics object and returns the joined string, then replace the
duplicated expressions in both places (the block producing lyrics: ... at the
first occurrence and the second occurrence around lines 126-129) with calls to
that helper to keep logic DRY and centralized for future edits.
src/content/testPipeline.ts (3)

386-391: Consider a switch or object lookup for caption selection.

The nested ternary is readable with the current formatting, but a lookup object would be more extensible if more caption lengths are added later. This is optional given it's test utility code.

Alternative approach
const captions: Record<string, string> = {
  long: "sometimes you just gotta sit in the dark...", // full text
  medium: "sometimes you just gotta sit in the dark...", // medium text
};
const testCaption = captions[process.argv[3]] ?? "that one drawer holding all the memories you just can't throw away";
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/testPipeline.ts` around lines 386 - 391, Replace the nested
ternary that assigns testCaption (which checks process.argv[3]) with a clearer
lookup-based approach: create a captions lookup (e.g., const captions:
Record<string,string>) keyed by "long" and "medium", then set testCaption =
captions[process.argv[3]] ?? "<default caption>"; this makes it easier to extend
and avoids deep nested ternaries in the testCaption assignment.

498-500: Inconsistent fs usage within testRenderOnly.

This function dynamically imports from node:fs/promises (lines 340-345) but then uses the top-level fs import here. Consider using one approach consistently—either the top-level import or pass through the dynamic import.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/testPipeline.ts` around lines 498 - 500, The code in
testRenderOnly uses a dynamic import of node:fs/promises earlier but then calls
the top-level fs (e.g., const stat = await fs.stat(...), fs.copyFile) here;
unify to one approach by either removing the dynamic import and using the
top-level fs consistently, or (preferred) use the dynamically imported promises
object throughout testRenderOnly — replace uses of the top-level fs with the
variable name returned by the dynamic import (the fs/promises alias used around
lines 340-345) so stat, copyFile, etc. are called on the same promises-based
import.

50-52: Remove or populate empty JSDoc blocks.

Multiple functions have empty JSDoc comments (here and at lines 61-63, 71-72, 84-86, 135-137, 166-168, 191-193, 216-218, 251-253, 291-293, 334-336, 404-408). These add noise without providing documentation value. Either remove them or add meaningful descriptions.

Example fix for loadState
-/**
- *
- */
+/** Load pipeline state from disk, returning empty object if file doesn't exist. */
 async function loadState(): Promise<PipelineState> {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/testPipeline.ts` around lines 50 - 52, Remove or populate the
empty JSDoc blocks in this file: either delete blank /** */ comments or replace
them with meaningful JSDoc for the associated functions (e.g., add a brief
description and `@param/`@returns tags for loadState and any other functions that
currently have empty blocks). Locate all empty JSDoc occurrences (the blank /**
*/ comments) and for each one either remove the block or add a one-line summary
plus relevant tags matching the function signature (use the function name like
loadState to guide content).
src/sandboxes/notifyCodingAgentCallback.ts (2)

3-12: Consider using Zod for runtime validation.

The CallbackPayload interface provides compile-time type checking but no runtime validation. Using Zod would add runtime validation to ensure the payload structure is correct before making the callback request.

📋 Example Zod schema
import { z } from "zod";

const CallbackPayloadSchema = z.object({
  threadId: z.string(),
  status: z.enum(["pr_created", "no_changes", "failed", "updated"]),
  branch: z.string().optional(),
  snapshotId: z.string().optional(),
  prs: z.array(z.object({
    repo: z.string(),
    number: z.number(),
    url: z.string(),
    baseBranch: z.string(),
  })).optional(),
  message: z.string().optional(),
  stdout: z.string().optional(),
  stderr: z.string().optional(),
});

type CallbackPayload = z.infer<typeof CallbackPayloadSchema>;

Then validate at the start of the function:

export async function notifyCodingAgentCallback(payload: CallbackPayload): Promise<void> {
  CallbackPayloadSchema.parse(payload);
  // ... rest of function
}

As per coding guidelines: Use Zod for schema validation.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/sandboxes/notifyCodingAgentCallback.ts` around lines 3 - 12, Replace the
plain TypeScript-only CallbackPayload interface with a Zod schema and use it to
validate incoming data at runtime: define a CallbackPayloadSchema using
z.object(...) mirroring the existing fields and enums (threadId, status enum,
optional branch, snapshotId, prs array with repo/number/url/baseBranch, message,
stdout, stderr), infer the CallbackPayload type from that schema, and call
CallbackPayloadSchema.parse(payload) at the start of notifyCodingAgentCallback
to validate the payload before proceeding.

39-39: Consider validating the callback secret.

If CODING_AGENT_CALLBACK_SECRET is not set, the code sends an empty string as the secret header. Consider logging a warning or returning early if the secret is missing, similar to the URL validation.

🔒 Proposed validation
 const url = process.env.CODING_AGENT_CALLBACK_URL;
 const secret = process.env.CODING_AGENT_CALLBACK_SECRET;

 if (!url) {
   logger.error("Missing CODING_AGENT_CALLBACK_URL environment variable");
   return;
 }
+
+if (!secret) {
+  logger.error("Missing CODING_AGENT_CALLBACK_SECRET environment variable");
+  return;
+}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/sandboxes/notifyCodingAgentCallback.ts` at line 39, The code currently
sends an empty "x-callback-secret" header when CODING_AGENT_CALLBACK_SECRET is
unset; update the notifyCodingAgentCallback logic to validate the secret like
the URL validation: read CODING_AGENT_CALLBACK_SECRET into the existing secret
variable, and if it is missing or empty, log a warning (via the same logger used
for URL errors) and return early (or throw) instead of sending an empty header;
ensure you reference and use the same header key ("x-callback-secret") and the
function notifyCodingAgentCallback in your changes.
src/sandboxes/__tests__/notifyCodingAgentCallback.test.ts (1)

18-58: Consider additional test coverage.

The current tests cover the happy path and missing URL scenario. Consider adding test cases for:

  • Fetch failures (when response.ok is false)
  • Network errors (when fetch throws)
  • Missing secret scenario
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/sandboxes/__tests__/notifyCodingAgentCallback.test.ts` around lines 18 -
58, Add tests for notifyCodingAgentCallback to cover (1) fetch returning a
non-ok response, (2) fetch throwing a network error, and (3) missing secret; for
each test set up process.env (CODING_AGENT_CALLBACK_URL and
CODING_AGENT_CALLBACK_SECRET) as needed, mock mockFetch to resolve to { ok:
false } or mockRejectedValueOnce(Error(...)) for the network case, call
notifyCodingAgentCallback with a minimal payload, and assert logger.error was
called with a message including context (e.g.,
expect(logger.error).toHaveBeenCalledWith(expect.stringContaining("callback") or
expect.stringContaining("CODING_AGENT_CALLBACK_SECRET"))); also assert mockFetch
behavior (called when URL present, not called when secret missing) and clean
up/reset environment and mocks between tests.
src/sandboxes/__tests__/pushOrgRepos.test.ts (1)

19-21: Empty JSDoc block adds no value.

This JSDoc comment is empty. Either remove it or add a meaningful description for the createMockSandbox helper function.

✏️ Suggested fix
-/**
- *
- */
+/** Creates a mock sandbox with a stubbed runCommand method. */
 function createMockSandbox() {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/sandboxes/__tests__/pushOrgRepos.test.ts` around lines 19 - 21, Remove
the empty JSDoc block above the createMockSandbox helper in
pushOrgRepos.test.ts; either delete the blank /** */ entirely or replace it with
a concise JSDoc describing what createMockSandbox does (its purpose, inputs, and
return value) so the helper is documented—ensure the comment references the
createMockSandbox function name.
src/socials/filterScrapableSocials.ts (1)

15-17: Incomplete JSDoc parameter descriptions.

The @param tags are present but lack descriptions. Either add meaningful descriptions or remove them.

✏️ Suggested fix
  * Filters and collects all scrapable socials from the artist socials map.
  * Returns an array of scrapable socials with their associated artist IDs.
- *
- * `@param` artistIds
- * `@param` artistSocialsMap
+ * `@param` artistIds - List of artist IDs to filter socials for
+ * `@param` artistSocialsMap - Map of artist ID to their social accounts
  */
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/socials/filterScrapableSocials.ts` around lines 15 - 17, Update the
incomplete JSDoc for the filterScrapableSocials function: provide brief
descriptions for the `@param` tags (e.g., explain that artistIds is an array of
artist identifiers and artistSocialsMap is a map/object of social links keyed by
artist id) or remove the unused `@param` tags entirely so the header no longer
contains empty parameter descriptions; ensure the JSDoc references the same
function name filterScrapableSocials and the exact parameter names artistIds and
artistSocialsMap.
src/sandboxes/__tests__/snapshotAndPersist.test.ts (1)

15-17: Empty JSDoc block adds no value.

This JSDoc comment is empty. Either remove it or add a meaningful description for the createMockSandbox helper function.

✏️ Suggested fix
-/**
- *
- */
+/** Creates a mock sandbox with a stubbed snapshot method. */
 function createMockSandbox() {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/sandboxes/__tests__/snapshotAndPersist.test.ts` around lines 15 - 17,
Remove the empty JSDoc block above the createMockSandbox helper: either delete
the blank /** */ entirely or replace it with a concise JSDoc describing
createMockSandbox’s purpose and return shape (e.g., "Creates a mock Sandbox for
tests" and what it returns), updating the comment attached to the
createMockSandbox function accordingly.
src/sandboxes/__tests__/getSandboxHomeDir.test.ts (1)

4-7: Incomplete JSDoc parameter description.

The @param stdout tag is present but lacks a description. Either complete it or remove the JSDoc block if documentation isn't needed for this test helper.

✏️ Suggested fix
 /**
- *
- * `@param` stdout
+ * Creates a mock sandbox with a stubbed runCommand method.
+ * `@param` stdout - The value to return from stdout()
  */
 function createMockSandbox(stdout = "/home/user") {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/sandboxes/__tests__/getSandboxHomeDir.test.ts` around lines 4 - 7, The
JSDoc block in src/sandboxes/__tests__/getSandboxHomeDir.test.ts contains an
incomplete `@param` stdout tag; either remove the entire JSDoc if it's unnecessary
for this test helper, or add a short description for the stdout parameter (e.g.,
"the captured standard output string" or "mocked stdout stream used in the
test") so the `@param` stdout tag is no longer empty—update the comment above the
test helper (referencing stdout) accordingly.
src/content/fetchArtistContext.ts (1)

4-7: Incomplete JSDoc parameter descriptions.

The @param tags are present but lack descriptions. Either add meaningful descriptions or remove them, as the parameter names and types are already self-documenting in the signature.

✏️ Suggested fix
  * Fetches artist context (artist.md) from GitHub.
  * Returns placeholder if not found.
- *
- * `@param` githubRepo
- * `@param` artistSlug
- * `@param` fetchFile
+ * `@param` githubRepo - GitHub repository URL
+ * `@param` artistSlug - The artist's slug/identifier
+ * `@param` fetchFile - Function to fetch file content from the repo
  */
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/fetchArtistContext.ts` around lines 4 - 7, Update the incomplete
JSDoc for the fetchArtistContext function: either remove the empty `@param` tags
or add concise descriptions for each parameter (githubRepo: the GitHub
repository identifier or client used to fetch files, artistSlug: the artist's
unique slug/identifier, fetchFile: function or path used to retrieve the artist
file), and ensure the JSDoc summary and `@returns` (if present) accurately
describe the function's behavior; adjust the block above the fetchArtistContext
declaration accordingly so the docs are meaningful and consistent with the
function signature.
src/content/generateContentImage.ts (1)

81-85: Incomplete JSDoc for extractFalUrl.

The @param data annotation lacks a description. Consider either adding a meaningful description or removing the incomplete JSDoc block entirely.

📝 Proposed fix
 /**
  * Extracts a media URL from various fal.ai response shapes.
  *
- * `@param` data
+ * `@param` data - The fal.ai API response object to extract URL from
+ * `@returns` The extracted URL, or undefined if not found
  */
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/generateContentImage.ts` around lines 81 - 85, The JSDoc for
extractFalUrl is incomplete — update the comment block to either remove it or
add a clear description for the `@param` data entry (e.g., "data: response object
from fal.ai containing possible media fields") and, if present, add a brief
`@returns` description for the extracted URL; ensure the JSDoc references the
extractFalUrl function name so IDEs and linters pick up the documentation.
src/content/fetchGithubFile.ts (2)

7-8: Incomplete JSDoc parameter annotations add no value.

The @param annotations without descriptions (just @param githubRepoUrl, @param filePath, etc.) don't provide useful documentation. Either add meaningful descriptions or remove the empty annotations to reduce noise.

📝 Proposed improvement
 /**
  * Fetches a raw file from a GitHub repo via the API.
  * If the file isn't found in the main repo, checks submodule org repos.
  *
- * `@param` githubRepoUrl
- * `@param` filePath
+ * `@param` githubRepoUrl - Full GitHub repository URL (e.g., https://github.com/owner/repo)
+ * `@param` filePath - Path to the file within the repository
  * `@returns` The file as a Buffer, or null if not found anywhere.
  */
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/fetchGithubFile.ts` around lines 7 - 8, The JSDoc in
src/content/fetchGithubFile.ts contains empty `@param` tags that add no value;
update the JSDoc for the fetchGithubFile function (or the top-level function in
that file) to either remove the empty `@param` githubRepoUrl and `@param` filePath
tags or replace them with concise descriptions of each parameter and the return
value (and add an `@returns` description if missing), e.g., describe what
githubRepoUrl and filePath represent and the function's return type/behavior so
the docblock is meaningful.

96-99: Empty JSDoc block provides no documentation value.

The JSDoc for parseRepoUrl has an empty description line and a parameter without explanation.

📝 Proposed fix
-/**
- *
- * `@param` githubRepoUrl
- */
+/** Parses a GitHub URL into owner and repo components. */
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/fetchGithubFile.ts` around lines 96 - 99, The JSDoc above
parseRepoUrl is empty and unhelpful; update it to include a concise function
description, a clear `@param` explanation for githubRepoUrl (expected format and
behavior), and an `@returns` tag describing the returned value (e.g., parsed
owner, repo, branch, or null/error). Locate the parseRepoUrl function and
replace the empty JSDoc block with a one- or two-sentence summary plus `@param`
githubRepoUrl {string} and `@returns` annotations referencing the exact return
shape used by parseRepoUrl.
src/recoup/fetchTask.ts (1)

30-33: Incomplete JSDoc parameter annotation.

The @param externalId lacks a description. Consider adding one for consistency with the detailed function description above it.

📝 Proposed fix
  *
- * `@param` externalId
+ * `@param` externalId - The task ID to fetch from the Recoup Tasks API
  */
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/recoup/fetchTask.ts` around lines 30 - 33, The JSDoc for fetchTask is
missing a description for the `@param` externalId; update the comment block above
the export async function fetchTask(externalId?: string) to add a brief
description of what externalId represents (e.g., "external task identifier used
to look up a ChatConfig; optional"), keeping wording consistent with the
existing function description.
src/artists/getBatchArtistSocials.ts (1)

8-9: Add a meaningful @param description.

@param artistIds is currently undocumented and can be made clearer.

Suggested doc improvement
- * `@param` artistIds
+ * `@param` artistIds - Artist IDs to fetch socials for.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/artists/getBatchArtistSocials.ts` around lines 8 - 9, Update the JSDoc
for the getBatchArtistSocials function to add a clear `@param` description for
artistIds: specify its type (e.g., string[] or number[]), what each ID
represents (artist database ID or external ID), whether the array may be empty,
and how the function behaves with invalid IDs (ignored or error). Edit the JSDoc
block above getBatchArtistSocials and replace the bare "@param artistIds" with a
one-line descriptive comment including type and expected contents.
src/recoup/getProArtists.ts (1)

11-13: Remove or complete the empty JSDoc block.

An empty doc comment adds noise without documenting behavior.

Suggested cleanup
-/**
- *
- */
+/** Fetches pro artist IDs from the Recoup API. */
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/recoup/getProArtists.ts` around lines 11 - 13, The empty JSDoc block
above the getProArtists function adds noise; either delete that empty /** */
block or replace it with a concise JSDoc describing the function, its
parameters, return value, and thrown errors (e.g., `@param` userId, `@returns`
Promise<Artist[]>, `@throws`). Update the JSDoc immediately preceding the
getProArtists declaration in src/recoup/getProArtists.ts so it is non-empty and
informative or remove it entirely.
src/tasks/proArtistSocialProfilesScrape.ts (1)

63-64: Compute status counts once and reuse.

SUCCEEDED/FAILED counts are recalculated multiple times; precomputing improves readability and avoids repeated filtering.

Suggested refactor
-    logger.log("All scrape batches completed", {
-      totalRuns: allResults.length,
-      totalArtists: artistIds.length,
-      succeeded: allResults.filter(r => r.status === "SUCCEEDED").length,
-      failed: allResults.filter(r => r.status === "FAILED").length,
-    });
+    const succeeded = allResults.filter(r => r.status === "SUCCEEDED").length;
+    const failed = allResults.filter(r => r.status === "FAILED").length;
+
+    logger.log("All scrape batches completed", {
+      totalRuns: allResults.length,
+      totalArtists: artistIds.length,
+      succeeded,
+      failed,
+    });

     return {
       totalArtists: artistIds.length,
       totalRuns: allResults.length,
-      succeeded: allResults.filter(r => r.status === "SUCCEEDED").length,
-      failed: allResults.filter(r => r.status === "FAILED").length,
+      succeeded,
+      failed,
     };

Also applies to: 70-71

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/tasks/proArtistSocialProfilesScrape.ts` around lines 63 - 64, Precompute
the SUCCEEDED/FAILED counts instead of filtering allResults multiple times:
before building the result object that uses succeeded/failed (and similarly at
lines referenced 70-71), create local constants like succeededCount =
allResults.filter(r => r.status === "SUCCEEDED").length and failedCount =
allResults.filter(r => r.status === "FAILED").length and then reuse
succeededCount and failedCount wherever the code currently calls
allResults.filter(...).length (e.g., in the object with succeeded/failed fields
and any later aggregates).
src/content/fetchAudienceContext.ts (1)

4-8: JSDoc parameter tags lack descriptions.

Similar to other files in this PR, @param tags without descriptions add no documentation value. Consider adding descriptions or removing these annotations.

📝 Example with descriptions
  * Fetches audience context (audience.md) from GitHub.
  * Returns placeholder if not found.
  *
- * `@param` githubRepo
- * `@param` artistSlug
- * `@param` fetchFile
+ * `@param` githubRepo - The GitHub repository identifier
+ * `@param` artistSlug - The artist's slug for folder lookup
+ * `@param` fetchFile - Function to fetch file content from a repo
  */
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/fetchAudienceContext.ts` around lines 4 - 8, Update the JSDoc for
the fetchAudienceContext function in src/content/fetchAudienceContext.ts so each
`@param` tag has a short descriptive sentence (e.g., describe githubRepo,
artistSlug, fetchFile purpose and expected types) or remove any unnecessary
empty `@param` tags; specifically edit the JSDoc block above the
fetchAudienceContext declaration to either add descriptions for githubRepo,
artistSlug, and fetchFile or remove those `@param` entries if they add no value.
src/sandboxes/__tests__/runClaudeCodeAgent.test.ts (2)

17-23: JSDoc parameter tags lack descriptions.

The @param annotations are present but have no descriptions. Either add meaningful descriptions or remove the JSDoc block entirely—empty annotations add noise without value.

📝 Example with descriptions
 /**
- *
- * `@param` finished
- * `@param` finished.exitCode
- * `@param` finished.stdout
- * `@param` finished.stderr
+ * Creates a mock detached command that resolves with the given result.
+ * `@param` finished - The result to return when wait() is called
  */
 function mockDetachedCommand(finished: {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/sandboxes/__tests__/runClaudeCodeAgent.test.ts` around lines 17 - 23, The
JSDoc block above the test contains `@param` tags with no descriptions for the
`finished` object and its properties (`finished.exitCode`, `finished.stdout`,
`finished.stderr`); either remove the entire JSDoc comment or replace the empty
tags with short meaningful descriptions (e.g., describe that `finished` is the
process result and what each property contains) so the comment is informative;
update the comment adjacent to the test helper or function that returns
`finished` (the symbol named `finished`) accordingly.

32-37: Empty JSDoc provides no documentation value.

The JSDoc block on createMockSandbox is empty. Either add a meaningful description or remove it.

📝 Suggested fix
-/**
- *
- */
+/** Creates a minimal mock Sandbox for testing. */
 function createMockSandbox() {
   return { runCommand: vi.fn() } as any;
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/sandboxes/__tests__/runClaudeCodeAgent.test.ts` around lines 32 - 37, The
empty JSDoc above createMockSandbox provides no value—either delete the /** */
block entirely or replace it with a one-line description like "Creates a mock
sandbox with a runCommand spy" to document the function; update the comment
directly above the createMockSandbox function so the file no longer contains a
blank JSDoc block.
src/sandboxes/__tests__/runOpenClawAgent.test.ts (1)

15-21: JSDoc comments are empty — consider adding descriptions or removing.

The JSDoc blocks for mockDetachedCommand and createMockSandbox contain only parameter tags without descriptions. For test helpers, either add brief explanations of what they do or remove the empty annotations.

Also applies to: 30-32

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/sandboxes/__tests__/runOpenClawAgent.test.ts` around lines 15 - 21, The
JSDoc blocks for test helpers are empty and should be fixed; for the functions
mockDetachedCommand and createMockSandbox, either add short descriptive JSDoc
lines for the overall function and each `@param/`@returns (e.g., what finished,
finished.exitCode, stdout, stderr represent and what the helper returns) or
simply remove the empty JSDoc blocks to avoid clutter—update the JSDoc above
mockDetachedCommand and createMockSandbox accordingly so each tag has a brief
description or remove the tags entirely.
src/content/listArtistSongs.ts (1)

59-64: JSDoc parameter annotations are empty — consider adding descriptions or removing.

The JSDoc blocks at lines 59-64 (and similar at lines 45-46, 102-106) contain @param tags without descriptions. Either add meaningful descriptions or remove the empty annotations to avoid clutter.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/listArtistSongs.ts` around lines 59 - 64, The JSDoc for the
function in src/content/listArtistSongs.ts contains empty `@param` tags (e.g., the
block around listArtistSongs and other JSDoc blocks at lines mentioned) — either
add brief descriptions for each parameter (githubRepoUrl: repo URL, artistSlug:
artist identifier, token: auth token) and for the function return value, or
remove the empty `@param` lines entirely; update the JSDoc above the
listArtistSongs function and the other empty blocks (the ones near the top and
around lines 102-106) so every `@param` has a short meaningful description or is
removed to eliminate clutter.
src/content/generateCaption.ts (1)

19-28: JSDoc uses auto-generated root0 pattern for destructured parameters.

The root0.template, root0.songTitle, etc. pattern appears to be auto-generated. While functional, consider using a more descriptive approach like documenting the options object type or using inline comments for key parameters.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/generateCaption.ts` around lines 19 - 28, The JSDoc currently
documents destructured parameters as auto-generated `root0` entries; update the
docs for the generateCaption function to use a descriptive options object (e.g.,
document a single `@param` {Object} options or create a `@typedef` like
CaptionOptions) and list each property explicitly (e.g., `@param` {string}
options.template, `@param` {string} options.songTitle, `@param` {string}
options.fullLyrics, `@param` {string} options.clipLyrics, `@param` {string}
options.artistContext, `@param` {string} options.audienceContext, `@param` {number}
options.captionLength) so readers can clearly see the expected shape instead of
`root0.template`.
src/sandboxes/__tests__/addOrgSubmodules.test.ts (1)

13-15: Remove the empty JSDoc block.

This block doesn’t document anything and can be dropped to keep the test file clean.

Suggested cleanup
-/**
- *
- */
 function createMockSandbox() {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/sandboxes/__tests__/addOrgSubmodules.test.ts` around lines 13 - 15,
Remove the empty JSDoc block (the standalone "/** */" at the top of the test
file) — delete that empty comment so the file
src/sandboxes/__tests__/addOrgSubmodules.test.ts no longer contains a blank
JSDoc header and the tests remain unchanged.
src/content/loadTemplate.ts (1)

29-143: Split exported helpers into dedicated files to align with SRP guideline.

This module currently exports multiple functions; consider keeping one exported function per file and moving the helper exports into focused modules.

As per coding guidelines src/**/*.{ts,tsx,js,jsx}: Implement SRP (Single Responsibility Principle): have one exported function per file.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/loadTemplate.ts` around lines 29 - 143, This file violates SRP by
exporting multiple top-level helpers; split each exported function into its own
module and re-export where needed. Create separate files for loadTemplate
(preserving TEMPLATES_DIR usage and loadJsonFile/fs logic),
pickRandomReferenceImage (uses TemplateData.referenceImagePaths),
buildImagePrompt (accepts basePrompt and styleGuide and preserves
camera/environment/subject/real keys), and buildMotionPrompt (uses
template.videoMovements and template.videoMoods), move their implementations
into those files with a single default export each, update imports in callers to
import the specific function, and leave this file either empty or as a small
aggregator that re-exports the individual modules if necessary.
src/github/getExistingGithubRepo.ts (1)

25-31: Validate the lookup response instead of casting it.

response.json() is asserted to { html_url: string }, so an unexpected GitHub payload can slip through the happy path with an undefined URL. A small Zod schema here would keep this boundary consistent with the rest of src/.

As per coding guidelines "Use Zod for schema validation".

Also applies to: 40-47

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/github/getExistingGithubRepo.ts` around lines 25 - 31, The call that
fetches GitHub repo data (the response variable from the fetch in
getExistingGithubRepo) currently casts response.json() to { html_url: string } —
replace that cast with a Zod validation: define a small Zod schema (e.g.
repoSchema = z.object({ html_url: z.string().url() })) and parse/validate the
parsed JSON before using html_url; update both occurrences (the response
handling around the fetch and the other block at lines ~40-47) to check
schema.parse or safeParse and handle invalid shapes (return null or throw) so an
unexpected GitHub payload cannot produce an undefined url.
src/sandboxes/__tests__/setupOpenClaw.test.ts (1)

46-49: Extract the openclaw.json lookup into a helper.

The same sandbox.runCommand.mock.calls.find(...) predicate appears five times here. A small helper would keep these assertions aligned and make future command-shape changes less brittle.

As per coding guidelines "Extract shared logic into reusable utilities to follow DRY (Don't Repeat Yourself)".

Also applies to: 73-76, 92-95, 104-107, 134-137

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/sandboxes/__tests__/setupOpenClaw.test.ts` around lines 46 - 49, Extract
the repeated predicate used to locate the openclaw injection into a small test
helper (e.g., findOpenClawInjectCall or findRunCommandWithOpenClaw) and replace
the five inline uses of sandbox.runCommand.mock.calls.find(...) with calls to
that helper; the helper should accept sandbox.runCommand.mock.calls (or the mock
object) and return the matching call by checking call[0]?.args where args[0] ===
"-c" and args[1]?.includes("openclaw.json"), keeping the existing behavior and
making assertions use the helper in each test location that currently repeats
the predicate.
src/github/createOrgGithubRepo.ts (1)

38-50: Validate the GitHub success payload before using html_url.

This still trusts response.json() via a type assertion, so a malformed success body can log and return undefined as if it were a valid repo URL. Parse the success body with a small Zod schema before reading html_url.

As per coding guidelines "Use Zod for schema validation".

Also applies to: 66-73

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/github/createOrgGithubRepo.ts` around lines 38 - 50, The code trusts
response.json() and reads html_url without validation; add a small Zod schema
(e.g., RepoSchema = z.object({ html_url: z.string().url() })) in
createOrgGithubRepo and use RepoSchema.safeParse(parsedBody) on the JSON
returned from the POST (the response variable) before accessing html_url; if
validation fails, log the validation error and throw or return a clear failure
instead of returning undefined. Apply the same pattern to the other
success-handling block referenced (lines ~66-73) so both places validate the
GitHub payload with the same RepoSchema and handle invalid shapes consistently.
src/content/generateContentVideo.ts (2)

55-59: Incomplete JSDoc for extractFalUrl.

The @param data tag lacks a description. Either add a meaningful description or remove the incomplete JSDoc block.

📝 Suggested fix
 /**
  * Extracts a media URL from various fal.ai response shapes.
- *
- * `@param` data
+ * `@param` data - The fal.ai response data object
+ * `@returns` The extracted URL or undefined if not found
  */
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/generateContentVideo.ts` around lines 55 - 59, The JSDoc for
extractFalUrl is incomplete because the `@param` data tag has no description;
update the JSDoc block for the extractFalUrl function to either provide a
concise description of the data parameter (e.g., "response object from fal.ai
containing potential media URL fields") and briefly document the return value,
or remove the JSDoc block entirely if it adds no value; ensure you reference the
extractFalUrl function name so the change clearly targets that function's
documentation.

5-12: Malformed JSDoc parameter documentation.

The JSDoc syntax is incorrect. @param imageUrl.imageUrl and @param imageUrl.motionPrompt don't follow valid JSDoc conventions for destructured parameters. The parameter is named imageUrl but the object property is also documented as imageUrl.imageUrl.

For destructured object parameters, use either:

  • Document the object shape with @param for each property: @param {Object} options, @param {string} options.imageUrl, @param {string} options.motionPrompt
  • Or remove the malformed lines and keep only the existing descriptions
📝 Suggested fix
 /**
  * Generates a video from an AI-generated image using fal.ai image-to-video.
  *
- * `@param` imageUrl.imageUrl
  * `@param` imageUrl - URL of the source image (from generateContentImage)
  * `@param` motionPrompt - Describes how the subject should move
- * `@param` imageUrl.motionPrompt
  * `@returns` URL of the generated video
  */
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/generateContentVideo.ts` around lines 5 - 12, The JSDoc for
generateContentVideo is malformed: replace the incorrect `@param
imageUrl.imageUrl` and `@param imageUrl.motionPrompt` lines with proper
destructured-parameter docs by declaring the options object and its properties
(e.g., add `@param {Object} params` or `@param {Object} options` and then
`@param {string} params.imageUrl` and `@param {string} params.motionPrompt`) and
include a proper `@returns {string}` description; ensure the names match the
function signature (generateContentVideo and its parameter name) so the doc
tools and editors resolve the types and descriptions correctly.
src/content/generateAudioVideo.ts (3)

88-94: Incomplete JSDoc for clipAndUploadAudio.

The @param tags lack descriptions. Either add meaningful descriptions or remove the incomplete tags.

📝 Suggested fix
 /**
  * Clips the song mp3 to the specified range and uploads to fal storage.
- *
- * `@param` songBuffer
- * `@param` startSeconds
- * `@param` durationSeconds
+ * `@param` songBuffer - Raw mp3 bytes of the full song
+ * `@param` startSeconds - Start position for the clip in seconds
+ * `@param` durationSeconds - Duration of the clip in seconds
+ * `@returns` URL of the uploaded audio clip
  */
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/generateAudioVideo.ts` around lines 88 - 94, The JSDoc for
clipAndUploadAudio is incomplete: update the comment for function
clipAndUploadAudio to either remove the empty `@param` tags or, preferably, add
clear descriptions for each parameter (e.g., describe songBuffer as the input
audio Buffer, startSeconds as the clip start time in seconds, durationSeconds as
the clip length in seconds) and add a `@returns` description indicating what the
function returns (e.g., uploaded file URL or upload result) so the documentation
is complete and useful.

137-140: Incomplete JSDoc for extractFalUrl.

The JSDoc block has an empty description and @param data lacks context.

📝 Suggested fix
-/**
- *
- * `@param` data
- */
+/**
+ * Extracts a media URL from various fal.ai response shapes.
+ * `@param` data - The fal.ai response data object
+ * `@returns` The extracted URL or undefined if not found
+ */
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/generateAudioVideo.ts` around lines 137 - 140, The JSDoc for
extractFalUrl is incomplete; update the comment above the extractFalUrl function
to include a short description of what the function does, document the parameter
(e.g., `@param` {string|object} data - describe expected shape or fields such as a
FAL object or URL string), and add a `@returns` tag describing the return value
(e.g., {string|null} - resolved FAL URL or null). Ensure types and descriptions
match extractFalUrl's implementation and any edge cases it handles (invalid
input, missing fields).

13-29: Malformed JSDoc parameter documentation.

Same issue as in generateContentVideo.ts. The @param imageUrl.songBuffer, @param imageUrl.audioStartSeconds, etc. syntax is invalid. These appear to be attempting to document properties of a destructured parameter but use incorrect JSDoc notation.

📝 Suggested fix
 /**
  * Generates a video with audio baked in (lipsync mode) using fal.ai LTX-2.
  * The model creates lip-synced animation from image + audio.
  *
  * Matches the content-creation-app's generateAudioVideo.ts behavior.
  *
- * `@param` imageUrl.imageUrl
  * `@param` imageUrl - URL of the AI-generated image
  * `@param` songBuffer - Raw mp3 bytes of the song
  * `@param` audioStartSeconds - Where to clip the song from
  * `@param` audioDurationSeconds - How long the clip should be
  * `@param` motionPrompt - Describes how the subject should move
- * `@param` imageUrl.songBuffer
- * `@param` imageUrl.audioStartSeconds
- * `@param` imageUrl.audioDurationSeconds
- * `@param` imageUrl.motionPrompt
  * `@returns` URL of the generated video (with audio baked in)
  */
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/generateAudioVideo.ts` around lines 13 - 29, The JSDoc for
generateAudioVideo is malformed: entries like "@param imageUrl.songBuffer"
incorrectly document destructured properties; fix by documenting each actual
parameter or the options object correctly—either list each parameter as "@param
{Type} imageUrl - URL of the AI-generated image", "@param {Uint8Array|Buffer}
songBuffer - Raw mp3 bytes", "@param {number} audioStartSeconds - clip start",
"@param {number} audioDurationSeconds - clip duration", "@param {string}
motionPrompt - motion description", or if the function accepts a single options
object, replace with "@param {Object} options" and then use "@param {Type}
options.songBuffer", "@param {number} options.audioStartSeconds", etc.; update
generateAudioVideo's JSDoc to use the chosen, consistent param names/types and
remove the invalid "imageUrl.songBuffer" style entries.
src/content/renderFinalVideo.ts (1)

259-264: Extract captionLayout into a shared type.

This inline shape duplicates calculateCaptionLayout output and can drift. Use a shared alias to keep both sides synchronized.

♻️ Suggested refactor
+type CaptionLayout = ReturnType<typeof calculateCaptionLayout>;
+
 function buildFfmpegArgs({
   videoPath,
   audioPath,
   captionLayout,
@@
 }: {
   videoPath: string;
   audioPath: string;
-  captionLayout: {
-    lines: string[];
-    fontSize: number;
-    lineHeight: number;
-    position: "bottom" | "center" | "top";
-  };
+  captionLayout: CaptionLayout;
   outputPath: string;
   audioStartSeconds: number;
   audioDurationSeconds: number;
   hasAudio: boolean;
 }): string[] {
As per coding guidelines, "Extract shared logic into reusable utilities to follow DRY (Don't Repeat Yourself)".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/renderFinalVideo.ts` around lines 259 - 264, The inline shape for
captionLayout duplicates the output of calculateCaptionLayout and should be
extracted to a shared type (e.g., CaptionLayout) to avoid drift; define and
export a single type alias or interface named CaptionLayout with properties
lines: string[], fontSize: number, lineHeight: number, position: "bottom" |
"center" | "top", then replace the inline declaration in renderFinalVideo.ts and
update calculateCaptionLayout's return type to use CaptionLayout (and import the
type where needed).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 696419db-c9cd-4ade-981b-08ce870d93d9

📥 Commits

Reviewing files that changed from the base of the PR and between 70f345c and 91d230e.

📒 Files selected for processing (98)
  • src/artists/getBatchArtistSocials.ts
  • src/artists/isScrapableSocial.ts
  • src/chats/getTaskRoomId.ts
  • src/consts.ts
  • src/content/analyzeClips.ts
  • src/content/defaultPipelineConfig.ts
  • src/content/fetchArtistContext.ts
  • src/content/fetchAudienceContext.ts
  • src/content/fetchGithubFile.ts
  • src/content/generateAudioVideo.ts
  • src/content/generateCaption.ts
  • src/content/generateContentImage.ts
  • src/content/generateContentVideo.ts
  • src/content/listArtistSongs.ts
  • src/content/loadTemplate.ts
  • src/content/renderFinalVideo.ts
  • src/content/selectAudioClip.ts
  • src/content/testPipeline.ts
  • src/content/transcribeSong.ts
  • src/content/upscaleImage.ts
  • src/content/upscaleVideo.ts
  • src/github/__tests__/createOrgGithubRepo.test.ts
  • src/github/createGithubRepo.ts
  • src/github/createOrgGithubRepo.ts
  • src/github/getExistingGithubRepo.ts
  • src/polling/pollScraperResults.ts
  • src/pulse/__tests__/executePulseInSandbox.test.ts
  • src/pulse/executePulseInSandbox.ts
  • src/recoup/__tests__/getAccountOrgs.test.ts
  • src/recoup/createAccountSandbox.ts
  • src/recoup/createChat.ts
  • src/recoup/fetchActivePulses.ts
  • src/recoup/fetchTask.ts
  • src/recoup/generateChat.ts
  • src/recoup/getAccount.ts
  • src/recoup/getAccountOrgs.ts
  • src/recoup/getAccountSandboxes.ts
  • src/recoup/getArtistSocials.ts
  • src/recoup/getProArtists.ts
  • src/recoup/getScraperResults.ts
  • src/recoup/scrapeSocial.ts
  • src/recoup/updateAccountSnapshot.ts
  • src/sandboxes/__tests__/addOrgSubmodules.test.ts
  • src/sandboxes/__tests__/cloneMonorepoViaAgent.test.ts
  • src/sandboxes/__tests__/configureGitAuth.test.ts
  • src/sandboxes/__tests__/copyOpenClawToRepo.test.ts
  • src/sandboxes/__tests__/ensureOrgRepos.test.ts
  • src/sandboxes/__tests__/getGitHubAuthPrefix.test.ts
  • src/sandboxes/__tests__/getOrCreateSandbox.test.ts
  • src/sandboxes/__tests__/getSandboxHomeDir.test.ts
  • src/sandboxes/__tests__/notifyCodingAgentCallback.test.ts
  • src/sandboxes/__tests__/pushOrgRepos.test.ts
  • src/sandboxes/__tests__/runClaudeCodeAgent.test.ts
  • src/sandboxes/__tests__/runOpenClawAgent.test.ts
  • src/sandboxes/__tests__/setupOpenClaw.test.ts
  • src/sandboxes/__tests__/snapshotAndPersist.test.ts
  • src/sandboxes/__tests__/stripGitmodulesTokens.test.ts
  • src/sandboxes/__tests__/syncOrgRepos.test.ts
  • src/sandboxes/cloneMonorepoViaAgent.ts
  • src/sandboxes/configureGitAuth.ts
  • src/sandboxes/ensureGithubRepo.ts
  • src/sandboxes/ensureOrgRepos.ts
  • src/sandboxes/ensureSetupSandbox.ts
  • src/sandboxes/getOrCreateSandbox.ts
  • src/sandboxes/getSandboxEnv.ts
  • src/sandboxes/getVercelSandboxCredentials.ts
  • src/sandboxes/git/addOrgSubmodules.ts
  • src/sandboxes/git/pushOrgRepos.ts
  • src/sandboxes/installSkill.ts
  • src/sandboxes/logStep.ts
  • src/sandboxes/notifyCodingAgentCallback.ts
  • src/sandboxes/onboardOpenClaw.ts
  • src/sandboxes/parsePRUrls.ts
  • src/sandboxes/pushSandboxToGithub.ts
  • src/sandboxes/runGitCommand.ts
  • src/sandboxes/runOpenClawAgent.ts
  • src/sandboxes/runSetupArtistSkill.ts
  • src/sandboxes/runSetupSandboxSkill.ts
  • src/sandboxes/setupOpenClaw.ts
  • src/sandboxes/snapshotAndPersist.ts
  • src/sandboxes/writeReadme.ts
  • src/schemas/__tests__/contentCreationSchema.test.ts
  • src/schemas/contentCreationSchema.ts
  • src/schemas/sandboxSchema.ts
  • src/socials/filterScrapableSocials.ts
  • src/socials/scrapeAndPollSocials.ts
  • src/tasks/__tests__/codingAgentTask.test.ts
  • src/tasks/__tests__/sendPulsesTask.test.ts
  • src/tasks/__tests__/setupSandboxTask.test.ts
  • src/tasks/__tests__/updatePRTask.test.ts
  • src/tasks/codingAgentTask.ts
  • src/tasks/createContentTask.ts
  • src/tasks/customerPromptTask.ts
  • src/tasks/proArtistSocialProfilesScrape.ts
  • src/tasks/runSandboxCommandTask.ts
  • src/tasks/sendPulsesTask.ts
  • src/tasks/setupSandboxTask.ts
  • src/tasks/updatePRTask.ts
💤 Files with no reviewable changes (3)
  • src/schemas/tests/contentCreationSchema.test.ts
  • src/schemas/contentCreationSchema.ts
  • src/sandboxes/tests/cloneMonorepoViaAgent.test.ts

songTitle: string,
lyrics: SongLyrics,
): Promise<SongClip[]> {
export async function analyzeClips(songTitle: string, lyrics: SongLyrics): Promise<SongClip[]> {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Validate parsed clip payload with Zod before returning.

JSON.parse(... ) as SongClip[] is a blind cast on external/LLM output. Add runtime validation and fallback on invalid shape to avoid propagating malformed clips.

Proposed fix
+import { z } from "zod";
 import { logger } from "@trigger.dev/sdk/v3";
 import type { SongLyrics } from "./transcribeSong";
@@
 export interface SongClip {
@@
 }
+
+const songClipSchema = z.object({
+  startSeconds: z.number(),
+  lyrics: z.string(),
+  reason: z.string(),
+  mood: z.string(),
+  hasLyrics: z.boolean(),
+});
+
+const songClipArraySchema = z.array(songClipSchema);
@@
   let clips: SongClip[];
   try {
-    clips = JSON.parse(jsonMatch[0]) as SongClip[];
+    const parsed = JSON.parse(jsonMatch[0]);
+    const result = songClipArraySchema.safeParse(parsed);
+    if (!result.success) {
+      logger.log("Invalid clip schema from API, using fallback", {
+        issues: result.error.issues.slice(0, 3),
+      });
+      return [
+        {
+          startSeconds: 0,
+          lyrics: lyrics.segments.slice(0, 10).map(s => s.text).join(" "),
+          reason: "fallback — invalid schema",
+          mood: "unknown",
+          hasLyrics: true,
+        },
+      ];
+    }
+    clips = result.data;
   } catch {

As per coding guidelines, "Use Zod for schema validation".

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export async function analyzeClips(songTitle: string, lyrics: SongLyrics): Promise<SongClip[]> {
import { z } from "zod";
import { logger } from "@trigger.dev/sdk/v3";
import type { SongLyrics } from "./transcribeSong";
export interface SongClip {
startSeconds: number;
lyrics: string;
reason: string;
mood: string;
hasLyrics: boolean;
}
const songClipSchema = z.object({
startSeconds: z.number(),
lyrics: z.string(),
reason: z.string(),
mood: z.string(),
hasLyrics: z.boolean(),
});
const songClipArraySchema = z.array(songClipSchema);
export async function analyzeClips(songTitle: string, lyrics: SongLyrics): Promise<SongClip[]> {
let clips: SongClip[];
try {
const parsed = JSON.parse(jsonMatch[0]);
const result = songClipArraySchema.safeParse(parsed);
if (!result.success) {
logger.log("Invalid clip schema from API, using fallback", {
issues: result.error.issues.slice(0, 3),
});
return [
{
startSeconds: 0,
lyrics: lyrics.segments.slice(0, 10).map(s => s.text).join(" "),
reason: "fallback — invalid schema",
mood: "unknown",
hasLyrics: true,
},
];
}
clips = result.data;
} catch {
// existing error handling
}
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/analyzeClips.ts` at line 20, The analyzeClips function currently
does a blind cast of LLM output to SongClip[]; add Zod runtime validation for
the parsed payload (define a SongClipSchema using zod that matches the SongClip
shape) and run SongClipSchema.array().safeParse(parsed) before returning; if
validation fails, log or handle the error and return a safe fallback (e.g.,
empty array) rather than the invalid value, and update any callers expecting
SongClip[] accordingly.

Comment on lines +16 to +21
* @param faceGuideUrl.faceGuideUrl
* @param faceGuideUrl - fal storage URL of the artist's face-guide (headshot)
* @param referenceImagePath - local path to a template reference image (or null)
* @param prompt - Scene/style prompt that instructs the face swap
* @param faceGuideUrl.referenceImagePath
* @param faceGuideUrl.prompt
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Malformed JSDoc parameter annotations.

The JSDoc structure is incorrect. referenceImagePath and prompt are separate destructured parameters, not properties of faceGuideUrl. The @param faceGuideUrl.faceGuideUrl syntax is also invalid.

📝 Proposed fix for JSDoc
-* `@param` faceGuideUrl.faceGuideUrl
-* `@param` faceGuideUrl - fal storage URL of the artist's face-guide (headshot)
-* `@param` referenceImagePath - local path to a template reference image (or null)
-* `@param` prompt - Scene/style prompt that instructs the face swap
-* `@param` faceGuideUrl.referenceImagePath
-* `@param` faceGuideUrl.prompt
+* `@param` options - The generation options
+* `@param` options.faceGuideUrl - fal storage URL of the artist's face-guide (headshot)
+* `@param` options.referenceImagePath - local path to a template reference image (or null)
+* `@param` options.prompt - Scene/style prompt that instructs the face swap
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* @param faceGuideUrl.faceGuideUrl
* @param faceGuideUrl - fal storage URL of the artist's face-guide (headshot)
* @param referenceImagePath - local path to a template reference image (or null)
* @param prompt - Scene/style prompt that instructs the face swap
* @param faceGuideUrl.referenceImagePath
* @param faceGuideUrl.prompt
* `@param` options - The generation options
* `@param` options.faceGuideUrl - fal storage URL of the artist's face-guide (headshot)
* `@param` options.referenceImagePath - local path to a template reference image (or null)
* `@param` options.prompt - Scene/style prompt that instructs the face swap
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/generateContentImage.ts` around lines 16 - 21, The JSDoc for
generateContentImage has malformed `@param` entries (e.g., `@param`
faceGuideUrl.faceGuideUrl and treating referenceImagePath and prompt as
properties); update the comment to list each top-level parameter separately
(e.g., `@param` {string} faceGuideUrl - fal storage URL of the artist's face-guide
(headshot); `@param` {string|null} referenceImagePath - local path to a template
reference image; `@param` {string} prompt - scene/style prompt that instructs the
face swap), remove the dotted/property-style annotations, and ensure types and
short descriptions match the actual function signature (reference
generateContentImage, faceGuideUrl, referenceImagePath, prompt to locate the
code).

Comment on lines +145 to 152
* 1. Downloads the AI-generated video
* 2. Crops 16:9 → 9:16 (portrait for TikTok/Reels)
* 3. Overlays audio clip from the song (unless lipsync mode)
* 4. Overlays caption text (white with black stroke, bottom center)
* 5. Returns the final video as a data URL
*
* @param input
*/
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Align return description with runtime behavior.

Line 149 still says “data URL,” but the function uploads the file and returns a storage URL (videoUrl). Please update this wording to avoid API confusion.

✏️ Suggested doc fix
- * 5. Returns the final video as a data URL
+ * 5. Uploads the final video and returns its storage URL + metadata
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* 1. Downloads the AI-generated video
* 2. Crops 16:9 9:16 (portrait for TikTok/Reels)
* 3. Overlays audio clip from the song (unless lipsync mode)
* 4. Overlays caption text (white with black stroke, bottom center)
* 5. Returns the final video as a data URL
*
* @param input
*/
* 1. Downloads the AI-generated video
* 2. Crops 16:9 9:16 (portrait for TikTok/Reels)
* 3. Overlays audio clip from the song (unless lipsync mode)
* 4. Overlays caption text (white with black stroke, bottom center)
* 5. Uploads the final video and returns its storage URL + metadata
*
* `@param` input
*/
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/renderFinalVideo.ts` around lines 145 - 152, The JSDoc for
renderFinalVideo (in src/content/renderFinalVideo.ts) incorrectly states the
function returns a "data URL" while the runtime uploads the file and returns a
storage URL (`videoUrl`); update the documentation (the block describing steps
and the `@return/`@param section) to say the function uploads the final video and
returns the storage URL (videoUrl) instead of a data URL, and ensure any mention
of "data URL" or similar is replaced with "storage URL" / "videoUrl" to match
the actual return value.

Comment on lines +40 to +47
* @param githubRepo.githubRepo
* @param githubRepo - GitHub repo URL
* @param artistSlug - Artist directory name
* @param clipDuration - How long the clip should be (seconds)
* @param lipsync - Whether to prefer clips with lyrics (for lipsync mode)
* @param githubRepo.artistSlug
* @param githubRepo.clipDuration
* @param githubRepo.lipsync
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Incorrect JSDoc parameter structure.

The added @param entries incorrectly nest parameters under githubRepo (e.g., githubRepo.githubRepo, githubRepo.artistSlug). These are top-level destructured properties, not nested fields. This creates misleading documentation.

✏️ Suggested fix

Remove the malformed entries since the existing documentation on lines 41-44 is correct:

- * `@param` githubRepo.githubRepo
  * `@param` githubRepo - GitHub repo URL
  * `@param` artistSlug - Artist directory name
  * `@param` clipDuration - How long the clip should be (seconds)
  * `@param` lipsync - Whether to prefer clips with lyrics (for lipsync mode)
- * `@param` githubRepo.artistSlug
- * `@param` githubRepo.clipDuration
- * `@param` githubRepo.lipsync
  * `@returns` Selected audio clip with all metadata
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* @param githubRepo.githubRepo
* @param githubRepo - GitHub repo URL
* @param artistSlug - Artist directory name
* @param clipDuration - How long the clip should be (seconds)
* @param lipsync - Whether to prefer clips with lyrics (for lipsync mode)
* @param githubRepo.artistSlug
* @param githubRepo.clipDuration
* @param githubRepo.lipsync
* `@param` githubRepo - GitHub repo URL
* `@param` artistSlug - Artist directory name
* `@param` clipDuration - How long the clip should be (seconds)
* `@param` lipsync - Whether to prefer clips with lyrics (for lipsync mode)
* `@returns` Selected audio clip with all metadata
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/selectAudioClip.ts` around lines 40 - 47, The JSDoc for the
selectAudioClip function incorrectly lists nested params like
"githubRepo.githubRepo" and "githubRepo.artistSlug"; remove those malformed
entries and keep/document the top-level destructured parameters (githubRepo,
artistSlug, clipDuration, lipsync) to match the function signature in
selectAudioClip, ensuring the `@param` tags refer to those top-level names only.

Comment on lines +340 to +345
const {
writeFile: writeFileFn,
readFile: readFileFn,
unlink: unlinkFn,
mkdir: mkdirFn,
} = await import("node:fs/promises");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove unused imports writeFileFn and readFileFn.

These renamed imports are never used in testRenderOnly. Only mkdirFn and unlinkFn are actually used.

Proposed fix
   const {
-    writeFile: writeFileFn,
-    readFile: readFileFn,
     unlink: unlinkFn,
     mkdir: mkdirFn,
   } = await import("node:fs/promises");
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/testPipeline.ts` around lines 340 - 345, The import destructure
in testPipeline.ts includes unused symbols writeFileFn and readFileFn; remove
these from the dynamic import so only the actually used functions (mkdirFn and
unlinkFn) are imported, and ensure any references to writeFileFn/readFileFn
inside the testRenderOnly function are absent (no-op) or replaced if they were
intended to be used; update the import line that currently declares writeFileFn,
readFileFn, unlinkFn, mkdirFn to only declare mkdirFn and unlinkFn to eliminate
the unused imports.

Comment on lines +35 to +46
const response = await fetch(`https://api.github.com/orgs/${GITHUB_ORG}/repos`, {
method: "POST",
headers: {
Accept: "application/vnd.github+json",
Authorization: `Bearer ${token}`,
"X-GitHub-Api-Version": "2022-11-28",
},
body: JSON.stringify({
name: repoName,
private: true,
}),
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n src/github/createGithubRepo.ts

Repository: recoupable/tasks

Length of output: 2654


🏁 Script executed:

# Check if there are task files calling this function to understand the provisioning context
rg "createGithubRepo" --type ts --type tsx -A 3 -B 3

Repository: recoupable/tasks

Length of output: 87


🏁 Script executed:

rg "createGithubRepo" -A 3 -B 3

Repository: recoupable/tasks

Length of output: 1577


🏁 Script executed:

cat -n src/sandboxes/ensureGithubRepo.ts

Repository: recoupable/tasks

Length of output: 5099


Add a timeout to the GitHub create call.

This POST runs in the sandbox provisioning path, so an unbounded network call can consume the task's full execution window before error handling activates. Add an AbortController with a timeout and log timeout failures explicitly.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/github/createGithubRepo.ts` around lines 35 - 46, Wrap the GitHub POST
fetch in an AbortController with a timeout: create an AbortController, pass
controller.signal into the fetch options used to POST the repo (the fetch that
returns response), start a setTimeout to call controller.abort() after a defined
timeout constant (e.g. GITHUB_CREATE_TIMEOUT_MS), and clear the timer after
fetch completes; in the surrounding try/catch detect an abort (AbortError) and
log a clear "GitHub create repo timed out" message that includes repoName and
token context as appropriate and rethrow or return a handled error. Update the
fetch call site and ensure the timeout is cleared to avoid leaks.

Comment on lines 22 to 27
* @param params.accountId - The account ID to execute the pulse for
* @param params.prompt - The pulse prompt to execute
* @param root0
* @param root0.accountId
* @param root0.prompt
* @returns The sandbox ID and run ID on success, undefined on error
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Duplicate and malformed JSDoc parameter documentation.

The added @param root0 entries conflict with the existing @param params.accountId and @param params.prompt documentation. The root0 naming appears to be auto-generated and doesn't match the actual code. Remove the duplicate entries.

✏️ Suggested fix
  * `@param` params.accountId - The account ID to execute the pulse for
  * `@param` params.prompt - The pulse prompt to execute
- * `@param` root0
- * `@param` root0.accountId
- * `@param` root0.prompt
  * `@returns` The sandbox ID and run ID on success, undefined on error
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* @param params.accountId - The account ID to execute the pulse for
* @param params.prompt - The pulse prompt to execute
* @param root0
* @param root0.accountId
* @param root0.prompt
* @returns The sandbox ID and run ID on success, undefined on error
* `@param` params.accountId - The account ID to execute the pulse for
* `@param` params.prompt - The pulse prompt to execute
* `@returns` The sandbox ID and run ID on success, undefined on error
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pulse/executePulseInSandbox.ts` around lines 22 - 27, Remove the
duplicated/malformed JSDoc entries for `@param root0`, `@param root0.accountId`,
and `@param root0.prompt` in the JSDoc for executePulseInSandbox; keep the
correct `@param params.accountId` and `@param params.prompt` entries (and ensure
the `@returns` doc remains accurate) so the docblock matches the actual function
signature `executePulseInSandbox(params)`.

export async function createChat(
params?: CreateChatParams
): Promise<Room | undefined> {
export async function createChat(params?: CreateChatParams): Promise<Room | undefined> {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n src/recoup/createChat.ts

Repository: recoupable/tasks

Length of output: 2682


Use Zod to validate the API response schema instead of a type cast.

Line 71 uses a TypeScript cast (as CreateChatResponse) which provides no runtime validation. The response.json() payload is untrusted, and accessing json.status and json.chat without schema validation can fail at runtime if the API returns an unexpected structure. Per coding guidelines, use Zod for schema validation.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/recoup/createChat.ts` at line 26, The createChat function currently casts
the untrusted response.json() to CreateChatResponse (using as
CreateChatResponse); replace that cast with runtime validation using a Zod
schema (e.g., CreateChatResponseSchema) that matches the expected shape (status,
chat, etc.), call CreateChatResponseSchema.parse or safeParse on the parsed
JSON, and handle parse failures by logging the error and returning undefined (or
an appropriate error flow) instead of proceeding; update references in
createChat to use the validated object (from safeParse.data) when accessing
status and chat.

accountId: string,
snapshotId?: string,
githubRepo?: string
githubRepo?: string,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

cat -n src/recoup/updateAccountSnapshot.ts

Repository: recoupable/tasks

Length of output: 2323


Add Zod schema to validate the API response before returning.

The function promises { success: boolean; snapshotId: string }, but it currently forwards the unvalidated JSON response. Add a Zod schema to validate the response shape at this boundary. The logging at lines 51-54 also assumes data.snapshotId exists without validation. Per coding guidelines, "Use Zod for schema validation" for all files matching src/**/*.{ts,tsx}.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/recoup/updateAccountSnapshot.ts` at line 15, The function
updateAccountSnapshot currently forwards unvalidated JSON (variable data) and
logs data.snapshotId; add a Zod schema (e.g., const UpdateSnapshotResponseSchema
= z.object({ success: z.boolean(), snapshotId: z.string() })) and use
UpdateSnapshotResponseSchema.parse or safeParse on the fetched JSON before any
logging or returning; on validation failure throw or return a controlled error
so the function's promised return type { success: boolean; snapshotId: string }
is guaranteed, and replace uses of data.snapshotId in the logging block with the
validated result (e.g., parsed.snapshotId).

Comment on lines +121 to 126
const gatewayCall = sandbox.runCommand.mock.calls.find((call: any[]) => {
const args = call[0]?.args;
return args?.[1]?.includes("gateway");
});

expect(gatewayCall).toBeDefined();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

This test doesn't verify the ordering it names.

It only checks that some call contains gateway, so it still passes if the gateway starts before the openclaw.json mutation. Please compare the env-injection call index with the gateway call index here instead of checking presence alone.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/sandboxes/__tests__/setupOpenClaw.test.ts` around lines 121 - 126, The
test currently only checks that some sandbox.runCommand mock call contains
"gateway" (gatewayCall) but doesn't assert its order relative to the
openclaw.json mutation; update the test to locate both the
env-injection/openclaw.json mutation call and the gateway call in
sandbox.runCommand.mock.calls (e.g., find the call whose args indicate the
openclaw.json/env-injection step and the call stored in gatewayCall) and then
assert that the index of the env-injection/openclaw.json call is less than the
index of gatewayCall so the gateway starts after the mutation.

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