(spec: string)
| 173 | } |
| 174 | |
| 175 | export async function resolvePathPluginTarget(spec: string) { |
| 176 | const raw = spec.startsWith("file://") ? fileURLToPath(spec) : spec |
| 177 | const file = path.isAbsolute(raw) || /^[A-Za-z]:[\\/]/.test(raw) ? raw : path.resolve(raw) |
| 178 | const stat = await Filesystem.statAsync(file) |
| 179 | if (!stat?.isDirectory()) { |
| 180 | if (spec.startsWith("file://")) return spec |
| 181 | return pathToFileURL(file).href |
| 182 | } |
| 183 | |
| 184 | if (await Filesystem.exists(path.join(file, "package.json"))) { |
| 185 | return pathToFileURL(file).href |
| 186 | } |
| 187 | |
| 188 | const index = await resolveDirectoryIndex(file) |
| 189 | if (index) return pathToFileURL(index).href |
| 190 | |
| 191 | throw new Error(`Plugin directory ${file} is missing package.json or index file`) |
| 192 | } |
| 193 | |
| 194 | export async function checkPluginCompatibility(target: string, opencodeVersion: string, pkg?: PluginPackage) { |
| 195 | if (!semver.valid(opencodeVersion) || semver.major(opencodeVersion) === 0) return |
no test coverage detected