Skip to content

Commit ec5eb9c

Browse files
authored
Merge branch 'dev' into fix/plan-mode-prompt-bug
2 parents e248497 + 6a2fed7 commit ec5eb9c

File tree

438 files changed

+76165
-7284
lines changed

Some content is hidden

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

438 files changed

+76165
-7284
lines changed

.github/CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# web + desktop packages
2+
packages/app/ @adamdotdevin
3+
packages/tauri/ @adamdotdevin
4+
packages/desktop/ @adamdotdevin

.github/pull_request_template.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### What does this PR do?
2+
3+
### How did you verify your code works?

.github/workflows/duplicate-issues.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ jobs:
2828
OPENCODE_PERMISSION: |
2929
{
3030
"bash": {
31-
"gh issue*": "allow",
32-
"*": "deny"
31+
"*": "deny",
32+
"gh issue*": "allow"
3333
},
3434
"webfetch": "deny"
3535
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Duplicate PR Check
2+
3+
on:
4+
pull_request_target:
5+
types: [opened]
6+
7+
jobs:
8+
check-duplicates:
9+
if: |
10+
github.event.pull_request.user.login != 'actions-user' &&
11+
github.event.pull_request.user.login != 'opencode' &&
12+
github.event.pull_request.user.login != 'rekram1-node' &&
13+
github.event.pull_request.user.login != 'thdxr' &&
14+
github.event.pull_request.user.login != 'kommander' &&
15+
github.event.pull_request.user.login != 'jayair' &&
16+
github.event.pull_request.user.login != 'fwang' &&
17+
github.event.pull_request.user.login != 'adamdotdevin' &&
18+
github.event.pull_request.user.login != 'iamdavidhill' &&
19+
github.event.pull_request.user.login != 'opencode-agent[bot]'
20+
runs-on: blacksmith-4vcpu-ubuntu-2404
21+
permissions:
22+
contents: read
23+
pull-requests: write
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 1
29+
30+
- name: Setup Bun
31+
uses: ./.github/actions/setup-bun
32+
33+
- name: Install dependencies
34+
run: bun install
35+
36+
- name: Install opencode
37+
run: curl -fsSL https://opencode.ai/install | bash
38+
39+
- name: Build prompt
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
PR_NUMBER: ${{ github.event.pull_request.number }}
43+
run: |
44+
{
45+
echo "Check for duplicate PRs related to this new PR:"
46+
echo ""
47+
echo "CURRENT_PR_NUMBER: $PR_NUMBER"
48+
echo ""
49+
echo "Title: $(gh pr view "$PR_NUMBER" --json title --jq .title)"
50+
echo ""
51+
echo "Description:"
52+
gh pr view "$PR_NUMBER" --json body --jq .body
53+
} > pr_info.txt
54+
55+
- name: Check for duplicate PRs
56+
env:
57+
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
PR_NUMBER: ${{ github.event.pull_request.number }}
60+
run: |
61+
COMMENT=$(bun script/duplicate-pr.ts -f pr_info.txt "Check the attached file for PR details and search for duplicates")
62+
63+
gh pr comment "$PR_NUMBER" --body "_The following comment was made by an LLM, it may be inaccurate:_
64+
65+
$COMMENT"

.github/workflows/nix-desktop.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: nix desktop
2+
3+
on:
4+
push:
5+
branches: [dev]
6+
paths:
7+
- "flake.nix"
8+
- "flake.lock"
9+
- "nix/**"
10+
- "packages/app/**"
11+
- "packages/desktop/**"
12+
pull_request:
13+
paths:
14+
- "flake.nix"
15+
- "flake.lock"
16+
- "nix/**"
17+
- "packages/app/**"
18+
- "packages/desktop/**"
19+
workflow_dispatch:
20+
21+
jobs:
22+
build-desktop:
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
os:
27+
- blacksmith-4vcpu-ubuntu-2404
28+
- macos-latest
29+
runs-on: ${{ matrix.os }}
30+
timeout-minutes: 60
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v6
34+
35+
- name: Setup Nix
36+
uses: DeterminateSystems/nix-installer-action@v21
37+
38+
- name: Build desktop via flake
39+
run: |
40+
set -euo pipefail
41+
nix --version
42+
nix build .#desktop -L

.github/workflows/pr-standards.yml

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: PR Standards
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, edited, synchronize]
6+
7+
jobs:
8+
check-standards:
9+
if: |
10+
github.event.pull_request.user.login != 'actions-user' &&
11+
github.event.pull_request.user.login != 'opencode' &&
12+
github.event.pull_request.user.login != 'rekram1-node' &&
13+
github.event.pull_request.user.login != 'thdxr' &&
14+
github.event.pull_request.user.login != 'kommander' &&
15+
github.event.pull_request.user.login != 'jayair' &&
16+
github.event.pull_request.user.login != 'fwang' &&
17+
github.event.pull_request.user.login != 'adamdotdevin' &&
18+
github.event.pull_request.user.login != 'iamdavidhill' &&
19+
github.event.pull_request.user.login != 'opencode-agent[bot]'
20+
runs-on: ubuntu-latest
21+
permissions:
22+
pull-requests: write
23+
steps:
24+
- name: Check PR standards
25+
uses: actions/github-script@v7
26+
with:
27+
script: |
28+
const pr = context.payload.pull_request;
29+
const title = pr.title;
30+
31+
async function addLabel(label) {
32+
await github.rest.issues.addLabels({
33+
owner: context.repo.owner,
34+
repo: context.repo.repo,
35+
issue_number: pr.number,
36+
labels: [label]
37+
});
38+
}
39+
40+
async function removeLabel(label) {
41+
try {
42+
await github.rest.issues.removeLabel({
43+
owner: context.repo.owner,
44+
repo: context.repo.repo,
45+
issue_number: pr.number,
46+
name: label
47+
});
48+
} catch (e) {
49+
// Label wasn't present, ignore
50+
}
51+
}
52+
53+
async function comment(marker, body) {
54+
const markerText = `<!-- pr-standards:${marker} -->`;
55+
const { data: comments } = await github.rest.issues.listComments({
56+
owner: context.repo.owner,
57+
repo: context.repo.repo,
58+
issue_number: pr.number
59+
});
60+
61+
const existing = comments.find(c => c.body.includes(markerText));
62+
if (existing) return;
63+
64+
await github.rest.issues.createComment({
65+
owner: context.repo.owner,
66+
repo: context.repo.repo,
67+
issue_number: pr.number,
68+
body: markerText + '\n' + body
69+
});
70+
}
71+
72+
// Step 1: Check title format
73+
// Matches: feat:, feat(scope):, feat (scope):, etc.
74+
const titlePattern = /^(feat|fix|docs|chore|refactor|test)\s*(\([a-zA-Z0-9-]+\))?\s*:/;
75+
const hasValidTitle = titlePattern.test(title);
76+
77+
if (!hasValidTitle) {
78+
await addLabel('needs:title');
79+
await comment('title', `Hey! Your PR title \`${title}\` doesn't follow conventional commit format.
80+
81+
Please update it to start with one of:
82+
- \`feat:\` or \`feat(scope):\` new feature
83+
- \`fix:\` or \`fix(scope):\` bug fix
84+
- \`docs:\` or \`docs(scope):\` documentation changes
85+
- \`chore:\` or \`chore(scope):\` maintenance tasks
86+
- \`refactor:\` or \`refactor(scope):\` code refactoring
87+
- \`test:\` or \`test(scope):\` adding or updating tests
88+
89+
Where \`scope\` is the package name (e.g., \`app\`, \`desktop\`, \`opencode\`).
90+
91+
See [CONTRIBUTING.md](../blob/dev/CONTRIBUTING.md#pr-titles) for details.`);
92+
return;
93+
}
94+
95+
await removeLabel('needs:title');
96+
97+
// Step 2: Check for linked issue (skip for docs/refactor PRs)
98+
const skipIssueCheck = /^(docs|refactor)\s*(\([a-zA-Z0-9-]+\))?\s*:/.test(title);
99+
if (skipIssueCheck) {
100+
await removeLabel('needs:issue');
101+
console.log('Skipping issue check for docs/refactor PR');
102+
return;
103+
}
104+
const query = `
105+
query($owner: String!, $repo: String!, $number: Int!) {
106+
repository(owner: $owner, name: $repo) {
107+
pullRequest(number: $number) {
108+
closingIssuesReferences(first: 1) {
109+
totalCount
110+
}
111+
}
112+
}
113+
}
114+
`;
115+
116+
const result = await github.graphql(query, {
117+
owner: context.repo.owner,
118+
repo: context.repo.repo,
119+
number: pr.number
120+
});
121+
122+
const linkedIssues = result.repository.pullRequest.closingIssuesReferences.totalCount;
123+
124+
if (linkedIssues === 0) {
125+
await addLabel('needs:issue');
126+
await comment('issue', `Thanks for your contribution!
127+
128+
This PR doesn't have a linked issue. All PRs must reference an existing issue.
129+
130+
Please:
131+
1. Open an issue describing the bug/feature (if one doesn't exist)
132+
2. Add \`Fixes #<number>\` or \`Closes #<number>\` to this PR description
133+
134+
See [CONTRIBUTING.md](../blob/dev/CONTRIBUTING.md#issue-first-policy) for details.`);
135+
return;
136+
}
137+
138+
await removeLabel('needs:issue');
139+
console.log('PR meets all standards');

.github/workflows/publish.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ jobs:
9292

9393
publish-tauri:
9494
needs: publish
95-
continue-on-error: true
95+
continue-on-error: false
9696
strategy:
9797
fail-fast: false
9898
matrix:
@@ -177,8 +177,22 @@ jobs:
177177
cargo tauri --version
178178
179179
- name: Build and upload artifacts
180-
timeout-minutes: 20
181-
uses: tauri-apps/tauri-action@390cbe447412ced1303d35abe75287949e43437a
180+
uses: Wandalen/wretry.action@v3
181+
timeout-minutes: 60
182+
with:
183+
attempt_limit: 3
184+
attempt_delay: 10000
185+
action: tauri-apps/tauri-action@390cbe447412ced1303d35abe75287949e43437a
186+
with: |
187+
projectPath: packages/desktop
188+
uploadWorkflowArtifacts: true
189+
tauriScript: ${{ (contains(matrix.settings.host, 'ubuntu') && 'cargo tauri') || '' }}
190+
args: --target ${{ matrix.settings.target }} --config ./src-tauri/tauri.prod.conf.json --verbose
191+
updaterJsonPreferNsis: true
192+
releaseId: ${{ needs.publish.outputs.release }}
193+
tagName: ${{ needs.publish.outputs.tag }}
194+
releaseAssetNamePattern: opencode-desktop-[platform]-[arch][ext]
195+
releaseDraft: true
182196
env:
183197
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
184198
TAURI_BUNDLER_NEW_APPIMAGE_FORMAT: true
@@ -190,16 +204,6 @@ jobs:
190204
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
191205
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
192206
APPLE_API_KEY_PATH: ${{ runner.temp }}/apple-api-key.p8
193-
with:
194-
projectPath: packages/desktop
195-
uploadWorkflowArtifacts: true
196-
tauriScript: ${{ (contains(matrix.settings.host, 'ubuntu') && 'cargo tauri') || '' }}
197-
args: --target ${{ matrix.settings.target }} --config ./src-tauri/tauri.prod.conf.json --verbose
198-
updaterJsonPreferNsis: true
199-
releaseId: ${{ needs.publish.outputs.release }}
200-
tagName: ${{ needs.publish.outputs.tag }}
201-
releaseAssetNamePattern: opencode-desktop-[platform]-[arch][ext]
202-
releaseDraft: true
203207

204208
publish-release:
205209
needs:

.github/workflows/review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
env:
4848
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
4949
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50-
OPENCODE_PERMISSION: '{ "bash": { "gh*": "allow", "gh pr review*": "deny", "*": "deny" } }'
50+
OPENCODE_PERMISSION: '{ "bash": { "*": "deny", "gh*": "allow", "gh pr review*": "deny" } }'
5151
PR_TITLE: ${{ steps.pr-details.outputs.title }}
5252
run: |
5353
PR_BODY=$(jq -r .body pr_data.json)

.github/workflows/stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ concurrency: ${{ github.workflow }}-${{ github.ref }}
99

1010
jobs:
1111
stats:
12-
if: github.repository == 'sst/opencode'
12+
if: github.repository == 'anomalyco/opencode'
1313
runs-on: blacksmith-4vcpu-ubuntu-2404
1414
permissions:
1515
contents: write

0 commit comments

Comments
 (0)