Skip to content

Commit a9a2c23

Browse files
committed
add autoupdate: notify
1 parent ccde319 commit a9a2c23

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

packages/opencode/src/cli/upgrade.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ export async function upgrade() {
1010
if (Installation.VERSION === latest) return
1111

1212
if (config.autoupdate === false || Flag.OPENCODE_DISABLE_AUTOUPDATE) {
13+
return
14+
}
15+
if (config.autoupdate === "notify") {
1316
await Bus.publish(Installation.Event.UpdateAvailable, { version: latest })
1417
return
1518
}

packages/opencode/src/config/config.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,12 @@ export namespace Config {
479479
.boolean()
480480
.optional()
481481
.describe("@deprecated Use 'share' field instead. Share newly created sessions automatically"),
482-
autoupdate: z.boolean().optional().describe("Automatically update to the latest version"),
482+
autoupdate: z
483+
.union([z.boolean(), z.literal("notify")])
484+
.optional()
485+
.describe(
486+
"Automatically update to the latest version. Set to true to auto-update, false to disable, or 'notify' to show update notifications",
487+
),
483488
disabled_providers: z.array(z.string()).optional().describe("Disable providers that are loaded automatically"),
484489
enabled_providers: z
485490
.array(z.string())

packages/sdk/js/src/gen/types.gen.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,9 +1021,9 @@ export type Config = {
10211021
*/
10221022
autoshare?: boolean
10231023
/**
1024-
* Automatically update to the latest version
1024+
* Automatically update to the latest version. Set to true to auto-update, false to disable, or 'notify' to show update notifications
10251025
*/
1026-
autoupdate?: boolean
1026+
autoupdate?: boolean | "notify"
10271027
/**
10281028
* Disable providers that are loaded automatically
10291029
*/

packages/web/src/content/docs/config.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@ OpenCode will automatically download any new updates when it starts up. You can
267267
}
268268
```
269269

270+
If you don't want updates but want to be notified when a new version is available, set `autoupdate` to `"notify"`.
271+
270272
---
271273

272274
### Formatters

0 commit comments

Comments
 (0)