MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / loadLocalPlugins

Function loadLocalPlugins

apps/local/src/executor.ts:61–90  ·  view source on GitHub ↗
(options: LocalExecutorOptions = {})

Source from the content-addressed store, hash-verified

59}
60
61const loadLocalPlugins = (options: LocalExecutorOptions = {}) =>
62 Effect.gen(function* () {
63 const cwd = process.env.EXECUTOR_SCOPE_DIR || process.cwd();
64 const staticPlugins = executorConfig.plugins({
65 activeToolkitSlug: options.activeToolkitSlug,
66 });
67 const dynamicPlugins =
68 (yield* Effect.promise(() => loadPluginsFromJsonc({ path: resolvePluginConfigPath(cwd) }))) ??
69 [];
70
71 const staticPackageNames = new Set(
72 staticPlugins.map((plugin) => plugin.packageName).filter((name): name is string => !!name),
73 );
74 const dedupedDynamic = dynamicPlugins.filter((plugin) => {
75 if (plugin.packageName && staticPackageNames.has(plugin.packageName)) {
76 console.warn(
77 `[executor] plugin "${plugin.packageName}" appears in both ` +
78 `executor.config.ts and executor.jsonc#plugins. The static ` +
79 `entry wins; the jsonc entry is ignored.`,
80 );
81 return false;
82 }
83 return true;
84 });
85
86 return {
87 cwd,
88 plugins: [...staticPlugins, ...dedupedDynamic] as LocalPlugins,
89 };
90 });
91
92interface LocalExecutorBundle {
93 readonly executor: Executor<LocalPlugins>;

Callers 1

createLocalExecutorLayerFunction · 0.85

Calls 3

loadPluginsFromJsoncFunction · 0.90
resolvePluginConfigPathFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected