Skip to content

Commit 4b94d98

Browse files
committed
ci: improve test coverage
1 parent d0043a4 commit 4b94d98

File tree

6 files changed

+54
-448
lines changed

6 files changed

+54
-448
lines changed

.github/workflows/test.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- production
7+
pull_request:
8+
branches-ignore:
9+
- production
10+
workflow_dispatch:
11+
jobs:
12+
format:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
with:
18+
token: ${{ secrets.GITHUB_TOKEN }}
19+
20+
- name: Setup Bun
21+
uses: oven-sh/setup-bun@v1
22+
with:
23+
bun-version: 1.2.21
24+
25+
- name: run
26+
run: |
27+
bun install
28+
bun turbo test
29+
env:
30+
CI: true

packages/opencode/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"private": true,
77
"scripts": {
88
"typecheck": "tsc --noEmit",
9+
"test": "bun test",
910
"build": "./script/build.ts",
1011
"dev": "bun run --conditions=development ./src/index.ts"
1112
},

packages/opencode/src/tool/edit.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -596,13 +596,13 @@ export function replace(content: string, oldString: string, newString: string, r
596596
for (const replacer of [
597597
SimpleReplacer,
598598
LineTrimmedReplacer,
599-
// BlockAnchorReplacer,
599+
BlockAnchorReplacer,
600600
WhitespaceNormalizedReplacer,
601601
IndentationFlexibleReplacer,
602602
EscapeNormalizedReplacer,
603-
// TrimmedBoundaryReplacer,
604-
// ContextAwareReplacer,
605-
// MultiOccurrenceReplacer,
603+
TrimmedBoundaryReplacer,
604+
ContextAwareReplacer,
605+
MultiOccurrenceReplacer,
606606
]) {
607607
for (const search of replacer(content, oldString)) {
608608
const index = content.indexOf(search)

packages/opencode/src/tool/registry.ts

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,6 @@ import z from "zod/v4"
2020
import { Plugin } from "../plugin"
2121

2222
export namespace ToolRegistry {
23-
// Built-in tools that ship with opencode
24-
function builtin() {
25-
return [
26-
InvalidTool,
27-
BashTool,
28-
EditTool,
29-
WebFetchTool,
30-
GlobTool,
31-
GrepTool,
32-
ListTool,
33-
PatchTool,
34-
ReadTool,
35-
WriteTool,
36-
TodoWriteTool,
37-
TodoReadTool,
38-
TaskTool,
39-
]
40-
}
41-
4223
export const state = Instance.state(async () => {
4324
const custom = [] as Tool.Info[]
4425
const glob = new Bun.Glob("tool/*.{js,ts}")
@@ -93,7 +74,22 @@ export namespace ToolRegistry {
9374

9475
async function all(): Promise<Tool.Info[]> {
9576
const custom = await state().then((x) => x.custom)
96-
return [...builtin(), ...custom]
77+
return [
78+
InvalidTool,
79+
BashTool,
80+
EditTool,
81+
WebFetchTool,
82+
GlobTool,
83+
GrepTool,
84+
ListTool,
85+
PatchTool,
86+
ReadTool,
87+
WriteTool,
88+
TodoWriteTool,
89+
TodoReadTool,
90+
TaskTool,
91+
...custom,
92+
]
9793
}
9894

9995
export async function ids() {

0 commit comments

Comments
 (0)