MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / addFromRequire

Function addFromRequire

crates/opencode-plugin/host/plugin-host.ts:331–339  ·  view source on GitHub ↗
(basePath: string)

Source from the content-addressed store, hash-verified

329 try {
330 const moduleMod = await import("node:module");
331 const addFromRequire = (basePath: string) => {
332 try {
333 const req = moduleMod.createRequire(basePath);
334 const resolved = req.resolve("@opencode-ai/sdk");
335 addCandidate(urlMod.pathToFileURL(resolved).href);
336 } catch {
337 // Try next base path.
338 }
339 };
340 addFromRequire(pathMod.join(process.cwd(), "package.json"));
341 if (pluginFsPath) {
342 addFromRequire(pluginFsPath);

Callers 1

createPluginClientFunction · 0.85

Calls 1

addCandidateFunction · 0.85

Tested by

no test coverage detected