Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/api/accounts/[id]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* - id (required): The unique identifier of the account (UUID)
*
* @param request - The request object
* @param params.params

Check failure on line 26 in app/api/accounts/[id]/route.ts

View workflow job for this annotation

GitHub Actions / lint

Missing JSDoc @param "params.params" description

Check failure on line 26 in app/api/accounts/[id]/route.ts

View workflow job for this annotation

GitHub Actions / lint

@param path declaration ("params.params") root node name ("params") does not match previous real parameter name ("request")
* @param params - Route params containing the account ID
Comment on lines +26 to 27
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 redundant and confusing @param params.params entry.

Line 26's @param params.params is incorrect for the destructured parameter syntax { params }. Line 27 already correctly documents the params object. The duplicate entry on line 26 should be removed to avoid confusion.

🧹 Proposed fix
  * `@param` request - The request object
- * `@param` params.params
  * `@param` params - Route params containing the account ID
  * `@returns` A NextResponse with account 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.

Suggested change
* @param params.params
* @param params - Route params containing the account ID
* `@param` request - The request object
* `@param` params - Route params containing the account ID
* `@returns` A NextResponse with account data
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/api/accounts/`[id]/route.ts around lines 26 - 27, Remove the incorrect
JSDoc entry "@param params.params" that duplicates and conflicts with the
correct "@param params" for the destructured handler parameter; update the JSDoc
above the route handler (the function that accepts "{ params }" in
app/api/accounts/[id]/route.ts) so it only documents "@param params - Route
params containing the account ID" and remove the redundant line to avoid
confusion.

* @returns A NextResponse with account data
*/
Expand Down
2 changes: 2 additions & 0 deletions app/api/admins/coding/slack/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@
import { getCorsHeaders } from "@/lib/networking/getCorsHeaders";
import { getSlackTagsHandler } from "@/lib/admins/slack/getSlackTagsHandler";

/**

Check failure on line 5 in app/api/admins/coding/slack/route.ts

View workflow job for this annotation

GitHub Actions / lint

Missing JSDoc @returns declaration
* GET /api/admins/coding/slack
*
* Returns Slack tagging analytics for the Recoup Coding Agent bot.
* Pulls directly from the Slack API as the source of truth.
* Supports period filtering: all (default), daily, weekly, monthly.
* Requires admin authentication.
*
* @param request

Check failure on line 13 in app/api/admins/coding/slack/route.ts

View workflow job for this annotation

GitHub Actions / lint

Missing JSDoc @param "request" description
*/
export async function GET(request: NextRequest): Promise<NextResponse> {
return getSlackTagsHandler(request);
}

/** CORS preflight handler. */

Check failure on line 19 in app/api/admins/coding/slack/route.ts

View workflow job for this annotation

GitHub Actions / lint

Missing JSDoc @returns declaration
export async function OPTIONS(): Promise<NextResponse> {
return new NextResponse(null, { status: 204, headers: getCorsHeaders() });
}
5 changes: 5 additions & 0 deletions app/api/admins/privy/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ import { getPrivyLoginsHandler } from "@/lib/admins/privy/getPrivyLoginsHandler"
* Returns Privy login statistics for the requested time period.
* Supports daily (last 24h), weekly (last 7 days), and monthly (last 30 days) periods.
* Requires admin authentication.
*
* @param request
*/
export async function GET(request: NextRequest): Promise<NextResponse> {
return getPrivyLoginsHandler(request);
}

/**
*
*/
export async function OPTIONS(): Promise<NextResponse> {
return new NextResponse(null, { status: 204, headers: getCorsHeaders() });
}
1 change: 1 addition & 0 deletions app/api/songs/analyze/presets/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export async function OPTIONS() {
* - status: "success"
* - presets: Array of { name, label, description, requiresAudio, responseFormat }
*
* @param request
* @returns A NextResponse with the list of available presets
*/
export async function GET(request: NextRequest): Promise<NextResponse> {
Expand Down
4 changes: 4 additions & 0 deletions app/api/transcribe/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import { NextRequest, NextResponse } from "next/server";
import { processAudioTranscription } from "@/lib/transcribe/processAudioTranscription";
import { formatTranscriptionError } from "@/lib/transcribe/types";

/**
*
* @param req
*/
export async function POST(req: NextRequest) {
try {
const body = await req.json();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ vi.mock("@/lib/admins/validateAdminAuth", () => ({
validateAdminAuth: vi.fn(),
}));

/**
*
* @param url
*/
function createMockRequest(url: string): NextRequest {
return {
url,
Expand Down
4 changes: 4 additions & 0 deletions lib/admins/pr/__tests__/getPrMergedStatusHandler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ vi.mock("@/lib/github/fetchGithubPrStatus", () => ({
const PR_URL_1 = "https://github.com/recoupable/api/pull/42";
const PR_URL_2 = "https://github.com/recoupable/chat/pull/100";

/**
*
* @param urls
*/
function makeRequest(urls: string[] = [PR_URL_1]) {
const params = new URLSearchParams();
urls.forEach(url => params.append("pull_requests", url));
Expand Down
2 changes: 2 additions & 0 deletions lib/admins/pr/getPrStatusHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { fetchGithubPrStatus } from "@/lib/github/fetchGithubPrStatus";
* Uses the GitHub REST API to check each PR's state.
*
* Requires admin authentication.
*
* @param request
*/
export async function getPrStatusHandler(request: NextRequest): Promise<NextResponse> {
try {
Expand Down
3 changes: 3 additions & 0 deletions lib/admins/privy/countNewAccounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { getCutoffMs } from "./getCutoffMs";

/**
* Counts how many users in the list were created within the cutoff period.
*
* @param users
* @param period
*/
export function countNewAccounts(users: User[], period: PrivyLoginsPeriod): number {
const cutoffMs = getCutoffMs(period);
Expand Down
4 changes: 4 additions & 0 deletions lib/admins/privy/fetchPrivyLogins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export type FetchPrivyLoginsResult = {
totalPrivyUsers: number;
};

/**
*
* @param period
*/
export async function fetchPrivyLogins(period: PrivyLoginsPeriod): Promise<FetchPrivyLoginsResult> {
const isAll = period === "all";
const cutoffMs = getCutoffMs(period);
Expand Down
2 changes: 2 additions & 0 deletions lib/admins/privy/getCutoffMs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { PERIOD_DAYS } from "./periodDays";
* Returns the cutoff timestamp in milliseconds for a given period.
* Uses midnight UTC calendar day boundaries to match Privy dashboard behavior.
* Returns 0 for "all" (no cutoff).
*
* @param period
*/
export function getCutoffMs(period: PrivyLoginsPeriod): number {
if (period === "all") return 0;
Expand Down
2 changes: 2 additions & 0 deletions lib/admins/privy/getLatestVerifiedAt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import type { User } from "@privy-io/node";
/**
* Returns the most recent latest_verified_at (in ms) across all linked_accounts for a Privy user.
* Returns null if no linked account has a latest_verified_at.
*
* @param user
*/
export function getLatestVerifiedAt(user: User): number | null {
const linkedAccounts = user.linked_accounts;
Expand Down
2 changes: 2 additions & 0 deletions lib/admins/privy/toMs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/**
* Normalizes a Privy timestamp to milliseconds.
* Privy docs say milliseconds but examples show seconds (10 digits).
*
* @param timestamp
*/
export function toMs(timestamp: number): number {
return timestamp > 1e12 ? timestamp : timestamp * 1000;
Expand Down
1 change: 1 addition & 0 deletions lib/ai/getModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { GatewayLanguageModelEntry } from "@ai-sdk/gateway";

/**
* Returns a specific model by its ID from the list of available models.
*
* @param modelId - The ID of the model to find
* @returns The matching model or undefined if not found
*/
Expand Down
2 changes: 2 additions & 0 deletions lib/ai/isEmbedModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { GatewayLanguageModelEntry } from "@ai-sdk/gateway";
/**
* Determines if a model is an embedding model (not suitable for chat).
* Embed models typically have 0 output pricing since they only produce embeddings.
*
* @param m
*/
export const isEmbedModel = (m: GatewayLanguageModelEntry): boolean => {
const pricing = m.pricing;
Expand Down
5 changes: 5 additions & 0 deletions lib/artists/__tests__/createArtistPostHandler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ vi.mock("@/lib/auth/validateAuthContext", () => ({
validateAuthContext: (...args: unknown[]) => mockValidateAuthContext(...args),
}));

/**
*
* @param body
* @param headers
*/
function createRequest(body: unknown, headers: Record<string, string> = {}): NextRequest {
const defaultHeaders: Record<string, string> = {
"Content-Type": "application/json",
Expand Down
5 changes: 5 additions & 0 deletions lib/artists/__tests__/validateCreateArtistBody.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ vi.mock("@/lib/auth/validateAuthContext", () => ({
validateAuthContext: (...args: unknown[]) => mockValidateAuthContext(...args),
}));

/**
*
* @param body
* @param headers
*/
function createRequest(body: unknown, headers: Record<string, string> = {}): NextRequest {
const defaultHeaders: Record<string, string> = { "Content-Type": "application/json" };
return new NextRequest("http://localhost/api/artists", {
Expand Down
4 changes: 4 additions & 0 deletions lib/auth/__tests__/validateAuthContext.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ const mockGetAuthenticatedAccountId = vi.mocked(getAuthenticatedAccountId);
const mockValidateOrganizationAccess = vi.mocked(validateOrganizationAccess);
const mockCanAccessAccount = vi.mocked(canAccessAccount);

/**
*
* @param headers
*/
function createMockRequest(headers: Record<string, string> = {}): Request {
return {
headers: {
Expand Down
2 changes: 2 additions & 0 deletions lib/catalog/formatCatalogSongsAsCSV.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { CatalogSong } from "./getCatalogSongs";

/**
* Formats catalog songs into the CSV-like format expected by the scorer
*
* @param songs
*/
export function formatCatalogSongsAsCSV(songs: CatalogSong[]): string {
const csvLines = songs.map(song => {
Expand Down
2 changes: 2 additions & 0 deletions lib/catalog/getCatalogDataAsCSV.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { formatCatalogSongsAsCSV } from "./formatCatalogSongsAsCSV";

/**
* Gets all catalog songs and formats them as CSV for the scorer
*
* @param catalogId
*/
export async function getCatalogDataAsCSV(catalogId: string): Promise<string> {
const allSongs: CatalogSong[] = [];
Expand Down
7 changes: 7 additions & 0 deletions lib/catalog/getCatalogSongs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ export interface CatalogSongsResponse {
error?: string;
}

/**
*
* @param catalogId
* @param pageSize
* @param page
* @param artistName
*/
export async function getCatalogSongs(
catalogId: string,
pageSize: number = 100,
Expand Down
4 changes: 4 additions & 0 deletions lib/catalog/getCatalogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ export interface CatalogsResponse {
error?: string;
}

/**
*
* @param accountId
*/
export async function getCatalogs(accountId: string): Promise<CatalogsResponse> {
try {
const response = await fetch(
Expand Down
5 changes: 5 additions & 0 deletions lib/chat/__tests__/integration/chatEndToEnd.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ const mockDeductCredits = vi.mocked(deductCredits);
const mockGenerateChatTitle = vi.mocked(generateChatTitle);

// Helper to create mock NextRequest
/**
*
* @param body
* @param headers
*/
function createMockRequest(body: unknown, headers: Record<string, string> = {}): Request {
return {
json: () => Promise.resolve(body),
Expand Down
2 changes: 2 additions & 0 deletions lib/chat/toolChains/getPrepareStepResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ type PrepareStepOptions = {
/**
* Returns the next tool to run based on timeline progression through tool chains.
* Uses toolCallsContent to track exact execution order and position in sequence.
*
* @param options
Comment on lines +15 to +16
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

Complete the JSDoc parameter documentation.

The @param tag is present but lacks a description. Since this PR aims to improve documentation, consider describing what the options parameter contains.

📝 Suggested enhancement for JSDoc completeness
  * Returns the next tool to run based on timeline progression through tool chains.
  * Uses toolCallsContent to track exact execution order and position in sequence.
  *
- * `@param` options
+ * `@param` options - The preparation step configuration containing steps, model, and messages

Or for more detailed documentation:

  * Returns the next tool to run based on timeline progression through tool chains.
  * Uses toolCallsContent to track exact execution order and position in sequence.
  *
- * `@param` options
+ * `@param` options - The preparation step configuration
+ * `@param` options.steps - Array of previous step results from the tool chain
+ * `@param` options.stepNumber - Current step number in the execution sequence
+ * `@param` options.model - Language model being used for this conversation
+ * `@param` options.messages - Array of model messages in the conversation
+ * `@returns` The next tool to execute in the chain, or undefined if sequence is complete
📝 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 options
/**
* Returns the next tool to run based on timeline progression through tool chains.
* Uses toolCallsContent to track exact execution order and position in sequence.
*
* `@param` options - The preparation step configuration containing steps, model, and messages
*/
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/chat/toolChains/getPrepareStepResult.ts` around lines 15 - 16, Update the
JSDoc for the getPrepareStepResult function to complete the `@param` documentation
for the options parameter: describe that options is an object passed into
getPrepareStepResult, list the expected properties (their names, types, and a
one-line purpose for each), and indicate which fields are optional vs required;
ensure the description matches the actual parameter shape used inside
getPrepareStepResult so the docs are accurate and helpful.

