Skip to content

Commit e9bbd8b

Browse files
authored
Merge branch 'dev' into desktop-deep-link
2 parents ba986ec + dd1624e commit e9bbd8b

295 files changed

Lines changed: 18395 additions & 4108 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.
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Close stale PRs
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
dryRun:
7+
description: "Log actions without closing PRs"
8+
type: boolean
9+
default: false
10+
schedule:
11+
- cron: "0 6 * * *"
12+
13+
permissions:
14+
contents: read
15+
issues: write
16+
pull-requests: write
17+
18+
jobs:
19+
close-stale-prs:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Close inactive PRs
23+
uses: actions/github-script@v8
24+
with:
25+
github-token: ${{ secrets.GITHUB_TOKEN }}
26+
script: |
27+
const DAYS_INACTIVE = 60
28+
const cutoff = new Date(Date.now() - DAYS_INACTIVE * 24 * 60 * 60 * 1000)
29+
const { owner, repo } = context.repo
30+
const dryRun = context.payload.inputs?.dryRun === "true"
31+
const stalePrs = []
32+
33+
core.info(`Dry run mode: ${dryRun}`)
34+
35+
const prs = await github.paginate(github.rest.pulls.list, {
36+
owner,
37+
repo,
38+
state: "open",
39+
per_page: 100,
40+
sort: "updated",
41+
direction: "asc",
42+
})
43+
44+
for (const pr of prs) {
45+
const lastUpdated = new Date(pr.updated_at)
46+
if (lastUpdated > cutoff) {
47+
core.info(`PR ${pr.number} is fresh`)
48+
continue
49+
}
50+
51+
stalePrs.push(pr)
52+
}
53+
54+
if (!stalePrs.length) {
55+
core.info("No stale pull requests found.")
56+
return
57+
}
58+
59+
for (const pr of stalePrs) {
60+
const issue_number = pr.number
61+
const closeComment = `Closing this pull request because it has had no updates for more than ${DAYS_INACTIVE} days. If you plan to continue working on it, feel free to reopen or open a new PR.`
62+
63+
if (dryRun) {
64+
core.info(`[dry-run] Would close PR #${issue_number} from ${pr.user.login}`)
65+
continue
66+
}
67+
68+
await github.rest.issues.createComment({
69+
owner,
70+
repo,
71+
issue_number,
72+
body: closeComment,
73+
})
74+
75+
await github.rest.pulls.update({
76+
owner,
77+
repo,
78+
pull_number: issue_number,
79+
state: "closed",
80+
})
81+
82+
core.info(`Closed PR #${issue_number} from ${pr.user.login}`)
83+
}

.github/workflows/test.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,20 @@ jobs:
5353
printf '%s\n' "XDG_CACHE_HOME=${{ runner.temp }}\\opencode-e2e\\cache" >> "$GITHUB_ENV"
5454
printf '%s\n' "XDG_CONFIG_HOME=${{ runner.temp }}\\opencode-e2e\\config" >> "$GITHUB_ENV"
5555
printf '%s\n' "XDG_STATE_HOME=${{ runner.temp }}\\opencode-e2e\\state" >> "$GITHUB_ENV"
56-
printf '%s\n' "MODELS_DEV_API_JSON=${{ github.workspace }}\\packages\\opencode\\test\\tool\\fixtures\\models-api.json" >> "$GITHUB_ENV"
5756
else
5857
printf '%s\n' "OPENCODE_E2E_ROOT=${{ runner.temp }}/opencode-e2e" >> "$GITHUB_ENV"
5958
printf '%s\n' "OPENCODE_TEST_HOME=${{ runner.temp }}/opencode-e2e/home" >> "$GITHUB_ENV"
6059
printf '%s\n' "XDG_DATA_HOME=${{ runner.temp }}/opencode-e2e/share" >> "$GITHUB_ENV"
6160
printf '%s\n' "XDG_CACHE_HOME=${{ runner.temp }}/opencode-e2e/cache" >> "$GITHUB_ENV"
6261
printf '%s\n' "XDG_CONFIG_HOME=${{ runner.temp }}/opencode-e2e/config" >> "$GITHUB_ENV"
6362
printf '%s\n' "XDG_STATE_HOME=${{ runner.temp }}/opencode-e2e/state" >> "$GITHUB_ENV"
64-
printf '%s\n' "MODELS_DEV_API_JSON=${{ github.workspace }}/packages/opencode/test/tool/fixtures/models-api.json" >> "$GITHUB_ENV"
6563
fi
6664
6765
- name: Seed opencode data
6866
if: matrix.settings.name != 'windows'
6967
working-directory: packages/opencode
7068
run: bun script/seed-e2e.ts
7169
env:
72-
MODELS_DEV_API_JSON: ${{ env.MODELS_DEV_API_JSON }}
73-
OPENCODE_DISABLE_MODELS_FETCH: "true"
7470
OPENCODE_DISABLE_SHARE: "true"
7571
OPENCODE_DISABLE_LSP_DOWNLOAD: "true"
7672
OPENCODE_DISABLE_DEFAULT_PLUGINS: "true"
@@ -90,8 +86,6 @@ jobs:
9086
working-directory: packages/opencode
9187
run: bun dev -- --print-logs --log-level WARN serve --port 4096 --hostname 127.0.0.1 &
9288
env:
93-
MODELS_DEV_API_JSON: ${{ env.MODELS_DEV_API_JSON }}
94-
OPENCODE_DISABLE_MODELS_FETCH: "true"
9589
OPENCODE_DISABLE_SHARE: "true"
9690
OPENCODE_DISABLE_LSP_DOWNLOAD: "true"
9791
OPENCODE_DISABLE_DEFAULT_PLUGINS: "true"
@@ -117,8 +111,6 @@ jobs:
117111
run: ${{ matrix.settings.command }}
118112
env:
119113
CI: true
120-
MODELS_DEV_API_JSON: ${{ env.MODELS_DEV_API_JSON }}
121-
OPENCODE_DISABLE_MODELS_FETCH: "true"
122114
OPENCODE_DISABLE_SHARE: "true"
123115
OPENCODE_DISABLE_LSP_DOWNLOAD: "true"
124116
OPENCODE_DISABLE_DEFAULT_PLUGINS: "true"

.opencode/command/ai-deps.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Please read @package.json and @packages/opencode/package.json.
77
Your job is to look into AI SDK dependencies, figure out if they have versions that can be upgraded (minor or patch versions ONLY no major ignore major changes).
88

99
I want a report of every dependency and the version that can be upgraded to.
10-
What would be even better is if you can give me links to the changelog for each dependency, or at least some reference info so I can see what bugs were fixed or new features were added.
10+
What would be even better is if you can give me brief summary of the changes for each dep and a link to the changelog for each dependency, or at least some reference info so I can see what bugs were fixed or new features were added.
1111

1212
Consider using subagents for each dep to save your context window.
1313

.opencode/command/commit.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
description: git commit and push
3-
model: opencode/glm-4.6
3+
model: opencode/glm-4.7
44
subtask: true
55
---
66

@@ -26,3 +26,15 @@ about what user facing changes were made
2626

2727
if there are changes do a git pull --rebase
2828
if there are conflicts DO NOT FIX THEM. notify me and I will fix them
29+
30+
## GIT DIFF
31+
32+
!`git diff`
33+
34+
## GIT DIFF --cached
35+
36+
!`git diff --cached`
37+
38+
## GIT STATUS --short
39+
40+
!`git status --short`

