{"url_pattern":"^https?://(www\\.)?github\\.com(/.*)?$","site_name":"github","allowed_domains":["api.github.com","github.com"],"tools":[{"name":"github_fork","description":"Fork a GitHub repository","inputSchema":{"type":"object","properties":{"repo":{"type":"string","description":"Repository to fork (owner/repo)"}},"required":["repo"]},"handler":"(params) => {\n  const run = async function(args) {\n\n      if (!args.repo) return {error: 'Missing argument: repo'};\n\n      const resp = await fetch('https://api.github.com/repos/' + args.repo + '/forks', {\n        method: 'POST',\n        credentials: 'include',\n        headers: {'Content-Type': 'application/json'},\n        body: JSON.stringify({})\n      });\n\n      if (!resp.ok) {\n        const status = resp.status;\n        if (status === 401 || status === 403) return {error: 'HTTP ' + status, hint: 'Not logged in to GitHub'};\n        if (status === 404) return {error: 'Repo not found: ' + args.repo};\n        return {error: 'HTTP ' + status};\n      }\n\n      const fork = await resp.json();\n      return {\n        full_name: fork.full_name,\n        url: fork.html_url,\n        clone_url: fork.clone_url\n      };\n  };\n  return run(params || {});\n}"},{"name":"github_get_repo_info","description":"Get current repository information","inputSchema":{"type":"object","properties":{},"required":null},"handler":"(params) => {\n  const repoName = document.querySelector('[itemprop=\"name\"] a')?.textContent?.trim();\n  const description = document.querySelector('[data-pjax=\"#repo-content-pjax-container\"] p')?.textContent?.trim();\n  const stars = document.querySelector('#repo-stars-counter-star')?.getAttribute('title');\n  const forks = document.querySelector('#repo-network-counter')?.getAttribute('title');\n  return {\n    success: true,\n    repo: { name: repoName, description, stars, forks }\n  };\n}"},{"name":"github_issue_create","description":"Create a GitHub issue","inputSchema":{"type":"object","properties":{"repo":{"type":"string","description":"owner/repo format"},"title":{"type":"string","description":"Issue title"},"body":{"type":"string","description":"Issue body (markdown)"}},"required":["repo","title"]},"handler":"(params) => {\n  const run = async function(args) {\n\n      if (!args.repo) return {error: 'Missing argument: repo'};\n      if (!args.title) return {error: 'Missing argument: title'};\n\n      const resp = await fetch('https://api.github.com/repos/' + args.repo + '/issues', {\n        method: 'POST',\n        credentials: 'include',\n        headers: {'Content-Type': 'application/json'},\n        body: JSON.stringify({title: args.title, body: args.body || ''})\n      });\n\n      if (!resp.ok) {\n        const status = resp.status;\n        if (status === 401 || status === 403) return {error: 'HTTP ' + status, hint: 'Not logged in to GitHub'};\n        if (status === 404) return {error: 'Repo not found: ' + args.repo};\n        return {error: 'HTTP ' + status};\n      }\n\n      const issue = await resp.json();\n      return {\n        number: issue.number,\n        title: issue.title,\n        url: issue.html_url,\n        state: issue.state\n      };\n  };\n  return run(params || {});\n}"},{"name":"github_issues","description":"获取 GitHub 仓库的 issue 列表","inputSchema":{"type":"object","properties":{"repo":{"type":"string","description":"owner/repo format"},"state":{"type":"string","description":"open, closed, or all (default: open)"}},"required":["repo"]},"handler":"(params) => {\n  const run = async function(args) {\n\n      if (!args.repo) return {error: 'Missing argument: repo'};\n      const state = args.state || 'open';\n      const resp = await fetch('https://api.github.com/repos/' + args.repo + '/issues?state=' + state + '&per_page=30', {credentials: 'include'});\n      if (!resp.ok) return {error: 'HTTP ' + resp.status};\n      const issues = await resp.json();\n      return {\n        repo: args.repo, state, count: issues.length,\n        issues: issues.map(i => ({\n          number: i.number, title: i.title, state: i.state,\n          url: i.html_url,\n          author: i.user?.login, labels: i.labels?.map(l => l.name),\n          comments: i.comments, created_at: i.created_at,\n          is_pr: !!i.pull_request\n        }))\n      };\n  };\n  return run(params || {});\n}"},{"name":"github_me","description":"获取当前 GitHub 登录用户信息","inputSchema":{"type":"object","properties":{},"required":null},"handler":"(params) => {\n  const run = async function(args) {\n\n      const resp = await fetch('https://api.github.com/user', {credentials: 'include'});\n      if (!resp.ok) return {error: 'HTTP ' + resp.status, hint: resp.status === 401 ? 'Not logged into github.com' : 'API error'};\n      const d = await resp.json();\n      return {\n        login: d.login, name: d.name, bio: d.bio,\n        url: d.html_url || ('https://github.com/' + d.login),\n        public_repos: d.public_repos, followers: d.followers, following: d.following,\n        created_at: d.created_at\n      };\n  };\n  return run(params || {});\n}"},{"name":"github_pr_create","description":"Create a GitHub pull request","inputSchema":{"type":"object","properties":{"repo":{"type":"string","description":"Target repo (owner/repo)"},"title":{"type":"string","description":"PR title"},"head":{"type":"string","description":"Source branch (user:branch or branch)"},"base":{"type":"string","description":"Target branch (default: main)"},"body":{"type":"string","description":"PR description (markdown)"}},"required":["repo","title","head"]},"handler":"(params) => {\n  const run = async function(args) {\n\n      if (!args.repo) return {error: 'Missing argument: repo'};\n      if (!args.title) return {error: 'Missing argument: title'};\n      if (!args.head) return {error: 'Missing argument: head', hint: 'Provide source branch as \"user:branch\" or \"branch\"'};\n\n      const resp = await fetch('https://api.github.com/repos/' + args.repo + '/pulls', {\n        method: 'POST',\n        credentials: 'include',\n        headers: {'Content-Type': 'application/json'},\n        body: JSON.stringify({\n          title: args.title,\n          head: args.head,\n          base: args.base || 'main',\n          body: args.body || ''\n        })\n      });\n\n      if (!resp.ok) {\n        const status = resp.status;\n        if (status === 401 || status === 403) return {error: 'HTTP ' + status, hint: 'Not logged in to GitHub'};\n        if (status === 404) return {error: 'Repo not found: ' + args.repo};\n        if (status === 422) {\n          const d = await resp.json().catch(() => null);\n          const msg = d?.errors?.[0]?.message || d?.message || 'Validation failed';\n          return {error: msg, hint: 'Check that the head branch exists and has commits ahead of base'};\n        }\n        return {error: 'HTTP ' + status};\n      }\n\n      const pr = await resp.json();\n      return {\n        number: pr.number,\n        title: pr.title,\n        url: pr.html_url,\n        state: pr.state\n      };\n  };\n  return run(params || {});\n}"},{"name":"github_repo","description":"获取 GitHub 仓库信息","inputSchema":{"type":"object","properties":{"repo":{"type":"string","description":"owner/repo format (e.g. epiral/bb-browser)"}},"required":["repo"]},"handler":"(params) => {\n  const run = async function(args) {\n\n      if (!args.repo) return {error: 'Missing argument: repo', hint: 'Use owner/repo format'};\n      const resp = await fetch('https://api.github.com/repos/' + args.repo, {credentials: 'include'});\n      if (!resp.ok) return {error: 'HTTP ' + resp.status, hint: resp.status === 404 ? 'Repo not found: ' + args.repo : 'API error'};\n      const d = await resp.json();\n      return {\n        full_name: d.full_name, description: d.description, language: d.language,\n        url: d.html_url || ('https://github.com/' + d.full_name),\n        stars: d.stargazers_count, forks: d.forks_count, open_issues: d.open_issues_count,\n        created_at: d.created_at, updated_at: d.updated_at, default_branch: d.default_branch,\n        topics: d.topics, license: d.license?.spdx_id\n      };\n  };\n  return run(params || {});\n}"},{"name":"github_star_repo","description":"Star the current repository","inputSchema":{"type":"object","properties":{},"required":null},"handler":"(params) => {\n  const starButton = document.querySelector('button[data-ga-click*=\"star\"]');\n  if (starButton && !starButton.textContent.includes('Unstar')) {\n    starButton.click();\n    return { success: true, message: 'Starred the repository' };\n  }\n  return { success: false, message: 'Star button not found or already starred' };\n}"}]}