Skip to content

fix(opencode): support env-prefixed plugin paths in config#25394

Closed
himax12 wants to merge 1 commit intoanomalyco:devfrom
himax12:fix/tui-plugin-path-env-expansion-25390
Closed

fix(opencode): support env-prefixed plugin paths in config#25394
himax12 wants to merge 1 commit intoanomalyco:devfrom
himax12:fix/tui-plugin-path-env-expansion-25390

Conversation

@himax12
Copy link
Copy Markdown

@himax12 himax12 commented May 2, 2026

Fixes #25390

tui.json plugin specs using env/home-style prefixes were treated as package names instead of local paths.

What changed:

  • expand ~, $VAR, ${VAR}, and %VAR% prefixes in plugin specs before path resolution
  • keep package specs unchanged
  • add regression tests for $HOME and %USERPROFILE%

Verification:

  • bun --cwd packages/opencode test test/config/config.test.ts --timeout 60000
  • passes locally (82 passed)

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.
Copilot AI review requested due to automatic review settings May 2, 2026 09:48
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label May 2, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/opencode/src/config/plugin.ts
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

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.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label May 2, 2026
@github-actions github-actions Bot closed this May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Allow using $HOME variable in tui.json plugin path

2 participants