.opencode/command/learn.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
description: Extract non-obvious learnings from session to AGENTS.md files to build codebase understanding
3+
---
4+
5+
Analyze this session and extract non-obvious learnings to add to AGENTS.md files.
6+
7+
AGENTS.md files can exist at any directory level, not just the project root. When an agent reads a file, any AGENTS.md in parent directories are automatically loaded into the context of the tool read. Place learnings as close to the relevant code as possible:
8+
9+
- Project-wide learnings → root AGENTS.md
10+
- Package/module-specific → packages/foo/AGENTS.md
11+
- Feature-specific → src/auth/AGENTS.md
12+
13+
What counts as a learning (non-obvious discoveries only):
14+
15+
- Hidden relationships between files or modules
16+
- Execution paths that differ from how code appears
17+
- Non-obvious configuration, env vars, or flags
18+
- Debugging breakthroughs when error messages were misleading
19+
- API/tool quirks and workarounds
20+
- Build/test commands not in README
21+
- Architectural decisions and constraints
22+
- Files that must change together
23+
24+
What NOT to include:
25+
26+
- Obvious facts from documentation
27+
- Standard language/framework behavior
28+
- Things already in an AGENTS.md
29+
- Verbose explanations
30+
- Session-specific details
31+
32+
Process:
33+
34+
1. Review session for discoveries, errors that took multiple attempts, unexpected connections
35+
2. Determine scope - what directory does each learning apply to?
36+
3. Read existing AGENTS.md files at relevant levels
37+
4. Create or update AGENTS.md at the appropriate level
38+
5. Keep entries to 1-3 lines per insight
39+
40+
After updating, summarize which AGENTS.md files were created/updated and how many learnings per file.
41+
42+
$ARGUMENTS

.opencode/opencode.jsonc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// "enterprise": {
55
// "url": "https://enterprise.dev.opencode.ai",
66
// },
7-
"instructions": ["STYLE_GUIDE.md"],
87
"provider": {
98
"opencode": {
109
"options": {},

AGENTS.md

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,81 @@
1-
- To test opencode in `packages/opencode`, run `bun dev`.
21
- To regenerate the JavaScript SDK, run `./packages/sdk/js/script/build.ts`.
32
- ALWAYS USE PARALLEL TOOLS WHEN APPLICABLE.
43
- The default branch in this repo is `dev`.
4+
5+
## Style Guide
6+
7+
- Keep things in one function unless composable or reusable
8+
- Avoid unnecessary destructuring. Instead of `const { a, b } = obj`, use `obj.a` and `obj.b` to preserve context
9+
- Avoid `try`/`catch` where possible
10+
- Avoid using the `any` type
11+
- Prefer single word variable names where possible
12+
- Use Bun APIs when possible, like `Bun.file()`
13+
- Rely on type inference when possible; avoid explicit type annotations or interfaces unless necessary for exports or clarity
14+
15+
### Avoid let statements
16+
17+
We don't like `let` statements, especially combined with if/else statements.
18+
Prefer `const`.
19+
20+
Good:
21+
22+
```ts
23+
const foo = condition ? 1 : 2
24+
```
25+
26+
Bad:
27+
28+
```ts
29+
let foo
30+
31+
if (condition) foo = 1
32+
else foo = 2
33+
```
34+
35+
### Avoid else statements
36+
37+
Prefer early returns or using an `iife` to avoid else statements.
38+
39+
Good:
40+
41+
```ts
42+
function foo() {
43+
if (condition) return 1
44+
return 2
45+
}
46+
```
47+
48+
Bad:
49+
50+
```ts
51+
function foo() {
52+
if (condition) return 1
53+
else return 2
54+
}
55+
```
56+
57+
### Prefer single word naming
58+
59+
Try your best to find a single word name for your variables, functions, etc.
60+
Only use multiple words if you cannot.
61+
62+
Good:
63+
64+
```ts
65+
const foo = 1
66+
const bar = 2
67+
const baz = 3
68+
```
69+
70+
Bad:
71+
72+
```ts
73+
const fooBar = 1
74+
const barBaz = 2
75+
const bazFoo = 3
76+
```
77+
78+
## Testing
79+
80+
You MUST avoid using `mocks` as much as possible.
81+
Tests MUST test actual implementation, do not duplicate logic into a test.

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ This runs `bun run --cwd packages/desktop build` automatically via Tauri’s `be
148148
> [!NOTE]
149149
> If you make changes to the API or SDK (e.g. `packages/opencode/src/server/server.ts`), run `./script/generate.ts` to regenerate the SDK and related files.
150150
151-
Please try to follow the [style guide](./STYLE_GUIDE.md)
151+
Please try to follow the [style guide](./AGENTS.md)
152152

153153
### Setting up a Debugger
154154

0 commit comments

Comments
 (0)