*/
const getPrepareStepResult = (options: PrepareStepOptions): PrepareStepResult | undefined => {
const { steps } = options;
Expand Down
4 changes: 4 additions & 0 deletions lib/chats/__tests__/createChatHandler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ vi.mock("../generateChatTitle", () => ({
generateChatTitle: vi.fn(),
}));

/**
*
* @param headers
*/
function createMockRequest(
headers: Record<string, string> = { "x-api-key": "test-api-key" },
): NextRequest {
Expand Down
3 changes: 3 additions & 0 deletions lib/chats/processCompactChatRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ interface ProcessCompactChatRequestParams {
* Verifies the chat exists and the user has access before compacting.
*
* @param params - The parameters for processing the chat compaction.
* @param params.chatId
* @param params.prompt
* @param params.accountId
* @returns The result of the compaction attempt.
*/
export async function processCompactChatRequest({
Expand Down
6 changes: 6 additions & 0 deletions lib/coding-agent/__tests__/handleGitHubWebhook.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ const BASE_PAYLOAD = {
},
};

/**
*
* @param body
* @param event
* @param signature
*/
function makeRequest(body: unknown, event = "issue_comment", signature = "valid") {
return {
text: () => Promise.resolve(JSON.stringify(body)),
Expand Down
3 changes: 3 additions & 0 deletions lib/coding-agent/__tests__/onMergeTestToMainAction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ beforeEach(() => {
process.env.GITHUB_TOKEN = "ghp_test";
});

/**
*
*/
function createMockBot() {
return { onAction: vi.fn() } as any;
}
Expand Down
2 changes: 2 additions & 0 deletions lib/coding-agent/encodeGitHubThreadId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import type { GitHubThreadId } from "@chat-adapter/github";
*
* - PR-level: `github:{owner}/{repo}:{prNumber}`
* - Review comment: `github:{owner}/{repo}:{prNumber}:rc:{reviewCommentId}`
*
* @param thread
*/
export function encodeGitHubThreadId(thread: GitHubThreadId): string {
const { owner, repo, prNumber, reviewCommentId } = thread;
Expand Down
2 changes: 2 additions & 0 deletions lib/coding-agent/handleMergeSuccess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import type { CodingAgentThreadState } from "./types";
* Handles post-merge cleanup after all PRs merged successfully.
* Deletes the shared PR state keys for all repos and persists the latest
* snapshot via upsertAccountSnapshot.
*
* @param state
*/
export async function handleMergeSuccess(state: CodingAgentThreadState): Promise<void> {
try {
Expand Down
2 changes: 2 additions & 0 deletions lib/coding-agent/parseMergeActionId.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/**
* Parses a merge action ID like "merge_pr:recoupable/api#42"
* into { repo, number } or null if the format doesn't match.
*
* @param actionId
*/
export function parseMergeActionId(actionId: string) {
const match = actionId.match(/^merge_pr:(.+)#(\d+)$/);
Expand Down
2 changes: 2 additions & 0 deletions lib/coding-agent/parseMergeTestToMainActionId.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/**
* Parses a merge_test_to_main action ID like "merge_test_to_main:recoupable/api"
* into the repo string, or null if the format doesn't match.
*
* @param actionId
*/
export function parseMergeTestToMainActionId(actionId: string): string | null {
const prefix = "merge_test_to_main:";
Expand Down
1 change: 1 addition & 0 deletions lib/composio/getCallbackUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ interface CallbackOptions {
*
* @param options.destination - Where to redirect: "chat" or "connectors"
* @param options.roomId - For chat destination, the room ID to return to
* @param options
* @returns Full callback URL with success indicator
*/
export function getCallbackUrl(options: CallbackOptions): string {
Expand Down
4 changes: 4 additions & 0 deletions lib/content/__tests__/validateCreateContentBody.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ vi.mock("@/lib/content/resolveArtistSlug", () => ({
resolveArtistSlug: vi.fn().mockResolvedValue("gatsby-grace"),
}));

/**
*
* @param body
*/
function createRequest(body: unknown): NextRequest {
return new NextRequest("http://localhost/api/content/create", {
method: "POST",
Expand Down
4 changes: 4 additions & 0 deletions lib/content/contentTemplates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ export const CONTENT_TEMPLATES: ContentTemplate[] = [
/** Derived from the first entry in CONTENT_TEMPLATES to avoid string duplication. */
export const DEFAULT_CONTENT_TEMPLATE = CONTENT_TEMPLATES[0].name;

/**
*
* @param template
*/
export function isSupportedContentTemplate(template: string): boolean {
return CONTENT_TEMPLATES.some(item => item.name === template);
}
2 changes: 2 additions & 0 deletions lib/content/createContentHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { selectAccountSnapshots } from "@/lib/supabase/account_snapshots/selectA
/**
* Handler for POST /api/content/create.
* Always returns runIds array (KISS — one response shape for single and batch).
*
* @param request
*/
export async function createContentHandler(request: NextRequest): Promise<NextResponse> {
const validated = await validateCreateContentBody(request);
Expand Down
5 changes: 5 additions & 0 deletions lib/content/getArtistContentReadiness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ export interface ArtistContentReadiness {
/**
* Checks whether an artist has the expected files for content creation.
* Searches the main repo and org submodule repos.
*
* @param root0
* @param root0.accountId
* @param root0.artistAccountId
* @param root0.artistSlug
*/
export async function getArtistContentReadiness({
accountId,
Expand Down
3 changes: 3 additions & 0 deletions lib/content/getArtistFileTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { getOrgRepoUrls } from "@/lib/github/getOrgRepoUrls";
/**
* Gets the file tree that contains the artist, checking the main repo
* first, then falling back to org submodule repos.
*
* @param githubRepo
* @param artistSlug
*/
export async function getArtistFileTree(
githubRepo: string,
Expand Down
5 changes: 5 additions & 0 deletions lib/content/getArtistRootPrefix.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
*
* @param paths
* @param artistSlug
*/
export function getArtistRootPrefix(paths: string[], artistSlug: string): string {
const preferredPrefix = `artists/${artistSlug}/`;
if (paths.some(path => path.startsWith(preferredPrefix))) {
Expand Down
Loading
Loading