Skip to content
Open
Changes from 1 commit
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
6 changes: 5 additions & 1 deletion packages/opencode/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1425,7 +1425,11 @@ export namespace Config {
}

export async function update(config: Info) {
const filepath = path.join(Instance.directory, "config.json")
// Find an existing project config file, or default to opencode.json.
// ConfigPaths.projectFiles("opencode", ...) looks for opencode.jsonc and opencode.json,
// so we must write to one of those — not config.json which is never loaded by state().
const projectFiles = await ConfigPaths.projectFiles("opencode", Instance.directory, Instance.worktree)
const filepath = projectFiles[projectFiles.length - 1] ?? path.join(Instance.directory, "opencode.json")
const existing = await loadFile(filepath)
await Filesystem.writeJson(filepath, mergeDeep(existing, config))
await Instance.dispose()
Expand Down
Loading