fix: convert import.meta.resolve result to file:// URL for plugins#16558
fix: convert import.meta.resolve result to file:// URL for plugins#16558abc-lee wants to merge 1 commit intoanomalyco:devfrom
Conversation
On Windows, import.meta.resolve() returns a raw filesystem path like 'E:\path\to\plugin\index.js' instead of a file:// URL. This causes the plugin name extraction logic to fail, displaying the full path in the UI instead of the plugin name. The fix ensures all resolved plugin paths are consistently converted to file:// URLs, matching the behavior of the require.resolve() fallback. Fixes: Plugin paths displayed incorrectly on Windows
|
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. |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: Based on the search results, here are potential related PRs:
Both PRs appear to address plugin path handling and deduplication issues, which are closely related to the current PR's fix for ensuring consistent file:// URL conversion. These should be reviewed to ensure compatibility and avoid overlapping fixes. |
CI Failure AnalysisThe CI failure is not caused by this PR. The failing test test("uses cwd when spawning commands", async () => {
const out = await Process.run(node("process.stdout.write(process.cwd())"), {
cwd: "/tmp", // ? This path does not exist on Windows
})
expect(out.stdout.toString()).toBe("/tmp")
})This test fails on Windows because My change (in SuggestionThe test should use a cross-platform temp directory approach: import { tmpdir } from "os"
// or use the test fixture mentioned in test/AGENTS.md |
|
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. |
Summary
On Windows,
import.meta.resolve()returns a raw filesystem path instead of afile://URL. This causes the plugin name extraction logic to fail, displaying the full raw path in the UI.How to Test
opencode.json:"plugin": ["oh-my-opencode@latest"]/statusdialogC:\Users\Username\orE:\opencode\oh-my-opencode @latestTest Plan
require.resolve()fallback patternFixes #16559