Bug Description
When installing a plugin from a git URL (e.g., superpowers@git+https://github.com/obra/superpowers.git), opencode fails on Windows because it uses the raw URL as a directory name in the cache path.
Error
ENOENT: no such file or directory, mkdir 'C:\Users\Ivan\.cache\opencode\packages\superpowers@git+https:\github.com\obra\superpowers.git'
Root Cause
The plugin installer constructs the cache directory path by appending the raw package specifier (e.g., superpowers@git+https://github.com/obra/superpowers.git) directly to the packages cache directory. On Windows, the : character and path separators from the URL are invalid in file/directory names, causing mkdir to fail.
The problematic path transforms https:// into https:\ (backslash due to Windows path normalization), which contains a colon — a forbidden character in Windows filenames.
Reproduction Steps
- On Windows, add a git-based plugin to opencode config:
{
"plugins": ["superpowers@git+https://github.com/obra/superpowers.git"]
}
- Run
opencode run --print-logs "hello"
- Observe the ENOENT error during plugin installation
Expected Behavior
The plugin should install successfully. The cache directory name should be derived from a URL-safe encoding (e.g., URL-encoding, hashing, or stripping invalid characters) of the git URL.
Actual Behavior
Installation fails with ENOENT because the cache directory path contains Windows-invalid characters (:).
Environment
| Field |
Value |
| opencode |
1.3.15 |
| Node.js |
v22.22.2 |
| npm |
10.9.7 |
| OS |
Windows 11 Pro |
| Shell |
Git Bash, Powershell, CMD |
Log Excerpt
INFO service=plugin path=superpowers@git+https://github.com/obra/superpowers.git loading plugin
INFO service=npm pkg=superpowers@git+https://github.com/obra/superpowers.git installing package
ERROR service=plugin pkg=superpowers version=git+https://github.com/obra/superpowers.git error=ENOENT: no such file or directory, mkdir 'C:\Users\Ivan\.cache\opencode\packages\superpowers@git+https:\github.com\obra\superpowers.git' failed to install plugin
Suggested Fix
When constructing the cache directory name for git-based plugins, sanitize the URL by either:
- Hashing the URL (e.g., SHA-256 or MD5) to produce a safe directory name
- URL-encoding or replacing invalid characters (
:, /, <, >, |, ?, *) with safe alternatives
- Using a combination of package name prefix + hash suffix for readability
This would also prevent similar issues with other URL-based package specifiers on Windows.
Bug Description
When installing a plugin from a git URL (e.g.,
superpowers@git+https://github.com/obra/superpowers.git), opencode fails on Windows because it uses the raw URL as a directory name in the cache path.Error
Root Cause
The plugin installer constructs the cache directory path by appending the raw package specifier (e.g.,
superpowers@git+https://github.com/obra/superpowers.git) directly to the packages cache directory. On Windows, the:character and path separators from the URL are invalid in file/directory names, causingmkdirto fail.The problematic path transforms
https://intohttps:\(backslash due to Windows path normalization), which contains a colon — a forbidden character in Windows filenames.Reproduction Steps
{ "plugins": ["superpowers@git+https://github.com/obra/superpowers.git"] }opencode run --print-logs "hello"Expected Behavior
The plugin should install successfully. The cache directory name should be derived from a URL-safe encoding (e.g., URL-encoding, hashing, or stripping invalid characters) of the git URL.
Actual Behavior
Installation fails with
ENOENTbecause the cache directory path contains Windows-invalid characters (:).Environment
Log Excerpt
Suggested Fix
When constructing the cache directory name for git-based plugins, sanitize the URL by either:
:,/,<,>,|,?,*) with safe alternativesThis would also prevent similar issues with other URL-based package specifiers on Windows.