Skip to content

Commit 82a7390

Browse files
committed
fix(config): correct directory config precedence so project overrides global
The directories() function loaded home ~/.opencode configs AFTER project .opencode configs, giving global config higher precedence than project config. This contradicts the documented precedence order where project configs should override global defaults. Swap the order so home .opencode is merged first (as a base), then project .opencode is merged on top, giving project config the higher precedence as documented. Closes anomalyco#19296
1 parent e96eead commit 82a7390

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

‎packages/opencode/src/config/paths.ts‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ export namespace ConfigPaths {
2222
export async function directories(directory: string, worktree: string) {
2323
return [
2424
Global.Path.config,
25+
...(await Array.fromAsync(
26+
Filesystem.up({
27+
targets: [".opencode"],
28+
start: Global.Path.home,
29+
stop: Global.Path.home,
30+
}),
31+
)),
2532
...(!Flag.OPENCODE_DISABLE_PROJECT_CONFIG
2633
? await Array.fromAsync(
2734
Filesystem.up({
@@ -31,13 +38,6 @@ export namespace ConfigPaths {
3138
}),
3239
)
3340
: []),
34-
...(await Array.fromAsync(
35-
Filesystem.up({
36-
targets: [".opencode"],
37-
start: Global.Path.home,
38-
stop: Global.Path.home,
39-
}),
40-
)),
4141
...(Flag.OPENCODE_CONFIG_DIR ? [Flag.OPENCODE_CONFIG_DIR] : []),
4242
]
4343
}

0 commit comments

Comments
 (0)