From ba02738d34f6e0037b2b71db96a9edea8fb43fc2 Mon Sep 17 00:00:00 2001 From: Ryan Vogel Date: Wed, 18 Feb 2026 21:16:19 -0500 Subject: [PATCH] init stage --- .github/workflows/pr-standards.yml | 12 ++++++ .opencode/agent/duplicate-issue.md | 27 ++++++++++++ .opencode/tool/github-issue-search.ts | 57 ++++++++++++++++++++++++++ .opencode/tool/github-issue-search.txt | 10 +++++ 4 files changed, 106 insertions(+) create mode 100644 .opencode/agent/duplicate-issue.md create mode 100644 .opencode/tool/github-issue-search.ts create mode 100644 .opencode/tool/github-issue-search.txt diff --git a/.github/workflows/pr-standards.yml b/.github/workflows/pr-standards.yml index 27581d06b7..bc66229ddf 100644 --- a/.github/workflows/pr-standards.yml +++ b/.github/workflows/pr-standards.yml @@ -6,6 +6,18 @@ on: jobs: check-standards: + if: | + github.event.pull_request.user.login != 'actions-user' && + github.event.pull_request.user.login != 'opencode' && + github.event.pull_request.user.login != 'rekram1-node' && + github.event.pull_request.user.login != 'thdxr' && + github.event.pull_request.user.login != 'kommander' && + github.event.pull_request.user.login != 'jayair' && + github.event.pull_request.user.login != 'fwang' && + github.event.pull_request.user.login != 'adamdotdevin' && + github.event.pull_request.user.login != 'iamdavidhill' && + github.event.pull_request.user.login != 'R44VC0RP' && + github.event.pull_request.user.login != 'opencode-agent[bot]' runs-on: ubuntu-latest permissions: contents: read diff --git a/.opencode/agent/duplicate-issue.md b/.opencode/agent/duplicate-issue.md new file mode 100644 index 0000000000..2f2a3d196e --- /dev/null +++ b/.opencode/agent/duplicate-issue.md @@ -0,0 +1,27 @@ +--- +mode: primary +hidden: true +model: opencode/claude-haiku-4-5 +color: "#E67E22" +tools: + "*": false + "github-issue-search": true + "github-pr-search": true +--- + +You are a duplicate issue detection agent. When an issue is opened, your job is to search for potentially duplicate or related open issues. + +Use the github-issue-search tool to search for issues that might be addressing the same issue or feature. You also have the github-pr-search tool to search for PRs that might be addressing the same issue or feature. + +IMPORTANT: The input will contain a line `CURRENT_PR_NUMBER: NNNN`. This is the current PR number, you should not mark that the current PR as a duplicate of itself. + +Search using keywords from the PR title and description. Try multiple searches with different relevant terms. + +If you find potential duplicates: + +- List them with their titles and URLs +- Briefly explain why they might be related + +If no duplicates are found, say so clearly. BUT ONLY SAY "No duplicate PRs found" (don't say anything else if no dups) + +Keep your response concise and actionable. diff --git a/.opencode/tool/github-issue-search.ts b/.opencode/tool/github-issue-search.ts new file mode 100644 index 0000000000..e028446c2a --- /dev/null +++ b/.opencode/tool/github-issue-search.ts @@ -0,0 +1,57 @@ +/// +import { tool } from "@opencode-ai/plugin" +import DESCRIPTION from "./github-issue-search.txt" + +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() +} + +interface Issue { + title: string + html_url: string +} + +export default tool({ + description: DESCRIPTION, + args: { + query: tool.schema.string().describe("Search query for issue titles and descriptions"), + limit: tool.schema.number().describe("Maximum number of results to return").default(10), + offset: tool.schema.number().describe("Number of results to skip for pagination").default(0), + }, + async execute(args) { + const owner = "anomalyco" + const repo = "opencode" + + const page = Math.floor(args.offset / args.limit) + 1 + const searchQuery = encodeURIComponent(`${args.query} repo:${owner}/${repo} type:issue state:open`) + const result = await githubFetch( + `/search/issues?q=${searchQuery}&per_page=${args.limit}&page=${page}&sort=updated&order=desc`, + ) + + if (result.total_count === 0) { + return `No issues found matching "${args.query}"` + } + + const issues = result.items as Issue[] + + if (issues.length === 0) { + return `No other issues found matching "${args.query}"` + } + + const formatted = issues.map((issue) => `${issue.title}\n${issue.html_url}`).join("\n\n") + + return `Found ${result.total_count} issues (showing ${issues.length}):\n\n${formatted}` + }, +}) diff --git a/.opencode/tool/github-issue-search.txt b/.opencode/tool/github-issue-search.txt new file mode 100644 index 0000000000..176e916084 --- /dev/null +++ b/.opencode/tool/github-issue-search.txt @@ -0,0 +1,10 @@ +Use this tool to search GitHub issues by title and description. + +This tool searches issues in the sst/opencode repository and returns LLM-friendly results including: +- Issue number and title +- Author +- State (open/closed/merged) +- Labels +- Description snippet + +Use the query parameter to search for keywords that might appear in issue titles or descriptions.