fix(init): honor OPENCODE_CONFIG_DIR for OpenCode plugin path#715
Open
cavanaug wants to merge 2 commits intortk-ai:developfrom
Open
fix(init): honor OPENCODE_CONFIG_DIR for OpenCode plugin path#715cavanaug wants to merge 2 commits intortk-ai:developfrom
cavanaug wants to merge 2 commits intortk-ai:developfrom
Conversation
- Resolve OpenCode plugin path via OPENCODE_CONFIG_DIR when provided - Fall back to ~/.config/opencode when env var is unset/blank - Add regression tests for resolver and plugin path prep - Update OpenCode docs/examples to show env-aware plugin location Signed-off-by: John Cavanaugh <59479+cavanaug@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates RTK’s OpenCode integration so rtk init -g --opencode installs the plugin under an OPENCODE_CONFIG_DIR override when provided, while preserving the existing ~/.config/opencode fallback and updating docs accordingly.
Changes:
- Add
OPENCODE_CONFIG_DIRsupport to OpenCode config-dir resolution (blank values fall back). - Add unit tests for env override, blank-env fallback, and plugin-path preparation using the override.
- Update README + troubleshooting docs to show env-aware paths (
${OPENCODE_CONFIG_DIR:-$HOME/.config/opencode}).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/init.rs | Honor OPENCODE_CONFIG_DIR for OpenCode plugin install path + add tests for override/fallback behavior. |
| docs/TROUBLESHOOTING.md | Use an env-aware path example when checking for the plugin file. |
| README.md | Document the env override behavior and update manual install commands to use ${OPENCODE_CONFIG_DIR:-...}. |
Comments suppressed due to low confidence (1)
src/init.rs:1538
- The doc comment for
opencode_plugin_pathis now misleading: the plugin path is not always~/.config/opencode/...becauseresolve_opencode_dir()can returnOPENCODE_CONFIG_DIR. Update the comment to describe the path as$OPENCODE_CONFIG_DIR/plugins/rtk.tswhen set, otherwise the~/.config/opencode/...fallback.
/// Return OpenCode plugin path: ~/.config/opencode/plugins/rtk.ts
fn opencode_plugin_path(opencode_dir: &Path) -> PathBuf {
opencode_dir.join("plugins").join("rtk.ts")
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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
rtk init -g --opencodeto honorOPENCODE_CONFIG_DIRwhen resolving the OpenCode plugin install directory.~/.config/opencodewhenOPENCODE_CONFIG_DIRis unset or blank.${OPENCODE_CONFIG_DIR:-$HOME/.config/opencode}.Test plan
cargo fmt --all --checkcargo clippy --all-targets(2 pre-existing warnings in unrelated files)cargo test(982 passed)cargo build --releasecargo test test_resolve_opencode_dir_uses_env_overridecargo test test_resolve_opencode_dir_falls_back_when_env_is_blankcargo test test_prepare_opencode_plugin_path_uses_env_override