Repository navigation
Conversation
…fig.json rtk looked for OpenCode's global permission rules only in ~/.config/opencode, and only in the first of opencode.json and opencode.jsonc. OpenCode 1.x reads its global directory from $XDG_CONFIG_HOME/opencode when that is set, and merges config.json, opencode.json and opencode.jsonc there in that order. An ask in any of the files rtk skipped was silenced by the rewrite. Use the same directory, and merge the three files the way OpenCode's mergeDeep does, so a key repeated in a later file keeps its first position.
📊 Automated PR Analysis
SummaryFixes OpenCode hook global config loading to follow the XDG Base Directory spec (XDG_CONFIG_HOME when set and non-empty, else ~/.config) and to deep-merge config.json, opencode.json, and opencode.jsonc in order, matching OpenCode's own loadGlobal/mergeDeep behavior. Previously only the first of opencode.json/.jsonc was read and XDG_CONFIG_HOME was ignored. Review Checklist
Linked issues: #4520 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
Contributor
Author
|
Merged develop (with #4187) into the branch; the only conflict was |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #4520.
$XDG_CONFIG_HOME/opencodewhen set and non-empty, else~/.config/opencode.config.json,opencode.jsonandopencode.jsoncexist, in that order, as OpenCode 1.18.34'sloadGlobaldoes (remedamergeDeep). Before, only the first ofopencode.json/.jsoncwas read.Test plan
cargo fmt --all && cargo clippy --all-targets && cargo test: one failure, also on develop (git_log_malformed_digit_run_propagates_real_git_errorexpects git 2.51 wording; mine is 2.43)config.jsonones fail without the fix.rtk <command>output inspected:rtk hook opencode ls -lawent from{"command":"rtk ls -la"}to{}for each ask. Not run against a real OpenCode.Prepared with an AI coding agent; the checks above ran on this branch.