Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/opencode/src/cli/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Flag } from "@/flag/flag"
import { Installation } from "@/installation"

export async function upgrade() {
const config = await Config.global()
const config = await Config.get()
const method = await Installation.method()
const latest = await Installation.latest(method).catch(() => {})
if (!latest) return
Expand Down
51 changes: 51 additions & 0 deletions packages/opencode/test/config/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,57 @@ describe("getPluginName", () => {
})
})

test("project config can override autoupdate setting", async () => {
await using tmp = await tmpdir({
init: async (dir) => {
// base config has autoupdate enabled
await Bun.write(
path.join(dir, "opencode.jsonc"),
JSON.stringify({
$schema: "https://opencode.ai/config.json",
autoupdate: true,
}),
)
// project config disables autoupdate
await Bun.write(
path.join(dir, "opencode.json"),
JSON.stringify({
$schema: "https://opencode.ai/config.json",
autoupdate: false,
}),
)
},
})
await Instance.provide({
directory: tmp.path,
fn: async () => {
const config = await Config.get()
expect(config.autoupdate).toBe(false)
},
})
})

test("project config can set autoupdate to notify", async () => {
await using tmp = await tmpdir({
init: async (dir) => {
await Bun.write(
path.join(dir, "opencode.json"),
JSON.stringify({
$schema: "https://opencode.ai/config.json",
autoupdate: "notify",
}),
)
},
})
await Instance.provide({
directory: tmp.path,
fn: async () => {
const config = await Config.get()
expect(config.autoupdate).toBe("notify")
},
})
})

describe("deduplicatePlugins", () => {
test("removes duplicates keeping higher priority (later entries)", () => {
const plugins = ["[email protected]", "[email protected]", "[email protected]", "[email protected]"]
Expand Down