Loading...
Loading...
Compare original and translation side by side
user-attachments/assets/ghuser-attachments/assets/ghundefinedundefined
If multiple repos or branches are involved, confirm with the user which PR to target.
Also, normalize the image paths to absolute paths. If a path contains special characters (e.g., Unicode narrow spaces from CleanShot X), copy the file to `/tmp/` first:
```bash
如果涉及多个仓库或分支,请与用户确认目标PR。
同时,将图片路径转换为绝对路径。如果路径包含特殊字符(例如CleanShot X生成的Unicode窄空格),请先将文件复制到`/tmp/`目录:
```bashundefinedundefinedmcp__playwright__*mcp__chrome-devtools__*--profile--profile ~/.agent-browser-githubmcp__playwright__*mcp__chrome-devtools__*--profile--profile ~/.agent-browser-githubundefinedundefinedundefinedundefined| Operation | Playwright MCP | Chrome DevTools MCP | agent-browser (CLI/Bash) |
|---|---|---|---|
| Navigate | | | |
| Snapshot | | | |
| Screenshot | | | |
| Click | | | |
| File Upload | | | |
| JS Eval | | | |
| Login State | Preserved | Preserved | Preserved with |
| 操作 | Playwright MCP | Chrome DevTools MCP | agent-browser (CLI/Bash) |
|---|---|---|---|
| 页面导航 | | | |
| 页面快照 | | | |
| 截图 | | | |
| 点击操作 | | | |
| 文件上传 | | | |
| JS执行 | | | |
| 登录状态 | 已保留 | 已保留 | 使用--profile时保留 |
// Playwright MCP
browser_navigate({ url: "https://github.com/{owner}/{repo}/pull/{number}" })
// Chrome DevTools MCP
navigate_page({ url: "https://github.com/{owner}/{repo}/pull/{number}", type: "url" })
// agent-browser (use --profile to persist login state)
agent-browser --headed --profile ~/.agent-browser-github open "https://github.com/{owner}/{repo}/pull/{number}"https://github.com/login// Playwright MCP
browser_navigate({ url: "https://github.com/{owner}/{repo}/pull/{number}" })
// Chrome DevTools MCP
navigate_page({ url: "https://github.com/{owner}/{repo}/pull/{number}", type: "url" })
// agent-browser(使用--profile持久化登录状态)
agent-browser --headed --profile ~/.agent-browser-github open "https://github.com/{owner}/{repo}/pull/{number}"https://github.com/login// Shared JS for MCP-based tools — tries multiple known selectors
() => {
const selectors = [
'input[type="file"][id*="comment"]',
'input[type="file"][id="fc-new_comment_field"]',
'#new_comment_field',
'input[type="file"]'
];
for (const sel of selectors) {
const el = document.querySelector(sel);
if (el) return { found: true, id: el.id, selector: sel };
}
return { found: false };
}uid// 基于MCP工具的通用JS代码——尝试多个已知选择器
() => {
const selectors = [
'input[type="file"][id*="comment"]',
'input[type="file"][id="fc-new_comment_field"]',
'#new_comment_field',
'input[type="file"]'
];
for (const sel of selectors) {
const el = document.querySelector(sel);
if (el) return { found: true, id: el.id, selector: sel };
}
return { found: false };
}uid// Chrome DevTools MCP: upload_file requires the uid of the input element
// Playwright MCP: browser_file_upload takes the element ref and file path(s) array
// agent-browser: agent-browser upload {ref} {absolute_path}// Chrome DevTools MCP:upload_file需要输入元素的uid
// Playwright MCP:browser_file_upload接收元素引用和文件路径数组
// agent-browser:agent-browser upload {ref} {absolute_path}// Shared JS — tries both known textarea IDs
() => {
const ta = document.getElementById('new_comment_field')
|| document.querySelector('textarea[id*="comment"]');
return ta ? ta.value : 'textarea not found';
}undefined// 通用JS代码——尝试两个已知的输入框ID
() => {
const ta = document.getElementById('new_comment_field')
|| document.querySelector('textarea[id*="comment"]');
return ta ? ta.value : 'textarea not found';
}undefined
The response contains URLs in the format:
Extract all image URLs/markdown from the textarea value before clearing it.
返回结果包含如下格式的URL:
在清空输入框前,提取其中所有图片URL/Markdown内容。// MCP-based tools
() => {
const ta = document.getElementById('new_comment_field')
|| document.querySelector('textarea[id*="comment"]');
if (ta) { ta.value = ""; return "cleared"; }
return "textarea not found";
}undefined// 基于MCP的工具
() => {
const ta = document.getElementById('new_comment_field')
|| document.querySelector('textarea[id*="comment"]');
if (ta) { ta.value = ""; return "cleared"; }
return "textarea not found";
}undefinedundefinedundefinedEXISTING_BODY=$(gh pr view {PR_NUMBER} --json body -q .body)
gh pr edit {PR_NUMBER} --body "$(printf '%s\n\n## Screenshots\n\n%s' "$EXISTING_BODY" "")"gh pr comment {PR_NUMBER} --body "## Screenshots
"EXISTING_BODY=$(gh pr view {PR_NUMBER} --json body -q .body)
gh pr edit {PR_NUMBER} --body "$(printf '%s\n\n## 截图\n\n%s' "$EXISTING_BODY" "")"gh pr comment {PR_NUMBER} --body "## 截图
"<img><img width="800" alt="description" src="..." />--profile ~/.agent-browser-github<img><img width="800" alt="description" src="..." />--profile ~/.agent-browser-github| Issue | Solution |
|---|---|
| Not logged in (MCP tools) | SSO screen may appear — take snapshot, find "Continue" button, click it |
| Not logged in (agent-browser) | Use |
| Browser window not visible | For agent-browser, ensure |
| File path with special characters (e.g., Unicode narrow spaces from CleanShot) | Copy file to |
| File upload fails | Ensure the file path is absolute |
| Textarea doesn't contain URLs yet | Wait 3–5 seconds after upload before running JS eval; retry once if needed |
| Textarea selector not found | GitHub UI changes occasionally — use the multi-selector JS in Step 2 to find the current element |
| Chrome DevTools MCP disconnected | Reconnect via |
| agent-browser not found | |
| No browser tools found | Use |
| PR not found / 404 | Private repos return 404 for unauthenticated users — check login state |
| 问题 | 解决方案 |
|---|---|
| 未登录(MCP工具) | 可能出现SSO界面——截取快照,找到“Continue”按钮并点击 |
| 未登录(agent-browser) | 使用 |
| 浏览器窗口不可见 | 对于agent-browser,确保使用 |
| 文件路径包含特殊字符(例如CleanShot生成的Unicode窄空格) | 将文件复制到 |
| 文件上传失败 | 确保使用绝对文件路径 |
| 输入框中尚未出现URL | 上传后等待3-5秒再执行JS代码;若需要,重试一次 |
| 未找到输入框选择器 | GitHub UI偶尔会变更——使用步骤2中的多选择器JS代码查找当前元素 |
| Chrome DevTools MCP断开连接 | 通过 |
| 未找到agent-browser | 执行 |
| 未找到浏览器工具 | 使用 |
| PR未找到 / 404 | 私有仓库对未认证用户返回404——检查登录状态 |
user-attachments/assets/gh pr edituser-attachments/assets/gh pr edit