Refactor into plugin loader and do not enforce (#20112)

This commit is contained in:
Sebastian 2026-03-30 20:36:21 +02:00 committed by GitHub
parent 9f3c2bd861
commit fa95a61c4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 1056 additions and 351 deletions

View file

@ -6,21 +6,14 @@ type PluginSpec = string | [string, Record<string, unknown>]
export function mockTuiRuntime(dir: string, plugin: PluginSpec[]) {
process.env.OPENCODE_PLUGIN_META_FILE = path.join(dir, "plugin-meta.json")
const meta = Object.fromEntries(
plugin.map((item) => {
const spec = Array.isArray(item) ? item[0] : item
return [
spec,
{
scope: "local" as const,
source: path.join(dir, "tui.json"),
},
]
}),
)
const plugin_records = plugin.map((item) => ({
item,
scope: "local" as const,
source: path.join(dir, "tui.json"),
}))
const get = spyOn(TuiConfig, "get").mockResolvedValue({
plugin,
plugin_meta: meta,
plugin_records,
})
const wait = spyOn(TuiConfig, "waitForDependencies").mockResolvedValue()
const cwd = spyOn(process, "cwd").mockImplementation(() => dir)