Skip to content

Commit a03e114

Browse files
Apply PR #16918: opencode 2-0
2 parents 14f82ae + 6ad171d commit a03e114

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1692
-1390
lines changed

.opencode/.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
plans/
2-
bun.lock
1+
node_modules
2+
plans
33
package.json
4+
bun.lock
5+
.gitignore
6+
package-lock.json

.opencode/tool/github-pr-search.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/// <reference path="../env.d.ts" />
22
import { tool } from "@opencode-ai/plugin"
3-
import DESCRIPTION from "./github-pr-search.txt"
43

54
async function githubFetch(endpoint: string, options: RequestInit = {}) {
65
const response = await fetch(`https://api.github.com${endpoint}`, {
@@ -24,7 +23,16 @@ interface PR {
2423
}
2524

2625
export default tool({
27-
description: DESCRIPTION,
26+
description: `Use this tool to search GitHub pull requests by title and description.
27+
28+
This tool searches PRs in the anomalyco/opencode repository and returns LLM-friendly results including:
29+
- PR number and title
30+
- Author
31+
- State (open/closed/merged)
32+
- Labels
33+
- Description snippet
34+
35+
Use the query parameter to search for keywords that might appear in PR titles or descriptions.`,
2836
args: {
2937
query: tool.schema.string().describe("Search query for PR titles and descriptions"),
3038
limit: tool.schema.number().describe("Maximum number of results to return").default(10),

.opencode/tool/github-pr-search.txt

Lines changed: 0 additions & 10 deletions
This file was deleted.

.opencode/tool/github-triage.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/// <reference path="../env.d.ts" />
22
import { tool } from "@opencode-ai/plugin"
3-
import DESCRIPTION from "./github-triage.txt"
43

54
const TEAM = {
65
desktop: ["adamdotdevin", "iamdavidhill", "Brendonovich", "nexxeln"],
@@ -40,7 +39,12 @@ async function githubFetch(endpoint: string, options: RequestInit = {}) {
4039
}
4140

4241
export default tool({
43-
description: DESCRIPTION,
42+
description: `Use this tool to assign and/or label a GitHub issue.
43+
44+
Choose labels and assignee using the current triage policy and ownership rules.
45+
Pick the most fitting labels for the issue and assign one owner.
46+
47+
If unsure, choose the team/section with the most overlap with the issue and assign a member from that team at random.`,
4448
args: {
4549
assignee: tool.schema
4650
.enum(ASSIGNEES as [string, ...string[]])

.opencode/tool/github-triage.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ If you are working on a project that's related to OpenCode and is using "opencod
128128

129129
#### How is this different from Claude Code?
130130

131-
It's very similar to Claude Code in terms of capability. Here are the key differences:
131+
It's very similar to Claude Code in terms of capability. Here are the key differences::
132132

133133
- 100% open source
134134
- Not coupled to any provider. Although we recommend the models we provide through [OpenCode Zen](https://opencode.ai/zen), OpenCode can be used with Claude, OpenAI, Google, or even local models. As models evolve, the gaps between them will close and pricing will drop, so being provider-agnostic is important.

bun.lock

Lines changed: 948 additions & 623 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
"@tailwindcss/vite": "4.1.11",
4242
"diff": "8.0.2",
4343
"dompurify": "3.3.1",
44-
"drizzle-kit": "1.0.0-beta.16-ea816b6",
45-
"drizzle-orm": "1.0.0-beta.16-ea816b6",
4644
"effect": "4.0.0-beta.29",
45+
"drizzle-kit": "1.0.0-beta.16-c2458b2",
46+
"drizzle-orm": "1.0.0-beta.16-c2458b2",
4747
"ai": "5.0.124",
4848
"hono": "4.10.7",
4949
"hono-openapi": "1.1.2",

packages/opencode/package.json

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"private": true,
88
"scripts": {
99
"typecheck": "tsgo --noEmit",
10-
"test": "bun test --timeout 30000",
10+
"test": "bun test --timeout 30000 registry",
1111
"build": "bun run script/build.ts",
1212
"dev": "bun run --conditions=browser ./src/index.ts",
1313
"random": "echo 'Random script updated at $(date)' && echo 'Change queued successfully' && echo 'Another change made' && echo 'Yet another change' && echo 'One more change' && echo 'Final change' && echo 'Another final change' && echo 'Yet another final change'",
@@ -25,9 +25,15 @@
2525
"exports": {
2626
"./*": "./src/*.ts"
2727
},
28+
"imports": {
29+
"#db": {
30+
"bun": "./src/storage/db.bun.ts",
31+
"node": "./src/storage/db.node.ts",
32+
"default": "./src/storage/db.bun.ts"
33+
}
34+
},
2835
"devDependencies": {
2936
"@babel/core": "7.28.4",
30-
"@effect/language-service": "0.79.0",
3137
"@octokit/webhooks-types": "7.6.1",
3238
"@opencode-ai/script": "workspace:*",
3339
"@parcel/watcher-darwin-arm64": "2.5.1",
@@ -42,13 +48,14 @@
4248
"@types/babel__core": "7.20.5",
4349
"@types/bun": "catalog:",
4450
"@types/mime-types": "3.0.1",
51+
"@types/npmcli__arborist": "6.3.3",
4552
"@types/semver": "^7.5.8",
4653
"@types/turndown": "5.0.5",
47-
"@types/yargs": "17.0.33",
4854
"@types/which": "3.0.4",
55+
"@types/yargs": "17.0.33",
4956
"@typescript/native-preview": "catalog:",
50-
"drizzle-kit": "1.0.0-beta.16-ea816b6",
51-
"drizzle-orm": "1.0.0-beta.16-ea816b6",
57+
"effect": "catalog:",
58+
"drizzle-kit": "catalog:",
5259
"typescript": "catalog:",
5360
"vscode-languageserver-types": "3.17.5",
5461
"why-is-node-running": "3.2.2",
@@ -81,9 +88,12 @@
8188
"@clack/prompts": "1.0.0-alpha.1",
8289
"@gitlab/gitlab-ai-provider": "3.6.0",
8390
"@gitlab/opencode-gitlab-auth": "1.3.3",
91+
"@hono/node-server": "1.19.11",
92+
"@hono/node-ws": "1.3.0",
8493
"@hono/standard-validator": "0.1.5",
8594
"@hono/zod-validator": "catalog:",
8695
"@modelcontextprotocol/sdk": "1.25.2",
96+
"@npmcli/arborist": "9.4.0",
8797
"@octokit/graphql": "9.0.2",
8898
"@octokit/rest": "catalog:",
8999
"@openauthjs/openauth": "catalog:",
@@ -92,8 +102,8 @@
92102
"@opencode-ai/sdk": "workspace:*",
93103
"@opencode-ai/util": "workspace:*",
94104
"@openrouter/ai-sdk-provider": "1.5.4",
95-
"@opentui/core": "0.1.87",
96-
"@opentui/solid": "0.1.87",
105+
"@opentui/core": "0.1.86",
106+
"@opentui/solid": "0.1.86",
97107
"@parcel/watcher": "2.5.1",
98108
"@pierre/diffs": "catalog:",
99109
"@solid-primitives/event-bus": "1.1.2",
@@ -108,8 +118,7 @@
108118
"clipboardy": "4.0.0",
109119
"decimal.js": "10.5.0",
110120
"diff": "catalog:",
111-
"drizzle-orm": "1.0.0-beta.16-ea816b6",
112-
"effect": "catalog:",
121+
"drizzle-orm": "catalog:",
113122
"fuzzysort": "3.1.0",
114123
"glob": "13.0.5",
115124
"google-auth-library": "10.5.0",
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/env bun
2+
3+
import fs from "fs"
4+
import path from "path"
5+
import { fileURLToPath } from "url"
6+
7+
const __filename = fileURLToPath(import.meta.url)
8+
const __dirname = path.dirname(__filename)
9+
const dir = path.resolve(__dirname, "..")
10+
11+
process.chdir(dir)
12+
13+
// Load migrations from migration directories
14+
const migrationDirs = (
15+
await fs.promises.readdir(path.join(dir, "migration"), {
16+
withFileTypes: true,
17+
})
18+
)
19+
.filter((entry) => entry.isDirectory() && /^\d{4}\d{2}\d{2}\d{2}\d{2}\d{2}/.test(entry.name))
20+
.map((entry) => entry.name)
21+
.sort()
22+
23+
const migrations = await Promise.all(
24+
migrationDirs.map(async (name) => {
25+
const file = path.join(dir, "migration", name, "migration.sql")
26+
const sql = await Bun.file(file).text()
27+
const match = /^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/.exec(name)
28+
const timestamp = match
29+
? Date.UTC(
30+
Number(match[1]),
31+
Number(match[2]) - 1,
32+
Number(match[3]),
33+
Number(match[4]),
34+
Number(match[5]),
35+
Number(match[6]),
36+
)
37+
: 0
38+
return { sql, timestamp, name }
39+
}),
40+
)
41+
console.log(`Loaded ${migrations.length} migrations`)
42+
43+
await Bun.build({
44+
target: "node",
45+
entrypoints: ["./src/node.ts"],
46+
outdir: "./dist",
47+
format: "esm",
48+
external: ["jsonc-parser"],
49+
define: {
50+
OPENCODE_MIGRATIONS: JSON.stringify(migrations),
51+
},
52+
})
53+
54+
console.log("Build complete")

0 commit comments

Comments
 (0)