source dump of claude code
at main 57 lines 2.2 kB view raw
1import type { ContentBlockParam } from '@anthropic-ai/sdk/resources/messages.js' 2import type { Command } from '../commands.js' 3import { isUltrareviewEnabled } from './review/ultrareviewEnabled.js' 4 5// Legal wants the explicit surface name plus a docs link visible before the 6// user triggers, so the description carries "Claude Code on the web" + URL. 7const CCR_TERMS_URL = 'https://code.claude.com/docs/en/claude-code-on-the-web' 8 9const LOCAL_REVIEW_PROMPT = (args: string) => ` 10 You are an expert code reviewer. Follow these steps: 11 12 1. If no PR number is provided in the args, run \`gh pr list\` to show open PRs 13 2. If a PR number is provided, run \`gh pr view <number>\` to get PR details 14 3. Run \`gh pr diff <number>\` to get the diff 15 4. Analyze the changes and provide a thorough code review that includes: 16 - Overview of what the PR does 17 - Analysis of code quality and style 18 - Specific suggestions for improvements 19 - Any potential issues or risks 20 21 Keep your review concise but thorough. Focus on: 22 - Code correctness 23 - Following project conventions 24 - Performance implications 25 - Test coverage 26 - Security considerations 27 28 Format your review with clear sections and bullet points. 29 30 PR number: ${args} 31 ` 32 33const review: Command = { 34 type: 'prompt', 35 name: 'review', 36 description: 'Review a pull request', 37 progressMessage: 'reviewing pull request', 38 contentLength: 0, 39 source: 'builtin', 40 async getPromptForCommand(args): Promise<ContentBlockParam[]> { 41 return [{ type: 'text', text: LOCAL_REVIEW_PROMPT(args) }] 42 }, 43} 44 45// /ultrareview is the ONLY entry point to the remote bughunter path — 46// /review stays purely local. local-jsx type renders the overage permission 47// dialog when free reviews are exhausted. 48const ultrareview: Command = { 49 type: 'local-jsx', 50 name: 'ultrareview', 51 description: `~10–20 min · Finds and verifies bugs in your branch. Runs in Claude Code on the web. See ${CCR_TERMS_URL}`, 52 isEnabled: () => isUltrareviewEnabled(), 53 load: () => import('./review/ultrareviewCommand.js'), 54} 55 56export default review 57export { ultrareview }