fix(opencode): support env-prefixed plugin paths in config#25394
fix(opencode): support env-prefixed plugin paths in config#25394himax12 wants to merge 1 commit intoanomalyco:devfrom
Conversation
Support plugin specs in config files that use home/environment prefixes (like C:\Users\ghima, C:\Users\ghima, ~, and %USERPROFILE%) so local plugin paths resolve correctly instead of being treated as npm packages. Adds regression tests for C:\Users\ghima and %USERPROFILE% forms.
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
There was a problem hiding this comment.
Pull request overview
This PR fixes config plugin resolution so that plugin specs in tui.json/config files starting with home/env prefixes (e.g. ~, $HOME, %USERPROFILE%) are expanded and treated as local paths instead of npm package names, and adds regression tests for the behavior.
Changes:
- Expand
~,$VAR,${VAR}, and%VAR%prefixes in plugin specs before resolving them as paths. - Preserve non-path (npm) plugin specs unchanged.
- Add tests covering
$HOME/...and%USERPROFILE%/...directory plugin specs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/opencode/src/config/plugin.ts | Adds prefix-expansion logic and updates resolvePluginSpec() to treat expanded prefixes as path-like specs. |
| packages/opencode/test/config/config.test.ts | Adds regression tests ensuring $HOME and %USERPROFILE% prefixed plugin directory specs resolve to file URLs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
Fixes #25390
tui.jsonplugin specs using env/home-style prefixes were treated as package names instead of local paths.What changed:
~,$VAR,${VAR}, and%VAR%prefixes in plugin specs before path resolution$HOMEand%USERPROFILE%Verification:
bun --cwd packages/opencode test test/config/config.test.ts --timeout 60000