diff --git a/apps/web/src/lib/code-reviews/prompts/platform-helpers.ts b/apps/web/src/lib/code-reviews/prompts/platform-helpers.ts index 35fd2874778..71c21ee026a 100644 --- a/apps/web/src/lib/code-reviews/prompts/platform-helpers.ts +++ b/apps/web/src/lib/code-reviews/prompts/platform-helpers.ts @@ -114,105 +114,3 @@ export function getPlatformConfig(platform: CodeReviewPlatform): PlatformConfig } } } - -/** - * Get the CLI tool name for a platform - */ -export function getCliTool(platform: CodeReviewPlatform): string { - return getPlatformConfig(platform).cli; -} - -/** - * Get the PR/MR term for a platform - */ -export function getPrTerm(platform: CodeReviewPlatform): string { - return getPlatformConfig(platform).prTerm; -} - -/** - * Replace platform-specific placeholders in text - */ -export function replacePlatformPlaceholders( - text: string, - platform: CodeReviewPlatform, - values: { - repository: string; - prNumber?: string | number; - commentId?: string | number; - baseSha?: string; - startSha?: string; - headSha?: string; - } -): string { - const config = getPlatformConfig(platform); - let result = text; - - // Replace repository/project path - result = result.replace(/{REPO}/g, values.repository); - result = result.replace(/{PROJECT_PATH}/g, values.repository); - - // Replace PR/MR number - if (values.prNumber !== undefined) { - result = result.replace(/{PR_NUMBER}/g, String(values.prNumber)); - result = result.replace(/{PR}/g, String(values.prNumber)); - result = result.replace(/{MR_IID}/g, String(values.prNumber)); - } - - // Replace comment ID - if (values.commentId !== undefined) { - result = result.replace(/{COMMENT_ID}/g, String(values.commentId)); - result = result.replace(/{NOTE_ID}/g, String(values.commentId)); - } - - // Replace GitLab-specific SHA placeholders - if (values.baseSha) { - result = result.replace(/{BASE_SHA}/g, values.baseSha); - } - if (values.startSha) { - result = result.replace(/{START_SHA}/g, values.startSha); - } - if (values.headSha) { - result = result.replace(/{HEAD_SHA}/g, values.headSha); - } - - // Replace CLI tool name - result = result.replace(/{CLI}/g, config.cli); - - // Replace PR term - result = result.replace(/{PR_TERM}/g, config.prTerm); - - return result; -} - -/** - * Terminology mapping for platform-agnostic documentation - */ -export const PLATFORM_TERMINOLOGY = { - github: { - pullRequest: 'Pull Request', - pullRequestShort: 'PR', - mergeRequest: 'Pull Request', - repository: 'repository', - comment: 'comment', - reviewComment: 'review comment', - cli: 'gh', - }, - gitlab: { - pullRequest: 'Merge Request', - pullRequestShort: 'MR', - mergeRequest: 'Merge Request', - repository: 'project', - comment: 'note', - reviewComment: 'discussion', - cli: 'glab', - }, - bitbucket: { - pullRequest: 'Pull Request', - pullRequestShort: 'PR', - mergeRequest: 'Pull Request', - repository: 'repository', - comment: 'comment', - reviewComment: 'inline comment', - cli: 'bb', - }, -} as const;