agent: @U0AJM7X8FBR @U0AJM7X8FBR become an expert at this repo https://github.c#92
Conversation
📝 WalkthroughWalkthroughComprehensive codebase refactoring across 65+ files introducing JSDoc parameter annotations, reformatting function signatures from multi-line to single-line declarations, normalizing arrow function parameter syntax, and adding trailing commas. Notable functional changes include expanding Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
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: 10
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (6)
src/polling/pollScraperResults.ts (1)
30-33:⚠️ Potential issue | 🔴 CriticalAdd retry limits to prevent infinite polling loop.
When
getScraperResultsreturnsnull, the function logs a warning but keeps the run inpendingRuns. If polling consistently fails for a run, this creates an infinite loop where the function polls every 10 seconds indefinitely with no escape condition.🔒 Proposed fix to add retry tracking and limits
export async function pollScraperResults(runs: ScrapeRun[]): Promise<PollResult[]> { const results: PollResult[] = []; const pendingRuns = new Map<string, ScrapeRun>(runs.map(run => [run.runId, run])); + const retryCount = new Map<string, number>(); + const MAX_RETRIES = 30; // 30 retries * 10 seconds = 5 minutes max while (pendingRuns.size > 0) { // Poll all pending runs in parallel const pollPromises = Array.from(pendingRuns.values()).map(async run => { const result = await getScraperResults(run.runId); if (!result) { + const count = (retryCount.get(run.runId) || 0) + 1; + retryCount.set(run.runId, count); + + if (count >= MAX_RETRIES) { + logger.error("Max retries exceeded for scraper run", { + runId: run.runId, + retries: count + }); + return { + run, + pollResult: { + runId: run.runId, + datasetId: run.datasetId, + status: "FAILED", + }, + }; + } + logger.warn("Failed to get scraper result", { runId: run.runId }); return null; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/polling/pollScraperResults.ts` around lines 30 - 33, The function pollScraperResults currently leaves runs in pendingRuns when getScraperResults returns null, causing infinite polling; add retry tracking and a max retry limit to break out: introduce a retry counter (e.g., map pendingRetries keyed by run.runId) incremented each time getScraperResults returns null inside pollScraperResults, stop polling and remove the run from pendingRuns (or mark it failed) once the counter exceeds a configurable MAX_RETRIES, and reset the counter when a successful result is received; update any related logging (logger.warn / logger.error) to include runId and current retry count so failures are visible.src/content/listArtistSongs.ts (2)
52-56:⚠️ Potential issue | 🟡 MinorDelimiter
__in URL or path will break parsing.The
split("__")approach fails if the GitHub URL or file path contains__. For example, a repo namedfoo__barwould be incorrectly parsed.Consider using a more robust delimiter (e.g., a non-printable character or JSON encoding) or a fixed-position split:
♻️ Proposed fix using indexOf for first delimiter only
export function parseSongPath(encodedPath: string): { repoUrl: string | null; filePath: string; } { if (encodedPath.startsWith("__ORG_REPO__")) { - const parts = encodedPath.replace("__ORG_REPO__", "").split("__"); - return { repoUrl: parts[0], filePath: parts.slice(1).join("__") }; + const remainder = encodedPath.slice("__ORG_REPO__".length); + const delimiterIndex = remainder.indexOf("__"); + if (delimiterIndex === -1) { + return { repoUrl: null, filePath: encodedPath }; + } + return { + repoUrl: remainder.slice(0, delimiterIndex), + filePath: remainder.slice(delimiterIndex + 2), + }; } return { repoUrl: null, filePath: encodedPath }; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/content/listArtistSongs.ts` around lines 52 - 56, The current parsing uses encodedPath.replace("__ORG_REPO__", "").split("__") which breaks when the repo URL or file path contains "__"; change to remove the "__ORG_REPO__" prefix into a variable (e.g., remaining = encodedPath.slice("__ORG_REPO__".length)), then locate the first separator with remaining.indexOf("__") and split into repoUrl = remaining.slice(0, idx) and filePath = remaining.slice(idx + 2) (handling idx === -1 by setting filePath to "" or null); update the logic around encodedPath, "__ORG_REPO__", repoUrl and filePath to preserve any "__" characters in the repo or file path.
74-85:⚠️ Potential issue | 🟡 MinorHardcoded
mainbranch fails silently for repos usingmasteror other defaults.The GitHub API call assumes the default branch is
main. If a repo usesmasteror another default branch, the request returns 404 and silently returns an empty array at line 85, causing false negatives.Fetch the repository's default branch first using
GET /repos/{owner}/{repo}(which includes thedefault_branchfield in the response), then use it in the tree API call.Current code
const response = await fetch( `https://api.github.com/repos/${owner}/${repo}/git/trees/main?recursive=1`, { headers: { Authorization: `Bearer ${token}`, Accept: "application/vnd.github.v3+json", "User-Agent": "Recoup-Tasks", }, }, ); if (!response.ok) return [];🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/content/listArtistSongs.ts` around lines 74 - 85, The current tree fetch hardcodes "main" which fails for repos with other default branches; update the logic in listArtistSongs (around the fetch that assigns response) to first call GET https://api.github.com/repos/{owner}/{repo} with the same headers, parse default_branch from its JSON, then call the tree API using that branch (e.g., .../git/trees/{default_branch}?recursive=1); ensure you check response.ok for both requests and return [] or surface an error appropriately if either request fails, preserving existing Authorization, Accept, and User-Agent headers.src/sandboxes/ensureOrgRepos.ts (1)
19-25:⚠️ Potential issue | 🟠 MajorFail fast when
GITHUB_TOKENis absent.At Line 24, the function returns after logging, which makes this setup step appear successful to callers even though a required credential is missing.
🔧 Proposed fix
if (!githubToken) { logger.error("Missing GITHUB_TOKEN for org repos"); - return; + throw new Error("Missing GITHUB_TOKEN for org repo setup"); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/sandboxes/ensureOrgRepos.ts` around lines 19 - 25, In ensureOrgRepos, do not silently return when the required GITHUB_TOKEN is missing; replace the logger.error + return with a hard failure (throw an Error with a clear message, e.g., "Missing GITHUB_TOKEN for org repos") so callers fail fast; update the ensureOrgRepos implementation and any callers/tests to expect or handle the thrown error accordingly.src/sandboxes/git/pushOrgRepos.ts (1)
15-21:⚠️ Potential issue | 🟠 MajorReturn an explicit status from
pushOrgReposinstead of silently no-oping.Line 15 + Line 18-Line 21 currently hide the “skipped due to missing token” state from callers.
pushSandboxToGithubcontinues downstream unconditionally, so partial publish flows are indistinguishable from success.✅ Proposed fix (explicit status + caller handling)
diff --git a/src/sandboxes/git/pushOrgRepos.ts b/src/sandboxes/git/pushOrgRepos.ts @@ -export async function pushOrgRepos(sandbox: Sandbox): Promise<void> { +export async function pushOrgRepos(sandbox: Sandbox): Promise<boolean> { const githubToken = process.env.GITHUB_TOKEN; @@ if (!githubToken) { - logger.log("No GITHUB_TOKEN, skipping org submodule registration"); - return; + logger.log("No GITHUB_TOKEN, skipping org repo push"); + return false; } @@ if (orgNames.length === 0) { - logger.log("No org repos found, skipping submodule registration"); - return; + logger.log("No org repos found, skipping org repo push"); + return true; } @@ await runOpenClawAgent(sandbox, { label: "Pushing org repo changes", message, }); @@ logger.log("Org repo push complete", { count: orgNames.length, }); + return true; }diff --git a/src/sandboxes/pushSandboxToGithub.ts b/src/sandboxes/pushSandboxToGithub.ts @@ - await pushOrgRepos(sandbox); + if (!(await pushOrgRepos(sandbox))) { + return false; + }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/sandboxes/git/pushOrgRepos.ts` around lines 15 - 21, Update pushOrgRepos to return an explicit status instead of silently returning void: change the signature of pushOrgRepos to return a Promise<boolean> (or a small enum) and return false when GITHUB_TOKEN is missing or the operation is skipped and true on successful completion; update the caller pushSandboxToGithub to check the returned value and handle the "skipped" case (e.g., abort downstream steps or surface an error) so callers can distinguish success from "skipped due to missing token." Ensure references to pushOrgRepos and pushSandboxToGithub are updated accordingly.src/content/renderFinalVideo.ts (1)
211-215:⚠️ Potential issue | 🟠 MajorReturn type mismatch with interface.
The
RenderFinalVideoOutputinterface (lines 134-141) definesdataUrlas the property name, but the return statement at lines 211-215 returnsvideoUrlinstead. This causes a type error insrc/content/testPipeline.tsat line 323, where the code attempts to accessresult.dataUrl, which does not exist on the returned object.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/content/renderFinalVideo.ts` around lines 211 - 215, The return object from the function currently returns videoUrl but the expected interface is RenderFinalVideoOutput which defines dataUrl; update the return to include dataUrl mapped to the existing videoUrl (e.g., dataUrl: videoUrl) while keeping mimeType and sizeBytes unchanged so callers like testPipeline.ts can access result.dataUrl; ensure the function signature and any type annotations still align with RenderFinalVideoOutput.
🧹 Nitpick comments (27)
src/sandboxes/__tests__/copyOpenClawToRepo.test.ts (1)
9-11: Remove the empty JSDoc block.The comment block at Line 9–Line 11 is empty and adds noise in tests; please remove it unless you plan to document behavior there.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/sandboxes/__tests__/copyOpenClawToRepo.test.ts` around lines 9 - 11, Remove the empty JSDoc block (the standalone "/** */" comment) present near the top of the test file; simply delete that empty comment so the test file no longer contains the unused JSDoc noise and ensure there are no other empty JSDoc blocks left in the same file.src/content/transcribeSong.ts (2)
71-75: Incomplete JSDoc parameters add noise without value.The
@paramtags list only parameter names without descriptions. Either provide meaningful descriptions or remove these empty annotations—the function signature already conveys the parameter names.📝 Suggested fix: Complete or remove JSDoc params
Option 1 - Complete the documentation:
/** * Gets the lyrics for a specific time range within a song. - * - * `@param` lyrics - * `@param` startSeconds - * `@param` endSeconds + * `@param` lyrics - The full song lyrics with timestamped segments + * `@param` startSeconds - Start of the time range in seconds + * `@param` endSeconds - End of the time range in seconds + * `@returns` Object containing concatenated lyrics text and matching segments */Option 2 - Remove empty params:
/** * Gets the lyrics for a specific time range within a song. - * - * `@param` lyrics - * `@param` startSeconds - * `@param` endSeconds */🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/content/transcribeSong.ts` around lines 71 - 75, The JSDoc above the transcribeSong function contains `@param` entries with only parameter names and no descriptions, which is noisy; either remove those empty `@param` tags or replace them with concise descriptions for each parameter (e.g., explain lyrics, startSeconds, endSeconds and their types/units) in the JSDoc for function transcribeSong so the docblock is meaningful and matches the function signature.
76-84: Multiple exports violate Single Responsibility Principle.This file exports both
transcribeSongandgetLyricsForTimeRange. Consider extractinggetLyricsForTimeRangeto a separate utility file (e.g.,src/content/lyricsUtils.ts) to comply with the one-exported-function-per-file guideline.As per coding guidelines: "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/transcribeSong.ts` around lines 76 - 84, The file currently exports both transcribeSong and getLyricsForTimeRange; extract getLyricsForTimeRange into its own module by creating a new file that exports getLyricsForTimeRange (keeping its signature and returning { clipLyrics, segments }), import any needed types (SongLyrics, LyricSegment) into that new module, update the original file to remove the getLyricsForTimeRange export and replace its internal references with an import of getLyricsForTimeRange from the new module, and run/adjust any unit tests or callers to import the function from the new module so each file only exports one main function.src/pulse/executePulseInSandbox.ts (1)
22-27: Remove redundant auto-generated JSDoc params.Lines 22-23 already document
params.accountIdandparams.prompt. Theroot0parameters (lines 24-26) appear to be auto-generated artifacts that duplicate this documentation and add confusion. Remove the redundant entries.Suggested fix
/** * Executes a pulse in a sandbox by calling POST /api/sandboxes with a prompt. * The API creates/resumes a sandbox and runs the prompt via OpenClaw. * * `@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 */🤖 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, The JSDoc contains redundant autogenerated param entries (root0, root0.accountId, root0.prompt) that duplicate params.accountId and params.prompt; edit the JSDoc for executePulseInSandbox to remove the redundant root0* param lines so only the meaningful params (params.accountId and params.prompt) remain and the return description stays intact.src/content/upscaleImage.ts (1)
40-43: Complete or remove incomplete JSDoc block.The JSDoc has an empty description and
@param datawithout any explanation. Either provide meaningful documentation or remove the comment.Suggested fix
-/** - * - * `@param` data - */ +/** Extracts the output URL from a fal.ai response payload. */ function extractFalUrl(data: Record<string, unknown>): string | undefined {🤖 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, The JSDoc above the upscaleImage function is incomplete (empty description and a bare "@param data"); either remove the entire JSDoc block or replace it with a concise docstring that describes what upscaleImage does, documents the "data" parameter (type and expected shape/properties) and the return value/promise (e.g., processed image buffer or response). Update the JSDoc near the upscaleImage function to include a short one-line description, "@param data {Type} - description" and an "@returns {Type} - description" or simply delete the /** ... */ block if you prefer no comment.src/sandboxes/getSandboxEnv.ts (1)
4-6: Complete the JSDoc@paramdescription.The
@param accountIdtag is missing a description. Add a brief explanation of what the parameter represents.Suggested fix
/** * Builds the environment variables to inject into sandbox commands. * Shared by runSandboxCommandTask and codingAgentTask. * - * `@param` accountId + * `@param` accountId - The account identifier to include in the environment */🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/sandboxes/getSandboxEnv.ts` around lines 4 - 6, Add a brief description for the JSDoc `@param` tag for accountId in the getSandboxEnv function: explain that accountId is the unique identifier (string or number) for the user/account whose sandbox environment variables should be retrieved or used to load the sandbox configuration. Update the JSDoc comment above getSandboxEnv to include this description.src/sandboxes/__tests__/snapshotAndPersist.test.ts (1)
15-17: Remove empty JSDoc comment block.This JSDoc block is empty and provides no documentation value. Either add a meaningful description for
createMockSandboxor remove the comment entirely.Suggested fix
-/** - * - */ function createMockSandbox() {Or add a meaningful description:
-/** - * - */ +/** Creates a mock Sandbox with a stubbed snapshot method for testing. */ 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 createMockSandbox: either delete the blank /** */ entirely or replace it with a concise meaningful description for the createMockSandbox helper (one-line summary of purpose and behavior), ensuring the comment directly precedes the createMockSandbox declaration.src/content/upscaleVideo.ts (2)
46-49: Complete or remove incomplete JSDoc block.Same issue as in
upscaleImage.ts- the JSDoc has an empty description and@param datawithout explanation.Suggested fix
-/** - * - * `@param` data - */ +/** Extracts the output URL from a fal.ai response payload. */ function extractFalUrl(data: Record<string, unknown>): string | undefined {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/content/upscaleVideo.ts` around lines 46 - 49, The JSDoc above the upscaleVideo function is incomplete — either fill in a meaningful description and document the `data` parameter (its expected type and any properties used by upscaleVideo, e.g., input path, output path, scaleFactor, options) or remove the empty JSDoc block entirely; update the comment immediately above the upscaleVideo function to include a one-line summary and a proper `@param {Type} data` description that matches the function's actual parameter shape.
50-64: ExtractextractFalUrlto a shared utility module.This helper function is duplicated identically across at least five content files (
upscaleVideo.ts,upscaleImage.ts,generateContentImage.ts,generateContentVideo.ts, andgenerateAudioVideo.ts). Extract it to a dedicated utils module (e.g.,src/content/utils/falUrlExtractor.ts) and import it in all files to follow the DRY principle.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/content/upscaleVideo.ts` around lines 50 - 64, Extract the duplicated function extractFalUrl into a single exported helper module (create and export a function named extractFalUrl in a new utils module), update each file that currently defines it (upscaleVideo.ts, upscaleImage.ts, generateContentImage.ts, generateContentVideo.ts, generateAudioVideo.ts) to remove the local implementation and import { extractFalUrl } from the new module, and ensure the imported function signature and behavior remain unchanged so calls to extractFalUrl(data: Record<string, unknown>) continue to work as before.src/sandboxes/__tests__/syncOrgRepos.test.ts (1)
10-12: Remove empty JSDoc comment block.This empty JSDoc block adds no documentation value. Either add a meaningful description for
createMockSandboxor remove the comment entirely.📝 Suggested options
Option 1: Remove empty comment
-/** - * - */ function createMockSandbox() {Option 2: Add meaningful description
-/** - * - */ +/** Creates a mock sandbox with a stubbed runCommand method for testing. */ 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 at the top of the test file (the blank /** */) — either delete it entirely or replace it with a short meaningful description for the createMockSandbox helper (referencing createMockSandbox) so the file no longer contains a useless empty JSDoc comment; update the comment to describe the helper’s purpose if you choose to keep it.src/content/fetchArtistContext.ts (1)
4-7: Consider adding parameter descriptions to JSDoc.The parameter annotations lack descriptions. Adding brief descriptions would improve documentation clarity.
📝 Suggested improvement
* -* `@param` githubRepo -* `@param` artistSlug -* `@param` fetchFile +* `@param` githubRepo - GitHub repository URL +* `@param` artistSlug - Artist directory identifier +* `@param` fetchFile - Function to fetch file content from the repository */🤖 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 JSDoc for the fetchArtistContext function by adding brief descriptions for each `@param`: describe githubRepo (e.g., the GitHub repository identifier or client used), artistSlug (the artist's unique slug used to locate their content), and fetchFile (the helper/function used to fetch files or a flag indicating file retrieval behavior), and also ensure the return/throws tags (if present) are meaningful; modify the JSDoc block immediately above fetchArtistContext to include these parameter descriptions.src/content/listArtistSongs.ts (2)
7-8: JSDoc parameter annotations are incomplete.The JSDoc
@paramtags lack descriptions. Either add meaningful descriptions or remove the empty parameter annotations to avoid documentation noise.* `@param` githubRepoUrl * `@param` artistSlugCould be:
-* `@param` githubRepoUrl -* `@param` artistSlug +* `@param` githubRepoUrl - The GitHub repository URL to search +* `@param` artistSlug - The artist's slug identifier for folder lookupAlso applies to: 45-47
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/content/listArtistSongs.ts` around lines 7 - 8, The JSDoc for the function listArtistSongs (and other JSDoc blocks around lines 45-47) contains `@param` tags with empty descriptions (e.g., `@param` githubRepoUrl, `@param` artistSlug); update these JSDoc comments by adding concise descriptions for each parameter (what they represent and expected type/format) or remove the empty `@param` lines entirely so the documentation is not noisy—look for the JSDoc block above the listArtistSongs function and any subsequent blocks at the indicated region and either fill in meaningful descriptions for githubRepoUrl and artistSlug (and any other empty params) or delete those `@param` annotations.
11-14: Multiple exported functions violate SRP guideline.This file exports both
listArtistSongsandparseSongPath. As per coding guidelines, files should have "one exported function per file."Consider extracting
parseSongPathto a separate file (e.g.,src/content/parseSongPath.ts) since it's used by consumers to decode the encoded paths.Also applies to: 48-57
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/content/listArtistSongs.ts` around lines 11 - 14, This file currently exports both listArtistSongs and parseSongPath which breaks the one-export-per-file rule; extract parseSongPath into its own module (e.g., create src/content/parseSongPath.ts) and export it from there, remove its export from src/content/listArtistSongs.ts so only listArtistSongs remains exported, and update any call sites/imports to import parseSongPath from the new module; ensure function signature and runtime behavior of parseSongPath remain unchanged and run tests to verify no import paths are broken.src/sandboxes/__tests__/setupOpenClaw.test.ts (1)
13-15: Remove empty JSDoc comment.The empty JSDoc block adds no value. Either remove it or add a meaningful description for
createMockSandbox.Suggested fix
-/** - * - */ function createMockSandbox() {Or add a proper description:
-/** - * - */ +/** Creates a mock Sandbox with 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__/setupOpenClaw.test.ts` around lines 13 - 15, Remove the empty JSDoc block above createMockSandbox in the test file; either delete the blank /** */ entirely or replace it with a concise JSDoc describing the createMockSandbox helper (e.g., its purpose and return value) so the comment is meaningful and not an empty block.src/recoup/scrapeSocial.ts (1)
17-19: Incomplete JSDoc@paramtag.The
@param socialIdis missing a description. Either complete it or remove the tag to avoid inconsistency with the rest of the documentation.Suggested fix
* Returns Apify run metadata that can be used to poll for status and retrieve results. * - * `@param` socialId + * `@param` socialId - The social profile ID to scrape */🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/recoup/scrapeSocial.ts` around lines 17 - 19, The JSDoc for the function handling social scraping contains an incomplete `@param socialId` tag; update the JSDoc for the function (e.g., the scrapeSocial or equivalent function that takes socialId) to either remove the orphan `@param` or add a concise description like "socialId - the ID or handle of the social account to scrape" so the param documentation is consistent and informative; locate the JSDoc block above the function that references socialId and edit the `@param` line accordingly.src/github/getExistingGithubRepo.ts (1)
40-40: Consider using Zod for response validation.The response is cast with a type assertion rather than validated. If the GitHub API response shape changes or returns an error object, this could lead to runtime issues when accessing
html_url.Suggested fix using Zod
+import { z } from "zod"; + +const repoResponseSchema = z.object({ + html_url: z.string(), +}); + // In the function: - const data = (await response.json()) as { html_url: string }; + const json = await response.json(); + const result = repoResponseSchema.safeParse(json); + + if (!result.success) { + logger.error("Invalid response from GitHub API", { + repoName, + errors: result.error.issues, + }); + return undefined; + } + + const data = result.data;As per coding guidelines: "Use Zod for schema validation" applies to
src/**/*.{ts,tsx}files.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/github/getExistingGithubRepo.ts` at line 40, The code casts the GitHub response with a type assertion (const data = (await response.json()) as { html_url: string }) which risks runtime errors; replace this with Zod validation: import z from "zod", define a schema like repoSchema = z.object({ html_url: z.string().url() }), parse the JSON via repoSchema.parse(await response.json()) or use safeParse and handle failures, then use the parsed object's html_url; update any error handling in getExistingGithubRepo to log/throw on validation failure instead of assuming the shape.src/sandboxes/__tests__/addOrgSubmodules.test.ts (1)
13-15: Remove empty JSDoc block.The JSDoc comment on the
createMockSandboxhelper is completely empty and adds no documentation value.🧹 Suggested fix
-/** - * - */ function createMockSandbox() {Or add a meaningful description:
-/** - * - */ +/** 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__/addOrgSubmodules.test.ts` around lines 13 - 15, Remove the empty JSDoc block above the createMockSandbox helper in the test file: delete the /** */ block entirely (or replace it with a concise meaningful description of what createMockSandbox does), ensuring the createMockSandbox declaration is left directly preceded by either no comment or a short descriptive JSDoc comment.src/content/fetchAudienceContext.ts (1)
4-7: Consider adding descriptions to JSDoc@paramannotations.The added
@paramannotations are empty and don't provide additional documentation value. Either add meaningful descriptions or remove them to avoid documentation noise.📝 Suggested improvement
/** * Fetches audience context (audience.md) from GitHub. * Returns placeholder if not found. - * - * `@param` githubRepo - * `@param` artistSlug - * `@param` fetchFile + * `@param` githubRepo - The GitHub repository URL + * `@param` artistSlug - The artist identifier/slug + * `@param` fetchFile - Function to fetch file content from 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 - 7, The JSDoc for fetchAudienceContext currently lists `@param` githubRepo, `@param` artistSlug, and `@param` fetchFile with no descriptions; update the JSDoc above the fetchAudienceContext function in src/content/fetchAudienceContext.ts to either remove those empty `@param` tags or replace them with short, meaningful descriptions explaining each parameter's purpose (e.g., what type/value githubRepo expects, what artistSlug represents, and what fetchFile does), and add a brief `@returns` description if applicable.src/content/fetchGithubFile.ts (1)
96-99: Empty JSDoc block adds no value.The JSDoc for
parseRepoUrlcontains only an empty description and a parameter name without explanation. Either add meaningful documentation or remove the block entirely.📝 Suggested improvement
-/** - * - * `@param` githubRepoUrl - */ +/** Extracts owner and repo name from a GitHub URL. */ function parseRepoUrl(githubRepoUrl: string): { owner: string; repo: string } {🤖 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 adds no value; remove the empty block or replace it with a concise description and parameter explanation (e.g., describe what parseRepoUrl does, the expected format of githubRepoUrl, and the return value). Update the JSDoc for parseRepoUrl to include meaningful text for the githubRepoUrl param and the function's return type/behavior, or delete the /** ... */ block entirely if you prefer no doc comment.src/recoup/fetchTask.ts (1)
30-32: Add a short description to@param externalId.The tag is present but currently not descriptive.
📝 Suggested doc tweak
- * `@param` externalId + * `@param` externalId - External task ID used to fetch the task 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 - 32, Add a one-line description for the JSDoc `@param` externalId in the fetchTask function: describe that externalId is the external system identifier (e.g., third-party or upstream task ID) used to locate or fetch the task, so update the comment above fetchTask to read a short phrase like "externalId - external system/task identifier used to fetch the task."src/sandboxes/__tests__/runOpenClawAgent.test.ts (1)
15-21: Trim or complete the new JSDoc blocks.These docblocks are currently empty/low-signal. Either add meaningful descriptions or remove them to keep test helpers concise.
✂️ Suggested cleanup
-/** - * - * `@param` finished - * `@param` finished.exitCode - * `@param` finished.stdout - * `@param` finished.stderr - */ function mockDetachedCommand(finished: { exitCode: number; stdout: () => Promise<string>; stderr: () => Promise<string>; }) { return { wait: vi.fn().mockResolvedValue(finished) }; } -/** - * - */ function createMockSandbox() { const runCommand = vi.fn(); return { runCommand } as any; }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 block for the test helper parameter "finished" is empty/low-signal—either remove the docblock entirely or replace it with concise descriptions for the parameter and its properties (finished.exitCode, finished.stdout, finished.stderr); update the JSDoc above the helper function used in runOpenClawAgent.test.ts (the function that accepts the "finished" param) to include a one-line summary and short `@param` lines describing each property, or delete the entire block to keep the test helper concise.src/content/generateAudioVideo.ts (1)
88-94: JSDoc@paramtags lack descriptions.The
@paramannotations are present but empty, which doesn't add value. Either add meaningful descriptions or remove the empty tags.🤖 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, Update the JSDoc for the clip function in src/content/generateAudioVideo.ts by either removing the empty `@param` tags or, preferably, adding concise descriptions for each parameter used by the function (songBuffer, startSeconds, durationSeconds) and any return value; for example document that songBuffer is the MP3 file buffer, startSeconds is the clip start time in seconds, and durationSeconds is the clip length in seconds so the JSDoc on the function (the block above the clip/clipSong or generateAudioVideo function) provides meaningful parameter documentation.src/recoup/getArtistSocials.ts (1)
34-37: Empty JSDoc@paramtag.Same pattern as other files — the
@paramannotation lacks a description.🤖 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 for getArtistSocials has an empty `@param` tag; update the comment above the getArtistSocials function to provide a clear description for the artistAccountId parameter (e.g., "artistAccountId - the unique identifier or account ID of the artist whose social links are being retrieved") so the `@param` is not blank and matches the style used in other files.src/content/loadTemplate.ts (1)
26-27: Empty JSDoc@paramtags don't add documentation value.Multiple functions have
@param paramNameannotations without descriptions. Either add meaningful descriptions or remove the empty tags to avoid clutter.Also applies to: 81-82, 93-95, 128-129, 145-149
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/content/loadTemplate.ts` around lines 26 - 27, Remove or fill empty JSDoc `@param` tags in this file: update the JSDoc blocks for loadTemplate and the other documented functions (e.g., getTemplate, compileTemplate, renderTemplate) so each `@param` either has a concise description or is removed entirely; ensure the remaining JSDoc tags accurately describe parameter names shown in the corresponding function signatures (match symbol names loadTemplate, getTemplate, compileTemplate, renderTemplate) and keep the comments minimal and relevant.src/content/testPipeline.ts (1)
50-58: Empty JSDoc blocks throughout the file add no documentation value.Multiple functions have JSDoc blocks with no content (e.g.,
loadState,saveState,setupFal,testImage, etc.). These empty comment blocks clutter the code without providing documentation. Either add meaningful descriptions or remove them.🤖 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 - 58, Remove or populate the empty JSDoc blocks that provide no value: locate the empty /** */ comments above functions like loadState, saveState, setupFal, testImage, etc., and either delete those empty JSDoc blocks or replace them with brief meaningful descriptions and param/return tags where appropriate (e.g., describe what loadState returns and what saveState persists). Ensure any added JSDoc accurately references the function signature (parameters and return types) and keep comments concise.src/socials/filterScrapableSocials.ts (1)
15-17: Empty JSDoc parameter descriptions provide no value.The
@paramannotations lack descriptions. Either add meaningful documentation or remove the empty annotations to reduce noise.* 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 */🤖 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, The JSDoc for filterScrapableSocials contains empty `@param` tags for artistIds and artistSocialsMap which are noisy; update the JSDoc by either removing those empty `@param` annotations or replacing them with brief, meaningful descriptions (e.g., describe that artistIds is an array of artist identifiers and artistSocialsMap is a map/object of social links keyed by artist ID) so the function header documents its inputs clearly.src/socials/scrapeAndPollSocials.ts (1)
12-14: Empty JSDoc parameter descriptions.Same issue as other files—
@paramtags without descriptions add clutter without value.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/socials/scrapeAndPollSocials.ts` around lines 12 - 14, The JSDoc for the scrapeAndPollSocials function contains empty `@param` tags that add noise; either remove the empty `@param` entries or replace them with concise descriptions for the parameters (e.g., describe "socials" and "batchSize") in the JSDoc block for the scrapeAndPollSocials function so the comment is meaningful and consistent with other files.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 522fe480-bf83-4718-a85f-5599fc8a9165
📒 Files selected for processing (98)
src/artists/getBatchArtistSocials.tssrc/artists/isScrapableSocial.tssrc/chats/getTaskRoomId.tssrc/consts.tssrc/content/analyzeClips.tssrc/content/defaultPipelineConfig.tssrc/content/fetchArtistContext.tssrc/content/fetchAudienceContext.tssrc/content/fetchGithubFile.tssrc/content/generateAudioVideo.tssrc/content/generateCaption.tssrc/content/generateContentImage.tssrc/content/generateContentVideo.tssrc/content/listArtistSongs.tssrc/content/loadTemplate.tssrc/content/renderFinalVideo.tssrc/content/selectAudioClip.tssrc/content/testPipeline.tssrc/content/transcribeSong.tssrc/content/upscaleImage.tssrc/content/upscaleVideo.tssrc/github/__tests__/createOrgGithubRepo.test.tssrc/github/createGithubRepo.tssrc/github/createOrgGithubRepo.tssrc/github/getExistingGithubRepo.tssrc/polling/pollScraperResults.tssrc/pulse/__tests__/executePulseInSandbox.test.tssrc/pulse/executePulseInSandbox.tssrc/recoup/__tests__/getAccountOrgs.test.tssrc/recoup/createAccountSandbox.tssrc/recoup/createChat.tssrc/recoup/fetchActivePulses.tssrc/recoup/fetchTask.tssrc/recoup/generateChat.tssrc/recoup/getAccount.tssrc/recoup/getAccountOrgs.tssrc/recoup/getAccountSandboxes.tssrc/recoup/getArtistSocials.tssrc/recoup/getProArtists.tssrc/recoup/getScraperResults.tssrc/recoup/scrapeSocial.tssrc/recoup/updateAccountSnapshot.tssrc/sandboxes/__tests__/addOrgSubmodules.test.tssrc/sandboxes/__tests__/cloneMonorepoViaAgent.test.tssrc/sandboxes/__tests__/configureGitAuth.test.tssrc/sandboxes/__tests__/copyOpenClawToRepo.test.tssrc/sandboxes/__tests__/ensureOrgRepos.test.tssrc/sandboxes/__tests__/getGitHubAuthPrefix.test.tssrc/sandboxes/__tests__/getOrCreateSandbox.test.tssrc/sandboxes/__tests__/getSandboxHomeDir.test.tssrc/sandboxes/__tests__/notifyCodingAgentCallback.test.tssrc/sandboxes/__tests__/pushOrgRepos.test.tssrc/sandboxes/__tests__/runClaudeCodeAgent.test.tssrc/sandboxes/__tests__/runOpenClawAgent.test.tssrc/sandboxes/__tests__/setupOpenClaw.test.tssrc/sandboxes/__tests__/snapshotAndPersist.test.tssrc/sandboxes/__tests__/stripGitmodulesTokens.test.tssrc/sandboxes/__tests__/syncOrgRepos.test.tssrc/sandboxes/cloneMonorepoViaAgent.tssrc/sandboxes/configureGitAuth.tssrc/sandboxes/ensureGithubRepo.tssrc/sandboxes/ensureOrgRepos.tssrc/sandboxes/ensureSetupSandbox.tssrc/sandboxes/getOrCreateSandbox.tssrc/sandboxes/getSandboxEnv.tssrc/sandboxes/getVercelSandboxCredentials.tssrc/sandboxes/git/addOrgSubmodules.tssrc/sandboxes/git/pushOrgRepos.tssrc/sandboxes/installSkill.tssrc/sandboxes/logStep.tssrc/sandboxes/notifyCodingAgentCallback.tssrc/sandboxes/onboardOpenClaw.tssrc/sandboxes/parsePRUrls.tssrc/sandboxes/pushSandboxToGithub.tssrc/sandboxes/runGitCommand.tssrc/sandboxes/runOpenClawAgent.tssrc/sandboxes/runSetupArtistSkill.tssrc/sandboxes/runSetupSandboxSkill.tssrc/sandboxes/setupOpenClaw.tssrc/sandboxes/snapshotAndPersist.tssrc/sandboxes/writeReadme.tssrc/schemas/__tests__/contentCreationSchema.test.tssrc/schemas/contentCreationSchema.tssrc/schemas/sandboxSchema.tssrc/socials/filterScrapableSocials.tssrc/socials/scrapeAndPollSocials.tssrc/tasks/__tests__/codingAgentTask.test.tssrc/tasks/__tests__/sendPulsesTask.test.tssrc/tasks/__tests__/setupSandboxTask.test.tssrc/tasks/__tests__/updatePRTask.test.tssrc/tasks/codingAgentTask.tssrc/tasks/createContentTask.tssrc/tasks/customerPromptTask.tssrc/tasks/proArtistSocialProfilesScrape.tssrc/tasks/runSandboxCommandTask.tssrc/tasks/sendPulsesTask.tssrc/tasks/setupSandboxTask.tssrc/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
| * @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 |
There was a problem hiding this comment.
Malformed JSDoc @param annotations.
The JSDoc parameter annotations are incorrectly formatted. They reference imageUrl.imageUrl, imageUrl.songBuffer, etc., but the function uses destructured parameters at the top level (imageUrl, songBuffer, audioStartSeconds, etc.). This appears to be auto-generated documentation that didn't correctly parse the parameter structure.
📝 Proposed fix for JSDoc
* 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 19 - 28, The JSDoc `@param`
lines are malformed (e.g., "imageUrl.imageUrl", "imageUrl.songBuffer") and must
match the actual function parameters; update the JSDoc for the function
(generateAudioVideo or the top-level exported function in
src/content/generateAudioVideo.ts) to use correct `@param` names: imageUrl,
songBuffer, audioStartSeconds, audioDurationSeconds, motionPrompt, and provide
short descriptions for each, removing any "imageUrl." prefixes so the
annotations align with the destructured parameters used in the implementation.
| * | ||
| * @param root0 | ||
| * @param root0.template | ||
| * @param root0.songTitle | ||
| * @param root0.fullLyrics | ||
| * @param root0.clipLyrics | ||
| * @param root0.artistContext | ||
| * @param root0.audienceContext | ||
| * @param root0.captionLength |
There was a problem hiding this comment.
Auto-generated JSDoc parameter names are not meaningful.
The root0, root0.template, etc. parameter names appear to be auto-generated placeholders and don't provide useful documentation. Consider either removing them or replacing with meaningful descriptions.
📝 Suggested improvement
* Matches the content-creation-app's generateCaption.ts behavior.
*
- * `@param` root0
- * `@param` root0.template
- * `@param` root0.songTitle
- * `@param` root0.fullLyrics
- * `@param` root0.clipLyrics
- * `@param` root0.artistContext
- * `@param` root0.audienceContext
- * `@param` root0.captionLength
+ * `@param` options - Caption generation options
+ * `@param` options.template - Template data with style/caption guides
+ * `@param` options.songTitle - Title of the song
+ * `@param` options.fullLyrics - Complete song lyrics
+ * `@param` options.clipLyrics - Lyrics for the selected clip window
+ * `@param` options.artistContext - Context about the artist
+ * `@param` options.audienceContext - Context about the target audience
+ * `@param` options.captionLength - Desired caption length (short/medium/long)
*/📝 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.
| * | |
| * @param root0 | |
| * @param root0.template | |
| * @param root0.songTitle | |
| * @param root0.fullLyrics | |
| * @param root0.clipLyrics | |
| * @param root0.artistContext | |
| * @param root0.audienceContext | |
| * @param root0.captionLength | |
| * | |
| * `@param` options - Caption generation options | |
| * `@param` options.template - Template data with style/caption guides | |
| * `@param` options.songTitle - Title of the song | |
| * `@param` options.fullLyrics - Complete song lyrics | |
| * `@param` options.clipLyrics - Lyrics for the selected clip window | |
| * `@param` options.artistContext - Context about the artist | |
| * `@param` options.audienceContext - Context about the target audience | |
| * `@param` options.captionLength - Desired caption length (short/medium/long) |
🤖 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 - 27, The JSDoc block above
generateCaption contains auto-generated param names like root0 and
root0.template; update the comment to use the actual parameter names (template,
songTitle, fullLyrics, clipLyrics, artistContext, audienceContext,
captionLength) and provide brief meaningful descriptions for each (or remove any
unused params), ensuring the JSDoc tags match the function signature in
generateCaption so IDEs and docs show correct parameter info.
| * @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 |
There was a problem hiding this comment.
Malformed JSDoc @param annotations.
Same pattern as other files — faceGuideUrl.faceGuideUrl, faceGuideUrl.referenceImagePath, etc. are incorrectly formatted.
🤖 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 `@param`
annotations in generateContentImage.ts are malformed (e.g., entries like
"faceGuideUrl.faceGuideUrl" and duplicated fields); update the JSDoc for the
function that accepts parameters faceGuideUrl, referenceImagePath, and prompt so
each `@param` line uses the simple parameter name and a short description (for
example "@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"), remove the incorrect dotted entries (faceGuideUrl.faceGuideUrl,
faceGuideUrl.referenceImagePath, faceGuideUrl.prompt) and ensure the remaining
`@param` names exactly match the function signature.
| * @param imageUrl.imageUrl | ||
| * @param imageUrl - URL of the source image (from generateContentImage) | ||
| * @param motionPrompt - Describes how the subject should move | ||
| * @param imageUrl.motionPrompt |
There was a problem hiding this comment.
Malformed JSDoc @param annotations.
Same issue as in generateAudioVideo.ts — the annotations incorrectly reference imageUrl.imageUrl and imageUrl.motionPrompt instead of documenting the actual destructured parameters.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/content/generateContentVideo.ts` around lines 8 - 11, Fix the malformed
JSDoc for the generateContentVideo function: replace the incorrect annotations
like `@param imageUrl.imageUrl` and `@param imageUrl.motionPrompt` with proper
param entries that match the actual destructured parameters (e.g., `@param
imageUrl - URL of the source image (from generateContentImage)` and `@param
motionPrompt - Describes how the subject should move`), remove any
duplicate/misnamed lines, and ensure the JSDoc matches the function signature
used in generateContentVideo.
| * @param root0 | ||
| * @param root0.videoPath | ||
| * @param root0.audioPath | ||
| * @param root0.captionLayout | ||
| * @param root0.captionLayout.lines | ||
| * @param root0.captionLayout.fontSize | ||
| * @param root0.captionLayout.lineHeight | ||
| * @param root0.captionLayout.position | ||
| * @param root0.outputPath | ||
| * @param root0.audioStartSeconds | ||
| * @param root0.audioDurationSeconds | ||
| * @param root0.hasAudio |
There was a problem hiding this comment.
Auto-generated JSDoc with root0 placeholders.
The root0, root0.videoPath, etc. parameter names are auto-generated and don't provide meaningful documentation.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/content/renderFinalVideo.ts` around lines 235 - 246, The JSDoc uses
auto-generated placeholders like `root0` and `root0.videoPath`; update the
comment for the renderFinalVideo function (the destructured params: videoPath,
audioPath, captionLayout, captionLayout.lines, captionLayout.fontSize,
captionLayout.lineHeight, captionLayout.position, outputPath, audioStartSeconds,
audioDurationSeconds, hasAudio) to use those real parameter names and concise
descriptions instead of `root0` placeholders so the documentation is meaningful
and maps to the actual function signature.
| * @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 |
There was a problem hiding this comment.
Malformed JSDoc parameter annotations.
The parameter documentation is incorrectly structured. artistSlug, clipDuration, and lipsync are top-level destructured parameters, not nested properties of githubRepo. Also, @param githubRepo.githubRepo on line 40 is redundant/invalid.
📝 Proposed fix for JSDoc
-* `@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🤖 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
selectAudioClip has malformed param annotations: remove the redundant "@param
githubRepo.githubRepo" and update the annotations so that githubRepo is
documented as its own param and artistSlug, clipDuration, and lipsync are
documented as top‑level params (not properties of githubRepo); locate the
selectAudioClip function and fix the JSDoc `@param` entries to list `@param`
githubRepo, `@param` artistSlug, `@param` clipDuration, and `@param` lipsync with
correct types and brief descriptions.
| * | ||
| * @param runs |
There was a problem hiding this comment.
Complete the JSDoc documentation.
The newly added JSDoc parameter annotation is missing a description for the runs parameter and lacks a @returns tag to document the return value.
📝 Proposed fix for complete JSDoc
/**
* Polls each scraper run in parallel until all are completed (SUCCEEDED or FAILED).
* Returns an array of results for each run.
*
- * `@param` runs
+ * `@param` runs - Array of scraper runs to poll for completion
+ * `@returns` Promise resolving to array of poll results with status and optional data
*/📝 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.
| * | |
| * @param runs | |
| /** | |
| * Polls each scraper run in parallel until all are completed (SUCCEEDED or FAILED). | |
| * Returns an array of results for each run. | |
| * | |
| * `@param` runs - Array of scraper runs to poll for completion | |
| * `@returns` Promise resolving to array of poll results with status and optional data | |
| */ |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/polling/pollScraperResults.ts` around lines 18 - 19, Update the JSDoc for
the pollScraperResults function: add a clear description for the `@param` runs
explaining what each run object contains and how it is used by
pollScraperResults (e.g., array of scraper run results to poll/aggregate), and
add an `@returns` tag that documents the function's return value (type and
meaning, e.g., Promise<SomeType> or array of processed results and what fields
it contains). Locate the function pollScraperResults in
src/polling/pollScraperResults.ts and ensure the `@param` and `@returns`
descriptions match the actual parameter and return types used in the
implementation.
| export async function pollScraperResults( | ||
| runs: ScrapeRun[] | ||
| ): Promise<PollResult[]> { | ||
| export async function pollScraperResults(runs: ScrapeRun[]): Promise<PollResult[]> { |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major
Add Zod schema validation for the input parameter.
The function accepts external input without validation. Input validation should be performed using Zod to ensure type safety at runtime.
🛡️ Proposed implementation with Zod validation
First, define the schema at the top of the file:
import { z } from "zod";
const ScrapeRunSchema = z.object({
runId: z.string(),
datasetId: z.string(),
});
const ScrapeRunsSchema = z.array(ScrapeRunSchema);Then validate the input:
export async function pollScraperResults(runs: ScrapeRun[]): Promise<PollResult[]> {
+ const validatedRuns = ScrapeRunsSchema.parse(runs);
const results: PollResult[] = [];
- const pendingRuns = new Map<string, ScrapeRun>(runs.map(run => [run.runId, run]));
+ const pendingRuns = new Map<string, ScrapeRun>(validatedRuns.map(run => [run.runId, run]));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/polling/pollScraperResults.ts` at line 21, The pollScraperResults
function accepts external input without runtime validation; add Zod validation
by importing z from "zod", define ScrapeRunSchema (with runId: z.string(),
datasetId: z.string()) and ScrapeRunsSchema = z.array(ScrapeRunSchema), then at
the start of pollScraperResults validate the runs parameter using
ScrapeRunsSchema.parse or safeParse and handle failures (throwing an error or
returning a rejected Promise) so only validated data is processed; reference the
symbols ScrapeRunSchema, ScrapeRunsSchema and the function pollScraperResults
when applying the change.
| /** | ||
| * | ||
| */ |
There was a problem hiding this comment.
Empty JSDoc block should be completed or removed.
The JSDoc comment is empty and provides no value. Either add meaningful documentation describing the function's purpose, or remove the empty block entirely.
📝 Suggested fix: Add documentation
/**
- *
+ * Fetches the list of pro artist IDs from the Recoup API.
+ *
+ * `@returns` Array of pro artist IDs, or undefined on error
*/
export async function getProArtists(): Promise<string[] | undefined> {📝 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.
| /** | |
| * | |
| */ | |
| /** | |
| * Fetches the list of pro artist IDs from the Recoup API. | |
| * | |
| * `@returns` Array of pro artist IDs, or undefined on error | |
| */ | |
| export async function getProArtists(): Promise<string[] | undefined> { |
🤖 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 should be removed or replaced with a meaningful
comment; either delete the blank /** */ or add a concise JSDoc for getProArtists
that describes the function's purpose, its parameters (if any), return value,
and any thrown errors or side effects so readers can understand getProArtists at
a glance.
| export async function installSkill(sandbox: Sandbox, skill: string): Promise<void> { | ||
| const skillName = skill.split("/").pop()!; |
There was a problem hiding this comment.
Validate skillName before using it in shell command construction.
skillName (derived from skill) is later interpolated into sh -c at Line 41. Without validation, crafted input can break command boundaries.
🔒 Proposed fix
export async function installSkill(sandbox: Sandbox, skill: string): Promise<void> {
- const skillName = skill.split("/").pop()!;
+ const skillName = skill.split("/").pop();
+ if (!skillName || !/^[a-zA-Z0-9._-]+$/.test(skillName)) {
+ throw new Error(`Invalid skill name: ${skill}`);
+ }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/sandboxes/installSkill.ts` around lines 13 - 14, installSkill currently
derives skillName from the input string and later interpolates it into a shell
command (see sh -c usage); validate skillName before using it by ensuring it is
non-empty and contains only allowed characters (e.g., alphanumerics,
dashes/underscores) and reject or sanitize any input containing path separators
or shell metacharacters, or alternatively avoid shell interpolation by invoking
commands with argument vectors (use spawn/execFile instead of sh -c). Update the
installSkill function to perform this validation/sanitization on skillName and
switch to a safe exec method or error out when validation fails.
Automated PR from coding agent.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Refactor