/**
 * Built-in workflow: `pr_review`
 *
 * Focused review of a PR, diff, or commit range — lighter than full repo audit.
 * Parallel reviewers cover correctness, security, tests, API compat, and perf;
 * final phase produces a ship/block verdict with blockers vs suggestions.
 *
 * Args:
 *   - target: PR description, diff, commit range, or file list
 *   - diff: alias for target
 */
export declare const PR_REVIEW_SCRIPT = "export const meta = {\n  name: 'pr_review',\n  description: 'Review a PR/diff/commit range with parallel focused reviewers and a ship/block verdict.',\n  whenToUse: 'User asks to review a PR, diff, specific changes, or commit range (not the whole repo).',\n  examplePrompts: [\n    { field: 'target', text: 'Review the changes on this branch' },\n    { field: 'target', text: 'Review PR #42 for ship/block verdict' },\n  ],\n  i18n: {\n    zh: {\n      description: '\u5E76\u884C\u805A\u7126\u5BA1\u67E5 PR\u3001diff \u6216\u63D0\u4EA4\u8303\u56F4\uFF0C\u5E76\u7ED9\u51FA\u53EF\u5408\u5E76/\u5E94\u62E6\u622A\u7684\u7ED3\u8BBA\u3002',\n      whenToUse: '\u7528\u6237\u8981\u5BA1\u67E5 PR\u3001diff\u3001\u7279\u5B9A\u6539\u52A8\u6216\u63D0\u4EA4\u8303\u56F4\uFF08\u800C\u975E\u6574\u5E93\uFF09\u65F6\u3002',\n      examplePrompts: [\n        { field: 'target', text: '\u5BA1\u67E5\u5F53\u524D\u5206\u652F\u4E0A\u7684\u6539\u52A8' },\n        { field: 'target', text: '\u5BA1\u67E5 PR #42\uFF0C\u7ED9\u51FA\u662F\u5426\u53EF\u5408\u5E76\u7684\u7ED3\u8BBA' },\n      ],\n    },\n  },\n  tags: ['code-review', 'pr'],\n  estimatedAgents: { min: 7, max: 7 },\n  phases: [\n    { title: 'Scope' },\n    { title: 'Review' },\n    { title: 'Verdict' },\n  ],\n}\n\nconst READ_ONLY_TOOLS = ['read_file', 'grep', 'find', 'list_dir', 'shell']\n\nconst target = args && typeof args === 'object'\n  ? String(args.target ?? args.diff ?? '')\n  : ''\nconst reviewTarget = target.trim()\n  ? target\n  : 'Recent changes in the working tree or the diff/context from the current conversation.'\n\nconst REVIEWERS = [\n  { key: 'correctness', focus: 'Logic bugs, edge cases, error handling, null safety, race conditions in changed code.' },\n  { key: 'security', focus: 'Auth/authz regressions, input validation, secret exposure, injection, unsafe deserialization in the diff.' },\n  { key: 'tests', focus: 'Missing tests for changed behavior, brittle assertions, untested edge cases introduced by this change.' },\n  { key: 'api_compat', focus: 'Breaking public API changes, schema migrations, backward compatibility, deprecation handling.' },\n  { key: 'perf', focus: 'Regressions in hot paths, accidental N+1, sync I/O, unbounded loops or allocations in changed code.' },\n]\n\nphase('Scope')\nconst scope = await agent(\n  'Identify what changed for this review target. List changed files, blast radius (what depends on them), and the apparent intent of the change. Be concise.\\n\\nTARGET:\\n' +\n    reviewTarget,\n  {\n    label: 'change scope',\n    toolset: READ_ONLY_TOOLS,\n    schema: {\n      type: 'object',\n      properties: {\n        changedFiles: { type: 'array', items: { type: 'string' } },\n        intent: { type: 'string' },\n        blastRadius: { type: 'string' },\n      },\n      required: ['changedFiles', 'intent'],\n    },\n  },\n)\n\nphase('Review')\nconst reviews = await parallel(\n  REVIEWERS.map((r) => () =>\n    agent(\n      'Review these changes through the ' + r.key + ' lens.\\n' +\n        'Focus: ' + r.focus + '\\n\\n' +\n        'TARGET:\\n' + reviewTarget + '\\n\\n' +\n        'SCOPE:\\n' + JSON.stringify(scope, null, 2) + '\\n\\n' +\n        'Return findings: file, severity (low/med/high/blocker), title, fix suggestion. Blocker = must fix before merge.',\n      {\n        label: r.key,\n        toolset: READ_ONLY_TOOLS,\n        schema: {\n          type: 'object',\n          properties: {\n            findings: {\n              type: 'array',\n              items: {\n                type: 'object',\n                properties: {\n                  file: { type: 'string' },\n                  severity: { type: 'string', enum: ['low', 'med', 'high', 'blocker'] },\n                  title: { type: 'string' },\n                  fix: { type: 'string' },\n                },\n                required: ['file', 'severity', 'title', 'fix'],\n              },\n            },\n          },\n          required: ['findings'],\n        },\n      },\n    ),\n  ),\n)\n\nphase('Verdict')\nconst live = reviews.filter(Boolean)\nconst byReviewer = {}\nfor (let i = 0; i < REVIEWERS.length; i++) {\n  byReviewer[REVIEWERS[i].key] = live[i]?.findings ?? []\n}\n\nconst verdict = await agent(\n  'Synthesize a PR review verdict. Separate blockers from suggestions. Deduplicate. Recommend ship | fix_first | block.\\n\\n' +\n    JSON.stringify(byReviewer, null, 2),\n  {\n    label: 'verdict',\n    schema: {\n      type: 'object',\n      properties: {\n        recommendation: { type: 'string', enum: ['ship', 'fix_first', 'block'] },\n        summary: { type: 'string' },\n        blockers: {\n          type: 'array',\n          items: {\n            type: 'object',\n            properties: {\n              file: { type: 'string' },\n              title: { type: 'string' },\n              fix: { type: 'string' },\n            },\n            required: ['file', 'title'],\n          },\n        },\n        suggestions: {\n          type: 'array',\n          items: {\n            type: 'object',\n            properties: {\n              file: { type: 'string' },\n              severity: { type: 'string' },\n              title: { type: 'string' },\n            },\n            required: ['file', 'title'],\n          },\n        },\n      },\n      required: ['recommendation', 'summary', 'blockers'],\n    },\n  },\n)\n\nreturn {\n  ok: true,\n  target: reviewTarget,\n  scope,\n  ...(verdict ?? { recommendation: 'fix_first', summary: 'verdict failed', blockers: [], suggestions: [] }),\n  byReviewer,\n}\n";
