summaryrefslogtreecommitdiffhomepage
path: root/.opencode/tool
diff options
context:
space:
mode:
authorAiden Cline <[email protected]>2025-12-19 11:49:39 -0600
committerAiden Cline <[email protected]>2025-12-19 12:28:11 -0600
commit4bad6f9f1b56b140d217c2af42fa532a61e9aa28 (patch)
tree86c61eff54c2aa791fc51324d100d9ed4825117a /.opencode/tool
parentd7db57e8e10ba8318d6c1cb83a9753a57b26e7d7 (diff)
downloadopencode-4bad6f9f1b56b140d217c2af42fa532a61e9aa28.tar.gz
opencode-4bad6f9f1b56b140d217c2af42fa532a61e9aa28.zip
tweak: use fetch instead of octokit for now
Diffstat (limited to '.opencode/tool')
-rw-r--r--.opencode/tool/github-triage.ts48
1 files changed, 36 insertions, 12 deletions
diff --git a/.opencode/tool/github-triage.ts b/.opencode/tool/github-triage.ts
index 739135169..a5e6c811d 100644
--- a/.opencode/tool/github-triage.ts
+++ b/.opencode/tool/github-triage.ts
@@ -1,5 +1,5 @@
/// <reference path="../env.d.ts" />
-import { Octokit } from "@octokit/rest"
+// import { Octokit } from "@octokit/rest"
import { tool } from "@opencode-ai/plugin"
import DESCRIPTION from "./github-triage.txt"
@@ -9,6 +9,22 @@ function getIssueNumber(): number {
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,
+ },
+ })
+ if (!response.ok) {
+ throw new Error(`GitHub API error: ${response.status} ${response.statusText}`)
+ }
+ return response.json()
+}
+
export default tool({
description: DESCRIPTION,
args: {
@@ -23,7 +39,7 @@ export default tool({
},
async execute(args) {
const issue = getIssueNumber()
- const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN })
+ // const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN })
const owner = "sst"
const repo = "opencode"
@@ -41,22 +57,30 @@ export default tool({
throw new Error("Only opentui issues should be assigned to kommander")
}
- await octokit.rest.issues.addAssignees({
- owner,
- repo,
- issue_number: issue,
- assignees: [args.assignee],
+ // await octokit.rest.issues.addAssignees({
+ // owner,
+ // repo,
+ // issue_number: issue,
+ // assignees: [args.assignee],
+ // })
+ await githubFetch(`/repos/${owner}/${repo}/issues/${issue}/assignees`, {
+ method: "POST",
+ body: JSON.stringify({ assignees: [args.assignee] }),
})
results.push(`Assigned @${args.assignee} to issue #${issue}`)
const labels: string[] = args.labels.map((label) => (label === "desktop" ? "web" : label))
if (labels.length > 0) {
- await octokit.rest.issues.addLabels({
- owner,
- repo,
- issue_number: issue,
- labels,
+ // await octokit.rest.issues.addLabels({
+ // owner,
+ // repo,
+ // issue_number: issue,
+ // labels,
+ // })
+ await githubFetch(`/repos/${owner}/${repo}/issues/${issue}/labels`, {
+ method: "POST",
+ body: JSON.stringify({ labels }),
})
results.push(`Added labels: ${args.labels.join(", ")}`)
}