Skip to content

Commit 98a189c

Browse files
authored
Merge pull request #4 from theopenco/sync-upstream-v2
feat: sync upstream opencode v2.0.28 and add the Smart Router
2 parents a845115 + 34e850f commit 98a189c

8,531 files changed

Lines changed: 958654 additions & 911494 deletions

File tree

Some content is hidden

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

‎.gitattributes‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
packages/core/migration/**/snapshot.json linguist-generated
22
packages/core/src/database/migration.gen.ts linguist-generated
3+
packages/core/src/models-dev/snapshot.txt linguist-generated
4+
packages/core/src/**/*.txt text eol=lf
5+
packages/httpapi-codegen/test/generated/*.ts text eol=lf

‎.github/TEAM_MEMBERS‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ kitlangton
1010
kommander
1111
ludvigrask
1212
MrMushrooooom
13+
neriousy
1314
nexxeln
1415
R44VC0RP
1516
rekram1-node

‎.github/actions/setup-bun/action.yml‎

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: "Setup Bun"
22
description: "Setup Bun with caching and install dependencies"
33
inputs:
4+
bun-version:
5+
description: "Bun version to install instead of the root packageManager version"
6+
required: false
7+
default: ""
48
install-flags:
59
description: "Additional flags to pass to 'bun install'"
610
required: false
@@ -20,34 +24,37 @@ runs:
2024
shell: bash
2125
run: |
2226
if [ "$RUNNER_ARCH" = "X64" ]; then
23-
V=$(node -p "require('./package.json').packageManager.split('@')[1]")
27+
V="${{ inputs.bun-version }}"
28+
if [ -z "$V" ]; then V=$(node -p "require('./package.json').packageManager.split('@')[1]"); fi
29+
TAG=$([ "$V" = "canary" ] && echo "canary" || echo "bun-v${V}")
2430
case "$RUNNER_OS" in
2531
macOS) OS=darwin ;;
2632
Linux) OS=linux ;;
2733
Windows) OS=windows ;;
2834
esac
29-
echo "url=https://github.com/oven-sh/bun/releases/download/bun-v${V}/bun-${OS}-x64-baseline.zip" >> "$GITHUB_OUTPUT"
35+
echo "url=https://github.com/oven-sh/bun/releases/download/${TAG}/bun-${OS}-x64-baseline.zip" >> "$GITHUB_OUTPUT"
3036
fi
3137
3238
- name: Setup Bun
3339
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
3440
with:
35-
bun-version-file: ${{ !steps.bun-url.outputs.url && 'package.json' || '' }}
41+
bun-version: ${{ !steps.bun-url.outputs.url && inputs.bun-version || '' }}
42+
bun-version-file: ${{ !steps.bun-url.outputs.url && !inputs.bun-version && 'package.json' || '' }}
3643
bun-download-url: ${{ steps.bun-url.outputs.url }}
3744

3845
- name: Get cache directory
3946
id: cache
4047
shell: bash
41-
run: echo "dir=$(bun pm cache)" >> "$GITHUB_OUTPUT"
48+
run: |
49+
echo "dir=$(bun pm cache)" >> "$GITHUB_OUTPUT"
50+
echo "version=$(bun --version)" >> "$GITHUB_OUTPUT"
4251
4352
- name: Restore Bun dependencies
4453
id: bun-cache
4554
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
4655
with:
4756
path: ${{ steps.cache.outputs.dir }}
48-
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
49-
restore-keys: |
50-
${{ runner.os }}-bun-
57+
key: ${{ runner.os }}-${{ runner.arch }}-bun-${{ steps.cache.outputs.version }}-${{ hashFiles('bun.lock', 'patches/**') }}
5158

5259
- name: Install setuptools for distutils compatibility
5360
run: python3 -m pip install setuptools || pip install setuptools || true
@@ -59,9 +66,9 @@ runs:
5966
# e.g. ./patches/ for standard-openapi
6067
# https://github.com/oven-sh/bun/issues/28147
6168
if [ "$RUNNER_OS" = "Windows" ]; then
62-
bun install --linker hoisted ${{ inputs.install-flags }}
69+
bun install --frozen-lockfile --linker hoisted ${{ inputs.install-flags }}
6370
else
64-
bun install ${{ inputs.install-flags }}
71+
bun install --frozen-lockfile ${{ inputs.install-flags }}
6572
fi
6673
shell: bash
6774

@@ -70,4 +77,4 @@ runs:
7077
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
7178
with:
7279
path: ${{ steps.cache.outputs.dir }}
73-
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
80+
key: ${{ steps.bun-cache.outputs.cache-primary-key }}

‎.github/workflows/beta.yml‎

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

‎.github/workflows/check.yml‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: check
2+
3+
on:
4+
push:
5+
branches: [dev]
6+
pull_request:
7+
branches: [dev]
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: ${{ case(github.ref == 'refs/heads/dev', format('{0}-{1}', github.workflow, github.run_id), format('{0}-{1}', github.workflow, github.event.pull_request.number || github.ref)) }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
check:
16+
name: typecheck
17+
runs-on: ubuntu-24.04
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
21+
with:
22+
# A pull request checks out its merge into the current base; the first parent is that base.
23+
fetch-depth: 2
24+
25+
- name: Setup Bun
26+
uses: ./.github/actions/setup-bun
27+
28+
- name: Run checks
29+
run: bun run check
30+
31+
# Every GUI package file (app, desktop, gui-extensions, ui, session-ui) a pull request adds or edits must be free of
32+
# oxlint problems, warn-level rules (anti-slop) included. Other packages are not affected.
33+
- name: Lint changed files
34+
if: github.event_name == 'pull_request'
35+
# Against the merge's first parent, so base-branch commits the pull request has not merged are not counted as its
36+
# changes (the event's base SHA can predate them).
37+
run: bun run lint:changed HEAD^1

‎.github/workflows/compliance-close.yml‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
close-non-compliant:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- name: Close non-compliant issues and PRs after 2 hours
18+
- name: Close non-compliant issues and PRs after 72 hours
1919
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0
2020
with:
2121
script: |
@@ -33,14 +33,14 @@ jobs:
3333
}
3434
3535
const now = Date.now();
36-
const twoHours = 2 * 60 * 60 * 1000;
36+
const seventyTwoHours = 72 * 60 * 60 * 1000;
3737
const orgMemberAssociations = new Set(['OWNER', 'MEMBER']);
3838
const agentLogin = 'opencode-agent[bot]';
3939
const { data: file } = await github.rest.repos.getContent({
4040
owner: context.repo.owner,
4141
repo: context.repo.repo,
4242
path: '.github/TEAM_MEMBERS',
43-
ref: 'main',
43+
ref: 'dev',
4444
});
4545
const teamMembers = new Set(
4646
Buffer.from(file.content, 'base64')
@@ -87,14 +87,14 @@ jobs:
8787
if (!complianceComment) continue;
8888
8989
const commentAge = now - new Date(complianceComment.created_at).getTime();
90-
if (commentAge < twoHours) {
91-
core.info(`${kind} #${item.number} still within 2-hour window (${Math.round(commentAge / 60000)}m elapsed)`);
90+
if (commentAge < seventyTwoHours) {
91+
core.info(`${kind} #${item.number} still within 72-hour window (${Math.round(commentAge / 60000)}m elapsed)`);
9292
continue;
9393
}
9494
9595
const closeMessage = isPR
96-
? 'This pull request has been automatically closed because it was not updated to meet our [contributing guidelines](../blob/main/CONTRIBUTING.md) within the 2-hour window.\n\nFeel free to open a new pull request that follows our guidelines.'
97-
: 'This issue has been automatically closed because it was not updated to meet our [contributing guidelines](../blob/main/CONTRIBUTING.md) within the 2-hour window.\n\nFeel free to open a new issue that follows our issue templates.';
96+
? 'This pull request has been automatically closed because it was not updated to meet our [contributing guidelines](../blob/dev/CONTRIBUTING.md) within the 72-hour window.\n\nFeel free to open a new pull request that follows our guidelines.'
97+
: 'This issue has been automatically closed because it was not updated to meet our [contributing guidelines](../blob/dev/CONTRIBUTING.md) within the 72-hour window.\n\nFeel free to open a new issue that follows our issue templates.';
9898
9999
await github.rest.issues.createComment({
100100
owner: context.repo.owner,
@@ -129,5 +129,5 @@ jobs:
129129
});
130130
}
131131
132-
core.info(`Closed non-compliant ${kind} #${item.number} after 2-hour window`);
132+
core.info(`Closed non-compliant ${kind} #${item.number} after 72-hour window`);
133133
}

‎.github/workflows/containers.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ permissions:
1616

1717
jobs:
1818
build:
19-
runs-on: blacksmith-4vcpu-ubuntu-2404
19+
runs-on: ubuntu-24.04
2020
env:
2121
REGISTRY: ghcr.io/${{ github.repository_owner }}
2222
TAG: "24.04"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: deploy-changelog
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
paths:
8+
- services/changelog/**
9+
- .github/workflows/deploy-changelog.yml
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: deploy-changelog
14+
cancel-in-progress: false
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
deploy:
21+
if: github.repository == 'anomalyco/opencode' && github.ref_name == 'dev'
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
25+
26+
- uses: ./.github/actions/setup-bun
27+
28+
- name: Typecheck
29+
working-directory: services/changelog
30+
run: bun typecheck
31+
32+
- name: Test
33+
working-directory: services/changelog
34+
run: bun test
35+
36+
- name: Deploy
37+
working-directory: services/changelog
38+
run: bun run deploy
39+
env:
40+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}

‎.github/workflows/deploy-files.yml‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: deploy-files
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
- production
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: deploy-files-${{ github.ref_name }}
12+
cancel-in-progress: false
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
deploy:
19+
if: github.repository == 'anomalyco/opencode' && (github.ref_name == 'dev' || github.ref_name == 'production')
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
23+
24+
- uses: ./.github/actions/setup-bun
25+
26+
- name: Typecheck
27+
working-directory: services/files
28+
run: bun typecheck
29+
30+
- name: Deploy
31+
working-directory: services/files
32+
run: bun run deploy --env ${{ github.ref_name == 'production' && 'production' || 'dev' }}
33+
env:
34+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}

‎.github/workflows/deploy-posts.yml‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: deploy-posts
2+
3+
on:
4+
push:
5+
branches:
6+
- production
7+
paths:
8+
- packages/posts/**
9+
- bun.lock
10+
- .github/workflows/deploy-posts.yml
11+
workflow_dispatch:
12+
13+
concurrency:
14+
group: deploy-posts-${{ github.ref_name }}
15+
cancel-in-progress: false
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
deploy:
22+
if: github.repository == 'anomalyco/opencode' && github.ref_name == 'production'
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
26+
27+
- uses: ./.github/actions/setup-bun
28+
29+
- name: Build
30+
working-directory: packages/posts
31+
run: bun run build
32+
33+
- name: Deploy
34+
working-directory: packages/posts
35+
run: bun run deploy
36+
env:
37+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}

0 commit comments

Comments
 (0)