mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-21 18:26:09 +00:00
+22






![opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>](/assets/img/avatar_default.png)

![opencode-agent[bot]](/assets/img/avatar_default.png)
opencode-agent[bot]
GitHub
opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Aiden Cline
usrnk1
Aarav Sareen
Luke Parker
Brendan Allan
Kit Langton
James Long
Adam
opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com>
Jay
Simon Klee
Jay
Jack
David Hill
Brendan Allan
opencode
Aiden Cline
James Long
Dustin Deus
冯基魁
Frank
Aiden Cline
Victor Navarro
Dax Raad
Dax
Nabs
Vladimir Glafirov
AidenGeunGeun
Mark
634386fe0f
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Co-authored-by: usrnk1 <7547651+usrnk1@users.noreply.github.com> Co-authored-by: Aarav Sareen <96787824+arvsrn@users.noreply.github.com> Co-authored-by: Luke Parker <10430890+Hona@users.noreply.github.com> Co-authored-by: Brendan Allan <git@brendonovich.dev> Co-authored-by: Kit Langton <kit.langton@gmail.com> Co-authored-by: James Long <longster@gmail.com> Co-authored-by: Adam <2363879+adamdotdevin@users.noreply.github.com> Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com> Co-authored-by: Jay <53023+jayair@users.noreply.github.com> Co-authored-by: Simon Klee <hello@simonklee.dk> Co-authored-by: Jay <air@live.ca> Co-authored-by: Jack <jack@anoma.ly> Co-authored-by: David Hill <1879069+iamdavidhill@users.noreply.github.com> Co-authored-by: Brendan Allan <14191578+Brendonovich@users.noreply.github.com> Co-authored-by: opencode <opencode@sst.dev> Co-authored-by: Aiden Cline <aidenpcline@gmail.com> Co-authored-by: James Long <jlongster@users.noreply.github.com> Co-authored-by: Dustin Deus <deusdustin@gmail.com> Co-authored-by: 冯基魁 <56265583+fengjikui@users.noreply.github.com> Co-authored-by: Frank <frank@anoma.ly> Co-authored-by: Aiden Cline <rekram1-node@users.noreply.github.com> Co-authored-by: Victor Navarro <vn4varro@gmail.com> Co-authored-by: Dax Raad <d@ironbay.co> Co-authored-by: Dax <mail@thdxr.com> Co-authored-by: Nabs <nabil@instafork.com> Co-authored-by: Vladimir Glafirov <vglafirov@gitlab.com> Co-authored-by: AidenGeunGeun <eastlandwyvern@gmail.com> Co-authored-by: Mark <geraint0923@users.noreply.github.com>
61 lines
1.9 KiB
TypeScript
61 lines
1.9 KiB
TypeScript
/// <reference path="../env.d.ts" />
|
|
import { tool } from "@opencode-ai/plugin"
|
|
|
|
const TEAM = {
|
|
tui: ["kommander", "simonklee"],
|
|
desktop_web: ["Hona", "Brendonovich"],
|
|
core: ["jlongster", "rekram1-node", "nexxeln", "kitlangton"],
|
|
inference: ["fwang", "MrMushrooooom", "starptech"],
|
|
windows: ["Hona"],
|
|
} as const
|
|
|
|
function pick<T>(items: readonly T[]) {
|
|
return items[Math.floor(Math.random() * items.length)]!
|
|
}
|
|
|
|
function getIssueNumber(): number {
|
|
const issue = parseInt(process.env.ISSUE_NUMBER ?? "", 10)
|
|
if (!issue) throw new Error("ISSUE_NUMBER env var not set")
|
|
return issue
|
|
}
|
|
|
|
async function githubFetch(endpoint: string, options: RequestInit = {}) {
|
|
const response = await fetch(`https://api.github.com${endpoint}`, {
|
|
...options,
|
|
headers: {
|
|
Authorization: `Bearer ${process.env.GITHUB_TOKEN}`,
|
|
Accept: "application/vnd.github+json",
|
|
"Content-Type": "application/json",
|
|
...(options.headers instanceof Headers ? Object.fromEntries(options.headers.entries()) : options.headers),
|
|
},
|
|
})
|
|
if (!response.ok) {
|
|
throw new Error(`GitHub API error: ${response.status} ${response.statusText}`)
|
|
}
|
|
return response.json()
|
|
}
|
|
|
|
export default tool({
|
|
description: `Use this tool to assign a GitHub issue.
|
|
|
|
Provide the team that should own the issue. This tool picks a random assignee from that team and does not apply labels.`,
|
|
args: {
|
|
team: tool.schema
|
|
.enum(Object.keys(TEAM) as [keyof typeof TEAM, ...(keyof typeof TEAM)[]])
|
|
.describe("The owning team"),
|
|
},
|
|
async execute(args) {
|
|
const issue = getIssueNumber()
|
|
const owner = "anomalyco"
|
|
const repo = "opencode"
|
|
const assignee = pick(TEAM[args.team])
|
|
|
|
await githubFetch(`/repos/${owner}/${repo}/issues/${issue}/assignees`, {
|
|
method: "POST",
|
|
body: JSON.stringify({ assignees: [assignee] }),
|
|
})
|
|
|
|
return `Assigned @${assignee} from ${args.team} to issue #${issue}`
|
|
},
|
|
})
|